[racket-dev] mouse motion events in Linux

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jul 17 10:12:55 EDT 2011

Thanks! That page is clearer than the docs I read, though I still don't
feel more enlightened. I did eventually conclude that
GDK_POINTER_MOTION_HINT_MASK is orthogonal to GDK_POINTER_MOTION_MASK /
GDK_BUTTON_MOTION_MASK, but adding it back seemed to have no effect on
the mouse events that arrived.

In particular, more mouse-move events arrive than just one after
entering the window --- even without pressing a button or hitting a
key. Maybe something internal to the Gtk widget implementation calls
gdk_window_get_pointer(); in that case, I didn't want the mouse-event
behavior to change (to generate less movement events than `racket/gui'
intends to provide) if the Gtk widget changes to not call
gdk_window_get_pointer(). More generally, since adding
GDK_POINTER_MOTION_HINT_MASK didn't seem to change anything, the safest
course seemed to be leaving it out.

Does adding GDK_POINTER_MOTION_HINT_MASK change the mouse events that
you see on your machine?

At Sun, 17 Jul 2011 15:57:10 +0200, Stephan Houben wrote:
> Hi Matthew,
> 
> On 07/16/2011 10:31 PM, Matthew Flatt wrote:
>  > Short answer: change pushed.
> 
> Thanks for picking this up.
> 
> I see you also removed GDK_POINTER_MOTION_HINT_MASK , which
> means we will be again seeing more motion events than before.
> 
> Please note that GDK_POINTER_MOTION_HINT_MASK is really orthogonal to
> GDK_POINTER_MOTION_MASK / GDK_BUTTON_MOTION_MASK .
> 
> The latter selects in which cases motion events should be sent
> (GDK_POINTER_MOTION_MASK == always, GDK_BUTTON_MOTION_MASK == only
> when a mouse button is pressed).
> 
> The former enables coalescing of motion events so that the application
> doesn't see so many of them. GDK_POINTER_MOTION_HINT_MASK by itself
> doesn't enable the sending of motion events.
> 
> See also:
> http://www.linuxtopia.org/online_books/gui_toolkit_guides/gtk+_gnome_application
> _development/sec-gdkevent_5.html
> 
> (Apology if you knew all this already).
> 
> Note that this page states that if the motion events can be handled quickly 
> (under 5 ms),
> then not using  GDK_POINTER_MOTION_HINT_MASK may be preferable.
> I guess most apps don't do anything with the motion events which is probably
> quite fast indeed.
> 
> Stephan


Posted on the dev mailing list.