From 065cef24c2cbbd004e5b4dab6440049179b157f2 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Thu, 23 Apr 2026 09:02:45 +0200 Subject: [PATCH] use gdk_window_set_decorations to strip KWin SSD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gtk_window_set_decorated alone doesn't work on KDE Wayland — KWin adds server-side decorations regardless. Now also calling gdk_window_set_decorations(gdk_win, 0) after realize and before first frame show, which communicates directly with the compositor via GDK's Wayland layer. Co-Authored-By: Claude Opus 4.6 (1M context) --- linux/runner/my_application.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc index f5cab4f5..9c3c95a9 100644 --- a/linux/runner/my_application.cc +++ b/linux/runner/my_application.cc @@ -14,9 +14,20 @@ struct _MyApplication { G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) +// D-057: strip all window decorations after the GdkWindow exists. +static void remove_decorations(GtkWidget* widget, gpointer data) { + (void)data; + GdkWindow* gdk_win = gtk_widget_get_window(widget); + if (gdk_win != nullptr) { + gdk_window_set_decorations(gdk_win, (GdkWMDecoration)0); + } +} + // Called when first Flutter frame received. static void first_frame_cb(MyApplication* self, FlView* view) { - gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); + GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(view)); + remove_decorations(toplevel, nullptr); + gtk_widget_show(toplevel); } // Implements GApplication::activate. @@ -30,6 +41,9 @@ static void my_application_activate(GApplication* application) { gtk_window_set_decorated(window, FALSE); gtk_window_set_title(window, "clide"); + // Also strip decorations via GDK after realize (catches KDE/KWin + // on Wayland which ignores gtk_window_set_decorated). + g_signal_connect(window, "realize", G_CALLBACK(remove_decorations), nullptr); gtk_window_set_default_size(window, 1280, 720);