pointer: the lease, and a driver process that only executes
There is one cursor on this compositor build and every virtual pointer writes to it, so aiming at a session is a matter of serialising input, not of binding harder. Two pieces, and the split between them is the point. `hhstreamd/pointer.py` is the lease: one holder, an idle TTL and a hard cap on an injected clock, tracked buttons, and the window-local-to-normalised arithmetic that makes "click 40px into this window" mean something on an output that is not at the layout origin. Pure, so the expiry tests move time instead of sleeping. `hhstream_pointer/` is the driver: its own process because a Wayland client needs its own connection and a blocked one must not stall the broker. It holds no lease state -- it is told what to do and does it. The manager is bound at version 2 and pointers are created with `create_virtual_pointer_with_output`; a version-1-only manager is reported and refused rather than quietly aiming at the global layout. The wlr protocol module is vendored scanner output under `_protocol/`, so a checkout builds without a code generator; `_protocol/regenerate.py` says how to refresh it and why pywayland's own scanner entry point cannot be used. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011txKimbdkqPFpq6m8KDELu
This commit is contained in:
1 parent
98374b8457
commit
0d414d76bc
21 files changed
+2417
-2
No files matched your search
@@ -0,0 +1,42 @@
|
||||
"""Fixtures for the pointer tests. Nothing here sleeps and nothing connects.
|
||||
|
||||
``src`` goes on the path because these tests run straight out of a checkout
|
||||
(``nix develop -c python -m pytest tests/pointer -q``) rather than against an
|
||||
installed package.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "src"))
|
||||
|
||||
from hhstreamd.pointer import PointerLease # noqa: E402
|
||||
|
||||
|
||||
class FakeClock:
|
||||
"""The injected clock. Tests move time; time never moves on its own."""
|
||||
|
||||
def __init__(self, now: float = 1000.0) -> None:
|
||||
self.now = float(now)
|
||||
|
||||
def __call__(self) -> float:
|
||||
return self.now
|
||||
|
||||
def advance(self, seconds: float) -> None:
|
||||
self.now += float(seconds)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def clock() -> FakeClock:
|
||||
return FakeClock()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def lease(clock: FakeClock) -> PointerLease:
|
||||
"""Short deadlines so the arithmetic in a failing test is readable."""
|
||||
|
||||
return PointerLease(ttl_s=30.0, max_s=300.0, clock=clock)
|
||||
Reference in new issue
Block a user