Summary: | make kmenu popup on win key configurable | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Vincenzo Ciancia <vincenzo_ml> |
Component: | general | Assignee: | Lubos Lunak <l.lunak> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | toma |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Vincenzo Ciancia
2003-12-01 01:40:20 UTC
*** This bug has been marked as a duplicate of 68508 *** I reopen this bug because I realize that this has nothing to do with its duplicate 68508; sometimes the left win key hangs, the only way to make it work again is to click on the K menu. Also it's impossible to avoid the left win key to open the K menu, is there a way? I think this bug has to do with the filter on keycode 115 installed by kicker. It incorrectly handles the windows key and that's all. I even tried to comment the code, but *then* the filter is registered somewhere else. Maybe the God of Free Software knows where - I seriously think that a product that has a bug which cannot be workarounded by modifying source code is NOT usable. A simple workaround is to disable this win key handling (people who has the bug is using this key for something else) and *the* solution is to handle global keystrokes with khotkeys and not by hardcoded (and unportable) hacks. The best workaround I have found to these problems is to completely disable that "winkey" feature; the only way I found to disable win key is to start kde with a .xsession like this: #### #!/bin/sh xmodmap -e "keycode 115 = Hyper_L" startkde & sleep 15 xmodmap -e "keycode 115 = Super_L" wait #### This sucks but somewhat works. Is this still a problem in kde 3.3? No, everything works in kde3.3, so I guess the bug can be closed, but it's still a pity that you can't disable the windows key opening the k menu. I removed the k menu from my panel because it keeps on popping up when I press the win key by accident. reassigning to lubos as this is his baby. CVS commit by aseigo: after discussions with Lubos, it was decided to just rm this "feature" due to ongoing issues with it. Lubos sees more trouble with it than its worth, and forsees ongoing bugs cropping up even if we manage to fix the current spate. it's value is not commensurate. BUG:76041 BUG:69411 BUG:85394 M +0 -91 kbutton.cpp 1.18.6.3 M +0 -2 kbutton.h 1.5.8.1 --- kdebase/kicker/buttons/kbutton.h #1.5:1.5.8.1 @@ -46,6 +46,4 @@ protected: virtual void initPopup(); virtual QString defaultIcon() const { return "go"; } - - virtual bool x11Event( XEvent *event ); }; --- kdebase/kicker/buttons/kbutton.cpp #1.18.6.2:1.18.6.3 @@ -54,30 +54,4 @@ KButton::KButton( QWidget* parent ) MenuManager::the()->setKButton(this); setIcon("kmenu"); - -#if defined(HAVE_XTEST) - // Get the Win keycodes - // FIXME: This should be retrieved from KKeyServer, since the Win key might not be mapped to Super - g_keycodeForSuperL = XKeysymToKeycode( qt_xdisplay(), XK_Super_L ); - g_keycodeForSuperR = XKeysymToKeycode( qt_xdisplay(), XK_Super_R ); - - // Make sure that the Win key is not in repeat-when-pressed mode - XKeyboardControl kbd; - kbd.auto_repeat_mode = AutoRepeatModeOff; - kbd.key = g_keycodeForSuperL; - XChangeKeyboardControl( qt_xdisplay(), KBKey | KBAutoRepeatMode, &kbd ); - kbd.key = g_keycodeForSuperR; - XChangeKeyboardControl( qt_xdisplay(), KBKey | KBAutoRepeatMode, &kbd ); - - // Grab the Win keys - if( g_keycodeForSuperL || g_keycodeForSuperR ) { - //kdDebug(125) << "g_keycodeForSuperL = " << g_keycodeForSuperL - // << ", g_keycodeForSuperR = " << g_keycodeForSuperR << endl; - if( g_keycodeForSuperL ) - XGrabKey( qt_xdisplay(), g_keycodeForSuperL, 0, qt_xrootwin(), True, GrabModeAsync, GrabModeSync ); - if( g_keycodeForSuperR ) - XGrabKey( qt_xdisplay(), g_keycodeForSuperR, 0, qt_xrootwin(), True, GrabModeAsync, GrabModeSync ); - kapp->installX11EventFilter( this ); - } -#endif } @@ -103,67 +77,2 @@ void KButton::initPopup() } -#if defined(HAVE_XTEST) -extern Time qt_x_time; - -#define UNGRAB() \ - XUngrabKeyboard( qt_xdisplay(), event->xkey.time ); \ - XUngrabPointer( qt_xdisplay(), event->xkey.time ); \ - s_bWatching = false - -bool KButton::x11Event( XEvent* event ) -{ - static bool s_bWatching = false; - bool bHandled = false; - - if( !s_bWatching ) { - if( event->type == KeyPress ) { - //kdDebug(125) << "key pressed: window " << event->xkey.window << endl; - // 115 = Super_L - if (event->xkey.state == 0 && event->xkey.keycode && - (event->xkey.keycode == g_keycodeForSuperL || - event->xkey.keycode == g_keycodeForSuperR)) { - if( XGrabKeyboard(qt_xdisplay(), qt_xrootwin(), false, GrabModeAsync, GrabModeAsync, qt_x_time) == GrabSuccess ) { - //kdDebug(125) << "grab!" << endl; - XGrabPointer( qt_xdisplay(), qt_xrootwin(), false, ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, qt_x_time ); - s_bWatching = true; - bHandled = true; - } - } - } - } - else { - if( event->type == KeyPress ) { - UNGRAB(); - XTestFakeKeyEvent( qt_xdisplay(), event->xkey.keycode, true, 0 ); - //kdDebug(125) << "sent" << endl; - bHandled = true; - } - else if( event->type == KeyRelease ) { - UNGRAB(); - if (event->xkey.keycode && - (event->xkey.keycode == g_keycodeForSuperL || - event->xkey.keycode == g_keycodeForSuperR)) - { - //kdDebug(125) << "Win released! " << popup()->isVisible() << endl; - if (popup()->isVisible()) - popup()->hide(); - else - slotExecMenu(); - } - bHandled = true; - } - else if( event->type == ButtonPress || event->type == ButtonRelease ) { - UNGRAB(); - XTestFakeButtonEvent( qt_xdisplay(), event->xbutton.button, event->type == ButtonPress, 0 ); - bHandled = true; - } - } - - return bHandled; -} -#else -bool KButton::x11Event( XEvent* ) -{ - return false; -} -#endif |