From cbab88861b629cec0fc683caccdd6c41edec62d0 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 21 Feb 2023 18:41:11 +0200 Subject: [PATCH] Client: Stop requesting activation on every focus object change Currently, windows with xdg-toplevel surface role request window activation every time the focus object changes. It conflicts with the compositor's activation and stacking order policies. For example, when a window is minimized, the compositor will start an animation and move focus to the next window. If that window activates itself, it can be raised in the stack and start covering the minimized window, thus making it look as if no animation is played at all. This activation logic was introduced as part of qt-shell activation model in a7bb7210ac76a397b4aec8d8f32d902dc932d855. On the other hand, with the introduction of the xdg-activation-v1 protocol, there is a better way to pass input focus, so drop the qt-shell hack in favor of that. Fixes: QTBUG-111377 Pick-to: 6.5 Change-Id: I8ed19f1be17f49fa9748b1cb5fdd0070791d2ecd Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/wayland/qwaylandintegration.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9ee3811806f..13bacc9be72 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -88,19 +88,6 @@ QWaylandIntegration::QWaylandIntegration() QWaylandWindow::fixedToplevelPositions = !qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_FIXED_POSITIONS"); - - // ### Not ideal... - // We don't want to use QPlatformWindow::requestActivate here, since that gives a warning - // for most shells. Also, we don't want to put this into the specific shells that can use - // it, since we want to support more than one shell in one client. - // In addition, this will send a new requestActivate when the focus object changes, even if - // the focus window stays the same. - QObject::connect(qApp, &QGuiApplication::focusObjectChanged, qApp, [](){ - QWindow *fw = QGuiApplication::focusWindow(); - auto *w = fw ? static_cast(fw->handle()) : nullptr; - if (w && w->shellSurface()) - w->shellSurface()->requestActivate(); - }); } QWaylandIntegration::~QWaylandIntegration()