summaryrefslogtreecommitdiff
path: root/gdk/broadway/gdkdisplay-broadway.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-16 12:27:22 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-16 12:27:22 -0400
commitc0ae36e94375ff524e95f053e4c1d2a6bc483b5e (patch)
tree64356967406d77c49415df4bc40cebfcf241fa09 /gdk/broadway/gdkdisplay-broadway.c
parent5851415fcab06390ee6e04ac5416ea0e7d03ae2b (diff)
downloadgtk+-c0ae36e94375ff524e95f053e4c1d2a6bc483b5e.tar.gz
broadway: Create slave devices
The assumption is that the source device in events is a slave device, so create pointer and keyboard devices and use them in events. This fixes the seat test on Broadway.
Diffstat (limited to 'gdk/broadway/gdkdisplay-broadway.c')
-rw-r--r--gdk/broadway/gdkdisplay-broadway.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index db7428719f..0241769f00 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -113,7 +113,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
}}
static GdkDevice *
-create_core_pointer (GdkDisplay *display)
+create_core_pointer (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
@@ -125,7 +125,7 @@ create_core_pointer (GdkDisplay *display)
}
static GdkDevice *
-create_core_keyboard (GdkDisplay *display)
+create_core_keyboard (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
@@ -137,7 +137,31 @@ create_core_keyboard (GdkDisplay *display)
}
static GdkDevice *
-create_touchscreen (GdkDisplay *display)
+create_pointer (GdkDisplay *display)
+{
+ return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
+ "name", "Pointer",
+ "type", GDK_DEVICE_TYPE_SLAVE,
+ "source", GDK_SOURCE_MOUSE,
+ "has-cursor", TRUE,
+ "display", display,
+ NULL);
+}
+
+static GdkDevice *
+create_keyboard (GdkDisplay *display)
+{
+ return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
+ "name", "Keyboard",
+ "type", GDK_DEVICE_TYPE_SLAVE,
+ "source", GDK_SOURCE_KEYBOARD,
+ "has-cursor", FALSE,
+ "display", display,
+ NULL);
+}
+
+static GdkDevice *
+create_touchscreen (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
@@ -161,16 +185,23 @@ _gdk_broadway_display_open (const gchar *display_name)
broadway_display->core_pointer = create_core_pointer (display);
broadway_display->core_keyboard = create_core_keyboard (display);
+ broadway_display->pointer = create_pointer (display);
+ broadway_display->keyboard = create_keyboard (display);
broadway_display->touchscreen = create_touchscreen (display);
_gdk_device_set_associated_device (broadway_display->core_pointer, broadway_display->core_keyboard);
_gdk_device_set_associated_device (broadway_display->core_keyboard, broadway_display->core_pointer);
+ _gdk_device_set_associated_device (broadway_display->pointer, broadway_display->core_pointer);
+ _gdk_device_set_associated_device (broadway_display->keyboard, broadway_display->core_keyboard);
_gdk_device_set_associated_device (broadway_display->touchscreen, broadway_display->core_pointer);
_gdk_device_add_slave (broadway_display->core_pointer, broadway_display->touchscreen);
seat = gdk_seat_default_new_for_master_pair (broadway_display->core_pointer,
broadway_display->core_keyboard);
+
gdk_display_add_seat (display, seat);
+ gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->pointer);
+ gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->keyboard);
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->touchscreen);
g_object_unref (seat);