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
This commit is contained in:
Carlos Garnacho 2015-11-20 00:07:36 +01:00
parent 26f9d6b1c1
commit c4f5fd111c
3 changed files with 9 additions and 10 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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,