Partially revert a0c4a8e766

Unfortunately, a0c4a8e766 has a major bug
where clients that track focus events may get confused by focusToNull().

One such a notable example is Dota 2. It tracks the focus events to
minimize itself after the keyboard focus has been lost as well stop
playing music while it's in background. So, when we call focusToNull(),
Dota 2 will receive a corresponding FocusOut event and ask the window
manager to minimize it. It doesn't really matter that the FocusOut
event is going to be followed by a FocusIn event because when a window
is minimized, kwin will activate the next one in the focus chain.

Since those issues can't be fixed from the window manager's side, this
patch partially reverts a0c4a leaving only the autotest.

BUG: 424223
FIXED-IN: 5.19.4
This commit is contained in:
Vlad Zahorodnii 2020-07-21 12:44:26 +03:00
parent 0fad9cc86c
commit 2717252861
2 changed files with 2 additions and 5 deletions

View file

@ -1007,6 +1007,8 @@ void X11ClientTest::testActivateFocusedWindow()
// case no FocusIn event will be generated and the window won't be marked as active. This test
// verifies that we handle that subtle case properly.
QSKIP("Focus is not restored properly when the active client is about to be unmapped");
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> connection(xcb_connect(nullptr, nullptr));
QVERIFY(!xcb_connection_has_error(connection.data()));

View file

@ -2023,11 +2023,6 @@ void X11Client::setOnAllActivities(bool on)
*/
void X11Client::takeFocus()
{
// Force a FocusIn event if the window is already focused but inactive.
Xcb::CurrentInput currentInput;
if (!currentInput.isNull() && currentInput.window() == window())
workspace()->focusToNull();
if (rules()->checkAcceptFocus(info->input()))
m_client.focus();
else