forked from AuroraMiddleware/gtk
wayland: Store the current drag operation
Use it to detect local drags when creating drop objects.
This commit is contained in:
parent
ff38d38444
commit
66bd54d14c
@ -246,6 +246,7 @@ struct _GdkWaylandSeat
|
||||
GdkClipboard *clipboard;
|
||||
GdkClipboard *primary_clipboard;
|
||||
struct wl_data_device *data_device;
|
||||
GdkDragContext *drag;
|
||||
GdkDrop *drop;
|
||||
|
||||
/* Source/dest for non-local dnd */
|
||||
@ -1263,7 +1264,7 @@ data_device_enter (void *data,
|
||||
seat->pending_builder = NULL;
|
||||
seat->pending_offer = NULL;
|
||||
|
||||
seat->drop = gdk_wayland_drop_new (device, formats, dest_surface, offer, serial);
|
||||
seat->drop = gdk_wayland_drop_new (device, seat->drag, formats, dest_surface, offer, serial);
|
||||
|
||||
gdk_wayland_seat_discard_pending_offer (seat);
|
||||
|
||||
@ -4597,6 +4598,7 @@ gdk_wayland_seat_finalize (GObject *object)
|
||||
gdk_wayland_pointer_data_finalize (&seat->pointer_info);
|
||||
/* FIXME: destroy data_device */
|
||||
g_clear_object (&seat->keyboard_settings);
|
||||
g_clear_object (&seat->drag);
|
||||
g_clear_object (&seat->drop);
|
||||
g_clear_object (&seat->clipboard);
|
||||
g_clear_object (&seat->primary_clipboard);
|
||||
@ -5137,6 +5139,15 @@ gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDragContext *context)
|
||||
{
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
|
||||
g_set_object (&wayland_seat->drag, context);
|
||||
}
|
||||
|
||||
struct wl_data_device *
|
||||
gdk_wayland_device_get_data_device (GdkDevice *gdk_device)
|
||||
{
|
||||
|
@ -193,6 +193,9 @@ gdk_wayland_drag_context_drop_done (GdkDragContext *context,
|
||||
gboolean success)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkDevice *device = gdk_drag_context_get_device (context);
|
||||
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), context);
|
||||
|
||||
if (success)
|
||||
{
|
||||
@ -387,9 +390,11 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland;
|
||||
GdkDragContext *context;
|
||||
GdkSeat *seat;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
|
||||
seat = gdk_device_get_seat (device);
|
||||
|
||||
context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT,
|
||||
"device", device,
|
||||
@ -411,13 +416,15 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
gdk_to_wl_actions (actions));
|
||||
}
|
||||
|
||||
gdk_wayland_seat_set_drag (seat, context);
|
||||
|
||||
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
|
||||
context_wayland->data_source,
|
||||
gdk_wayland_surface_get_wl_surface (surface),
|
||||
context_wayland->dnd_wl_surface,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
|
||||
gdk_seat_ungrab (gdk_device_get_seat (device));
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ gdk_wayland_drop_init (GdkWaylandDrop *drop)
|
||||
|
||||
GdkDrop *
|
||||
gdk_wayland_drop_new (GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
struct wl_data_offer *offer,
|
||||
@ -271,6 +272,7 @@ gdk_wayland_drop_new (GdkDevice *device,
|
||||
|
||||
drop = g_object_new (GDK_TYPE_WAYLAND_DROP,
|
||||
"device", device,
|
||||
"drag", drag,
|
||||
"formats", formats,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
|
@ -105,6 +105,7 @@ void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
|
||||
int x,
|
||||
int y);
|
||||
GdkDrop * gdk_wayland_drop_new (GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
struct wl_data_offer *offer,
|
||||
@ -192,6 +193,8 @@ struct gtk_surface1 * gdk_wayland_surface_get_gtk_surface (GdkSurface *surface);
|
||||
|
||||
void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
|
||||
GdkCursor *cursor);
|
||||
void gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDragContext *drag);
|
||||
|
||||
struct wl_output *gdk_wayland_surface_get_wl_output (GdkSurface *surface);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user