summaryrefslogtreecommitdiffhomepage
path: root/qxt-mini
diff options
context:
space:
mode:
authorSven Kocksch <github@miniskipper.at>2017-05-15 11:25:45 +0200
committerGitHub <noreply@github.com>2017-05-15 11:25:45 +0200
commita53a9afb7fd0d20b1667407f5d218ad9cb3d195a (patch)
treecd2f977aeba5f3950f97e4c431f8db3f440bf274 /qxt-mini
parent5c23666b58bb1dd4aea15c0d62a2f716d5be7f52 (diff)
Linux/X11: Fix hotkeys
Diffstat (limited to 'qxt-mini')
-rw-r--r--qxt-mini/qxtglobalshortcut_x11.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/qxt-mini/qxtglobalshortcut_x11.cpp b/qxt-mini/qxtglobalshortcut_x11.cpp
index a2e47ade..1cc99b67 100644
--- a/qxt-mini/qxtglobalshortcut_x11.cpp
+++ b/qxt-mini/qxtglobalshortcut_x11.cpp
@@ -206,19 +206,44 @@ public:
return DefaultRootWindow(display());
}
- bool grabKey(quint32 keycode, Window window)
+ bool grabKey(quint32 keycode, quint32 modifiers, Window window)
{
if (keybinding::incf(keycode))
{
QxtX11ErrorHandler errorHandler;
+ bool error = false;
- XGrabKey(display(), keycode, AnyModifier, window, True,
+ XGrabKey(display(), keycode, modifiers, window, True,
GrabModeAsync, GrabModeAsync);
+ if (errorHandler.error) {
+ error=true;
+ }
+ //Also grab key with num lock = on
+ XGrabKey(display(), keycode, modifiers | Mod2Mask, window, True,
+ GrabModeAsync, GrabModeAsync);
+ if (errorHandler.error) {
+ error=true;
+ }
+ //...and with scroll lock = on
+ XGrabKey(display(), keycode, modifiers | Mod5Mask, window, True,
+ GrabModeAsync, GrabModeAsync);
if (errorHandler.error) {
+ error=true;
+ }
+
+ //...and with bot = on
+ XGrabKey(display(), keycode, modifiers | Mod2Mask | Mod5Mask, window, True,
+ GrabModeAsync, GrabModeAsync);
+ if (errorHandler.error) {
+ error=true;
+ }
+
+ if(error){
ungrabKey(keycode, window);
return false;
}
+
}
return true;
@@ -262,8 +287,6 @@ bool QxtGlobalShortcutPrivate::nativeEventFilter(const QByteArray & eventType,
keystate |= Mod4Mask;
if(kev->state & XCB_MOD_MASK_SHIFT) //shift
keystate |= ShiftMask;
- if(kev->state & XCB_MOD_MASK_2) //numlock
- keystate |= Mod2Mask;
#if 0
if(key->state & XCB_MOD_MASK_3) // alt gr aka right-alt or ctrl+left-alt -- what mask is it?
keystate |= AltGrMask;
@@ -323,7 +346,7 @@ quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key)
bool QxtGlobalShortcutPrivate::registerShortcut(quint32 nativeKey, unused(quint32, nativeMods))
{
QxtX11Data x11;
- return x11.isValid() && x11.grabKey(nativeKey, x11.rootWindow());
+ return x11.isValid() && x11.grabKey(nativeKey, nativeMods, x11.rootWindow());
}
bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, unused(quint32, nativeMods))