inputMethod: Keep Capabilite.FOCUS before context.focus_in/focus_out

If context.focus_out() is called *after* context.set_capabilities(0),
The FocusOut D-Bus method is ignored because of no FOCUS capability.
If context.focus_out() is called *before* context.set_capabilities(0),
The 0 capability is set to the next focused context and the
FocusIn D-Bus method is ignored because of no FOCUS capability.
So context.set_capabilities(0) should not be called.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6415
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2666>
This commit is contained in:
Takao Fujiwara 2023-03-01 23:42:18 +09:00 committed by Florian Müllner
parent 1cfaa2379d
commit 17d9ec5788

View File

@ -188,6 +188,7 @@ export const InputMethod = GObject.registerClass({
vfunc_focus_in(focus) { vfunc_focus_in(focus) {
this._currentFocus = focus; this._currentFocus = focus;
if (this._context) { if (this._context) {
this.update();
this._context.focus_in(); this._context.focus_in();
this._emitRequestSurrounding(); this._emitRequestSurrounding();
} }
@ -371,7 +372,6 @@ export const InputMethod = GObject.registerClass({
_fullReset() { _fullReset() {
this._context.set_content_type(0, 0); this._context.set_content_type(0, 0);
this._context.set_cursor_location(0, 0, 0, 0); this._context.set_cursor_location(0, 0, 0, 0);
this._context.set_capabilities(0);
this._context.reset(); this._context.reset();
} }