Skip to content

Commit

Permalink
apprt/gtk: make window-decoration=false with gtk-titlebar=true look b…
Browse files Browse the repository at this point in the history
…etter (#3999)

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.
  • Loading branch information
mitchellh authored Dec 30, 2024
2 parents 3059d90 + 31c9a2f commit d2d6f8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/apprt/gtk/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
5 changes: 5 additions & 0 deletions src/apprt/gtk/Window.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d2d6f8b

Please sign in to comment.