From 4e62350232dfb639343c07be605001129d864648 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 2 Feb 2023 12:31:38 +0100 Subject: [PATCH] wayland: Set up monitor descriptions We get this information in the xdg_output protocol. --- gdk/wayland/gdkdisplay-wayland.c | 10 +++++++--- gdk/wayland/gdkmonitor-wayland.c | 1 + gdk/wayland/gdkmonitor-wayland.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 0f745c28dc..e04387df27 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -2326,6 +2326,7 @@ apply_monitor_change (GdkWaylandMonitor *monitor) monitor->x, monitor->y, monitor->width, monitor->height }); gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name); + gdk_monitor_set_description (GDK_MONITOR (monitor), monitor->description); monitor->wl_output_done = FALSE; monitor->xdg_output_done = FALSE; @@ -2382,7 +2383,7 @@ xdg_output_handle_name (void *data, { GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; - GDK_DEBUG (MISC, "handle name xdg-output %d", monitor->id); + GDK_DEBUG (MISC, "handle name xdg-output %d: %s", monitor->id, name); monitor->name = g_strdup (name); } @@ -2392,8 +2393,11 @@ xdg_output_handle_description (void *data, struct zxdg_output_v1 *xdg_output, const char *description) { - GDK_DEBUG (MISC, "handle description xdg-output %d", - ((GdkWaylandMonitor *)data)->id); + GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data; + + GDK_DEBUG (MISC, "handle description xdg-output %d: %s", monitor->id, description); + + monitor->description = g_strdup (description); } static const struct zxdg_output_v1_listener xdg_output_listener = { diff --git a/gdk/wayland/gdkmonitor-wayland.c b/gdk/wayland/gdkmonitor-wayland.c index 3db7810f26..17406ad6cd 100644 --- a/gdk/wayland/gdkmonitor-wayland.c +++ b/gdk/wayland/gdkmonitor-wayland.c @@ -46,6 +46,7 @@ gdk_wayland_monitor_finalize (GObject *object) GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)object; g_free (monitor->name); + g_free (monitor->description); g_clear_pointer (&monitor->xdg_output, zxdg_output_v1_destroy); diff --git a/gdk/wayland/gdkmonitor-wayland.h b/gdk/wayland/gdkmonitor-wayland.h index 69592bd28a..4397075407 100644 --- a/gdk/wayland/gdkmonitor-wayland.h +++ b/gdk/wayland/gdkmonitor-wayland.h @@ -38,6 +38,7 @@ struct _GdkWaylandMonitor { int32_t width; int32_t height; char *name; + char *description; gboolean wl_output_done; gboolean xdg_output_done; };