From c963d75dfdeec11f82e79e727062fbf89afa2c04 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 22 Apr 2012 09:19:23 +1000 Subject: Update EFL to latest beta. --- libraries/ecore/src/modules/Makefile.in | 20 +- libraries/ecore/src/modules/immodules/Makefile.in | 20 +- .../ecore/src/modules/immodules/scim/Makefile.in | 20 +- .../src/modules/immodules/scim/scim_imcontext.cpp | 1348 ++++++++++---------- .../src/modules/immodules/scim/scim_imcontext.h | 2 + .../src/modules/immodules/scim/scim_module.cpp | 11 +- .../ecore/src/modules/immodules/xim/Makefile.in | 20 +- .../src/modules/immodules/xim/ecore_imf_xim.c | 48 +- 8 files changed, 806 insertions(+), 683 deletions(-) (limited to 'libraries/ecore/src/modules') diff --git a/libraries/ecore/src/modules/Makefile.in b/libraries/ecore/src/modules/Makefile.in index 4bb9420..e2cf44a 100644 --- a/libraries/ecore/src/modules/Makefile.in +++ b/libraries/ecore/src/modules/Makefile.in @@ -47,16 +47,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -172,6 +171,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -227,6 +228,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -237,6 +240,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/Makefile.in b/libraries/ecore/src/modules/immodules/Makefile.in index e65881c..5dacbed 100644 --- a/libraries/ecore/src/modules/immodules/Makefile.in +++ b/libraries/ecore/src/modules/immodules/Makefile.in @@ -49,16 +49,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.in b/libraries/ecore/src/modules/immodules/scim/Makefile.in index 9fc3283..ae6fc7d 100644 --- a/libraries/ecore/src/modules/immodules/scim/Makefile.in +++ b/libraries/ecore/src/modules/immodules/scim/Makefile.in @@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -205,6 +204,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -260,6 +261,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -270,6 +273,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp index 6cb72c2..eb9b5c9 100644 --- a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp +++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp @@ -223,18 +223,18 @@ static int __current_super_mask = 0; static int __current_hyper_mask = 0; static int __current_numlock_mask = Mod2Mask; -// A hack to shutdown the immodule cleanly even if im_module_exit () is not called when exiting. +// A hack to shutdown the immodule cleanly even if im_module_exit() is not called when exiting. class FinalizeHandler { public: - FinalizeHandler () + FinalizeHandler() { - SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler ()\n"; + SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler()\n"; } - ~FinalizeHandler () + ~FinalizeHandler() { - SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler ()\n"; - isf_imf_context_shutdown (); + SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler()\n"; + isf_imf_context_shutdown(); } }; @@ -254,12 +254,12 @@ utf8_offset_to_index(const char *str, int offset) } static unsigned int -get_time (void) +get_time(void) { unsigned int tint; struct timeval tv; struct timezone tz; /* is not used since ages */ - gettimeofday (&tv, &tz); + gettimeofday(&tv, &tz); tint = tv.tv_sec * 1000; tint = tint / 1000 * 1000; tint = tint + tv.tv_usec / 1000; @@ -268,7 +268,7 @@ get_time (void) /* Function Implementations */ static EcoreIMFContextISFImpl * -new_ic_impl (EcoreIMFContextISF *parent) +new_ic_impl(EcoreIMFContextISF *parent) { EcoreIMFContextISFImpl *impl = NULL; @@ -295,7 +295,7 @@ new_ic_impl (EcoreIMFContextISF *parent) } static void -delete_ic_impl (EcoreIMFContextISFImpl *impl) +delete_ic_impl(EcoreIMFContextISFImpl *impl) { EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0; @@ -312,10 +312,10 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl) _free_ic_impl_list = rec; rec->parent = 0; - rec->si.reset (); + rec->si.reset(); rec->client_window = 0; - rec->preedit_string = WideString (); - rec->preedit_attrlist.clear (); + rec->preedit_string = WideString(); + rec->preedit_attrlist.clear(); return; } @@ -323,7 +323,7 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl) } static void -delete_all_ic_impl (void) +delete_all_ic_impl(void) { EcoreIMFContextISFImpl *it = _used_ic_impl_list; @@ -344,7 +344,7 @@ delete_all_ic_impl (void) } static EcoreIMFContextISF * -find_ic (int id) +find_ic(int id) { EcoreIMFContextISFImpl *rec = _used_ic_impl_list; @@ -363,17 +363,18 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx) { char *plain_str = NULL; char *markup_str = NULL; - const char *puncs[3] = {". ", "! ", "? "}; + const char *puncs[] = {". ", "! ", "? "}; Eina_Bool ret = EINA_FALSE; int cursor_pos = 0; int i = 0; Eina_Unicode *tail = NULL; Eina_Unicode *ustr = NULL; - Eina_Unicode *uni_puncs[3]; + const int punc_num = sizeof(puncs) / sizeof(puncs[0]); + Eina_Unicode *uni_puncs[punc_num]; EcoreIMFContextISF *context_scim; if (!ctx) return EINA_FALSE; - context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (!context_scim || !context_scim->impl) return EINA_FALSE; switch (context_scim->impl->autocapital_type) @@ -386,7 +387,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx) break; } - for (i=0; i<3; i++) + for (i = 0; i < punc_num; i++) uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL); ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos); @@ -432,7 +433,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx) if (tail) { - for (i=0; i<3; i++) + for (i = 0; i < punc_num; i++) { if (!eina_unicode_strcmp(tail, uni_puncs[i])) { @@ -450,7 +451,7 @@ done: if (markup_str) free(markup_str); if (plain_str) free(plain_str); - for (i=0; i<3; i++) + for (i = 0; i < punc_num; i++) if (uni_puncs[i]) free(uni_puncs[i]); return ret; @@ -463,7 +464,7 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force) EcoreIMFContextISF *context_scim; if (!ctx) return; - context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (autocap_allow == EINA_FALSE) return; @@ -485,28 +486,52 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force) } static void -feed_key_event (Evas *evas, const char *str, Eina_Bool fake) +feed_key_event(Evas *evas, const char *str, Eina_Bool fake) { char key_string[128] = {0}; unsigned int timestamp = 0; if (!fake) - timestamp = get_time (); + timestamp = get_time(); - if (strncmp (str, "KeyRelease+", 11) == 0) + if (strncmp(str, "KeyRelease+", 11) == 0) { strncpy(key_string, str + 11, strlen(str)-11); - evas_event_feed_key_up (evas, key_string, key_string, NULL, NULL, timestamp, NULL); - SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up ()...\n"; + evas_event_feed_key_up(evas, key_string, key_string, NULL, NULL, timestamp, NULL); + SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up()...\n"; } else { strncpy(key_string, str, strlen(str)); - evas_event_feed_key_down (evas, key_string, key_string, NULL, NULL, timestamp, NULL); - SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down ()...\n"; + evas_event_feed_key_down(evas, key_string, key_string, NULL, NULL, timestamp, NULL); + SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down()...\n"; } } +static void +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; + int sum_x = 0, sum_y = 0; + + root_window = ecore_x_window_root_get(client_win); + win = client_win; + + while (root_window != win) + { + ecore_x_window_geometry_get(win, &win_x, &win_y, NULL, NULL); + sum_x += win_x; + sum_y += win_y; + win = ecore_x_window_parent_get(win); + } + + if (x) + *x = sum_x; + if (y) + *y = sum_y; +} + /* Public functions */ /** * isf_imf_context_new @@ -517,18 +542,11 @@ feed_key_event (Evas *evas, const char *str, Eina_Bool fake) * Return value: A pointer to the newly created EcoreIMFContextISF instance */ EAPI EcoreIMFContextISF * -isf_imf_context_new (void) +isf_imf_context_new(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; char *env; - Ecore_X_Display *display = ecore_x_display_get (); - if (!display) - { - std::cerr << "ecore_x_display_get () failed !!!"; - return NULL; - } - EcoreIMFContextISF *context_scim = new EcoreIMFContextISF; if (context_scim == NULL) { @@ -540,7 +558,7 @@ isf_imf_context_new (void) if (!_scim_initialized) { - initialize (); + initialize(); _scim_initialized = true; } @@ -558,61 +576,61 @@ isf_imf_context_new (void) * cleanup job. */ EAPI void -isf_imf_context_shutdown (void) +isf_imf_context_shutdown(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (_scim_initialized) { _scim_initialized = false; - finalize (); + finalize(); } } EAPI void -isf_imf_context_add (Ecore_IMF_Context *ctx) +isf_imf_context_add(Ecore_IMF_Context *ctx) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (!context_scim) return; context_scim->impl = NULL; - if (_backend.null ()) + if (_backend.null()) return; IMEngineInstancePointer si; // Use the default instance if "shared input method" mode is enabled. - if (_shared_input_method && !_default_instance.null ()) + if (_shared_input_method && !_default_instance.null()) { si = _default_instance; - SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; + SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n"; } // Not in "shared input method" mode, or no default instance, create an instance. - if (si.null ()) + if (si.null()) { - IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); - if (factory.null ()) return; - si = factory->create_instance ("UTF-8", _instance_count++); - if (si.null ()) return; - attach_instance (si); - SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; + IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8"); + if (factory.null()) return; + si = factory->create_instance("UTF-8", _instance_count++); + if (si.null()) return; + attach_instance(si); + SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n"; } // If "shared input method" mode is enabled, and there is no default instance, // then store this instance as default one. - if (_shared_input_method && _default_instance.null ()) + if (_shared_input_method && _default_instance.null()) { SCIM_DEBUG_FRONTEND(2) << "update default instance.\n"; _default_instance = si; } context_scim->ctx = ctx; - context_scim->impl = new_ic_impl (context_scim); + context_scim->impl = new_ic_impl(context_scim); if (context_scim->impl == NULL) { std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n"; @@ -640,24 +658,24 @@ isf_imf_context_add (Ecore_IMF_Context *ctx) _ic_list = context_scim; if (_shared_input_method) - context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); + context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); - _panel_client.prepare (context_scim->id); - _panel_client.register_input_context (context_scim->id, si->get_factory_uuid ()); - set_ic_capabilities (context_scim); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + _panel_client.register_input_context(context_scim->id, si->get_factory_uuid()); + set_ic_capabilities(context_scim); + _panel_client.send(); SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n"; } EAPI void -isf_imf_context_del (Ecore_IMF_Context *ctx) +isf_imf_context_del(Ecore_IMF_Context *ctx) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (!_ic_list) return; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim) { @@ -682,32 +700,32 @@ isf_imf_context_del (Ecore_IMF_Context *ctx) if (context_scim && context_scim->impl) { - _panel_client.prepare (context_scim->id); + _panel_client.prepare(context_scim->id); if (context_scim == _focused_ic) - context_scim->impl->si->focus_out (); + context_scim->impl->si->focus_out(); // Delete the instance. EcoreIMFContextISF *old_focused = _focused_ic; _focused_ic = context_scim; - context_scim->impl->si.reset (); + context_scim->impl->si.reset(); _focused_ic = old_focused; if (context_scim == _focused_ic) { - _panel_client.turn_off (context_scim->id); - _panel_client.focus_out (context_scim->id); + _panel_client.turn_off(context_scim->id); + _panel_client.focus_out(context_scim->id); } - _panel_client.remove_input_context (context_scim->id); - _panel_client.send (); + _panel_client.remove_input_context(context_scim->id); + _panel_client.send(); if (context_scim->impl->client_window) - isf_imf_context_client_window_set (ctx, NULL); + isf_imf_context_client_window_set(ctx, NULL); if (context_scim->impl) { - delete_ic_impl (context_scim->impl); + delete_ic_impl(context_scim->impl); context_scim->impl = 0; } } @@ -738,11 +756,11 @@ isf_imf_context_del (Ecore_IMF_Context *ctx) * be used for purposes internal to the Input Method Context. */ EAPI void -isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas) +isf_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas) context_scim->impl->client_canvas = (Evas*)canvas; @@ -762,11 +780,11 @@ isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas) * and may also be used for purposes internal to the Input Method Context. */ EAPI void -isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window) +isf_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window)) { @@ -789,29 +807,29 @@ isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window) * to clear the preedit state. */ EAPI void -isf_imf_context_reset (Ecore_IMF_Context *ctx) +isf_imf_context_reset(Ecore_IMF_Context *ctx) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim == _focused_ic) { WideString wstr = context_scim->impl->preedit_string; - _panel_client.prepare (context_scim->id); - context_scim->impl->si->reset (); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + context_scim->impl->si->reset(); + _panel_client.send(); if (context_scim->impl->need_commit_preedit) { - if (wstr.length ()) + if (wstr.length()) { - ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); + ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str()); ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); } - _panel_client.prepare (context_scim->id); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + _panel_client.send(); } } } @@ -825,9 +843,9 @@ isf_imf_context_reset (Ecore_IMF_Context *ctx) * Notify the Input Method Context that the widget to which its correspond has gained focus. */ EAPI void -isf_imf_context_focus_in (Ecore_IMF_Context *ctx) +isf_imf_context_focus_in(Ecore_IMF_Context *ctx) { - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (!context_scim) return; @@ -839,12 +857,11 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) if (_focused_ic == context_scim) { SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n"; - //isf_imf_context_cursor_position_set (ctx, 0); return; } SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n"; if (_focused_ic->ctx) - isf_imf_context_focus_out (_focused_ic->ctx); + isf_imf_context_focus_out(_focused_ic->ctx); } bool need_cap = false; @@ -854,28 +871,28 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) if (context_scim && context_scim->impl) { _focused_ic = context_scim; - _panel_client.prepare (context_scim->id); + _panel_client.prepare(context_scim->id); // Handle the "Shared Input Method" mode. if (_shared_input_method) { SCIM_DEBUG_FRONTEND(2) << "shared input method.\n"; - IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); - if (!factory.null ()) + IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8"); + if (!factory.null()) { - if (_default_instance.null () || _default_instance->get_factory_uuid () != factory->get_uuid ()) + if (_default_instance.null() || _default_instance->get_factory_uuid() != factory->get_uuid()) { - _default_instance = factory->create_instance ("UTF-8", _default_instance.null () ? _instance_count++ : _default_instance->get_id ()); - attach_instance (_default_instance); - SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n"; + _default_instance = factory->create_instance("UTF-8", _default_instance.null() ? _instance_count++ : _default_instance->get_id()); + attach_instance(_default_instance); + SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id() << " " << _default_instance->get_factory_uuid() << "\n"; } context_scim->impl->shared_si = true; context_scim->impl->si = _default_instance; - context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); - context_scim->impl->preedit_string.clear (); - context_scim->impl->preedit_attrlist.clear (); + context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); + context_scim->impl->preedit_string.clear(); + context_scim->impl->preedit_attrlist.clear(); context_scim->impl->preedit_caret = 0; context_scim->impl->preedit_started = false; need_cap = true; @@ -886,47 +903,50 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) else if (context_scim->impl->shared_si) { SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n"; - IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); - if (!factory.null ()) + IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8"); + if (!factory.null()) { - context_scim->impl->si = factory->create_instance ("UTF-8", _instance_count++); - context_scim->impl->preedit_string.clear (); - context_scim->impl->preedit_attrlist.clear (); + context_scim->impl->si = factory->create_instance("UTF-8", _instance_count++); + context_scim->impl->preedit_string.clear(); + context_scim->impl->preedit_attrlist.clear(); context_scim->impl->preedit_caret = 0; context_scim->impl->preedit_started = false; - attach_instance (context_scim->impl->si); + attach_instance(context_scim->impl->si); need_cap = true; need_reg = true; context_scim->impl->shared_si = false; - SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id () << " " << context_scim->impl->si->get_factory_uuid () << "\n"; + SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id() << " " << context_scim->impl->si->get_factory_uuid() << "\n"; } } - context_scim->impl->si->set_frontend_data (static_cast (context_scim)); + context_scim->impl->si->set_frontend_data(static_cast (context_scim)); - if (need_reg) _panel_client.register_input_context (context_scim->id, context_scim->impl->si->get_factory_uuid ()); - if (need_cap) set_ic_capabilities (context_scim); - if (need_reset) context_scim->impl->si->reset (); + if (need_reg) _panel_client.register_input_context(context_scim->id, context_scim->impl->si->get_factory_uuid()); + if (need_cap) set_ic_capabilities(context_scim); + if (need_reset) context_scim->impl->si->reset(); - panel_req_focus_in (context_scim); - panel_req_update_spot_location (context_scim); - panel_req_update_factory_info (context_scim); + panel_req_focus_in(context_scim); + panel_req_update_spot_location(context_scim); + panel_req_update_factory_info(context_scim); if (context_scim->impl->is_on) { - _panel_client.turn_on (context_scim->id); - _panel_client.hide_preedit_string (context_scim->id); - _panel_client.hide_aux_string (context_scim->id); - _panel_client.hide_lookup_table (context_scim->id); - context_scim->impl->si->focus_in (); + _panel_client.turn_on(context_scim->id); + _panel_client.hide_preedit_string(context_scim->id); + _panel_client.hide_aux_string(context_scim->id); + _panel_client.hide_lookup_table(context_scim->id); + context_scim->impl->si->focus_in(); } else { - _panel_client.turn_off (context_scim->id); + _panel_client.turn_off(context_scim->id); } - _panel_client.send (); + _panel_client.send(); } + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_show(ctx); } /** @@ -938,9 +958,9 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) * Notify the Input Method Context that the widget to which its correspond has lost focus. */ EAPI void -isf_imf_context_focus_out (Ecore_IMF_Context *ctx) +isf_imf_context_focus_out(Ecore_IMF_Context *ctx) { - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (!context_scim) return; @@ -952,23 +972,26 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx) if (context_scim->impl->need_commit_preedit) { - if (wstr.length ()) + if (wstr.length()) { - ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); + ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str()); ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); } - _panel_client.prepare (context_scim->id); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + _panel_client.send(); } - _panel_client.prepare (context_scim->id); - context_scim->impl->si->focus_out (); - context_scim->impl->si->reset (); - _panel_client.turn_off (context_scim->id); - _panel_client.focus_out (context_scim->id); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + context_scim->impl->si->focus_out(); + context_scim->impl->si->reset(); + _panel_client.turn_off(context_scim->id); + _panel_client.focus_out(context_scim->id); + _panel_client.send(); _focused_ic = 0; } + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_hide(ctx); } /** @@ -984,11 +1007,11 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx) * Notify the Input Method Context that a change in the cursor location has been made. */ EAPI void -isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch) +isf_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); Ecore_Evas *ee; int canvas_x, canvas_y; @@ -1001,21 +1024,28 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int if (context_scim->impl->preedit_updating) return; - if (!context_scim->impl->client_canvas) - return; - - ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); - if (!ee) return; + if (context_scim->impl->client_canvas) + { + ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); + if (!ee) return; - ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL); + ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL); + } + else + { + if (context_scim->impl->client_window) + window_to_screen_geometry_get(context_scim->impl->client_window, &canvas_x, &canvas_y); + else + return; + } if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch) { context_scim->impl->cursor_x = canvas_x + cx; context_scim->impl->cursor_y = canvas_y + cy + ch; - _panel_client.prepare (context_scim->id); - panel_req_update_spot_location (context_scim); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + panel_req_update_spot_location(context_scim); + _panel_client.send(); SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n"; } } @@ -1033,11 +1063,11 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int * display feedback, such as displaying it in a child of the root window. */ EAPI void -isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit) +isf_imf_context_use_preedit_set(Ecore_IMF_Context* ctx, Eina_Bool use_preedit) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (!_on_the_spot) return; @@ -1047,36 +1077,36 @@ isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit) context_scim->impl->use_preedit = use_preedit; if (context_scim == _focused_ic) { - _panel_client.prepare (context_scim->id); + _panel_client.prepare(context_scim->id); if (old != use_preedit) - set_ic_capabilities (context_scim); + set_ic_capabilities(context_scim); - if (context_scim->impl->preedit_string.length ()) - slot_show_preedit_string (context_scim->impl->si); + if (context_scim->impl->preedit_string.length()) + slot_show_preedit_string(context_scim->impl->si); - _panel_client.send (); + _panel_client.send(); } } } EAPI void -isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos) +isf_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->is_on) { - String mbs = utf8_wcstombs (context_scim->impl->preedit_string); + String mbs = utf8_wcstombs(context_scim->impl->preedit_string); if (str) { - if (mbs.length ()) - *str = strdup (mbs.c_str ()); + if (mbs.length()) + *str = strdup(mbs.c_str()); else - *str = strdup (""); + *str = strdup(""); } if (cursor_pos) @@ -1086,28 +1116,28 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char if (attrs) { - if (mbs.length ()) + if (mbs.length()) { int start_index, end_index; - int wlen = context_scim->impl->preedit_string.length (); + int wlen = context_scim->impl->preedit_string.length(); Ecore_IMF_Preedit_Attr *attr = NULL; AttributeList::const_iterator i; - bool *attrs_flag = new bool [mbs.length ()]; - memset (attrs_flag, 0, mbs.length () *sizeof (bool)); + bool *attrs_flag = new bool [mbs.length()]; + memset(attrs_flag, 0, mbs.length() *sizeof(bool)); - for (i = context_scim->impl->preedit_attrlist.begin (); - i != context_scim->impl->preedit_attrlist.end (); ++i) + for (i = context_scim->impl->preedit_attrlist.begin(); + i != context_scim->impl->preedit_attrlist.end(); ++i) { - start_index = i->get_start (); - end_index = i->get_end (); + start_index = i->get_start(); + end_index = i->get_end(); - if (end_index <= wlen && start_index < end_index && i->get_type () != SCIM_ATTR_DECORATE_NONE) + if (end_index <= wlen && start_index < end_index && i->get_type() != SCIM_ATTR_DECORATE_NONE) { - start_index = utf8_offset_to_index (mbs.c_str (), i->get_start ()); - end_index = utf8_offset_to_index (mbs.c_str (), i->get_end ()); + start_index = utf8_offset_to_index(mbs.c_str(), i->get_start()); + end_index = utf8_offset_to_index(mbs.c_str(), i->get_end()); - if (i->get_type () == SCIM_ATTR_DECORATE) + if (i->get_type() == SCIM_ATTR_DECORATE) { attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); if (attr == NULL) @@ -1115,24 +1145,24 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char attr->start_index = start_index; attr->end_index = end_index; - if (i->get_value () == SCIM_ATTR_DECORATE_UNDERLINE) + if (i->get_value() == SCIM_ATTR_DECORATE_UNDERLINE) { attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1; *attrs = eina_list_append(*attrs, (void *)attr); } - else if (i->get_value () == SCIM_ATTR_DECORATE_REVERSE) + else if (i->get_value() == SCIM_ATTR_DECORATE_REVERSE) { attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; *attrs = eina_list_append(*attrs, (void *)attr); } - else if (i->get_value () == SCIM_ATTR_DECORATE_HIGHLIGHT) + else if (i->get_value() == SCIM_ATTR_DECORATE_HIGHLIGHT) { attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3; *attrs = eina_list_append(*attrs, (void *)attr); } else { - free (attr); + free(attr); } switch(i->get_value()) @@ -1148,11 +1178,11 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char break; } } - else if (i->get_type () == SCIM_ATTR_FOREGROUND) + else if (i->get_type() == SCIM_ATTR_FOREGROUND) { SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n"; } - else if (i->get_type () == SCIM_ATTR_BACKGROUND) + else if (i->get_type() == SCIM_ATTR_BACKGROUND) { SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n"; } @@ -1160,13 +1190,13 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char } // Add underline for all characters which don't have attribute. - for (unsigned int pos = 0; pos < mbs.length (); ++pos) + for (unsigned int pos = 0; pos < mbs.length(); ++pos) { if (!attrs_flag [pos]) { int begin_pos = pos; - while (pos < mbs.length () && !attrs_flag [pos]) + while (pos < mbs.length() && !attrs_flag[pos]) ++pos; // use REVERSE style as default @@ -1187,7 +1217,7 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char else { if (str) - *str = strdup (""); + *str = strdup(""); if (cursor_pos) *cursor_pos = 0; @@ -1208,22 +1238,22 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char * To get the preedit string of the input method. */ EAPI void -isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos) +isf_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char** str, int *cursor_pos) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->is_on) { - String mbs = utf8_wcstombs (context_scim->impl->preedit_string); + String mbs = utf8_wcstombs(context_scim->impl->preedit_string); if (str) { - if (mbs.length ()) - *str = strdup (mbs.c_str ()); + if (mbs.length()) + *str = strdup(mbs.c_str()); else - *str = strdup (""); + *str = strdup(""); } if (cursor_pos) @@ -1232,7 +1262,7 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur else { if (str) - *str = strdup (""); + *str = strdup(""); if (cursor_pos) *cursor_pos = 0; @@ -1249,11 +1279,11 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur * Notify the Input Method Context that a change in the cursor position has been made. */ EAPI void -isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos) +isf_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim == _focused_ic) { @@ -1280,11 +1310,11 @@ isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos) * is in Ecore_IMF.h. */ EAPI void -isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) +isf_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl) context_scim->impl->input_mode = input_mode; } @@ -1299,22 +1329,22 @@ isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode inp * Set whether the IM context should use the prediction. */ EAPI void -isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction) +isf_imf_context_prediction_allow_set(Ecore_IMF_Context* ctx, Eina_Bool prediction) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction) context_scim->impl->prediction_allow = prediction; } EAPI void -isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type) +isf_imf_context_autocapital_type_set(Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type) context_scim->impl->autocapital_type = autocapital_type; @@ -1337,11 +1367,11 @@ isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapi */ EAPI Eina_Bool -isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) +isf_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); Eina_Bool ret = EINA_FALSE; if (ic == NULL || ic->impl == NULL) @@ -1352,7 +1382,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, if (type == ECORE_IMF_EVENT_KEY_DOWN) { Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; - scim_string_to_key (key, ev->key); + scim_string_to_key(key, ev->key); if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask; @@ -1362,7 +1392,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, else if (type == ECORE_IMF_EVENT_KEY_UP) { Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event; - scim_string_to_key (key, ev->key); + scim_string_to_key(key, ev->key); key.mask = SCIM_KEY_ReleaseMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; @@ -1377,264 +1407,290 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, key.mask &= _valid_key_mask; - _panel_client.prepare (ic->id); + _panel_client.prepare(ic->id); ret = EINA_TRUE; - if (!filter_hotkeys (ic, key)) + if (!filter_hotkeys(ic, key)) { if (!_focused_ic || !_focused_ic->impl->is_on || - !_focused_ic->impl->si->process_key_event (key)) + !_focused_ic->impl->si->process_key_event(key)) ret = EINA_FALSE; } - _panel_client.send (); + _panel_client.send(); return ret; } +EAPI void +isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); + if (ic == NULL || ic->impl == NULL) + return; + + ecore_x_e_virtual_keyboard_state_set + (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); +} + +EAPI void +isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); + if (ic == NULL || ic->impl == NULL) + return; + + ecore_x_e_virtual_keyboard_state_set + (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); +} + /* Panel Slot functions */ static void -panel_slot_reload_config (int context __UNUSED__) +panel_slot_reload_config(int context __UNUSED__) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _config->reload (); + _config->reload(); } static void -panel_slot_exit (int /* context */) +panel_slot_exit(int /* context */) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - finalize (); + finalize(); } static void -panel_slot_update_lookup_table_page_size (int context, int page_size) +panel_slot_update_lookup_table_page_size(int context, int page_size) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->update_lookup_table_page_size (page_size); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->update_lookup_table_page_size(page_size); + _panel_client.send(); } } static void -panel_slot_lookup_table_page_up (int context) +panel_slot_lookup_table_page_up(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->lookup_table_page_up (); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->lookup_table_page_up(); + _panel_client.send(); } } static void -panel_slot_lookup_table_page_down (int context) +panel_slot_lookup_table_page_down(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->lookup_table_page_down (); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->lookup_table_page_down(); + _panel_client.send(); } } static void -panel_slot_trigger_property (int context, const String &property) +panel_slot_trigger_property(int context, const String &property) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->trigger_property (property); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->trigger_property(property); + _panel_client.send(); } } static void -panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) +panel_slot_process_helper_event(int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid=" - << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid () : "" ) << "\n"; - if (ic && ic->impl && ic->impl->si->get_factory_uuid () == target_uuid) + << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid() : "" ) << "\n"; + if (ic && ic->impl && ic->impl->si->get_factory_uuid() == target_uuid) { - _panel_client.prepare (ic->id); + _panel_client.prepare(ic->id); SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n"; - ic->impl->si->process_helper_event (helper_uuid, trans); - _panel_client.send (); + ic->impl->si->process_helper_event(helper_uuid, trans); + _panel_client.send(); } } static void -panel_slot_move_preedit_caret (int context, int caret_pos) +panel_slot_move_preedit_caret(int context, int caret_pos) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->move_preedit_caret (caret_pos); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->move_preedit_caret(caret_pos); + _panel_client.send(); } } static void -panel_slot_select_candidate (int context, int cand_index) +panel_slot_select_candidate(int context, int cand_index) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->select_candidate (cand_index); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->select_candidate(cand_index); + _panel_client.send(); } } static void -panel_slot_process_key_event (int context, const KeyEvent &key) +panel_slot_process_key_event(int context, const KeyEvent &key) { - EcoreIMFContextISF *ic = find_ic (context); - SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; + EcoreIMFContextISF *ic = find_ic(context); + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n"; - if (ic && ic->impl && ic->impl->client_canvas) - feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE); + if (key.is_key_press()) + ecore_x_test_fake_key_press(key.get_key_string().c_str()); } static void -panel_slot_commit_string (int context, const WideString &wstr) +panel_slot_commit_string(int context, const WideString &wstr) { - EcoreIMFContextISF *ic = find_ic (context); - SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n"; + EcoreIMFContextISF *ic = find_ic(context); + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs(wstr) << " ic=" << ic << "\n"; if (ic && ic->impl) { if (_focused_ic != ic) return; - ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (wstr).c_str ()); + ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(wstr).c_str()); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); } } static void -panel_slot_forward_key_event (int context, const KeyEvent &key) +panel_slot_forward_key_event(int context, const KeyEvent &key) { - EcoreIMFContextISF *ic = find_ic (context); - SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; + EcoreIMFContextISF *ic = find_ic(context); + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n"; if (ic && ic->impl && ic->impl->client_canvas) - feed_key_event (ic->impl->client_canvas, key.get_key_string ().c_str (), EINA_TRUE); + feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_TRUE); } static void -panel_slot_request_help (int context) +panel_slot_request_help(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - panel_req_show_help (ic); - _panel_client.send (); + _panel_client.prepare(ic->id); + panel_req_show_help(ic); + _panel_client.send(); } } static void -panel_slot_request_factory_menu (int context) +panel_slot_request_factory_menu(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - panel_req_show_factory_menu (ic); - _panel_client.send (); + _panel_client.prepare(ic->id); + panel_req_show_factory_menu(ic); + _panel_client.send(); } } static void -panel_slot_change_factory (int context, const String &uuid) +panel_slot_change_factory(int context, const String &uuid) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n"; if (ic && ic->impl) { - ic->impl->si->reset (); - _panel_client.prepare (ic->id); - open_specific_factory (ic, uuid); - _panel_client.send (); + ic->impl->si->reset(); + _panel_client.prepare(ic->id); + open_specific_factory(ic, uuid); + _panel_client.send(); } } /* Panel Requestion functions. */ static void -panel_req_show_help (EcoreIMFContextISF *ic) +panel_req_show_help(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; String help; - help = String ("Smart Common Input Method platform ") + - //String (SCIM_VERSION) + - String ("\n(C) 2002-2005 James Su \n\n"); + help = String("Smart Common Input Method platform ") + + //String(SCIM_VERSION) + + String("\n(C) 2002-2005 James Su \n\n"); if (ic && ic->impl) { - IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid()); if (sf) { - help += utf8_wcstombs (sf->get_name ()); - help += String (":\n\n"); + help += utf8_wcstombs(sf->get_name()); + help += String(":\n\n"); - help += utf8_wcstombs (sf->get_help ()); - help += String ("\n\n"); + help += utf8_wcstombs(sf->get_help()); + help += String("\n\n"); - help += utf8_wcstombs (sf->get_credits ()); + help += utf8_wcstombs(sf->get_credits()); } - _panel_client.show_help (ic->id, help); + _panel_client.show_help(ic->id, help); } } static void -panel_req_show_factory_menu (EcoreIMFContextISF *ic) +panel_req_show_factory_menu(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; std::vector factories; std::vector menu; - _backend->get_factories_for_encoding (factories, "UTF-8"); + _backend->get_factories_for_encoding(factories, "UTF-8"); - for (size_t i = 0; i < factories.size (); ++ i) + for (size_t i = 0; i < factories.size(); ++ i) { - menu.push_back (PanelFactoryInfo ( - factories [i]->get_uuid (), - utf8_wcstombs (factories [i]->get_name ()), - factories [i]->get_language (), - factories [i]->get_icon_file ())); + menu.push_back(PanelFactoryInfo( + factories [i]->get_uuid(), + utf8_wcstombs(factories [i]->get_name()), + factories [i]->get_language(), + factories [i]->get_icon_file())); } - if (menu.size ()) - _panel_client.show_factory_menu (ic->id, menu); + if (menu.size()) + _panel_client.show_factory_menu(ic->id, menu); } static void -panel_req_update_factory_info (EcoreIMFContextISF *ic) +panel_req_update_factory_info(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1643,160 +1699,160 @@ panel_req_update_factory_info (EcoreIMFContextISF *ic) PanelFactoryInfo info; if (ic->impl->is_on) { - IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid()); if (sf) - info = PanelFactoryInfo (sf->get_uuid (), utf8_wcstombs (sf->get_name ()), sf->get_language (), sf->get_icon_file ()); + info = PanelFactoryInfo(sf->get_uuid(), utf8_wcstombs(sf->get_name()), sf->get_language(), sf->get_icon_file()); } else { - info = PanelFactoryInfo (String (""), String ("English/Keyboard"), String ("C"), ""); + info = PanelFactoryInfo(String(""), String("English/Keyboard"), String("C"), ""); } - _panel_client.update_factory_info (ic->id, info); + _panel_client.update_factory_info(ic->id, info); } } static void -panel_req_focus_in (EcoreIMFContextISF *ic) +panel_req_focus_in(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ()); + _panel_client.focus_in(ic->id, ic->impl->si->get_factory_uuid()); } static void -panel_req_update_spot_location (EcoreIMFContextISF *ic) +panel_req_update_spot_location(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _panel_client.update_spot_location (ic->id, ic->impl->cursor_x, ic->impl->cursor_y); + _panel_client.update_spot_location(ic->id, ic->impl->cursor_x, ic->impl->cursor_y); } static bool -filter_hotkeys (EcoreIMFContextISF *ic, const KeyEvent &key) +filter_hotkeys(EcoreIMFContextISF *ic, const KeyEvent &key) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; bool ret = false; - _frontend_hotkey_matcher.push_key_event (key); - _imengine_hotkey_matcher.push_key_event (key); + _frontend_hotkey_matcher.push_key_event(key); + _imengine_hotkey_matcher.push_key_event(key); - FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result (); + FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result(); if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER) { if (!ic->impl->is_on) - turn_on_ic (ic); + turn_on_ic(ic); else - turn_off_ic (ic); + turn_off_ic(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) { if (!ic->impl->is_on) - turn_on_ic (ic); + turn_on_ic(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF) { if (ic->impl->is_on) - turn_off_ic (ic); + turn_off_ic(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY) { - open_next_factory (ic); + open_next_factory(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY) { - open_previous_factory (ic); + open_previous_factory(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU) { - panel_req_show_factory_menu (ic); + panel_req_show_factory_menu(ic); ret = true; } - else if (_imengine_hotkey_matcher.is_matched ()) + else if (_imengine_hotkey_matcher.is_matched()) { - String sfid = _imengine_hotkey_matcher.get_match_result (); - open_specific_factory (ic, sfid); + String sfid = _imengine_hotkey_matcher.get_match_result(); + open_specific_factory(ic, sfid); ret = true; } return ret; } static bool -panel_initialize (void) +panel_initialize(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; String display_name; { - const char *p = getenv ("DISPLAY"); - if (p) display_name = String (p); + const char *p = getenv("DISPLAY"); + if (p) display_name = String(p); } - if (_panel_client.open_connection (_config->get_name (), display_name) >= 0) + if (_panel_client.open_connection(_config->get_name(), display_name) >= 0) { - int fd = _panel_client.get_connection_number (); + int fd = _panel_client.get_connection_number(); - _panel_iochannel_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL); + _panel_iochannel_read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL); SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n"; return true; } - std::cerr << "panel_initialize () failed!!!\n"; + std::cerr << "panel_initialize() failed!!!\n"; return false; } static void -panel_finalize (void) +panel_finalize(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _panel_client.close_connection (); + _panel_client.close_connection(); if (_panel_iochannel_read_handler) { - ecore_main_fd_handler_del (_panel_iochannel_read_handler); + ecore_main_fd_handler_del(_panel_iochannel_read_handler); _panel_iochannel_read_handler = 0; } if (_panel_iochannel_err_handler) { - ecore_main_fd_handler_del (_panel_iochannel_err_handler); + ecore_main_fd_handler_del(_panel_iochannel_err_handler); _panel_iochannel_err_handler = 0; } } static Eina_Bool -panel_iochannel_handler (void *data __UNUSED__, Ecore_Fd_Handler *fd_handler) +panel_iochannel_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (fd_handler == _panel_iochannel_read_handler) { - if (!_panel_client.filter_event ()) + if (!_panel_client.filter_event()) { - panel_finalize (); - panel_initialize (); + panel_finalize(); + panel_initialize(); return ECORE_CALLBACK_CANCEL; } } else if (fd_handler == _panel_iochannel_err_handler) { - panel_finalize (); - panel_initialize (); + panel_finalize(); + panel_initialize(); return ECORE_CALLBACK_CANCEL; } return ECORE_CALLBACK_RENEW; } static void -turn_on_ic (EcoreIMFContextISF *ic) +turn_on_ic(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1806,25 +1862,25 @@ turn_on_ic (EcoreIMFContextISF *ic) if (ic == _focused_ic) { - panel_req_focus_in (ic); - panel_req_update_spot_location (ic); - panel_req_update_factory_info (ic); - _panel_client.turn_on (ic->id); - _panel_client.hide_preedit_string (ic->id); - _panel_client.hide_aux_string (ic->id); - _panel_client.hide_lookup_table (ic->id); - ic->impl->si->focus_in (); + panel_req_focus_in(ic); + panel_req_update_spot_location(ic); + panel_req_update_factory_info(ic); + _panel_client.turn_on(ic->id); + _panel_client.hide_preedit_string(ic->id); + _panel_client.hide_aux_string(ic->id); + _panel_client.hide_lookup_table(ic->id); + ic->impl->si->focus_in(); } //Record the IC on/off status if (_shared_input_method) - _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); + _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); - if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + if (ic->impl->use_preedit && ic->impl->preedit_string.length()) { - ecore_imf_context_preedit_start_event_add (ic->ctx); + ecore_imf_context_preedit_start_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); ic->impl->preedit_started = true; } @@ -1832,7 +1888,7 @@ turn_on_ic (EcoreIMFContextISF *ic) } static void -turn_off_ic (EcoreIMFContextISF *ic) +turn_off_ic(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1842,21 +1898,21 @@ turn_off_ic (EcoreIMFContextISF *ic) if (ic == _focused_ic) { - ic->impl->si->focus_out (); + ic->impl->si->focus_out(); - panel_req_update_factory_info (ic); - _panel_client.turn_off (ic->id); + panel_req_update_factory_info(ic); + _panel_client.turn_off(ic->id); } //Record the IC on/off status if (_shared_input_method) - _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); + _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); - if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + if (ic->impl->use_preedit && ic->impl->preedit_string.length()) { - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); - ecore_imf_context_preedit_end_event_add (ic->ctx); + ecore_imf_context_preedit_end_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); ic->impl->preedit_started = false; } @@ -1864,7 +1920,7 @@ turn_off_ic (EcoreIMFContextISF *ic) } static void -set_ic_capabilities (EcoreIMFContextISF *ic) +set_ic_capabilities(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1875,12 +1931,12 @@ set_ic_capabilities (EcoreIMFContextISF *ic) if (!_on_the_spot || !ic->impl->use_preedit) cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT; - ic->impl->si->update_client_capabilities (cap); + ic->impl->si->update_client_capabilities(cap); } } static bool -check_socket_frontend (void) +check_socket_frontend(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1889,23 +1945,23 @@ check_socket_frontend (void) uint32 magic; - address.set_address (scim_get_default_socket_frontend_address ()); + address.set_address(scim_get_default_socket_frontend_address()); - if (!client.connect (address)) + if (!client.connect(address)) return false; - if (!scim_socket_open_connection (magic, - String ("ConnectionTester"), - String ("SocketFrontEnd"), - client, - 1000)) + if (!scim_socket_open_connection(magic, + String("ConnectionTester"), + String("SocketFrontEnd"), + client, + 1000)) return false; return true; } void -initialize (void) +initialize(void) { std::vector config_list; std::vector engine_list; @@ -1924,31 +1980,31 @@ initialize (void) SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n"; // Get system language. - _language = scim_get_locale_language (scim_get_current_locale ()); + _language = scim_get_locale_language(scim_get_current_locale()); if (socket) { // If no Socket FrontEnd is running, then launch one. // And set manual to false. - bool check_result = check_socket_frontend (); + bool check_result = check_socket_frontend(); if (!check_result) { std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n"; //get modules list - scim_get_imengine_module_list (engine_list); + scim_get_imengine_module_list(engine_list); - for (it = engine_list.begin (); it != engine_list.end (); it++) + for (it = engine_list.begin(); it != engine_list.end(); it++) { if (*it != "socket") - load_engine_list.push_back (*it); + load_engine_list.push_back(*it); } const char *new_argv [] = { "--no-stay", 0 }; - scim_launch (true, - config_module_name, - (load_engine_list.size () ? scim_combine_string_list (load_engine_list, ',') : "none"), - "socket", - (char **)new_argv); + scim_launch(true, + config_module_name, + (load_engine_list.size() ? scim_combine_string_list(load_engine_list, ',') : "none"), + "socket", + (char **)new_argv); manual = false; } @@ -1961,12 +2017,12 @@ initialize (void) if (check_result) { config_module_name = "socket"; - load_engine_list.clear (); - load_engine_list.push_back ("socket"); + load_engine_list.clear(); + load_engine_list.push_back("socket"); break; } - scim_usleep (50000); - check_result = check_socket_frontend (); + scim_usleep(50000); + check_result = check_socket_frontend(); } } } @@ -1975,69 +2031,69 @@ initialize (void) { //load config module SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n"; - _config_module = new ConfigModule (config_module_name); + _config_module = new ConfigModule(config_module_name); //create config instance - if (_config_module != NULL && _config_module->valid ()) - _config = _config_module->create_config (); + if (_config_module != NULL && _config_module->valid()) + _config = _config_module->create_config(); } - if (_config.null ()) + if (_config.null()) { SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n"; if (_config_module) delete _config_module; _config_module = NULL; - _config = new DummyConfig (); + _config = new DummyConfig(); config_module_name = "dummy"; } - reload_config_callback (_config); - _config->signal_connect_reload (slot (reload_config_callback)); + reload_config_callback(_config); + _config->signal_connect_reload(slot(reload_config_callback)); // create backend - _backend = new CommonBackEnd (_config, load_engine_list.size () ? load_engine_list : engine_list); + _backend = new CommonBackEnd(_config, load_engine_list.size() ? load_engine_list : engine_list); - if (_backend.null ()) + if (_backend.null()) std::cerr << "Cannot create BackEnd Object!\n"; else - _fallback_factory = _backend->get_factory (SCIM_COMPOSE_KEY_FACTORY_UUID); + _fallback_factory = _backend->get_factory(SCIM_COMPOSE_KEY_FACTORY_UUID); - if (_fallback_factory.null ()) - _fallback_factory = new DummyIMEngineFactory (); + if (_fallback_factory.null()) + _fallback_factory = new DummyIMEngineFactory(); - _fallback_instance = _fallback_factory->create_instance (String ("UTF-8"), 0); - _fallback_instance->signal_connect_commit_string (slot (fallback_commit_string_cb)); + _fallback_instance = _fallback_factory->create_instance(String("UTF-8"), 0); + _fallback_instance->signal_connect_commit_string(slot(fallback_commit_string_cb)); // Attach Panel Client signal. - _panel_client.signal_connect_reload_config (slot (panel_slot_reload_config)); - _panel_client.signal_connect_exit (slot (panel_slot_exit)); - _panel_client.signal_connect_update_lookup_table_page_size (slot (panel_slot_update_lookup_table_page_size)); - _panel_client.signal_connect_lookup_table_page_up (slot (panel_slot_lookup_table_page_up)); - _panel_client.signal_connect_lookup_table_page_down (slot (panel_slot_lookup_table_page_down)); - _panel_client.signal_connect_trigger_property (slot (panel_slot_trigger_property)); - _panel_client.signal_connect_process_helper_event (slot (panel_slot_process_helper_event)); - _panel_client.signal_connect_move_preedit_caret (slot (panel_slot_move_preedit_caret)); - _panel_client.signal_connect_select_candidate (slot (panel_slot_select_candidate)); - _panel_client.signal_connect_process_key_event (slot (panel_slot_process_key_event)); - _panel_client.signal_connect_commit_string (slot (panel_slot_commit_string)); - _panel_client.signal_connect_forward_key_event (slot (panel_slot_forward_key_event)); - _panel_client.signal_connect_request_help (slot (panel_slot_request_help)); - _panel_client.signal_connect_request_factory_menu (slot (panel_slot_request_factory_menu)); - _panel_client.signal_connect_change_factory (slot (panel_slot_change_factory)); - - if (!panel_initialize ()) + _panel_client.signal_connect_reload_config (slot(panel_slot_reload_config)); + _panel_client.signal_connect_exit (slot(panel_slot_exit)); + _panel_client.signal_connect_update_lookup_table_page_size(slot(panel_slot_update_lookup_table_page_size)); + _panel_client.signal_connect_lookup_table_page_up (slot(panel_slot_lookup_table_page_up)); + _panel_client.signal_connect_lookup_table_page_down (slot(panel_slot_lookup_table_page_down)); + _panel_client.signal_connect_trigger_property (slot(panel_slot_trigger_property)); + _panel_client.signal_connect_process_helper_event (slot(panel_slot_process_helper_event)); + _panel_client.signal_connect_move_preedit_caret (slot(panel_slot_move_preedit_caret)); + _panel_client.signal_connect_select_candidate (slot(panel_slot_select_candidate)); + _panel_client.signal_connect_process_key_event (slot(panel_slot_process_key_event)); + _panel_client.signal_connect_commit_string (slot(panel_slot_commit_string)); + _panel_client.signal_connect_forward_key_event (slot(panel_slot_forward_key_event)); + _panel_client.signal_connect_request_help (slot(panel_slot_request_help)); + _panel_client.signal_connect_request_factory_menu (slot(panel_slot_request_factory_menu)); + _panel_client.signal_connect_change_factory (slot(panel_slot_change_factory)); + + if (!panel_initialize()) std::cerr << "Ecore IM Module: Cannot connect to Panel!\n"; } static void -finalize (void) +finalize(void) { SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n"; // Reset this first so that the shared instance could be released correctly afterwards. - _default_instance.reset (); + _default_instance.reset(); SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n"; while (_used_ic_impl_list) @@ -2045,20 +2101,20 @@ finalize (void) // In case in "shared input method" mode, // all contexts share only one instance, // so we need point the reference pointer correctly before finalizing. - _used_ic_impl_list->si->set_frontend_data (static_cast (_used_ic_impl_list->parent)); - isf_imf_context_del (_used_ic_impl_list->parent->ctx); + _used_ic_impl_list->si->set_frontend_data(static_cast (_used_ic_impl_list->parent)); + isf_imf_context_del(_used_ic_impl_list->parent->ctx); } - delete_all_ic_impl (); + delete_all_ic_impl(); - _fallback_instance.reset (); - _fallback_factory.reset (); + _fallback_instance.reset(); + _fallback_factory.reset(); SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n"; - _backend.reset (); + _backend.reset(); SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n"; - _config.reset (); + _config.reset(); if (_config_module) { @@ -2072,27 +2128,27 @@ finalize (void) _scim_initialized = false; - panel_finalize (); + panel_finalize(); } static void -open_next_factory (EcoreIMFContextISF *ic) +open_next_factory(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; - IMEngineFactoryPointer sf = _backend->get_next_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_next_factory("", "UTF-8", ic->impl->si->get_factory_uuid()); - if (!sf.null ()) + if (!sf.null()) { - turn_off_ic (ic); - ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); - ic->impl->si->set_frontend_data (static_cast (ic)); - ic->impl->preedit_string = WideString (); + turn_off_ic(ic); + ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id()); + ic->impl->si->set_frontend_data(static_cast (ic)); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - attach_instance (ic->impl->si); - _backend->set_default_factory (_language, sf->get_uuid ()); - _panel_client.register_input_context (ic->id, sf->get_uuid ()); - set_ic_capabilities (ic); - turn_on_ic (ic); + attach_instance(ic->impl->si); + _backend->set_default_factory(_language, sf->get_uuid()); + _panel_client.register_input_context(ic->id, sf->get_uuid()); + set_ic_capabilities(ic); + turn_on_ic(ic); if (_shared_input_method) { @@ -2103,26 +2159,26 @@ open_next_factory (EcoreIMFContextISF *ic) } static void -open_previous_factory (EcoreIMFContextISF *ic) +open_previous_factory(EcoreIMFContextISF *ic) { if (ic == NULL) return; SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; - IMEngineFactoryPointer sf = _backend->get_previous_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_previous_factory("", "UTF-8", ic->impl->si->get_factory_uuid()); - if (!sf.null ()) + if (!sf.null()) { - turn_off_ic (ic); - ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); - ic->impl->si->set_frontend_data (static_cast (ic)); - ic->impl->preedit_string = WideString (); + turn_off_ic(ic); + ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id()); + ic->impl->si->set_frontend_data(static_cast (ic)); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - attach_instance (ic->impl->si); - _backend->set_default_factory (_language, sf->get_uuid ()); - _panel_client.register_input_context (ic->id, sf->get_uuid ()); - set_ic_capabilities (ic); - turn_on_ic (ic); + attach_instance(ic->impl->si); + _backend->set_default_factory(_language, sf->get_uuid()); + _panel_client.register_input_context(ic->id, sf->get_uuid()); + set_ic_capabilities(ic); + turn_on_ic(ic); if (_shared_input_method) { @@ -2133,7 +2189,7 @@ open_previous_factory (EcoreIMFContextISF *ic) } static void -open_specific_factory (EcoreIMFContextISF *ic, +open_specific_factory(EcoreIMFContextISF *ic, const String &uuid) { if (ic == NULL) @@ -2142,26 +2198,26 @@ open_specific_factory (EcoreIMFContextISF *ic, SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; // The same input method is selected, just turn on the IC. - if (ic->impl->si->get_factory_uuid () == uuid) + if (ic->impl->si->get_factory_uuid() == uuid) { - turn_on_ic (ic); + turn_on_ic(ic); return; } - IMEngineFactoryPointer sf = _backend->get_factory (uuid); + IMEngineFactoryPointer sf = _backend->get_factory(uuid); - if (uuid.length () && !sf.null ()) + if (uuid.length() && !sf.null()) { - turn_off_ic (ic); - ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); - ic->impl->si->set_frontend_data (static_cast (ic)); - ic->impl->preedit_string = WideString (); + turn_off_ic(ic); + ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id()); + ic->impl->si->set_frontend_data(static_cast (ic)); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - attach_instance (ic->impl->si); - _backend->set_default_factory (_language, sf->get_uuid ()); - _panel_client.register_input_context (ic->id, sf->get_uuid ()); - set_ic_capabilities (ic); - turn_on_ic (ic); + attach_instance(ic->impl->si); + _backend->set_default_factory(_language, sf->get_uuid()); + _panel_client.register_input_context(ic->id, sf->get_uuid()); + set_ic_capabilities(ic); + turn_on_ic(ic); if (_shared_input_method) { @@ -2171,29 +2227,29 @@ open_specific_factory (EcoreIMFContextISF *ic, } else { - // turn_off_ic comment out panel_req_update_factory_info () - turn_off_ic (ic); + // turn_off_ic comment out panel_req_update_factory_info() + turn_off_ic(ic); if (ic && ic->impl->is_on) { ic->impl->is_on = false; if (ic == _focused_ic) { - ic->impl->si->focus_out (); + ic->impl->si->focus_out(); - panel_req_update_factory_info (ic); - _panel_client.turn_off (ic->id); + panel_req_update_factory_info(ic); + _panel_client.turn_off(ic->id); } //Record the IC on/off status if (_shared_input_method) - _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); + _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); - if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + if (ic->impl->use_preedit && ic->impl->preedit_string.length()) { - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); - ecore_imf_context_preedit_end_event_add (ic->ctx); + ecore_imf_context_preedit_end_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); ic->impl->preedit_started = false; } @@ -2201,7 +2257,7 @@ open_specific_factory (EcoreIMFContextISF *ic, } } -static void initialize_modifier_bits (Display *display) +static void initialize_modifier_bits(Display *display) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -2222,21 +2278,21 @@ static void initialize_modifier_bits (Display *display) XModifierKeymap *mods = NULL; - ::KeyCode ctrl_l = XKeysymToKeycode (display, XK_Control_L); - ::KeyCode ctrl_r = XKeysymToKeycode (display, XK_Control_R); - ::KeyCode meta_l = XKeysymToKeycode (display, XK_Meta_L); - ::KeyCode meta_r = XKeysymToKeycode (display, XK_Meta_R); - ::KeyCode alt_l = XKeysymToKeycode (display, XK_Alt_L); - ::KeyCode alt_r = XKeysymToKeycode (display, XK_Alt_R); - ::KeyCode super_l = XKeysymToKeycode (display, XK_Super_L); - ::KeyCode super_r = XKeysymToKeycode (display, XK_Super_R); - ::KeyCode hyper_l = XKeysymToKeycode (display, XK_Hyper_L); - ::KeyCode hyper_r = XKeysymToKeycode (display, XK_Hyper_R); - ::KeyCode numlock = XKeysymToKeycode (display, XK_Num_Lock); + ::KeyCode ctrl_l = XKeysymToKeycode(display, XK_Control_L); + ::KeyCode ctrl_r = XKeysymToKeycode(display, XK_Control_R); + ::KeyCode meta_l = XKeysymToKeycode(display, XK_Meta_L); + ::KeyCode meta_r = XKeysymToKeycode(display, XK_Meta_R); + ::KeyCode alt_l = XKeysymToKeycode(display, XK_Alt_L); + ::KeyCode alt_r = XKeysymToKeycode(display, XK_Alt_R); + ::KeyCode super_l = XKeysymToKeycode(display, XK_Super_L); + ::KeyCode super_r = XKeysymToKeycode(display, XK_Super_R); + ::KeyCode hyper_l = XKeysymToKeycode(display, XK_Hyper_L); + ::KeyCode hyper_r = XKeysymToKeycode(display, XK_Hyper_R); + ::KeyCode numlock = XKeysymToKeycode(display, XK_Num_Lock); int i, j; - mods = XGetModifierMapping (display); + mods = XGetModifierMapping(display); if (mods == NULL) return; @@ -2283,13 +2339,13 @@ static void initialize_modifier_bits (Display *display) xkey.same_screen = False; xkey.subwindow = None; xkey.window = None; - xkey.root = DefaultRootWindow (display); + xkey.root = DefaultRootWindow(display); xkey.state = ShiftMask; xkey.keycode = meta_l; - XLookupString (&xkey, buf, 32, &keysym_l, 0); + XLookupString(&xkey, buf, 32, &keysym_l, 0); xkey.keycode = meta_r; - XLookupString (&xkey, buf, 32, &keysym_r, 0); + XLookupString(&xkey, buf, 32, &keysym_r, 0); if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R)) __current_meta_mask = ShiftMask + __current_alt_mask; @@ -2297,16 +2353,16 @@ static void initialize_modifier_bits (Display *display) __current_meta_mask = ShiftMask + ControlMask; } - XFreeModifiermap (mods); + XFreeModifiermap(mods); } -static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask) +static unsigned int scim_x11_keymask_scim_to_x11(Display *display, uint16 scimkeymask) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; unsigned int state = 0; - initialize_modifier_bits (display); + initialize_modifier_bits(display); if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask; if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask; @@ -2320,9 +2376,9 @@ static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimk return state; } -static XKeyEvent createKeyEvent (Display *display, Window &win, - Window &winRoot, bool press, - int keycode, int modifiers) +static XKeyEvent createKeyEvent(Display *display, Window &win, + Window &winRoot, bool press, + int keycode, int modifiers) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -2339,7 +2395,7 @@ static XKeyEvent createKeyEvent (Display *display, Window &win, event.y_root = 1; event.same_screen = EINA_TRUE; event.state = modifiers; - event.keycode = XKeysymToKeycode (display, keycode); + event.keycode = XKeysymToKeycode(display, keycode); if (press) event.type = KeyPress; else @@ -2350,12 +2406,12 @@ static XKeyEvent createKeyEvent (Display *display, Window &win, return event; } -static void _x_send_key_event (const KeyEvent &key) +static void _x_send_key_event(const KeyEvent &key) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; // Obtain the X11 display. - Display *display = XOpenDisplay (NULL); + Display *display = XOpenDisplay(NULL); if (display == NULL) { std::cerr << "XOpenDisplay failed\n"; @@ -2363,98 +2419,98 @@ static void _x_send_key_event (const KeyEvent &key) } // Get the root window for the current display. - Window winRoot = 0;// = XRootWindow (display, 1); + Window winRoot = 0; // Find the window which has the current keyboard focus. Window winFocus = 0; int revert = RevertToParent; - XGetInputFocus (display, &winFocus, &revert); + XGetInputFocus(display, &winFocus, &revert); // Send a fake key press event to the window. - XSelectInput (display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); - XMapWindow (display, winFocus); + XSelectInput(display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); + XMapWindow(display, winFocus); - unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask); + unsigned int modifier = scim_x11_keymask_scim_to_x11(display, key.mask); XKeyEvent event; - if (key.is_key_press ()) + if (key.is_key_press()) { - event = createKeyEvent (display, winFocus, winRoot, true, key.code, modifier); - XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event); + event = createKeyEvent(display, winFocus, winRoot, true, key.code, modifier); + XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event); } else { - event = createKeyEvent (display, winFocus, winRoot, false, key.code, modifier); - XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event); + event = createKeyEvent(display, winFocus, winRoot, false, key.code, modifier); + XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event); } - XCloseDisplay (display); + XCloseDisplay(display); } static void -attach_instance (const IMEngineInstancePointer &si) +attach_instance(const IMEngineInstancePointer &si) { - si->signal_connect_show_preedit_string ( - slot (slot_show_preedit_string)); - si->signal_connect_show_aux_string ( - slot (slot_show_aux_string)); - si->signal_connect_show_lookup_table ( - slot (slot_show_lookup_table)); + si->signal_connect_show_preedit_string( + slot(slot_show_preedit_string)); + si->signal_connect_show_aux_string( + slot(slot_show_aux_string)); + si->signal_connect_show_lookup_table( + slot(slot_show_lookup_table)); - si->signal_connect_hide_preedit_string ( - slot (slot_hide_preedit_string)); - si->signal_connect_hide_aux_string ( - slot (slot_hide_aux_string)); - si->signal_connect_hide_lookup_table ( - slot (slot_hide_lookup_table)); + si->signal_connect_hide_preedit_string( + slot(slot_hide_preedit_string)); + si->signal_connect_hide_aux_string( + slot(slot_hide_aux_string)); + si->signal_connect_hide_lookup_table( + slot(slot_hide_lookup_table)); - si->signal_connect_update_preedit_caret ( - slot (slot_update_preedit_caret)); - si->signal_connect_update_preedit_string ( - slot (slot_update_preedit_string)); - si->signal_connect_update_aux_string ( - slot (slot_update_aux_string)); - si->signal_connect_update_lookup_table ( - slot (slot_update_lookup_table)); + si->signal_connect_update_preedit_caret( + slot(slot_update_preedit_caret)); + si->signal_connect_update_preedit_string( + slot(slot_update_preedit_string)); + si->signal_connect_update_aux_string( + slot(slot_update_aux_string)); + si->signal_connect_update_lookup_table( + slot(slot_update_lookup_table)); - si->signal_connect_commit_string ( - slot (slot_commit_string)); + si->signal_connect_commit_string( + slot(slot_commit_string)); - si->signal_connect_forward_key_event ( - slot (slot_forward_key_event)); + si->signal_connect_forward_key_event( + slot(slot_forward_key_event)); - si->signal_connect_register_properties ( - slot (slot_register_properties)); + si->signal_connect_register_properties( + slot(slot_register_properties)); - si->signal_connect_update_property ( - slot (slot_update_property)); + si->signal_connect_update_property( + slot(slot_update_property)); - si->signal_connect_beep ( - slot (slot_beep)); + si->signal_connect_beep( + slot(slot_beep)); - si->signal_connect_start_helper ( - slot (slot_start_helper)); + si->signal_connect_start_helper( + slot(slot_start_helper)); - si->signal_connect_stop_helper ( - slot (slot_stop_helper)); + si->signal_connect_stop_helper( + slot(slot_stop_helper)); - si->signal_connect_send_helper_event ( - slot (slot_send_helper_event)); + si->signal_connect_send_helper_event( + slot(slot_send_helper_event)); - si->signal_connect_get_surrounding_text ( - slot (slot_get_surrounding_text)); + si->signal_connect_get_surrounding_text( + slot(slot_get_surrounding_text)); - si->signal_connect_delete_surrounding_text ( - slot (slot_delete_surrounding_text)); + si->signal_connect_delete_surrounding_text( + slot(slot_delete_surrounding_text)); } // Implementation of slot functions static void -slot_show_preedit_string (IMEngineInstanceBase *si) +slot_show_preedit_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { @@ -2462,102 +2518,102 @@ slot_show_preedit_string (IMEngineInstanceBase *si) { if (!ic->impl->preedit_started) { - ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); + ecore_imf_context_preedit_start_event_add(_focused_ic->ctx); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); ic->impl->preedit_started = true; } } else - _panel_client.show_preedit_string (ic->id); + _panel_client.show_preedit_string(ic->id); } } static void -slot_show_aux_string (IMEngineInstanceBase *si) +slot_show_aux_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.show_aux_string (ic->id); + _panel_client.show_aux_string(ic->id); } static void -slot_show_lookup_table (IMEngineInstanceBase *si) +slot_show_lookup_table(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.show_lookup_table (ic->id); + _panel_client.show_lookup_table(ic->id); } static void -slot_hide_preedit_string (IMEngineInstanceBase *si) +slot_hide_preedit_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { bool emit = false; - if (ic->impl->preedit_string.length ()) + if (ic->impl->preedit_string.length()) { - ic->impl->preedit_string = WideString (); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - ic->impl->preedit_attrlist.clear (); + ic->impl->preedit_attrlist.clear(); emit = true; } if (ic->impl->use_preedit) { if (emit) { - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } if (ic->impl->preedit_started) { - ecore_imf_context_preedit_end_event_add (ic->ctx); + ecore_imf_context_preedit_end_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); ic->impl->preedit_started = false; } } else - _panel_client.hide_preedit_string (ic->id); + _panel_client.hide_preedit_string(ic->id); } } static void -slot_hide_aux_string (IMEngineInstanceBase *si) +slot_hide_aux_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.hide_aux_string (ic->id); + _panel_client.hide_aux_string(ic->id); } static void -slot_hide_lookup_table (IMEngineInstanceBase *si) +slot_hide_lookup_table(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.hide_lookup_table (ic->id); + _panel_client.hide_lookup_table(ic->id); } static void -slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) +slot_update_preedit_caret(IMEngineInstanceBase *si, int caret) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) { @@ -2566,28 +2622,28 @@ slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) { if (!ic->impl->preedit_started) { - ecore_imf_context_preedit_start_event_add (ic->ctx); + ecore_imf_context_preedit_start_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); ic->impl->preedit_started = true; } - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } else - _panel_client.update_preedit_caret (ic->id, caret); + _panel_client.update_preedit_caret(ic->id, caret); } } static void -slot_update_preedit_string (IMEngineInstanceBase *si, +slot_update_preedit_string(IMEngineInstanceBase *si, const WideString & str, const AttributeList & attrs) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); - if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ())) + if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length())) { ic->impl->preedit_string = str; ic->impl->preedit_attrlist = attrs; @@ -2595,178 +2651,178 @@ slot_update_preedit_string (IMEngineInstanceBase *si, { if (!ic->impl->preedit_started) { - ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); + ecore_imf_context_preedit_start_event_add(_focused_ic->ctx); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); ic->impl->preedit_started = true; } - ic->impl->preedit_caret = str.length (); + ic->impl->preedit_caret = str.length(); ic->impl->preedit_updating = true; - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); ic->impl->preedit_updating = false; } else { - _panel_client.update_preedit_string (ic->id, str, attrs); + _panel_client.update_preedit_string(ic->id, str, attrs); } } } static void -slot_update_aux_string (IMEngineInstanceBase *si, +slot_update_aux_string(IMEngineInstanceBase *si, const WideString & str, const AttributeList & attrs) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.update_aux_string (ic->id, str, attrs); + _panel_client.update_aux_string(ic->id, str, attrs); } static void -slot_commit_string (IMEngineInstanceBase *si, +slot_commit_string(IMEngineInstanceBase *si, const WideString & str) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->ctx) { - ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (str).c_str ()); + ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(str).c_str()); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); } } static void -slot_forward_key_event (IMEngineInstanceBase *si, +slot_forward_key_event(IMEngineInstanceBase *si, const KeyEvent & key) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && _focused_ic == ic) { - if (!_fallback_instance->process_key_event (key)) + if (!_fallback_instance->process_key_event(key)) _x_send_key_event(key); } } static void -slot_update_lookup_table (IMEngineInstanceBase *si, +slot_update_lookup_table(IMEngineInstanceBase *si, const LookupTable & table) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.update_lookup_table (ic->id, table); + _panel_client.update_lookup_table(ic->id, table); } static void -slot_register_properties (IMEngineInstanceBase *si, - const PropertyList & properties) +slot_register_properties(IMEngineInstanceBase *si, + const PropertyList & properties) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.register_properties (ic->id, properties); + _panel_client.register_properties(ic->id, properties); } static void -slot_update_property (IMEngineInstanceBase *si, - const Property & property) +slot_update_property(IMEngineInstanceBase *si, + const Property & property) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.update_property (ic->id, property); + _panel_client.update_property(ic->id, property); } static void -slot_beep (IMEngineInstanceBase *si __UNUSED__) +slot_beep(IMEngineInstanceBase *si __UNUSED__) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; } static void -slot_start_helper (IMEngineInstanceBase *si, - const String &helper_uuid) +slot_start_helper(IMEngineInstanceBase *si, + const String &helper_uuid) { - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic - << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; + << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid() : "") << "...\n"; if (ic && ic->impl) - _panel_client.start_helper (ic->id, helper_uuid); + _panel_client.start_helper(ic->id, helper_uuid); } static void -slot_stop_helper (IMEngineInstanceBase *si, - const String &helper_uuid) +slot_stop_helper(IMEngineInstanceBase *si, + const String &helper_uuid) { - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n"; if (ic && ic->impl) - _panel_client.stop_helper (ic->id, helper_uuid); + _panel_client.stop_helper(ic->id, helper_uuid); } static void -slot_send_helper_event (IMEngineInstanceBase *si, - const String &helper_uuid, - const Transaction &trans) +slot_send_helper_event(IMEngineInstanceBase *si, + const String &helper_uuid, + const Transaction &trans) { - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic - << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; + << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid() : "") << "...\n"; if (ic && ic->impl) - _panel_client.send_helper_event (ic->id, helper_uuid, trans); + _panel_client.send_helper_event(ic->id, helper_uuid, trans); } static bool -slot_get_surrounding_text (IMEngineInstanceBase *si, - WideString &text, - int &cursor, - int maxlen_before, - int maxlen_after) +slot_get_surrounding_text(IMEngineInstanceBase *si, + WideString &text, + int &cursor, + int maxlen_before, + int maxlen_after) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { char *surrounding = NULL; int cursor_index; - if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index)) + if (ecore_imf_context_surrounding_get(_focused_ic->ctx, &surrounding, &cursor_index)) { SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n"; SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n"; - WideString before (utf8_mbstowcs (String (surrounding, surrounding + cursor_index))); - WideString after (utf8_mbstowcs (String (surrounding + cursor_index))); - if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length ()) - before = WideString (before.begin () + (before.length () - maxlen_before), before.end ()); - else if (maxlen_before == 0) before = WideString (); - if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length ()) - after = WideString (after.begin (), after.begin () + maxlen_after); - else if (maxlen_after == 0) after = WideString (); + WideString before(utf8_mbstowcs(String(surrounding, surrounding + cursor_index))); + WideString after(utf8_mbstowcs(String(surrounding + cursor_index))); + if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length()) + before = WideString(before.begin() + (before.length() - maxlen_before), before.end()); + else if (maxlen_before == 0) before = WideString(); + if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length()) + after = WideString(after.begin(), after.begin() + maxlen_after); + else if (maxlen_after == 0) after = WideString(); text = before + after; - cursor = before.length (); + cursor = before.length(); return true; } } @@ -2774,13 +2830,13 @@ slot_get_surrounding_text (IMEngineInstanceBase *si, } static bool -slot_delete_surrounding_text (IMEngineInstanceBase *si, - int offset, - int len) +slot_delete_surrounding_text(IMEngineInstanceBase *si, + int offset, + int len) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { @@ -2788,7 +2844,7 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si, ev.ctx = _focused_ic->ctx; ev.n_chars = len; ev.offset = offset; - ecore_imf_context_delete_surrounding_event_add (_focused_ic->ctx, offset, len); + ecore_imf_context_delete_surrounding_event_add(_focused_ic->ctx, offset, len); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev); return true; } @@ -2796,43 +2852,43 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si, } static void -reload_config_callback (const ConfigPointer &config) +reload_config_callback(const ConfigPointer &config) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _frontend_hotkey_matcher.load_hotkeys (config); - _imengine_hotkey_matcher.load_hotkeys (config); + _frontend_hotkey_matcher.load_hotkeys(config); + _imengine_hotkey_matcher.load_hotkeys(config); KeyEvent key; - scim_string_to_key (key, - config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK), - String ("Shift+Control+Alt+Lock"))); + scim_string_to_key(key, + config->read(String(SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK), + String("Shift+Control+Alt+Lock"))); _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF; _valid_key_mask |= SCIM_KEY_ReleaseMask; // Special treatment for two backslash keys on jp106 keyboard. _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask; - _on_the_spot = config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); - _shared_input_method = config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); + _on_the_spot = config->read(String(SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); + _shared_input_method = config->read(String(SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); // Get keyboard layout setting // Flush the global config first, in order to load the new configs from disk. - scim_global_config_flush (); + scim_global_config_flush(); - _keyboard_layout = scim_get_default_keyboard_layout (); + _keyboard_layout = scim_get_default_keyboard_layout(); } static void -fallback_commit_string_cb (IMEngineInstanceBase *si __UNUSED__, - const WideString &str) +fallback_commit_string_cb(IMEngineInstanceBase *si __UNUSED__, + const WideString &str) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (_focused_ic && _focused_ic->impl) { - ecore_imf_context_commit_event_add (_focused_ic->ctx, utf8_wcstombs (str).c_str ()); + ecore_imf_context_commit_event_add(_focused_ic->ctx, utf8_wcstombs(str).c_str()); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); } } diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h index 84f1a2f..72533e2 100644 --- a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h +++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h @@ -32,6 +32,8 @@ Eina_Bool isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction); void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type); void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout); +void isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx); +void isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx); EcoreIMFContextISF* isf_imf_context_new (void); void isf_imf_context_shutdown (void); diff --git a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp index eff6381..d17e37a 100644 --- a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp +++ b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp @@ -19,8 +19,8 @@ extern "C" isf_imf_context_del, /* del */ isf_imf_context_client_window_set, /* client_window_set */ isf_imf_context_client_canvas_set, /* client_canvas_set */ - NULL, /* isf_imf_context_input_panel_show, - show */ - NULL, /* isf_imf_context_input_panel_hide, - hide */ + isf_imf_context_input_panel_show, /* input_panel_show, - show */ + isf_imf_context_input_panel_hide, /* input_panel_hide, - hide */ isf_imf_context_preedit_string_get, /* get_preedit_string */ isf_imf_context_focus_in, /* focus_in */ isf_imf_context_focus_out, /* focus_out */ @@ -38,7 +38,12 @@ extern "C" NULL, /* isf_imf_context_input_panel_layout_get, */ NULL, /* isf_imf_context_input_panel_language_set, */ NULL, /* isf_imf_context_input_panel_language_get, */ - isf_imf_context_cursor_location_set /* cursor_location_set */ + isf_imf_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 */ }; static Ecore_IMF_Context *imf_module_create (void); diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.in b/libraries/ecore/src/modules/immodules/xim/Makefile.in index 5b78946..775b574 100644 --- a/libraries/ecore/src/modules/immodules/xim/Makefile.in +++ b/libraries/ecore/src/modules/immodules/xim/Makefile.in @@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -189,6 +188,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -244,6 +245,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -254,6 +257,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c index ea7ee7f..01a3576 100644 --- a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c +++ b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c @@ -294,6 +294,10 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx) imf_context_data = ecore_imf_context_data_get(ctx); ic = imf_context_data->ic; imf_context_data->has_focus = EINA_TRUE; + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_show(ctx); + if (ic) { char *str; @@ -326,6 +330,9 @@ _ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx) ic = imf_context_data->ic; if (ic) XUnsetICFocus(ic); + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_hide(ctx); } #else (void)ctx; @@ -501,6 +508,38 @@ _ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx, (void)(w); // yes w is unused, but only a bi-product of the algorithm } +static void +_ecore_imf_context_xim_input_panel_show(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + ecore_x_e_virtual_keyboard_state_set + (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); +#else + (void)ctx; +#endif +} + +static void +_ecore_imf_context_xim_input_panel_hide(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + ecore_x_e_virtual_keyboard_state_set + (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); +#else + (void)ctx; +#endif +} + #ifdef ENABLE_XIM static unsigned int _ecore_x_event_reverse_modifiers(unsigned int state) @@ -739,8 +778,8 @@ static Ecore_IMF_Context_Class xim_class = { .del = _ecore_imf_context_xim_del, .client_window_set = _ecore_imf_context_xim_client_window_set, .client_canvas_set = NULL, - .show = NULL, - .hide = NULL, + .show = _ecore_imf_context_xim_input_panel_show, + .hide = _ecore_imf_context_xim_input_panel_hide, .preedit_string_get = _ecore_imf_context_xim_preedit_string_get, .focus_in = _ecore_imf_context_xim_focus_in, .focus_out = _ecore_imf_context_xim_focus_out, @@ -759,6 +798,11 @@ static Ecore_IMF_Context_Class xim_class = { .input_panel_language_set = NULL, .input_panel_language_get = NULL, .cursor_location_set = _ecore_imf_context_xim_cursor_location_set, + .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 }; static Ecore_IMF_Context * -- cgit v1.1