From 31c9a2fe598425cede5c4a01b14f50db187c4e49 Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Sun, 29 Dec 2024 22:57:48 -0600 Subject: [PATCH] apprt/gtk: make window-decoration=false with gtk-titlebar=true look better Before this change, there seemed to be some artifacting in the window corners due to the window border no longer outlining the content properly. By detecting the situation, we can turn the window border radius off. Signed-off-by: Tristan Partin --- src/apprt/gtk/App.zig | 3 +++ src/apprt/gtk/Window.zig | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 033f4788cb..c6e2b4d08f 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -972,6 +972,9 @@ fn loadRuntimeCss( const headerbar_foreground = config.@"window-titlebar-foreground" orelse config.foreground; try writer.print( + \\window.without-window-decoration-and-with-titlebar {{ + \\ border-radius: 0 0; + \\}} \\widget.unfocused-split {{ \\ opacity: {d:.2}; \\ background-color: rgb({d},{d},{d}); diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index c2700f9862..6bfcb07509 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -209,6 +209,11 @@ pub fn init(self: *Window, app: *App) !void { // If we are disabling decorations then disable them right away. if (!app.config.@"window-decoration") { c.gtk_window_set_decorated(gtk_window, 0); + + // Fix any artifacting that may occur in window corners. + if (app.config.@"gtk-titlebar") { + c.gtk_widget_add_css_class(window, "without-window-decoration-and-with-titlebar"); + } } // In debug we show a warning and apply the 'devel' class to the window.