Merge branch 'x11-dnd-fix' into 'master'

Fix dnd on X11

See merge request GNOME/gtk!1899
This commit is contained in:
Matthias Clasen 2020-05-14 13:10:54 +00:00
commit 38f09ac38e
5 changed files with 13 additions and 7 deletions

View File

@ -53,12 +53,12 @@ drag_end (GtkDragSource *source,
gtk_widget_set_opacity (item, 1.0);
}
static void
static gboolean
drag_cancel (GtkDragSource *source,
GdkDrag *drag,
GdkDragCancelReason reason)
{
drag_end (source, drag);
return FALSE;
}
typedef struct {
@ -204,7 +204,7 @@ pressed_cb (GtkGesture *gesture,
gtk_popover_set_has_arrow (GTK_POPOVER (menu), FALSE);
gtk_popover_set_pointing_to (GTK_POPOVER (menu), &(GdkRectangle){ x, y, 1, 1});
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_append (GTK_BOX (menu), box);
gtk_popover_set_child (GTK_POPOVER (menu), box);
item = gtk_button_new_with_label ("New");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);

View File

@ -2028,6 +2028,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
x11_drag->ipc_surface = ipc_surface;
if (gdk_x11_surface_get_group (surface))
gdk_x11_surface_set_group (x11_drag->ipc_surface, surface);
gdk_synthesize_surface_state (x11_drag->ipc_surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
gdk_x11_surface_show (x11_drag->ipc_surface, FALSE);
x11_drag->drag_surface = create_drag_surface (display);

View File

@ -625,11 +625,11 @@ xdnd_position_filter (GdkSurface *surface,
if (drop_x11->enter_emitted)
{
gdk_drop_emit_motion_event (drop, FALSE, drop_x11->last_x - surface->x, drop_x11->last_y - surface->y, time);
gdk_drop_emit_motion_event (drop, FALSE, drop_x11->last_x - impl->abs_x, drop_x11->last_y - impl->abs_y, time);
}
else
{
gdk_drop_emit_enter_event (drop, FALSE, drop_x11->last_x - surface->x, drop_x11->last_y - surface->y, time);
gdk_drop_emit_enter_event (drop, FALSE, drop_x11->last_x - impl->abs_x, drop_x11->last_y - impl->abs_y, time);
drop_x11->enter_emitted = TRUE;
}
}
@ -662,9 +662,10 @@ xdnd_drop_filter (GdkSurface *surface,
(drop_x11->source_window == source_window))
{
GdkSurface *s = gdk_drop_get_surface (drop);
GdkX11Surface *si = GDK_X11_SURFACE (s);
gdk_x11_surface_set_user_time (s, time);
gdk_drop_emit_drop_event (drop, FALSE, drop_x11->last_x - s->x, drop_x11->last_y - s->y, time);
gdk_drop_emit_drop_event (drop, FALSE, drop_x11->last_x - si->abs_x, drop_x11->last_y - si->abs_y, time);
}
return TRUE;

View File

@ -5128,7 +5128,10 @@ gdk_x11_drag_surface_present (GdkDragSurface *drag_surface,
GdkSurface *surface = GDK_SURFACE (drag_surface);
gdk_x11_surface_toplevel_resize (surface, width, height);
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
_gdk_surface_update_viewable (surface);
gdk_x11_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
return TRUE;
}

View File

@ -436,7 +436,7 @@ gtk_drag_source_cancel_cb (GdkDrag *drag,
gboolean success = FALSE;
g_signal_emit (source, signals[DRAG_CANCEL], 0, source->drag, reason, &success);
drag_end (source, FALSE);
drag_end (source, success);
}
static void