-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Added the ability to customize keyboard shortcuts. Fix for: #92 and #13 #100
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR! Can you give an intro to the general architecture of this please? |
try { | ||
x /= instance.mScaling; | ||
y /= instance.mScaling; | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to not indent code that's not being changed. This makes reviewing changes very hard :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I'm really sorry. I've never made a pull request before. This seems a bit tricky. I can pull the latest version, make my edits where needed, and repeat the pull-request. Will it save the situation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies in advance for my English. I rely a lot on Google translator.
I don't know if my approach is architecturally correct, but here's what it is:
There is a VNCKey enumeration, each member of which corresponds to a keysym, and has one parameter that is responsible for the current state of the key (pressed / released). The onKeyEvent event of the InputService passes the corresponding key (if it was defined in the enum) a new status. Thus, at any point in the program, when accessing the button, you can find out its current state.
Hotkey processing also has a fairly simple principle: There is a small "HotkeyBinding" class, which includes an array of three VNCKeys, and a stub for anonymous classes implemented on the basis of the ICommand interface. This interface has only one method: void execute();, which is responsible for what exactly this keyboard shortcut does. Further, the matter is small: in the InputService, you can add any key combination to the static constant HOTKEY_BINDINGS by writing a couple of lines.
As for the user interface, the code looks scary, but it works. All shortcuts are added to the user interface dynamically, and do not require any intervention in the process. The programmer just needs to add a new line to the HOTKEY_BINDINGS constant, and he does not have to worry about everything else. That was the idea
…F12 in the GUI. Added hotkeys: Power dialog, Notifications and Split screen
Hi @QuantMad I'm currently quite busy with $$$-work, so expect this to wait a bit. |
Full customization of keyboard shortcuts. There are plans to add the ability to create custom keyboard shortcuts (such as launching other applications)