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.cpp | |
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.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsnativeinterface.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index ac7c22fb7e..babca35149 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -84,6 +84,9 @@ static int resourceType(const QByteArray &key) return int(result - names); } +QWindowsWindowFunctions::WindowActivationBehavior QWindowsNativeInterface::m_windowActivationBehavior = + QWindowsWindowFunctions::DefaultActivateWindow; + void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { if (!window || !window->handle()) { @@ -253,6 +256,8 @@ QFunctionPointer QWindowsNativeInterface::platformFunction(const QByteArray &fun return QFunctionPointer(QWindowsWindow::setTouchWindowTouchTypeStatic); else if (function == QWindowsWindowFunctions::setHasBorderInFullScreenIdentifier()) return QFunctionPointer(QWindowsWindow::setHasBorderInFullScreenStatic); + else if (function == QWindowsWindowFunctions::setWindowActivationBehaviorIdentifier()) + return QFunctionPointer(QWindowsNativeInterface::setWindowActivationBehavior); return Q_NULLPTR; } |