Bug 140023 - win+tab don't switch thru all desktops (commit 427993)
Summary: win+tab don't switch thru all desktops (commit 427993)
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 108862 123619 125246 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-13 15:40 UTC by Sune Vuorela
Modified: 2007-09-04 17:36 UTC (History)
4 users (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 Sune Vuorela 2007-01-13 15:40:55 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages

Hi!

When using a xorg configuration file without any special options and the setting in 'kcontrol > regional & accessibility > keyboard shortcuts > shortcut schemes' and in drop-down box chooses 'kde default for 4 modifier keys'
win+tab does not switch thru all the virtual desktops. 
Adding         Option          "XkbOptions"    "altwin:super_win"  in xorg.conf gives right behaviour.

I have tried reverting only commit 427993 and rebuilt kwin. 
http://websvn.kde.org/trunk/KDE/kdebase/kwin/tabbox.cpp?rev=427993&r1=427984&r2=427993

It works right when reverting this commit and without any special stuff in xorg.conf.

(originally reported in debian as http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=406549 - where original submitter shows xorg.conf and other informations)

/Sune
Comment 1 Lubos Lunak 2007-01-15 15:12:00 UTC
I don't think this is a bug in KWin. As the xmodmap output in the debian bugreport shows, in the first (non-working) case Mod4(=Win modifiers) includes only Super_L (left Win key) but not Super_R (right Win key), which is included only after explicitly using the option. So, in other words, the right Win key is not a Win modifier, so it doesn't work with Win+Tab. I suggest complaining to X.Org developers about the default modifier mapping.

Comment 2 Sune Vuorela 2007-01-15 18:13:06 UTC
On Monday 15 January 2007, Lubos Lunak wrote:
> I don't think this is a bug in KWin. As the xmodmap output in the debian
> bugreport shows, in the first (non-working) case Mod4(=Win modifiers)
> includes only Super_L (left Win key) but not Super_R (right Win key), which
> is included only after explicitly using the option. So, in other words, the
> right Win key is not a Win modifier, so it doesn't work with Win+Tab. I
> suggest complaining to X.Org developers about the default modifier mapping.


Hi!

I might not have been totally clear everywhere.
with kde 3.4.3, it works without stuff in xorg.conf 
in kde 3.5.0 it don't. (Same xorg, same configuration)
in kde3.5.5 with reverted the mentioned commit, it also works.

so it is kwin that has changed, not xorg.


I still think this is a valid bug report. (But I am not going to reopen, at 
least not yet)

/Sune
Comment 3 Rob Walker 2007-01-15 18:35:55 UTC
Just to clarify a couple of points from the debian report:
 - It's broken with BOTH left and right Win keys
 - The scan code for Super_L reported in XModmap (Super_L (0x7f)) is different from what the key actually generates (0x73).  The xkb rules file suggests this is some kind of virtual scan code.  With the altwin:super_win option, XModmap lists both variants of Super_L (0x7f and 0x73)

So it looks to me like newer Xorg releases generate different codes for Super and kwin should be handling these.

Rob
Comment 4 Lubos Lunak 2007-01-16 16:34:59 UTC
I still don't see anything wrong with KWin. If left key is 0x73 and right key is 0x74 and the modifier list doesn't include either, then neither is a Win modifier, so KWin doesn't handle them. When they are included, KWin handles them.
Comment 5 Brice Goglin 2007-01-21 04:21:10 UTC
Well, where did you get the fact that _both_ are not a Win modifier? As you said in comment #1, the right one is not a modifier. But the left one is. And the left one does _not_ work with kwin 3.5.5 while it worked with 3.4.3. This is exactly what I observed when trying to reproduce the Debian bug report. Left-win + tab did not work anymore once I upgraded from 3.4.3 to 3.5.5 (without changing anything else, especially Xorg).

Brice
Comment 6 Sune Vuorela 2007-01-24 09:31:09 UTC
as it works with kwin 3.4.3 and doesn't with 3.5.x series, without any other changes than the kdebase changes I am reopening this bug.
Comment 7 Lubos Lunak 2007-01-24 14:19:34 UTC
*** Bug 123619 has been marked as a duplicate of this bug. ***
Comment 8 Lubos Lunak 2007-01-24 14:19:54 UTC
*** Bug 125246 has been marked as a duplicate of this bug. ***
Comment 9 Lubos Lunak 2007-01-24 14:42:02 UTC
SVN commit 626727 by lunakl:

Revert r427993 (#106013) as it causes #140023.
BUG: 140023



 M  +0 -4      events.cpp  
 M  +9 -51     tabbox.cpp  
 M  +0 -1      tabbox.h  


--- branches/KDE/3.5/kdebase/kwin/events.cpp #626726:626727
@@ -451,10 +451,6 @@
             if( electricBorder( e ))
                 return true;
             break;
-        case MappingNotify:
-            XRefreshKeyboardMapping( &e->xmapping );
-            tab_box->updateKeyMapping();
-            break;
         default:
             break;
         }
--- branches/KDE/3.5/kdebase/kwin/tabbox.cpp #626726:626727
@@ -54,7 +54,6 @@
 
     no_tasks = i18n("*** No Windows ***");
     m = DesktopMode; // init variables
-    updateKeyMapping();
     reconfigure();
     reset();
     connect(&delayedShowTimer, SIGNAL(timeout()), this, SLOT(show()));
@@ -787,10 +786,6 @@
     return bAll;
     }
 
-static const int MAX_KEYSYMS = 4;
-static uint alt_keysyms[ MAX_KEYSYMS ];
-static uint win_keysyms[ MAX_KEYSYMS ];
-
 static bool areModKeysDepressed( const KKeySequence& seq )
     {
     uint rgKeySyms[10];
@@ -811,17 +806,18 @@
         }
     if( mod & KKey::ALT )
         {
-        for( int i = 0;
-             i < MAX_KEYSYMS && alt_keysyms[ i ] != NoSymbol;
-             ++i )
-            rgKeySyms[nKeySyms++] = alt_keysyms[ i ];
+        rgKeySyms[nKeySyms++] = XK_Alt_L;
+        rgKeySyms[nKeySyms++] = XK_Alt_R;
         }
     if( mod & KKey::WIN )
         {
-        for( int i = 0;
-             i < MAX_KEYSYMS && win_keysyms[ i ] != NoSymbol;
-             ++i )
-            rgKeySyms[nKeySyms++] = win_keysyms[ i ];
+        // It would take some code to determine whether the Win key
+        // is associated with Super or Meta, so check for both.
+        // See bug #140023 for details.
+        rgKeySyms[nKeySyms++] = XK_Super_L;
+        rgKeySyms[nKeySyms++] = XK_Super_R;
+        rgKeySyms[nKeySyms++] = XK_Meta_L;
+        rgKeySyms[nKeySyms++] = XK_Meta_R;
         }
 
     return areKeySymXsDepressed( false, rgKeySyms, nKeySyms );
@@ -839,44 +835,6 @@
     return false;
     }
 
-void TabBox::updateKeyMapping()
-    {
-    const int size = 6;
-    uint keysyms[ size ] = { XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R, XK_Meta_L, XK_Meta_R };
-    XModifierKeymap* map = XGetModifierMapping( qt_xdisplay() );
-    int altpos = 0;
-    int winpos = 0;
-    int winmodpos = -1;
-    int winmod = KKeyNative::modX( KKey::WIN );
-    while( winmod > 0 ) // get position of the set bit in winmod
-        {
-        winmod >>= 1;
-        ++winmodpos;
-        }
-    for( int i = 0;
-         i < MAX_KEYSYMS;
-         ++i )
-        alt_keysyms[ i ] = win_keysyms[ i ] = NoSymbol;
-    for( int i = 0;
-         i < size;
-         ++i )
-        {
-        KeyCode keycode = XKeysymToKeycode( qt_xdisplay(), keysyms[ i ] );
-        for( int j = 0;
-             j < map->max_keypermod;
-             ++j )
-            {
-            if( map->modifiermap[ 3 * map->max_keypermod + j ] == keycode ) // Alt
-                if( altpos < MAX_KEYSYMS )
-                    alt_keysyms[ altpos++ ] = keysyms[ i ];
-            if( winmodpos >= 0 && map->modifiermap[ winmodpos * map->max_keypermod + j ] == keycode )
-                if( winpos < MAX_KEYSYMS )
-                    win_keysyms[ winpos++ ] = keysyms[ i ];
-            }
-        }
-    XFreeModifiermap( map );
-    }
-
 void Workspace::slotWalkThroughWindows()
     {
     if ( root != qt_xrootwin() )
--- branches/KDE/3.5/kdebase/kwin/tabbox.h #626726:626727
@@ -54,7 +54,6 @@
         Workspace* workspace() const;
 
         void reconfigure();
-        void updateKeyMapping();
 
     protected:
         void showEvent( QShowEvent* );
Comment 10 Lubos Lunak 2007-04-24 14:55:56 UTC
*** Bug 108862 has been marked as a duplicate of this bug. ***
Comment 11 Sebastian Schubert 2007-09-02 15:22:01 UTC
It works with kde3.5.7 but i have to press an additional key to actually swap to the marked window in the window list. So pressing WIN+TAB shows this list and I can cycle through it. Stopping pressing the buttons does not change the active window. This is not the case with any other combination i tried. After deactivating "Show window list while switching windows" it works.

Do you want me to open a new bug report?
Comment 12 Lubos Lunak 2007-09-03 14:35:44 UTC
Yes, assuming there's not an open bugreport for this.
Comment 13 Martin Aumueller 2007-09-04 17:36:13 UTC
I had exactly the same problem as #11, but as noted in bug #108862

xmodmap -e "add mod4 = Super_L"

fixed it for me.