Backport MR #2059 to fix cursor jumping around in text editors (#2017192)

This commit is contained in:
Adam Williamson 2021-10-25 16:48:46 -07:00
parent fc6842463b
commit 75e6ecbeda
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 3b6f9111c7da3fee82d3ffd19c444155f84d86ea Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 19 Oct 2021 16:53:13 +0200
Subject: [PATCH] clutter: Only reset preedit text if set
On ClutterInputFocus::reset, avoid to unset the preedit text if
none was set earlier. This seems to trick GTK clients into focusing
the cursor position again, even when we are moving away from it.
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4647
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2059>
---
clutter/clutter/clutter-input-focus.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/clutter/clutter/clutter-input-focus.c b/clutter/clutter/clutter-input-focus.c
index c22e3a32c0..117bab72ce 100644
--- a/clutter/clutter/clutter-input-focus.c
+++ b/clutter/clutter/clutter-input-focus.c
@@ -103,14 +103,16 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
priv = clutter_input_focus_get_instance_private (focus);
- if (priv->preedit &&
- priv->mode == CLUTTER_PREEDIT_RESET_COMMIT)
- clutter_input_focus_commit (focus, priv->preedit);
+ if (priv->preedit)
+ {
+ if (priv->mode == CLUTTER_PREEDIT_RESET_COMMIT)
+ clutter_input_focus_commit (focus, priv->preedit);
- clutter_input_focus_set_preedit_text (focus, NULL, 0);
- g_clear_pointer (&priv->preedit, g_free);
- priv->mode = CLUTTER_PREEDIT_RESET_CLEAR;
+ clutter_input_focus_set_preedit_text (focus, NULL, 0);
+ g_clear_pointer (&priv->preedit, g_free);
+ }
+ priv->mode = CLUTTER_PREEDIT_RESET_CLEAR;
clutter_input_method_reset (priv->im);
}
--
2.33.0

View File

@ -10,7 +10,7 @@
Name: mutter Name: mutter
Version: 41.0 Version: 41.0
Release: 3%{?dist} Release: 4%{?dist}
Summary: Window and compositing manager based on Clutter Summary: Window and compositing manager based on Clutter
License: GPLv2+ License: GPLv2+
@ -32,6 +32,12 @@ Patch2: 0001-Test-deny-atomic-KMS-for-tegra-RHBZ-1936991.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2009304 # https://bugzilla.redhat.com/show_bug.cgi?id=2009304
Patch3: 0001-kms-impl-device-atomic-Add-virtio_gpu-to-deny-list.patch Patch3: 0001-kms-impl-device-atomic-Add-virtio_gpu-to-deny-list.patch
# Only reset preedit text if set
# Fixes cursor jumping around like a demented bunny in text editors
# https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4647
# https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2059
Patch4: 0001-clutter-Only-reset-preedit-text-if-set.patch
BuildRequires: pango-devel BuildRequires: pango-devel
BuildRequires: startup-notification-devel BuildRequires: startup-notification-devel
BuildRequires: gnome-desktop3-devel BuildRequires: gnome-desktop3-devel
@ -180,6 +186,9 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests %{_datadir}/mutter-%{mutter_api_version}/tests
%changelog %changelog
* Mon Oct 25 2021 Adam Williamson <awilliam@redhat.com> - 41.0-4
- Backport MR #2059 to fix cursor jumping around in text editors (#2017192)
* Tue Oct 05 2021 Adam Williamson <awilliam@redhat.com> - 41.0-3 * Tue Oct 05 2021 Adam Williamson <awilliam@redhat.com> - 41.0-3
- Backport MR #2040 to fix cursor offset in VMs (#2009304) - Backport MR #2040 to fix cursor offset in VMs (#2009304)