[gtk+] wayland: Ensure we have a drop-side GdkDragContext without pointer
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Ensure we have a drop-side GdkDragContext without pointer
- Date: Thu, 19 Nov 2015 23:15:06 +0000 (UTC)
commit c4f5fd111c5e6f8b9b92f029d357019430dafb6b
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Nov 20 00:07:36 2015 +0100
wayland: Ensure we have a drop-side GdkDragContext without pointer
This GdkDragContext should be created even if we don't have pointer
capabilities. Make it created on add_seat(), and only set the device
on wl_seat.capabilities, so it can be set to either master pointer.
https://bugzilla.gnome.org/show_bug.cgi?id=741066
gdk/wayland/gdkdevice-wayland.c | 11 +++++++----
gdk/wayland/gdkdnd-wayland.c | 5 +----
gdk/wayland/gdkprivate-wayland.h | 3 +--
3 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index cce562e..74aba25 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2047,8 +2047,6 @@ seat_handle_capabilities (void *data,
device_manager->devices =
g_list_prepend (device_manager->devices, device->pointer);
- device->drop_context = _gdk_wayland_drop_context_new (device->master_pointer,
- device->data_device);
if (wayland_display->pointer_gestures)
{
device->wl_pointer_gesture_swipe =
@@ -2079,8 +2077,6 @@ seat_handle_capabilities (void *data,
device_manager->devices =
g_list_remove (device_manager->devices, device->pointer);
- g_clear_object (&device->drop_context);
-
g_signal_emit_by_name (device_manager, "device-removed", device->pointer);
g_object_unref (device->pointer);
device->pointer = NULL;
@@ -2181,6 +2177,11 @@ seat_handle_capabilities (void *data,
device->touch_master = NULL;
device->touch = NULL;
}
+
+ if (device->master_pointer)
+ gdk_drag_context_set_device (device->drop_context, device->master_pointer);
+ else if (device->touch_master)
+ gdk_drag_context_set_device (device->drop_context, device->touch_master);
}
static void
@@ -2362,6 +2363,7 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
device->data_device =
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
device->wl_seat);
+ device->drop_context = _gdk_wayland_drop_context_new (device->data_device);
wl_data_device_add_listener (device->data_device,
&data_device_listener, device);
@@ -2394,6 +2396,7 @@ _gdk_wayland_device_manager_remove_seat (GdkDeviceManager *manager,
wl_surface_destroy (device->pointer_surface);
/* FIXME: destroy data_device */
g_clear_object (&device->keyboard_settings);
+ g_clear_object (&device->drop_context);
g_hash_table_destroy (device->touches);
gdk_window_destroy (device->foreign_dnd_window);
stop_key_repeat (device);
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 6f95b07..7095686 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -387,8 +387,7 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
}
GdkDragContext *
-_gdk_wayland_drop_context_new (GdkDevice *device,
- struct wl_data_device *data_device)
+_gdk_wayland_drop_context_new (struct wl_data_device *data_device)
{
GdkWaylandDragContext *context_wayland;
GdkDragContext *context;
@@ -397,8 +396,6 @@ _gdk_wayland_drop_context_new (GdkDevice *device,
context = GDK_DRAG_CONTEXT (context_wayland);
context->is_source = FALSE;
- gdk_drag_context_set_device (context, device);
-
return context;
}
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 5f8f37d..00db37f 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -104,8 +104,7 @@ void _gdk_wayland_window_register_dnd (GdkWindow *window);
GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets);
-GdkDragContext * _gdk_wayland_drop_context_new (GdkDevice *device,
- struct wl_data_device *data_device);
+GdkDragContext * _gdk_wayland_drop_context_new (struct wl_data_device *data_device);
void _gdk_wayland_drag_context_set_source_window (GdkDragContext *context,
GdkWindow *window);
void _gdk_wayland_drag_context_set_dest_window (GdkDragContext *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]