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
View File
@@ -697,3 +697,27 @@ test "the dock module magnifies the tile under the pointer and shows nothing whe
comp.handle_input(@nested.InputEvent::PointerMove(640.0, 300.0), 2U)
assert_eq(comp.shell.hover_slot, "")
}
///|
test "dragging a title bar moves the window and floats it" {
let socket_path = "/tmp/wayland-moon-wdrag-" +
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
let g0 = comp.windows.get(2UL).unwrap().geometry
let sx = g0.x + g0.w / 3
let sy = g0.y - 16 // inside the title bar, clear of the buttons
comp.handle_input(@nested.InputEvent::PointerMove(sx.to_double(), sy.to_double()), 1U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), 2U)
comp.handle_input(@nested.InputEvent::PointerMove((sx - 120).to_double(), (sy + 60).to_double()), 3U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), 4U)
let g1 = comp.windows.get(2UL).unwrap().geometry
assert_eq(g1.x, g0.x - 120)
assert_eq(g1.y, g0.y + 60)
assert_eq(g1.w, g0.w)
// The other window now has the whole tiling area.
assert_true(comp.windows.get(1UL).unwrap().geometry.w > g0.w)
}