[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] virtual input mode on Linux



Hello,

I am trying to use pygame for its virtual input mode where the mouse doesn't stop reporting its relative position at the edges of the screen. That's really all I need from it... just the mouse position and some button clicks. So I wrote a piece of code below and it works great on a mac and windows but not correctly on linux. On linux the pointer seems to stop at the edges of the pygame window (it doesn't even get to the edges of the screen). At the edges it just keeps reporting (0,0) for dx, dy. Any idea why this might be happening when everything works fine on win/mac??

System Info:
 - Suse 10.2
 - Python 2.5
 - gtk2-2.10
 - SDL 1.2.11


Here's the code that I am using on all the platforms:

import pygame
pygame.init()
pygame.display.set_mode((300,200))
runThread = True

pygame.mouse.set_visible(False)
pygame.event.set_grab(True)

while runThread:
    time.sleep(0.01)
    e = pygame.event.wait()
            
    if e.type == pygame.MOUSEMOTION :
        print "relative mouse motion: ", e.rel
       
    elif e.type == pygame.KEYDOWN:
        print "quitting pygame window"
        runThread = False
                    
pygame.mouse.set_visible(True)
pygame.event.set_grab(False)
pygame.quit()


Thanks,
Ratko