Skip to content

Commit a0d8793

Browse files
committed
fix(window): prevent showing header with decorations disabled
1 parent 73c1e42 commit a0d8793

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/app/window/imp.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub struct Window {
2929
#[property(get, set)]
3030
decorations: Cell<bool>,
3131
#[template_child]
32-
pub header: TemplateChild<adw::HeaderBar>,
32+
header: TemplateChild<adw::HeaderBar>,
3333
#[template_child]
3434
pub overlay: TemplateChild<gtk::Overlay>,
3535
pub inhibit_request: Arc<Mutex<Option<Request<()>>>>,
@@ -116,6 +116,10 @@ impl Window {
116116
}
117117
));
118118
}
119+
120+
pub fn show_header(&self, state: bool) {
121+
self.header.set_visible(self.decorations.get() && state);
122+
}
119123
}
120124

121125
#[glib::object_subclass]
@@ -149,7 +153,7 @@ impl WidgetImpl for Window {
149153
self.parent_realize();
150154

151155
if !self.decorations.get() {
152-
self.header.set_visible(false);
156+
self.show_header(false);
153157
self.obj().remove_css_class("csd");
154158
}
155159
}

src/app/window/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ impl Window {
3838
}
3939

4040
pub fn set_fullscreen(&self, fullscreen: bool) {
41-
let window = self.imp();
42-
43-
window.header.set_visible(!fullscreen);
41+
self.imp().show_header(!fullscreen);
4442
self.set_fullscreened(fullscreen);
4543
}
4644

0 commit comments

Comments
 (0)