Commit 995d6d7f5d55
tarball3 files changed+13-12
@@ -10,8 +10,7 @@ use smithay::utils::{Rectangle, Transform};
1010
use smithay::wayland::buffer::BufferHandler;1111
use smithay::wayland::compositor::{1212
BufferAssignment, CompositorClientState, CompositorHandler, CompositorState, Damage,13
- SurfaceAttributes, add_blocker, add_pre_commit_hook, get_parent, is_sync_subsurface,14
- with_states,13
+ SurfaceAttributes, add_blocker, add_pre_commit_hook, is_sync_subsurface, with_states,1514
};1615
use smithay::wayland::dmabuf::{1716
DmabufGlobal, DmabufHandler, DmabufState, ImportNotifier, get_dmabuf,@@ -48,10 +47,7 @@ impl CompositorHandler for State {
4847
tracing::debug!("early import failed: {e}");4948
}5049
if !is_sync_subsurface(surface) {51
- let mut root = surface.clone();52
- while let Some(parent) = get_parent(&root) {53
- root = parent;54
- }50
+ let root = crate::idle::root_surface(surface);5551
let mapped = self.wm.id_of(&root).and_then(|id| self.wm.window(id));5652
let window = mapped.or_else(|| {5753
self.wm@@ -44,16 +44,21 @@ impl IdleInhibitHandler for State {
4444
}4545
}4646
47
+pub fn root_surface(surface: &WlSurface) -> WlSurface {48
+ let mut root = surface.clone();49
+ while let Some(parent) = get_parent(&root) {50
+ root = parent;51
+ }52
+ root53
+}54
+4755
impl State {4856
/// An inhibitor only counts while its surface is on screen, as the4957
/// protocol asks, so a video on a hidden tag lets the screen blank.5058
pub fn update_inhibit(&mut self) {5159
self.services.idle.inhibitors.retain(|s| s.is_alive());5260
let shown = self.services.idle.inhibitors.iter().any(|s| {53
- let mut root = s.clone();54
- while let Some(parent) = get_parent(&root) {55
- root = parent;56
- }61
+ let root = root_surface(s);5762
self.wm5863
.space5964
.elements()@@ -468,8 +468,6 @@ impl State {
468468
}469469
}470470
471
- /// Brings a window's tag into view when it is the tag's first window,472
- /// whether it mapped there, was moved there or was placed by activation.473471
/// Moves a mapped window's input region to follow its window geometry.474472
/// GTK drops its shadow margins once told it is tiled, shifting the475473
/// geometry after `apply_layout` placed it, so clicks landed a shadow's@@ -493,6 +491,8 @@ impl State {
493491
}494492
}495493
494
+ /// Brings a window's tag into view when it is the tag's first window,495
+ /// whether it mapped there, was moved there or was placed by activation.496496
pub fn view_if_first(&mut self, id: WindowId) {497497
if self.settings.config.general.view_tag_on_first_window {498498
self.wm.layout.view_if_alone(id);