-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add g-key support for use in global shortcuts #1730
Conversation
I don't have a logitech mouse with gkeys, so someone else needs to test that
@@ -557,12 +566,53 @@ void GlobalShortcutWin::timeTicked() { | |||
handleButton(ql, rgdod[j].dwData & 0x80); | |||
} | |||
} | |||
#ifdef USE_GKEYS | |||
if (gkey->isValid()) { | |||
for (int button = GKEY_MIN_MOUSE_BUTTON; button <= GKEY_MAX_MOUSE_BUTTON; button++) { |
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.
Indentation.
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.
Wierd, my editor switched to spaces for those lines. Fixed. Should I just squash in the indentation fix?
I'd like if this was using a GUID for G-keys instead. Fits the GlobalShortcut_win architecture better. I'd like it if you added a comment at the top of Gkeys.cpp saying: "The code interfacing with the Logitech G-Keys DLL was implemented using the following spec:\n\n" Let's rename the file from Gkeys.{cpp,h} to GKeys.{cpp,h}. Very nitpicky. I think we might as well enable G-keys support by default. Code LGTM.... If you implement my spec, registry querying and GUIDs for G-Ke-Keyboard and G-Key-Mouse, I think it's ready to go in. |
I guess also means I prefer the class to be called GKeyLibrary. :-) |
Oh, and the !CONFIG(no-gkeys) would probably need to go after CONFIG(gkeys)... |
Also, I would like to ask you to include a config option (no UI, just a config option) for disabling G-keys suport. You can base it on 18c359f I think it should just be called "shortcut/gkey" or something. I don't think we need to put it under "shortcut/win/gkey" since it is not OS-vendor specific. We could grow an implementation for other OSes in the future, so "shortcut/gkey" seems fine. It should be enabled by default. In GlobalShortcut_win.cpp, you can then just do (g.s.bEnableGKey) { gkeys = new GKeyLibrary(); }, and gate the polling inside the ifdefs with a similar check. This allows us to have users apply a registry hotfix to disable G-Key support in case it causes performance problems, hangs or crashes in the future. |
Awesome! should I just create a guid with Should I include the full text of the spec in the comment, or just a link? I would anticipate that the only other os that this would be needed for is OSX. (Since Linux users have to use custom drivers 😓) I'll do all of this sometime tomorrow (PDT). It's late. |
Just create a v4 GUID somewhere. I use python: import uuid; uuid.uuid4(). Spec: just include a line stating you implemented it using the spec below, and include it verbatim inside the source file. |
You might also want to add a small doc snipped inside the .cpp file describing how to setup Logitech Gaming Software to interact with Mumble. You are right that it probably should live in the Wiki for end-users to see, but I think it would be nice to have in the code as well. |
And done! |
QLibrary qlLogiGkey; | ||
bool bValid; | ||
|
||
bool (*LogiGkeyInit)(void *); |
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.
BOOL as per the spec.
Looks pretty good now! I know I suggested GKeys.cpp and GKeys.h, but would it be more correct for it to be GKey.cpp and GKey.h? And USE_GKEY? It fits better with the class name, DLL function names and so on. If it's not too burdensome, I think we should change it to just be GKey all around. |
#ifndef MUMBLE_MUMBLE_GKEY_H | ||
#define MUMBLE_MUMBLE_GKEY_H | ||
|
||
// #include <stdint.h> |
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.
Drop if not needed?
Use utf16 for registry query Remove unused comments and code Use BOOL instead of bool as defined by spec Drop extra warning
Yeah, I'm fine with renaming stuff (except that when I changed "USE_GKEYS" to "USE_GKEY", I had do do a clean build cuz the pch had the old define. 😧) I also changed the qmake flag from |
Looks good! One thing: I can't land this with the current license text. You've changed "All rights reserved" to "Some rights reserved", which I myself don't particularly mind. But the "All rights reserved" text is part of the 3-clause BSD license, whether we like it or not. So it ought to stay. I would have done this myself, but since your modified BSD-license text contains "Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.", I cannot make that change myself, as I would breach the license. So in order for me to be able to land this, please revert it back to the default 3-clause BSD license used elsewhere in Mumble. Thanks! |
Sorry about that. I usually just slap a LICENSE file at the base of my project, and then not really pay attention to the individual file header license text. |
Marking as ready-to-land. LGTM. I will land once I am able to. |
Landed as 6c096c3. Very sorry for the long wait. :-( |
Oh, and just to add: Thank you very much, this is pretty cool :-) |
Any idea when the build with this addition be released? and If I want to build this myself do I have to use the gkey flag? I want to test this on my G500 and G710+ |
I will do a snapshot soon. |
Triggered a snapshot... It's building! @pyrojoe The gkey CONFIG option is always on, unless disabled with CONFIG-=no-gkey. |
Thanks @mkrautz I saw the snapshot "mumble-1.3.0 I've tested it and I've got it working on both my keyboard (G710+) and mouse (G500 predecessor to the G502). I had to reinstall LGS for it to work on both my machines. The downside of this implementation is mumble only reacts to that key while the mumble profile is active (either when mumble is in focus or if you have that profile set as persistent) This means the mumble profile is the only profile you can use, if you have profiles with bindings for games you can't use them. So while this sounded like a useful feature on paper it's only useful to those who use one profile across all their applications anyway. It would also be a viable solution if the G-keys could be assigned in all profiles. Then I could just have my mouse button set to the G-key for all profiles and not have to worry about it. But as far as I can tell you can only assign the G-key for programs that support it, and only one program can use a G-key at a time. To be sure, is my understanding correct @forivall ? If it is I'm trying to figure out the benefit of this addition. I didn't have much familiarity with G-Keys so wasn't expecting the use case to be so narrow =/ |
@pyrojoe Yes, unfortunately, that is correct. That's just the way that the LGS works and the way that the G-key API works, and the G-key API is the only way to listen directly to g-keys. I wish that Logitech would allow a way to globally listen to g-keypresses, without requiring a profile. The only other ways to interact with the G-keys are by using the LGS GUI or embedded Lua, which don't lend well to direct integration with mumble. The third solution would be to use the Lua scripting to simulate F13-F18, and fix #987. However, that's a harder bug, and one that I'm not equipped to try to fix 😞. This behaviour is documented in the code (link), and will be updated in the wiki. I was just waiting for this pr to land before updating the wiki; didn't want to document something that hasn't landed yet. I'll also add screenshots 🎉. One thing that you may have missed is that you can also set the mumble profile as the default, so if you have a specific game profile, it will still activate. Personally, I really only use one profile anyways. |
Fixes #1721
There are still some todos for this before it should be merged:
The location of the dll needs to be loaded by looking at the registry, instead of how it is currently hardcodedsee checklist.code review plz! I modeled it after CELTCodec.cpp/h."LGTM"should theCreate a uuid for gkeys and gmousebuttonsQList<QVariant>
format for passing around buttons be made uniform, so that the first element is always a signifier of if it's a dinput or a gkey? or should i create a uuid for gkeys, and keep the list length at 2?And finally, the instructions to the user, that will need to be placed somewhere on the wiki: This requires Logitech Gaming Software version 8.55+, and they need to set the mumble profile to "Set as Default" or "Set as Persistent" to allow the keys to work while mumble is in the background.Included in pr.