int state;
};
-static Eina_Bool _use_sync_mode = EINA_FALSE;
+static Eina_Bool _sync_mode_use = EINA_FALSE;
static Ecore_IMF_Context *_focus_im_context = NULL;
static IBusBus *_bus = NULL;
/* functions prototype */
/* static methods*/
-static void _create_input_context (IBusIMContext *context);
-static void _set_cursor_location_internal
-(Ecore_IMF_Context *ctx);
-static void _bus_connected_cb (IBusBus *bus,
+static void _ecore_imf_context_ibus_create (IBusIMContext *context);
+static void _ecore_imf_context_ibus_cursor_location_internal_set(Ecore_IMF_Context *ctx);
+static void _ecore_imf_context_ibus_bus_connected_cb (IBusBus *bus,
IBusIMContext *context);
-static XKeyEvent createXKeyEvent (Window win, Eina_Bool press, int keysym, int modifiers);
+static XKeyEvent _ecore_imf_ibus_x_key_event_generate (Window win, Eina_Bool press, int keysym, int modifiers);
static void
-_window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y)
+_ecore_imf_ibus_window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y)
{
Ecore_X_Window root_window, win;
int win_x, win_y;
}
static void
-key_event_put(int keysym, int state)
+_ecore_imf_ibus_key_event_put(int keysym, int state)
{
// Find the window which has the current keyboard focus.
Window winFocus = 0;
XKeyEvent event;
if (state & IBUS_RELEASE_MASK)
{
- event = createXKeyEvent(winFocus, EINA_FALSE, keysym, state);
+ event = _ecore_imf_ibus_x_key_event_generate(winFocus, EINA_FALSE, keysym, state);
XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
}
else
{
- event = createXKeyEvent(winFocus, EINA_TRUE, keysym, state);
+ event = _ecore_imf_ibus_x_key_event_generate(winFocus, EINA_TRUE, keysym, state);
XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
}
}
static KeyEvent *
-key_event_copy(int keysym, int state)
+_ecore_imf_ibus_key_event_copy(int keysym, int state)
{
KeyEvent *kev = calloc(1, sizeof(KeyEvent));
kev->keysym = keysym;
}
IBusIMContext *
-ibus_im_context_new(void)
+ecore_imf_context_ibus_new(void)
{
EINA_LOG_DBG("%s", __FUNCTION__);
}
static void
-_process_key_event_done(GObject *object,
+_ecore_imf_ibus_process_key_event_done(GObject *object,
GAsyncResult *res,
gpointer user_data)
{
if (retval == EINA_FALSE)
{
- key_event_put(event->keysym, event->state);
+ _ecore_imf_ibus_key_event_put(event->keysym, event->state);
}
free(event);
}
EAPI void
-ibus_im_context_add(Ecore_IMF_Context *ctx)
+ecore_imf_context_ibus_add(Ecore_IMF_Context *ctx)
{
EINA_LOG_DBG("%s", __FUNCTION__);
s = getenv("IBUS_ENABLE_SYNC_MODE");
if (s)
- _use_sync_mode = !!atoi(s);
+ _sync_mode_use = !!atoi(s);
if (ibus_bus_is_connected(_bus))
- _create_input_context (ibusimcontext);
+ _ecore_imf_context_ibus_create (ibusimcontext);
- g_signal_connect(_bus, "connected", G_CALLBACK (_bus_connected_cb), ctx);
+ g_signal_connect(_bus, "connected", G_CALLBACK (_ecore_imf_context_ibus_bus_connected_cb), ctx);
}
EAPI void
-ibus_im_context_del(Ecore_IMF_Context *ctx)
+ecore_imf_context_ibus_del(Ecore_IMF_Context *ctx)
{
EINA_LOG_DBG("%s", __FUNCTION__);
IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
- g_signal_handlers_disconnect_by_func(_bus, G_CALLBACK(_bus_connected_cb), ctx);
+ g_signal_handlers_disconnect_by_func(_bus, G_CALLBACK(_ecore_imf_context_ibus_bus_connected_cb), ctx);
if (ibusimcontext->ibuscontext)
ibus_proxy_destroy((IBusProxy *)ibusimcontext->ibuscontext);
}
EAPI Eina_Bool
-ibus_im_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
+ecore_imf_context_ibus_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
{
IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
EINA_SAFETY_ON_NULL_RETURN_VAL(ibusimcontext, EINA_FALSE);
keysym = XStringToKeysym(ev->key);
state = _ecore_imf_modifier_to_ibus_modifier(ev->modifiers) | IBUS_RELEASE_MASK;
- if (_use_sync_mode)
+ if (_sync_mode_use)
{
retval = ibus_input_context_process_key_event(ibusimcontext->ibuscontext,
keysym,
state,
-1,
NULL,
- _process_key_event_done,
- key_event_copy(keysym, state));
+ _ecore_imf_ibus_process_key_event_done,
+ _ecore_imf_ibus_key_event_copy(keysym, state));
retval = EINA_TRUE;
}
}
keycode = ecore_x_keysym_keycode_get(ev->key);
keysym = XStringToKeysym(ev->key);
state = _ecore_imf_modifier_to_ibus_modifier(ev->modifiers);
- if (_use_sync_mode)
+ if (_sync_mode_use)
{
retval = ibus_input_context_process_key_event(ibusimcontext->ibuscontext,
keysym,
state,
-1,
NULL,
- _process_key_event_done,
- key_event_copy(keysym, state));
+ _ecore_imf_ibus_process_key_event_done,
+ _ecore_imf_ibus_key_event_copy(keysym, state));
retval = EINA_TRUE;
}
}
}
EAPI void
-ibus_im_context_focus_in(Ecore_IMF_Context *ctx)
+ecore_imf_context_ibus_focus_in(Ecore_IMF_Context *ctx)
{
EINA_LOG_DBG("ctx : %p", ctx);
}
EAPI void
-ibus_im_context_focus_out(Ecore_IMF_Context *ctx)
+ecore_imf_context_ibus_focus_out(Ecore_IMF_Context *ctx)
{
EINA_LOG_DBG("ctx : %p", ctx);
}
EAPI void
-ibus_im_context_reset(Ecore_IMF_Context *ctx)
+ecore_imf_context_ibus_reset(Ecore_IMF_Context *ctx)
{
IBusIMContext *ibusimcontext = (IBusIMContext*)ecore_imf_context_data_get(ctx);
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
}
EAPI void
-ibus_im_context_preedit_string_get(Ecore_IMF_Context *ctx,
+ecore_imf_context_ibus_preedit_string_get(Ecore_IMF_Context *ctx,
char **str,
int *cursor_pos)
{
}
EAPI void
-ibus_im_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx,
+ecore_imf_context_ibus_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx,
char **str,
Eina_List **attr EINA_UNUSED,
int *cursor_pos)
}
EAPI void
-ibus_im_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
+ecore_imf_context_ibus_client_window_set(Ecore_IMF_Context *ctx, void *window)
{
EINA_LOG_DBG("canvas : %p", window);
IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
}
EAPI void
-ibus_im_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
+ecore_imf_context_ibus_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
{
EINA_LOG_DBG("canvas : %p", canvas);
IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
}
static void
-_set_cursor_location_internal(Ecore_IMF_Context *ctx)
+_ecore_imf_context_ibus_cursor_location_set(Ecore_IMF_Context *ctx)
{
IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
Ecore_Evas *ee;
else
{
if (ibusimcontext->client_window)
- _window_to_screen_geometry_get(ibusimcontext->client_window, &canvas_x, &canvas_y);
+ _ecore_imf_ibus_window_to_screen_geometry_get(ibusimcontext->client_window, &canvas_x, &canvas_y);
else
return;
}
}
EAPI void
-ibus_im_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
+ecore_imf_context_ibus_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h)
{
EINA_LOG_DBG("x : %d, y : %d, w, %d, h :%d", x, y, w, h);
IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
ibusimcontext->cursor_w = w;
ibusimcontext->cursor_h = h;
- _set_cursor_location_internal(ctx);
+ _ecore_imf_context_ibus_cursor_location_set(ctx);
}
}
EAPI void
-ibus_im_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit)
+ecore_imf_context_ibus_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit)
{
EINA_LOG_DBG("preedit : %d", use_preedit);
IBusIMContext *ibusimcontext = (IBusIMContext *)ecore_imf_context_data_get(ctx);
}
static void
-_bus_connected_cb(IBusBus *bus EINA_UNUSED,
+_ecore_imf_context_ibus_bus_connected_cb(IBusBus *bus EINA_UNUSED,
IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("ibus is connected");
if (ibusimcontext)
- _create_input_context(ibusimcontext);
+ _ecore_imf_context_ibus_create(ibusimcontext);
}
static void
-_ibus_context_commit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_commit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusText *text,
IBusIMContext *ibusimcontext)
{
}
}
-static XKeyEvent createXKeyEvent(Window win, Eina_Bool press, int keysym, int modifiers)
+static XKeyEvent _ecore_imf_ibus_x_key_event_generate(Window win, Eina_Bool press, int keysym, int modifiers)
{
XKeyEvent event;
Display *display = ecore_x_display_get();
}
static void
-_ibus_context_forward_key_event_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_forward_key_event_cb(IBusInputContext *ibuscontext EINA_UNUSED,
guint keyval,
guint state,
IBusIMContext *ibusimcontext EINA_UNUSED)
{
EINA_LOG_DBG("keyval : %d, state : %d", keyval, state);
- key_event_put(keyval, state);
+ _ecore_imf_ibus_key_event_put(keyval, state);
}
static void
-_ibus_context_update_preedit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_update_preedit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusText *text,
gint cursor_pos,
gboolean visible,
}
static void
-_ibus_context_show_preedit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_show_preedit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("preedit visible : %d", ibusimcontext->preedit_visible);
}
static void
-_ibus_context_hide_preedit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_hide_preedit_text_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("%s", __FUNCTION__);
}
static void
-_ibus_context_enabled_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_enabled_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("%s", __FUNCTION__);
}
static void
-_ibus_context_disabled_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_disabled_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("%s", __FUNCTION__);
}
static void
-_ibus_context_destroy_cb(IBusInputContext *ibuscontext EINA_UNUSED,
+_ecore_imf_context_ibus_destroy_cb(IBusInputContext *ibuscontext EINA_UNUSED,
IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("%s", __FUNCTION__);
}
static void
-_create_input_context(IBusIMContext *ibusimcontext)
+_ecore_imf_context_ibus_create(IBusIMContext *ibusimcontext)
{
EINA_LOG_DBG("%s", __FUNCTION__);
EINA_SAFETY_ON_NULL_RETURN(ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"commit-text",
- G_CALLBACK (_ibus_context_commit_text_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_commit_text_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"forward-key-event",
- G_CALLBACK (_ibus_context_forward_key_event_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_forward_key_event_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"update-preedit-text",
- G_CALLBACK (_ibus_context_update_preedit_text_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_update_preedit_text_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"show-preedit-text",
- G_CALLBACK (_ibus_context_show_preedit_text_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_show_preedit_text_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"hide-preedit-text",
- G_CALLBACK (_ibus_context_hide_preedit_text_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_hide_preedit_text_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"enabled",
- G_CALLBACK (_ibus_context_enabled_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_enabled_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext,
"disabled",
- G_CALLBACK (_ibus_context_disabled_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_disabled_cb),
ibusimcontext);
g_signal_connect(ibusimcontext->ibuscontext, "destroy",
- G_CALLBACK (_ibus_context_destroy_cb),
+ G_CALLBACK (_ecore_imf_context_ibus_destroy_cb),
ibusimcontext);
ibus_input_context_set_capabilities(ibusimcontext->ibuscontext, ibusimcontext->caps);
};
static Ecore_IMF_Context_Class ibus_imf_class = {
- ibus_im_context_add, /* add */
- ibus_im_context_del, /* del */
- ibus_im_context_client_window_set, /* client_window_set */
- ibus_im_context_client_canvas_set, /* client_canvas_set */
- NULL, /* input_panel_show */
- NULL, /* input_panel_hide */
- ibus_im_context_preedit_string_get, /* get_preedit_string */
- ibus_im_context_focus_in, /* focus_in */
- ibus_im_context_focus_out, /* focus_out */
- ibus_im_context_reset, /* reset */
- NULL, /* cursor_position_set */
- ibus_im_context_use_preedit_set, /* use_preedit_set */
- NULL, /* input_mode_set */
- ibus_im_context_filter_event, /* filter_event */
- ibus_im_context_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */
- NULL, /* prediction_allow_set */
- NULL, /* autocapital_type_set */
- NULL, /* control panel show */
- NULL, /* control panel hide */
- NULL, /* input_panel_layout_set */
- NULL, /* ibus_im_context_input_panel_layout_get, */
- NULL, /* ibus_im_context_input_panel_language_set, */
- NULL, /* ibus_im_context_input_panel_language_get, */
- ibus_im_context_cursor_location_set, /* cursor_location_set */
- NULL, /* input_panel_imdata_set */
- NULL, /* input_panel_imdata_get */
- NULL, /* input_panel_return_key_type_set */
- NULL, /* input_panel_return_key_disabled_set */
- NULL, /* input_panel_caps_lock_mode_set */
+ ecore_imf_context_ibus_add, /* add */
+ ecore_imf_context_ibus_del, /* del */
+ ecore_imf_context_ibus_client_window_set, /* client_window_set */
+ ecore_imf_context_ibus_client_canvas_set, /* client_canvas_set */
+ NULL, /* input_panel_show */
+ NULL, /* input_panel_hide */
+ ecore_imf_context_ibus_preedit_string_get, /* get_preedit_string */
+ ecore_imf_context_ibus_focus_in, /* focus_in */
+ ecore_imf_context_ibus_focus_out, /* focus_out */
+ ecore_imf_context_ibus_reset, /* reset */
+ NULL, /* cursor_position_set */
+ ecore_imf_context_ibus_use_preedit_set, /* use_preedit_set */
+ NULL, /* input_mode_set */
+ ecore_imf_context_ibus_filter_event, /* filter_event */
+ ecore_imf_context_ibus_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */
+ NULL, /* prediction_allow_set */
+ NULL, /* autocapital_type_set */
+ NULL, /* control panel show */
+ NULL, /* control panel hide */
+ NULL, /* input_panel_layout_set */
+ NULL, /* ecore_imf_context_ibus_input_panel_layout_get, */
+ NULL, /* ecore_imf_context_ibus_input_panel_language_set, */
+ NULL, /* ecore_imf_context_ibus_input_panel_language_get, */
+ ecore_imf_context_ibus_cursor_location_set, /* cursor_location_set */
+ NULL, /* input_panel_imdata_set */
+ NULL, /* input_panel_imdata_get */
+ NULL, /* input_panel_return_key_type_set */
+ NULL, /* input_panel_return_key_disabled_set */
+ NULL, /* input_panel_caps_lock_mode_set */
NULL,
NULL,
NULL,
Ecore_IMF_Context *ctx = NULL;
IBusIMContext *ctxd = NULL;
- ctxd = ibus_im_context_new();
+ ctxd = ecore_imf_context_ibus_new();
if (!ctxd)
{
return NULL;