[gnome-shell/wip/carlosg/im-full-reset: 2/2] inputMethod: Manually reset input context state before unfocus




commit b1c9746fafaa7c34748b16ac05680f035fb5593a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 17 13:34:21 2022 +0200

    inputMethod: Manually reset input context state before unfocus
    
    The IBusInputContext currently seems to be a bit sloppy wrt propagating
    the current state to engines after those are changed, this results in
    engines possibly ending with purpose/hint/etc that do not actually
    correspond to the current state.
    
    Ensure this state is cleared on unfocus of our IBusInputContext, so
    that the next time the input method receives an input focus, the new
    state makes it all the way to the currently active engine.
    
    Fixes situations in the GDM/lock screen password entry that IBus
    would miss the PASSWORD hint set on the StEntry, and let passwords
    be fed to engines.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5966

 js/misc/inputMethod.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index ed680ec045..422c144618 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -185,8 +185,10 @@ var InputMethod = GObject.registerClass({
 
     vfunc_focus_out() {
         this._currentFocus = null;
-        if (this._context)
+        if (this._context) {
+            this._fullReset();
             this._context.focus_out();
+        }
 
         if (this._preeditStr && this._preeditVisible) {
             // Unset any preedit text
@@ -344,6 +346,13 @@ var InputMethod = GObject.registerClass({
             keyval, 0, IBus.ModifierType.RELEASE_MASK, -1, null, null);
     }
 
+    _fullReset() {
+        this._context.set_content_type(0, 0);
+        this._context.set_cursor_location(0, 0, 0, 0);
+        this._context.set_capabilities(0);
+        this._context.reset();
+    }
+
     update() {
         if (!this._context)
             return;


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