google-code-export / kytten

Automatically exported from code.google.com/p/kytten
1 stars 0 forks source link

Dialog eats all mouse events, even ones not directed to it #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to have a Dialog on screen at the same time as other clickable
(non-Kytten) sprites.

As soon as the dialog appears, the other elements stop receiving click
events, much to my sadness.

Looking at the source it seems like Dialog's handlers unconditionally eat
the mouse events by returning pyglet.event.EVENT_HANDLED (I'm looking at
e.g. on_mouse_release), preventing the event from propagating up the stack
to my sprite.

Is this intentional? I would expect the Dialog only to consume events that
actually affect it, while leaving clicks outside it alone. It would even be
fine if it responded to the events in some way (like defocusing the dialog
or whatever) but then still let it propagate up.

I would really like to use kytten in my game since it's been great
otherwise, so I may just start hacking this to work the way I need it to
anyway.

Original issue reported on code.google.com by ChrisM6794@gmail.com on 3 Sep 2009 at 2:05

GoogleCodeExporter commented 9 years ago
So far I've just been randomly commenting out "return 
pyglet.event.EVENT_HANDLED" all
over the place and it seems to be working okay. There's no telling what else 
I've
managed to break in the process, though.

Original comment by ChrisM6794@gmail.com on 3 Sep 2009 at 5:51

GoogleCodeExporter commented 9 years ago
In 5.8.5 I run into the problem with on_mouse_release, but on_mouse_press and 
on_mouse_drag work fine.

Original comment by agntdr...@gmail.com on 30 Sep 2010 at 12:11

GoogleCodeExporter commented 9 years ago
Seems easy enough to fix.  Attached is a patch that fixes on_mouse_release.  I 
haven't looked at the other mouse events.

Original comment by agntdr...@gmail.com on 5 Oct 2010 at 12:52

Attachments: