|
|
|
@ -68,8 +68,8 @@ static void calculateGrabMasks()
|
|
|
|
|
g_keyModMaskXOnOrOff =
|
|
|
|
|
KKeyServer::modXLock() |
|
|
|
|
|
KKeyServer::modXNumLock() |
|
|
|
|
|
KKeyServer::modXScrollLock() |
|
|
|
|
|
KKeyServer::modXModeSwitch();
|
|
|
|
|
KKeyServer::modXScrollLock() |
|
|
|
|
|
KKeyServer::modXModeSwitch();
|
|
|
|
|
//kdDebug() << "g_keyModMaskXAccel = " << g_keyModMaskXAccel
|
|
|
|
|
// << "g_keyModMaskXOnOrOff = " << g_keyModMaskXOnOrOff << endl;
|
|
|
|
|
}
|
|
|
|
@ -164,8 +164,9 @@ bool KGlobalAccelPrivate::grabKey( const KKeyServer::Key& key, bool bGrab, KAcce
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Make sure that grab masks have been initialized.
|
|
|
|
|
if( g_keyModMaskXOnOrOff == 0 )
|
|
|
|
|
if( g_keyModMaskXOnOrOff == 0 ) {
|
|
|
|
|
calculateGrabMasks();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uchar keyCodeX = key.code();
|
|
|
|
|
uint keyModX = key.mod() & g_keyModMaskXAccel; // Get rid of any non-relevant bits in mod
|
|
|
|
@ -176,6 +177,14 @@ bool KGlobalAccelPrivate::grabKey( const KKeyServer::Key& key, bool bGrab, KAcce
|
|
|
|
|
keyModX |= KKeyServer::modXAlt();
|
|
|
|
|
keyCodeX = 111;
|
|
|
|
|
}
|
|
|
|
|
// If the MODE_SWITCH modifier was set in the original key, and was truncated in g_keyModMaskXAccel, XGrabKey will grab the wrong key
|
|
|
|
|
// See Bug 1676
|
|
|
|
|
if ((key.mod() & KKeyServer::MODE_SWITCH) && (!(g_keyModMaskXAccel & KKeyServer::MODE_SWITCH))) {
|
|
|
|
|
// FIXME
|
|
|
|
|
// Is there any way to make AltGr-based character sequences work with XGrabKey?
|
|
|
|
|
kdWarning(125) << "KGlobalAccelPrivate::grabKey( " << key.key().toStringInternal() << ", " << bGrab << ", \"" << (pAction ? pAction->name().latin1() : "(null)") << "\" ): Tried to grab key requiring ISO_Level3_Shift (AltGr) sequence." << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef __osf__
|
|
|
|
|
// this crashes under Tru64 so .....
|
|
|
|
@ -183,8 +192,9 @@ bool KGlobalAccelPrivate::grabKey( const KKeyServer::Key& key, bool bGrab, KAcce
|
|
|
|
|
.arg( key.key().toStringInternal() ).arg( bGrab )
|
|
|
|
|
.arg( keyCodeX, 0, 16 ).arg( keyModX, 0, 16 ));
|
|
|
|
|
#endif
|
|
|
|
|
if( !keyCodeX )
|
|
|
|
|
if( !keyCodeX ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef Q_WS_X11
|
|
|
|
|
KXErrorHandler handler( XGrabErrorHandler );
|
|
|
|
@ -253,8 +263,9 @@ bool KGlobalAccelPrivate::x11Event( XEvent* pEvent )
|
|
|
|
|
x11MappingNotify();
|
|
|
|
|
return false;
|
|
|
|
|
case XKeyPress:
|
|
|
|
|
if( x11KeyPress( pEvent ) )
|
|
|
|
|
if( x11KeyPress( pEvent ) ) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return TQWidget::x11Event( pEvent );
|
|
|
|
|
}
|
|
|
|
@ -275,7 +286,7 @@ void KGlobalAccelPrivate::fakeKeyPressed(unsigned int keyCode) {
|
|
|
|
|
codemod.code = keyCode;
|
|
|
|
|
codemod.mod = 0;
|
|
|
|
|
|
|
|
|
|
KKey key = (keyCode, 0);
|
|
|
|
|
KKey key(keyCode, 0);
|
|
|
|
|
|
|
|
|
|
kdDebug(125) << "fakeKeyPressed: seek " << key.toStringInternal()
|
|
|
|
|
<< TQString(TQString( " keyCodeX: %1 keyCode: %2 keyModX: %3" )
|
|
|
|
@ -293,7 +304,7 @@ void KGlobalAccelPrivate::fakeKeyPressed(unsigned int keyCode) {
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KAccelAction* pAction = m_rgCodeModToAction[codemod];
|
|
|
|
|
|
|
|
|
|
if( !pAction ) {
|
|
|
|
@ -321,8 +332,9 @@ bool KGlobalAccelPrivate::x11KeyPress( const XEvent *pEvent )
|
|
|
|
|
XFlush( qt_xdisplay()); // avoid X(?) bug
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( !isEnabledInternal() || m_suspended )
|
|
|
|
|
if( !isEnabledInternal() || m_suspended ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CodeMod codemod;
|
|
|
|
|
codemod.code = pEvent->xkey.keycode;
|
|
|
|
@ -371,7 +383,7 @@ bool KGlobalAccelPrivate::x11KeyPress( const XEvent *pEvent )
|
|
|
|
|
#endif
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KAccelAction* pAction = m_rgCodeModToAction[codemod];
|
|
|
|
|
|
|
|
|
|
if( !pAction ) {
|
|
|
|
|