[gnome-shell/wip/carlosg/osk-cldr: 31/45] ibusCandidatePopup: Feed OSK suggestions from ibus panel candidates



commit 5c7c24c5e8f28ba30e8b2397c3b2f1781729b2b2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 6 14:44:16 2017 +0100

    ibusCandidatePopup: Feed OSK suggestions from ibus panel candidates
    
    We don't currently hide the ibus completion panel, and this is done from
    within the popup that we are meant to hide itself, so thoroughly sucks.

 js/ui/ibusCandidatePopup.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index 1571224e6..172c7653d 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -253,10 +253,18 @@ var CandidatePopup = new Lang.Class({
                                  for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
                                       indexes.push(indexLabel.get_text());
 
+                                 Main.keyboard.resetSuggestions();
+
                                  let candidates = [];
-                                 for (let i = startIndex; i < endIndex; ++i)
+                                 for (let i = startIndex; i < endIndex; ++i) {
                                      candidates.push(lookupTable.get_candidate(i).get_text());
 
+                                     Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), 
Lang.bind(this, function() {
+                                         let index = i;
+                                         this._panelService.candidate_clicked(index, 1, 0);
+                                     }));
+                                 }
+
                                  this._candidateArea.setCandidates(indexes,
                                                                    candidates,
                                                                    cursorPos % pageSize,
@@ -277,6 +285,7 @@ var CandidatePopup = new Lang.Class({
         panelService.connect('focus-out',
                              Lang.bind(this, function(ps) {
                                  this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
+                                 Main.keyboard.resetSuggestions();
                              }));
     },
 
@@ -287,6 +296,9 @@ var CandidatePopup = new Lang.Class({
     },
 
     _updateVisibility: function() {
+        if (Main.keyboard.visible)
+            return;
+
         let isVisible = (this._preeditText.visible ||
                          this._auxText.visible ||
                          this._candidateArea.actor.visible);
@@ -297,6 +309,7 @@ var CandidatePopup = new Lang.Class({
             this._boxPointer.actor.raise_top();
         } else {
             this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
+            Main.keyboard.resetSuggestions();
         }
     },
 


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