From 136ccaa276574ba540f7fbed8173f7ae4c5680af Mon Sep 17 00:00:00 2001 From: John Brooks Date: Wed, 15 Oct 2014 15:55:36 -0600 Subject: [PATCH] Ignore alert on an active window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QWindow::alert() is called with a duration of 0, it calls QPlatformWindow::setAlertState(true), and expects the alert state to be reset when the window is next activated. Other calls to alert are ignored while alertState is still true. If alert was called for an active window, it would remain in the alert state until deactivated and activated again, and on some platforms calls to alert would be broken while deactivated. Alerting doesn't make sense for active windows, so we can simply ignore it, which was the behavior with Qt 4 on some platforms. Change-Id: Ia3324da4c89db711b63eb31cddf0bf742bb4e3b8 Found-By: Jan Noertemann Reviewed-by: Friedemann Kleint Reviewed-by: Martin Gräßlin Reviewed-by: Shawn Rutledge --- src/gui/kernel/qwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index af3b27fd10..b0fbbc1570 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2299,7 +2299,7 @@ QWindow *QWindow::fromWinId(WId id) /*! Causes an alert to be shown for \a msec miliseconds. If \a msec is \c 0 (the default), then the alert is shown indefinitely until the window becomes - active again. + active again. This function has no effect on an active window. In alert state, the window indicates that it demands attention, for example by flashing or bouncing the taskbar entry. @@ -2310,7 +2310,7 @@ QWindow *QWindow::fromWinId(WId id) void QWindow::alert(int msec) { Q_D(QWindow); - if (!d->platformWindow || d->platformWindow->isAlertState()) + if (!d->platformWindow || d->platformWindow->isAlertState() || isActive()) return; d->platformWindow->setAlertState(true); if (d->platformWindow->isAlertState() && msec)