forked from AuroraMiddleware/gtk
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:
parent
598dedfe36
commit
1fbf2fe4d7
@ -107,50 +107,12 @@ static void
|
|||||||
gdk_input_init (GdkDisplay *display)
|
gdk_input_init (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
GdkWaylandDisplay *display_wayland;
|
GdkWaylandDisplay *display_wayland;
|
||||||
GdkDeviceManager *device_manager;
|
|
||||||
GdkDevice *device;
|
|
||||||
GList *list, *l;
|
|
||||||
|
|
||||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||||
device_manager = gdk_display_get_device_manager (display);
|
display->core_pointer = gdk_seat_get_pointer (gdk_display_get_default_seat (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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the core pointer to the devices list */
|
/* Add the core pointer to the devices list */
|
||||||
display_wayland->input_devices = g_list_prepend (display_wayland->input_devices, display->core_pointer);
|
display_wayland->input_devices = g_list_prepend (display_wayland->input_devices, display->core_pointer);
|
||||||
|
|
||||||
g_list_free (list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -676,27 +638,10 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
|
|||||||
static GdkKeymap *
|
static GdkKeymap *
|
||||||
_gdk_wayland_display_get_keymap (GdkDisplay *display)
|
_gdk_wayland_display_get_keymap (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
GdkDeviceManager *device_manager;
|
|
||||||
GList *list, *l;
|
|
||||||
GdkDevice *core_keyboard = NULL;
|
GdkDevice *core_keyboard = NULL;
|
||||||
static GdkKeymap *tmp_keymap = NULL;
|
static GdkKeymap *tmp_keymap = NULL;
|
||||||
|
|
||||||
device_manager = gdk_display_get_device_manager (display);
|
core_keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (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);
|
|
||||||
|
|
||||||
if (core_keyboard && tmp_keymap)
|
if (core_keyboard && tmp_keymap)
|
||||||
{
|
{
|
||||||
|
@ -883,11 +883,9 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display,
|
|||||||
|
|
||||||
if (selection == atoms[ATOM_CLIPBOARD])
|
if (selection == atoms[ATOM_CLIPBOARD])
|
||||||
{
|
{
|
||||||
GdkDeviceManager *device_manager;
|
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
|
|
||||||
device_manager = gdk_display_get_device_manager (display);
|
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
||||||
device = gdk_device_manager_get_client_pointer (device_manager);
|
|
||||||
|
|
||||||
gdk_wayland_device_set_selection (device, NULL);
|
gdk_wayland_device_set_selection (device, NULL);
|
||||||
|
|
||||||
@ -1168,13 +1166,11 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
|||||||
|
|
||||||
if (selection == atoms[ATOM_CLIPBOARD])
|
if (selection == atoms[ATOM_CLIPBOARD])
|
||||||
{
|
{
|
||||||
GdkDeviceManager *device_manager;
|
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
|
|
||||||
display = gdk_window_get_display (window);
|
display = gdk_window_get_display (window);
|
||||||
device_manager = gdk_display_get_device_manager (display);
|
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
|
||||||
device = gdk_device_manager_get_client_pointer (device_manager);
|
|
||||||
gdk_wayland_device_set_selection (device, data_source);
|
gdk_wayland_device_set_selection (device, data_source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1130,8 +1130,8 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
|
|||||||
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
||||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||||
GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
|
GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
|
||||||
GdkDeviceManager *device_manager;
|
|
||||||
GdkWaylandDevice *device;
|
GdkWaylandDevice *device;
|
||||||
|
GdkSeat *gdk_seat;
|
||||||
int x, y;
|
int x, y;
|
||||||
int parent_x, parent_y;
|
int parent_x, parent_y;
|
||||||
|
|
||||||
@ -1141,8 +1141,8 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
|
|||||||
if (!parent_impl->surface)
|
if (!parent_impl->surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (display));
|
gdk_seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
|
||||||
device = GDK_WAYLAND_DEVICE (gdk_device_manager_get_client_pointer (device_manager));
|
device = GDK_WAYLAND_DEVICE (gdk_seat_get_pointer (gdk_seat));
|
||||||
|
|
||||||
gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y);
|
gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user