Drag windows by their title bar
CI / test (push) Failing after 17s

A press on a title bar (outside the buttons) focuses the window, floats it if it was
tiled (WmState::float_window) and starts a move drag; motion moves it, release ends it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Sonnet 5.5 committed 2026-11-25 00:42:38 -08:00
1 parent f05677178a
commit 8a3ea16b1c
3 files changed
+71 -1

No files matched your search

+24 -1
View File
@@ -119,7 +119,7 @@ fn MoonPlasmaCompositor::apply_actions(
match self.windows.get(wid) {
Some(win) => {
win.geometry = @scene.Rect::new(r.x, r.y, r.w, r.h)
if self.split_drag is Some(_) {
if self.split_drag is Some(_) || self.wm.drag is Some(_) {
// Dragging: send one configure per frame, not one per mouse event.
win.cfg_dirty = true
} else {
@@ -810,6 +810,13 @@ pub fn MoonPlasmaCompositor::handle_input(
self.shell.set_hover(id, xi, yi)
return
}
if self.wm.drag is Some(_) {
match self.wm.update_drag(xi, yi) {
Some(a) => self.apply_actions([a])
None => ()
}
return
}
if self.shell.pointer_move(xi, yi) || self.shell.hit(xi, yi) {
self.leave_pointer()
return
@@ -893,6 +900,11 @@ pub fn MoonPlasmaCompositor::handle_input(
self.split_drag = None
return
}
if !pressed && self.wm.drag is Some(_) {
self.wm.end_drag()
self.flush_configures()
return
}
// Right button over a swappable panel widget opens its alternatives menu.
if button == 273U && pressed && self.shell.right_click(xi, yi) {
return
@@ -910,6 +922,14 @@ pub fn MoonPlasmaCompositor::handle_input(
self.press_title_button(wid, btn)
return
}
if button == 272U {
// Drag the window by its title bar; a tiled window becomes floating first.
self.leave_pointer()
self.apply_actions([@wm.WmAction::Focus(wid), @wm.WmAction::Raise(wid)])
self.apply_actions(self.wm.float_window(wid, self.work_area))
ignore(self.wm.start_drag(wid, @wm.DragMode::Move, xi, yi))
return
}
}
_ => ()
}
@@ -1004,6 +1024,9 @@ pub fn MoonPlasmaCompositor::desired_cursor(self : MoonPlasmaCompositor) -> UInt
if shell_shape != 0U {
return shell_shape
}
if self.wm.drag is Some(_) {
return 4U
}
let handle = match self.split_drag {
Some(h) => Some(h)
None => self.handle_at(self.ptr_x.to_int(), self.ptr_y.to_int())