Skip to content

Commit 9983aca

Browse files
committed
overlay: the XWayland backing in its own module
1 parent 59d3913 commit 9983aca

2 files changed

Lines changed: 25 additions & 18 deletions

File tree

‎crates/rune/src/overlay.rs‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ mod frame;
4545
use frame::{idle_after, render_frame, step};
4646
#[path = "overlay/placement.rs"]
4747
mod placement;
48+
#[path = "overlay/xwayland.rs"]
49+
mod xwayland;
4850
#[cfg(not(target_os = "macos"))]
4951
pub(crate) use placement::monitor_at;
5052
use placement::{monitor, position};
@@ -611,24 +613,6 @@ impl<T: 'static> Overlay<T> {
611613
None
612614
}
613615

614-
/// The compositor has no layer-shell (GNOME): an overlay that takes no input shows on
615-
/// XWayland when there is one.
616-
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
617-
fn xwayland(&mut self) -> Option<Live> {
618-
if self.options.input.resolved(self.interactive) != OverlayInput::None || self.options.keys == KeyPolicy::OnDemand { return None; }
619-
let surface = crate::x11::xwayland::XwaylandSurface::new(self.name, self.at, &self.options)?;
620-
let scale = surface.scale();
621-
self.shared.native.lock().unwrap().1 = crate::OverlayCapabilities {
622-
capture_exclusion: OverlaySupport::Unsupported, global_pointer: OverlaySupport::Unsupported, nonactivating_keys: OverlaySupport::Unsupported,
623-
};
624-
self.attach(Backing::Xwayland(surface), scale)
625-
}
626-
627-
#[cfg(not(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android"))))]
628-
fn xwayland(&mut self) -> Option<Live> {
629-
None
630-
}
631-
632616
fn window(&mut self, event_loop: &ActiveEventLoop) -> Option<Live> {
633617
let mut attrs = Window::default_attributes()
634618
.with_title(self.name)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! An overlay's XWayland backing, for a Wayland compositor without layer-shell.
2+
3+
use super::*;
4+
5+
impl<T: 'static> Overlay<T> {
6+
/// The compositor has no layer-shell (GNOME): an overlay that takes no input shows on
7+
/// XWayland when there is one.
8+
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
9+
pub(super) fn xwayland(&mut self) -> Option<Live> {
10+
if self.options.input.resolved(self.interactive) != OverlayInput::None || self.options.keys == KeyPolicy::OnDemand { return None; }
11+
let surface = crate::x11::xwayland::XwaylandSurface::new(self.name, self.at, &self.options)?;
12+
let scale = surface.scale();
13+
self.shared.native.lock().unwrap().1 = crate::OverlayCapabilities {
14+
capture_exclusion: OverlaySupport::Unsupported, global_pointer: OverlaySupport::Unsupported, nonactivating_keys: OverlaySupport::Unsupported,
15+
};
16+
self.attach(Backing::Xwayland(surface), scale)
17+
}
18+
19+
#[cfg(not(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android"))))]
20+
pub(super) fn xwayland(&mut self) -> Option<Live> {
21+
None
22+
}
23+
}

0 commit comments

Comments
 (0)