toplevel_mgmt: Fix activating sticky windows
This commit is contained in:
parent
0efdfb25f5
commit
a4b2294bee
1 changed files with 44 additions and 26 deletions
|
|
@ -47,11 +47,11 @@ impl ToplevelManagementHandler for State {
|
||||||
.flat_map(|m| m.windows().map(|(s, _)| s))
|
.flat_map(|m| m.windows().map(|(s, _)| s))
|
||||||
.any(|w| &w == window)
|
.any(|w| &w == window)
|
||||||
});
|
});
|
||||||
if let Some((idx, workspace)) = maybe {
|
|
||||||
let seat = seat.unwrap_or(shell.seats.last_active().clone());
|
|
||||||
|
|
||||||
|
let seat = seat.clone().unwrap_or(shell.seats.last_active().clone());
|
||||||
|
let (target, new_pos) = if let Some((idx, workspace)) = maybe {
|
||||||
let handle = workspace.handle;
|
let handle = workspace.handle;
|
||||||
let res = shell.activate(
|
let new_pos = shell.activate(
|
||||||
&output,
|
&output,
|
||||||
idx,
|
idx,
|
||||||
WorkspaceDelta::new_shortcut(),
|
WorkspaceDelta::new_shortcut(),
|
||||||
|
|
@ -86,11 +86,32 @@ impl ToplevelManagementHandler for State {
|
||||||
} else {
|
} else {
|
||||||
KeyboardFocusTarget::Fullscreen(window.clone())
|
KeyboardFocusTarget::Fullscreen(window.clone())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(target, new_pos.ok())
|
||||||
|
// sticky window?
|
||||||
|
} else if let Some(mapped) = shell
|
||||||
|
.workspaces
|
||||||
|
.sets
|
||||||
|
.get(output)
|
||||||
|
.unwrap()
|
||||||
|
.sticky_layer
|
||||||
|
.mapped()
|
||||||
|
.find(|m| m.windows().any(|(w, _)| &w == window))
|
||||||
|
{
|
||||||
|
mapped.focus_window(window);
|
||||||
|
|
||||||
|
let output_geo = output.geometry();
|
||||||
|
let new_pos =
|
||||||
|
output_geo.loc + Point::from((output_geo.size.w / 2, output_geo.size.h / 2));
|
||||||
|
(KeyboardFocusTarget::Element(mapped.clone()), Some(new_pos))
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
std::mem::drop(shell);
|
std::mem::drop(shell);
|
||||||
|
|
||||||
if seat.active_output() != *output {
|
if seat.active_output() != *output {
|
||||||
match res {
|
if let Some(new_pos) = new_pos {
|
||||||
Ok(new_pos) => {
|
|
||||||
seat.set_active_output(&output);
|
seat.set_active_output(&output);
|
||||||
if let Some(ptr) = seat.get_pointer() {
|
if let Some(ptr) = seat.get_pointer() {
|
||||||
let serial = SERIAL_COUNTER.next_serial();
|
let serial = SERIAL_COUNTER.next_serial();
|
||||||
|
|
@ -106,15 +127,12 @@ impl ToplevelManagementHandler for State {
|
||||||
ptr.frame(self);
|
ptr.frame(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shell::set_focus(self, Some(&target), &seat, None, false);
|
Shell::set_focus(self, Some(&target), &seat, None, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn close(&mut self, _dh: &DisplayHandle, window: &<Self as ToplevelInfoHandler>::Window) {
|
fn close(&mut self, _dh: &DisplayHandle, window: &<Self as ToplevelInfoHandler>::Window) {
|
||||||
window.close();
|
window.close();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue