mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-23 18:08:39 +03:00
gtk: also add css window-decorated class when toggling window decorations
This commit is contained in:
@ -514,13 +514,19 @@ pub fn toggleWindowDecorations(self: *Window) void {
|
|||||||
const new_decorated = !old_decorated;
|
const new_decorated = !old_decorated;
|
||||||
c.gtk_window_set_decorated(self.window, @intFromBool(new_decorated));
|
c.gtk_window_set_decorated(self.window, @intFromBool(new_decorated));
|
||||||
|
|
||||||
|
// Fix any artifacting that may occur in window corners.
|
||||||
|
if (new_decorated) {
|
||||||
|
c.gtk_widget_add_css_class(@ptrCast(self.window), "without-window-decoration-and-with-titlebar");
|
||||||
|
} else {
|
||||||
|
c.gtk_widget_remove_css_class(@ptrCast(self.window), "without-window-decoration-and-with-titlebar");
|
||||||
|
}
|
||||||
|
|
||||||
// If we have a titlebar, then we also show/hide it depending on the
|
// If we have a titlebar, then we also show/hide it depending on the
|
||||||
// decorated state. GTK tends to consider the titlebar part of the frame
|
// decorated state. GTK tends to consider the titlebar part of the frame
|
||||||
// and hides it with decorations, but libadwaita doesn't. This makes it
|
// and hides it with decorations, but libadwaita doesn't. This makes it
|
||||||
// explicit.
|
// explicit.
|
||||||
if (self.header) |v| {
|
if (self.header) |headerbar| {
|
||||||
const widget = v.asWidget();
|
headerbar.setVisible(new_decorated);
|
||||||
c.gtk_widget_set_visible(widget, @intFromBool(new_decorated));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ pub const HeaderBar = union(enum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn setVisible(self: HeaderBar, visible: bool) void {
|
pub fn setVisible(self: HeaderBar, visible: bool) void {
|
||||||
c.gtk_widget_set_visible(self.asWidget(), if (visible) 1 else 0);
|
c.gtk_widget_set_visible(self.asWidget(), @intFromBool(visible));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn asWidget(self: HeaderBar) *c.GtkWidget {
|
pub fn asWidget(self: HeaderBar) *c.GtkWidget {
|
||||||
|
Reference in New Issue
Block a user