[gtk/gtk-3-24: 1/2] wayland: Add xdg-output v3 support



commit ab1e86a3b1cbb7874c29640b2ed6c03243b21ebb
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Fri Jul 26 16:50:19 2019 +0200

    wayland: Add xdg-output v3 support
    
    xdg-output v3 marks xdg-output.done as deprecated and compositors are
    not required to send that event anymore.
    
    So if the xdg-output version is 3 or higher, simply set the initial
    value `xdg_output_done` to TRUE so we don't wait/expect that event
    from the compositor.
    
    https://gitlab.gnome.org/GNOME/gtk/issues/2053

 gdk/wayland/gdkdisplay-wayland.c | 3 ++-
 gdk/wayland/gdkdisplay-wayland.h | 1 +
 gdk/wayland/gdkscreen-wayland.c  | 8 +++++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index d57159b232..16e3054293 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -515,11 +515,12 @@ 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_version = MIN (version, 3);
       display_wayland->xdg_output_manager =
         wl_registry_bind (display_wayland->wl_registry, id,
                           &zxdg_output_manager_v1_interface,
                           display_wayland->xdg_output_manager_version);
+      display_wayland->xdg_output_version = version;
       _gdk_wayland_screen_init_xdg_output (display_wayland->screen);
       _gdk_wayland_display_async_roundtrip (display_wayland);
     }
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index 3b1ba200a3..a6b2247600 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -95,6 +95,7 @@ struct _GdkWaylandDisplay
   struct zwp_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
   struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
   struct zxdg_output_manager_v1 *xdg_output_manager;
+  uint32_t xdg_output_version;
 
   GList *async_roundtrips;
 
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 1a7f8210e9..8b65cd00fa 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -87,6 +87,7 @@ struct _GdkWaylandScreenClass
 };
 
 #define OUTPUT_VERSION_WITH_DONE 2
+#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
 
 #define GTK_SETTINGS_DBUS_PATH "/org/gtk/Settings"
 #define GTK_SETTINGS_DBUS_NAME "org.gtk.Settings"
@@ -1449,6 +1450,7 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
 {
   GdkDisplay *display = GDK_MONITOR (monitor)->display;
   GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (gdk_display_get_default_screen (display));
+  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
 
   GDK_NOTE (MISC,
             g_message ("monitor %d changed position %d %d, size %d %d",
@@ -1460,7 +1462,11 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
   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;
+  /* xdg_output v3 marks xdg_output.done as deprecated, so if using
+   * that version, no need to wait for xdg-output.done event.
+   */
+  monitor->xdg_output_done =
+     (display_wayland->xdg_output_version >= NO_XDG_OUTPUT_DONE_SINCE_VERSION);
 
   g_signal_emit_by_name (screen_wayland, "monitors-changed");
   update_screen_size (screen_wayland);


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