summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbkeyboard.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-02-09 11:05:54 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-02-09 11:05:54 (GMT)
commitbb0480a03bba6b23dd1e35ea1a8cc62e4f4a0219 (patch)
tree914806dc855707fb6977c180e6e6eb10f541db95 /src/plugins/platforms/xcb/qxcbkeyboard.cpp
parenta0cc1e923e1d43bbb86d59b829c2d8a23a03bcf4 (diff)
downloadQt-bb0480a03bba6b23dd1e35ea1a8cc62e4f4a0219.zip
Qt-bb0480a03bba6b23dd1e35ea1a8cc62e4f4a0219.tar.gz
Qt-bb0480a03bba6b23dd1e35ea1a8cc62e4f4a0219.tar.bz2
Added workaround to make XCB key event handling detect upper case.
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbkeyboard.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index b226e3e..83f053a 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -911,10 +911,8 @@ QXcbKeyboard::~QXcbKeyboard()
xcb_key_symbols_free(m_key_symbols);
}
-void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event)
+void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time)
{
- xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast<xcb_key_press_event_t *>(event), 0);
-
QByteArray chars;
chars.resize(513);
@@ -922,25 +920,26 @@ void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_even
int qtcode = 0;
int count = 0;
- QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count);
+ if (state & XCB_MOD_MASK_SHIFT && sym <= 0x7f && isalpha(sym))
+ sym = toupper(sym);
- QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyPress, qtcode, modifiers, string.left(count));
+ QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count);
+
+ QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count));
}
-void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event)
+void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event)
{
- xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast<xcb_key_release_event_t *>(event), 0);
-
- QByteArray chars;
- chars.resize(513);
+ xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast<xcb_key_press_event_t *>(event), 0);
- Qt::KeyboardModifiers modifiers;
- int qtcode = 0;
- int count = 0;
+ handleKeyEvent(widget, QEvent::KeyPress, sym, event->state, event->time);
+}
- QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count);
+void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event)
+{
+ xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast<xcb_key_release_event_t *>(event), 0);
- QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyRelease, qtcode, modifiers, string.left(count));
+ handleKeyEvent(widget, QEvent::KeyRelease, sym, event->state, event->time);
}
void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event)