[gnome-shell/wip/rstrode/login-screen-extensions: 86/134] a11y: Change HC icon theme first




commit f2cf5c381e3250a1eb9612d2e3a7c7d75ebec6aa
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Dec 14 19:15:53 2019 +0100

    a11y: Change HC icon theme first
    
    There are two ways for applications to provide a high contrast icon:
    
     1. install an icon into the HighContrast theme
     2. install a symbolic icon into the default hicolor theme
    
    The latter is preferred nowadays, and implemented in the high-contrast
    CSS variant by enforcing the symbolic icon style.
    
    However together with the way we currently enable/disable high-contrast,
    this can lead to the following race:
     1. the GTK theme is changed from HighContrast
     2. we reload the default stylesheet
     3. the icon style changes to "regular", so we request a
        new icon from the HighContrast icon theme
     4. the icon theme is changed from HighContrast
     5. we evict existing icons from the cache
     6. we reload icons for the new icon theme; however as we
        find a pending request (from 3), we re-use it
     7. the request from 3 finishes, and we end up with a
        wrong icon in the cache
    
    The simplest fix is to change the icon theme before the GTK theme: Unlike the
    theme name, the icon style is encoded in the cache key, so we won't re-use
    an old (and incorrect) request in that case.

 js/ui/status/accessibility.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 10223ec844..90948d4650 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -154,14 +154,14 @@ class ATIndicator extends PanelMenu.Button {
             interfaceSettings.is_writable(KEY_ICON_THEME),
             enabled => {
                 if (enabled) {
-                    interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
                     interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME);
+                    interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
                 } else if(!hasHC) {
-                    interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme);
                     interfaceSettings.set_string(KEY_ICON_THEME, iconTheme);
+                    interfaceSettings.set_string(KEY_GTK_THEME, gtkTheme);
                 } else {
-                    interfaceSettings.reset(KEY_GTK_THEME);
                     interfaceSettings.reset(KEY_ICON_THEME);
+                    interfaceSettings.reset(KEY_GTK_THEME);
                 }
             });
         return highContrast;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]