focus: Don't sort children behind their parents
This commit is contained in:
parent
4709a1d684
commit
de83185af9
1 changed files with 26 additions and 4 deletions
|
|
@ -10,13 +10,14 @@ use smithay::{
|
||||||
desktop::{layer_map_for_output, PopupUngrabStrategy},
|
desktop::{layer_map_for_output, PopupUngrabStrategy},
|
||||||
input::Seat,
|
input::Seat,
|
||||||
utils::{IsAlive, Serial, SERIAL_COUNTER},
|
utils::{IsAlive, Serial, SERIAL_COUNTER},
|
||||||
|
wayland::seat::WaylandFocus,
|
||||||
};
|
};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
|
|
||||||
use self::target::{KeyboardFocusTarget, WindowGroup};
|
use self::target::{KeyboardFocusTarget, WindowGroup};
|
||||||
|
|
||||||
use super::CosmicSurface;
|
use super::{layout::floating::FloatingLayout, CosmicSurface};
|
||||||
|
|
||||||
pub mod target;
|
pub mod target;
|
||||||
|
|
||||||
|
|
@ -170,9 +171,7 @@ impl Shell {
|
||||||
let _ = xwm.raise_window(&window);
|
let _ = xwm.raise_window(&window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if workspace.floating_layer.mapped().any(|m| m == focused) {
|
raise_with_children(&mut workspace.floating_layer, focused);
|
||||||
workspace.floating_layer.space.raise_element(focused, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for window in workspace.mapped() {
|
for window in workspace.mapped() {
|
||||||
window.set_activated(focused_windows.contains(&window));
|
window.set_activated(focused_windows.contains(&window));
|
||||||
|
|
@ -182,6 +181,29 @@ impl Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn raise_with_children(floating_layer: &mut FloatingLayout, focused: &CosmicMapped) {
|
||||||
|
if floating_layer.mapped().any(|m| m == focused) {
|
||||||
|
floating_layer.space.raise_element(focused, true);
|
||||||
|
for element in floating_layer
|
||||||
|
.space
|
||||||
|
.elements()
|
||||||
|
.filter(|elem| {
|
||||||
|
let parent = match elem.active_window() {
|
||||||
|
CosmicSurface::Wayland(w) => w.toplevel().parent(),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
parent == focused.active_window().wl_surface()
|
||||||
|
})
|
||||||
|
.cloned()
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_iter()
|
||||||
|
{
|
||||||
|
raise_with_children(floating_layer, &element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Common {
|
impl Common {
|
||||||
pub fn set_focus(
|
pub fn set_focus(
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue