Bug 293734

Summary: kwin does not honor disableMultihead=true and causes window focus problems
Product: [Plasma] kwin Reporter: Ferdinand Hübner <ferdinand.huebner>
Component: multi-screenAssignee: KWin default assignee <kwin-bugs-null>
Severity: normal CC: a, kwin-bugs-null
Priority: NOR    
Version: unspecified   
Target Milestone: 4.11   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.11
Sentry Crash Report:
Attachments: Disable multihead support in kwin when disableMultihead=true is in kcmdisplayrc

Description Ferdinand Hübner 2012-02-09 18:14:25 UTC
Version:           unspecified (using KDE 4.8.0) 
OS:                Linux

I have a multihead setup with two X screens. When I set disableMultihead=true in ~/.kde4/share/config/kcmdisplayrc, plasma does not start on the second screen, but kwin does.

This has various negative side-effects. When an application (on screen 0) spawns a modal dialog, that dialog gets focused. Once I close the dialog the focus is not returned to the spawning window. In fact, no window on screen 0 gets focus at all. This is incredibly annoying with keyboard-intense applications that spawn a lot of dialogs, like kmymoney. You have to manually focus the application before you can start typing again. 
This does not happen on gtk-apps like google chrome. If you open the "About" dialog in chrome and close it, the focus returns to chrome.

I am using "click to focus" and "focus stealing prevention low". Setting it to "focus follows mouse" and/or "focus stealing prevention high" has no effect.

If I open an xterm on screen 1, switch to screen 0, start dolphin, open and close its "About" dialog, the xterm on screen 1 gets focused.

The alt+tab switch seems to be affected, too. Closing a modal dialog and pressing alt+tab does not cycle through active windows on screen 0. My guess is that it tries to cycle through the windows on screen 1 for no apparent reason.

My current workaround is to kill the secon kwin process in a startup script (and hope that I kill the one on screen 1). When I do that, the focus is always returned to the application that spawned the modal dialog.

This issue appeared sometime around 4.7.1. I had no such problems with older versions. A fresh user profile does not change the behavior either.

Reproducible: Always

Steps to Reproduce:
- Start KDE on a system with two X screens
- Start an xterm on display 1 
- Start dolphin on display 0
- Open the "About" dialog in dolphin
- Close the "About" dialog
- The xterm on screen 1 gains focus

Actual Results:  
The window focus is on the wrong display

Expected Results:  
Dolphin on display 0 should regain focus

Kernel 3.2.1-gentoo-r2, x86, nvidia binary driver 290.10, GeForce 9500GT
Comment 1 Grégory Coutant 2012-12-14 22:55:07 UTC
Created attachment 75840 [details]
Disable multihead support in kwin when disableMultihead=true is in kcmdisplayrc
Comment 2 Thomas Lübking 2012-12-14 23:13:02 UTC
please post tht at git.reviewboard.kde.org - it's gonna be lost on the bug.

The focus annoyance is likely bug #157219

@anybody (esp. gentoo users and devs)
can you please have a look at the last patch attached to bug #256242 (jaja i know what i said, i may do that ;-) and confirm or deny that there's an improvement reg. the focus randomly bein nowhere?
Comment 3 Thomas Lübking 2012-12-17 17:59:57 UTC
*** Bug 311840 has been marked as a duplicate of this bug. ***
Comment 4 Martin Flöser 2013-01-18 19:50:17 UTC
Always check whether there are bugs before pushing a change and thanks again to Grégory for providing the patch.

commit ab6d5c048a25bcb2f5bdb822ba3eda64019c61bc
Author: Grégory Coutant <gregory.coutant@gmail.com>
Date:   Fri Dec 14 19:41:13 2012 +0100

    Add ability to disable multihead support
    REVIEW: 107735