Fix the condition when real focus doesn't change (#35)

Co-authored-by: Weng Xuetian <wengxt@gmail.com>
This commit is contained in:
liulinsong 2022-11-27 06:35:46 +08:00
parent fe938a7717
commit 914bfdf95e
1 changed files with 4 additions and 3 deletions

View File

@ -425,9 +425,10 @@ void QFcitxPlatformInputContext::commit() { QPlatformInputContext::commit(); }
void QFcitxPlatformInputContext::setFocusObject(QObject *object) {
// Since we have a wrapper, it's possible that real focus object is not
// changed.
// changed. Do not emit focusOut and focusIn if:
// realFocusObject does not change.
QObject *realFocusObject = focusObjectWrapper();
if (realFocusObject != object && lastObject_ == object) {
if (lastObject_ == realFocusObject) {
return;
}
@ -442,7 +443,7 @@ void QFcitxPlatformInputContext::setFocusObject(QObject *object) {
QWindow *window = focusWindowWrapper();
lastWindow_ = window;
lastObject_ = object;
lastObject_ = realFocusObject;
// Always create IC Data for window.
if (window) {
proxy = validICByWindow(window);