diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-12-21 15:06:40 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-02-25 07:17:43 +0000 |
commit | 28ee76fd0b9ce59291341c8a9937a6c98fcb926d (patch) | |
tree | cd385d6a5b771c7e88639e05cef1630bba7458e3 /src/plugins/platforms/windows/qwindowsnativeinterface.h | |
parent | 97965a0908b8fbf7f01d0880410929a4ea61b48d (diff) |
QtPlatformHeaders/Windows: Add function to set window activation behavior.
The Windows OS by default does not activate windows when the calling
process is not active; only the taskbar entry is flashed as not to
distract the user.
Nevertheless, for some use cases, it is desirable to activate the window
also in the inactive state.
Introduce an enumeration specifying the behavior to QtPlatformHeaders
and employ a workaround using the Win32 API AttachThreadInput() to attach
to other processes while setting the foreground window to achieve
the AlwaysActivateWindow behavior.
Task-number: QTBUG-14062
Task-number: QTBUG-37435
Change-Id: I79cb6cd3fab29d55b5d3db7f9af01bbaa5096a37
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsnativeinterface.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsnativeinterface.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.h b/src/plugins/platforms/windows/qwindowsnativeinterface.h index 3a0d3398d9..9fc43ddcce 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.h +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.h @@ -42,6 +42,7 @@ #include <QtGui/qfont.h> #include <QtGui/qpa/qplatformnativeinterface.h> +#include <QtPlatformHeaders/qwindowswindowfunctions.h> QT_BEGIN_NAMESPACE @@ -96,7 +97,15 @@ public: QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE; void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + static QWindowsWindowFunctions::WindowActivationBehavior windowActivationBehavior() + { return QWindowsNativeInterface::m_windowActivationBehavior; } + static void setWindowActivationBehavior(QWindowsWindowFunctions::WindowActivationBehavior b) + { QWindowsNativeInterface::m_windowActivationBehavior = b; } + QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE; + +private: + static QWindowsWindowFunctions::WindowActivationBehavior m_windowActivationBehavior; }; QT_END_NAMESPACE |