Skip to content

Commit c6faf94

Browse files
committed
cfg the partially the panel example
1 parent 455b4dc commit c6faf94

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

examples/floating_panel.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
windows_subsystem = "windows"
44
)]
55

6+
#[cfg(target_os = "linux")]
7+
use freya::winit::platform::x11::{
8+
WindowAttributesExtX11,
9+
WindowType,
10+
};
611
use freya::{
712
prelude::*,
813
winit::{
914
dpi::LogicalPosition,
10-
platform::x11::{
11-
WindowAttributesExtX11,
12-
WindowType,
13-
},
1415
window::WindowLevel,
1516
},
1617
};
@@ -27,22 +28,23 @@ fn main() {
2728
.with_transparency(true)
2829
.with_background(Color::TRANSPARENT)
2930
.with_window_attributes(move |attributes, el| {
30-
let attributes = attributes
31-
.with_x11_window_type(vec![WindowType::Dock])
32-
.with_window_level(WindowLevel::AlwaysOnTop);
31+
#[cfg(target_os = "linux")]
32+
let attributes = attributes.with_x11_window_type(vec![WindowType::Dock]);
33+
34+
let mut attributes = attributes.with_window_level(WindowLevel::AlwaysOnTop);
3335

3436
if let Some(monitor) = el
3537
.primary_monitor()
3638
.or_else(|| el.available_monitors().next())
3739
{
3840
let size = monitor.size();
39-
attributes.with_position(LogicalPosition {
41+
attributes = attributes.with_position(LogicalPosition {
4042
x: size.width as i32 / 2 - width / 2,
4143
y: 40,
4244
})
43-
} else {
44-
attributes
4545
}
46+
47+
attributes
4648
}),
4749
),
4850
)

0 commit comments

Comments
 (0)