Bug 69411 - make kmenu popup on win key configurable
Summary: make kmenu popup on win key configurable
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-01 01:40 UTC by Vincenzo Ciancia
Modified: 2004-11-08 22:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincenzo Ciancia 2003-12-01 01:40:20 UTC
Version:            (using KDE KDE 3.1.93)
Installed from:    RedHat RPMs

If I press the left windows key, wich I currently use for many window-manager related shortcuts, and NOT release it, and press another key, it usually should perform the associated action if any. If I press it and release it, in kde 3.2 it opens the K menu (please, give me AN OPTION to remove this or at least change the shortcut, I can't bear this since it happens that I press the windows key accidentally, and I lose the current focus, it's almost unusable).

However, in general, this don't work properly since sometimes something locks up and kde starts acting as if I were pressing and releasing the windows key or something like that. Clicking on some menu on the panel and randomly pressing esc, the win key or something, helps to get out. If there is a way to disable "divine intervention" handling of the windows key, I suspect that would be a great workaround ATM. Sorry if this is already possible, I can't find it in the control center. Also I am not sure it's kwin fault.

bye

Vincenzo
Comment 1 John Firebaugh 2003-12-05 04:21:51 UTC

*** This bug has been marked as a duplicate of 68508 ***
Comment 2 Vincenzo Ciancia 2004-02-06 22:20:05 UTC
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?
Comment 3 Vincenzo Ciancia 2004-02-14 14:53:26 UTC
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.
Comment 4 Vincenzo Ciancia 2004-02-18 10:18:10 UTC
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.

Comment 5 Tom Albers 2004-10-30 23:41:40 UTC
Is this still a problem in kde 3.3?
Comment 6 Vincenzo Ciancia 2004-10-31 00:37:38 UTC
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.
Comment 7 Aaron J. Seigo 2004-11-03 23:55:17 UTC
reassigning to lubos as this is his baby.
Comment 8 Aaron J. Seigo 2004-11-08 22:22:03 UTC
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