Blame SOURCES/caps-lock-warning.patch

28ed8f
From 7b514e637837e00372e20fa52f841e993966b734 Mon Sep 17 00:00:00 2001
28ed8f
From: Umang Jain <mailumangjain@gmail.com>
28ed8f
Date: Fri, 13 Dec 2019 13:36:14 +0530
28ed8f
Subject: [PATCH 1/7] shellEntry: Add CapsLockWarning class
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
28ed8f
---
28ed8f
 data/theme/gnome-shell-sass/_common.scss |  5 +++
28ed8f
 js/ui/shellEntry.js                      | 39 +++++++++++++++++++++++-
28ed8f
 2 files changed, 43 insertions(+), 1 deletion(-)
28ed8f
28ed8f
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
28ed8f
index b1eeb0ce97..19a736ab7d 100644
28ed8f
--- a/data/theme/gnome-shell-sass/_common.scss
28ed8f
+++ b/data/theme/gnome-shell-sass/_common.scss
28ed8f
@@ -391,6 +391,11 @@ StScrollBar {
28ed8f
     padding-bottom: 8px;
28ed8f
   }
28ed8f
 
28ed8f
+  .prompt-dialog-caps-lock-warning {
28ed8f
+    @extend .prompt-dialog-error-label;
28ed8f
+    padding-left: 6.2em;
28ed8f
+  }
28ed8f
+
28ed8f
   .prompt-dialog-info-label {
28ed8f
     font-size: 10pt;
28ed8f
     padding-bottom: 8px;
28ed8f
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
28ed8f
index 79f1aad3e7..c1738c4064 100644
28ed8f
--- a/js/ui/shellEntry.js
28ed8f
+++ b/js/ui/shellEntry.js
28ed8f
@@ -1,6 +1,6 @@
28ed8f
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
28ed8f
 
28ed8f
-const { Clutter, Shell, St } = imports.gi;
28ed8f
+const { Clutter, GObject, Pango, Shell, St } = imports.gi;
28ed8f
 
28ed8f
 const BoxPointer = imports.ui.boxpointer;
28ed8f
 const Main = imports.ui.main;
28ed8f
@@ -170,3 +170,40 @@ function addContextMenu(entry, params) {
28ed8f
         entry._menuManager = null;
28ed8f
     });
28ed8f
 }
28ed8f
+
28ed8f
+var CapsLockWarning = GObject.registerClass(
28ed8f
+class CapsLockWarning extends St.Label {
28ed8f
+    _init(params) {
28ed8f
+        let defaultParams = { style_class: 'prompt-dialog-error-label' };
28ed8f
+        super._init(Object.assign(defaultParams, params));
28ed8f
+
28ed8f
+        this.text = _('Caps lock is on.');
28ed8f
+
28ed8f
+        this._keymap = Clutter.get_default_backend().get_keymap();
28ed8f
+
28ed8f
+        this.connect('notify::mapped', () => {
28ed8f
+            if (this.is_mapped()) {
28ed8f
+                this.stateChangedId = this._keymap.connect('state-changed',
28ed8f
+                    this._updateCapsLockWarningOpacity.bind(this));
28ed8f
+            } else {
28ed8f
+                this._keymap.disconnect(this.stateChangedId);
28ed8f
+                this.stateChangedId = 0;
28ed8f
+            }
28ed8f
+
28ed8f
+            this._updateCapsLockWarningOpacity();
28ed8f
+        });
28ed8f
+
28ed8f
+        this.connect('destroy', () => {
28ed8f
+            if (this.stateChangedId > 0)
28ed8f
+                this._keymap.disconnect(this.stateChangedId);
28ed8f
+        });
28ed8f
+
28ed8f
+        this.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
28ed8f
+        this.clutter_text.line_wrap = true;
28ed8f
+    }
28ed8f
+
28ed8f
+    _updateCapsLockWarningOpacity() {
28ed8f
+        let capsLockOn = this._keymap.get_caps_lock_state();
28ed8f
+        this.opacity = capsLockOn ? 255 : 0;
28ed8f
+    }
28ed8f
+});
28ed8f
-- 
28ed8f
2.21.1
28ed8f
28ed8f
28ed8f
From aa4938f261454f85c782e59e40d4e5a9e1a01dbc Mon Sep 17 00:00:00 2001
28ed8f
From: Umang Jain <mailumangjain@gmail.com>
28ed8f
Date: Wed, 18 Dec 2019 01:33:45 +0530
28ed8f
Subject: [PATCH 2/7] js: Add caps-lock Warning to the dialogs
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
28ed8f
---
28ed8f
 js/gdm/authPrompt.js             | 4 ++++
28ed8f
 js/ui/components/keyring.js      | 6 ++++++
28ed8f
 js/ui/components/networkAgent.js | 8 ++++++++
28ed8f
 js/ui/components/polkitAgent.js  | 2 ++
28ed8f
 js/ui/shellMountOperation.js     | 3 +++
28ed8f
 5 files changed, 23 insertions(+)
28ed8f
28ed8f
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
28ed8f
index 71069e93b8..3ce9fd0d01 100644
28ed8f
--- a/js/gdm/authPrompt.js
28ed8f
+++ b/js/gdm/authPrompt.js
28ed8f
@@ -113,6 +113,9 @@ var AuthPrompt = class {
28ed8f
 
28ed8f
         this._entry.grab_key_focus();
28ed8f
 
28ed8f
+        this._capsLockWarningLabel = new ShellEntry.CapsLockWarning();
28ed8f
+        this.actor.add_child(this._capsLockWarningLabel);
28ed8f
+
28ed8f
         this._timedLoginIndicator = new St.Bin({ style_class: 'login-dialog-timed-login-indicator',
28ed8f
                                                  scale_x: 0 });
28ed8f
 
28ed8f
@@ -432,6 +435,7 @@ var AuthPrompt = class {
28ed8f
     setPasswordChar(passwordChar) {
28ed8f
         this._entry.clutter_text.set_password_char(passwordChar);
28ed8f
         this._entry.menu.isPassword = passwordChar != '';
28ed8f
+        this._capsLockWarningLabel.visible = passwordChar !== '';
28ed8f
     }
28ed8f
 
28ed8f
     setQuestion(question) {
28ed8f
diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js
28ed8f
index 0d9f1e4663..3512fb63b1 100644
28ed8f
--- a/js/ui/components/keyring.js
28ed8f
+++ b/js/ui/components/keyring.js
28ed8f
@@ -128,6 +128,12 @@ var KeyringDialog = class extends ModalDialog.ModalDialog {
28ed8f
         this.prompt.set_password_actor(this._passwordEntry ? this._passwordEntry.clutter_text : null);
28ed8f
         this.prompt.set_confirm_actor(this._confirmEntry ? this._confirmEntry.clutter_text : null);
28ed8f
 
28ed8f
+        if (this._passwordEntry || this._confirmEntry) {
28ed8f
+            this._capsLockWarningLabel = new ShellEntry.CapsLockWarning();
28ed8f
+            layout.attach(this._capsLockWarningLabel, 1, row, 1, 1);
28ed8f
+            row++;
28ed8f
+        }
28ed8f
+
28ed8f
         if (this.prompt.choice_visible) {
28ed8f
             let choice = new CheckBox.CheckBox();
28ed8f
             this.prompt.bind_property('choice-label', choice.getLabelActor(), 'text', GObject.BindingFlags.SYNC_CREATE);
28ed8f
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
28ed8f
index f871c732d9..32d40fb2b9 100644
28ed8f
--- a/js/ui/components/networkAgent.js
28ed8f
+++ b/js/ui/components/networkAgent.js
28ed8f
@@ -95,6 +95,14 @@ var NetworkSecretDialog = class extends ModalDialog.ModalDialog {
28ed8f
                 secret.entry.clutter_text.set_password_char('\u25cf');
28ed8f
         }
28ed8f
 
28ed8f
+        if (this._content.secrets.some(s => s.password)) {
28ed8f
+            this._capsLockWarningLabel = new ShellEntry.CapsLockWarning();
28ed8f
+            if (rtl)
28ed8f
+                layout.attach(this._capsLockWarningLabel, 0, pos, 1, 1);
28ed8f
+            else
28ed8f
+                layout.attach(this._capsLockWarningLabel, 1, pos, 1, 1);
28ed8f
+        }
28ed8f
+
28ed8f
         contentBox.messageBox.add(secretTable);
28ed8f
 
28ed8f
         if (flags & NM.SecretAgentGetSecretsFlags.WPS_PBC_ACTIVE) {
28ed8f
diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js
28ed8f
index 21feb40903..734a217335 100644
28ed8f
--- a/js/ui/components/polkitAgent.js
28ed8f
+++ b/js/ui/components/polkitAgent.js
28ed8f
@@ -108,6 +108,8 @@ var AuthenticationDialog = class extends ModalDialog.ModalDialog {
28ed8f
 
28ed8f
         this.setInitialKeyFocus(this._passwordEntry);
28ed8f
         this._passwordBox.hide();
28ed8f
+        this._capsLockWarningLabel = new ShellEntry.CapsLockWarning({ style_class: 'prompt-dialog-caps-lock-warning' });
28ed8f
+        content.messageBox.add(this._capsLockWarningLabel);
28ed8f
 
28ed8f
         this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' });
28ed8f
         this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
28ed8f
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
28ed8f
index f976f400f4..3a2377ddaf 100644
28ed8f
--- a/js/ui/shellMountOperation.js
28ed8f
+++ b/js/ui/shellMountOperation.js
28ed8f
@@ -305,6 +305,9 @@ var ShellMountPasswordDialog = class extends ModalDialog.ModalDialog {
28ed8f
         this._passwordBox.add(this._passwordEntry, {expand: true });
28ed8f
         this.setInitialKeyFocus(this._passwordEntry);
28ed8f
 
28ed8f
+        this._capsLockWarningLabel = new ShellEntry.CapsLockWarning();
28ed8f
+        content.messageBox.add(this._capsLockWarningLabel);
28ed8f
+
28ed8f
         this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label',
28ed8f
                                                  text: _("Sorry, that didn’t work. Please try again.") });
28ed8f
         this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
28ed8f
-- 
28ed8f
2.21.1
28ed8f
28ed8f
28ed8f
From 016cbd971711665844d40ec678d2779c160f791b Mon Sep 17 00:00:00 2001
28ed8f
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
28ed8f
Date: Thu, 23 Jan 2020 22:37:06 +0100
28ed8f
Subject: [PATCH 3/7] shellEntry: Make signal id variable private
28ed8f
28ed8f
Signal connection IDs should be private variables, so make this one
28ed8f
private.
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/952
28ed8f
---
28ed8f
 js/ui/shellEntry.js | 10 +++++-----
28ed8f
 1 file changed, 5 insertions(+), 5 deletions(-)
28ed8f
28ed8f
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
28ed8f
index c1738c4064..cd7c9a6c88 100644
28ed8f
--- a/js/ui/shellEntry.js
28ed8f
+++ b/js/ui/shellEntry.js
28ed8f
@@ -183,19 +183,19 @@ class CapsLockWarning extends St.Label {
28ed8f
 
28ed8f
         this.connect('notify::mapped', () => {
28ed8f
             if (this.is_mapped()) {
28ed8f
-                this.stateChangedId = this._keymap.connect('state-changed',
28ed8f
+                this._stateChangedId = this._keymap.connect('state-changed',
28ed8f
                     this._updateCapsLockWarningOpacity.bind(this));
28ed8f
             } else {
28ed8f
-                this._keymap.disconnect(this.stateChangedId);
28ed8f
-                this.stateChangedId = 0;
28ed8f
+                this._keymap.disconnect(this._stateChangedId);
28ed8f
+                this._stateChangedId = 0;
28ed8f
             }
28ed8f
 
28ed8f
             this._updateCapsLockWarningOpacity();
28ed8f
         });
28ed8f
 
28ed8f
         this.connect('destroy', () => {
28ed8f
-            if (this.stateChangedId > 0)
28ed8f
-                this._keymap.disconnect(this.stateChangedId);
28ed8f
+            if (this._stateChangedId > 0)
28ed8f
+                this._keymap.disconnect(this._stateChangedId);
28ed8f
         });
28ed8f
 
28ed8f
         this.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
28ed8f
-- 
28ed8f
2.21.1
28ed8f
28ed8f
28ed8f
From ba65f9066d72731e345a5aced61f35d39c1c1376 Mon Sep 17 00:00:00 2001
28ed8f
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
28ed8f
Date: Thu, 23 Jan 2020 23:26:45 +0100
28ed8f
Subject: [PATCH 4/7] theme: Move caps-lock warning to entry widget stylesheet
28ed8f
28ed8f
The caps-lock warning is more related to entries than dialogs and is
28ed8f
also used in gdm, which is not realated to dialogs at all. Rename the
28ed8f
css class to caps-lock-warning-label and move it to the entry
28ed8f
stylesheet.
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/952
28ed8f
---
28ed8f
 data/theme/gnome-shell-sass/_common.scss | 12 +++++++-----
28ed8f
 js/ui/shellEntry.js                      |  2 +-
28ed8f
 2 files changed, 8 insertions(+), 6 deletions(-)
28ed8f
28ed8f
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
28ed8f
index 19a736ab7d..4661533de2 100644
28ed8f
--- a/data/theme/gnome-shell-sass/_common.scss
28ed8f
+++ b/data/theme/gnome-shell-sass/_common.scss
28ed8f
@@ -94,6 +94,13 @@ StEntry {
28ed8f
   }
28ed8f
 }
28ed8f
 
28ed8f
+.caps-lock-warning-label {
28ed8f
+  padding-left: 6.2em;
28ed8f
+  @include fontsize($font-size - 1);
28ed8f
+  color: $warning_color;
28ed8f
+}
28ed8f
+
28ed8f
+
28ed8f
 
28ed8f
 /* Scrollbars */
28ed8f
 
28ed8f
@@ -391,11 +398,6 @@ StScrollBar {
28ed8f
     padding-bottom: 8px;
28ed8f
   }
28ed8f
 
28ed8f
-  .prompt-dialog-caps-lock-warning {
28ed8f
-    @extend .prompt-dialog-error-label;
28ed8f
-    padding-left: 6.2em;
28ed8f
-  }
28ed8f
-
28ed8f
   .prompt-dialog-info-label {
28ed8f
     font-size: 10pt;
28ed8f
     padding-bottom: 8px;
28ed8f
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
28ed8f
index cd7c9a6c88..46eba88d54 100644
28ed8f
--- a/js/ui/shellEntry.js
28ed8f
+++ b/js/ui/shellEntry.js
28ed8f
@@ -174,7 +174,7 @@ function addContextMenu(entry, params) {
28ed8f
 var CapsLockWarning = GObject.registerClass(
28ed8f
 class CapsLockWarning extends St.Label {
28ed8f
     _init(params) {
28ed8f
-        let defaultParams = { style_class: 'prompt-dialog-error-label' };
28ed8f
+        let defaultParams = { style_class: 'caps-lock-warning-label' };
28ed8f
         super._init(Object.assign(defaultParams, params));
28ed8f
 
28ed8f
         this.text = _('Caps lock is on.');
28ed8f
-- 
28ed8f
2.21.1
28ed8f
28ed8f
28ed8f
From afd764c82febe21aec70bdfc19d256f3401530e1 Mon Sep 17 00:00:00 2001
28ed8f
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
28ed8f
Date: Thu, 23 Jan 2020 22:36:09 +0100
28ed8f
Subject: [PATCH 5/7] shellEntry: Hide caps lock warning and use animation to
28ed8f
 show it
28ed8f
28ed8f
Since the caps-lock warning adds a lot of spacing to dialogs and the
28ed8f
lock screen, hide it by default and only show it when necessary. To make
28ed8f
the transition smooth instead of just showing the label, animate it in
28ed8f
using the height and opacity.
28ed8f
28ed8f
Also add some bottom padding to the label so we can show or hide that
28ed8f
padding, too.
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/952
28ed8f
---
28ed8f
 data/theme/gnome-shell-sass/_common.scss |  1 +
28ed8f
 js/ui/shellEntry.js                      | 33 ++++++++++++++++++------
28ed8f
 2 files changed, 26 insertions(+), 8 deletions(-)
28ed8f
28ed8f
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
28ed8f
index 4661533de2..9e0751c8c5 100644
28ed8f
--- a/data/theme/gnome-shell-sass/_common.scss
28ed8f
+++ b/data/theme/gnome-shell-sass/_common.scss
28ed8f
@@ -95,6 +95,7 @@ StEntry {
28ed8f
 }
28ed8f
 
28ed8f
 .caps-lock-warning-label {
28ed8f
+  padding-bottom: 8px;
28ed8f
   padding-left: 6.2em;
28ed8f
   @include fontsize($font-size - 1);
28ed8f
   color: $warning_color;
28ed8f
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
28ed8f
index 46eba88d54..fc8ee37a9a 100644
28ed8f
--- a/js/ui/shellEntry.js
28ed8f
+++ b/js/ui/shellEntry.js
28ed8f
@@ -6,6 +6,7 @@ const BoxPointer = imports.ui.boxpointer;
28ed8f
 const Main = imports.ui.main;
28ed8f
 const Params = imports.misc.params;
28ed8f
 const PopupMenu = imports.ui.popupMenu;
28ed8f
+const Tweener = imports.ui.tweener;
28ed8f
 
28ed8f
 var EntryMenu = class extends PopupMenu.PopupMenu {
28ed8f
     constructor(entry) {
28ed8f
@@ -179,31 +180,47 @@ class CapsLockWarning extends St.Label {
28ed8f
 
28ed8f
         this.text = _('Caps lock is on.');
28ed8f
 
28ed8f
+        this.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
28ed8f
+        this.clutter_text.line_wrap = true;
28ed8f
+
28ed8f
         this._keymap = Clutter.get_default_backend().get_keymap();
28ed8f
 
28ed8f
         this.connect('notify::mapped', () => {
28ed8f
             if (this.is_mapped()) {
28ed8f
                 this._stateChangedId = this._keymap.connect('state-changed',
28ed8f
-                    this._updateCapsLockWarningOpacity.bind(this));
28ed8f
+                    () => this._sync(true));
28ed8f
             } else {
28ed8f
                 this._keymap.disconnect(this._stateChangedId);
28ed8f
                 this._stateChangedId = 0;
28ed8f
             }
28ed8f
 
28ed8f
-            this._updateCapsLockWarningOpacity();
28ed8f
+            this._sync(false);
28ed8f
         });
28ed8f
 
28ed8f
         this.connect('destroy', () => {
28ed8f
-            if (this._stateChangedId > 0)
28ed8f
+            if (this._stateChangedId)
28ed8f
                 this._keymap.disconnect(this._stateChangedId);
28ed8f
         });
28ed8f
-
28ed8f
-        this.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
28ed8f
-        this.clutter_text.line_wrap = true;
28ed8f
     }
28ed8f
 
28ed8f
-    _updateCapsLockWarningOpacity() {
28ed8f
+    _sync(animate) {
28ed8f
         let capsLockOn = this._keymap.get_caps_lock_state();
28ed8f
-        this.opacity = capsLockOn ? 255 : 0;
28ed8f
+
28ed8f
+        Tweener.removeTweens(this);
28ed8f
+
28ed8f
+        this.natural_height_set = false;
28ed8f
+        let [, height] = this.get_preferred_height(-1);
28ed8f
+        this.natural_height_set = true;
28ed8f
+
28ed8f
+        Tweener.addTween(this, {
28ed8f
+            height: capsLockOn ? height : 0,
28ed8f
+            opacity: capsLockOn ? 255 : 0,
28ed8f
+            time: animate ? 0.2 : 0,
28ed8f
+            transition: 'easeOutQuad',
28ed8f
+            onComplete: () => {
28ed8f
+                if (capsLockOn)
28ed8f
+                    this.height = -1;
28ed8f
+            },
28ed8f
+        });
28ed8f
     }
28ed8f
 });
28ed8f
-- 
28ed8f
2.21.1
28ed8f
28ed8f
28ed8f
From 1ef3dafb51da380c54635d0565dc098e40bbb3e1 Mon Sep 17 00:00:00 2001
28ed8f
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
28ed8f
Date: Wed, 29 Jan 2020 17:48:57 +0100
28ed8f
Subject: [PATCH 6/7] js: Initialize some properties
28ed8f
28ed8f
Otherwise those can result in the (harmless) "reference to undefined
28ed8f
property" warnings.
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/970
28ed8f
---
28ed8f
 js/ui/overview.js   | 1 +
28ed8f
 js/ui/shellEntry.js | 1 +
28ed8f
 2 files changed, 2 insertions(+)
28ed8f
28ed8f
diff --git a/js/ui/overview.js b/js/ui/overview.js
28ed8f
index dc6ad1821b..5bad4cbd62 100644
28ed8f
--- a/js/ui/overview.js
28ed8f
+++ b/js/ui/overview.js
28ed8f
@@ -80,6 +80,7 @@ var Overview = class {
28ed8f
     constructor() {
28ed8f
         this._overviewCreated = false;
28ed8f
         this._initCalled = false;
28ed8f
+        this._visible = false;
28ed8f
 
28ed8f
         Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
28ed8f
         this._sessionUpdated();
28ed8f
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
28ed8f
index fc8ee37a9a..55267e7c87 100644
28ed8f
--- a/js/ui/shellEntry.js
28ed8f
+++ b/js/ui/shellEntry.js
28ed8f
@@ -184,6 +184,7 @@ class CapsLockWarning extends St.Label {
28ed8f
         this.clutter_text.line_wrap = true;
28ed8f
 
28ed8f
         this._keymap = Clutter.get_default_backend().get_keymap();
28ed8f
+        this._stateChangedId = 0;
28ed8f
 
28ed8f
         this.connect('notify::mapped', () => {
28ed8f
             if (this.is_mapped()) {
28ed8f
-- 
28ed8f
2.21.1
28ed8f
28ed8f
28ed8f
From 273f7adb43cfee907342d017e1454ea90d42d262 Mon Sep 17 00:00:00 2001
28ed8f
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
28ed8f
Date: Fri, 21 Feb 2020 19:38:53 +0100
28ed8f
Subject: [PATCH 7/7] shellEntry: Restore natural-height-set instead of forcing
28ed8f
 it
28ed8f
28ed8f
If we are transitioning the label from 0 to its natural height, we
28ed8f
must set natural-height-set again after querying the preferred height,
28ed8f
otherwise Clutter would skip the transition.
28ed8f
28ed8f
However when transitioning in the opposite direction, setting the
28ed8f
property to true can go horribly wrong:
28ed8f
If the actor hasn't been allocated before, it will store a fixed
28ed8f
natural height of 0. But as there is no fixed min-height, we can
28ed8f
end up with min-height > natural-height, which is a fatal error.
28ed8f
28ed8f
(This isn't an issue when *actually* setting a fixed height, as
28ed8f
that will set both natural and minimum height)
28ed8f
28ed8f
So instead of always setting natural-height-set to true, restore
28ed8f
its previous value to fix the issue.
28ed8f
28ed8f
https://gitlab.gnome.org/GNOME/gnome-shell/issues/2255
28ed8f
---
28ed8f
 js/ui/shellEntry.js | 3 ++-
28ed8f
 1 file changed, 2 insertions(+), 1 deletion(-)
28ed8f
28ed8f
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
28ed8f
index 55267e7c87..4a30b22f7a 100644
28ed8f
--- a/js/ui/shellEntry.js
28ed8f
+++ b/js/ui/shellEntry.js
28ed8f
@@ -209,9 +209,10 @@ class CapsLockWarning extends St.Label {
28ed8f
 
28ed8f
         Tweener.removeTweens(this);
28ed8f
 
28ed8f
+        const naturalHeightSet = this.natural_height_set;
28ed8f
         this.natural_height_set = false;
28ed8f
         let [, height] = this.get_preferred_height(-1);
28ed8f
-        this.natural_height_set = true;
28ed8f
+        this.natural_height_set = naturalHeightSet;
28ed8f
 
28ed8f
         Tweener.addTween(this, {
28ed8f
             height: capsLockOn ? height : 0,
28ed8f
-- 
28ed8f
2.21.1
28ed8f