Dear Tom,
After talking with you, I send the patch not to contain the change of
whitespace.
I will be careful about your advice.
Here is pure patch file. :)
-----Original Message-----
From: Jihoon Kim [mailto:jihoon48....@samsung.com]
Sent: Thursday, March 17, 2011 2:39 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
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 57815)
+++ 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
@@ -1621,11 +1626,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,11 +1669,7 @@ 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);
}
@@ -1846,11 +1843,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 +1869,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 +1890,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 +2223,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);
}
/**
------------------------------------------------------------------------------
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