Merge branch 'x11-dnd-fixes' into 'master'
X11 dnd fixes See merge request GNOME/gtk!1464
This commit is contained in:
@@ -3587,6 +3587,10 @@ gdk_surface_register_dnd (GdkSurface *surface)
|
||||
* probably want to set up the drag icon using the surface returned
|
||||
* by gdk_drag_get_drag_surface().
|
||||
*
|
||||
* This function returns a reference to the GdkDrag object, but GTK
|
||||
* keeps its own reference as well, as long as the DND operation is
|
||||
* going on.
|
||||
*
|
||||
* Note: if @actions include %GDK_ACTION_MOVE, you need to listen for
|
||||
* the #GdkDrag::dnd-finished signal and delete the data at the source
|
||||
* if gdk_drag_get_selected_action() returns %GDK_ACTION_MOVE.
|
||||
|
||||
@@ -900,16 +900,12 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
|
||||
|
||||
if (drag)
|
||||
{
|
||||
g_object_ref (drag);
|
||||
|
||||
drag_x11 = GDK_X11_DRAG (drag);
|
||||
if (drag_x11->version == 5)
|
||||
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
|
||||
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
|
||||
|
||||
g_object_unref (drag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1714,8 +1710,8 @@ gdk_x11_drag_default_output_handler (GOutputStream *stream,
|
||||
|
||||
static gboolean
|
||||
gdk_x11_drag_xevent (GdkDisplay *display,
|
||||
const XEvent *xevent,
|
||||
gpointer data)
|
||||
const XEvent *xevent,
|
||||
gpointer data)
|
||||
{
|
||||
GdkDrag *drag = GDK_DRAG (data);
|
||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||
@@ -1876,8 +1872,8 @@ gdk_x11_drag_release_selection (GdkDrag *drag)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
gdk_x11_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
|
||||
GdkDragAnim *anim;
|
||||
@@ -1896,6 +1892,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
|
||||
if (success)
|
||||
{
|
||||
gdk_surface_hide (x11_drag->drag_surface);
|
||||
g_object_unref (drag);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1928,6 +1925,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
|
||||
gdk_drag_anim_timeout, anim,
|
||||
(GDestroyNotify) gdk_drag_anim_destroy);
|
||||
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
|
||||
g_object_unref (drag);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2072,13 +2070,15 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
|
||||
NULL);
|
||||
x11_drag = GDK_X11_DRAG (drag);
|
||||
|
||||
g_signal_connect (display, "xevent", G_CALLBACK (gdk_x11_drag_xevent), drag);
|
||||
|
||||
precache_target_list (drag);
|
||||
|
||||
gdk_device_get_position (device, &px, &py);
|
||||
x_root = round (px) + dx;
|
||||
y_root = round (py) + dy;
|
||||
|
||||
gdk_x11_surface_get_root_coords (surface,
|
||||
round (px) + dx,
|
||||
round (py) + dy,
|
||||
&x_root,
|
||||
&y_root);
|
||||
|
||||
x11_drag->start_x = x_root;
|
||||
x11_drag->start_y = y_root;
|
||||
@@ -2099,7 +2099,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
|
||||
g_object_unref (drag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
move_drag_surface (drag, x_root, y_root);
|
||||
|
||||
x11_drag->timestamp = gdk_display_get_last_seen_time (display);
|
||||
@@ -2115,6 +2115,11 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
g_signal_connect_object (display, "xevent", G_CALLBACK (gdk_x11_drag_xevent), drag, 0);
|
||||
/* backend holds a ref until gdk_drag_drop_done is called */
|
||||
g_object_ref (drag);
|
||||
|
||||
return drag;
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,12 @@ GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
void gdk_x11_surface_get_root_coords (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint *root_x,
|
||||
gint *root_y);
|
||||
|
||||
GdkGrabStatus _gdk_x11_convert_grab_status (gint status);
|
||||
|
||||
cairo_surface_t * _gdk_x11_display_create_bitmap_surface (GdkDisplay *display,
|
||||
|
||||
@@ -2402,7 +2402,7 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
gdk_x11_surface_get_root_coords (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
|
||||
Reference in New Issue
Block a user