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 544475 - DnD small custom icon doesn't always show
DnD small custom icon doesn't always show
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: X11
2.13.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-07-24 02:13 UTC by Michael Terry
Modified: 2018-02-10 03:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Vala test program (1.89 KB, text/plain)
2008-07-24 02:14 UTC, Michael Terry
Details
C test program (4.63 KB, text/plain)
2008-07-24 02:14 UTC, Michael Terry
Details

Description Michael Terry 2008-07-24 02:13:09 UTC
This is an odd problem I've encountered.  I've traced it down as much as I can, and am hoping to brain dump here and have someone else pick it up.  :)  I've attached a test case.

The issue is that when you set a drag pixbuf icon smaller than 64x64, the icon may not show up.

Smaller icons use a different code path than larger icons.  In gtkdnd.c:set_icon_stock_pixbuf(), the code branches on whether gdk can use rgba cursors (which boils down to the size of the pixbuf even if all else checks out).  If the pixbuf is too big, gdk uses a window for the drag icon.  If the pixbuf is small and thus it can use rgba cursors, gtk composites the pixbuf and a cursor image into one pixbuf to use for the drag.

In the latter case, when calling XGrabPointer with the composited pixbuf (in gdkmain-x11.c:gdk_pointer_grab()), XGrabPointer returns GrabNotViewable.  That seems to be why the pixbuf never shows.  Why that failure occurs, I'm not sure.

I've attached a test program in vala (as well as the associated C code).  Obviously just the C code is needed, I just figured vala might be more digestable.  The code draws two boxes, each with the same drag handler.  One of the boxes is 65x65, the other is 60x60.  One drags fine, the other disappears when dragged.
Comment 1 Michael Terry 2008-07-24 02:14:02 UTC
Created attachment 115140 [details]
Vala test program
Comment 2 Michael Terry 2008-07-24 02:14:23 UTC
Created attachment 115141 [details]
C test program
Comment 3 Michael Terry 2010-04-06 11:17:47 UTC
A workaround is to use gtk_drag_set_icon_pixmap instead of gtk_drag_set_icon_pixbuf, since the pixmap version does not branch on size.
Comment 4 Matthias Clasen 2018-02-10 03:35:53 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.