wayland: Set up monitor descriptions

We get this information in the xdg_output protocol.
This commit is contained in:
Matthias Clasen 2023-02-02 12:31:38 +01:00
parent 2c883a70e2
commit 4e62350232
3 changed files with 9 additions and 3 deletions

View File

@ -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 = {

View File

@ -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);

View File

@ -38,6 +38,7 @@ struct _GdkWaylandMonitor {
int32_t width;
int32_t height;
char *name;
char *description;
gboolean wl_output_done;
gboolean xdg_output_done;
};