From 5e36a06835587ea823bdd7241a9062dc12a288ce Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 9 Aug 2023 11:47:28 +0200 Subject: [PATCH] inputMethod: Check that there is an existing cursor location Commit 17d9ec5788fb made the input method call update() more eagerly, but also at times that it does not have a cursor position yet. Make it bail out correctly in that situation. Fixes: 17d9ec5788fb ("inputMethod: Keep Capabilite.FOCUS before context.focus_in/focus_out") Part-of: --- js/misc/inputMethod.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js index d944c2978..9f1659758 100644 --- a/js/misc/inputMethod.js +++ b/js/misc/inputMethod.js @@ -380,9 +380,11 @@ export const InputMethod = GObject.registerClass({ return; this._updateCapabilities(); this._context.set_content_type(this._purpose, this._hints); - this._context.set_cursor_location( - this._cursorRect.x, this._cursorRect.y, - this._cursorRect.width, this._cursorRect.height); + if (this._cursorRect) { + this._context.set_cursor_location( + this._cursorRect.x, this._cursorRect.y, + this._cursorRect.width, this._cursorRect.height); + } this._emitRequestSurrounding(); } });