From 4a46ac2e64a51ed9085b87197540e72851571abd Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 1 Nov 2021 10:24:50 -0700 Subject: [PATCH] Backport MR #2011 to further fix unexpected scrolling (#2017192) --- ...-Equate-empty-preedit-string-to-null.patch | 29 ++++++++++++++ ...ot-communicate-preedit-text-change-o.patch | 38 +++++++++++++++++++ ...ot-reset-invisible-preedit-on-focus_.patch | 30 +++++++++++++++ gnome-shell.spec | 14 ++++++- 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 0001-inputMethod-Equate-empty-preedit-string-to-null.patch create mode 100644 0002-inputMethod-Do-not-communicate-preedit-text-change-o.patch create mode 100644 0003-inputMethod-Do-not-reset-invisible-preedit-on-focus_.patch diff --git a/0001-inputMethod-Equate-empty-preedit-string-to-null.patch b/0001-inputMethod-Equate-empty-preedit-string-to-null.patch new file mode 100644 index 0000000..d09c14c --- /dev/null +++ b/0001-inputMethod-Equate-empty-preedit-string-to-null.patch @@ -0,0 +1,29 @@ +From 286cfdc6d48dc4315df54d29d7d16b5198d92a56 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 29 Oct 2021 16:41:55 +0200 +Subject: [PATCH 1/3] inputMethod: Equate empty preedit string to null + +If we get '' from the IM as the preedit string, it is pretty safe +to handle it as "no preedit" altogether. + +Part-of: +--- + js/misc/inputMethod.js | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js +index 1f9eaee7a..7de7540d3 100644 +--- a/js/misc/inputMethod.js ++++ b/js/misc/inputMethod.js +@@ -111,6 +111,8 @@ class InputMethod extends Clutter.InputMethod { + return; + + let preedit = text.get_text(); ++ if (preedit === '') ++ preedit = null; + + if (visible) + this.set_preedit_text(preedit, pos, mode); +-- +2.33.1 + diff --git a/0002-inputMethod-Do-not-communicate-preedit-text-change-o.patch b/0002-inputMethod-Do-not-communicate-preedit-text-change-o.patch new file mode 100644 index 0000000..030870a --- /dev/null +++ b/0002-inputMethod-Do-not-communicate-preedit-text-change-o.patch @@ -0,0 +1,38 @@ +From 047691b0d3471630ec80e32f371291dd2ef02419 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 29 Oct 2021 16:43:15 +0200 +Subject: [PATCH 2/3] inputMethod: Do not communicate preedit text change on + reset + +This is now done in the ClutterInputFocus for us, since +https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1940. There +is no need to duplicate this call, and it happens to cause undesired +scrolling to content in some cases when this reset happens during +a change in the IM focused client state. + +Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4647 +Part-of: +--- + js/misc/inputMethod.js | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js +index 7de7540d3..71dff84f5 100644 +--- a/js/misc/inputMethod.js ++++ b/js/misc/inputMethod.js +@@ -186,11 +186,7 @@ class InputMethod extends Clutter.InputMethod { + this._emitRequestSurrounding(); + } + +- if (this._preeditStr !== null) { +- // Unset any preedit text +- this.set_preedit_text(null, 0, Clutter.PreeditResetMode.CLEAR); +- this._preeditStr = null; +- } ++ this._preeditStr = null; + } + + vfunc_set_cursor_location(rect) { +-- +2.33.1 + diff --git a/0003-inputMethod-Do-not-reset-invisible-preedit-on-focus_.patch b/0003-inputMethod-Do-not-reset-invisible-preedit-on-focus_.patch new file mode 100644 index 0000000..29d0e07 --- /dev/null +++ b/0003-inputMethod-Do-not-reset-invisible-preedit-on-focus_.patch @@ -0,0 +1,30 @@ +From 01775609525b12de752a2f7ebac88baee9b041d3 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Fri, 29 Oct 2021 16:46:18 +0200 +Subject: [PATCH 3/3] inputMethod: Do not reset invisible preedit on focus_out + +If the preedit is in invisible state, the last preedit string that +was sent around is already null, so there is no need to clear the preedit +in that case. + +Part-of: +--- + js/misc/inputMethod.js | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js +index 71dff84f5..8c3cd61ae 100644 +--- a/js/misc/inputMethod.js ++++ b/js/misc/inputMethod.js +@@ -167,7 +167,7 @@ class InputMethod extends Clutter.InputMethod { + if (this._context) + this._context.focus_out(); + +- if (this._preeditStr) { ++ if (this._preeditStr && this._preeditVisible) { + // Unset any preedit text + this.set_preedit_text(null, 0, this._preeditCommitMode); + this._preeditStr = null; +-- +2.33.1 + diff --git a/gnome-shell.spec b/gnome-shell.spec index 7e90562..7c483c4 100644 --- a/gnome-shell.spec +++ b/gnome-shell.spec @@ -2,7 +2,7 @@ Name: gnome-shell Version: 41.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Window management and application launching for GNOME License: GPLv2+ @@ -36,6 +36,15 @@ Patch60002: 0002-unlockDialog-Properly-reset-auth-prompt-when-showing.patch # Work around crashy tear down Patch60003: 0001-main-Leak-the-GJS-context-and-ShellGlobal.patch +# More fixes for cursor bouncing around in text editors +# https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4647 +# https://bugzilla.redhat.com/show_bug.cgi?id=2017192 +# https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2011 +Patch70001: 0001-inputMethod-Equate-empty-preedit-string-to-null.patch +Patch70002: 0002-inputMethod-Do-not-communicate-preedit-text-change-o.patch +Patch70003: 0003-inputMethod-Do-not-reset-invisible-preedit-on-focus_.patch + + %define eds_version 3.33.1 %define gnome_desktop_version 3.35.91 %define glib2_version 2.56.0 @@ -249,6 +258,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/evolution-calendar.de %{_mandir}/man1/gnome-shell.1* %changelog +* Fri Oct 29 2021 Adam Williamson - 41.0-8 +- Backport MR #2011 to further fix unexpected scrolling (#2017192) + * Wed Oct 27 2021 Ray Strode - 41.0-7 - Use correct patch for fixing unlock screen confusion