forked from enlightenment/efl
ecore-x: Remove XIM
Signed-off-by: Naruto TAKAHASHI <tnaruto@gmail.com> SVN revision: 61257
This commit is contained in:
parent
dba308e60b
commit
39164fb44d
|
@ -59,8 +59,6 @@ Window _ecore_x_event_last_win = 0;
|
||||||
int _ecore_x_event_last_root_x = 0;
|
int _ecore_x_event_last_root_x = 0;
|
||||||
int _ecore_x_event_last_root_y = 0;
|
int _ecore_x_event_last_root_y = 0;
|
||||||
Eina_Bool _ecore_x_xcursor = EINA_FALSE;
|
Eina_Bool _ecore_x_xcursor = EINA_FALSE;
|
||||||
XIC _ecore_x_ic = NULL; /* Input context for composed characters */
|
|
||||||
XIM _ecore_x_im = NULL;
|
|
||||||
|
|
||||||
Ecore_X_Window _ecore_x_private_win = 0;
|
Ecore_X_Window _ecore_x_private_win = 0;
|
||||||
|
|
||||||
|
@ -558,56 +556,6 @@ ecore_x_init(const char *name)
|
||||||
|
|
||||||
_ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
|
_ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
|
||||||
|
|
||||||
#ifdef ENABLE_XIM
|
|
||||||
/* Setup XIM */
|
|
||||||
if (!_ecore_x_ic && XSupportsLocale())
|
|
||||||
{
|
|
||||||
XIM im;
|
|
||||||
XIC ic;
|
|
||||||
XIMStyles *supported_styles;
|
|
||||||
XIMStyle chosen_style = 0;
|
|
||||||
Ecore_X_Window client_window = ecore_x_window_root_get(
|
|
||||||
_ecore_x_private_win);
|
|
||||||
char *ret;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
XSetLocaleModifiers("@im=none");
|
|
||||||
if (!(im = XOpenIM(_ecore_x_disp, NULL, NULL, NULL)))
|
|
||||||
goto _im_create_end;
|
|
||||||
|
|
||||||
ret = XGetIMValues(im, XNQueryInputStyle, &supported_styles, NULL);
|
|
||||||
if (ret || !supported_styles)
|
|
||||||
goto _im_create_error;
|
|
||||||
|
|
||||||
for (i = 0; i < supported_styles->count_styles; i++)
|
|
||||||
{
|
|
||||||
if (supported_styles->supported_styles[i] ==
|
|
||||||
(XIMPreeditNothing | XIMStatusNothing))
|
|
||||||
chosen_style = supported_styles->supported_styles[i];
|
|
||||||
}
|
|
||||||
XFree(supported_styles);
|
|
||||||
if (!chosen_style)
|
|
||||||
goto _im_create_error;
|
|
||||||
|
|
||||||
ic = XCreateIC(im,
|
|
||||||
XNInputStyle,
|
|
||||||
chosen_style,
|
|
||||||
XNClientWindow,
|
|
||||||
client_window,
|
|
||||||
NULL);
|
|
||||||
if (ic)
|
|
||||||
{
|
|
||||||
_ecore_x_ic = ic;
|
|
||||||
_ecore_x_im = im;
|
|
||||||
goto _im_create_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
_im_create_error:
|
|
||||||
XCloseIM(im);
|
|
||||||
}
|
|
||||||
|
|
||||||
_im_create_end:
|
|
||||||
#endif /* ifdef ENABLE_XIM */
|
|
||||||
return _ecore_x_init_count;
|
return _ecore_x_init_count;
|
||||||
|
|
||||||
free_event_handlers:
|
free_event_handlers:
|
||||||
|
@ -640,20 +588,6 @@ _ecore_x_shutdown(int close_display)
|
||||||
|
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
#ifdef ENABLE_XIM
|
|
||||||
if (_ecore_x_ic)
|
|
||||||
{
|
|
||||||
XDestroyIC(_ecore_x_ic);
|
|
||||||
_ecore_x_ic = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_ecore_x_im)
|
|
||||||
{
|
|
||||||
XCloseIM(_ecore_x_im);
|
|
||||||
_ecore_x_im = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ifdef ENABLE_XIM */
|
|
||||||
ecore_main_fd_handler_del(_ecore_x_fd_handler_handle);
|
ecore_main_fd_handler_del(_ecore_x_fd_handler_handle);
|
||||||
if (close_display)
|
if (close_display)
|
||||||
XCloseDisplay(_ecore_x_disp);
|
XCloseDisplay(_ecore_x_disp);
|
||||||
|
|
|
@ -231,88 +231,18 @@ _ecore_key_press(int event, XKeyEvent *xevent)
|
||||||
sym = 0;
|
sym = 0;
|
||||||
key = NULL;
|
key = NULL;
|
||||||
compose = NULL;
|
compose = NULL;
|
||||||
if ((_ecore_x_ic) && (event == ECORE_EVENT_KEY_DOWN))
|
val = XLookupString(xevent,
|
||||||
{
|
compose_buffer,
|
||||||
Status mbstatus;
|
sizeof(compose_buffer),
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
&sym,
|
||||||
val = Xutf8LookupString(_ecore_x_ic,
|
&status);
|
||||||
(XKeyEvent *)xevent,
|
if (val > 0)
|
||||||
compose_buffer,
|
{
|
||||||
sizeof(compose_buffer) - 1,
|
compose_buffer[val] = 0;
|
||||||
&sym,
|
compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8",
|
||||||
&mbstatus);
|
compose_buffer);
|
||||||
#else /* ifdef X_HAVE_UTF8_STRING */
|
tmp = compose;
|
||||||
val = XmbLookupString(_ecore_x_ic,
|
}
|
||||||
(XKeyEvent *)xevent,
|
|
||||||
compose_buffer,
|
|
||||||
sizeof(compose_buffer) - 1,
|
|
||||||
&sym,
|
|
||||||
&mbstatus);
|
|
||||||
#endif /* ifdef X_HAVE_UTF8_STRING */
|
|
||||||
if (mbstatus == XBufferOverflow)
|
|
||||||
{
|
|
||||||
tmp = malloc(sizeof (char) * (val + 1));
|
|
||||||
if (!tmp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
compose = tmp;
|
|
||||||
|
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
|
||||||
val = Xutf8LookupString(_ecore_x_ic,
|
|
||||||
(XKeyEvent *)xevent,
|
|
||||||
tmp,
|
|
||||||
val,
|
|
||||||
&sym,
|
|
||||||
&mbstatus);
|
|
||||||
#else /* ifdef X_HAVE_UTF8_STRING */
|
|
||||||
val = XmbLookupString(_ecore_x_ic,
|
|
||||||
(XKeyEvent *)xevent,
|
|
||||||
tmp,
|
|
||||||
val,
|
|
||||||
&sym,
|
|
||||||
&mbstatus);
|
|
||||||
#endif /* ifdef X_HAVE_UTF8_STRING */
|
|
||||||
if (val > 0)
|
|
||||||
{
|
|
||||||
tmp[val] = 0;
|
|
||||||
|
|
||||||
#ifndef X_HAVE_UTF8_STRING
|
|
||||||
compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
|
|
||||||
free(tmp);
|
|
||||||
tmp = compose;
|
|
||||||
#endif /* ifndef X_HAVE_UTF8_STRING */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
compose = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (val > 0)
|
|
||||||
{
|
|
||||||
compose_buffer[val] = 0;
|
|
||||||
#ifdef X_HAVE_UTF8_STRING
|
|
||||||
compose = compose_buffer;
|
|
||||||
#else /* ifdef X_HAVE_UTF8_STRING */
|
|
||||||
compose = eina_str_convert(nl_langinfo(
|
|
||||||
CODESET), "UTF-8", compose_buffer);
|
|
||||||
tmp = compose;
|
|
||||||
#endif /* ifdef X_HAVE_UTF8_STRING */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
val = XLookupString(xevent,
|
|
||||||
compose_buffer,
|
|
||||||
sizeof(compose_buffer),
|
|
||||||
&sym,
|
|
||||||
&status);
|
|
||||||
if (val > 0)
|
|
||||||
{
|
|
||||||
compose_buffer[val] = 0;
|
|
||||||
compose = eina_str_convert(nl_langinfo(
|
|
||||||
CODESET), "UTF-8", compose_buffer);
|
|
||||||
tmp = compose;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
key = XKeysymToString(sym);
|
key = XKeysymToString(sym);
|
||||||
if (!key)
|
if (!key)
|
||||||
|
@ -881,16 +811,6 @@ _ecore_x_event_handle_focus_in(XEvent *xevent)
|
||||||
Ecore_X_Event_Window_Focus_In *e;
|
Ecore_X_Event_Window_Focus_In *e;
|
||||||
|
|
||||||
_ecore_x_last_event_mouse_move = 0;
|
_ecore_x_last_event_mouse_move = 0;
|
||||||
if (_ecore_x_ic)
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
|
|
||||||
XSetICValues(_ecore_x_ic, XNFocusWindow, xevent->xfocus.window, NULL);
|
|
||||||
if ((str = XmbResetIC(_ecore_x_ic)))
|
|
||||||
XFree(str);
|
|
||||||
|
|
||||||
XSetICFocus(_ecore_x_ic);
|
|
||||||
}
|
|
||||||
|
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
|
||||||
if (!e)
|
if (!e)
|
||||||
|
@ -935,8 +855,6 @@ _ecore_x_event_handle_focus_out(XEvent *xevent)
|
||||||
Ecore_X_Event_Window_Focus_Out *e;
|
Ecore_X_Event_Window_Focus_Out *e;
|
||||||
|
|
||||||
_ecore_x_last_event_mouse_move = 0;
|
_ecore_x_last_event_mouse_move = 0;
|
||||||
if (_ecore_x_ic)
|
|
||||||
XUnsetICFocus(_ecore_x_ic);
|
|
||||||
|
|
||||||
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
|
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
|
||||||
if (!e)
|
if (!e)
|
||||||
|
|
Loading…
Reference in New Issue