[gnome-shell/gnome-42] ibusCandidatePopup: Set OSK candidates list visibility correctly



commit 7e37852f2e54b950ecd8a8f5bfe21a0992d3d27b
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, so the Suggestions actor hides its
    internal candidate buttons. Since the Suggestions actor gets its
    minimum height from CSS, this does not result in OSK size jumps.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5601
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2347>
    (cherry picked from commit 237ba24dbeae5f838b40f8c3d100a09413b96d22)

 js/ui/ibusCandidatePopup.js | 3 +++
 js/ui/keyboard.js           | 9 +++++++++
 2 files changed, 12 insertions(+)
---
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index 22bff9f9e0..fc7a0871c8 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -272,6 +272,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) {
@@ -291,10 +292,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..9e5dbffbb1 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -227,6 +227,11 @@ class Suggestions extends St.BoxLayout {
     clear() {
         this.remove_all_children();
     }
+
+    setVisible(visible) {
+        for (const child of this)
+            child.visible = visible;
+    }
 });
 
 var LanguageSelectionPopup = class extends PopupMenu.PopupMenu {
@@ -1937,6 +1942,10 @@ var Keyboard = GObject.registerClass({
             this._suggestions.clear();
     }
 
+    setSuggestionsVisible(visible) {
+        this._suggestions?.setVisible(visible);
+    }
+
     addSuggestion(text, callback) {
         if (!this._suggestions)
             return;


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