summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2023-03-24 11:35:38 +0100
committerJonas Ådahl <jadahl@gmail.com>2023-04-18 14:04:41 +0000
commit429cc9a674db51015ba15b9ca38d93607e09f386 (patch)
tree443c18b02bdcf8a8b27fd53be3e1bfc3f6276123
parentdb24557e40013f9af548e2f1e49481285a03fb3d (diff)
downloadmutter-429cc9a674db51015ba15b9ca38d93607e09f386.tar.gz
clutter/backend: Allow unsetting input method
This is needed by GNOME Shell to remove itself as a input method implementation during its shutdown sequence. We can't do it ourself later because at mutters own shutdowns equence, the GNOME Shell Javascript context has by that time already been teared down. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2934>
-rw-r--r--clutter/clutter/clutter-backend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
index 39863c7bb..e61e0b8c5 100644
--- a/clutter/clutter/clutter-backend.c
+++ b/clutter/clutter/clutter-backend.c
@@ -688,7 +688,7 @@ clutter_backend_get_input_method (ClutterBackend *backend)
/**
* clutter_backend_set_input_method:
* @backend: the #ClutterBackend
- * @method: the input method
+ * @method: (nullable): the input method
*
* Sets the input method to be used by Clutter
**/
@@ -696,6 +696,12 @@ void
clutter_backend_set_input_method (ClutterBackend *backend,
ClutterInputMethod *method)
{
+ if (backend->input_method == method)
+ return;
+
+ if (backend->input_method)
+ clutter_input_method_focus_out (backend->input_method);
+
g_set_object (&backend->input_method, method);
}