wayland: Update cursor surface scale when output scale changes

Cursor surfaces didn't listen for output scale changes, meaning they
didn't adapt their scale when an output changed scale, which could
happen for example when changing the monitor scale via Settings.
This commit is contained in:
Jonas Ådahl 2018-06-28 11:41:09 +02:00
parent 5afc01d995
commit 3354d91090

View File

@ -310,6 +310,9 @@ struct _GdkWaylandDeviceManagerClass
GdkDeviceManagerClass parent_class;
};
static void
pointer_surface_update_scale (GdkDevice *device);
static void deliver_key_event (GdkWaylandSeat *seat,
uint32_t time_,
uint32_t key,
@ -4501,10 +4504,18 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
tablet_seat_handle_pad_added,
};
static void
on_monitors_changed (GdkScreen *screen,
GdkWaylandSeat *seat)
{
pointer_surface_update_scale (seat->master_pointer);
}
static void
init_devices (GdkWaylandSeat *seat)
{
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (seat->device_manager);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
/* pointer */
seat->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
@ -4524,6 +4535,9 @@ init_devices (GdkWaylandSeat *seat)
g_list_prepend (device_manager->devices, seat->master_pointer);
g_signal_emit_by_name (device_manager, "device-added", seat->master_pointer);
g_signal_connect (display->screen, "monitors-changed",
G_CALLBACK (on_monitors_changed), seat);
/* keyboard */
seat->master_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",