The input method is disabled only if it's really needed
When QPlatformInputContext object does not support input method and the focus object/focus object wrapper do not support input method, it's really needed to disable it.
This commit is contained in:
parent
82bf9fac90
commit
ff9178231e
|
@ -247,6 +247,10 @@ bool QFcitxPlatformInputContext::objectAcceptsInputMethod() const {
|
|||
return enabled;
|
||||
}
|
||||
|
||||
bool QFcitxPlatformInputContext::shouldDisableInputMethod() const {
|
||||
return !inputMethodAccepted() && !objectAcceptsInputMethod();
|
||||
}
|
||||
|
||||
void QFcitxPlatformInputContext::cleanUp() {
|
||||
icMap_.clear();
|
||||
|
||||
|
@ -330,7 +334,7 @@ void QFcitxPlatformInputContext::update(Qt::InputMethodQueries queries) {
|
|||
}
|
||||
|
||||
if (queries & Qt::ImEnabled) {
|
||||
if (!inputMethodAccepted() && !objectAcceptsInputMethod()) {
|
||||
if (shouldDisableInputMethod()) {
|
||||
addCapability(data, FcitxCapabilityFlag_Disable);
|
||||
} else {
|
||||
removeCapability(data, FcitxCapabilityFlag_Disable);
|
||||
|
@ -569,7 +573,7 @@ void QFcitxPlatformInputContext::createInputContextFinished(
|
|||
}
|
||||
flag |= FcitxCapabilityFlag_ClientSideInputPanel;
|
||||
|
||||
if (!inputMethodAccepted() || !objectAcceptsInputMethod()) {
|
||||
if (shouldDisableInputMethod()) {
|
||||
flag |= FcitxCapabilityFlag_Disable;
|
||||
}
|
||||
|
||||
|
@ -939,7 +943,7 @@ bool QFcitxPlatformInputContext::filterEvent(const QEvent *event) {
|
|||
//hanteng 2022/10/18
|
||||
if (keycode == 248)
|
||||
break;
|
||||
if (!inputMethodAccepted() && !objectAcceptsInputMethod())
|
||||
if (shouldDisableInputMethod())
|
||||
break;
|
||||
|
||||
QObject *input = qGuiApp->focusObject();
|
||||
|
|
|
@ -185,6 +185,7 @@ private:
|
|||
|
||||
void updateCursorRect();
|
||||
bool objectAcceptsInputMethod() const;
|
||||
bool shouldDisableInputMethod() const;
|
||||
|
||||
FcitxQtWatcher *watcher_;
|
||||
QString preedit_;
|
||||
|
|
Loading…
Reference in New Issue