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 <tristan@partin.io>
This commit is contained in:
Tristan Partin
2024-12-29 22:57:48 -06:00
parent 3059d9036b
commit 31c9a2fe59
2 changed files with 8 additions and 0 deletions

View File

@ -972,6 +972,9 @@ fn loadRuntimeCss(
const headerbar_foreground = config.@"window-titlebar-foreground" orelse config.foreground; const headerbar_foreground = config.@"window-titlebar-foreground" orelse config.foreground;
try writer.print( try writer.print(
\\window.without-window-decoration-and-with-titlebar {{
\\ border-radius: 0 0;
\\}}
\\widget.unfocused-split {{ \\widget.unfocused-split {{
\\ opacity: {d:.2}; \\ opacity: {d:.2};
\\ background-color: rgb({d},{d},{d}); \\ background-color: rgb({d},{d},{d});

View File

@ -209,6 +209,11 @@ pub fn init(self: *Window, app: *App) !void {
// If we are disabling decorations then disable them right away. // If we are disabling decorations then disable them right away.
if (!app.config.@"window-decoration") { if (!app.config.@"window-decoration") {
c.gtk_window_set_decorated(gtk_window, 0); 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. // In debug we show a warning and apply the 'devel' class to the window.