fix(universal-control): arm on KDE, and smooth the cursor over adb-TCP - #6
Open
X-Ryl669 wants to merge 1 commit into
Open
fix(universal-control): arm on KDE, and smooth the cursor over adb-TCP#6X-Ryl669 wants to merge 1 commit into
X-Ryl669 wants to merge 1 commit into
Conversation
Universal Control never armed on Plasma. Two separate incompatibilities
with xdg-desktop-portal-kde, the first masking the second:
1. `barrier_id = 0` is rejected outright. `inputcapture.cpp` does
if (id == 0) { "Invalid barrier id"; failedBarriers.append(id); }
BEFORE any geometry check. The InputCapture spec puts no constraint on
the id and Mutter accepts 0, so this broke every KDE session while
looking like a geometry problem. Now `BARRIER_ID = 1`.
2. KWin only arms a barrier spanning the WHOLE screen edge —
`inputcapturebarrier.cpp` requires `y1 == geometry.y() && y2 ==
geometry.bottom()` and returns `BetweenScreensOrDoesNotFill`
otherwise. The 400 px corner strip (`SEGMENT_LEN`) is therefore
refused. We now retry across the full edge when the compositor
refuses the partial one, rebinding the armed `span` so `entry_point`
/ `laptop_point` still map crossings against the barrier that
actually armed. Mutter keeps the corner strip; KDE trades corner
avoidance for working at all. `barrier_pos` is split out so the retry
builds its line the same way the first attempt did.
The failure was diagnosable only from the portal's own journal
("Invalid barrier id 0") — our side could see nothing beyond a non-empty
`failed_barriers`, which is what `barrier_refused` already reported.
Also: fill gaps in traffic to the phone while it holds the pointer.
Android parks the Wi-Fi radio between packets and the AP buffers ours
until its next wake — measured 150–350 ms on an idle 5 GHz link (RSSI
-52, 866 Mbps) versus 2–13 ms awake, which made the cursor stutter badly
whenever adb rides TCP rather than USB. Driven off the existing 2 ms
flush tick and gated on `last_tx`, so it sends nothing while real motion
is flowing and stops the moment the pointer leaves. Covers `pending` too,
so the crossing lands on an already-awake radio instead of paying the
wake penalty on its first motion. `last_tx` is deliberately NOT
`last_motion`: that one is the acceleration curve's `dt`.
This is a mitigation for a transport limitation, not a fix — USB adb
remains materially smoother.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Made by Claude. This fixes the Universal Control feature on KDE Plasma Desktop and made it smooth on ADB over Wifi.
Here's Claude description:
Universal Control never armed on Plasma. Two separate incompatibilities with xdg-desktop-portal-kde, the first masking the second:
barrier_id = 0is rejected outright.inputcapture.cppdoes if (id == 0) { "Invalid barrier id"; failedBarriers.append(id); } BEFORE any geometry check. The InputCapture spec puts no constraint on the id and Mutter accepts 0, so this broke every KDE session while looking like a geometry problem. NowBARRIER_ID = 1.KWin only arms a barrier spanning the WHOLE screen edge —
inputcapturebarrier.cpprequiresy1 == geometry.y() && y2 == geometry.bottom()and returnsBetweenScreensOrDoesNotFillotherwise. The 400 px corner strip (SEGMENT_LEN) is therefore refused. We now retry across the full edge when the compositor refuses the partial one, rebinding the armedspansoentry_point/laptop_pointstill map crossings against the barrier that actually armed. Mutter keeps the corner strip; KDE trades corner avoidance for working at all.barrier_posis split out so the retry builds its line the same way the first attempt did.The failure was diagnosable only from the portal's own journal ("Invalid barrier id 0") — our side could see nothing beyond a non-empty
failed_barriers, which is whatbarrier_refusedalready reported.Also: fill gaps in traffic to the phone while it holds the pointer. Android parks the Wi-Fi radio between packets and the AP buffers ours until its next wake — measured 150–350 ms on an idle 5 GHz link (RSSI -52, 866 Mbps) versus 2–13 ms awake, which made the cursor stutter badly whenever adb rides TCP rather than USB. Driven off the existing 2 ms flush tick and gated on
last_tx, so it sends nothing while real motion is flowing and stops the moment the pointer leaves. Coverspendingtoo, so the crossing lands on an already-awake radio instead of paying the wake penalty on its first motion.last_txis deliberately NOTlast_motion: that one is the acceleration curve'sdt.This is a mitigation for a transport limitation, not a fix — USB adb remains materially smoother.