Backport MR2487 and MR2495 to fix input sources sorting (#2121110)

This commit is contained in:
Kalev Lember 2022-09-22 12:37:11 +02:00
parent d56ef2cdd0
commit 668c36c53b
3 changed files with 116 additions and 1 deletions

37
2487.patch Normal file
View File

@ -0,0 +1,37 @@
From 13c9fd2a668e137b9e2569dcdedb0a25b95ae9aa Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Wed, 14 Sep 2022 20:20:14 +0200
Subject: [PATCH] status: Use fixed sorting of input sources on empty MRU
When updating the MRU sources if there was no prior MRU, we want
to go with the unmodified list of sources in visibility order.
However iterating over object properties happens in an undetermined
order, so the initial MRU list ends up picking a value at random.
In order to prefer the sources list in the same order than they
appear in the menu if there was no prior MRU, order the keys
when accessing it and building the initial list of sources.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5873
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2487>
---
js/ui/status/keyboard.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 76a42f6bd7..65b3962731 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -492,7 +492,7 @@ var InputSourceManager = class extends Signals.EventEmitter {
_updateMruSources() {
let sourcesList = [];
- for (let i in this._inputSources)
+ for (let i of Object.keys(this._inputSources).sort((a, b) => a - b))
sourcesList.push(this._inputSources[i]);
this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));
--
GitLab

68
2495.patch Normal file
View File

@ -0,0 +1,68 @@
From 79a45d691fb03279f501b33bfbefd933e94ec12d Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 19 Sep 2022 22:35:15 +0200
Subject: [PATCH] status: Ignore prior single-element lists updating input
sources MRU
Consider the existing input sources MRU only valid if it contained
more than one element to pick from. Fixes the following situation
with initial-setup sessions:
- Initial setup Session starts, with several input sources already
configured ("us" between them)
- InputSourceManager initializes, only the default "us" keymap is
available
- MRU list is constructed, "us" is picked
- InputSourceManager catches up with session configuration, the
other extra sources are added
- MRU list is reconstructed, "us" is already the most recent
- Session ends up with "us" picked, regardless of its position in
the list, and no MRU existing prior to startup
If we consider the intermediate single-element MRU list invalid,
it is still possible to pick the best default source between all
the configured ones (the one that was put first in the list,
basically), after initialization is complete.
But also, it is unnecessary to have if there is a single source to
pick from. After the sources list has two elements of more, the
MRU list will become effective and preserved during changes to
the available sources.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5873
---
js/ui/status/keyboard.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 65b3962731..82706c0389 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -524,15 +524,18 @@ var InputSourceManager = class extends Signals.EventEmitter {
}
let mruSources = [];
- for (let i = 0; i < this._mruSources.length; i++) {
- for (let j = 0; j < sourcesList.length; j++) {
- if (this._mruSources[i].type == sourcesList[j].type &&
- this._mruSources[i].id == sourcesList[j].id) {
- mruSources = mruSources.concat(sourcesList.splice(j, 1));
- break;
+ if (this._mruSources.length > 1) {
+ for (let i = 0; i < this._mruSources.length; i++) {
+ for (let j = 0; j < sourcesList.length; j++) {
+ if (this._mruSources[i].type === sourcesList[j].type &&
+ this._mruSources[i].id === sourcesList[j].id) {
+ mruSources = mruSources.concat(sourcesList.splice(j, 1));
+ break;
+ }
}
}
}
+
this._mruSources = mruSources.concat(sourcesList);
}
--
GitLab

View File

@ -2,13 +2,20 @@
Name: gnome-shell Name: gnome-shell
Version: 43.0 Version: 43.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: Window management and application launching for GNOME Summary: Window management and application launching for GNOME
License: GPLv2+ License: GPLv2+
URL: https://wiki.gnome.org/Projects/GnomeShell URL: https://wiki.gnome.org/Projects/GnomeShell
Source0: https://download.gnome.org/sources/gnome-shell/43/%{name}-%{tarball_version}.tar.xz Source0: https://download.gnome.org/sources/gnome-shell/43/%{name}-%{tarball_version}.tar.xz
# Backported from upstream
# https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2487
Patch0: 2487.patch
# Backported from upstream
# https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2495
Patch1: 2495.patch
# Replace Epiphany with Firefox in the default favourite apps list # Replace Epiphany with Firefox in the default favourite apps list
Patch10001: gnome-shell-favourite-apps-firefox.patch Patch10001: gnome-shell-favourite-apps-firefox.patch
@ -231,6 +238,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/evolution-calendar.de
%{_mandir}/man1/gnome-shell.1* %{_mandir}/man1/gnome-shell.1*
%changelog %changelog
* Thu Sep 22 2022 Kalev Lember <klember@redhat.com> - 43.0-2
- Backport MR2487 and MR2495 to fix input sources sorting (#2121110)
* Sat Sep 17 2022 Florian Müllner <fmuellner@redhat.com> - 43.0-1 * Sat Sep 17 2022 Florian Müllner <fmuellner@redhat.com> - 43.0-1
- Update to 43.0 - Update to 43.0