:windows {"app.id" {:x :y :w :h}} is written when a floating window is dragged or resized and
read at startup; an app opening later gets its last place (floating, clamped on screen).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b99b0063e
commit
235f17cd70
4 files changed
+121
-6
No files matched your search
@@ -943,3 +943,38 @@ test "clicking a floating window brings it in front of the others" {
|
||||
assert_eq(after[1], back)
|
||||
assert_eq(after[0], front)
|
||||
}
|
||||
|
||||
///|
|
||||
test "a window dragged somewhere reopens there, saved per app in state.edn" {
|
||||
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
|
||||
write_state_edn("{:note \"keep\"}\n")
|
||||
let sock1 = "/tmp/wayland-moon-wp1-" + @sys.getpid().to_string() + ".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let a = @host.MoonPlasmaCompositor::new(sock1, theme, 1280, 720).unwrap()
|
||||
a.shell.persist = true
|
||||
a.set_layout_mode(@wm.LayoutMode::Floating)
|
||||
ignore(open_and_configure_client(a, sock1, "T", "org.test.app"))
|
||||
ignore(a.compose_frame())
|
||||
let g0 = a.windows.get(1UL).unwrap().geometry
|
||||
// Drag its title bar 120px right and 60px down.
|
||||
a.handle_input(@nested.InputEvent::PointerMove((g0.x + 20).to_double(), (g0.y - 16).to_double()), 10U)
|
||||
a.handle_input(@nested.InputEvent::PointerButton(272U, true), 11U)
|
||||
a.handle_input(@nested.InputEvent::PointerMove((g0.x + 140).to_double(), (g0.y + 44).to_double()), 12U)
|
||||
a.handle_input(@nested.InputEvent::PointerButton(272U, false), 13U)
|
||||
let g1 = a.windows.get(1UL).unwrap().geometry
|
||||
assert_true(g1.x != g0.x || g1.y != g0.y)
|
||||
let text = read_state_edn()
|
||||
assert_true(text.contains("\"org.test.app\"") && text.contains(":windows"))
|
||||
assert_true(text.contains(":note \"keep\""))
|
||||
// A new session: the same app opens where it was left.
|
||||
let sock2 = "/tmp/wayland-moon-wp2-" + @sys.getpid().to_string() + ".sock"
|
||||
let b = @host.MoonPlasmaCompositor::new(sock2, theme, 1280, 720).unwrap()
|
||||
b.shell.persist = true
|
||||
b.restore_state()
|
||||
ignore(open_and_configure_client(b, sock2, "T", "org.test.app"))
|
||||
ignore(b.compose_frame())
|
||||
let g2 = b.windows.get(1UL).unwrap().geometry
|
||||
assert_eq(g2.x, g1.x)
|
||||
assert_eq(g2.y, g1.y)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user