forked from enlightenment/efl
ecore_imf/ibus: fix indentation
This commit is contained in:
parent
505491c47c
commit
478433f0cf
|
@ -80,16 +80,16 @@ utf8_offset_to_index(const char *str, int offset)
|
||||||
static int
|
static int
|
||||||
sort_cb(const void *d1, const void *d2)
|
sort_cb(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
const Ecore_IMF_Preedit_Attr *attr1 = d1;
|
const Ecore_IMF_Preedit_Attr *attr1 = d1;
|
||||||
const Ecore_IMF_Preedit_Attr *attr2 = d2;
|
const Ecore_IMF_Preedit_Attr *attr2 = d2;
|
||||||
|
|
||||||
if (!attr1) return 1;
|
if (!attr1) return 1;
|
||||||
if (!attr2) return -1;
|
if (!attr2) return -1;
|
||||||
|
|
||||||
if (attr1->start_index < attr2->start_index)
|
if (attr1->start_index < attr2->start_index)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -233,44 +233,44 @@ _request_surrounding_text(IBusIMContext *ibusimcontext)
|
||||||
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext->ibuscontext);
|
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext->ibuscontext);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext->ctx);
|
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext->ctx);
|
||||||
|
|
||||||
if ((ibusimcontext->caps & IBUS_CAP_SURROUNDING_TEXT) != 0 &&
|
if ((ibusimcontext->caps & IBUS_CAP_SURROUNDING_TEXT) != 0 &&
|
||||||
ibus_input_context_needs_surrounding_text(ibusimcontext->ibuscontext))
|
ibus_input_context_needs_surrounding_text(ibusimcontext->ibuscontext))
|
||||||
{
|
{
|
||||||
char *surrounding = NULL;
|
char *surrounding = NULL;
|
||||||
int cursor_pos;
|
int cursor_pos;
|
||||||
IBusText *ibustext;
|
IBusText *ibustext;
|
||||||
|
|
||||||
EINA_LOG_DBG ("requesting surrounding text...\n");
|
EINA_LOG_DBG ("requesting surrounding text...\n");
|
||||||
|
|
||||||
if (ecore_imf_context_surrounding_get(ibusimcontext->ctx,
|
if (ecore_imf_context_surrounding_get(ibusimcontext->ctx,
|
||||||
&surrounding,
|
&surrounding,
|
||||||
&cursor_pos))
|
&cursor_pos))
|
||||||
{
|
{
|
||||||
if (!surrounding)
|
if (!surrounding)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cursor_pos < 0)
|
if (cursor_pos < 0)
|
||||||
{
|
{
|
||||||
free(surrounding);
|
free(surrounding);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ibustext = ibus_text_new_from_string(surrounding);
|
ibustext = ibus_text_new_from_string(surrounding);
|
||||||
|
|
||||||
ibus_input_context_set_surrounding_text(ibusimcontext->ibuscontext,
|
ibus_input_context_set_surrounding_text(ibusimcontext->ibuscontext,
|
||||||
ibustext,
|
ibustext,
|
||||||
cursor_pos,
|
cursor_pos,
|
||||||
cursor_pos);
|
cursor_pos);
|
||||||
|
|
||||||
free(surrounding);
|
free(surrounding);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ibusimcontext->caps &= ~IBUS_CAP_SURROUNDING_TEXT;
|
ibusimcontext->caps &= ~IBUS_CAP_SURROUNDING_TEXT;
|
||||||
ibus_input_context_set_capabilities(ibusimcontext->ibuscontext,
|
ibus_input_context_set_capabilities(ibusimcontext->ibuscontext,
|
||||||
ibusimcontext->caps);
|
ibusimcontext->caps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IBusIMContext *
|
IBusIMContext *
|
||||||
|
|
|
@ -59,8 +59,8 @@ static Ecore_IMF_Context_Class ibus_imf_class = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static Ecore_IMF_Context *im_module_create (void);
|
static Ecore_IMF_Context *im_module_create(void);
|
||||||
static Ecore_IMF_Context *im_module_exit (void);
|
static Ecore_IMF_Context *im_module_exit(void);
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
im_module_init(void)
|
im_module_init(void)
|
||||||
|
@ -73,10 +73,10 @@ im_module_init(void)
|
||||||
if (strcmp(s, "x11")) return EINA_FALSE;
|
if (strcmp(s, "x11")) return EINA_FALSE;
|
||||||
}
|
}
|
||||||
ecore_main_loop_glib_integrate();
|
ecore_main_loop_glib_integrate();
|
||||||
ibus_init();
|
ibus_init();
|
||||||
ecore_imf_module_register(&ibus_im_info, im_module_create, im_module_exit);
|
ecore_imf_module_register(&ibus_im_info, im_module_create, im_module_exit);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void im_module_shutdown(void)
|
static void im_module_shutdown(void)
|
||||||
|
@ -86,31 +86,31 @@ static void im_module_shutdown(void)
|
||||||
static Ecore_IMF_Context *
|
static Ecore_IMF_Context *
|
||||||
im_module_exit(void)
|
im_module_exit(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ecore_IMF_Context *
|
static Ecore_IMF_Context *
|
||||||
im_module_create(void)
|
im_module_create(void)
|
||||||
{
|
{
|
||||||
Ecore_IMF_Context *ctx = NULL;
|
Ecore_IMF_Context *ctx = NULL;
|
||||||
IBusIMContext *ctxd = NULL;
|
IBusIMContext *ctxd = NULL;
|
||||||
|
|
||||||
ctxd = ecore_imf_context_ibus_new();
|
ctxd = ecore_imf_context_ibus_new();
|
||||||
if (!ctxd)
|
if (!ctxd)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = ecore_imf_context_new(&ibus_imf_class);
|
ctx = ecore_imf_context_new(&ibus_imf_class);
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
{
|
{
|
||||||
free(ctxd);
|
free(ctxd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_imf_context_data_set(ctx, ctxd);
|
ecore_imf_context_data_set(ctx, ctxd);
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_MODULE_INIT(im_module_init);
|
EINA_MODULE_INIT(im_module_init);
|
||||||
|
|
Loading…
Reference in New Issue