[mutter] wayland/xdg-output: Add xdg-output v2 support



commit b138006bb7702c3b2b0018e6de2cbcfa3c945163
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Jun 26 11:42:29 2019 +0200

    wayland/xdg-output: Add xdg-output v2 support
    
    xdg-output v2 adds the output name and description events, add siupports
    for these in mutter.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/645

 src/wayland/meta-wayland-outputs.c  | 21 +++++++++++++++++++++
 src/wayland/meta-wayland-versions.h |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 099e87ab9..a45bcbcd2 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -573,7 +573,9 @@ send_xdg_output_events (struct wl_resource *resource,
   MetaRectangle new_layout;
   MetaRectangle old_layout;
   MetaLogicalMonitor *old_logical_monitor;
+  MetaMonitor *monitor;
   gboolean need_done;
+  int version;
 
   need_done = FALSE;
   old_logical_monitor = wayland_output->logical_monitor;
@@ -600,6 +602,25 @@ send_xdg_output_events (struct wl_resource *resource,
       need_done = TRUE;
     }
 
+  version = wl_resource_get_version (resource);
+  monitor = pick_main_monitor (logical_monitor);
+
+  if (need_all_events && version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
+    {
+      const char *name;
+
+      name = meta_monitor_get_connector (monitor);
+      zxdg_output_v1_send_name (resource, name);
+    }
+
+  if (need_all_events && version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION)
+    {
+      const char *description;
+
+      description = meta_monitor_get_display_name (monitor);
+      zxdg_output_v1_send_description (resource, description);
+    }
+
   if (need_all_events)
     {
       zxdg_output_v1_send_done (resource);
diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h
index 674b6c4e5..0e2b6414b 100644
--- a/src/wayland/meta-wayland-versions.h
+++ b/src/wayland/meta-wayland-versions.h
@@ -50,7 +50,7 @@
 #define META_ZXDG_IMPORTER_V1_VERSION       1
 #define META_ZWP_LINUX_DMABUF_V1_VERSION    3
 #define META_ZWP_KEYBOARD_SHORTCUTS_INHIBIT_V1_VERSION 1
-#define META_ZXDG_OUTPUT_V1_VERSION         1
+#define META_ZXDG_OUTPUT_V1_VERSION         2
 #define META_ZWP_XWAYLAND_KEYBOARD_GRAB_V1_VERSION 1
 #define META_GTK_TEXT_INPUT_VERSION         1
 #define META_ZWP_TEXT_INPUT_V3_VERSION      1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]