xdg-activation: Switch stack focus
This commit is contained in:
parent
a0aa8fb8b2
commit
14867a0893
3 changed files with 21 additions and 5 deletions
|
|
@ -584,7 +584,7 @@ impl CosmicSurface {
|
|||
|
||||
pub fn with_surfaces<F>(&self, processor: F)
|
||||
where
|
||||
F: FnMut(&WlSurface, &SurfaceData) + Copy,
|
||||
F: FnMut(&WlSurface, &SurfaceData),
|
||||
{
|
||||
match self {
|
||||
CosmicSurface::Wayland(window) => window.with_surfaces(processor),
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use calloop::LoopHandle;
|
|||
use indexmap::IndexMap;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
sync::atomic::Ordering,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use wayland_backend::server::ClientId;
|
||||
|
|
@ -1024,11 +1024,13 @@ impl Shell {
|
|||
})
|
||||
.or_else(|| {
|
||||
self.pending_layers.iter().find_map(|(l, output, _)| {
|
||||
let found = AtomicBool::new(false);
|
||||
let mut found = false;
|
||||
l.with_surfaces(|s, _| {
|
||||
found.fetch_or(s == surface, Ordering::SeqCst);
|
||||
if s == surface {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
found.load(Ordering::SeqCst).then_some(output)
|
||||
found.then_some(output)
|
||||
})
|
||||
}) {
|
||||
Some(output) => {
|
||||
|
|
|
|||
|
|
@ -128,6 +128,20 @@ impl XdgActivationHandler for State {
|
|||
.raise_element(&element, true);
|
||||
}
|
||||
|
||||
if element.is_stack() {
|
||||
if let Some((window, _)) = element.windows().find(|(window, _)| {
|
||||
let mut found = false;
|
||||
window.with_surfaces(|wl_surface, _| {
|
||||
if wl_surface == &surface {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
found
|
||||
}) {
|
||||
element.set_active(&window);
|
||||
}
|
||||
}
|
||||
|
||||
let target = element.into();
|
||||
if workspace == ¤t_workspace.handle {
|
||||
Shell::set_focus(self, Some(&target), &seat, None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue