diff --git a/Cargo.toml b/Cargo.toml
index f4eaaa8..97e341a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,7 +47,7 @@ features = ["v2_74"]
[dependencies.adw]
package = "libadwaita"
version = "0.4.1"
-features = ["v1_3"]
+features = ["v1_4"]
[dependencies.gettext-rs]
version = "0.7.0"
diff --git a/data/gtk/window.ui b/data/gtk/window.ui
index bb127f4..296c552 100644
--- a/data/gtk/window.ui
+++ b/data/gtk/window.ui
@@ -68,11 +68,28 @@
-
diff --git a/data/resources/style.css b/data/resources/style.css
index 31ecc82..6a6a0db 100644
--- a/data/resources/style.css
+++ b/data/resources/style.css
@@ -4,6 +4,10 @@ button.osd.circular {
min-height: 42px;
}
+.fullscreen revealer:not(.raised) .fullscreen-osd {
+ background: rgba(0, 0, 0, 0.65);
+}
+
shadow, border, outline {
background: none;
}
@@ -29,4 +33,4 @@ lpprintpreview {
background-color: rgb(240, 240, 240);
border-radius: 4px;
box-shadow: 0 0 14px 1px black;
-}
\ No newline at end of file
+}
diff --git a/meson.build b/meson.build
index 5b41660..cf3b9af 100644
--- a/meson.build
+++ b/meson.build
@@ -9,7 +9,7 @@ i18n = import('i18n')
gnome = import('gnome')
dependency('gtk4', version: '>=4.11.1')
-dependency('libadwaita-1', version: '>=1.3.0')
+dependency('libadwaita-1', version: '>=1.3.99')
dependency('gweather4', version: '>=4.0.0')
dependency('libheif', version: '>=1.14.2')
dependency('lcms2', version: '>=2.12.0')
diff --git a/src/window.rs b/src/window.rs
index 5f50442..151f3dc 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -72,7 +72,11 @@ mod imp {
// TemplateChild wrapper, where T is the
// object type of the template child.
#[template_child]
- pub(super) headerbar: TemplateChild,
+ pub(super) toolbar_view: TemplateChild,
+ #[template_child]
+ pub(super) headerbar: TemplateChild,
+ #[template_child]
+ pub(super) headerbar_events: TemplateChild,
#[template_child]
pub(super) properties_button: TemplateChild,
#[template_child]
@@ -87,6 +91,7 @@ mod imp {
pub(super) properties_view: TemplateChild,
#[template_child]
pub(super) drop_target: TemplateChild,
+ /// Motion controller for complete window
#[template_child]
pub(super) motion_controller: TemplateChild,
@@ -300,6 +305,10 @@ mod imp {
}),
);
+ self.toolbar_view.connect_top_bar_style_notify(
+ glib::clone!(@weak obj => move |_| obj.on_top_bar_style_notify()),
+ );
+
self.image_view.connect_notify_local(
Some("current-page"),
glib::clone!(@weak obj => move |_, _| {
@@ -590,6 +599,10 @@ impl LpWindow {
self.imp().image_view.clone()
}
+ pub fn headerbar(&self) -> adw::HeaderBar {
+ self.imp().headerbar.clone()
+ }
+
fn show_toast(&self, text: impl AsRef, priority: adw::ToastPriority) {
let imp = self.imp();
@@ -691,6 +704,12 @@ impl LpWindow {
self.image_view().controls_box_start().set_opacity(opacity);
self.image_view().controls_box_end().set_opacity(opacity);
+ if self.is_headerbar_flat() {
+ self.headerbar().set_opacity(opacity);
+ } else {
+ self.headerbar().set_opacity(1.);
+ }
+
if self.is_fullscreened() && hiding && opacity < 0.9 {
self.set_cursor(gdk::Cursor::from_name("none", None).as_ref());
} else {
@@ -839,6 +858,7 @@ impl LpWindow {
.controls_box_end_events()
.contains_pointer()
&& self.is_showing_image()
+ && (!self.is_headerbar_flat() || !self.imp().headerbar_events.contains_pointer())
}
#[template_callback]
@@ -849,4 +869,39 @@ impl LpWindow {
}
self.queue_hide_controls();
}
+
+ fn is_headerbar_flat(&self) -> bool {
+ matches!(
+ self.imp().toolbar_view.top_bar_style(),
+ adw::ToolbarStyle::Flat
+ )
+ }
+
+ fn on_top_bar_style_notify(&self) {
+ if self.is_headerbar_flat() {
+ // Bring headerbar opacity in sync with controls
+ self.headerbar().set_opacity(self.controls_opacity());
+ } else {
+ self.headerbar().set_opacity(1.);
+ }
+ }
+
+ #[template_callback]
+ fn extend_to_top(&self, fullscreened: bool, show_properties: bool, show_menu: bool) -> bool {
+ fullscreened && !show_properties && !show_menu
+ }
+
+ #[template_callback]
+ fn top_bar_style(
+ &self,
+ fullscreened: bool,
+ show_properties: bool,
+ show_menu: bool,
+ ) -> adw::ToolbarStyle {
+ if self.extend_to_top(fullscreened, show_properties, show_menu) {
+ adw::ToolbarStyle::Flat
+ } else {
+ adw::ToolbarStyle::Raised
+ }
+ }
}