There was some typo in my previous e-mail.
The API that I mentioned in the paragraph 1 is
'edje_object_message_signal_process' NOT 'edje_object_signal_emit'.
-----Original Message-----
From: Jihoon Kim [mailto:jihoon48....@samsung.com]
Sent: Thursday, March 17, 2011 2:21 PM
To: 'Tom Hacohen'
Cc: 'enlightenment-devel@lists.sourceforge.net'
Subject: RE: [E-devel] [PATCH] Patch to keep the cursor position regardless of
changing edj
1. The reason why I call edje_object_signal_emit is that _signal_cursor_changed
function was not called in the below situation.
elm_entry_cursor_pos_set(en, 5);
elm_entry_password_set(en, EINA_TRUE);
2. The APIs such as elm_entry_password_mode_set, elm_entry_single_line_set call
_elm_theme_object_set directly to change theme.
Therefore, '_theme_hook' callback function has not been called.
As you mentioned it, there are a lot of redundant codes in each API.
I have fixed this problem and then attach the patch again.
Would you please review this patch again?
-----Original Message-----
From: Tom Hacohen [mailto:tom.haco...@partner.samsung.com]
Sent: Thursday, March 17, 2011 1:29 AM
To: Jihoon Kim
Cc: enlightenment-devel@lists.sourceforge.net
Subject: Re: [E-devel] [PATCH] Patch to keep the cursor position regardless of
changing edj
Dear Jihoon,
Thanks a lot for the patch, I have one question and one comment:
Question: In line 89 of the patch, you added:
edje_object_message_signal_process(wd->ent);
Why is it needed there?
Comment:
I think all the
+ elm_entry_cursor_pos_set(obj, wd->cursor_pos);
+ if (elm_widget_focus_get(obj))
+ edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
are not needed everywhere, but only in theme_hook. Does it work if you remove
it from everywhere except for theme_hook? if not, there's probably something
wrong that should be fixed, because this is what theme_hook is for (updating
the widget when the theme changes, among others).
Thanks,
Tom.
On Wed, 2011-03-16 at 16:57 +0900, Jihoon Kim wrote:
> Hello.
>
> Whenever the theme (edj) is changed in entry, the cursor position in
> entry is reset because elm_entry does not save the cursor position in
> the entry.
>
> This patch is for keeping the cursor position in entry regardless of
> changing theme (edj).
> It will save the cursor position in entry and set the cursor position
> again after changing theme.
>
> Would you please review this patch?
>
> ----------------------------------------------------------------------
> --------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit for your
> organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Index: elm_entry.c
===================================================================
--- elm_entry.c (revision 57812)
+++ elm_entry.c (working copy)
@@ -136,6 +136,7 @@ struct _Widget_Data
Eina_Bool can_write : 1;
Eina_Bool autosave : 1;
Eina_Bool textonly : 1;
+ int cursor_pos;
};
struct _Elm_Entry_Context_Menu_Item
@@ -545,6 +546,9 @@ _theme_hook(Evas_Object *obj)
eina_stringshare_del(t);
if (elm_widget_disabled_get(obj))
edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
+ elm_entry_cursor_pos_set(obj, wd->cursor_pos);
+ if (elm_widget_focus_get(obj))
+ edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
edje_object_message_signal_process(wd->ent);
edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) *
_elm_config->scale);
_sizing_eval(obj);
@@ -1181,6 +1185,7 @@ _signal_cursor_changed(void *data, Evas_Object *ob
evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED, NULL);
edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
&cx, &cy, &cw, &ch);
+ wd->cursor_pos = edje_object_part_text_cursor_pos_get(wd->ent, "elm.text",
EDJE_CURSOR_MAIN);
if (!wd->deferred_recalc_job)
elm_widget_show_region_set(data, cx, cy, cw, ch);
else
@@ -1389,7 +1394,6 @@ _event_selection_clear(void *data __UNUSED__, int
return ECORE_CALLBACK_PASS_ON;
}
-
static Eina_Bool
_drag_drop_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Selection_Data
*drop)
{
@@ -1598,7 +1602,6 @@ elm_entry_add(Evas_Object *parent)
return obj;
}
-
/**
* This sets the entry object not to line wrap. All input will
* be on a single line, and the entry box will extend with user input.
@@ -1621,11 +1624,7 @@ elm_entry_single_line_set(Evas_Object *obj, Eina_B
wd->linewrap = EINA_FALSE;
wd->char_linewrap = EINA_FALSE;
elm_entry_cnp_textonly_set(obj, EINA_TRUE);
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj),
elm_widget_style_get(obj));
- elm_entry_entry_set(obj, t);
- eina_stringshare_del(t);
- _sizing_eval(obj);
+ _theme_hook(obj);
}
/**
@@ -1668,14 +1667,9 @@ elm_entry_password_set(Evas_Object *obj, Eina_Bool
wd->single_line = EINA_TRUE;
wd->linewrap = EINA_FALSE;
wd->char_linewrap = EINA_FALSE;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj),
elm_widget_style_get(obj));
- elm_entry_entry_set(obj, t);
- eina_stringshare_del(t);
- _sizing_eval(obj);
+ _theme_hook(obj);
}
-
/**
* This returns whether password mode is enabled.
* See also elm_entry_password_set().
@@ -1744,7 +1738,6 @@ elm_entry_entry_get(const Evas_Object *obj)
return wd->text;
}
-
/**
* This returns EINA_TRUE if the entry is empty/there was an error
* and EINA_FALSE if it is not empty.
@@ -1846,11 +1839,7 @@ elm_entry_line_wrap_set(Evas_Object *obj, Eina_Boo
wd->linewrap = wrap;
if(wd->linewrap)
wd->char_linewrap = EINA_FALSE;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj),
elm_widget_style_get(obj));
- elm_entry_entry_set(obj, t);
- eina_stringshare_del(t);
- _sizing_eval(obj);
+ _theme_hook(obj);
}
/**
@@ -1876,11 +1865,7 @@ elm_entry_line_char_wrap_set(Evas_Object *obj, Ein
wd->char_linewrap = wrap;
if(wd->char_linewrap)
wd->linewrap = EINA_FALSE;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj),
elm_widget_style_get(obj));
- elm_entry_entry_set(obj, t);
- eina_stringshare_del(t);
- _sizing_eval(obj);
+ _theme_hook(obj);
}
/**
@@ -1901,11 +1886,7 @@ elm_entry_editable_set(Evas_Object *obj, Eina_Bool
if (!wd) return;
if (wd->editable == editable) return;
wd->editable = editable;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj),
elm_widget_style_get(obj));
- elm_entry_entry_set(obj, t);
- eina_stringshare_del(t);
- _sizing_eval(obj);
+ _theme_hook(obj);
#ifdef HAVE_ELEMENTARY_X
if (editable)
@@ -2238,6 +2219,7 @@ elm_entry_cursor_pos_set(Evas_Object *obj, int pos
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
edje_object_part_text_cursor_pos_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN,
pos);
+ edje_object_message_signal_process(wd->ent);
}
/**
@@ -2879,7 +2861,6 @@ elm_entry_autosave_get(const Evas_Object *obj)
return wd->autosave;
}
-
/**
* Control pasting of text and images for the widget.
*
@@ -2927,4 +2908,3 @@ elm_entry_cnp_textonly_get(Evas_Object *obj)
if (!wd) return EINA_FALSE;
return wd->textonly;
}
-
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel