[mutter/wip/carlosg/text-input: 22/24] clutter: Add input-purpose/hint properties to ClutterText
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/text-input: 22/24] clutter: Add input-purpose/hint properties to ClutterText
- Date: Fri, 22 Dec 2017 16:36:01 +0000 (UTC)
commit 59e89f0d6352d8e1add2eb4575d7757d99b0204c
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Dec 21 11:34:11 2017 +0100
clutter: Add input-purpose/hint properties to ClutterText
So those properties can be changed or queried within shell UI.
clutter/clutter/clutter-text.c | 59 ++++++++++++++++++++++++++++++++++++++++
clutter/clutter/clutter-text.h | 11 +++++++
2 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
index 7df53ff..dd0c3d1 100644
--- a/clutter/clutter/clutter-text.c
+++ b/clutter/clutter/clutter-text.c
@@ -177,6 +177,9 @@ struct _ClutterTextPrivate
/* Signal handler for when the :text-direction changes */
guint direction_changed_id;
+ ClutterInputContentHintFlags input_hints;
+ ClutterInputContentPurpose input_purpose;
+
/* bitfields */
guint alignment : 2;
guint wrap : 1;
@@ -237,6 +240,8 @@ enum
PROP_SINGLE_LINE_MODE,
PROP_SELECTED_TEXT_COLOR,
PROP_SELECTED_TEXT_COLOR_SET,
+ PROP_INPUT_HINTS,
+ PROP_INPUT_PURPOSE,
PROP_LAST
};
@@ -3991,6 +3996,22 @@ clutter_text_class_init (ClutterTextClass *klass)
obj_props[PROP_SELECTED_TEXT_COLOR_SET] = pspec;
g_object_class_install_property (gobject_class, PROP_SELECTED_TEXT_COLOR_SET, pspec);
+ pspec = g_param_spec_flags ("input-hints",
+ P_("Input hints"),
+ P_("Input hints"),
+ CLUTTER_TYPE_INPUT_CONTENT_HINT_FLAGS,
+ 0, CLUTTER_PARAM_READWRITE);
+ obj_props[PROP_INPUT_HINTS] = pspec;
+ g_object_class_install_property (gobject_class, PROP_INPUT_HINTS, pspec);
+
+ pspec = g_param_spec_enum ("input-purpose",
+ P_("Input purpose"),
+ P_("Input purpose"),
+ CLUTTER_TYPE_INPUT_CONTENT_PURPOSE,
+ 0, CLUTTER_PARAM_READWRITE);
+ obj_props[PROP_INPUT_PURPOSE] = pspec;
+ g_object_class_install_property (gobject_class, PROP_INPUT_PURPOSE, pspec);
+
/**
* ClutterText::text-changed:
* @self: the #ClutterText that emitted the signal
@@ -6425,3 +6446,41 @@ clutter_text_get_cursor_rect (ClutterText *self,
*rect = self->priv->cursor_rect;
}
+
+void
+clutter_text_set_input_hints (ClutterText *self,
+ ClutterInputContentHintFlags hints)
+{
+ g_return_if_fail (CLUTTER_IS_TEXT (self));
+
+ self->priv->input_hints = hints;
+ clutter_input_focus_set_content_hints (CLUTTER_INPUT_FOCUS (self), hints);
+ g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_HINTS]);
+}
+
+ClutterInputContentHintFlags
+clutter_text_get_input_hints (ClutterText *self)
+{
+ g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
+
+ return self->priv->input_hints;
+}
+
+void
+clutter_text_set_input_purpose (ClutterText *self,
+ ClutterInputContentPurpose purpose)
+{
+ g_return_if_fail (CLUTTER_IS_TEXT (self));
+
+ self->priv->input_purpose = purpose;
+ clutter_input_focus_set_content_purpose (CLUTTER_INPUT_FOCUS (self), purpose);
+ g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_PURPOSE]);
+}
+
+ClutterInputContentPurpose
+clutter_text_get_input_purpose (ClutterText *self)
+{
+ g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
+
+ return self->priv->input_purpose;
+}
diff --git a/clutter/clutter/clutter-text.h b/clutter/clutter/clutter-text.h
index c046dd4..9660e65 100644
--- a/clutter/clutter/clutter-text.h
+++ b/clutter/clutter/clutter-text.h
@@ -302,6 +302,17 @@ void clutter_text_get_layout_offsets (ClutterText *
gint *x,
gint *y);
+CLUTTER_AVAILABLE_IN_MUTTER
+void clutter_text_set_input_hints (ClutterText *self,
+ ClutterInputContentHintFlags hints);
+CLUTTER_AVAILABLE_IN_MUTTER
+void clutter_text_set_input_purpose (ClutterText *self,
+ ClutterInputContentPurpose purpose);
+CLUTTER_AVAILABLE_IN_MUTTER
+ClutterInputContentHintFlags clutter_text_get_input_hints (ClutterText *self);
+CLUTTER_AVAILABLE_IN_MUTTER
+ClutterInputContentPurpose clutter_text_get_input_purpose (ClutterText *self);
+
G_END_DECLS
#endif /* __CLUTTER_TEXT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]