Hi
Thank you for your implementation.
I have been playing all evening along with your patch. But I run into a
problem: it only appears to work if I press a key!!
Not sure what is going on. After adding print statements I see that the
"_event_raw_input" is not called when I move the mouse, but as soon as I
exit exclusive mouse mode all wm_input events are played back! Its like
they are queued up but don't get to the window for processing (or the
window does not pull them correctly).
I was trying to decode the event_handlers and such and it seems that
somehow the wm_input is either not called from windowproc or I missed
something. Or maybe raw input has to be processed differently? It looks
to me that the event loop is preventing events in between calls to the
"dispatch_events" method. Could that be a problem?
According to the docs there is a "DefRawInputProc" method. I have tried
to call that method without success [1].
I have no clue at the moment what makes the wm_input events to be
processed by a key stroke!
2h later...
I think I have found the missing part in pyglet/app/win32.py
def step(self, timeout=None):
self.dispatch_posted_events()
msg = types.MSG()
if timeoutis None:
timeout = constants.INFINITE
else:
timeout =int(timeout *1000)# milliseconds result =
_user32.MsgWaitForMultipleObjects(
self._wait_objects_n, self._wait_objects_array, False, timeout,
constants.QS_ALLINPUT|*constants.QS_RAWINPUT*)
result -= constants.WAIT_OBJECT_0
if result ==self._wait_objects_n:
while _user32.PeekMessageW(ctypes.byref(msg), 0, 0, 0,
constants.PM_REMOVE):
print("step PeekMessageW", msg)
_user32.TranslateMessage(ctypes.byref(msg))
_user32.DispatchMessageW(ctypes.byref(msg))
elif 0 <= result <self._wait_objects_n:
object, func =self._wait_objects[result]
func()
# Return True if timeout was interrupted. return result
<=self._wait_objects_n
In the "MsgWaitForMultipleObjects" call the QS_RAWINPUT is missing to
wake the event processing up if there is a raw input message.
[1]
Adding those lines before the "return 0" statement in _event_raw_input:
# else: # print("raw_input DefRawInputProc") #
_user32.DefRawInputProc(byref(inp), 1, size_of_raw_input_header)
On 12.11.2017 15:29, Daniel Gillet wrote:
Hello DR0ID,
Could you please try my code at this
commit: https://bitbucket.org/dangillet/pyglet/commits/3bc4106e4dc1303d0737b657aff9f949239ece40
?
I've implemented RawInputs in Windows for mouse exclusive mode.
You can also find a test case in
tests/interactive/window/test_window_events.py called
EVENT_MOUSEMOTION_EXCLUSIVE. If you have pytest installed, you can
launch it from the tests/interactive folder with the command py.test
window\test_window_events.py::EVENT_MOUSEMOTION_EXCLUSIVE. Otherwise
you can run all the other tests as well.
Please let me know if that fixes the problem for you.
Dan
--
You received this message because you are subscribed to the Google
Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.