GNOME Bugzilla – Bug 656288
enter/leave-notify-event thrown when it should not
Last modified: 2012-01-22 08:15:38 UTC
Hi! I've found the bug while developing a new tool for Shotwell. The thing is that in Unity, Vala GTK+ programs throws enter/leave-notify-event when you click in a Gtk.DrawingArea. Although I've corrected the wrong behavior in Shotwell [1], I've continued investigating the problems with leave_notify_event and Unity and I'm getting weird behavior :S I attach two test cases I've created modifying Cairo-with-GTK+ examples using both Vala and C. Vala original program is at [2] and the C one is in one CVS repository at [3]. I've also prepared a without-Cairo version which has the same behavior. Let me explain that I found: [NOTE] By non-Unity I mean a Linux Mint 10 system with Gnome 2.32.0 and no Unity; by Unity I mean an Ubuntu Natty system with Gnome 2.32.1 and Unity, running in a VirtualBox virtual machine. Vala version is 0.12 (but I also tested the non-Unity test case with Vala 0.13.1.107-9b5a with the same behavior). * With C sample & Unity system -> If the program has a transient window, you'll get enter_notify_event and leave_notify_event each time you click the DrawingArea. If not, all works fine. * With C sample & non-Unity system -> All works fine. * With Vala sample & Unity system -> If the program has a transient window, you'll get enter_notify_event and leave_notify event each time you click the DrawingArea. If not, you'll only get enter_notify_event :S * With Vala sample & non-Unity system -> You'll get enter_notify_event, no matter if the program has the transient window or not. So, as you can see, this looks like an error in Unity, but the thing is that I've added a new system to the tests: Ubuntu 11.10 Alpha 3 with Gnome 3.1.4, with Unity but without 3D effects (VirtualBox, I'm not able to get 3D effects work); and in this system I see the problem with enter_notify_event but not the one with leave_notify_event, no matter if the transient window is present or not --so, it acts the same like in non-Unity systems. It seems that they've changed something in Unity that suppressed the leave_notify_event error in Ubuntu Oneiric, and the enter_notify_event is also present in a non-Unity system as I report above, so... it seems to be a Vala bug --I'm discarding Compiz because I have no 3D effects working in my Ubuntu Oneiric virtual machine. What do you think about this? [1] http://redmine.yorba.org/issues/3896 [2] http://live.gnome.org/Vala/CairoSample [3] http://webcvs.cairographics.org/cairo-demo/gtk/
Created attachment 193562 [details] C sample
Created attachment 193563 [details] Vala sample with Cairo
Created attachment 193564 [details] Vala sample without Cairo
1. Please send just files instead of tarballs 2. Please structure code in the same way if possible. It allows to easly compare the generated code with C sample 3. gtk_widget_add_events and drawing_area.add_events have different masks to begin with. 4. Vala produces nearly 1-1 translation to C so it should not 'surpress' events in any way. Compare code generated by Vala and the one from C.
Reported also to: https://bugs.launchpad.net/unity/+bug/824013
(In reply to comment #4) > 1. Please send just files instead of tarballs > 2. Please structure code in the same way if possible. It allows to easly > compare the generated code with C sample > 3. gtk_widget_add_events and drawing_area.add_events have different masks to > begin with. You are more than right. I've continued playing with it and simply adding Gdk.EventMask.BUTTON_PRESS_MASK suppresses the wrong behavior in Vala version, and not adding GDK_BUTTON_PRESS_MASK enables the problem in C version. So, bug in GTK+? I've continued searching and I've found an unconfirmed bug with the same thing reported more than two years ago: https://bugzilla.gnome.org/show_bug.cgi?id=556006 I'm going to test it better first and I'll attach my C test case (simplified without Cairo stuff) to there. > 4. Vala produces nearly 1-1 translation to C so it should not 'surpress' events > in any way. Compare code generated by Vala and the one from C.
I'm closing since it seems like a problem with GTK+ (or possibly Unity), not Vala, but please reopen if this turns out not to be the case.