mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Linux-specific: Handle Qt::Meta key in hotkeys (issue #404)
This commit is contained in:
parent
5a6c88ea09
commit
1a8bb0ae10
|
@ -412,6 +412,9 @@ void HotkeyWrapper::init()
|
||||||
lAltCode = XKeysymToKeycode( display, XK_Alt_L );
|
lAltCode = XKeysymToKeycode( display, XK_Alt_L );
|
||||||
rAltCode = XKeysymToKeycode( display, XK_Alt_R );
|
rAltCode = XKeysymToKeycode( display, XK_Alt_R );
|
||||||
|
|
||||||
|
lMetaCode = XKeysymToKeycode( display, XK_Super_L );
|
||||||
|
rMetaCode = XKeysymToKeycode( display, XK_Super_R );
|
||||||
|
|
||||||
cCode = XKeysymToKeycode( display, XK_c );
|
cCode = XKeysymToKeycode( display, XK_c );
|
||||||
insertCode = XKeysymToKeycode( display, XK_Insert );
|
insertCode = XKeysymToKeycode( display, XK_Insert );
|
||||||
kpInsertCode = XKeysymToKeycode( display, XK_KP_Insert );
|
kpInsertCode = XKeysymToKeycode( display, XK_KP_Insert );
|
||||||
|
@ -493,6 +496,10 @@ void HotkeyWrapper::handleRecordEvent( XRecordInterceptData * data )
|
||||||
key == rAltCode )
|
key == rAltCode )
|
||||||
currentModifiers |= Mod1Mask;
|
currentModifiers |= Mod1Mask;
|
||||||
else
|
else
|
||||||
|
if ( key == lMetaCode ||
|
||||||
|
key == rMetaCode )
|
||||||
|
currentModifiers |= Mod4Mask;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Here we employ a kind of hack translating KP_Insert key
|
// Here we employ a kind of hack translating KP_Insert key
|
||||||
// to just Insert. This allows reacting to both Insert keys.
|
// to just Insert. This allows reacting to both Insert keys.
|
||||||
|
@ -518,6 +525,10 @@ void HotkeyWrapper::handleRecordEvent( XRecordInterceptData * data )
|
||||||
if ( key == lAltCode ||
|
if ( key == lAltCode ||
|
||||||
key == rAltCode )
|
key == rAltCode )
|
||||||
currentModifiers &= ~Mod1Mask;
|
currentModifiers &= ~Mod1Mask;
|
||||||
|
else
|
||||||
|
if ( key == lMetaCode ||
|
||||||
|
key == rMetaCode )
|
||||||
|
currentModifiers &= ~Mod4Mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,6 +551,8 @@ bool HotkeyWrapper::setGlobalKey( int key, int key2,
|
||||||
mod |= ControlMask;
|
mod |= ControlMask;
|
||||||
if (modifier & Qt::AltModifier)
|
if (modifier & Qt::AltModifier)
|
||||||
mod |= Mod1Mask;
|
mod |= Mod1Mask;
|
||||||
|
if (modifier & Qt::MetaModifier)
|
||||||
|
mod |= Mod4Mask;
|
||||||
|
|
||||||
hotkeys.append( HotkeyStruct( vk, vk2, mod, handle, 0 ) );
|
hotkeys.append( HotkeyStruct( vk, vk2, mod, handle, 0 ) );
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ private:
|
||||||
|
|
||||||
// We do one-time init of those, translating keysyms to keycodes
|
// We do one-time init of those, translating keysyms to keycodes
|
||||||
KeyCode lShiftCode, rShiftCode, lCtrlCode, rCtrlCode, lAltCode, rAltCode,
|
KeyCode lShiftCode, rShiftCode, lCtrlCode, rCtrlCode, lAltCode, rAltCode,
|
||||||
cCode, insertCode, kpInsertCode;
|
cCode, insertCode, kpInsertCode, lMetaCode, rMetaCode;
|
||||||
|
|
||||||
quint32 currentModifiers;
|
quint32 currentModifiers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue