fix(nix): focus_follows_mouse names no implementation and no compositor

The scenario toggled with --implementation windows on both ports, and
its settle time said it was KWin's 200 ms. The default of the command
is each port's own implementation, so the flag goes, and the settle is
a named wait that is longer than what either port needs.
This commit is contained in:
LGUG2Z committed 2026-10-30 12:51:01 -07:00
1 parent f012abf6ba
commit 1c701333ad
2 files changed
+31 -4

No files matched your search

@@ -16,10 +16,16 @@ def _focused(platform: Platform, client: Client) -> bool:
return window is not None and window.focused
# how long a setting is given to be taken up before the pointer is moved. A port may read it a
# moment after it is written, or follow the pointer after a delay of its own: this is more than
# either, and it is scaled for the host like every wait
SETTLE = 1
def _settle(platform: Platform) -> None:
"""Gives a platform the time to take up a setting: KWin reads its focus policy about 200 ms
after it is written, and a pointer that is moved before that is moved under the old one."""
platform.wait_for(lambda: False, timeout=1)
"""Gives the platform the time to take up a setting: a pointer that is moved before is moved
under the old one."""
platform.wait_for(lambda: False, timeout=SETTLE)
def run(platform: Platform, checks: Checks, first: Client, second: Client) -> None:
@@ -56,7 +62,8 @@ def run(platform: Platform, checks: Checks, first: Client, second: Client) -> No
platform.wait_for(lambda: platform.state().focused_title() == first.title, timeout=10),
)
platform.komorebic("toggle-focus-follows-mouse", "--implementation", "windows")
# no `--implementation`: each port has one, and the command's default is it
platform.komorebic("toggle-focus-follows-mouse")
_settle(platform)
platform.pointer.move(*b)
checks.check(
@@ -864,3 +864,23 @@ def test_a_second_display_of_another_size_passes_hotplug() -> None:
hotplug.run(platform, checks, clients)
assert platform.displays()[1] == Rect(1920, 0, 1280, 800)
assert checks.failed == 0, checks.failures
def test_focus_follows_mouse_is_driven_without_naming_an_implementation() -> None:
"""The implementation is a port's own: the scenario leaves it to the command's default."""
class Records(FakePlatform):
def __init__(self) -> None:
super().__init__()
self.said: list[tuple[str, ...]] = []
def komorebic(self, *args: str) -> str:
self.said.append(args)
return super().komorebic(*args)
platform = Records()
checks = Checks()
clients = opened(platform, checks)
focus_follows_mouse.run(platform, checks, clients[0], clients[2])
assert checks.failed == 0, checks.failures
assert not [a for a in platform.said if "--implementation" in a]