← Commit history

0.9.308: Motion gate: GetForegroundWindow can lag AD's z-order right after a raise, which aborted the symbol beat's motion at its first gesture on John's laptop while AD had already measured the window on top; the gate now waits up to 1.5 s for the OS to agree. Panel record keeps the callback URL across stage-advance shows.

John Lauer ·82e6b6d1b2 ·1mo ago ·parent c039166
1 file changed +9−3
handlers/demo_motion.py+9−3
@@ -192,9 +192,15 @@ def choreograph(hwnd: int, kind: str, abort=None, log=None) -> dict:     def gate(name: str) -> bool:         if abort and abort():             rep["aborted"] = f"stop requested before {name}"; return False-        if not is_front(hwnd):-            rep["aborted"] = f"window not in front before {name} (user switched away)"; return False-        return True+        # GetForegroundWindow can lag AD's z-order by a beat right after a raise+        # (John's laptop, 2026-09-03: the symbol beat aborted at its FIRST+        # gesture while AD had already measured the window on top). Give the+        # OS up to 1.5 s to agree before calling it a user switch.+        for _ in range(6):+            if is_front(hwnd):+                return True+            time.sleep(0.25)+        rep["aborted"] = f"window not in front before {name} (user switched away)"; return False      if kind == "3d":         try: