GNOME Bugzilla – Bug 405089
Incorrect window placement for GtkEventBox private window
Last modified: 2007-04-28 21:48:20 UTC
The GdkWindow used for event capture in GtkEventBox gets incorrectly positioned when both the "visible window" and "above child" properties are set, and the event_box is not at the top left corner of its parent GdkWindow. The bug manifests itself as getting events from the event box with a pixel offset identical to the eventbox position relative to its parent window. For example, if I create a toplevel with 20 of border_width, and put an event box (with visible window and above child) Demo code available at http://pastebin.ca/337410 , with things to try to see the bug at http://mail.gnome.org/archives/gtk-devel-list/2007-February/msg00001.html The bug seems to be in gtk_event_box_realize at gtkeventbox.c. The conditional at line 402 (all lines relative to gtk 2.10.9 source) succeeds, and the gdk_window_new at line 410 creates a window for the widget. A few lines below, at line 420 the conditional there also succeeds, because "above_child" is true. This results in the event_window in line 425 being created as a child of the widget->window. However, as the attributes and attributes_mask still contain the data used to position the widget->window on its parent, the private->event_window is created with an offset relative to the GtkEventBox. Probably not setting GDK_WA_X and GDK_WA_Y at line 423 when visible_window is true could fix it, but I am not 100% sure and would like some GTK guru to confirm :)
I'm not the GTK+ guru you may want, but could you please attach your test case to this bug report? The pastebin address is no longer available (and having test cases attached to the bug reports is a good manner). Thanks.
Created attachment 85160 [details] [review] a patch I couldn't get at your demo code. Maybe attach it directly ? Anyway, here is a patch that should fix this. Can you try it ?
Created attachment 85441 [details] Test case to see bug behavior
Uh, sorry for not attached before... I had it in pastebin for showing it to someone, and linked instead of thinking it was more useful attached. Anyway, here it is. I will try patch 85160 as soon as I can and tell you about the results (not very very soon, have some busy weeks ahead)
2007-04-28 Matthias Clasen <mclasen@redhat.com> * gtk/gtkeventbox.c (gtk_event_box_realize): Fix the offsets of the input-only window if we also have a visible window. (#405089)