From 2717252861048794737f6aa72c90548404814746 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 21 Jul 2020 12:44:26 +0300 Subject: [PATCH] Partially revert a0c4a8e766a2160 Unfortunately, a0c4a8e766a2160213838daf6f71c7ae6c3705df 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 --- autotests/integration/x11_client_test.cpp | 2 ++ x11client.cpp | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/autotests/integration/x11_client_test.cpp b/autotests/integration/x11_client_test.cpp index 010aaff246..9a966d5e41 100644 --- a/autotests/integration/x11_client_test.cpp +++ b/autotests/integration/x11_client_test.cpp @@ -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 connection(xcb_connect(nullptr, nullptr)); QVERIFY(!xcb_connection_has_error(connection.data())); diff --git a/x11client.cpp b/x11client.cpp index bb389e4b37..bbc76f1398 100644 --- a/x11client.cpp +++ b/x11client.cpp @@ -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