summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoaview_mac.mm
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-08-13 16:42:16 +0200
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-08-13 16:45:51 +0200
commit3411ac72ffcbd8152342603152193aa7283bd149 (patch)
treea383550020b6cea478d32aec1da9b535330a8741 /src/gui/kernel/qcocoaview_mac.mm
parent6c2662c9d4d0813622ee5a9783911dbe2e48e72c (diff)
Cannot enter text through character viewer on Mac (Cocoa)
This text is delivered through the NSTextInput protocol. Since it was not initiated from a keyDown message, we were ignoring the insertText: message. Reviewed-by: Denis
Diffstat (limited to 'src/gui/kernel/qcocoaview_mac.mm')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 3229e71bb5..0282c7946a 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -207,6 +207,7 @@ static int qCocoaViewCount = 0;
composing = false;
sendKeyEvents = true;
+ fromKeyDownEvent = false;
[self setHidden:YES];
return self;
}
@@ -1215,7 +1216,9 @@ static int qCocoaViewCount = 0;
&& !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly
|| widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly
|| widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) {
+ fromKeyDownEvent = true;
[qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]];
+ fromKeyDownEvent = false;
}
if (sendKeyEvents && !composing) {
bool keyOK = qt_dispatchKeyEvent(theEvent, widgetToGetKey);
@@ -1285,7 +1288,10 @@ static int qCocoaViewCount = 0;
};
}
- if ([aString length] && composing) {
+ // When entering characters through Character Viewer or Keyboard Viewer, the text is passed
+ // through this insertText method. Since we dont receive a keyDown Event in such cases, the
+ // composing flag will be false.
+ if (([aString length] && composing) || !fromKeyDownEvent) {
// Send the commit string to the widget.
composing = false;
sendKeyEvents = false;