*! React to a keypad Insert key in hotkeys under Linux too.

This commit is contained in:
Konstantin Isakov 2009-04-25 10:45:42 +00:00
parent be2aa85fba
commit d1377e28bd
2 changed files with 10 additions and 2 deletions

View file

@ -311,6 +311,7 @@ void HotkeyWrapper::init()
cCode = XKeysymToKeycode( display, XK_c );
insertCode = XKeysymToKeycode( display, XK_Insert );
kpInsertCode = XKeysymToKeycode( display, XK_KP_Insert );
currentModifiers = 0;
@ -389,8 +390,15 @@ void HotkeyWrapper::handleRecordEvent( XRecordInterceptData * data )
key == rAltCode )
currentModifiers |= Mod1Mask;
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 );
}
}
else
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
{
return modifiers == ControlMask &&
( keyCode == cCode || keyCode == insertCode );
( keyCode == cCode || keyCode == insertCode || keyCode == kpInsertCode );
}
bool HotkeyWrapper::isKeyGrabbed( quint32 keyCode, quint32 modifiers ) const

View file

@ -88,7 +88,7 @@ private:
// We do one-time init of those, translating keysyms to keycodes
KeyCode lShiftCode, rShiftCode, lCtrlCode, rCtrlCode, lAltCode, rAltCode,
cCode, insertCode;
cCode, insertCode, kpInsertCode;
quint32 currentModifiers;