shell: resize_request better handle tiled windows

This commit is contained in:
Victoria Brekenfeld 2024-03-07 16:54:19 +01:00
parent 20123927e0
commit e7f746ccee
2 changed files with 82 additions and 59 deletions

View file

@ -2443,7 +2443,7 @@ impl TilingLayout {
edges edges
} }
pub fn menu_resize( pub fn resize_request(
&self, &self,
mut node_id: NodeId, mut node_id: NodeId,
edge: ResizeEdge, edge: ResizeEdge,

View file

@ -2871,13 +2871,37 @@ impl Shell {
return; return;
}; };
if let Some(grab) = floating_layer.resize_request( let grab: ResizeGrab = if let Some(grab) = floating_layer.resize_request(
&mapped, &mapped,
seat, seat,
start_data.clone(), start_data.clone(),
edges, edges,
ReleaseMode::NoMouseButtons, ReleaseMode::NoMouseButtons,
) { ) {
grab.into()
} else if let Some(ws) = state.common.shell.space_for_mut(&mapped) {
let Some(node_id) = mapped.tiling_node_id.lock().unwrap().clone() else {
return;
};
let Some((node, left_up_idx, orientation)) =
ws.tiling_layer.resize_request(node_id, edges)
else {
return;
};
ResizeForkGrab::new(
start_data,
seat.get_pointer().unwrap().current_location().as_global(),
node,
left_up_idx,
orientation,
ws.output.downgrade(),
ReleaseMode::NoMouseButtons,
)
.into()
} else {
return;
};
seat.get_pointer().unwrap().set_grab( seat.get_pointer().unwrap().set_grab(
state, state,
grab, grab,
@ -2887,7 +2911,6 @@ impl Shell {
} }
} }
} }
}
pub fn resize(&mut self, seat: &Seat<State>, direction: ResizeDirection, edge: ResizeEdge) { pub fn resize(&mut self, seat: &Seat<State>, direction: ResizeDirection, edge: ResizeEdge) {
let output = seat.active_output(); let output = seat.active_output();