You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main reason to propose this MR is that for now, for any Linux target, global shortcuts do not work (or you must first click on an empty zone in the UI to get focus, which is unacceptable). The reason is quite simple: the main view (the one given to Application::new().window(|| {})) is wrapped internally by floem, in order to handle context menus. Maybe a better solution would be to remove this wrap for Linux targets, but I don't know if it's possible.
The 2nd reason is that sometimes, depending on the app you are writing, you may want the keyboard events to be handled at first by the application itself, not by the focused element; for example, for now, focused text editors will catch every keyboard event, and there is no way to quit with Ctrl-Q if you set this shortcut globally.
To summarize, as developpers we should have full control over this important aspect, but I'm certainly not enough involved to propose the best solution.
Btw as you can see, this MR is outdated, but I made a different version here where I moved the hook from Application to WindowHandle, (which allows to use the computed values for the key modifiers). I will take the time to update it soon with this new version.
I see. This is linux specific then? Good to know. We should check our implementation to work on linux too then :)
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
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.
This can be useful to handle application-level global shortcuts.
In the same time I improved the
keyboard_handlerexample, in order to demonstrate the "global shortcut" capability.EDIT: merged master and removed edits for the the
keyboard_handlerexample