diff options
author | Alexander Larsson <alexl@redhat.com> | 2017-11-29 18:11:45 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2017-11-30 21:57:42 +0100 |
commit | d284c3fa8573dbda86f7d03b2af634fc8d98a7ce (patch) | |
tree | ac0af04cee84ae9d3f63af8c01e090b7b9cdcfec /gdk/broadway/gdkdisplay-broadway.c | |
parent | 8cf2f3c3f19920e1c60f43e6201ef57cedb1d3b3 (diff) | |
download | gtk+-d284c3fa8573dbda86f7d03b2af634fc8d98a7ce.tar.gz |
broadway: Re-add seat and core device creation
Diffstat (limited to 'gdk/broadway/gdkdisplay-broadway.c')
-rw-r--r-- | gdk/broadway/gdkdisplay-broadway.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index 9eec2db507..59ad53317c 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -27,6 +27,8 @@ #include "gdkdisplay.h" #include "gdkeventsource.h" #include "gdkmonitor-broadway.h" +#include "gdkseatdefaultprivate.h" +#include "gdkdevice-broadway.h" #include "gdkinternals.h" #include "gdkdeviceprivate.h" #include <gdk/gdktextureprivate.h> @@ -99,6 +101,44 @@ _gdk_broadway_display_size_changed (GdkDisplay *display, } } +static GdkDevice * +create_core_pointer (GdkDisplay *display) +{ + return g_object_new (GDK_TYPE_BROADWAY_DEVICE, + "name", "Core Pointer", + "type", GDK_DEVICE_TYPE_MASTER, + "input-source", GDK_SOURCE_MOUSE, + "input-mode", GDK_MODE_SCREEN, + "has-cursor", TRUE, + "display", display, + NULL); +} + +static GdkDevice * +create_core_keyboard (GdkDisplay *display) +{ + return g_object_new (GDK_TYPE_BROADWAY_DEVICE, + "name", "Core Keyboard", + "type", GDK_DEVICE_TYPE_MASTER, + "input-source", GDK_SOURCE_KEYBOARD, + "input-mode", GDK_MODE_SCREEN, + "has-cursor", FALSE, + "display", display, + NULL); +} + +static GdkDevice * +create_touchscreen (GdkDisplay *display) +{ + return g_object_new (GDK_TYPE_BROADWAY_DEVICE, + "name", "Touchscreen", + "type", GDK_DEVICE_TYPE_SLAVE, + "input-source", GDK_SOURCE_TOUCHSCREEN, + "input-mode", GDK_MODE_SCREEN, + "has-cursor", FALSE, + "display", display, + NULL); +} GdkDisplay * _gdk_broadway_display_open (const gchar *display_name) @@ -106,10 +146,26 @@ _gdk_broadway_display_open (const gchar *display_name) GdkDisplay *display; GdkBroadwayDisplay *broadway_display; GError *error = NULL; + GdkSeat *seat; display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL); broadway_display = GDK_BROADWAY_DISPLAY (display); + broadway_display->core_pointer = create_core_pointer (display); + broadway_display->core_keyboard = create_core_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->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->touchscreen); + g_object_unref (seat); + gdk_event_init (display); _gdk_broadway_display_init_dnd (display); |