mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
fix(gtk/toggle_fullscreen): header bar visibility
While unfullscreen the window, header.setVisible(true) will be called. For .gtk it's okay, because it will follows the window-decoration, while .adw doesn't. After #4850, the header is always created and added to the window, so setting visibility to the correct value is vital for .adw. Fixes: #4850
This commit is contained in:
@ -538,8 +538,8 @@ pub fn toggleMaximize(self: *Window) void {
|
|||||||
|
|
||||||
/// Toggle fullscreen for this window.
|
/// Toggle fullscreen for this window.
|
||||||
pub fn toggleFullscreen(self: *Window) void {
|
pub fn toggleFullscreen(self: *Window) void {
|
||||||
const is_fullscreen = c.gtk_window_is_fullscreen(self.window);
|
const is_fullscreen = c.gtk_window_is_fullscreen(self.window) == 1;
|
||||||
if (is_fullscreen == 0) {
|
if (!is_fullscreen) {
|
||||||
c.gtk_window_fullscreen(self.window);
|
c.gtk_window_fullscreen(self.window);
|
||||||
} else {
|
} else {
|
||||||
c.gtk_window_unfullscreen(self.window);
|
c.gtk_window_unfullscreen(self.window);
|
||||||
@ -642,7 +642,18 @@ fn gtkWindowNotifyFullscreened(
|
|||||||
ud: ?*anyopaque,
|
ud: ?*anyopaque,
|
||||||
) callconv(.C) void {
|
) callconv(.C) void {
|
||||||
const self = userdataSelf(ud orelse return);
|
const self = userdataSelf(ud orelse return);
|
||||||
self.headerbar.setVisible(c.gtk_window_is_fullscreen(@ptrCast(object)) == 0);
|
const is_fullscreen = c.gtk_window_is_fullscreen(@ptrCast(object)) == 1;
|
||||||
|
|
||||||
|
const visible = if (is_fullscreen)
|
||||||
|
false
|
||||||
|
else switch (self.headerbar) {
|
||||||
|
// gtk will follow the window decorations
|
||||||
|
.gtk => true,
|
||||||
|
// adw need the explicit setting
|
||||||
|
.adw => c.gtk_window_get_decorated(self.window) == 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
self.headerbar.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: we MUST NOT use the GtkButton parameter because gtkActionNewTab
|
// Note: we MUST NOT use the GtkButton parameter because gtkActionNewTab
|
||||||
|
Reference in New Issue
Block a user