Window focus misbehavior regarding multiple X screens
Submitted by Rob Couto
Assigned to Olivier Fourdan @olivier
Description
(For more background, please see Bug #16192)
When the focus is on :0.1 and I close the last window on :0.1 using a key combo (e.g. Alt+F4), the currently active window returns to one on :0.0 but not necessarily the most recently active window there. Whichever window is active, it does not receive keystrokes until after I move the focus to some other window and then back to it.
Just now, I am looking at a maximized web browser. I opened two Terminals on :0.0 (Alt+F1) and then the offscreen xterm (Super+F1), then I closed the xterm. The web browser's titlebar became the "active" one even though the second Terminal was recently active & focused. Oddly enough, the browser window remained below the two inactive Terminals until I clicked or scrolled on it to activate and raise it. But it still wouldn't take keystrokes until I focused on anything else and came back.
Steps to Reproduce:
- In Window Manager settings, Focus tab, enable "Click to Focus" and "Automatically give focus to newly created windows"
- configure 2 separate X screens and restart machine (or just display manager)
- Start with no windows on :0.1
- Open a Terminal on :0.0, it becomes active, receives input.
- Run "DISPLAY=:0.1 xterm" in that Terminal or by any means, taking the focus to 2nd screen. It becomes active, receives input. Leave mouse on :0.0
- Close the xterm with Ctrl+D
Actual results:
- Some window on :0.0 gets its titlebar re-highlighted, which it will be is uncertain
- If window is a Terminal, its cursor is still outline of rectangle instead of solid rectangle (for cursor style = block). If window is a graphical app with text entry area visible, cursor does not appear or resume flashing. In any case, the window receives no keystrokes.
- Any amount of clicking on the "active" window does not restore the focus or keyboard input (or the solid rectangle cursor in Terminal). In a graphical application, only clicks will register-- clicking in a textarea will position the blinking, still-useless cursor.
- Alt+Tab or clicking on any other window on :0.0 focuses that one and input works as usual.
- Alt+Tab or clicking on the previously "active" window on :0.0 activates it again and restores proper input.
Expected results:
- The most recently focused window on any screen once again becomes active and receptive to input, after focus passively returns from window on other X screen
OS: Gentoo (unstable ~amd64), kernel: gentoo-sources-5.3.11 HW: Athlon FX-8320, Nvidia GeForce GTX 780 and GeForce GTX 1050 Ti, official binary driver version 440.31, USB mouse & keyboard
Version: 4.14.0