From d284c3fa8573dbda86f7d03b2af634fc8d98a7ce Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 29 Nov 2017 18:11:45 +0100 Subject: broadway: Re-add seat and core device creation --- gdk/broadway/gdkdisplay-broadway.c | 56 ++++++++++++++++++++++++++++++++++++++ gdk/broadway/gdkdisplay-broadway.h | 4 +++ 2 files changed, 60 insertions(+) (limited to 'gdk') 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 @@ -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); diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h index a82fc6640c..69bd34af55 100644 --- a/gdk/broadway/gdkdisplay-broadway.h +++ b/gdk/broadway/gdkdisplay-broadway.h @@ -40,6 +40,10 @@ struct _GdkBroadwayDisplay GHashTable *id_ht; GList *toplevels; + GdkDevice *core_pointer; + GdkDevice *core_keyboard; + GdkDevice *touchscreen; + GSource *event_source; /* Keyboard related information */ -- cgit v1.2.1