[gtk/gtk-3-24: 1/2] wayland: Update cursor surface scale when output scale changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] wayland: Update cursor surface scale when output scale changes
- Date: Fri, 29 Jun 2018 14:32:26 +0000 (UTC)
commit 3354d9109062d12890787bc1f1d23ddc1c3ea77a
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Jun 28 11:41:09 2018 +0200
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.
gdk/wayland/gdkdevice-wayland.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 807f0a29ff..fb3cfcb505 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -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",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]