diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-03-09 14:35:11 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-10 22:16:05 +0100 |
commit | 472cc7ac27ea552a254b9a56663a8e94082b137a (patch) | |
tree | 99e6e629dc22c75ec6bba3bdd2b0be463e699134 /src | |
parent | d8e6350c16a1cf696cf65d9cc898c7bd34419ec7 (diff) |
XCB: Implement native events for for windows.
Change-Id: Iacea1231b49ebe57da96f4012d3f314e1b037105
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 16 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.h | 2 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 367b24da9d..76979bf05f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -235,16 +235,24 @@ QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id) #define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \ { \ event_t *e = (event_t *)event; \ - if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) \ - platformWindow->handler(e); \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) { \ + long result = 0; \ + handled = QWindowSystemInterface::handleNativeEvent(platformWindow->window(), m_nativeInterface->genericEventFilterType(), event, &result); \ + if (!handled) \ + platformWindow->handler(e); \ + } \ } \ break; #define HANDLE_KEYBOARD_EVENT(event_t, handler) \ { \ event_t *e = (event_t *)event; \ - if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \ - m_keyboard->handler(platformWindow, e); \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) { \ + long result = 0; \ + handled = QWindowSystemInterface::handleNativeEvent(platformWindow->window(), m_nativeInterface->genericEventFilterType(), event, &result); \ + if (!handled) \ + m_keyboard->handler(platformWindow, e); \ + } \ } \ break; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index f56072f9d7..fc320ee69c 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -76,7 +76,9 @@ public: Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap) -QXcbNativeInterface::QXcbNativeInterface() +QXcbNativeInterface::QXcbNativeInterface() : + m_genericEventFilterType(QByteArrayLiteral("xcb_generic_event_t")) + { qFill(m_eventFilters, m_eventFilters + EventFilterCount, EventFilter(0)); } @@ -134,7 +136,7 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr QPlatformNativeInterface::EventFilter QXcbNativeInterface::setEventFilter(const QByteArray &eventType, QPlatformNativeInterface::EventFilter filter) { int type = -1; - if (eventType == QByteArrayLiteral("xcb_generic_event_t")) + if (eventType == m_genericEventFilterType) type = GenericEventFilter; if (type == -1) { qWarning("QXcbNativeInterface: %s: Attempt to set invalid event filter type '%s'.", diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 6f6130d3e9..c6835ff9e0 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -71,6 +71,7 @@ public: void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); + inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; } EventFilter setEventFilter(const QByteArray &eventType, EventFilter filter); EventFilter eventFilter(EventFilterType type) const { return m_eventFilters[type]; } @@ -83,6 +84,7 @@ public: void *eglContextForContext(QOpenGLContext *context); private: + const QByteArray m_genericEventFilterType; EventFilter m_eventFilters[EventFilterCount]; static QXcbScreen *qPlatformScreenForWindow(QWindow *window); |