After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 572986 - MOTION_HINT does not work
MOTION_HINT does not work
Status: RESOLVED DUPLICATE of bug 565405
Product: pygtk
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-24 14:36 UTC by Guillaume Bouchard
Modified: 2009-02-24 14:50 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24



Description Guillaume Bouchard 2009-02-24 14:36:34 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();
}
Comment 1 Guillaume Bouchard 2009-02-24 14:44:44 UTC
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.
Comment 2 Guillaume Bouchard 2009-02-24 14:50:14 UTC

*** This bug has been marked as a duplicate of 565405 ***