[gnome-shell/wip/carlosg/no-toggle-panel-across-focus] inputMethod: Handle OSK hiding after unfocus



commit ab03bb53b8c723234aac031a3732bcffd1b9b3ea
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Feb 8 23:00:18 2019 +0100

    inputMethod: Handle OSK hiding after unfocus
    
    Set a small timeout in order to let focus changes preserve OSK state. If
    focus is eventually unset, the OSK will be hidden.
    
    https://gitlab.gnome.org/GNOME/gtk/issues/1277

 js/misc/inputMethod.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index 4788a6d9e..668b0d8a8 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -1,5 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 const Clutter = imports.gi.Clutter;
+const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const IBus = imports.gi.IBus;
 const Keyboard = imports.ui.status.keyboard;
@@ -15,6 +16,7 @@ class InputMethod extends Clutter.InputMethod {
         this._preeditStr = '';
         this._preeditPos = 0;
         this._preeditVisible = false;
+        this._hidePanelId = 0;
         this._ibus = IBus.Bus.new_async();
         this._ibus.connect('connected', this._onConnected.bind(this));
         this._ibus.connect('disconnected', this._clear.bind(this));
@@ -138,6 +140,11 @@ class InputMethod extends Clutter.InputMethod {
             this._updateCapabilities();
             this._emitRequestSurrounding();
         }
+
+        if (this._hidePanelId) {
+            GLib.source_remove(this._hidePanelId);
+            this._hidePanelId = 0;
+        }
     }
 
     vfunc_focus_out() {
@@ -152,6 +159,12 @@ class InputMethod extends Clutter.InputMethod {
             this.set_preedit_text(null, 0);
             this._preeditStr = null;
         }
+
+        this._hidePanelId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 50, () => {
+            this.set_input_panel_state(Clutter.InputPanelState.OFF);
+            this._hidePanelId = 0;
+            return GLib.SOURCE_REMOVE;
+        });
     }
 
     vfunc_reset() {


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