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 608615 - DnD events sent to wrong window
DnD events sent to wrong window
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.19.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-01-31 18:30 UTC by Michal Hruby
Modified: 2010-03-11 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch fixing the problem (4.88 KB, patch)
2010-01-31 18:30 UTC, Michal Hruby
none Details | Review
Version 2 of the patch (7.50 KB, patch)
2010-01-31 20:51 UTC, Michal Hruby
none Details | Review
Fixed patch (8.69 KB, patch)
2010-02-03 12:02 UTC, Michal Hruby
none Details | Review

Description Michal Hruby 2010-01-31 18:30:59 UTC
Created attachment 152689 [details] [review]
Patch fixing the problem

For quite some time DnD on X11 doesn't take any regard on the window input shape mask and therefore when using RGBA windows with masked input shape, DnD events are being sent to incorrect window, which might look as an invisible barrier to the user. This bug is especially known to people using docks, but it can be observed for example also on ubuntu's notify-osd.

Attached is patch for the issue, the only thing that was added is check for toplevel windows' input shape.
Comment 1 Michal Hruby 2010-01-31 20:51:29 UTC
Created attachment 152695 [details] [review]
Version 2 of the patch

I enhanced the patch, now it listens for ShapeNotify events, so if the input mask is changed during the DnD operation, the cached input mask region is invalidated.
Comment 2 Matthias Clasen 2010-02-03 05:06:48 UTC
Review of attachment 152695 [details] [review]:

Do you have an example shaped dnd client to test this with ?

::: gdk/x11/gdkdnd-x11.c
@@ +600,3 @@
 
+static GdkRegion *
+xwindow_get_shape (Display *xdisplay,

Shouldn't duplicate this function from gdkwindow-x11.c here. Instead, change it to 

GdkRegion *_xwindow_get_shape (...)

over there and add a declaration to gdkprivate-x11.h
Comment 3 Michal Hruby 2010-02-03 12:02:25 UTC
Created attachment 152918 [details] [review]
Fixed patch

As I said you can see the problem on for example notify-osd (blocks DnD even though it's not clickable), avant-window-navigator, MacSlow's Cairo Clock... any input shaped app.
Comment 4 Matthias Clasen 2010-02-05 00:20:53 UTC
I've committed a version of your patch that also pays attention to bounding shapes.
Comment 5 Evan Martin (Chromium) 2010-03-10 21:59:08 UTC
It appears this change causes Chromium to crash.  We have tracked it to GTK 2.18.7 which includes this change.  Repro is easy: (1) start (2) click and hold on a tab, drag it an inch up or down (3) drop -- crash.

I don't fully understand the change yet, but it seems from xtrace that a window is destroyed and then we attempt to call more X functions on it.  From the GTK code it appears the child->xid used in free_cache_child() is no longer valid.

It could very well be a Chromium bug, but if the above text and the below stack trace mean anything to you, I'd appreciate the advice.  :)



xtrace:
000:>:3dde: Event DestroyNotify(17) event=0x002002cc window=0x002002cc
...
000:<:3e0e: 12: SHAPE-Request(129,6): ShapeSelectInput destination window=0x002002cc enable=false(0x00)
...
000:>:3e0e:Error 3=Window: major=6, minor=129, bad=2097868

backtrace (note I've compiled my own GTK 2.18.7 since my Jaunty desktop only has .3, which doesn't have the problem):

  • #0 gdk_x_error
    at ../../../gdk/x11/gdkmain-x11.c line 438
  • #1 _XError
    at ../../src/XlibInt.c line 2924
  • #2 process_responses
    at ../../src/xcb_io.c line 207
  • #3 _XReply
    at ../../src/xcb_io.c line 457
  • #4 XSync
    at ../../src/Sync.c line 48
  • #5 _XSyncFunction
    at ../../src/Synchro.c line 37
  • #6 free_cache_child
    at ../../../gdk/x11/gdkdnd-x11.c line 323
  • #7 IA__g_list_foreach
    at /build/buildd/glib2.0-2.22.3/glib/glist.c line 789
  • #8 gdk_window_cache_destroy
    at ../../../gdk/x11/gdkdnd-x11.c line 579
  • #9 gdk_drag_context_finalize
    at ../../../gdk/x11/gdkdnd-x11.c line 198
  • #10 IA__g_object_unref
    at /build/buildd/glib2.0-2.22.3/gobject/gobject.c line 2472
  • #11 gtk_drag_source_info_destroy
    at ../../gtk/gtkdnd.c line 3970
  • #12 gtk_drag_drop_finished
    at ../../gtk/gtkdnd.c line 3612
  • #13 gtk_drag_button_release_cb
  • #14 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 84
  • #15 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.22.3/gobject/gclosure.c line 767
  • #16 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.22.3/gobject/gsignal.c line 3247
  • #17 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.22.3/gobject/gsignal.c line 2990
  • #18 IA__g_signal_emit
    at /build/buildd/glib2.0-2.22.3/gobject/gsignal.c line 3037
  • #19 gtk_widget_event_internal
    at ../../gtk/gtkwidget.c line 4767
  • #20 IA__gtk_propagate_event
    at ../../gtk/gtkmain.c line 2417
  • #21 IA__gtk_main_do_event
    at ../../gtk/gtkmain.c line 1622

Comment 6 Matthias Clasen 2010-03-10 22:20:27 UTC
...Repro is easy:...

It would be easy if chromium were in Fedora...but anyway, I fixed one crasher bug later that sounds exactly like this later on. I don't know if that has made it to the 2.18 branch yet. The commit is

325cbef27edd58b801509a2016aee6ab6e49d2f1

   Protect against X errors when clearing the DND cache
    
   This was reported as a problem in bug 609952.


Can you see if that fixes your crashes ?
Comment 7 Evan Martin (Chromium) 2010-03-10 22:25:51 UTC
Yes, cherry-picking that change atop 2.18.7 works around the problem.  Thanks for the quick response!
Comment 8 Evan Martin (Chromium) 2010-03-10 22:36:52 UTC
PS: it appears that the 2.18 branch only has one other (non-translation) change in it since 2.18.7, so no, it's not in 2.18.