summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-01-27 14:09:36 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-30 16:40:02 +0100
commit870f19f44b1eb2b93c7151dd48b8d9cd471acae8 (patch)
tree111a6ae7cf59b83ca6f872bd537b4c8a635d8800 /src/plugins/platforms
parentb3a978d661b7d85b637e8e8a134bd1df925947f8 (diff)
Add native event filters to Windows, forward to Widgets.
Use prototypically for qwizard_win.cpp. Change-Id: I075e81ae1bc3d62d9f27e51c73c800ffd71cbcd6 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 30c4c0818a..02411d3daf 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -241,6 +241,7 @@ struct QWindowsContextPrivate {
QWindowsScreenManager m_screenManager;
QSharedPointer<QWindowCreationContext> m_creationContext;
const HRESULT m_oleInitializeResult;
+ const QByteArray m_eventType;
EventFilter m_eventFilters[EventFilterTypeCount];
};
@@ -248,7 +249,8 @@ QWindowsContextPrivate::QWindowsContextPrivate() :
m_systemInfo(0),
m_displayContext(GetDC(0)),
m_defaultDPI(GetDeviceCaps(m_displayContext,LOGPIXELSY)),
- m_oleInitializeResult(OleInitialize(NULL))
+ m_oleInitializeResult(OleInitialize(NULL)),
+ m_eventType(QByteArrayLiteral("windows_generic_MSG"))
{
QWindowsContext::user32dll.init();
QWindowsContext::shell32dll.init();
@@ -633,7 +635,7 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr)
QWindowsContext::EventFilter QWindowsContext::setEventFilter(const QByteArray &eventType, EventFilter filter)
{
int eventFilterType = -1;
- if (eventType == QByteArrayLiteral("windows_generic_MSG"))
+ if (eventType == d->m_eventType)
eventFilterType = QWindowsContextPrivate::GenericWindowsEventFilter;
if (eventFilterType < 0) {
qWarning("%s: Attempt to set unsupported event filter '%s'.",
@@ -665,8 +667,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
msg.pt.x = GET_X_LPARAM(lParam);
msg.pt.y = GET_Y_LPARAM(lParam);
+ long filterResult = 0;
if (d->m_eventFilters[QWindowsContextPrivate::GenericWindowsEventFilter]) {
- long filterResult = 0;
if (d->m_eventFilters[QWindowsContextPrivate::GenericWindowsEventFilter](&msg, &filterResult)) {
*result = LRESULT(filterResult);
return true;
@@ -734,6 +736,12 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return false;
}
+ filterResult = 0;
+ if (QWindowSystemInterface::handleNativeEvent(platformWindow->window(), d->m_eventType, &msg, &filterResult)) {
+ *result = LRESULT(filterResult);
+ return true;
+ }
+
switch (et) {
case QtWindows::KeyDownEvent:
case QtWindows::KeyEvent: