Bug 323765 - Window ordering changes when desktop is switched.
Summary: Window ordering changes when desktop is switched.
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 4.10.5
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://github.com/Mikiya/fixkdewindo...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-20 09:30 UTC by Mikiya Okuno
Modified: 2013-08-20 20:07 UTC (History)
0 users

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


Attachments
qdbus org.kde.kwin /KWin supportInformation (5.23 KB, text/plain)
2013-08-20 10:55 UTC, Mikiya Okuno
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikiya Okuno 2013-08-20 09:30:16 UTC
One of worst behavior of KWin for me is that the focus of window changes after switching to some desktop then switch back to the original desktop. I expect that the last top window has the focus, but sometimes other window has the focus even if the original top window exists there.

Reproducible: Always

Steps to Reproduce:
1. Have more than one desktops.
2. Open multiple windows in a desktop.
3. Switch to some desktop.
4. Open/close windows many times.
5. Go back to the original desktop.

Then, you can see the top front window loses keyboard focus.
Actual Results:  
The old/original top window sometimes loses focus, but it's painted on the front.

Expected Results:  
The old/original top window has focus after switching back to the desktop.

I have written a simple KWin script to fix this problem. I hope this behavior becomes default in future versions. Refer to the script for further details.
https://github.com/Mikiya/fixkdewindoworder
Comment 1 Mikiya Okuno 2013-08-20 09:31:22 UTC
Oops. I had a mistake. It's not reproducible always. Several challenges are required.
Comment 2 Martin Flöser 2013-08-20 10:01:51 UTC
I have never experienced such behavior and it shouldn't happen. Feel free to 
test 4.11 which includes a refactored focus chain handling. And yes I spent 
hours switching desktops and looking that the correct window has focus ;-)

Be aware that the focus policy might affect the window which gets selected.
Comment 3 Thomas Lübking 2013-08-20 10:18:56 UTC
- please attach the output of "qdbus org.kde.kwin /KWin supportInformation"
- is a fullscreen (konsole?) window involved?
- how do you change the desktop (pager, shortcut, mousewheel etc)
- any pattern on which window has the focus?
Comment 4 Mikiya Okuno 2013-08-20 10:55:01 UTC
Created attachment 81800 [details]
qdbus org.kde.kwin /KWin supportInformation
Comment 5 Mikiya Okuno 2013-08-20 11:01:53 UTC
Martin,

Thank you for your comments. I'll test 4.11. It will come to my distro soon :)

Thomas,
- please attach the output of "qdbus org.kde.kwin /KWin supportInformation"

Yes! Please find it in the Attachments section.

- is a fullscreen (konsole?) window involved?

No. It happens when only non-fullscreen windows are opened.

For example, I open Kopete and Konversation on Desktop 4 and start a new chat using Kopete, then switch to Desktop 5 and spend some time using Chromium browser, finally switch back to Desktop 4 and find that Kopete chat window is placed at the top, but Konversation has focus.

- how do you change the desktop (pager, shortcut, mousewheel etc)

I usually use a keyboard shortcut assigned to KWin global shortcut. I assign Ctrl+1 to "Switch to Desktop 1" and so forth. And I use "Slide" effect for switching desktops.

- any pattern on which window has the focus?

No. It's at random.

Kind regards,
Mikiya
Comment 6 Thomas Lübking 2013-08-20 11:18:57 UTC
> nextFocusPrefersMouse: true

Uncheck that -> still a "problem"?
Comment 7 Mikiya Okuno 2013-08-20 11:57:55 UTC
Hi Thomas,

Thank you for your advise.

I've changed the setting. The problem has not happened yet. I'll test further and report again.

Kind regards,
Mikiya
Comment 8 Thomas Lübking 2013-08-20 20:07:22 UTC
Ok, i'll pre-emptively tag this invalid then.
Passing the focus to the window under the mouse after changing the virtual desktop (if there's a window) is intended by this setting (which primarily existst to make FocusFollowsMouse more like FocusUnderMouse)

Please re-open the bug as soon as you get "wrong" focus (ie. w/o this setting checked)

inb4: 4.11 already has a nicer Focus strategy selection interface ;-)