summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-02-08 15:07:19 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-02-08 18:28:19 (GMT)
commit6c19992488d1aa820e860575533f2e2c1d3351d1 (patch)
treeed2a7c54e643f9037ee25b000c9a26e23ae669d0 /src/plugins/platforms/xcb/qxcbconnection.cpp
parent9d808132dbf2de191e3d1ab2a1222e584d7ff1bc (diff)
downloadQt-6c19992488d1aa820e860575533f2e2c1d3351d1.zip
Qt-6c19992488d1aa820e860575533f2e2c1d3351d1.tar.gz
Qt-6c19992488d1aa820e860575533f2e2c1d3351d1.tar.bz2
Initial key event handling for XCB backend.
As there is no XLookupString equivalent in XCB, the key handling is still incomplete.
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 70c6a63..2977d76 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qxcbconnection.h"
+#include "qxcbkeyboard.h"
#include "qxcbscreen.h"
#include "qxcbwindow.h"
@@ -67,6 +68,8 @@ QXcbConnection::QXcbConnection(const char *displayName)
QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this);
connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher()));
+ m_keyboard = new QXcbKeyboard(this);
+
initializeAllAtoms();
}
@@ -75,6 +78,8 @@ QXcbConnection::~QXcbConnection()
qDeleteAll(m_screens);
xcb_disconnect(xcb_connection());
+
+ delete m_keyboard;
}
QXcbWindow *platformWindowFromId(xcb_window_t id)
@@ -93,6 +98,14 @@ QXcbWindow *platformWindowFromId(xcb_window_t id)
} \
break;
+#define HANDLE_KEYBOARD_EVENT(event_t, handler) \
+{ \
+ event_t *e = (event_t *)event; \
+ if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \
+ m_keyboard->handler(platformWindow->widget(), e); \
+} \
+break;
+
void QXcbConnection::eventDispatcher()
{
while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) {
@@ -109,6 +122,21 @@ void QXcbConnection::eventDispatcher()
HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent);
case XCB_CLIENT_MESSAGE:
HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent);
+ case XCB_ENTER_NOTIFY:
+ HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent);
+ case XCB_LEAVE_NOTIFY:
+ HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent);
+ case XCB_FOCUS_IN:
+ HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent);
+ case XCB_FOCUS_OUT:
+ HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_out_event_t, event, handleFocusOutEvent);
+ case XCB_KEY_PRESS:
+ HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent);
+ case XCB_KEY_RELEASE:
+ HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent);
+ case XCB_MAPPING_NOTIFY:
+ m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event);
+ break;
default:
break;
}