diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-16 17:01:30 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-16 17:01:30 +0000 |
commit | b41aeabbeca3e382f661a655650049525b3f41f2 (patch) | |
tree | 77f7671fde71c57003d0c26f6f27b6362fea83ef /gdk/broadway | |
parent | 36b4b396194d48d74fda8e1e5bcb568acda0fb8b (diff) | |
parent | c0ae36e94375ff524e95f053e4c1d2a6bc483b5e (diff) | |
download | gtk+-b41aeabbeca3e382f661a655650049525b3f41f2.tar.gz |
Merge branch 'matthiasc/for-master' into 'master'
broadway: Don't create overlarge images
See merge request GNOME/gtk!1916
Diffstat (limited to 'gdk/broadway')
-rw-r--r-- | gdk/broadway/gdkdisplay-broadway.c | 37 | ||||
-rw-r--r-- | gdk/broadway/gdkdisplay-broadway.h | 2 | ||||
-rw-r--r-- | gdk/broadway/gdkeventsource.c | 56 |
3 files changed, 59 insertions, 36 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); diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h index b8e11168ef..e71b6f6201 100644 --- a/gdk/broadway/gdkdisplay-broadway.h +++ b/gdk/broadway/gdkdisplay-broadway.h @@ -42,6 +42,8 @@ struct _GdkBroadwayDisplay GdkDevice *core_pointer; GdkDevice *core_keyboard; + GdkDevice *pointer; + GdkDevice *keyboard; GdkDevice *touchscreen; GSource *event_source; diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c index bfeac00369..3c2e98dbcc 100644 --- a/gdk/broadway/gdkeventsource.c +++ b/gdk/broadway/gdkeventsource.c @@ -18,7 +18,6 @@ #include "config.h" #include "gdkeventsource.h" -#include "gdkseat.h" #include "gdksurfaceprivate.h" #include "gdkframeclockprivate.h" @@ -87,13 +86,11 @@ _gdk_broadway_events_got_input (GdkDisplay *display, BroadwayInputMsg *message) { GdkBroadwayDisplay *display_broadway; - GdkSeat *seat; GdkSurface *surface; GdkEvent *event = NULL; GList *node; display_broadway = GDK_BROADWAY_DISPLAY (display); - seat = gdk_display_get_default_seat (display); switch (message->base.type) { case BROADWAY_EVENT_ENTER: @@ -102,8 +99,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, { event = gdk_crossing_event_new (GDK_ENTER_NOTIFY, surface, - gdk_seat_get_pointer (seat), - gdk_seat_get_pointer (seat), + display_broadway->core_pointer, + display_broadway->pointer, message->base.time, message->pointer.state, message->pointer.win_x, @@ -121,8 +118,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, { event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY, surface, - gdk_seat_get_pointer (seat), - gdk_seat_get_pointer (seat), + display_broadway->core_pointer, + display_broadway->pointer, message->base.time, message->pointer.state, message->pointer.win_x, @@ -142,8 +139,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, if (surface) { event = gdk_motion_event_new (surface, - gdk_seat_get_pointer (seat), - gdk_seat_get_pointer (seat), + display_broadway->core_pointer, + display_broadway->pointer, NULL, message->base.time, message->pointer.state, @@ -169,8 +166,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE, surface, - gdk_seat_get_pointer (seat), - gdk_seat_get_pointer (seat), + display_broadway->core_pointer, + display_broadway->pointer, NULL, message->base.time, message->pointer.state, @@ -189,8 +186,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, if (surface) { event = gdk_scroll_event_new_discrete (surface, - gdk_seat_get_pointer (seat), - gdk_seat_get_pointer (seat), + display_broadway->core_pointer, + display_broadway->pointer, NULL, message->base.time, 0, @@ -198,7 +195,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display, ? GDK_SCROLL_UP : GDK_SCROLL_DOWN, FALSE); - + node = _gdk_event_queue_append (display, event); _gdk_windowing_got_event (display, node, event, message->base.serial); } @@ -210,7 +207,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display, { GdkEventType event_type = 0; GdkModifierType state; - GdkDevice *source_device; switch (message->touch.touch_type) { case 0: @@ -230,15 +226,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display, message->touch.is_emulated && _gdk_broadway_moveresize_handle_event (display, message)) break; - source_device = gdk_seat_get_pointer (seat); - { - GList *devices; - devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TOUCH); - if (devices) - source_device = GDK_DEVICE (devices->data); - g_list_free (devices); - } - state = message->touch.state; if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE) state |= GDK_BUTTON1_MASK; @@ -246,8 +233,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, event = gdk_touch_event_new (event_type, GUINT_TO_POINTER (message->touch.sequence_id), surface, - gdk_seat_get_pointer (seat), - source_device, + display_broadway->core_pointer, + display_broadway->touchscreen, message->base.time, state, message->touch.win_x, @@ -275,8 +262,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, ? GDK_KEY_PRESS : GDK_KEY_RELEASE, surface, - gdk_seat_get_keyboard (seat), - gdk_seat_get_keyboard (seat), + display_broadway->core_keyboard, + display_broadway->keyboard, message->base.time, message->key.key, message->key.state, @@ -291,7 +278,10 @@ _gdk_broadway_events_got_input (GdkDisplay *display, break; case BROADWAY_EVENT_GRAB_NOTIFY: case BROADWAY_EVENT_UNGRAB_NOTIFY: - _gdk_display_device_grab_update (display, gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat), message->base.serial); + _gdk_display_device_grab_update (display, + display_broadway->core_pointer, + display_broadway->pointer, + message->base.serial); break; case BROADWAY_EVENT_CONFIGURE_NOTIFY: @@ -330,8 +320,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, if (surface) { event = gdk_focus_event_new (surface, - gdk_seat_get_keyboard (seat), - gdk_seat_get_keyboard (seat), + display_broadway->core_keyboard, + display_broadway->keyboard, FALSE); node = _gdk_event_queue_append (display, event); @@ -341,8 +331,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display, if (surface) { event = gdk_focus_event_new (surface, - gdk_seat_get_keyboard (seat), - gdk_seat_get_keyboard (seat), + display_broadway->core_keyboard, + display_broadway->keyboard, TRUE); node = _gdk_event_queue_append (display, event); |