Commit 27172528 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Partially revert a0c4a8e7

Unfortunately, a0c4a8e7 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
parent 0fad9cc8
......@@ -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()));
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment