store the native mapping
This commit is contained in:
parent
cf34488842
commit
336b6f5780
|
@ -77,8 +77,8 @@ bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut)
|
|||
Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier;
|
||||
key = shortcut.isEmpty() ? Qt::Key(0) : Qt::Key((shortcut[0] ^ allMods) & shortcut[0]);
|
||||
mods = shortcut.isEmpty() ? Qt::KeyboardModifiers(0) : Qt::KeyboardModifiers(shortcut[0] & allMods);
|
||||
const quint32 nativeKey = nativeKeycode(key, mods);
|
||||
const quint32 nativeMods = nativeModifiers(mods);
|
||||
nativeKey = nativeKeycode(key, mods);
|
||||
nativeMods = nativeModifiers(mods);
|
||||
const bool res = registerShortcut(nativeKey, nativeMods);
|
||||
if (res)
|
||||
shortcuts.insert(qMakePair(nativeKey, nativeMods), &qxt_p());
|
||||
|
@ -90,8 +90,6 @@ bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut)
|
|||
bool QxtGlobalShortcutPrivate::unsetShortcut()
|
||||
{
|
||||
bool res = false;
|
||||
const quint32 nativeKey = nativeKeycode(key, mods);
|
||||
const quint32 nativeMods = nativeModifiers(mods);
|
||||
if (shortcuts.value(qMakePair(nativeKey, nativeMods)) == &qxt_p())
|
||||
res = unregisterShortcut(nativeKey, nativeMods);
|
||||
if (res)
|
||||
|
@ -100,6 +98,8 @@ bool QxtGlobalShortcutPrivate::unsetShortcut()
|
|||
qWarning() << "QxtGlobalShortcut failed to unregister:" << QKeySequence(key + mods).toString();
|
||||
key = Qt::Key(0);
|
||||
mods = Qt::KeyboardModifiers(0);
|
||||
nativeKey = 0;
|
||||
nativeMods = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
Qt::Key key;
|
||||
Qt::KeyboardModifiers mods;
|
||||
|
||||
quint32 nativeKey = 0;
|
||||
quint32 nativeMods = 0;
|
||||
|
||||
bool setShortcut(const QKeySequence& shortcut);
|
||||
bool unsetShortcut();
|
||||
|
||||
|
|
Loading…
Reference in New Issue