Skip to content

Commit

Permalink
chore: Update mutter, gnome-shell, and kf6-kio for F41
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Oct 19, 2024
1 parent ff2340b commit 2f239bc
Show file tree
Hide file tree
Showing 14 changed files with 1,348 additions and 999 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 78a733bae62f8af15f0771d7efde55473f295e46 Mon Sep 17 00:00:00 2001
From: Ray Strode <[email protected]>
Date: Wed, 16 Aug 2023 18:46:54 -0400
Subject: [PATCH 1/3] status/keyboard: Add a catch around reload call

Now that system input settings can get used in the user session
they're getting seen by the tests and the tests are complaining:

Unhandled promise rejection. To suppress this warning, add an
error handler to your promise chain with .catch() or a try-catch block
around your await expression.

This commit adds the catch it's asking for.
---
js/ui/status/keyboard.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index cfc0a01f6b..4ef2f355d3 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -204,7 +204,9 @@ class InputSourceSystemSettings extends InputSourceSettings {
this._options = '';
this._model = '';

- this._reload();
+ this._reload().catch(error => {
+ logError(error, 'Could not reload system input settings');
+ });

Gio.DBus.system.signal_subscribe(this._BUS_NAME,
this._BUS_PROPS_IFACE,
--
2.43.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
From 0c0cc4ce1d3e08eba3e701d565398e01aa479ff7 Mon Sep 17 00:00:00 2001
From: Ray Strode <[email protected]>
Date: Wed, 16 Aug 2023 11:13:39 -0400
Subject: [PATCH 2/3] status/keyboard: Load keyboard from system settings if
gsettings unconfigured

Right now if a user hasn't configured their input sources, the code
falls back to
using the current layout on Xorg and the mutter default with wayland.

This commit changes the code to instead fall back to using the system
default (as configured by localed).
---
js/ui/status/keyboard.js | 62 +++++++++++++++++++++++++++++++---------
1 file changed, 48 insertions(+), 14 deletions(-)

diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 4ef2f355d3..d91eb41bc6 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -22,6 +22,9 @@ import * as Util from '../../misc/util.js';
export const INPUT_SOURCE_TYPE_XKB = 'xkb';
export const INPUT_SOURCE_TYPE_IBUS = 'ibus';

+const DESKTOP_INPUT_SOURCES_SCHEMA = 'org.gnome.desktop.input-sources';
+const KEY_INPUT_SOURCES = 'sources';
+
export const LayoutMenuItem = GObject.registerClass(
class LayoutMenuItem extends PopupMenu.PopupBaseMenuItem {
_init(displayName, shortName) {
@@ -278,18 +281,16 @@ class InputSourceSystemSettings extends InputSourceSettings {
}

class InputSourceSessionSettings extends InputSourceSettings {
- constructor() {
+ constructor(settings) {
super();

- this._DESKTOP_INPUT_SOURCES_SCHEMA = 'org.gnome.desktop.input-sources';
- this._KEY_INPUT_SOURCES = 'sources';
this._KEY_MRU_SOURCES = 'mru-sources';
this._KEY_KEYBOARD_OPTIONS = 'xkb-options';
this._KEY_KEYBOARD_MODEL = 'xkb-model';
this._KEY_PER_WINDOW = 'per-window';

- this._settings = new Gio.Settings({schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA});
- this._settings.connect(`changed::${this._KEY_INPUT_SOURCES}`, this._emitInputSourcesChanged.bind(this));
+ this._settings = settings;
+ this._settings.connect(`changed::${KEY_INPUT_SOURCES}`, this._emitInputSourcesChanged.bind(this));
this._settings.connect(`changed::${this._KEY_KEYBOARD_OPTIONS}`, this._emitKeyboardOptionsChanged.bind(this));
this._settings.connect(`changed::${this._KEY_KEYBOARD_MODEL}`, this._emitKeyboardModelChanged.bind(this));
this._settings.connect(`changed::${this._KEY_PER_WINDOW}`, this._emitPerWindowChanged.bind(this));
@@ -308,7 +309,7 @@ class InputSourceSessionSettings extends InputSourceSettings {
}

get inputSources() {
- return this._getSourcesList(this._KEY_INPUT_SOURCES);
+ return this._getSourcesList(KEY_INPUT_SOURCES);
}

get mruSources() {
@@ -363,13 +364,6 @@ export class InputSourceManager extends Signals.EventEmitter {
Meta.KeyBindingFlags.IS_REVERSED,
Shell.ActionMode.ALL,
this._switchInputSource.bind(this));
- if (Main.sessionMode.isGreeter)
- this._settings = new InputSourceSystemSettings();
- else
- this._settings = new InputSourceSessionSettings();
- this._settings.connect('input-sources-changed', this._inputSourcesChanged.bind(this));
- this._settings.connect('keyboard-options-changed', this._keyboardOptionsChanged.bind(this));
- this._settings.connect('keyboard-model-changed', this._keyboardModelChanged.bind(this));

this._xkbInfo = KeyboardManager.getXkbInfo();
this._keyboardManager = KeyboardManager.getKeyboardManager();
@@ -381,16 +375,56 @@ export class InputSourceManager extends Signals.EventEmitter {
this._ibusManager.connect('property-updated', this._ibusPropertyUpdated.bind(this));
this._ibusManager.connect('set-content-type', this._ibusSetContentType.bind(this));

+ this._inputSettings = new Gio.Settings({schema_id: DESKTOP_INPUT_SOURCES_SCHEMA});
+ this._setupInputSettings();
+
global.display.connect('modifiers-accelerator-activated', this._modifiersSwitcher.bind(this));

this._sourcesPerWindow = false;
this._focusWindowNotifyId = 0;
- this._settings.connect('per-window-changed', this._sourcesPerWindowChanged.bind(this));
this._sourcesPerWindowChanged();
this._disableIBus = false;
this._reloading = false;
}

+ _sessionHasNoInputSettings() {
+ return this._inputSettings.get_user_value(KEY_INPUT_SOURCES) === null;
+ }
+
+ _reloadInputSettings() {
+ const hadNoSessionInputSettings = this._hasNoSessionInputSettings;
+
+ if (Main.sessionMode.isGreeter)
+ this._hasNoSessionInputSettings = true;
+ else
+ this._hasNoSessionInputSettings = this._sessionHasNoInputSettings();
+
+ if (this._settings && hadNoSessionInputSettings === this._hasNoSessionInputSettings)
+ return;
+
+ this._settings?.disconnectObject(this);
+
+ if (this._hasNoSessionInputSettings)
+ this._settings = new InputSourceSystemSettings();
+ else
+ this._settings = new InputSourceSessionSettings(this._inputSettings);
+
+ this._settings.connectObject(
+ 'input-sources-changed', this._inputSourcesChanged.bind(this),
+ 'keyboard-options-changed', this._keyboardOptionsChanged.bind(this),
+ 'keyboard-model-changed', this._keyboardModelChanged.bind(this),
+ 'per-window-changed', this._sourcesPerWindowChanged.bind(this),
+ this);
+ this.reload();
+ }
+
+ _setupInputSettings() {
+ if (!Main.sessionMode.isGreeter)
+ this._inputSettings.connect(`changed::${KEY_INPUT_SOURCES}`, this._reloadInputSettings.bind(this));
+
+ this._reloadInputSettings();
+ }
+
reload() {
this._reloading = true;
this._keyboardManager.setKeyboardOptions(this._settings.keyboardOptions);
--
2.43.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
From d060baeb69a2a7d80fe403fc8eec90e20aa6cb7f Mon Sep 17 00:00:00 2001
From: Ray Strode <[email protected]>
Date: Wed, 16 Aug 2023 14:09:50 -0400
Subject: [PATCH 3/3] status/keyboard: Use gnome-desktop API for getting
default input sources list

At the moment, gnome-shell tries to figure out the default input sources
from localed. It fails to take into account the system locale and input
methods.

This commit switches it to use a new function in gnome-desktop,
gnome_get_default_input_sources, which does most of the heavy
lifting itself, instead.
---
js/ui/status/keyboard.js | 59 ++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 32 deletions(-)

diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index d91eb41bc6..19c36031f6 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -3,6 +3,7 @@
import Clutter from 'gi://Clutter';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
+import GnomeDesktop from 'gi://GnomeDesktop';
import GObject from 'gi://GObject';
import IBus from 'gi://IBus';
import Meta from 'gi://Meta';
@@ -25,6 +26,8 @@ export const INPUT_SOURCE_TYPE_IBUS = 'ibus';
const DESKTOP_INPUT_SOURCES_SCHEMA = 'org.gnome.desktop.input-sources';
const KEY_INPUT_SOURCES = 'sources';

+Gio._promisify(GnomeDesktop, 'get_default_input_sources');
+
export const LayoutMenuItem = GObject.registerClass(
class LayoutMenuItem extends PopupMenu.PopupBaseMenuItem {
_init(displayName, shortName) {
@@ -202,9 +205,9 @@ class InputSourceSystemSettings extends InputSourceSettings {
this._BUS_IFACE = 'org.freedesktop.locale1';
this._BUS_PROPS_IFACE = 'org.freedesktop.DBus.Properties';

- this._layouts = '';
- this._variants = '';
- this._options = '';
+ this._inputSourceIds = [];
+ this._inputSourceTypes = [];
+ this._options = [];
this._model = '';

this._reload().catch(error => {
@@ -221,30 +224,22 @@ class InputSourceSystemSettings extends InputSourceSettings {
}

async _reload() {
- let props;
+ let inputSourceIds;
+ let inputSourceTypes;
+ let options;
+ let model;
try {
- const result = await Gio.DBus.system.call(
- this._BUS_NAME,
- this._BUS_PATH,
- this._BUS_PROPS_IFACE,
- 'GetAll',
- new GLib.Variant('(s)', [this._BUS_IFACE]),
- null, Gio.DBusCallFlags.NONE, -1, null);
- [props] = result.deepUnpack();
+ [inputSourceIds, inputSourceTypes, options, model] =
+ await GnomeDesktop.get_default_input_sources(null);
} catch (e) {
- log(`Could not get properties from ${this._BUS_NAME}`);
+ logError(e, 'Could not get default input sources');
return;
}

- const layouts = props['X11Layout'].unpack();
- const variants = props['X11Variant'].unpack();
- const options = props['X11Options'].unpack();
- const model = props['X11Model'].unpack();
-
- if (layouts !== this._layouts ||
- variants !== this._variants) {
- this._layouts = layouts;
- this._variants = variants;
+ if (inputSourceIds !== this._inputSourceIds ||
+ inputSourceTypes !== this._inputSourceTypes) {
+ this._inputSourceIds = inputSourceIds;
+ this._inputSourceTypes = inputSourceTypes;
this._emitInputSourcesChanged();
}
if (options !== this._options) {
@@ -258,21 +253,21 @@ class InputSourceSystemSettings extends InputSourceSettings {
}

get inputSources() {
- let sourcesList = [];
- let layouts = this._layouts.split(',');
- let variants = this._variants.split(',');
-
- for (let i = 0; i < layouts.length && !!layouts[i]; i++) {
- let id = layouts[i];
- if (variants[i])
- id += `+${variants[i]}`;
- sourcesList.push({type: INPUT_SOURCE_TYPE_XKB, id});
+ let sourcesList;
+
+ if (this._inputSourceIds) {
+ sourcesList = this._inputSourceIds.map((id, index) => {
+ return {type: this._inputSourceTypes[index], id};
+ });
+ } else {
+ sourcesList = [];
}
+
return sourcesList;
}

get keyboardOptions() {
- return this._options.split(',');
+ return this._options;
}

get keyboardModel() {
--
2.43.1

Loading

0 comments on commit 2f239bc

Please sign in to comment.