From d86b62d1b789705658c3c9b17ce20f0c25988a88 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 14 Dec 2017 17:19:01 +0100 Subject: [PATCH] st: Make StEntry rely entirely on ClutterInputMethod/Focus StIMText is no longer needed here. --- src/st/st-entry.c | 54 +++++++++++++++++++++++------------------------ src/st/st-entry.h | 13 ++++++------ 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/st/st-entry.c b/src/st/st-entry.c index 18e6a257d..74bdcdb65 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -54,7 +54,6 @@ #include "st-entry.h" -#include "st-im-text.h" #include "st-icon.h" #include "st-label.h" #include "st-widget.h" @@ -199,11 +198,11 @@ st_entry_get_property (GObject *gobject, break; case PROP_INPUT_PURPOSE: - g_value_set_enum (value, st_im_text_get_input_purpose (ST_IM_TEXT (priv->entry))); + g_value_set_enum (value, clutter_text_get_input_purpose (CLUTTER_TEXT (priv->entry))); break; case PROP_INPUT_HINTS: - g_value_set_flags (value, st_im_text_get_input_hints (ST_IM_TEXT (priv->entry))); + g_value_set_flags (value, clutter_text_get_input_hints (CLUTTER_TEXT (priv->entry))); break; default: @@ -980,8 +979,8 @@ st_entry_class_init (StEntryClass *klass) pspec = g_param_spec_enum ("input-purpose", "Purpose", "Purpose of the text field", - GTK_TYPE_INPUT_PURPOSE, - GTK_INPUT_PURPOSE_FREE_FORM, + CLUTTER_TYPE_INPUT_CONTENT_PURPOSE, + CLUTTER_INPUT_CONTENT_PURPOSE_NORMAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (gobject_class, PROP_INPUT_PURPOSE, @@ -990,9 +989,8 @@ st_entry_class_init (StEntryClass *klass) pspec = g_param_spec_flags ("input-hints", "hints", "Hints for the text field behaviour", - GTK_TYPE_INPUT_HINTS, - GTK_INPUT_HINT_NONE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + CLUTTER_TYPE_INPUT_CONTENT_HINT_FLAGS, + 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (gobject_class, PROP_INPUT_HINTS, pspec); @@ -1034,7 +1032,7 @@ st_entry_init (StEntry *entry) priv = st_entry_get_instance_private (entry); - priv->entry = g_object_new (ST_TYPE_IM_TEXT, + priv->entry = g_object_new (CLUTTER_TYPE_TEXT, "line-alignment", PANGO_ALIGN_LEFT, "editable", TRUE, "reactive", TRUE, @@ -1208,20 +1206,20 @@ st_entry_get_hint_text (StEntry *entry) * methods to adjust their behaviour. */ void -st_entry_set_input_purpose (StEntry *entry, - GtkInputPurpose purpose) +st_entry_set_input_purpose (StEntry *entry, + ClutterInputContentPurpose purpose) { StEntryPrivate *priv; - StIMText *imtext; + ClutterText *editable; g_return_if_fail (ST_IS_ENTRY (entry)); priv = st_entry_get_instance_private (entry); - imtext = ST_IM_TEXT (priv->entry); + editable = CLUTTER_TEXT (priv->entry); - if (st_im_text_get_input_purpose (imtext) != purpose) + if (clutter_text_get_input_purpose (editable) != purpose) { - st_im_text_set_input_purpose (imtext, purpose); + clutter_text_set_input_purpose (editable, purpose); g_object_notify (G_OBJECT (entry), "input-purpose"); } @@ -1233,15 +1231,15 @@ st_entry_set_input_purpose (StEntry *entry, * * Gets the value of the #StEntry:input-purpose property. */ -GtkInputPurpose +ClutterInputContentPurpose st_entry_get_input_purpose (StEntry *entry) { StEntryPrivate *priv; - g_return_val_if_fail (ST_IS_ENTRY (entry), GTK_INPUT_PURPOSE_FREE_FORM); + g_return_val_if_fail (ST_IS_ENTRY (entry), CLUTTER_INPUT_CONTENT_PURPOSE_NORMAL); priv = st_entry_get_instance_private (entry); - return st_im_text_get_input_purpose (ST_IM_TEXT (priv->entry)); + return clutter_text_get_input_purpose (CLUTTER_TEXT (priv->entry)); } /** @@ -1253,20 +1251,20 @@ st_entry_get_input_purpose (StEntry *entry) * allows input methods to fine-tune their behaviour. */ void -st_entry_set_input_hints (StEntry *entry, - GtkInputHints hints) +st_entry_set_input_hints (StEntry *entry, + ClutterInputContentHintFlags hints) { StEntryPrivate *priv; - StIMText *imtext; + ClutterText *editable; g_return_if_fail (ST_IS_ENTRY (entry)); priv = st_entry_get_instance_private (entry); - imtext = ST_IM_TEXT (priv->entry); + editable = CLUTTER_TEXT (priv->entry); - if (st_im_text_get_input_hints (imtext) != hints) + if (clutter_text_get_input_hints (editable) != hints) { - st_im_text_set_input_hints (imtext, hints); + clutter_text_set_input_hints (editable, hints); g_object_notify (G_OBJECT (entry), "input-hints"); } @@ -1278,15 +1276,15 @@ st_entry_set_input_hints (StEntry *entry, * * Gets the value of the #StEntry:input-hints property. */ -GtkInputHints +ClutterInputContentHintFlags st_entry_get_input_hints (StEntry *entry) { StEntryPrivate *priv; - g_return_val_if_fail (ST_IS_ENTRY (entry), GTK_INPUT_HINT_NONE); + g_return_val_if_fail (ST_IS_ENTRY (entry), 0); priv = st_entry_get_instance_private (entry); - return st_im_text_get_input_hints (ST_IM_TEXT (priv->entry)); + return clutter_text_get_input_hints (CLUTTER_TEXT (priv->entry)); } static gboolean @@ -1494,7 +1492,7 @@ st_entry_accessible_initialize (AtkObject *obj, { ATK_OBJECT_CLASS (st_entry_accessible_parent_class)->initialize (obj, data); - /* StEntry is behaving as a StImText container */ + /* StEntry is behaving as a ClutterText container */ atk_object_set_role (obj, ATK_ROLE_PANEL); } diff --git a/src/st/st-entry.h b/src/st/st-entry.h index 43ae0fa4c..2a05759d5 100644 --- a/src/st/st-entry.h +++ b/src/st/st-entry.h @@ -50,12 +50,13 @@ void st_entry_set_hint_text (StEntry *entry, const gchar *text); const gchar *st_entry_get_hint_text (StEntry *entry); -void st_entry_set_input_purpose (StEntry *entry, - GtkInputPurpose purpose); -GtkInputPurpose st_entry_get_input_purpose (StEntry *entry); -void st_entry_set_input_hints (StEntry *entry, - GtkInputHints hints); -GtkInputHints st_entry_get_input_hints (StEntry *entry); +void st_entry_set_input_purpose (StEntry *entry, + ClutterInputContentPurpose purpose); +void st_entry_set_input_hints (StEntry *entry, + ClutterInputContentHintFlags hints); + +ClutterInputContentPurpose st_entry_get_input_purpose (StEntry *entry); +ClutterInputContentHintFlags st_entry_get_input_hints (StEntry *entry); void st_entry_set_primary_icon (StEntry *entry, ClutterActor *icon);