[gtk+/wip/matthiasc/kill-device-manager: 2/17] widget: Don't use GdkDeviceManager
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/kill-device-manager: 2/17] widget: Don't use GdkDeviceManager
- Date: Fri, 24 Nov 2017 17:27:10 +0000 (UTC)
commit 7bbc1cbde02f34ce627fbda8a54ab1e0dc343bce
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 23 15:25:13 2017 -0500
widget: Don't use GdkDeviceManager
We can just as well use GdkSeat to enumerate the devices.
gtk/gtkwidget.c | 36 ++++++++++++++----------------------
1 files changed, 14 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a4739a9..6100ccb 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10305,27 +10305,22 @@ _gtk_widget_get_device_window (GtkWidget *widget,
}
static void
-list_devices (GtkWidget *widget,
- GdkDeviceManager *device_manager,
- GdkDeviceType device_type,
- GList **result)
+list_devices (GtkWidget *widget,
+ GdkSeat *seat,
+ GList **result)
{
GList *devices;
GList *l;
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- devices = gdk_device_manager_list_devices (device_manager, device_type);
- G_GNUC_END_IGNORE_DEPRECATIONS;
+ *result = g_list_prepend (*result, gdk_seat_get_pointer (seat));
+ devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL_POINTING);
for (l = devices; l; l = l->next)
{
GdkDevice *device = l->data;
- if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
- {
- GdkWindow *window = gdk_device_get_last_event_window (device);
- if (window && is_my_window (widget, window))
- *result = g_list_prepend (*result, device);
- }
+ GdkWindow *window = gdk_device_get_last_event_window (device);
+ if (window && is_my_window (widget, window))
+ *result = g_list_prepend (*result, device);
}
g_list_free (devices);
}
@@ -10342,8 +10337,7 @@ list_devices (GtkWidget *widget,
GList *
_gtk_widget_list_devices (GtkWidget *widget)
{
- GdkDisplay *display;
- GdkDeviceManager *device_manager;
+ GdkSeat *seat;
GList *result = NULL;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
@@ -10351,14 +10345,12 @@ _gtk_widget_list_devices (GtkWidget *widget)
if (!_gtk_widget_get_mapped (widget))
return NULL;
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- display = gtk_widget_get_display (widget);
- device_manager = gdk_display_get_device_manager (display);
- G_GNUC_END_IGNORE_DEPRECATIONS;
+ seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
+
+ result = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_KEYBOARD);
+ result = g_list_prepend (result, gdk_seat_get_keyboard (seat));
- list_devices (widget, device_manager, GDK_DEVICE_TYPE_MASTER, &result);
- /* Rare, but we can get events for grabbed slave devices */
- list_devices (widget, device_manager, GDK_DEVICE_TYPE_SLAVE, &result);
+ list_devices (widget, seat, &result);
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]