Skip to content
  • Matthias Clasen's avatar
    dnd: Fix issues with drag icons under Wayland · 5bb12474
    Matthias Clasen authored
    The Wayland dnd surface must remain in place until the drag
    is over. Setting it directly as the hardcoded window of the
    widget we construct carries the danger that it might get
    destroyed prematurely, e.g. when the application calls
    gtk_drag_set_icon_name more than once and we recreate the
    widget.
    
    Instead, create a dedicated toplevel, and reparent the widget
    into it. To keep the code simple, we use the same approach
    under X11 as well, and make it the responsibility of the
    GDK dnd code to keep the window position updated. We already
    pass the current pointer position to gdk_drag_motion, which
    makes this very easy.
    
    As a side-effect of these changes, it is now possible to use
    non-toplevel widgets as drag icons.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748763
    5bb12474