Re: [pygame] BUG: Different events when I enable OpenGL

2009-11-21 Thread René Dudfield
hi,

opengl uses a slighty different video and event driver.  So that
explains the different behaviour.

probably have a better chance of it getting fixed if you report your
bug here:  bugzilla.libsdl.org

I'm guessing that the stylus uses a different method of updating the
mouse position... and the opengl method of getting events is not
working.

Maybe a work around would be to use pygame.mouse.get_pos()  ?


cu,


On Sat, Nov 21, 2009 at 6:27 AM, Thomas  Hansen thomas.han...@gmail.com wrote:
 If I enable OpenGL on my display, teh evebnt system starts behaving
 differntly.
  The following code prints all the events I am interrested in if i do
 not
 enable OpenGL.  If I enable it however, events from the touchscreen
 and stylus
 are not reaching the event queue.

 Note that this also happens for the simulated mouse events that
 windows
 generates for these input devices. When I dont enable OpenGL, and just
 get the
 normal mouse events (no fancy windows touchwindow, or using
 pymt.SYWMEVENT),
 everything is fine.  If I enable OpenGL however, mouse events are not
 generated
 when I use touch or stylus (although they move/controll the system
 mouse
 cursor)

 I am using pygame 1.9.1 with Python 2.6.2 on Windows 7.


 import pygame
 import ctypes

 #if I uncomment this line, the window does not produce teh same events
 #without it it works just fine!!
 #display_flag = pygame.OPENGL

 pygame.display.quit()
 pygame.display.init()
 pygame.display.set_mode((320, 240) display_flag)
 pygame.event.set_allowed(pygame.SYSWMEVENT)

 pygame.display.set_caption('pymt')
 hwnd = ctypes.windll.user32.FindWindowA(None, pymt)
 ctypes.windll.user32.RegisterTouchWindow(hwnd, 0)

 while True:
    for event in pygame.event.get():
        if event.type == pygame.SYSWMEVENT:
            print event



Re: [pygame] BUG: Different events when I enable OpenGL

2009-11-21 Thread Thomas Hansen
I see, I'll let the libsdl folks know, and see what they think about
that.  The get_mouse thing might work for teh stylus, but not for
multi-touch :(

Is there a way to inject code, or attach handlers to the actual
underlying system window (instead of teh SDL abstraction) from python?
 SDL must handle the windows mesage somewhere, but I dont know if that
is accessible at all through python.  i tried using win32 hooks, but I
cant inject python code (the code has to be in a dll).  I dont really
want to change the code in C/C++, because it would require user to
compile a custom version.

--
Thomas


--
Thomas

On Sat, Nov 21, 2009 at 2:50 AM, René Dudfield ren...@gmail.com wrote:
 hi,

 opengl uses a slighty different video and event driver.  So that
 explains the different behaviour.

 probably have a better chance of it getting fixed if you report your
 bug here:  bugzilla.libsdl.org

 I'm guessing that the stylus uses a different method of updating the
 mouse position... and the opengl method of getting events is not
 working.

 Maybe a work around would be to use pygame.mouse.get_pos()  ?


 cu,


 On Sat, Nov 21, 2009 at 6:27 AM, Thomas  Hansen thomas.han...@gmail.com 
 wrote:
 If I enable OpenGL on my display, teh evebnt system starts behaving
 differntly.
  The following code prints all the events I am interrested in if i do
 not
 enable OpenGL.  If I enable it however, events from the touchscreen
 and stylus
 are not reaching the event queue.

 Note that this also happens for the simulated mouse events that
 windows
 generates for these input devices. When I dont enable OpenGL, and just
 get the
 normal mouse events (no fancy windows touchwindow, or using
 pymt.SYWMEVENT),
 everything is fine.  If I enable OpenGL however, mouse events are not
 generated
 when I use touch or stylus (although they move/controll the system
 mouse
 cursor)

 I am using pygame 1.9.1 with Python 2.6.2 on Windows 7.


 import pygame
 import ctypes

 #if I uncomment this line, the window does not produce teh same events
 #without it it works just fine!!
 #display_flag = pygame.OPENGL

 pygame.display.quit()
 pygame.display.init()
 pygame.display.set_mode((320, 240) display_flag)
 pygame.event.set_allowed(pygame.SYSWMEVENT)

 pygame.display.set_caption('pymt')
 hwnd = ctypes.windll.user32.FindWindowA(None, pymt)
 ctypes.windll.user32.RegisterTouchWindow(hwnd, 0)

 while True:
    for event in pygame.event.get():
        if event.type == pygame.SYSWMEVENT:
            print event




Re: [pygame] BUG: Different events when I enable OpenGL

2009-11-21 Thread Brian Fisher
On Fri, Nov 20, 2009 at 9:27 PM, Thomas Hansen thomas.han...@gmail.comwrote:

 pygame.display.set_caption('pymt')
 hwnd = ctypes.windll.user32.FindWindowA(None, pymt)
 ctypes.windll.user32.RegisterTouchWindow(hwnd, 0)

 Hey Thomas,
  you may want to double check that the hwnd you are getting is the right
one - those windows funcs would execute without an exception if they had
some kind of error or problem.

Also, the normal way to get an hwnd in pygame is this:

hwnd = pygame.display.get_wm_info()['window']

So you might want to do a quick check to see if the value from the
FindWindowA func matched what get_wm_info gives you.