xdg-activation/toplevel-management: Unmaximize when activating a tiled window

This commit is contained in:
Victoria Brekenfeld 2025-03-26 18:25:22 +01:00 committed by Victoria Brekenfeld
parent d46ed304b8
commit b0d0bfb034
2 changed files with 37 additions and 2 deletions

View file

@ -53,12 +53,28 @@ impl ToplevelManagementHandler for State {
.unwrap() .unwrap()
.clone(); .clone();
let handle = workspace.handle;
let res = shell.activate( let res = shell.activate(
&output, &output,
idx, idx,
WorkspaceDelta::new_shortcut(), WorkspaceDelta::new_shortcut(),
&mut self.common.workspace_state.update(), &mut self.common.workspace_state.update(),
); );
let workspace = shell.workspaces.space_for_handle_mut(&handle).unwrap();
if seat.get_keyboard().unwrap().current_focus() != Some(mapped.clone().into())
&& workspace.is_tiled(&mapped)
{
for mapped in workspace
.mapped()
.filter(|m| m.maximized_state.lock().unwrap().is_some())
.cloned()
.collect::<Vec<_>>()
.into_iter()
{
workspace.unmaximize_request(&mapped);
}
}
std::mem::drop(shell); std::mem::drop(shell);
if seat.active_output() != *output { if seat.active_output() != *output {

View file

@ -154,10 +154,29 @@ impl XdgActivationHandler for State {
} }
if in_current_workspace { if in_current_workspace {
let target = element.into(); if seat.get_keyboard().unwrap().current_focus()
!= Some(element.clone().into())
&& current_workspace.is_tiled(&element)
{
for mapped in current_workspace
.mapped()
.filter(|m| m.maximized_state.lock().unwrap().is_some())
.cloned()
.collect::<Vec<_>>()
.into_iter()
{
current_workspace.unmaximize_request(&mapped);
}
}
std::mem::drop(shell); std::mem::drop(shell);
Shell::set_focus(self, Some(&target), &seat, None, false); Shell::set_focus(
self,
Some(&element.clone().into()),
&seat,
None,
false,
);
} else if let Some(w) = element_workspace { } else if let Some(w) = element_workspace {
shell.append_focus_stack(&element, &seat); shell.append_focus_stack(&element, &seat);
let mut workspace_guard = self.common.workspace_state.update(); let mut workspace_guard = self.common.workspace_state.update();