1
0
Fork 0
forked from wry/wry

Merge pull request #715 from mahkoh/jorth/no-root-drag

window-management: prevent dragging the root container
This commit is contained in:
mahkoh 2026-01-16 14:25:06 +01:00 committed by GitHub
commit d15b5bc980
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -1137,6 +1137,9 @@ impl SimplePointerOwnerUsecase for WindowManagementUsecase {
let (mut dx, mut dy) = pos.translate(x, y);
let owner: Rc<dyn PointerOwner> = if button == BTN_LEFT {
if let Some(tl) = pn.clone().node_into_toplevel() {
if tl.tl_data().is_root_container() {
return false;
}
seat.pointer_cursor.set_known(KnownCursor::Move);
if tl.tl_data().is_fullscreen.get() {
Rc::new(ToplevelGrabPointerOwner {
@ -1578,6 +1581,10 @@ impl UiDragUsecase for TileDragUsecase {
}
fn apply_changes(&self, seat: &Rc<WlSeatGlobal>) -> Option<Rect> {
if self.tl.tl_data().is_root_container() {
self.destination.take();
return None;
}
let (x, y) = seat.pointer_cursor.position();
let dest = seat.state.root.tile_drag_destination(
self.tl.node_id(),

View file

@ -918,6 +918,13 @@ impl ToplevelData {
}
NodeLayerLink::Tiled
}
pub fn is_root_container(&self) -> bool {
let Some(parent) = self.parent.get() else {
return false;
};
parent.node_is_workspace()
}
}
impl Drop for ToplevelData {