Answer a right click the way a long press is answered - #930
Open
JingMatrix wants to merge 1 commit into
Open
Conversation
A tablet with a keyboard case is a pointer device, and the way to ask a row for its menu with a pointer is the secondary button: a right click, or a two-finger tap on the touchpad. Nothing in the manager answered it. combinedClickable reads a press from any button as the beginning of an ordinary tap and finds a long press only by timing a held finger, so a right click did whatever a left click does -- opened a module's scope instead of its menu, toggled an app instead of offering to re-optimize it -- and what the hold was for could not be reached at all. The View-based manager never had to say any of this. A View shows its registered context menu on a secondary press by itself, which is why the gesture worked at all before the manager was written in Compose. It worked badly: the menu was built from the row under the pointer but acted on a field that only the long press listener wrote, so it opened against whichever row had been held last, or did nothing when none had been (#644). So the press is caught and handed to the same lambda the long press runs, the two gestures meaning the same thing -- one asked with a finger, one asked with a pointer. It is watched on the initial pass, ahead of the pass foundation listens on, and every event from the moment the button is reported held is consumed, which is also what keeps the click from landing: foundation asks for a press nothing else has taken, and for a release nothing else has taken. The action runs on the way down rather than on the release, which is when a View opens its context menu too. The rows that gain it are the ones a long press already meant something on: a module and its icon in the shared row, an app in a module's scope, and a contributor's avatar and their name on the home screen. Nothing changes for a finger.
1 task
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.
A tablet with a keyboard case is a pointer device, and the way to ask a row for its menu with a pointer is the secondary button — a right click, or a two-finger tap on the touchpad.
combinedClickablereads a press from any button as an ordinary tap and finds a long press only by timing a held finger, so a right click did whatever a left click does: opened a module's scope instead of its menu, toggled an app instead of offering to re-optimize it.The View-based manager never had to say this — a
Viewopens its registered context menu on a secondary press by itself. It did that badly: the menu was built from the row under the pointer but acted on a field only the long press listener wrote, so it opened against whichever row was held last. That is what #644 reported; Compose changed the symptom, not the cause.So the press is handed to the same lambda the long press runs, watched on the initial pass — ahead of the one foundation listens on — and consumed, which is what keeps the click from landing.
Module rows and their icons, apps in a scope, contributors on the home screen. Nothing changes for a finger.
Fixes #644.