Hi, Vencent.
(I forgeted adding e-devel ML address to Cc. So send again.)
> split your patch in 3 patches (the 3 things above). Or at least 2 patches
> (one for the warnings, the other for the fixes).
I split my patch to 2 paches. one for warnings, the other for fixes.
Thanks.
2011/7/23 Vincent Torri <vto...@univ-evry.fr>:
>
> hey
>
> On Sat, 23 Jul 2011, Naruto TAKAHASHI wrote:
>
>> Hi JihoonKim, and EFL developers.
>>
>> I attach a patch for fixing some XIM module bugs.
>>
>> - fix showing previous preedit string bug.
>> - delete compile warning(thanks JihoonKim)
>> - fix some sequence issue to send preedit changed event and commit
>> event.(thanks JihoonKim)
>>
>> Please review this patch?
>
> split your patch in 3 patches (the 3 things above). Or at least 2 patches
> (one for the warnings, the other for the fixes).
>
> Vincent
>
>> Regards.
>>
>> 2011年7月22日23:52 Naruto TAKAHASHI <tnar...@gmail.com>:
>>>
>>> Hi, JihoonKim.
>>>
>>> I talked to you how fix "preedit draw callback " direction on IRC.
>>> I repeat to talk this stuff for didn't see this talk.
>>>
>>> Your patch behavior is no problem.
>>> But Preedit Draw Callback needs insert, delete, and replace by
>>> referencing Preedit Draw Callback argument.
>>> (detail:
>>> http://static.cray-cyber.org/Documentation/NEC_SX_R10_1/G1AE02E/CHAP13.HTML#13.18.6.
>>> Preedit Draw Callback)
>>>
>>> I'm trying to fix too easy routine by using Eina_UStrBuf, now.
>>>
>>> So, please wait this.
>>> Off course, I merge deleting comple warning of your patch with thanks. :)
>>>
>>> Thanks.
>>>
>>> 2011/7/17 Jihoon Kim <imfin...@gmail.com>:
>>>>
>>>> Hi, Naruto.
>>>> As I told you last Friday on IRC, I guess there are some bugs in your
>>>> xim
>>>> immodule.
>>>> For example, in case that I'd like to input '私の' (watasino), the preedit
>>>> string was got from your immodule like below
>>>> '私のしの'.
>>>> In addition, there are some sequence issue to send preedit changed event
>>>> and
>>>> commit event.
>>>> I've tried to fix this problem and send you the patch.
>>>> (I've tested on elementary_test > entry)
>>>> If you don't mind uploading this patch to svn, I'll request Maintainers
>>>> to
>>>> upload this patch.
>>>> Thanks.
>>>> On Sun, Jul 10, 2011 at 2:51 AM, Naruto TAKAHASHI <tnar...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Hi Mike.
>>>>>
>>>>> Thanks, feedback. I merged it to xim/Makefile.am.
>>>>>
>>>>> I attach a source code for using XIM module debug.
>>>>> This program can check a below behaviors.
>>>>>
>>>>> - toggle enable and disable XIM
>>>>> - commit string from XIM
>>>>>
>>>>> Another test, by using Desktop Entry Editor's text field.
>>>>> (Enlightenment Main->Settings->Settings Panel->New Application)
>>>>>
>>>>> When executing test program, set ECORE_IMF_MODULE=xim.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> 2011/7/8 Mike McCormack <mj.mccorm...@samsung.com>:
>>>>>>
>>>>>> On 07/08/2011 03:15 PM, Naruto TAKAHASHI wrote:
>>>>>>>
>>>>>>> Hi, All.
>>>>>>>
>>>>>>> I attached some patches of XIM module of ecore_imf.
>>>>>>>
>>>>>>> As far as I know, EFL has not having official ecore_imf module in E
>>>>>>> repository. And ecore_x has XIM code but is unavailable condition.
>>>>>>> So I moved XIM code of ecore_x as ecore_imf module.
>>>>>>>
>>>>>>> please review this patches.
>>>>>>
>>>>>> Hello Naruto,
>>>>>>
>>>>>> Looks like nice work.
>>>>>>
>>>>>> I applied your patches to my ecore and built, but there was a build
>>>>>> error (fix below):
>>>>>>
>>>>>> make[5]: Entering directory
>>>>>> `/home/mike/git/e/ecore/src/modules/immodules/xim'
>>>>>> CC xim_la-ecore_imf_xim.lo
>>>>>> ecore_imf_xim.c:5:18: error: Evas.h: No such file or directory
>>>>>> ecore_imf_xim.c: In function ‘_ecore_x_event_reverse_locks’:
>>>>>> ecore_imf_xim.c:359: warning: suggest braces around empty body in an
>>>>>> ‘if’ statement
>>>>>> ecore_imf_xim.c: In function ‘preedit_start_callback’:
>>>>>> ecore_imf_xim.c:662: warning: unused parameter ‘xic’
>>>>>> ecore_imf_xim.c:664: warning: unused parameter ‘call_data’
>>>>>>
>>>>>> How can I test it?
>>>>>>
>>>>>> thanks,
>>>>>>
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>>
>>>>>> diff --git a/ecore/src/modules/immodules/xim/Makefile.am
>>>>>> b/ecore/src/modules/immodules/xim/Makefile.am
>>>>>> index 006035c..cc0682d 100644
>>>>>> --- a/ecore/src/modules/immodules/xim/Makefile.am
>>>>>> +++ b/ecore/src/modules/immodules/xim/Makefile.am
>>>>>> @@ -12,6 +12,7 @@ AM_CPPFLAGS = \
>>>>>> -I$(top_builddir)/src/lib/ecore_imf \
>>>>>> -DPACKAGE_LIB_DIR=\"$(libdir)\" \
>>>>>> -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
>>>>>> +@EVAS_CFLAGS@ \
>>>>>> @EINA_CFLAGS@
>>>>>>
>>>>>> pkgdir = $(libdir)/ecore/immodules
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> All of the data generated in your IT infrastructure is seriously
>>>>>> valuable.
>>>>>> Why? It contains a definitive record of application performance,
>>>>>> security
>>>>>> threats, fraudulent activity, and more. Splunk takes this data and
>>>>>> makes
>>>>>> sense of it. IT sense. And common sense.
>>>>>> http://p.sf.net/sfu/splunk-d2d-c2
>>>>>> _______________________________________________
>>>>>> enlightenment-devel mailing list
>>>>>> enlightenment-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Naruto TAKAHASHI
>>>>> tnar...@gmail.com
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> All of the data generated in your IT infrastructure is seriously
>>>>> valuable.
>>>>> Why? It contains a definitive record of application performance,
>>>>> security
>>>>> threats, fraudulent activity, and more. Splunk takes this data and
>>>>> makes
>>>>> sense of it. IT sense. And common sense.
>>>>> http://p.sf.net/sfu/splunk-d2d-c2
>>>>> _______________________________________________
>>>>> enlightenment-devel mailing list
>>>>> enlightenment-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Naruto TAKAHASHI
>>> tnar...@gmail.com
>>>
>>
>>
>>
>> --
>> Naruto TAKAHASHI
>> tnar...@gmail.com
>
--
Naruto TAKAHASHI
tnar...@gmail.com
diff --git a/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/ecore/src/modules/immodules/xim/ecore_imf_xim.c
index 2445fb7..d35eb70 100644
--- a/ecore/src/modules/immodules/xim/ecore_imf_xim.c
+++ b/ecore/src/modules/immodules/xim/ecore_imf_xim.c
@@ -358,8 +358,10 @@ _ecore_x_event_reverse_locks(unsigned int state)
if(state & ECORE_IMF_KEYBOARD_LOCK_CAPS)
locks |= LockMask;
+#if 0 /* FIXME: add mask. */
if(state & ECORE_IMF_KEYBOARD_LOCK_SCROLL)
- ; /* XXX */
+ ;
+#endif
return locks;
}
@@ -666,14 +668,15 @@ imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data)
if(imf_context_data->ic)
XDestroyIC(imf_context_data->ic);
+ free(imf_context_data->preedit_chars);
free(imf_context_data->locale);
free(imf_context_data);
}
static int
-preedit_start_callback(XIC xic,
+preedit_start_callback(XIC xic __UNUSED__,
XPointer client_data,
- XPointer call_data)
+ XPointer call_data __UNUSED__)
{
EINA_LOG_DBG("in");
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
@@ -687,9 +690,9 @@ preedit_start_callback(XIC xic,
}
static void
-preedit_done_callback(XIC xic,
+preedit_done_callback(XIC xic __UNUSED__,
XPointer client_data,
- XPointer call_data)
+ XPointer call_data __UNUSED__)
{
EINA_LOG_DBG("in");
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
@@ -708,7 +711,7 @@ preedit_done_callback(XIC xic,
/* FIXME */
static int
-xim_text_to_utf8(Ecore_IMF_Context *ctx,
+xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
XIMText *xim_text,
char **text)
{
@@ -750,7 +753,7 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx,
}
static void
-preedit_draw_callback(XIC xic,
+preedit_draw_callback(XIC xic __UNUSED__,
XPointer client_data,
XIMPreeditDrawCallbackStruct *call_data)
{
@@ -829,7 +832,7 @@ preedit_draw_callback(XIC xic,
}
static void
-preedit_caret_callback(XIC xic,
+preedit_caret_callback(XIC xic __UNUSED__,
XPointer client_data,
XIMPreeditCaretCallbackStruct *call_data)
{
@@ -1053,8 +1056,8 @@ xim_info_try_im(XIM_Im_Info *info)
}
static void
-xim_info_display_closed(Ecore_X_Display *display,
- int is_error,
+xim_info_display_closed(Ecore_X_Display *display __UNUSED__,
+ int is_error __UNUSED__,
XIM_Im_Info *info)
{
Eina_List *ics, *tmp_list;
@@ -1085,7 +1088,7 @@ xim_info_display_closed(Ecore_X_Display *display,
static void
xim_instantiate_callback(Display *display,
XPointer client_data,
- XPointer call_data)
+ XPointer call_data __UNUSED__)
{
XIM_Im_Info *info = (XIM_Im_Info *)client_data;
XIM im = NULL;
@@ -1146,9 +1149,9 @@ setup_im(XIM_Im_Info *info)
}
static void
-xim_destroy_callback(XIM xim,
+xim_destroy_callback(XIM xim __UNUSED__,
XPointer client_data,
- XPointer call_data)
+ XPointer call_data __UNUSED__)
{
XIM_Im_Info *info = (XIM_Im_Info *)client_data;
info->im = NULL;
diff --git a/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/ecore/src/modules/immodules/xim/ecore_imf_xim.c
index d35eb70..9d3de2f 100644
--- a/ecore/src/modules/immodules/xim/ecore_imf_xim.c
+++ b/ecore/src/modules/immodules/xim/ecore_imf_xim.c
@@ -45,7 +45,6 @@ struct _Ecore_IMF_Context_Data
char *locale;
XIM_Im_Info *im_info;
int preedit_length;
- int preedit_size;
int preedit_cursor;
Eina_Unicode *preedit_chars;
Eina_Bool use_preedit;
@@ -282,6 +281,14 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx)
XFree(preedit_attr);
+ if(imf_context_data->preedit_length)
+ {
+ imf_context_data->preedit_length = 0;
+ free(imf_context_data->preedit_chars);
+ imf_context_data->preedit_chars = NULL;
+ ecore_imf_context_preedit_changed_event_add(ctx);
+ }
+
if(result)
{
char *result_utf8 = strdup(result);
@@ -292,12 +299,6 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx)
}
}
- if(imf_context_data->preedit_length)
- {
- imf_context_data->preedit_length = 0;
- ecore_imf_context_preedit_changed_event_add(ctx);
- }
-
XFree (result);
#endif
}
@@ -702,6 +703,8 @@ preedit_done_callback(XIC xic __UNUSED__,
if(imf_context_data->preedit_length)
{
imf_context_data->preedit_length = 0;
+ free(imf_context_data->preedit_chars);
+ imf_context_data->preedit_chars = NULL;
ecore_imf_context_preedit_changed_event_add(ctx);
}
@@ -758,22 +761,20 @@ preedit_draw_callback(XIC xic __UNUSED__,
XIMPreeditDrawCallbackStruct *call_data)
{
EINA_LOG_DBG("in");
+ Eina_Bool ret = EINA_FALSE;
Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data;
Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
XIMText *t = call_data->text;
char *tmp;
Eina_Unicode *new_text = NULL;
- int new_length;
+ Eina_UStrbuf *preedit_bufs = NULL;
int new_text_length;
- int diff;
- int chg_first;
- int chg_length;
- int i;
- /* XXX */
- chg_first = CLAMP(call_data->chg_first, 0, imf_context_data->preedit_length);
- chg_length = CLAMP(call_data->chg_length, 0,
- imf_context_data->preedit_length - chg_first);
+ preedit_bufs = eina_ustrbuf_new();
+ if(imf_context_data->preedit_chars) {
+ ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars);
+ if(ret == EINA_FALSE) goto done;
+ }
new_text_length = xim_text_to_utf8(ctx, t, &tmp);
if(tmp)
@@ -783,52 +784,37 @@ preedit_draw_callback(XIC xic __UNUSED__,
free(tmp);
}
- diff = new_text_length - chg_length;
- new_length = imf_context_data->preedit_length + diff;
- if(new_length > imf_context_data->preedit_size)
- {
- Eina_Unicode *tmp_chars = NULL;
- imf_context_data->preedit_size = new_length;
-
- if(imf_context_data->preedit_chars)
- {
- tmp_chars = eina_unicode_strdup(imf_context_data->preedit_chars);
- free(imf_context_data->preedit_chars);
- imf_context_data->preedit_chars = calloc(new_length + 1,
- sizeof(Eina_Unicode));
- eina_unicode_strcpy(imf_context_data->preedit_chars, tmp_chars);
- free(tmp_chars);
- }
- else {
- imf_context_data->preedit_chars = calloc(new_length + 1,
- sizeof(Eina_Unicode));
- }
- // XXX feedback?
- }
-
- if(diff < 0)
- {
- for(i = chg_first + chg_length; i < imf_context_data->preedit_length; i++) {
- imf_context_data->preedit_chars[i + diff] =
- imf_context_data->preedit_chars[i];
- }
- }
- else {
- for(i = imf_context_data->preedit_length - 1; i >= chg_first + chg_length; i--) {
- imf_context_data->preedit_chars[i + diff] =
- imf_context_data->preedit_chars[i];
- }
- }
-
- for(i = 0; i < new_text_length; i++) {
- imf_context_data->preedit_chars[chg_first + i] = new_text[i];
- }
+ if(t == NULL) {
+ /* delete string */
+ ret = eina_ustrbuf_remove(preedit_bufs,
+ call_data->chg_first, call_data->chg_length);
+ } else if(call_data->chg_length == 0) {
+ /* insert string */
+ ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first);
+ } else if(call_data->chg_length > 0) {
+ /* replace string */
+ ret = eina_ustrbuf_remove(preedit_bufs,
+ call_data->chg_first, call_data->chg_length);
+ if(ret == EINA_FALSE) goto done;
+
+ ret = eina_ustrbuf_insert_n(preedit_bufs, new_text,
+ new_text_length, call_data->chg_first);
+ if(ret == EINA_FALSE) goto done;
+ } else {
+ ret = EINA_FALSE;
+ }
+
+ done:
+ if(ret == EINA_TRUE) {
+ free(imf_context_data->preedit_chars);
+ imf_context_data->preedit_chars =
+ eina_ustrbuf_string_steal(preedit_bufs);
+ imf_context_data->preedit_length =
+ eina_unicode_strlen(imf_context_data->preedit_chars);
+ }
- imf_context_data->preedit_length += diff;
free(new_text);
-
- if(imf_context_data->finalizing == EINA_FALSE)
- ecore_imf_context_preedit_changed_event_add(ctx);
+ eina_ustrbuf_free(preedit_bufs);
}
static void
@@ -940,6 +926,8 @@ reinitialize_ic(Ecore_IMF_Context *ctx)
if(imf_context_data->preedit_length)
{
imf_context_data->preedit_length = 0;
+ free(imf_context_data->preedit_chars);
+ imf_context_data->preedit_chars = NULL;
ecore_imf_context_preedit_changed_event_add(ctx);
}
}
------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide. Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel