fix: window controls on linux not clickable

This commit is contained in:
Michael Aaron Murphy 2024-07-31 08:06:05 +02:00
parent 716b3dee56
commit 9e344b15c3
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -361,22 +361,22 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
macro_rules! icon { macro_rules! icon {
($name:expr, $size:expr, $on_press:expr) => {{ ($name:expr, $size:expr, $on_press:expr) => {{
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ let icon = { widget::icon::from_name($name).apply(widget::button::icon) };
widget::icon::from_name($name).apply(widget::button::icon)
}
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
{ let icon = {
widget::icon::from_svg_bytes(include_bytes!(concat!( widget::icon::from_svg_bytes(include_bytes!(concat!(
"../../res/icons/", "../../res/icons/",
$name, $name,
".svg" ".svg"
))) )))
.apply(widget::button::icon) .apply(widget::button::icon)
} };
.style(crate::theme::Button::HeaderBar)
.selected(self.focused) icon.style(crate::theme::Button::HeaderBar)
.icon_size($size) .selected(self.focused)
.on_press($on_press) .icon_size($size)
.on_press($on_press)
}}; }};
} }
@ -391,7 +391,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
.push_maybe( .push_maybe(
self.on_minimize self.on_minimize
.take() .take()
.map(|m| icon!("window-minimize-symbolic", 16, m)), .map(|m: Message| icon!("window-minimize-symbolic", 16, m)),
) )
.push_maybe( .push_maybe(
self.on_maximize self.on_maximize