mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
*! React to a keypad Insert key in hotkeys under Linux too.
This commit is contained in:
parent
be2aa85fba
commit
d1377e28bd
|
@ -311,6 +311,7 @@ void HotkeyWrapper::init()
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
currentModifiers = 0;
|
currentModifiers = 0;
|
||||||
|
|
||||||
|
@ -389,7 +390,14 @@ void HotkeyWrapper::handleRecordEvent( XRecordInterceptData * data )
|
||||||
key == rAltCode )
|
key == rAltCode )
|
||||||
currentModifiers |= Mod1Mask;
|
currentModifiers |= Mod1Mask;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Here we employ a kind of hack translating KP_Insert key
|
||||||
|
// to just Insert. This allows reacting to both Insert keys.
|
||||||
|
if ( key == kpInsertCode )
|
||||||
|
key = insertCode;
|
||||||
|
|
||||||
emit keyRecorded( key, currentModifiers );
|
emit keyRecorded( key, currentModifiers );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ( event->u.u.type == KeyRelease )
|
if ( event->u.u.type == KeyRelease )
|
||||||
|
@ -441,7 +449,7 @@ bool HotkeyWrapper::setGlobalKey( int key, int key2,
|
||||||
bool HotkeyWrapper::isCopyToClipboardKey( quint32 keyCode, quint32 modifiers ) const
|
bool HotkeyWrapper::isCopyToClipboardKey( quint32 keyCode, quint32 modifiers ) const
|
||||||
{
|
{
|
||||||
return modifiers == ControlMask &&
|
return modifiers == ControlMask &&
|
||||||
( keyCode == cCode || keyCode == insertCode );
|
( keyCode == cCode || keyCode == insertCode || keyCode == kpInsertCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HotkeyWrapper::isKeyGrabbed( quint32 keyCode, quint32 modifiers ) const
|
bool HotkeyWrapper::isKeyGrabbed( quint32 keyCode, quint32 modifiers ) const
|
||||||
|
|
|
@ -88,7 +88,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;
|
cCode, insertCode, kpInsertCode;
|
||||||
|
|
||||||
quint32 currentModifiers;
|
quint32 currentModifiers;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue