diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-04-08 11:43:39 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-04-08 11:43:39 (GMT) |
commit | 8da880e77db04cc4509e0f48e0b5b1d6265da223 (patch) | |
tree | b6dbd9ceb780e7524cc55a3a63dbf7ef17452036 /src/gui/inputmethod | |
parent | 7edc2b05cfdf143c7f8ac444f93db918a5fd5344 (diff) | |
download | Qt-8da880e77db04cc4509e0f48e0b5b1d6265da223.zip Qt-8da880e77db04cc4509e0f48e0b5b1d6265da223.tar.gz Qt-8da880e77db04cc4509e0f48e0b5b1d6265da223.tar.bz2 |
QTextEdit character are lost after special characters like ^ ยด `
This happens only on keyboard layouts like French. The is mainly due to
the key event processing done by the Input manager. In carbon, the key
down event has to be replayed after the input manager finishes his
processing. In Cocoa, while unmarking we have to accept the current text.
Task-number: 123740
Reviewed-by: nrc
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r-- | src/gui/inputmethod/qmacinputcontext_mac.cpp | 20 | ||||
-rw-r--r-- | src/gui/inputmethod/qmacinputcontext_p.h | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp index f0e7ea9..86385fa 100644 --- a/src/gui/inputmethod/qmacinputcontext_mac.cpp +++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp @@ -45,6 +45,7 @@ #include "qtextformat.h" #include <qdebug.h> #include <private/qapplication_p.h> +#include <private/qkeymapper_p.h> QT_BEGIN_NAMESPACE @@ -63,7 +64,8 @@ static QTextFormat qt_mac_compose_format() } QMacInputContext::QMacInputContext(QObject *parent) - : QInputContext(parent), composing(false), recursionGuard(false), textDocument(0) + : QInputContext(parent), composing(false), recursionGuard(false), textDocument(0), + keydownEvent(0) { // createTextDocument(); } @@ -183,6 +185,16 @@ QMacInputContext::cleanup() #endif } +void QMacInputContext::setLastKeydownEvent(EventRef event) +{ + EventRef tmpEvent = keydownEvent; + keydownEvent = event; + if (keydownEvent) + RetainEvent(keydownEvent); + if (tmpEvent) + ReleaseEvent(tmpEvent); +} + OSStatus QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *) { @@ -335,6 +347,12 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void GetEventParameter(key_ev, kEventParamKeyMacCharCodes, typeChar, 0, sizeof(chr), 0, &chr); if(!chr || chr >= 128 || (text.length() > 0 && (text.length() > 1 || text.at(0) != QLatin1Char(chr)))) handled_event = !widget->testAttribute(Qt::WA_InputMethodEnabled); + QMacInputContext *context = qobject_cast<QMacInputContext*>(qApp->inputContext()); + if (context && context->lastKeydownEvent()) { + qt_keymapper_private()->translateKeyEvent(widget, 0, context->lastKeydownEvent(), + 0, false); + context->setLastKeydownEvent(0); + } } break; } default: diff --git a/src/gui/inputmethod/qmacinputcontext_p.h b/src/gui/inputmethod/qmacinputcontext_p.h index f708040..c3f245a 100644 --- a/src/gui/inputmethod/qmacinputcontext_p.h +++ b/src/gui/inputmethod/qmacinputcontext_p.h @@ -78,6 +78,10 @@ public: static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *); static void initialize(); static void cleanup(); + + EventRef lastKeydownEvent() { return keydownEvent; } + void setLastKeydownEvent(EventRef); + protected: void mouseHandler(int pos, QMouseEvent *); private: @@ -85,6 +89,7 @@ private: bool recursionGuard; TSMDocumentID textDocument; QString currentText; + EventRef keydownEvent; }; QT_END_NAMESPACE |