Re: motion notify question



You make a good point, but my experiments show that if you were to release
in another window which captures releases then the release won't register
in the original widget. Is this your experience, too?

So if you are programming something like a lever, the following
unfortunate combination might happen. Suppose you
1. Press the mouse within the lever.
2. Move it outside the bounds.
3. Release it over another lever.
4. Then press it down elsewhere
5. Move it with in the bounds of the original lever.

As far as the original lever is concerned then is that it's been pressed
down and now the mouse is moving over it with the button pressed. So it
must react which is incorrect. The problem is that it has no way to find
out that it's been released and that another one has been pressed - if
there's no communication between the objects.

The way I solve the problem is by enabling focus and then capturing the
loss of focus, but you would agree that's not very clean...

Pavel



 On 29 Dec 2000, Havoc Pennington wrote:


<pavel klebanov ne mediaone net> writes:

If my widget captures motion_notify and the mouse button is pressed and
the button moves out of the widget, motion_notify keeps firing. Why and is
there a way to disable it?

Of course I could easily test whether the mouse is inside the widget, but
still....


X automatically grabs the pointer while a mouse button is pressed, so
during a press gdk_pointer_grab() has effectively been called.
Among other things, this ensures that you always get a button release
event paired with your press event, which simplifies a lot of code.
So this may complicate your life now, but in other cases it won't. ;-)

Havoc






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]