[gnome-shell/wip/carlosg/osk-candidates-visibility] ibusCandidatePopup: Set OSK candidates list visibility correctly




commit de5d96045a953350b128d3b9851b4c3b8d0a12a8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 29 13:06:07 2022 +0200

    ibusCandidatePopup: Set OSK candidates list visibility correctly
    
    Right now, we don't pay much attention to visibility hints from IBus
    about the candidates list for the OSK suggestions bar. Since some
    IMs rely on this visibility being honored, do that.
    
    To fix this, the visibility hints for the lookup table are now
    propagated to the keyboard, and the Suggestions actor has been
    embedded in an intermediate container so that showing/hiding the
    candidates list does not result in OSK size jumps.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5601

 js/ui/ibusCandidatePopup.js |  3 +++
 js/ui/keyboard.js           | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index c57e289cbb..340f9a8e1a 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -270,6 +270,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
                 indexes.push(indexLabel.get_text());
 
             Main.keyboard.resetSuggestions();
+            Main.keyboard.setSuggestionsVisible(visible);
 
             let candidates = [];
             for (let i = startIndex; i < endIndex; ++i) {
@@ -289,10 +290,12 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
             this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
         });
         panelService.connect('show-lookup-table', () => {
+            Main.keyboard.setSuggestionsVisible(true);
             this._candidateArea.show();
             this._updateVisibility();
         });
         panelService.connect('hide-lookup-table', () => {
+            Main.keyboard.setSuggestionsVisible(false);
             this._candidateArea.hide();
             this._updateVisibility();
         });
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 499bc28a90..a9bae6d467 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1384,7 +1384,10 @@ var Keyboard = GObject.registerClass({
         this._currentPage = null;
 
         this._suggestions = new Suggestions();
-        this.add_child(this._suggestions);
+
+        let container = new Clutter.Actor();
+        container.add_child(this._suggestions);
+        this.add_child(container);
 
         this._aspectContainer = new AspectContainer({
             layout_manager: new Clutter.BinLayout(),
@@ -1937,6 +1940,13 @@ var Keyboard = GObject.registerClass({
             this._suggestions.clear();
     }
 
+    setSuggestionsVisible(visible) {
+        if (visible)
+            this._suggestions?.show();
+        else
+            this._suggestions?.hide();
+    }
+
     addSuggestion(text, callback) {
         if (!this._suggestions)
             return;


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