From 5df549ce8d57f5622ab5e0b9037994a07eb7f28d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 7 Aug 2012 15:09:33 -0500 Subject: [PATCH] Update calls to deprecated XKeycodeToKeysym function --- tdecore/kglobalaccel_win.cpp | 2 +- tdecore/kglobalaccel_x11.cpp | 5 +++-- tdecore/kkeynative_x11.cpp | 5 +++-- tdecore/kkeyserver_x11.cpp | 23 ++++++++++++----------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/tdecore/kglobalaccel_win.cpp b/tdecore/kglobalaccel_win.cpp index 42175c5ba..4323320bc 100644 --- a/tdecore/kglobalaccel_win.cpp +++ b/tdecore/kglobalaccel_win.cpp @@ -237,7 +237,7 @@ bool KGlobalAccelPrivate::x11KeyPress( const XEvent *pEvent ) // e.g., KP_4 => Shift+KP_Left, and Shift+KP_4 => KP_Left. if( pEvent->xkey.state & KKeyServer::modXNumLock() ) { // TODO: what's the xor operator in c++? - uint sym = XKeycodeToKeysym( tqt_xdisplay(), codemod.code, 0 ); + uint sym = XkbKeycodeToKeysym( tqt_xdisplay(), codemod.code, 0, 0 ); // If this is a keypad key, if( sym >= XK_KP_Space && sym <= XK_KP_9 ) { switch( sym ) { diff --git a/tdecore/kglobalaccel_x11.cpp b/tdecore/kglobalaccel_x11.cpp index 4f73c4ffd..260bc39e1 100644 --- a/tdecore/kglobalaccel_x11.cpp +++ b/tdecore/kglobalaccel_x11.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -172,7 +173,7 @@ bool KGlobalAccelPrivate::grabKey( const KKeyServer::Key& key, bool bGrab, KAcce // HACK: make Alt+Print work // only do this for the Xorg default keyboard keycodes, // other mappings (e.g. evdev) don't need or want it - if( key.sym() == XK_Sys_Req && XKeycodeToKeysym( tqt_xdisplay(), 111, 0 ) == XK_Print ) { + if( key.sym() == XK_Sys_Req && XkbKeycodeToKeysym( tqt_xdisplay(), 111, 0, 0 ) == XK_Print ) { keyModX |= KKeyServer::modXAlt(); keyCodeX = 111; } @@ -332,7 +333,7 @@ bool KGlobalAccelPrivate::x11KeyPress( const XEvent *pEvent ) // e.g., KP_4 => Shift+KP_Left, and Shift+KP_4 => KP_Left. if( pEvent->xkey.state & KKeyServer::modXNumLock() ) { // TODO: what's the xor operator in c++? - uint sym = XKeycodeToKeysym( tqt_xdisplay(), codemod.code, 0 ); + uint sym = XkbKeycodeToKeysym( tqt_xdisplay(), codemod.code, 0, 0 ); // If this is a keypad key, if( sym >= XK_KP_Space && sym <= XK_KP_9 ) { switch( sym ) { diff --git a/tdecore/kkeynative_x11.cpp b/tdecore/kkeynative_x11.cpp index 261f08e3c..64635acc3 100644 --- a/tdecore/kkeynative_x11.cpp +++ b/tdecore/kkeynative_x11.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #endif @@ -111,10 +112,10 @@ bool KKeyNative::init( const KKey& key ) // Only do this for the default Xorg layout, other keycode mappings // (e.g. evdev) don't need or want it. if( m_sym == XK_Print && !(m_mod & Mod1Mask) && - XKeycodeToKeysym( tqt_xdisplay(), 111, 0 ) == XK_Print ) + XkbKeycodeToKeysym( tqt_xdisplay(), 111, 0, 0 ) == XK_Print ) m_code = 111; // code for Print else if( m_sym == XK_Break || (m_sym == XK_Pause && (m_mod & ControlMask)) && - XKeycodeToKeysym( tqt_xdisplay(), 114, 0 ) == XK_Pause ) + XkbKeycodeToKeysym( tqt_xdisplay(), 114, 0, 0 ) == XK_Pause ) m_code = 114; else m_code = XKeysymToKeycode( tqt_xdisplay(), m_sym ); diff --git a/tdecore/kkeyserver_x11.cpp b/tdecore/kkeyserver_x11.cpp index 0bc907efa..c12cde7e6 100644 --- a/tdecore/kkeyserver_x11.cpp +++ b/tdecore/kkeyserver_x11.cpp @@ -42,6 +42,7 @@ # include # include # include +# include # include # define X11_ONLY(arg) arg, //allows to omit an argument #else @@ -340,13 +341,13 @@ bool initializeMods() for( int i = Mod2MapIndex; i < 8; i++ ) { uint mask = (1 << i); uint keySymX = NoSymbol; - // This used to be only XKeycodeToKeysym( ... , 0 ), but that fails with XFree4.3.99 - // and X.org R6.7 , where for some reason only ( ... , 1 ) works. I have absolutely no + // This used to be only XkbKeycodeToKeysym( ... , 0, 0 ), but that fails with XFree4.3.99 + // and X.org R6.7 , where for some reason only ( ... , 0, 1 ) works. I have absolutely no // idea what the problem is, but searching all posibilities until something valid is // found fixes the problem. for( int j = 0; j < xmk->max_keypermod && keySymX == NoSymbol; ++j ) for( int k = 0; k < keysyms_per_keycode && keySymX == NoSymbol; ++k ) - keySymX = XKeycodeToKeysym( tqt_xdisplay(), xmk->modifiermap[xmk->max_keypermod * i + j], k ); + keySymX = XkbKeycodeToKeysym( tqt_xdisplay(), xmk->modifiermap[xmk->max_keypermod * i + j], 0, k ); switch( keySymX ) { case XK_Num_Lock: g_modXNumLock = mask; break; // Normally Mod2Mask case XK_Super_L: @@ -551,13 +552,13 @@ uint Sym::getModsRequired() const // need to check index 0 before the others, so that a null-mod // can take precedence over the others, in case the modified // key produces the same symbol. - if( m_sym == XKeycodeToKeysym( tqt_xdisplay(), code, 0 ) ) + if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 0 ) ) ; - else if( m_sym == XKeycodeToKeysym( tqt_xdisplay(), code, 1 ) ) + else if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 1 ) ) mod = KKey::SHIFT; - else if( m_sym == XKeycodeToKeysym( tqt_xdisplay(), code, 2 ) ) + else if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 2 ) ) mod = KKeyServer::MODE_SWITCH; - else if( m_sym == XKeycodeToKeysym( tqt_xdisplay(), code, 3 ) ) + else if( m_sym == XkbKeycodeToKeysym( tqt_xdisplay(), code, 0, 3 ) ) mod = KKey::SHIFT | KKeyServer::MODE_SWITCH; } #endif @@ -887,8 +888,8 @@ uint stringUserToMod( const TQString& mod ) // keycode 111 & 92: Print Sys_Req -> Sys_Req = Alt+Print // keycode 110 & 114: Pause Break -> Break = Ctrl+Pause if( (keyCodeX == 92 || keyCodeX == 111) && - XKeycodeToKeysym( tqt_xdisplay(), 92, 0 ) == XK_Print && - XKeycodeToKeysym( tqt_xdisplay(), 111, 0 ) == XK_Print ) + XkbKeycodeToKeysym( tqt_xdisplay(), 92, 0, 0 ) == XK_Print && + XkbKeycodeToKeysym( tqt_xdisplay(), 111, 0, 0 ) == XK_Print ) { // If Alt is pressed, then we need keycode 92, keysym XK_Sys_Req if( keyModX & keyModXAlt() ) { @@ -902,8 +903,8 @@ uint stringUserToMod( const TQString& mod ) } } else if( (keyCodeX == 110 || keyCodeX == 114) && - XKeycodeToKeysym( tqt_xdisplay(), 110, 0 ) == XK_Pause && - XKeycodeToKeysym( tqt_xdisplay(), 114, 0 ) == XK_Pause ) + XkbKeycodeToKeysym( tqt_xdisplay(), 110, 0, 0 ) == XK_Pause && + XkbKeycodeToKeysym( tqt_xdisplay(), 114, 0, 0 ) == XK_Pause ) { if( keyModX & keyModXCtrl() ) { keyCodeX = 114;