summaryrefslogtreecommitdiff
path: root/clutter
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-12-06 12:44:55 +0100
committerCarlos Garnacho <carlosg@gnome.org>2018-01-18 15:33:12 +0100
commit9eb962328806005bc231df6c6d166bbd62803293 (patch)
treefd7b27ec214cca5f169b74d8c865331dd16ea649 /clutter
parent8c988aa6329eb2a50ed54306144ca092aaddee89 (diff)
downloadmutter-9eb962328806005bc231df6c6d166bbd62803293.tar.gz
clutter: Add ClutterBackend IM setter/getter
The input method will be global to Clutter and shared between all the IM aware foci. These methods allow querying it and setting one up.
Diffstat (limited to 'clutter')
-rw-r--r--clutter/clutter/clutter-backend-private.h2
-rw-r--r--clutter/clutter/clutter-backend.c29
-rw-r--r--clutter/clutter/clutter-backend.h6
-rw-r--r--clutter/clutter/clutter-types.h2
4 files changed, 39 insertions, 0 deletions
diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h
index 9ce8e80bb..864d896a3 100644
--- a/clutter/clutter/clutter-backend-private.h
+++ b/clutter/clutter/clutter-backend-private.h
@@ -58,6 +58,8 @@ struct _ClutterBackend
gint32 units_serial;
GList *event_translators;
+
+ ClutterInputMethod *input_method;
};
struct _ClutterBackendClass
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
index fc820d93d..30ebe5ef1 100644
--- a/clutter/clutter/clutter-backend.c
+++ b/clutter/clutter/clutter-backend.c
@@ -127,6 +127,7 @@ clutter_backend_finalize (GObject *gobject)
g_free (backend->font_name);
clutter_backend_set_font_options (backend, NULL);
+ g_clear_object (&backend->input_method);
G_OBJECT_CLASS (clutter_backend_parent_class)->finalize (gobject);
}
@@ -1373,3 +1374,31 @@ clutter_backend_bell_notify (ClutterBackend *backend)
if (klass->bell_notify)
klass->bell_notify (backend);
}
+
+/**
+ * clutter_backend_get_input_method:
+ * @backend: the #CLutterBackend
+ *
+ * Returns the input method used by Clutter
+ *
+ * Returns: (transfer none): the input method
+ **/
+ClutterInputMethod *
+clutter_backend_get_input_method (ClutterBackend *backend)
+{
+ return backend->input_method;
+}
+
+/**
+ * clutter_backend_set_input_method:
+ * @backend: the #ClutterBackend
+ * @method: the input method
+ *
+ * Sets the input method to be used by Clutter
+ **/
+void
+clutter_backend_set_input_method (ClutterBackend *backend,
+ ClutterInputMethod *method)
+{
+ g_set_object (&backend->input_method, method);
+}
diff --git a/clutter/clutter/clutter-backend.h b/clutter/clutter/clutter-backend.h
index c2e03d5e2..78b04e349 100644
--- a/clutter/clutter/clutter-backend.h
+++ b/clutter/clutter/clutter-backend.h
@@ -77,6 +77,12 @@ CoglContext * clutter_backend_get_cogl_context (Clutter
CLUTTER_AVAILABLE_IN_ALL
void clutter_backend_bell_notify (ClutterBackend *backend);
+CLUTTER_AVAILABLE_IN_MUTTER
+ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend);
+
+CLUTTER_AVAILABLE_IN_MUTTER
+void clutter_backend_set_input_method (ClutterBackend *backend,
+ ClutterInputMethod *method);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_H__ */
diff --git a/clutter/clutter/clutter-types.h b/clutter/clutter/clutter-types.h
index bc71c7d00..4d5b018dc 100644
--- a/clutter/clutter/clutter-types.h
+++ b/clutter/clutter/clutter-types.h
@@ -97,6 +97,8 @@ typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
typedef struct _ClutterInputDevice ClutterInputDevice;
typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
+typedef struct _ClutterInputMethod ClutterInputMethod;
+
typedef CoglMatrix ClutterMatrix;
typedef union _ClutterEvent ClutterEvent;