Bug 46891 - keyboard shortcut w/ Alt opens menu
Summary: keyboard shortcut w/ Alt opens menu
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: qt (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
: 49291 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-08-24 14:03 UTC by Luke-Jr
Modified: 2002-10-21 11:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2002-08-24 14:01:00 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kwin
Version:           KDE 3.0.7 
Severity:          normal
Installed from:    Compiled From Sources
Compiler:          GCC 3.2
OS:                Linux
OS/Compiler notes: kernel 2.4.19

I've assigned "Switch to next keyboard layout" to Alt-Space... After I release Space (once it's changed the layout) however. the active program gets the Alt key (which is released a half second later) and 'selects' the menu...

(Submitted via bugs.kde.org)
Comment 1 Lubos Lunak 2002-08-26 13:36:37 UTC
On Monday 26 August 2002 00:07 Eric Christopherson wrote:
> On Sat Aug 24 2002 at 02:01:00PM -0000 Luke7Jr@yahoo.com wrote:
> > Package: kwin
> > Version: KDE 3.0.7
> > Severity: normal
> > Installed from:    Compiled From Sources
> > Compiler:          GCC 3.2
> > OS:                Linux
> > OS/Compiler notes: kernel 2.4.19
> >
> > I've assigned "Switch to next keyboard layout" to Alt-Space... After I
> > release Space (once it's changed the layout) however. the active program
> > gets the Alt key (which is released a half second later) and 'selects'
> > the menu...
>
> That irks me too. This is also true of the 'Windows' keys if you assign
> them to shortcuts; KDE's menu handler apparently highlights menus when the
> 'Windows' key is pressed too not just alt. Either way I think that if alt
> or win is pressed as part of a successfully-executed shortcut the menu
> highlighting should not occur.

 This is more or less a Qt bug and it cannot be reasonably fixed besides 
disabling the Alt-alone-activates-menu feature completely. Feel free to 
complain at qt-bugs@trolltech.com .

-- 
Lubos Lunak
developer
---------------------------------------------------------------------
SuSE CR s.r.o.  e-mail: l.lunak@suse.cz  l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/
Comment 2 Luke-Jr 2002-08-26 13:50:51 UTC
Makes you wonder why it didn't do that in KDE 3.0.2
(with the same version of Qt I might add)...

--- Lubos Lunak <l.lunak@sh.cvut.cz> wrote:
>  This is more or less a Qt bug and it cannot be
> reasonably fixed besides 
> disabling the Alt-alone-activates-menu feature
> completely. Feel free to 
> complain at qt-bugs@trolltech.com .


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
Comment 3 Lubos Lunak 2002-08-26 14:37:23 UTC
On Monday 26 August 2002 15:50 Luke-Jr wrote:
> Makes you wonder why it didn't do that in KDE 3.0.2
> (with the same version of Qt I might add)...

 I'm quite sure it did do that in KDE 3.0.2  as it did it also in KDE3.0.0 
and simply in every KDE version you may try. This is purely a Qt thing and 
KDE itself neither has nor can do anything with it.

>
> --- Lubos Lunak <l.lunak@sh.cvut.cz> wrote:
> >  This is more or less a Qt bug and it cannot be
> > reasonably fixed besides
> > disabling the Alt-alone-activates-menu feature
> > completely. Feel free to
> > complain at qt-bugs@trolltech.com .

-- 
Lubos Lunak
developer
---------------------------------------------------------------------
SuSE CR s.r.o.  e-mail: l.lunak@suse.cz  l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/
Comment 4 Lubos Lunak 2002-10-14 16:45:45 UTC
Subject: Alt-alone-selects-menu feature doesn't work reliably under X11

 Hello,

 from one KDE bugreport:

I've assigned "Switch to next keyboard layout" to Alt-Space... After I release 
Space (once it's changed the layout) however. the active program gets the Alt 
key (which is released a half second later) and 'selects' the menu... 

 The problem is that the currently active application gets only the Alt press 
and Alt release events, because the Alt+Space key combination is grabbed by 
the keyboard switching tool, the Space press and Space release events are 
intercepted by it and never reach the active application. The problem also 
appears e.g. when using Ctrl+Alt+Fn to switch to/from text consoles of when 
using a keyboard shortcut to (un)maximize a window, and basically in all 
cases when the application gets only Alt press and Alt release and has no 
chance to detect the intercepted key between these two events. Since AFAIK 
there's no realiable solution for this problem, I suggest that it's made 
possible to disable this feature or to change the Alt (and Meta) key to 
something different (e.g. Shift+F10 or whatever).

Comment 5 qt-bugs 2002-10-16 19:05:08 UTC
Subject: Re: [Issue N8895]  Alt-alone-selects-menu feature doesn't work reliably under X11

On Monday, 14 Oct 2002 16:47 Lubos Lunak wrote:
>
>  Hello,
>
>  from one KDE bugreport:
>
> I've assigned "Switch to next keyboard layout" to Alt-Space... After I
> release
> Space (once it's changed the layout) however. the active program gets
> the Alt
> key (which is released a half second later) and 'selects' the menu...
>
>  The problem is that the currently active application gets only the
>  Alt press
> and Alt release events, because the Alt+Space key combination is
> grabbed by
> the keyboard switching tool, the Space press and Space release events
> are
> intercepted by it and never reach the active application. The problem
> also
> appears e.g. when using Ctrl+Alt+Fn to switch to/from text consoles of
> when
> using a keyboard shortcut to (un)maximize a window, and basically in
> all
> cases when the application gets only Alt press and Alt release and has
> no
> chance to detect the intercepted key between these two events. Since
> AFAIK
> there's no realiable solution for this problem, I suggest that it's
> made
> possible to disable this feature or to change the Alt (and Meta) key
> to
> something different (e.g. Shift+F10 or whatever).
>
> --
> Lubos Lunak

Hi Lubos

This should be fixed with the following patch:

==== //depot/qt/main/src/kernel/qapplication_x11.cpp#1019 (text) ==== 
 
@@ -307,6 +307,8 @@ 
 // one day in the future we will be able to have static objects in libraries.... 
 static QGuardedPtr<QWidget>* activeBeforePopup = 0; // focus handling with popups 
  
+int qt_xfocusout_grab_counter = 0; 
+ 
 #if defined (QT_TABLET_SUPPORT) 
 // since XInput event classes aren't created until we actually open an XInput 
 // device, here is a static list that we will use later on... 
@@ -3431,6 +3433,8 @@ 
            break; 
        if ( !widget->isTopLevel() ) 
            break; 
+       if ( event->xfocus.mode == NotifyGrab ) 
+           qt_xfocusout_grab_counter++; 
        if ( event->xfocus.mode != NotifyNormal ) 
            break; 
        if ( event->xfocus.detail != NotifyAncestor && 
 
==== //depot/qt/main/src/widgets/qmenubar.cpp#359 (text) ==== 
 
@@ -69,6 +69,10 @@ 
 static bool inMenu = FALSE; 
 #endif 
  
+#if defined(Q_WS_X11) 
+extern int qt_xfocusout_grab_counter; // defined in qapplication_x11.cpp 
+#endif 
+ 
 /*! 
     \class QMenuBar qmenubar.h 
     \brief The QMenuBar class provides a horizontal menu bar. 
@@ -533,6 +537,9 @@ 
            // Start waiting for Alt release on focus widget 
            } else { 
                waitforalt = 1; 
+#if defined(Q_WS_X11) 
+               QMenuData::d->aInt = qt_xfocusout_grab_counter; 
+#endif 
                if ( f && f != object ) 
                    f->installEventFilter( this ); 
            } 
@@ -557,7 +564,11 @@ 
        if ( waitforalt && 
             event->type() == QEvent::KeyRelease && 
             (((QKeyEvent *)event)->key() == Key_Alt || 
-             ((QKeyEvent *)event)->key() == Key_Meta) ) { 
+             ((QKeyEvent *)event)->key() == Key_Meta) 
+#if defined(Q_WS_X11) 
+               && QMenuData::d->aInt == qt_xfocusout_grab_counter 
+#endif 
+           ) { 
            setAltMode( TRUE ); 
            if ( object->parent() ) 
                object->removeEventFilter( this ); 
 



Thanks for reporting it.

best regards

Anders Bakken - Trolltech AS, W. Thranes gt. 98, N-0175 Oslo, Norway

Comment 6 Lubos Lunak 2002-10-21 11:17:08 UTC
*** Bug 49291 has been marked as a duplicate of this bug. ***
Comment 7 Lubos Lunak 2002-10-21 11:24:37 UTC
Will be fixed with Qt3.1.