Support modifier keys
- advanced version of #453
- first 4 modifier keys are called
SHIFT,ALT,CTRL, andMETAby default, and after that they're just numbered / use custom names (or disallowed?) - we don't support multiple modifiers at once, but it is allowed to press a modifier and multiple other non-modifier buttons
- for ease of implementation, pressing a modifier while a different one is held should override the currently active modifier with the new one (i.e. modifiers activate when pressed, and deactivate when released or when a different modifier is pressed)
- [ ] Display tabs for modifier keys
- pressing a button assigned to a modifier key moves to that tab, but tabs can also be changed by clicking
- [ ] Functions mapping table for advanced configuration (/if there isn't an SVG)
- should likely be hidden by default, in a collapsible "advanced configuration" section
- columns are modifier keys, rows are (virtual) joystick button numbers
- each column can be optionally counted as a MAVLink
MANUAL_CONTROLshift button, except the REGULAR column - pressing a button/modifier-combination highlights the corresponding table cell(s), as well as the column+row headings
- since simultaneous modifiers aren't supported only one column should ever be highlighted at a time, but several rows can be highlighted at once (corresponding to the current modifier as well as any non-modifier buttons that are held down)
- clicking a table cell allows changing the assigned function
- if a cell is assigned as a modifier key, the rest of the row is greyed out
- MAVLink
MANUAL_CONTROLbutton function assignments also show theBTNn"n" number they're assigned to, or "Sn" for shifted button functions- we may want a toggle switch somewhere to turn this on/off, since users likely don't care about it most of the time
- adding a new modifier key is possible by clicking the
+button in the tabs or on the right of the table
If Cockpit is going to allow adding more than the initial 4 modifier keys, I think the layers should just start out as numbered rather than starting with the named ones then being numbered as more are added. Keyboard layout software usually uses the idea of numbered layers, with modifiers just associated with each layer.
The modifiers can also behave in different ways. They can be momentary, where the layer is only active while the modifier is held down, or toggle, where pressing the modifier changes to the layer and it only changes back when the modifier it pressed again (not sure how helpful that would be but options ¯\(ツ)/¯).
If there are only going to be 4 layers allowed then I guess it doesn't matter what they're called.
Actually a situation where a toggle function for a modifier would be useful just came up when discussing default controller layouts.
Instead of a combo button press, it would be cool if one could choose whether the modifier key is momentary or toggle.
The interface isn't streamlined for it (i.e. this serves as a workaround), but it's technically possible to have effectively infinite modifier keys now with compound variables.