summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2019-06-20 15:55:58 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2019-06-24 15:38:36 +0100
commita5f22897f9b4c12ca0775a44b80edd4f9c4a9adb (patch)
tree8cc0f03ebaba8b8b2d874f5ae5f0080f3f515835
parent03840fb68778a5278652d338697153a4dc9e87a8 (diff)
downloadgtk+-a5f22897f9b4c12ca0775a44b80edd4f9c4a9adb.tar.gz
Relay the xdg_output.name to GdkMonitor
The xdg_output v2 interface has a `name` property that reflects the output name coming from the compositor. This is the closest thing we can get to a connector name.
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c32
-rw-r--r--gdk/wayland/gdkdisplay-wayland.h1
-rw-r--r--gdk/wayland/gdkmonitor-wayland.c2
-rw-r--r--gdk/wayland/gdkmonitor-wayland.h1
4 files changed, 35 insertions, 1 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index eb46fa42af..c02f7c66eb 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -531,8 +531,11 @@ gdk_registry_handle_global (void *data,
}
else if (strcmp(interface, "zxdg_output_manager_v1") == 0)
{
+ display_wayland->xdg_output_manager_version = MIN (version, 2);
display_wayland->xdg_output_manager =
- wl_registry_bind (registry, id, &zxdg_output_manager_v1_interface, 1);
+ wl_registry_bind (display_wayland->wl_registry, id,
+ &zxdg_output_manager_v1_interface,
+ display_wayland->xdg_output_manager_version);
gdk_wayland_display_init_xdg_output (display_wayland);
_gdk_wayland_display_async_roundtrip (display_wayland);
}
@@ -2222,6 +2225,7 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
gdk_monitor_set_position (GDK_MONITOR (monitor), monitor->x, monitor->y);
gdk_monitor_set_size (GDK_MONITOR (monitor), monitor->width, monitor->height);
+ gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
monitor->wl_output_done = FALSE;
monitor->xdg_output_done = FALSE;
@@ -2272,10 +2276,36 @@ xdg_output_handle_done (void *data,
apply_monitor_change (monitor);
}
+static void
+xdg_output_handle_name (void *data,
+ struct zxdg_output_v1 *xdg_output,
+ const char *name)
+{
+ GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
+
+ GDK_NOTE (MISC,
+ g_message ("handle name xdg-output %d", monitor->id));
+
+ monitor->name = g_strdup (name);
+}
+
+static void
+xdg_output_handle_description (void *data,
+ struct zxdg_output_v1 *xdg_output,
+ const char *description)
+{
+ GdkWaylandMonitor *monitor = (GdkWaylandMonitor *) data;
+
+ GDK_NOTE (MISC,
+ g_message ("handle description xdg-output %d", monitor->id));
+}
+
static const struct zxdg_output_v1_listener xdg_output_listener = {
xdg_output_handle_logical_position,
xdg_output_handle_logical_size,
xdg_output_handle_done,
+ xdg_output_handle_name,
+ xdg_output_handle_description,
};
static void
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 6c5265f6a4..11768033d2 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -137,6 +137,7 @@ struct _GdkWaylandDisplay
int seat_version;
int data_device_manager_version;
int gtk_shell_version;
+ int xdg_output_manager_version;
uint32_t server_decoration_mode;
diff --git a/gdk/wayland/gdkmonitor-wayland.c b/gdk/wayland/gdkmonitor-wayland.c
index 189be0514a..7f73dd66a6 100644
--- a/gdk/wayland/gdkmonitor-wayland.c
+++ b/gdk/wayland/gdkmonitor-wayland.c
@@ -35,6 +35,8 @@ gdk_wayland_monitor_finalize (GObject *object)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)object;
+ g_free (monitor->name);
+
wl_output_destroy (monitor->output);
G_OBJECT_CLASS (gdk_wayland_monitor_parent_class)->finalize (object);
diff --git a/gdk/wayland/gdkmonitor-wayland.h b/gdk/wayland/gdkmonitor-wayland.h
index 593ab1d85c..69592bd28a 100644
--- a/gdk/wayland/gdkmonitor-wayland.h
+++ b/gdk/wayland/gdkmonitor-wayland.h
@@ -37,6 +37,7 @@ struct _GdkWaylandMonitor {
int32_t y;
int32_t width;
int32_t height;
+ char *name;
gboolean wl_output_done;
gboolean xdg_output_done;
};