GNOME Bugzilla – Bug 606453
button-release-event no longer fires unless BUTTON_PRESS_MASK
Last modified: 2010-01-15 11:22:28 UTC
Created attachment 151065 [details] small test script showing the problem In past versions of pygtk, I've been able to do this: self.drawing_area.set_events(gtk.gdk.EXPOSURE_MASK | gtk.gdk.BUTTON_RELEASE_MASK ) self.drawing_area.connect("button-release-event", self.button_event) and the button release events would fire. With 2.16.0, I have to do this: self.drawing_area.set_events(gtk.gdk.EXPOSURE_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK ) self.drawing_area.connect("button-release-event", self.button_event) The button release doesn't fire unless I have both BUTTON_RELEASE_MASK *and* BUTTON_PRESS_MASK. I can't find any documentation anywhere that mentions this, so I'm guessing it's a regression and not intentional. For instance, googling "button-release-event" BUTTON_PRESS_MASK site:pygtk.org finds nothing.
*If* there is a regression it cannot be in PyGTK itself since we don't do anything special with events, reassigning to GTK itself.
This is the same issue as: http://mail.gnome.org/archives/gtk-devel-list/2009-October/msg00087.html The example you show only works with a non-reparenting WM (like compiz), and is not a good way to code for the reasons listed in the mail above. To work in gtk 2.18 and in 2.16 with some WMs you just have to also select for button presses.