odyaka341 / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

evdev processing of events #437

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open a tablet like-device with evdev
2. create handlers for the x/y axes
3. use the values of each event for drawing

Paste in the traceback or error message:

No traceback. What you will get is a stair-drawing, due to the fact that
both x/y axes need to be updated before you can use any one of these
events. However, within an event handler it is impossible to know when that
has happened. What is required is to be able to delay the events until all
of a group have arrived, and issue a grouped event, or issue the grouped
event if any has been updated at the end of the event collection by evdev.

Fixed with: http://hg.codeflow.org/pyglet/rev/eac3f8cd9761

Original issue reported on code.google.com by pyalot@gmail.com on 14 Aug 2009 at 2:16

GoogleCodeExporter commented 8 years ago

Original comment by Nicolas.Rougier@gmail.com on 15 Aug 2009 at 1:47

GoogleCodeExporter commented 8 years ago
Has this patch been tested? The following line doesn't make any sense to me:

if len(self.seen) == self.controls:

As best I can tell, self.controls should be a tuple, so this condition will 
never be true, and the ControlGroup will 
never trigger. 

Original comment by m.e.w.ol...@gmail.com on 16 Aug 2009 at 3:36

GoogleCodeExporter commented 8 years ago

Original comment by m.e.w.ol...@gmail.com on 16 Aug 2009 at 3:55

GoogleCodeExporter commented 8 years ago
You're ignoring that EventGroups also get triggered at the end of the select, 
which
is what is working for me. You can patch it with:

--- a/pyglet/input/base.py  Sun Aug 16 14:13:10 2009 +0200
+++ b/pyglet/input/base.py  Sun Aug 16 20:03:25 2009 +0200
@@ -130,7 +130,7 @@ class ControlGroup(EventDispatcher):

     def event_for(self, control):
         self.seen.add(control)
-        if len(self.seen) == self.controls:
+        if len(self.seen) == len(self.controls):
             self.trigger()

     def trigger(self):

On any account, you do *need* to group events sometimes (for instance for a 
tablet).

Original comment by pyalot@gmail.com on 16 Aug 2009 at 6:04

GoogleCodeExporter commented 8 years ago
I'm not disputing the need for this patch. It seems like it fills a very real 
need. I was just asking, given that I 
don't have a Linux box to test on, whether it actually worked. The fact that it 
contained code that was obviously 
never executed felt slightly odd to me.

Original comment by m.e.w.ol...@gmail.com on 16 Aug 2009 at 9:47

GoogleCodeExporter commented 8 years ago
If you've got a better idea how to correlate events over time be my guest.

Original comment by pyalot@gmail.com on 17 Aug 2009 at 6:08