floem_winit/platform/
wayland.rs1use crate::{
2 event_loop::{EventLoopBuilder, EventLoopWindowTarget},
3 monitor::MonitorHandle,
4 window::{Window, WindowBuilder},
5};
6
7use crate::platform_impl::{ApplicationName, Backend};
8
9pub use crate::window::Theme;
10
11pub trait EventLoopWindowTargetExtWayland {
13 fn is_wayland(&self) -> bool;
15}
16
17impl<T> EventLoopWindowTargetExtWayland for EventLoopWindowTarget<T> {
18 #[inline]
19 fn is_wayland(&self) -> bool {
20 self.p.is_wayland()
21 }
22}
23
24pub trait EventLoopBuilderExtWayland {
26 fn with_wayland(&mut self) -> &mut Self;
28
29 fn with_any_thread(&mut self, any_thread: bool) -> &mut Self;
34}
35
36impl<T> EventLoopBuilderExtWayland for EventLoopBuilder<T> {
37 #[inline]
38 fn with_wayland(&mut self) -> &mut Self {
39 self.platform_specific.forced_backend = Some(Backend::Wayland);
40 self
41 }
42
43 #[inline]
44 fn with_any_thread(&mut self, any_thread: bool) -> &mut Self {
45 self.platform_specific.any_thread = any_thread;
46 self
47 }
48}
49
50pub trait WindowExtWayland {}
52
53impl WindowExtWayland for Window {}
54
55pub trait WindowBuilderExtWayland {
57 fn with_name(self, general: impl Into<String>, instance: impl Into<String>) -> Self;
65}
66
67impl WindowBuilderExtWayland for WindowBuilder {
68 #[inline]
69 fn with_name(mut self, general: impl Into<String>, instance: impl Into<String>) -> Self {
70 self.platform_specific.name = Some(ApplicationName::new(general.into(), instance.into()));
71 self
72 }
73}
74
75pub trait MonitorHandleExtWayland {
77 fn native_id(&self) -> u32;
79}
80
81impl MonitorHandleExtWayland for MonitorHandle {
82 #[inline]
83 fn native_id(&self) -> u32 {
84 self.inner.native_identifier()
85 }
86}