[gtk] wayland: Explicitly announce ssd for kwin



commit 6c54abeca719cb98d6ce84c0c03114b426cb1c51
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 21 22:43:33 2021 -0500

    wayland: Explicitly announce ssd for kwin
    
    Without this, kwin correctly assumes that we are
    using client-side decorations. This is a port
    of 32ae97f1 from GTK 3.24.
    
    Fixes: #3609

 gdk/wayland/gdksurface-wayland.c | 18 ++++++++++++++++++
 gdk/wayland/gdksurface-wayland.h |  1 +
 gtk/gtkwindow.c                  |  9 +++++++--
 3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index c114c04f29..0fd1b82a9b 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -2223,6 +2223,24 @@ gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel)
                                                 ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
 }
 
+void
+gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel)
+{
+  GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE 
(toplevel)));
+  GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (toplevel);
+
+  g_return_if_fail (GDK_IS_WAYLAND_TOPLEVEL (toplevel));
+
+  if (!display_wayland->server_decoration_manager)
+    return;
+  impl->display_server.server_decoration =
+    org_kde_kwin_server_decoration_manager_create (display_wayland->server_decoration_manager,
+                                                  impl->display_server.wl_surface);
+  if (impl->display_server.server_decoration)
+    org_kde_kwin_server_decoration_request_mode (impl->display_server.server_decoration,
+                                                ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_SERVER);
+}
+
 gboolean
 gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel)
 {
diff --git a/gdk/wayland/gdksurface-wayland.h b/gdk/wayland/gdksurface-wayland.h
index b0d0d6fc19..8efa4be04d 100644
--- a/gdk/wayland/gdksurface-wayland.h
+++ b/gdk/wayland/gdksurface-wayland.h
@@ -33,6 +33,7 @@ void                     gdk_wayland_toplevel_set_dbus_properties       (GdkTopl
                                                                          const char  *unique_bus_name);
 
 void                     gdk_wayland_toplevel_announce_csd              (GdkToplevel *toplevel);
+void                     gdk_wayland_toplevel_announce_ssd              (GdkToplevel *toplevel);
 
 gboolean                 gdk_wayland_toplevel_inhibit_idle              (GdkToplevel *toplevel);
 void                     gdk_wayland_toplevel_uninhibit_idle            (GdkToplevel *toplevel);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 06835dc99c..91f6d46989 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4204,8 +4204,13 @@ gtk_window_realize (GtkWidget *widget)
   gdk_toplevel_set_deletable (GDK_TOPLEVEL (surface), priv->deletable);
 
 #ifdef GDK_WINDOWING_WAYLAND
-  if (priv->client_decorated && GDK_IS_WAYLAND_SURFACE (surface))
-    gdk_wayland_toplevel_announce_csd (GDK_TOPLEVEL (surface));
+  if (GDK_IS_WAYLAND_SURFACE (surface))
+    {
+      if (priv->client_decorated)
+        gdk_wayland_toplevel_announce_csd (GDK_TOPLEVEL (surface));
+      else
+        gdk_wayland_toplevel_announce_ssd (GDK_TOPLEVEL (surface));
+    }
 #endif
 
   gdk_toplevel_set_modal (GDK_TOPLEVEL (surface), priv->modal);


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