Fix dialog placement and decorations and compact confirmation dialogs
This commit is contained in:
1 parent
24e23e2903
commit
91d2388d12
10 files changed
+83
-57
No files matched your search
+7
-2
@@ -91,7 +91,9 @@ static void close_window(void *data, struct xdg_toplevel *top) {
|
||||
static const struct xdg_toplevel_listener top_listener = {.configure = size, .close = close_window};
|
||||
#ifdef FERESE_TEST_DECORATION
|
||||
static void decoration_configure(void *data, struct zxdg_toplevel_decoration_v1 *decoration, uint32_t mode) {
|
||||
(void)data; (void)decoration; (void)mode;
|
||||
(void)data; (void)decoration;
|
||||
printf("decoration %u\n", mode);
|
||||
fflush(stdout);
|
||||
}
|
||||
static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = {.configure = decoration_configure};
|
||||
#endif
|
||||
@@ -115,7 +117,10 @@ int main(int argc, char **argv) {
|
||||
struct zxdg_toplevel_decoration_v1 *decoration =
|
||||
zxdg_decoration_manager_v1_get_toplevel_decoration(decoration_manager, top);
|
||||
zxdg_toplevel_decoration_v1_add_listener(decoration, &decoration_listener, NULL);
|
||||
zxdg_toplevel_decoration_v1_set_mode(decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
|
||||
zxdg_toplevel_decoration_v1_set_mode(decoration,
|
||||
argc >= 7 && !strcmp(argv[6], "server")
|
||||
? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE
|
||||
: ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
|
||||
}
|
||||
#endif
|
||||
xdg_toplevel_set_app_id(top, argc >= 2 ? argv[1] : "ferese.test.floating-size");
|
||||
|
||||
@@ -49,6 +49,9 @@ class FloatingPlacementTest(unittest.TestCase):
|
||||
("reopen", [.55, .55, .25, .3]),
|
||||
("rule-size", [.55, .55, .25, .3]),
|
||||
("tiled", [.55, .55, .25, .3])]}))
|
||||
saved = json.loads(memory.read_text())
|
||||
saved["dev.ferese.ScreenShare"] = {"output": "ferese-winit", "fractions": [.8, .1, .12, .1]}
|
||||
memory.write_text(json.dumps(saved))
|
||||
before = memory.read_bytes()
|
||||
display = Path(os.environ["WAYLAND_DISPLAY"])
|
||||
if not display.is_absolute():
|
||||
@@ -158,6 +161,37 @@ class FloatingPlacementTest(unittest.TestCase):
|
||||
if time.monotonic() > deadline:
|
||||
self.fail("closed client remained mapped")
|
||||
time.sleep(.01)
|
||||
# Dialogs retain their natural size and center even with stale
|
||||
# ordinary-window placement saved by an older compositor.
|
||||
for attempt in range(2):
|
||||
with (root / f"dialog-{attempt}.log").open("w+") as client_log:
|
||||
client = launch([str(root / "client"), "dev.ferese.ScreenShare",
|
||||
"400", "360", "configured", "decorated", "server"],
|
||||
stdout=client_log, stderr=log)
|
||||
deadline = time.monotonic() + 5
|
||||
while True:
|
||||
dialog = next((w for w in command("get-windows")
|
||||
if w["app_id"] == "dev.ferese.ScreenShare"), None)
|
||||
if dialog and (dialog["width"], dialog["height"]) == (400, 360):
|
||||
break
|
||||
if time.monotonic() > deadline:
|
||||
self.fail(f"dialog restored stale size: {dialog}")
|
||||
time.sleep(.025)
|
||||
output = next(o for o in command("get-outputs") if o["enabled"])
|
||||
self.assertAlmostEqual(dialog["x"] + 200, output["x"] + output["width"] / 2, delta=1)
|
||||
self.assertAlmostEqual(dialog["y"] + 180, output["y"] + output["height"] / 2, delta=1)
|
||||
time.sleep(.2)
|
||||
client_log.seek(0)
|
||||
modes = [line for line in client_log.read().splitlines() if line.startswith("decoration ")]
|
||||
self.assertTrue(modes)
|
||||
self.assertTrue(all(line == "decoration 2" for line in modes), modes)
|
||||
client.terminate()
|
||||
client.wait(timeout=3)
|
||||
deadline = time.monotonic() + 5
|
||||
while any(w["app_id"] == "dev.ferese.ScreenShare" for w in command("get-windows")):
|
||||
if time.monotonic() > deadline:
|
||||
self.fail("closed dialog remained mapped")
|
||||
time.sleep(.025)
|
||||
for mode in ["fullscreen", "maximized"]:
|
||||
app = "ferese.test.placement." + mode
|
||||
if mode == "maximized":
|
||||
|
||||
Reference in new issue
Block a user