summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qximinputcontext_x11.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-03-23 12:13:43 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-03-24 15:18:55 (GMT)
commit7f147cf30e8c72ed4c452de31f4b5f853dbe9e4f (patch)
tree94faed0e79b42e18dc384a8882bd110b57550a38 /src/gui/inputmethod/qximinputcontext_x11.cpp
parent2b9e47e4ce09802f00fa2ca39c0cd877f59ae4d9 (diff)
downloadQt-7f147cf30e8c72ed4c452de31f4b5f853dbe9e4f.zip
Qt-7f147cf30e8c72ed4c452de31f4b5f853dbe9e4f.tar.gz
Qt-7f147cf30e8c72ed4c452de31f4b5f853dbe9e4f.tar.bz2
Don't commit an empty string to the widget when it looses focus.
When a wiget that accepts keyboard input looses focus and the input context is resetted we should clear the old preedit string by sending an empty commit string only if the widget received non-empty pre-edit string before. Reviewed-by: Brad
Diffstat (limited to 'src/gui/inputmethod/qximinputcontext_x11.cpp')
-rw-r--r--src/gui/inputmethod/qximinputcontext_x11.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp
index 48a96b1..1c8560f 100644
--- a/src/gui/inputmethod/qximinputcontext_x11.cpp
+++ b/src/gui/inputmethod/qximinputcontext_x11.cpp
@@ -264,6 +264,7 @@ extern "C" {
qic->standardFormat(QInputContext::PreeditFormat));
attrs << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, sellen ? 0 : 1, QVariant());
QInputMethodEvent e(data->text, attrs);
+ data->preeditEmpty = data->text.isEmpty();
qic->sendEvent(e);
return 0;
@@ -286,6 +287,7 @@ void QXIMInputContext::ICData::clear()
text = QString();
selectedChars.clear();
composing = false;
+ preeditEmpty = true;
}
QXIMInputContext::ICData *QXIMInputContext::icData() const
@@ -537,9 +539,12 @@ void QXIMInputContext::reset()
if (mb) {
e.setCommitString(QString::fromLocal8Bit(mb));
XFree(mb);
+ data->preeditEmpty = false; // force sending an event
+ }
+ if (!data->preeditEmpty) {
+ sendEvent(e);
+ update();
}
- sendEvent(e);
- update();
}
data->clear();
}
@@ -686,6 +691,7 @@ QXIMInputContext::ICData *QXIMInputContext::createICData(QWidget *w)
{
ICData *data = new ICData;
data->widget = w;
+ data->preeditEmpty = true;
XVaNestedList preedit_attr = 0;
XIMCallback startcallback, drawcallback, donecallback;