summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@digia.com>2013-04-26 08:39:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-26 14:18:16 +0200
commitfca94fa5ed8321e84e7b0ff515620fbb901db545 (patch)
tree0172dcecbc859ced094a7ce4665f70902b7dbf7d /src/plugins/platforms/xcb/qxcbconnection.cpp
parent7288625c52749f566570a7e7ef047faa8171b18c (diff)
Add QXcbWindowEventListener
This makes it possible to listen for events on xcb_window_t which are not platformwindows inside the xcb plugin Change-Id: Ic9ec17ed757a7f9a5302ef2759c119a72bac573c Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 0597b18679..10a8f26614 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -391,28 +391,36 @@ QXcbConnection::~QXcbConnection()
delete m_keyboard;
}
-void QXcbConnection::addWindow(xcb_window_t id, QXcbWindow *window)
+void QXcbConnection::addWindowEventListener(xcb_window_t id, QXcbWindowEventListener *eventListener)
{
- m_mapper.insert(id, window);
+ m_mapper.insert(id, eventListener);
}
-void QXcbConnection::removeWindow(xcb_window_t id)
+void QXcbConnection::removeWindowEventListener(xcb_window_t id)
{
m_mapper.remove(id);
}
-QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id)
+QXcbWindowEventListener *QXcbConnection::windowEventListenerFromId(xcb_window_t id)
{
return m_mapper.value(id, 0);
}
+QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id)
+{
+ QXcbWindowEventListener *listener = m_mapper.value(id, 0);
+ if (listener)
+ return listener->toWindow();
+ return 0;
+}
+
#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \
{ \
event_t *e = (event_t *)event; \
- if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) { \
- handled = QWindowSystemInterface::handleNativeEvent(platformWindow->window(), m_nativeInterface->genericEventFilterType(), event, &result); \
+ if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->windowMember)) { \
+ handled = eventListener->handleGenericEvent(event, &result); \
if (!handled) \
- platformWindow->handler(e); \
+ eventListener->handler(e); \
} \
} \
break;
@@ -420,10 +428,10 @@ break;
#define HANDLE_KEYBOARD_EVENT(event_t, handler) \
{ \
event_t *e = (event_t *)event; \
- if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) { \
- handled = QWindowSystemInterface::handleNativeEvent(platformWindow->window(), m_nativeInterface->genericEventFilterType(), event, &result); \
+ if (QXcbWindowEventListener *eventListener = windowEventListenerFromId(e->event)) { \
+ handled = eventListener->handleGenericEvent(event, &result); \
if (!handled) \
- m_keyboard->handler(m_focusWindow ? m_focusWindow : platformWindow, e); \
+ m_keyboard->handler(m_focusWindow ? m_focusWindow : eventListener, e); \
} \
} \
break;