-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Virtual keys #340
Comments
I've been thinking about a similar approach some time ago, although in less sophisticated terms. Some notes to this sketchup (note that I by no means represent UHK team in this (and no other) matter, and my own opinions are usually rather contrary to Laci's):
|
I could implement this as a a new MouseAction, but either way, there is going to be special code in the UI and the firmware. This action is a MouseMove, it does not fit nicely into any of the current MouseActions. In addition, it does more than just MouseAction. This is about taking mouse input from a module and "doing something" with it. That "something" could be:
Technically, this moves all the "module mouse input", out of MouseController_ProcessMouseActions, and adds it as a special keyaction to be called during the applyKeyAction loop. When "mouse input" is detected in a module, it looks up the appropriate virtual key, then sets its hardwardSwitchState. When the applyKeyAction loop comes to this keyid, it sees the hardwareSwitchState, and looks up the appropriate keyAction for the active layer. This keyAction says what to do with the input, then calls into the MouseController to update x,y values or scroll values
So the basic idea is to move all the mouse configuration into unused keys in the keymap. Since the keymap is statically allocated, this is actually saving space. This is moving the navigationModes from the modules structure into keyactions within the keymap. Each keyaction in the keymap has 5 bytes to use, and this is already allocated in the keymap. Another benefit of moving into the keymap, is it allows the user to change configuration by changing keymap. This is much easier cycling between configs then opening up the agent and fiddling with the (yet unimplemted) navigation settings.
I'm not sure where you are getting this. This entirely relies on the current layer selection code. |
@steamraven Thank you very much for coming up with such a detailed solution! I've been thinking about how to introduce additional configuration options, such as module-related options, in the simplest and most general way possible and without affecting Agent, and I'm heavily leaning towards smart macros. I'm closing this issue, but feel free to follow up regardless. |
So right now, we some really cool mouse modules, but no way to configure them. Even if we did make them accessible from the agent, the code setup is pretty clunky. A solution may be Virtual Keys.
The idea is to make use of some of the keyIds in the keymap for each module that are not being used by a physical key. For example KeyId 6 in the left keycluster module, and 3 in each of the right modules.
Then we assign to this special keyid, a special new KeyAction: MouseMove. This KeyAction has a NavigationMode parameter : Cursor, Scroll, Caret
Then for each keymap, each layer, and each module, you can assign a navigation mode to the mouse functionality just by changing the KeyAction of the required KeyID
For example, we can emulate the current configuration by assigning
Of course, you can change this however you want. Each layer or keymap a different mode.
We can go farther, we can assign some Virtual Keys to gestures on the Touchpad. It currently can currently do:
We can give each of these a new virtual key (in its own module keymap, so it doesn't interfere) and assign scancodes, mosue actions, Mouse navigation, etc to each one. All Layer and keymap variable!
Technical details (see code at the bottom):
This will also require some Agent changes and a new UI for specifying these virtual keys. Changing the Agent configuration to handle the new KeyAction should be trivial and allow configuration through JSON. Adding the UI will be quite a bit more work.
KeyIds:
Here is a link to some code. I tried to break it into small commits. I haven't tested it, but it does compile.
https://github.com/steamraven/firmware/tree/keymap_mouse_move
The text was updated successfully, but these errors were encountered: