Gamescope: touch positions reach the compositor as positions
Description
Follows #2394 (its commit is the first one here).
In Gamescope mode the app sent every absolute pointer position (a touchscreen tap, an uncaptured mouse) as a relative move from a cursor position it tracked itself. The compositor's cursor can move without the app: it is kept inside the focused window, a window that takes the focus re-centres it, and a game can warp it. After any of these, taps landed off. #2394 covers the black-bar case; a windowed game or a launcher smaller than the screen was still wrong.
Now the position is sent as a position:
GamescopeInputSink.pointerMovecallsnativePointerAbsolute(x, y, width, height)with the container screen as the extent. The compositor maps it to the focused window.- Relative moves (captured mouse, a stick mapped to the mouse, trackpad gestures) are sent as before.
- The sink no longer keeps a cursor position.
Pending before this can merge:
-
libgamenative_drm.sobuilt from GameNative/gamenative-drm#63 (in this branch) - Gamescope payload with GameNative/gamescope#35, and the
GamescopePayload.VERSIONbump - Device test with a locally staged test payload: Device run, Poco F6 (Snapdragon 8s Gen 3), Balatro, 1280x720 container on a 2712x1220 panel (271 px bars left and right), touchscreen mode on, with GameNative/gamescope#35, GameNative/gamenative-drm#63 and utkarshdalal/GameNative#2395 together: taps on menu buttons landed on target after taps in the left bar, the right bar and a swipe that ended in a bar; taps just outside a button edge did not activate it; a card drag in a run worked; no crash or injector error in logcat. Taps were injected with adb (150 ms press). A captured mouse or a controller stick was not tested.
Recording
Type of Change
- Bug fix
- Performance / stability improvement
- Compatibility improvements
- Other (requires prior approval)
Checklist
- If I have access to
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed. - This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
- I have attached a recording of the change.
- I have read and agree to the contribution guidelines in
CONTRIBUTING.md.
Summary by cubic
Fixes Gamescope-mode taps and uncaptured mouse moves landing off-target after the compositor moves its cursor, by sending positions as positions instead of relative steps from a tracked cursor.
- Absolute pointer events go out as
(x, y)plus screen width and height; the sink no longer keeps a cursor position or sends relative deltas for absolute input. - Pan and click-drag gestures now send their step as a step, instead of projecting it from a local cursor copy.
- The guest pointer is clamped to the screen edges in
XServer, so touches in a letterbox bar stop at the edge instead of offsetting later taps. - The updated
libgamenative_drm.sois included; the gamescope payload change (GameNative/gamescope#35) is still required before this can merge.