[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] mouse outside window
Jeremy Biddle wrote:
re zak's get_focus suggestion: unfortunately pygame.mouse.get_focus
always returns true, whether the mouse is in or out, and whether the app
is front or not, so that doesn't seem like it'll help.
is there any way inside pygame (i.e. not hacking the source or SDL) to
determine whether the mouse is in the bounds of the window? i could
still use zak's suggestion of not sending events in this case.
i belive the mouse focus problems are really only with SDL on OSX. it
sounds like they are related because you shouldn't even be getting mouse
motion events when your window doesn't have the mouse focus.
you could test to see if you are getting ACTIVEEVENT's when the mouse is
entering and leaving the window. i have a hunch these won't happen,
since nothing else from SDL seems to acknowledge the mouse has left.
the ACTIVEEVENT has two attributes. "gain" is set to 0 or one depending
if the type of focus was lost or gained. "state" will equal 1 for mouse
focus, 2 for keyboard focus, or 4 for window iconification.