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 405089 - Incorrect window placement for GtkEventBox private window
Incorrect window placement for GtkEventBox private window
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.10.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-02-06 19:26 UTC by dmoisset
Modified: 2007-04-28 21:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a patch (539 bytes, patch)
2007-03-23 05:56 UTC, Matthias Clasen
none Details | Review
Test case to see bug behavior (3.14 KB, text/x-csrc)
2007-03-28 12:55 UTC, dmoisset
  Details

Description dmoisset 2007-02-06 19:26:56 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 :)
Comment 1 Claudio Saavedra 2007-03-22 18:46:35 UTC
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.
Comment 2 Matthias Clasen 2007-03-23 05:56:39 UTC
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 ?
Comment 3 dmoisset 2007-03-28 12:55:00 UTC
Created attachment 85441 [details]
Test case to see bug behavior
Comment 4 dmoisset 2007-03-28 12:56:59 UTC
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)
Comment 5 Matthias Clasen 2007-04-28 21:48:20 UTC
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)