wayland: Avoid GdkDeviceManager APIs

In most places, we can do with the pointer/keyboard of the default seat
instead of the client pointer. We can also remove some code from
gdk_input_init() because we know for sure there's no floating devices to
care about here.
This commit is contained in:
Carlos Garnacho 2015-12-16 19:12:18 +01:00
parent 598dedfe36
commit 1fbf2fe4d7
3 changed files with 7 additions and 66 deletions

View File

@ -107,50 +107,12 @@ static void
gdk_input_init (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland;
GdkDeviceManager *device_manager;
GdkDevice *device;
GList *list, *l;
display_wayland = GDK_WAYLAND_DISPLAY (display);
device_manager = gdk_display_get_device_manager (display);
/* For backwards compatibility, just add
* floating devices that are not keyboards.
*/
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
for (l = list; l; l = l->next)
{
device = l->data;
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
continue;
display_wayland->input_devices = g_list_prepend (display_wayland->input_devices, l->data);
}
g_list_free (list);
/* Now set "core" pointer to the first
* master device that is a pointer.
*/
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
for (l = list; l; l = l->next)
{
device = l->data;
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
display->core_pointer = device;
break;
}
display->core_pointer = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
/* Add the core pointer to the devices list */
display_wayland->input_devices = g_list_prepend (display_wayland->input_devices, display->core_pointer);
g_list_free (list);
}
static void
@ -676,27 +638,10 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
static GdkKeymap *
_gdk_wayland_display_get_keymap (GdkDisplay *display)
{
GdkDeviceManager *device_manager;
GList *list, *l;
GdkDevice *core_keyboard = NULL;
static GdkKeymap *tmp_keymap = NULL;
device_manager = gdk_display_get_device_manager (display);
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
for (l = list; l; l = l->next)
{
GdkDevice *device;
device = l->data;
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
core_keyboard = device;
break;
}
g_list_free (list);
core_keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (display));
if (core_keyboard && tmp_keymap)
{

View File

@ -883,11 +883,9 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display,
if (selection == atoms[ATOM_CLIPBOARD])
{
GdkDeviceManager *device_manager;
GdkDevice *device;
device_manager = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (device_manager);
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
gdk_wayland_device_set_selection (device, NULL);
@ -1168,13 +1166,11 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
if (selection == atoms[ATOM_CLIPBOARD])
{
GdkDeviceManager *device_manager;
GdkDisplay *display;
GdkDevice *device;
display = gdk_window_get_display (window);
device_manager = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (device_manager);
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
gdk_wayland_device_set_selection (device, data_source);
}
}

View File

@ -1130,8 +1130,8 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
GdkDeviceManager *device_manager;
GdkWaylandDevice *device;
GdkSeat *gdk_seat;
int x, y;
int parent_x, parent_y;
@ -1141,8 +1141,8 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
if (!parent_impl->surface)
return;
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (display));
device = GDK_WAYLAND_DEVICE (gdk_device_manager_get_client_pointer (device_manager));
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
device = GDK_WAYLAND_DEVICE (gdk_seat_get_pointer (gdk_seat));
gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y);