summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-04-10 13:55:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-19 20:10:46 +0200
commitda01deb0ac01b37656e021b9d5d696c5de7b0afb (patch)
tree6a689d5cddc689bc83c6a74c8dc5ef0f48359b64 /src/plugins
parent926086b9e37d45d09d5ce7d632a07583b40a8f70 (diff)
Implement alertion state for windows.
Add QWindow::alert() and QPlatformWindow::setAlertState(). Add logic to clear alertion state when the window becomes active. The platform plugins then only need to implement a setter and a cheap getter and need not handle activation. Prototypically implement X11 and Windows. Task-number: QTBUG-30416 Change-Id: Ia70c4722d812462a21f4034b7d52735c9f2bc49c Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp13
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h5
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h5
4 files changed, 35 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 9b2b67619d..2a5e08cf41 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1802,6 +1802,19 @@ QWindowsWindow *QWindowsWindow::childAt(const QPoint &clientPoint, unsigned cwex
}
#ifndef Q_OS_WINCE
+void QWindowsWindow::setAlertState(bool enabled)
+{
+ if (isAlertState() == enabled)
+ return;
+ if (enabled) {
+ alertWindow(0);
+ setFlag(AlertState);
+ } else {
+ stopAlertWindow();
+ clearFlag(AlertState);
+ }
+}
+
void QWindowsWindow::alertWindow(int durationMs)
{
DWORD timeOutMs = GetCaretBlinkTime();
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 1148440f05..2117ca50b8 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -132,7 +132,8 @@ public:
SynchronousGeometryChangeEvent = 0x400,
WithinSetStyle = 0x800,
WithinDestroy = 0x1000,
- TouchRegistered = 0x2000
+ TouchRegistered = 0x2000,
+ AlertState = 0x4000
};
struct WindowData
@@ -255,6 +256,8 @@ public:
void setWindowIcon(const QIcon &icon);
#ifndef Q_OS_WINCE
+ void setAlertState(bool enabled);
+ bool isAlertState() const { return testFlag(AlertState); }
void alertWindow(int durationMs = 0);
void stopAlertWindow();
#endif
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 5af6a9ec9d..68ccbfb8c0 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -189,6 +189,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
, m_usingSyncProtocol(false)
, m_deferredActivation(false)
, m_embedded(false)
+ , m_alertState(false)
, m_netWmUserTimeWindow(XCB_NONE)
, m_dirtyFrameMargins(false)
#if defined(XCB_USE_EGL)
@@ -2047,4 +2048,17 @@ void QXcbWindow::setMask(const QRegion &region)
#endif // !QT_NO_SHAPE
+void QXcbWindow::setAlertState(bool enabled)
+{
+ if (m_alertState == enabled)
+ return;
+ const NetWmStates oldState = netWmStates();
+ m_alertState = enabled;
+ if (enabled) {
+ setNetWmStates(oldState | NetWmStateDemandsAttention);
+ } else {
+ setNetWmStates(oldState & ~NetWmStateDemandsAttention);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index f4bd2d96ff..300596845e 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -56,7 +56,6 @@ QT_BEGIN_NAMESPACE
class QXcbScreen;
class QXcbEGLSurface;
class QIcon;
-
class QXcbWindow : public QXcbObject, public QPlatformWindow
{
public:
@@ -120,6 +119,9 @@ public:
void setMask(const QRegion &region);
#endif // !QT_NO_SHAPE
+ void setAlertState(bool enabled);
+ bool isAlertState() const { return m_alertState; }
+
xcb_window_t xcb_window() const { return m_window; }
uint depth() const { return m_depth; }
QImage::Format imageFormat() const { return m_imageFormat; }
@@ -194,6 +196,7 @@ private:
bool m_deferredExpose;
bool m_configureNotifyPending;
bool m_embedded;
+ bool m_alertState;
xcb_window_t m_netWmUserTimeWindow;
QSurfaceFormat m_format;