From 1e6c92a083864da9914078990210c1eb38c38cb1 Mon Sep 17 00:00:00 2001 From: Matthijs Velsink Date: Sun, 15 Dec 2024 21:53:06 +0100 Subject: [PATCH] status/a11y: Block 'toggled' signal when manually toggling When the 'text-scaling-factor' key changes and it's set bigger than 1.0, the corresponding switch is activated in the a11y menu. However, since commit 946ee936926a0e14fa5f86f62da757bcb581a147, setting the state using `setToggleState()` also fires the 'toggled' signal, which is I think correct and intended. However, that means the GSettings handler for 'text-scaling-factor' should block that 'toggled' handler when it sets the switch active, as otherwise the 'text-scaling-factor' is always set to 1.25 when it is first made bigger than 1.0. Part-of: --- js/ui/status/accessibility.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index 44c9dc9f9..2a98374ac 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -122,7 +122,7 @@ class ATIndicator extends PanelMenu.Button { const widget = new PopupMenu.PopupSwitchMenuItem(_('Large Text'), factor > 1.0); - widget.connect('toggled', item => { + const toggledId = widget.connect('toggled', item => { if (item.state) settings.set_double(KEY_TEXT_SCALING_FACTOR, DPI_FACTOR_LARGE); else @@ -132,7 +132,10 @@ class ATIndicator extends PanelMenu.Button { settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => { factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); let active = factor > 1.0; + + widget.block_signal_handler(toggledId); widget.setToggleState(active); + widget.unblock_signal_handler(toggledId); this._queueSyncMenuVisibility(); });