broadway: Stop using GdkDeviceManager

We can use the GdkSeat apis for this.
This commit is contained in:
Matthias Clasen 2017-11-23 22:17:30 -05:00
parent 903959301b
commit 1023249e31

View File

@ -18,7 +18,7 @@
#include "config.h"
#include "gdkeventsource.h"
#include "gdkdevicemanager-broadway.h"
#include "gdkseat.h"
#include "gdkinternals.h"
#include "gdkframeclockprivate.h"
@ -95,7 +95,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
{
GdkDisplay *display;
GdkBroadwayDisplay *display_broadway;
GdkBroadwayDeviceManager *device_manager;
GdkSeat *seat;
GdkWindow *window;
GdkEvent *event = NULL;
GList *node;
@ -117,9 +117,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
g_assert (display != NULL);
display_broadway = GDK_BROADWAY_DISPLAY (display);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
device_manager = GDK_BROADWAY_DEVICE_MANAGER (gdk_display_get_device_manager (display));
G_GNUC_END_IGNORE_DEPRECATIONS;
seat = gdk_display_get_default_seat (display);
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
@ -136,8 +134,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->crossing.state = message->pointer.state;
event->crossing.mode = message->crossing.mode;
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@ -157,8 +155,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->crossing.state = message->pointer.state;
event->crossing.mode = message->crossing.mode;
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@ -179,8 +177,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->motion.x_root = message->pointer.root_x;
event->motion.y_root = message->pointer.root_y;
event->motion.state = message->pointer.state;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@ -205,8 +203,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->button.y_root = message->pointer.root_y;
event->button.button = message->button.button;
event->button.state = message->pointer.state;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@ -225,8 +223,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->scroll.x_root = message->pointer.root_x;
event->scroll.y_root = message->pointer.root_y;
event->scroll.direction = message->scroll.dir == 0 ? GDK_SCROLL_UP : GDK_SCROLL_DOWN;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@ -268,9 +266,15 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->touch.y_root = message->touch.root_y;
event->touch.state = message->touch.state;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_source_device (event, device_manager->touchscreen);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
{
GList *devices;
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TOUCH);
if (devices)
gdk_event_set_source_device (event, GDK_DEVICE (devices->data));
g_list_free (devices);
}
gdk_event_set_seat (event, seat);
if (message->touch.is_emulated)
gdk_event_set_pointer_emulated (event, TRUE);
@ -297,8 +301,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->key.hardware_keycode = message->key.key;
gdk_event_set_scancode (event, message->key.key);
event->key.length = 0;
gdk_event_set_device (event, device_manager->core_keyboard);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@ -307,7 +311,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_GRAB_NOTIFY:
case BROADWAY_EVENT_UNGRAB_NOTIFY:
_gdk_display_device_grab_update (display, device_manager->core_pointer, device_manager->core_pointer, message->base.serial);
_gdk_display_device_grab_update (display, gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat), message->base.serial);
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
@ -366,8 +370,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (window);
event->focus_change.in = FALSE;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
@ -377,8 +381,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (window);
event->focus_change.in = TRUE;
gdk_event_set_device (event, device_manager->core_pointer);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
gdk_event_set_seat (event, seat);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}