Bug 342868 - The sort order of the windows is not most recently used order
Summary: The sort order of the windows is not most recently used order
Status: RESOLVED DUPLICATE of bug 297445
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (show other bugs)
Version: 4.11.14
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
Depends on:
Reported: 2015-01-15 10:11 UTC by Michael Couck
Modified: 2015-01-22 13:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Couck 2015-01-15 10:11:52 UTC
CTRL-TAB to switch through tasks/windows does not stack the windows in the most recently used sort order. Note that I am a programmer, 15 odd years as a consultant, and would be agreeable to fix this issue, just point me to the logic. I am guessing it is in Python? But C or even C++ is no real issue. I'll fix it. Of course I need access to the git repo, and I don't really want to go digging around to find the code where this logic is implemented.

I appreciate that this is trivial, but it annoys me, and as far as I can remember K version 13 was not an issue, hense something has changed.

Reproducible: Always

Steps to Reproduce:
1. Start several applications in different windows
2. Switch between the windows noting the most recently used
3. They will not be in a consistent order of most recently used

Actual Results:  
The order of the windows is not in the most recently used order.

Expected Results:  
The windows are always in the most recently used order.

I can fix this issue, I will need git access, and someone to find the logic that facilitates this functionality.
Comment 1 Martin Flöser 2015-01-15 11:01:27 UTC
By default kwin doesn't use the shortcut CTRL+TAB, thus I do not know which functionality you have mapped to it. Could you please clarify this, then we can point you to the code.
Comment 2 Thomas Lübking 2015-01-15 11:02:51 UTC
run "kcmshell4 kwintabbox" and check the value of "sort order" (upmost item in top right group) for both (main & alternative) switchers.

If this is about the "recent" behavior of minimized windows, this is bug #297445
Comment 3 Michael Couck 2015-01-15 11:57:24 UTC
Indeed, related to the bug 297445 which has been 'resolved invalid'. 

This is not functioning as expected. Please point me in the direction of the logic that defines this functionality, if you know where it is of course.

Thanks in advance.
Comment 4 Thomas Lübking 2015-01-15 12:09:04 UTC
focuschain.cpp ~ line 241
Just comment/remove the "client->isMinimized()" branch in FocusChain::makeFirstInChain(.)

the only somewhat recent change in that area was

commit 038278cfb7b10bfd541a7461c37da6303f5bab44
Author: Thomas Lübking
Date:   Fri Apr 5 22:28:05 2013 +0200
    make minimized windows first of minimized  instead of last

See https://git.reviewboard.kde.org/r/110567/ for details
Minimized windows have not been in the "normal" recently used order ever since-

*** This bug has been marked as a duplicate of bug 297445 ***
Comment 5 Michael Couck 2015-01-15 13:09:35 UTC
Hello Thomas,

Thank you for your input.

I assume this functionality is in the focuschain.cpp class? In any event I will find the logic eventually, and I will take a closer look in the following days, and more than likely fix it and issue a pull request, or in the worst case use a patch for myself.

Have a fantastic day ;)

Comment 6 Thomas Lübking 2015-01-15 13:21:44 UTC
in the file kde-workspace/kwin/focuschain.cpp at around the mentioned line.
Classname is "FocusChain", but that would not have been helpful, would it? ;-)
Comment 7 Michael Couck 2015-01-15 13:36:34 UTC
Indeed, not helpful at all ;)

Comment 8 Michael Couck 2015-01-15 14:19:03 UTC
Thomas, where is the source, I would have expected it to be on GitHub?
Comment 9 Martin Flöser 2015-01-15 14:21:57 UTC
> Thomas, where is the source, I would have expected it to be on GitHub?

no, our source is hosted on our own infrastructure:

git clone git://anongit.kde.org/kde-workspace.git

or for master (5.x)

git clone git://anongit.kde.org/kwin.git
Comment 10 Victor Varvaryuk 2015-01-15 21:34:32 UTC
See also: https://forum.kde.org/viewtopic.php?f=83&t=101211
Comment 11 Michael Couck 2015-01-22 13:27:13 UTC
Just as an update, for future reference:

When changing applications, using the arrow keys brings the window into focus, and therefore becomes the last actively used window/application, so the sort order is in fact the 'most recently arrowed', which is why it seemd that the sorting did not function as expected. Looking at the code, it seems that the behaviour is indeed correct.

Apologies for the wasted time to all...