Backport MR #2767 to fix slow startup issue (#2179998)

epel9
Adam Williamson 2 years ago
parent 484a6bde1b
commit 53d6a39c5d

@ -0,0 +1,51 @@
From 8cbc16f0925c75b569c39184a68595c54278e75a Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Wed, 22 Mar 2023 22:30:44 +0600
Subject: [PATCH] sddm-theme: Populate keyboard layouts menu only on first show
Doing it synchronously can be very slow; seemingly scaling with the
number of items in the model.
https://bugzilla.redhat.com/show_bug.cgi?id=2179998
---
lookandfeel/sddm-theme/KeyboardButton.qml | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lookandfeel/sddm-theme/KeyboardButton.qml b/lookandfeel/sddm-theme/KeyboardButton.qml
index df8767dda4..ca2458b6d2 100644
--- a/lookandfeel/sddm-theme/KeyboardButton.qml
+++ b/lookandfeel/sddm-theme/KeyboardButton.qml
@@ -17,7 +17,7 @@ PlasmaComponents.ToolButton {
onCurrentIndexChanged: keyboard.currentLayout = currentIndex
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keyboard Layout: %1", keyboard.layouts[currentIndex].longName)
- visible: menu.count > 1
+ visible: keyboard.layouts.length > 1
checkable: true
checked: menu.opened
@@ -36,13 +36,17 @@ PlasmaComponents.ToolButton {
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
PlasmaCore.ColorScope.inherit: false
- Instantiator {
- id: instantiator
- model: {
+ onAboutToShow: {
+ if (instantiator.model === null) {
let layouts = keyboard.layouts;
layouts.sort((a, b) => a.longName.localeCompare(b.longName));
- return layouts;
+ instantiator.model = layouts;
}
+ }
+
+ Instantiator {
+ id: instantiator
+ model: null
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
delegate: PlasmaComponents.MenuItem {
--
GitLab

@ -28,7 +28,7 @@
Name: plasma-workspace
Summary: Plasma workspace, applications and applets
Version: 5.27.3
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
URL: https://invent.kde.org/plasma/%{name}
@ -63,6 +63,10 @@ Source40: ssh-agent.conf
Source41: spice-vdagent.conf
## upstream Patches (master branch)
# https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2767
# https://bugzilla.redhat.com/show_bug.cgi?id=2179998
# Fix delay on startup caused by populating keyboard layout list
Patch0: 2767.patch
## upstreamable Patches
@ -792,6 +796,9 @@ fi
%changelog
* Wed Mar 22 2023 Adam Williamson <awilliam@redhat.com> - 5.27.3-2
- Backport MR #2767 to fix slow startup issue (#2179998)
* Tue Mar 14 2023 Marc Deop i Argemí <marcdeop@fedoraproject.org> - 5.27.3-1
- 5.27.3

Loading…
Cancel
Save