GNOME Bugzilla – Bug 572986
MOTION_HINT does not work
Last modified: 2009-02-24 14:50:14 UTC
Please describe the problem: gtk.gdk.POINTER_MOTION_HINT_MASK does not change the behavior of MOTION_NOTIFY_EVENT. On the documentation we can read that http://www.pygtk.org/pygtk2tutorial/sec-EventHandling.html "When we specify POINTER_MOTION_HINT_MASK, the server sends us a motion event the first time the pointer moves after entering our window, or after a button press or release event. Subsequent motion events will be suppressed until we explicitly ask for the position of the pointer using the gtk.gdk.Window method" Steps to reproduce: 1. Create a pygtk application with MOTION_NOTIFY_EVENT like that : import gtk def callback(widget,event): print "Called is_hint = %d"%event.is_hint window = gtk.Window() view = gtk.DrawingArea() view.connect('motion-notify-event',callback) view.add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK) window.add(view) window.show_all() gtk.main() 2. Launch it 3. Move the mouse on your window Actual results: The console is full of traces. Expected results: The console must only have one trace Does this happen every time? Yes Other information: This is a C version of this program, and we can see that the callback is called less times. Which is near the behavior on the documentation (but I still wonder why the callback is not called just once ?) ----------------------- #include <gtk/gtk.h> #include <stdio.h> void callback(GtkWidget *widget, GdkEventMotion *event) { printf("Called is_hint = %d\n",event->is_hint); } int main(int argc,char**argv) { GtkWidget *window,*view; gtk_init(&argc,&argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); view = gtk_drawing_area_new(); gtk_signal_connect(GTK_OBJECT(view),"motion-notify-event",callback,NULL); gtk_widget_add_events(GTK_WIDGET(view), GDK_POINTER_MOTION_MASK |GDK_POINTER_MOTION_HINT_MASK); gtk_container_add(GTK_CONTAINER(window),view); gtk_widget_show_all(window); gtk_main(); }
I found this message : http://www.daa.com.au/pipermail/pygtk/2008-December/016387.html from an user which seem to have the same problem (December 2008) on the mailing list, with no answer.
*** This bug has been marked as a duplicate of 565405 ***