Bug 246545

Summary: Alt-Tab no longer switches windows in latest trunk
Product: [Plasma] kwin Reporter: Robert Marmorstein <robert>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: apaku, kde, robert, tomjamesgillespie
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Robert Marmorstein 2010-08-02 20:57:46 UTC
Version:           SVN (using Devel) 
OS:                Linux

The Alt-Tab shortcut for switching between windows broke after a recent "svn update" (if you like, I can try to narrow it down to a particular commit).  The behavior is erratic -- occasionally the key combination will spontaneously work.  However, 9 times out of 10, it fails.  Strangely, if I hold down the key combination, a task menu DOES come up, but only after several seconds.  However, the behavior in which I could switch to the "last active" window with a quick keystroke doesn't seem to work at all.

Reproducible: Sometimes

Steps to Reproduce:
Build and install latest trunk.  Pull up several windows (firefox, konsole, and kmail are good candidates).  Select one in the taskbar.  Then select a different one.  Then Press Alt-TAB.  Fail.

Actual Results:  
Nothing happens.

Expected Results:  
Switched to a different window (the first window selected).

I have Desktop effects disabled.  Enabling them did not seem to affect the problem.
Comment 1 Andreas Pakulat 2010-08-02 21:09:16 UTC
I see the same thing, see http://lists.kde.org/?t=128051757300001&r=1&w=2

One (easier to try) workaround is to hold down both Alt+Tab for a bit, this should eventually show up the tabbox with the list of windows. The somewhat more involved change is to edit kdebase/workspace/kwin/utils.cpp and adjust grabXKeyboard to use "CurrentTime" instead of "xTime()" in the call to XGrabKeyboard. That fixes the problem for me completely, but I have no idea about why or how or wether the change is good enough or not.
Comment 2 Robert Marmorstein 2010-08-02 21:37:07 UTC
Commit r1002752 changed the XUngrabKeyboard call to use CurrentTime instead of xTime, so it probably makes sense for the XGrabKeyboard call to match.
Comment 3 Robert Marmorstein 2010-08-02 21:43:18 UTC
Michael Jansen committed that change.  Adding him to the CC list...
Comment 4 Thomas Gillespie 2010-08-07 02:33:31 UTC
I can confirm the fix by Andreas (using CurrentTime instead of xTime() in utils.cpp) but as he commented, someone who knows the code will be a better judge of it's correctness.
Comment 5 Robert Marmorstein 2010-08-07 04:39:56 UTC
I can, too.  Since I patched it, everything has worked correctly.
Comment 6 Andreas Pakulat 2010-08-07 08:01:45 UTC
The breakage turns out to be in kdelibs (a change involving the X11 event filter in KApplication). It also affects the keyboard access in the logout dialog (when pressing Ctrl+Alt+Del) and possibly other places where the keyboard is being grabbed. I've asked for help from the core-developers as I don't understand the code enough to propose a fix.
Comment 7 Andreas Pakulat 2010-08-07 11:54:27 UTC
This is fixed now by r1160177: http://websvn.kde.org/?view=revision&revision=1160177