aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/modules/immodules/scim
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/modules/immodules/scim')
-rw-r--r--libraries/ecore/src/modules/immodules/scim/Makefile.in20
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp1348
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_imcontext.h2
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_module.cpp11
4 files changed, 724 insertions, 657 deletions
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 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4) 58 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 59mkinstalldirs = $(install_sh) -d
61CONFIG_HEADER = $(top_builddir)/config.h 60CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES = 61CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES = 62CONFIG_CLEAN_VPATH_FILES =
@@ -205,6 +204,8 @@ EVAS_LIBS = @EVAS_LIBS@
205EVIL_CFLAGS = @EVIL_CFLAGS@ 204EVIL_CFLAGS = @EVIL_CFLAGS@
206EVIL_LIBS = @EVIL_LIBS@ 205EVIL_LIBS = @EVIL_LIBS@
207EXEEXT = @EXEEXT@ 206EXEEXT = @EXEEXT@
207EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
208EXOTIC_LIBS = @EXOTIC_LIBS@
208FGREP = @FGREP@ 209FGREP = @FGREP@
209GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 210GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
210GLIB_CFLAGS = @GLIB_CFLAGS@ 211GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -260,6 +261,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
260PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 261PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
261PIXMAN_LIBS = @PIXMAN_LIBS@ 262PIXMAN_LIBS = @PIXMAN_LIBS@
262PKG_CONFIG = @PKG_CONFIG@ 263PKG_CONFIG = @PKG_CONFIG@
264PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
265PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
263POSUB = @POSUB@ 266POSUB = @POSUB@
264RANLIB = @RANLIB@ 267RANLIB = @RANLIB@
265SCIM_CFLAGS = @SCIM_CFLAGS@ 268SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -270,6 +273,7 @@ SDL_LIBS = @SDL_LIBS@
270SED = @SED@ 273SED = @SED@
271SET_MAKE = @SET_MAKE@ 274SET_MAKE = @SET_MAKE@
272SHELL = @SHELL@ 275SHELL = @SHELL@
276SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
273SSL_CFLAGS = @SSL_CFLAGS@ 277SSL_CFLAGS = @SSL_CFLAGS@
274SSL_LIBS = @SSL_LIBS@ 278SSL_LIBS = @SSL_LIBS@
275STRIP = @STRIP@ 279STRIP = @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;
223static int __current_hyper_mask = 0; 223static int __current_hyper_mask = 0;
224static int __current_numlock_mask = Mod2Mask; 224static int __current_numlock_mask = Mod2Mask;
225 225
226// A hack to shutdown the immodule cleanly even if im_module_exit () is not called when exiting. 226// A hack to shutdown the immodule cleanly even if im_module_exit() is not called when exiting.
227class FinalizeHandler 227class FinalizeHandler
228{ 228{
229public: 229public:
230 FinalizeHandler () 230 FinalizeHandler()
231 { 231 {
232 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler ()\n"; 232 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler()\n";
233 } 233 }
234 ~FinalizeHandler () 234 ~FinalizeHandler()
235 { 235 {
236 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler ()\n"; 236 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler()\n";
237 isf_imf_context_shutdown (); 237 isf_imf_context_shutdown();
238 } 238 }
239}; 239};
240 240
@@ -254,12 +254,12 @@ utf8_offset_to_index(const char *str, int offset)
254} 254}
255 255
256static unsigned int 256static unsigned int
257get_time (void) 257get_time(void)
258{ 258{
259 unsigned int tint; 259 unsigned int tint;
260 struct timeval tv; 260 struct timeval tv;
261 struct timezone tz; /* is not used since ages */ 261 struct timezone tz; /* is not used since ages */
262 gettimeofday (&tv, &tz); 262 gettimeofday(&tv, &tz);
263 tint = tv.tv_sec * 1000; 263 tint = tv.tv_sec * 1000;
264 tint = tint / 1000 * 1000; 264 tint = tint / 1000 * 1000;
265 tint = tint + tv.tv_usec / 1000; 265 tint = tint + tv.tv_usec / 1000;
@@ -268,7 +268,7 @@ get_time (void)
268 268
269/* Function Implementations */ 269/* Function Implementations */
270static EcoreIMFContextISFImpl * 270static EcoreIMFContextISFImpl *
271new_ic_impl (EcoreIMFContextISF *parent) 271new_ic_impl(EcoreIMFContextISF *parent)
272{ 272{
273 EcoreIMFContextISFImpl *impl = NULL; 273 EcoreIMFContextISFImpl *impl = NULL;
274 274
@@ -295,7 +295,7 @@ new_ic_impl (EcoreIMFContextISF *parent)
295} 295}
296 296
297static void 297static void
298delete_ic_impl (EcoreIMFContextISFImpl *impl) 298delete_ic_impl(EcoreIMFContextISFImpl *impl)
299{ 299{
300 EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0; 300 EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0;
301 301
@@ -312,10 +312,10 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl)
312 _free_ic_impl_list = rec; 312 _free_ic_impl_list = rec;
313 313
314 rec->parent = 0; 314 rec->parent = 0;
315 rec->si.reset (); 315 rec->si.reset();
316 rec->client_window = 0; 316 rec->client_window = 0;
317 rec->preedit_string = WideString (); 317 rec->preedit_string = WideString();
318 rec->preedit_attrlist.clear (); 318 rec->preedit_attrlist.clear();
319 319
320 return; 320 return;
321 } 321 }
@@ -323,7 +323,7 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl)
323} 323}
324 324
325static void 325static void
326delete_all_ic_impl (void) 326delete_all_ic_impl(void)
327{ 327{
328 EcoreIMFContextISFImpl *it = _used_ic_impl_list; 328 EcoreIMFContextISFImpl *it = _used_ic_impl_list;
329 329
@@ -344,7 +344,7 @@ delete_all_ic_impl (void)
344} 344}
345 345
346static EcoreIMFContextISF * 346static EcoreIMFContextISF *
347find_ic (int id) 347find_ic(int id)
348{ 348{
349 EcoreIMFContextISFImpl *rec = _used_ic_impl_list; 349 EcoreIMFContextISFImpl *rec = _used_ic_impl_list;
350 350
@@ -363,17 +363,18 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
363{ 363{
364 char *plain_str = NULL; 364 char *plain_str = NULL;
365 char *markup_str = NULL; 365 char *markup_str = NULL;
366 const char *puncs[3] = {". ", "! ", "? "}; 366 const char *puncs[] = {". ", "! ", "? "};
367 Eina_Bool ret = EINA_FALSE; 367 Eina_Bool ret = EINA_FALSE;
368 int cursor_pos = 0; 368 int cursor_pos = 0;
369 int i = 0; 369 int i = 0;
370 Eina_Unicode *tail = NULL; 370 Eina_Unicode *tail = NULL;
371 Eina_Unicode *ustr = NULL; 371 Eina_Unicode *ustr = NULL;
372 Eina_Unicode *uni_puncs[3]; 372 const int punc_num = sizeof(puncs) / sizeof(puncs[0]);
373 Eina_Unicode *uni_puncs[punc_num];
373 EcoreIMFContextISF *context_scim; 374 EcoreIMFContextISF *context_scim;
374 375
375 if (!ctx) return EINA_FALSE; 376 if (!ctx) return EINA_FALSE;
376 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 377 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
377 if (!context_scim || !context_scim->impl) return EINA_FALSE; 378 if (!context_scim || !context_scim->impl) return EINA_FALSE;
378 379
379 switch (context_scim->impl->autocapital_type) 380 switch (context_scim->impl->autocapital_type)
@@ -386,7 +387,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
386 break; 387 break;
387 } 388 }
388 389
389 for (i=0; i<3; i++) 390 for (i = 0; i < punc_num; i++)
390 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL); 391 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL);
391 392
392 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos); 393 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos);
@@ -432,7 +433,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
432 433
433 if (tail) 434 if (tail)
434 { 435 {
435 for (i=0; i<3; i++) 436 for (i = 0; i < punc_num; i++)
436 { 437 {
437 if (!eina_unicode_strcmp(tail, uni_puncs[i])) 438 if (!eina_unicode_strcmp(tail, uni_puncs[i]))
438 { 439 {
@@ -450,7 +451,7 @@ done:
450 if (markup_str) free(markup_str); 451 if (markup_str) free(markup_str);
451 if (plain_str) free(plain_str); 452 if (plain_str) free(plain_str);
452 453
453 for (i=0; i<3; i++) 454 for (i = 0; i < punc_num; i++)
454 if (uni_puncs[i]) free(uni_puncs[i]); 455 if (uni_puncs[i]) free(uni_puncs[i]);
455 456
456 return ret; 457 return ret;
@@ -463,7 +464,7 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force)
463 EcoreIMFContextISF *context_scim; 464 EcoreIMFContextISF *context_scim;
464 465
465 if (!ctx) return; 466 if (!ctx) return;
466 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 467 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
467 468
468 if (autocap_allow == EINA_FALSE) 469 if (autocap_allow == EINA_FALSE)
469 return; 470 return;
@@ -485,28 +486,52 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force)
485} 486}
486 487
487static void 488static void
488feed_key_event (Evas *evas, const char *str, Eina_Bool fake) 489feed_key_event(Evas *evas, const char *str, Eina_Bool fake)
489{ 490{
490 char key_string[128] = {0}; 491 char key_string[128] = {0};
491 unsigned int timestamp = 0; 492 unsigned int timestamp = 0;
492 493
493 if (!fake) 494 if (!fake)
494 timestamp = get_time (); 495 timestamp = get_time();
495 496
496 if (strncmp (str, "KeyRelease+", 11) == 0) 497 if (strncmp(str, "KeyRelease+", 11) == 0)
497 { 498 {
498 strncpy(key_string, str + 11, strlen(str)-11); 499 strncpy(key_string, str + 11, strlen(str)-11);
499 evas_event_feed_key_up (evas, key_string, key_string, NULL, NULL, timestamp, NULL); 500 evas_event_feed_key_up(evas, key_string, key_string, NULL, NULL, timestamp, NULL);
500 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up ()...\n"; 501 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up()...\n";
501 } 502 }
502 else 503 else
503 { 504 {
504 strncpy(key_string, str, strlen(str)); 505 strncpy(key_string, str, strlen(str));
505 evas_event_feed_key_down (evas, key_string, key_string, NULL, NULL, timestamp, NULL); 506 evas_event_feed_key_down(evas, key_string, key_string, NULL, NULL, timestamp, NULL);
506 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down ()...\n"; 507 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down()...\n";
507 } 508 }
508} 509}
509 510
511static void
512window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y)
513{
514 Ecore_X_Window root_window, win;
515 int win_x, win_y;
516 int sum_x = 0, sum_y = 0;
517
518 root_window = ecore_x_window_root_get(client_win);
519 win = client_win;
520
521 while (root_window != win)
522 {
523 ecore_x_window_geometry_get(win, &win_x, &win_y, NULL, NULL);
524 sum_x += win_x;
525 sum_y += win_y;
526 win = ecore_x_window_parent_get(win);
527 }
528
529 if (x)
530 *x = sum_x;
531 if (y)
532 *y = sum_y;
533}
534
510/* Public functions */ 535/* Public functions */
511/** 536/**
512 * isf_imf_context_new 537 * isf_imf_context_new
@@ -517,18 +542,11 @@ feed_key_event (Evas *evas, const char *str, Eina_Bool fake)
517 * Return value: A pointer to the newly created EcoreIMFContextISF instance 542 * Return value: A pointer to the newly created EcoreIMFContextISF instance
518 */ 543 */
519EAPI EcoreIMFContextISF * 544EAPI EcoreIMFContextISF *
520isf_imf_context_new (void) 545isf_imf_context_new(void)
521{ 546{
522 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 547 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
523 char *env; 548 char *env;
524 549
525 Ecore_X_Display *display = ecore_x_display_get ();
526 if (!display)
527 {
528 std::cerr << "ecore_x_display_get () failed !!!";
529 return NULL;
530 }
531
532 EcoreIMFContextISF *context_scim = new EcoreIMFContextISF; 550 EcoreIMFContextISF *context_scim = new EcoreIMFContextISF;
533 if (context_scim == NULL) 551 if (context_scim == NULL)
534 { 552 {
@@ -540,7 +558,7 @@ isf_imf_context_new (void)
540 558
541 if (!_scim_initialized) 559 if (!_scim_initialized)
542 { 560 {
543 initialize (); 561 initialize();
544 _scim_initialized = true; 562 _scim_initialized = true;
545 } 563 }
546 564
@@ -558,61 +576,61 @@ isf_imf_context_new (void)
558 * cleanup job. 576 * cleanup job.
559 */ 577 */
560EAPI void 578EAPI void
561isf_imf_context_shutdown (void) 579isf_imf_context_shutdown(void)
562{ 580{
563 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 581 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
564 582
565 if (_scim_initialized) 583 if (_scim_initialized)
566 { 584 {
567 _scim_initialized = false; 585 _scim_initialized = false;
568 finalize (); 586 finalize();
569 } 587 }
570} 588}
571 589
572EAPI void 590EAPI void
573isf_imf_context_add (Ecore_IMF_Context *ctx) 591isf_imf_context_add(Ecore_IMF_Context *ctx)
574{ 592{
575 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 593 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
576 594
577 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 595 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
578 596
579 if (!context_scim) return; 597 if (!context_scim) return;
580 598
581 context_scim->impl = NULL; 599 context_scim->impl = NULL;
582 600
583 if (_backend.null ()) 601 if (_backend.null())
584 return; 602 return;
585 603
586 IMEngineInstancePointer si; 604 IMEngineInstancePointer si;
587 605
588 // Use the default instance if "shared input method" mode is enabled. 606 // Use the default instance if "shared input method" mode is enabled.
589 if (_shared_input_method && !_default_instance.null ()) 607 if (_shared_input_method && !_default_instance.null())
590 { 608 {
591 si = _default_instance; 609 si = _default_instance;
592 SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; 610 SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n";
593 } 611 }
594 612
595 // Not in "shared input method" mode, or no default instance, create an instance. 613 // Not in "shared input method" mode, or no default instance, create an instance.
596 if (si.null ()) 614 if (si.null())
597 { 615 {
598 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); 616 IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
599 if (factory.null ()) return; 617 if (factory.null()) return;
600 si = factory->create_instance ("UTF-8", _instance_count++); 618 si = factory->create_instance("UTF-8", _instance_count++);
601 if (si.null ()) return; 619 if (si.null()) return;
602 attach_instance (si); 620 attach_instance(si);
603 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; 621 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n";
604 } 622 }
605 623
606 // If "shared input method" mode is enabled, and there is no default instance, 624 // If "shared input method" mode is enabled, and there is no default instance,
607 // then store this instance as default one. 625 // then store this instance as default one.
608 if (_shared_input_method && _default_instance.null ()) 626 if (_shared_input_method && _default_instance.null())
609 { 627 {
610 SCIM_DEBUG_FRONTEND(2) << "update default instance.\n"; 628 SCIM_DEBUG_FRONTEND(2) << "update default instance.\n";
611 _default_instance = si; 629 _default_instance = si;
612 } 630 }
613 631
614 context_scim->ctx = ctx; 632 context_scim->ctx = ctx;
615 context_scim->impl = new_ic_impl (context_scim); 633 context_scim->impl = new_ic_impl(context_scim);
616 if (context_scim->impl == NULL) 634 if (context_scim->impl == NULL)
617 { 635 {
618 std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n"; 636 std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n";
@@ -640,24 +658,24 @@ isf_imf_context_add (Ecore_IMF_Context *ctx)
640 _ic_list = context_scim; 658 _ic_list = context_scim;
641 659
642 if (_shared_input_method) 660 if (_shared_input_method)
643 context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); 661 context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
644 662
645 _panel_client.prepare (context_scim->id); 663 _panel_client.prepare(context_scim->id);
646 _panel_client.register_input_context (context_scim->id, si->get_factory_uuid ()); 664 _panel_client.register_input_context(context_scim->id, si->get_factory_uuid());
647 set_ic_capabilities (context_scim); 665 set_ic_capabilities(context_scim);
648 _panel_client.send (); 666 _panel_client.send();
649 667
650 SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n"; 668 SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n";
651} 669}
652 670
653EAPI void 671EAPI void
654isf_imf_context_del (Ecore_IMF_Context *ctx) 672isf_imf_context_del(Ecore_IMF_Context *ctx)
655{ 673{
656 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 674 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
657 675
658 if (!_ic_list) return; 676 if (!_ic_list) return;
659 677
660 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 678 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
661 679
662 if (context_scim) 680 if (context_scim)
663 { 681 {
@@ -682,32 +700,32 @@ isf_imf_context_del (Ecore_IMF_Context *ctx)
682 700
683 if (context_scim && context_scim->impl) 701 if (context_scim && context_scim->impl)
684 { 702 {
685 _panel_client.prepare (context_scim->id); 703 _panel_client.prepare(context_scim->id);
686 704
687 if (context_scim == _focused_ic) 705 if (context_scim == _focused_ic)
688 context_scim->impl->si->focus_out (); 706 context_scim->impl->si->focus_out();
689 707
690 // Delete the instance. 708 // Delete the instance.
691 EcoreIMFContextISF *old_focused = _focused_ic; 709 EcoreIMFContextISF *old_focused = _focused_ic;
692 _focused_ic = context_scim; 710 _focused_ic = context_scim;
693 context_scim->impl->si.reset (); 711 context_scim->impl->si.reset();
694 _focused_ic = old_focused; 712 _focused_ic = old_focused;
695 713
696 if (context_scim == _focused_ic) 714 if (context_scim == _focused_ic)
697 { 715 {
698 _panel_client.turn_off (context_scim->id); 716 _panel_client.turn_off(context_scim->id);
699 _panel_client.focus_out (context_scim->id); 717 _panel_client.focus_out(context_scim->id);
700 } 718 }
701 719
702 _panel_client.remove_input_context (context_scim->id); 720 _panel_client.remove_input_context(context_scim->id);
703 _panel_client.send (); 721 _panel_client.send();
704 722
705 if (context_scim->impl->client_window) 723 if (context_scim->impl->client_window)
706 isf_imf_context_client_window_set (ctx, NULL); 724 isf_imf_context_client_window_set(ctx, NULL);
707 725
708 if (context_scim->impl) 726 if (context_scim->impl)
709 { 727 {
710 delete_ic_impl (context_scim->impl); 728 delete_ic_impl(context_scim->impl);
711 context_scim->impl = 0; 729 context_scim->impl = 0;
712 } 730 }
713 } 731 }
@@ -738,11 +756,11 @@ isf_imf_context_del (Ecore_IMF_Context *ctx)
738 * be used for purposes internal to the Input Method Context. 756 * be used for purposes internal to the Input Method Context.
739 */ 757 */
740EAPI void 758EAPI void
741isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas) 759isf_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
742{ 760{
743 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 761 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
744 762
745 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 763 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
746 764
747 if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas) 765 if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas)
748 context_scim->impl->client_canvas = (Evas*)canvas; 766 context_scim->impl->client_canvas = (Evas*)canvas;
@@ -762,11 +780,11 @@ isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas)
762 * and may also be used for purposes internal to the Input Method Context. 780 * and may also be used for purposes internal to the Input Method Context.
763 */ 781 */
764EAPI void 782EAPI void
765isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window) 783isf_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
766{ 784{
767 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 785 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
768 786
769 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 787 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
770 788
771 if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window)) 789 if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window))
772 { 790 {
@@ -789,29 +807,29 @@ isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window)
789 * to clear the preedit state. 807 * to clear the preedit state.
790 */ 808 */
791EAPI void 809EAPI void
792isf_imf_context_reset (Ecore_IMF_Context *ctx) 810isf_imf_context_reset(Ecore_IMF_Context *ctx)
793{ 811{
794 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 812 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
795 813
796 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 814 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
797 815
798 if (context_scim && context_scim->impl && context_scim == _focused_ic) 816 if (context_scim && context_scim->impl && context_scim == _focused_ic)
799 { 817 {
800 WideString wstr = context_scim->impl->preedit_string; 818 WideString wstr = context_scim->impl->preedit_string;
801 819
802 _panel_client.prepare (context_scim->id); 820 _panel_client.prepare(context_scim->id);
803 context_scim->impl->si->reset (); 821 context_scim->impl->si->reset();
804 _panel_client.send (); 822 _panel_client.send();
805 823
806 if (context_scim->impl->need_commit_preedit) 824 if (context_scim->impl->need_commit_preedit)
807 { 825 {
808 if (wstr.length ()) 826 if (wstr.length())
809 { 827 {
810 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); 828 ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str());
811 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); 829 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
812 } 830 }
813 _panel_client.prepare (context_scim->id); 831 _panel_client.prepare(context_scim->id);
814 _panel_client.send (); 832 _panel_client.send();
815 } 833 }
816 } 834 }
817} 835}
@@ -825,9 +843,9 @@ isf_imf_context_reset (Ecore_IMF_Context *ctx)
825 * Notify the Input Method Context that the widget to which its correspond has gained focus. 843 * Notify the Input Method Context that the widget to which its correspond has gained focus.
826 */ 844 */
827EAPI void 845EAPI void
828isf_imf_context_focus_in (Ecore_IMF_Context *ctx) 846isf_imf_context_focus_in(Ecore_IMF_Context *ctx)
829{ 847{
830 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 848 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
831 849
832 if (!context_scim) 850 if (!context_scim)
833 return; 851 return;
@@ -839,12 +857,11 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
839 if (_focused_ic == context_scim) 857 if (_focused_ic == context_scim)
840 { 858 {
841 SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n"; 859 SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n";
842 //isf_imf_context_cursor_position_set (ctx, 0);
843 return; 860 return;
844 } 861 }
845 SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n"; 862 SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n";
846 if (_focused_ic->ctx) 863 if (_focused_ic->ctx)
847 isf_imf_context_focus_out (_focused_ic->ctx); 864 isf_imf_context_focus_out(_focused_ic->ctx);
848 } 865 }
849 866
850 bool need_cap = false; 867 bool need_cap = false;
@@ -854,28 +871,28 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
854 if (context_scim && context_scim->impl) 871 if (context_scim && context_scim->impl)
855 { 872 {
856 _focused_ic = context_scim; 873 _focused_ic = context_scim;
857 _panel_client.prepare (context_scim->id); 874 _panel_client.prepare(context_scim->id);
858 875
859 // Handle the "Shared Input Method" mode. 876 // Handle the "Shared Input Method" mode.
860 if (_shared_input_method) 877 if (_shared_input_method)
861 { 878 {
862 SCIM_DEBUG_FRONTEND(2) << "shared input method.\n"; 879 SCIM_DEBUG_FRONTEND(2) << "shared input method.\n";
863 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); 880 IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
864 if (!factory.null ()) 881 if (!factory.null())
865 { 882 {
866 if (_default_instance.null () || _default_instance->get_factory_uuid () != factory->get_uuid ()) 883 if (_default_instance.null() || _default_instance->get_factory_uuid() != factory->get_uuid())
867 { 884 {
868 _default_instance = factory->create_instance ("UTF-8", _default_instance.null () ? _instance_count++ : _default_instance->get_id ()); 885 _default_instance = factory->create_instance("UTF-8", _default_instance.null() ? _instance_count++ : _default_instance->get_id());
869 attach_instance (_default_instance); 886 attach_instance(_default_instance);
870 SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n"; 887 SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id() << " " << _default_instance->get_factory_uuid() << "\n";
871 } 888 }
872 889
873 context_scim->impl->shared_si = true; 890 context_scim->impl->shared_si = true;
874 context_scim->impl->si = _default_instance; 891 context_scim->impl->si = _default_instance;
875 892
876 context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); 893 context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
877 context_scim->impl->preedit_string.clear (); 894 context_scim->impl->preedit_string.clear();
878 context_scim->impl->preedit_attrlist.clear (); 895 context_scim->impl->preedit_attrlist.clear();
879 context_scim->impl->preedit_caret = 0; 896 context_scim->impl->preedit_caret = 0;
880 context_scim->impl->preedit_started = false; 897 context_scim->impl->preedit_started = false;
881 need_cap = true; 898 need_cap = true;
@@ -886,47 +903,50 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
886 else if (context_scim->impl->shared_si) 903 else if (context_scim->impl->shared_si)
887 { 904 {
888 SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n"; 905 SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n";
889 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); 906 IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
890 if (!factory.null ()) 907 if (!factory.null())
891 { 908 {
892 context_scim->impl->si = factory->create_instance ("UTF-8", _instance_count++); 909 context_scim->impl->si = factory->create_instance("UTF-8", _instance_count++);
893 context_scim->impl->preedit_string.clear (); 910 context_scim->impl->preedit_string.clear();
894 context_scim->impl->preedit_attrlist.clear (); 911 context_scim->impl->preedit_attrlist.clear();
895 context_scim->impl->preedit_caret = 0; 912 context_scim->impl->preedit_caret = 0;
896 context_scim->impl->preedit_started = false; 913 context_scim->impl->preedit_started = false;
897 attach_instance (context_scim->impl->si); 914 attach_instance(context_scim->impl->si);
898 need_cap = true; 915 need_cap = true;
899 need_reg = true; 916 need_reg = true;
900 context_scim->impl->shared_si = false; 917 context_scim->impl->shared_si = false;
901 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id () << " " << context_scim->impl->si->get_factory_uuid () << "\n"; 918 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id() << " " << context_scim->impl->si->get_factory_uuid() << "\n";
902 } 919 }
903 } 920 }
904 921
905 context_scim->impl->si->set_frontend_data (static_cast <void*> (context_scim)); 922 context_scim->impl->si->set_frontend_data(static_cast <void*>(context_scim));
906 923
907 if (need_reg) _panel_client.register_input_context (context_scim->id, context_scim->impl->si->get_factory_uuid ()); 924 if (need_reg) _panel_client.register_input_context(context_scim->id, context_scim->impl->si->get_factory_uuid());
908 if (need_cap) set_ic_capabilities (context_scim); 925 if (need_cap) set_ic_capabilities(context_scim);
909 if (need_reset) context_scim->impl->si->reset (); 926 if (need_reset) context_scim->impl->si->reset();
910 927
911 panel_req_focus_in (context_scim); 928 panel_req_focus_in(context_scim);
912 panel_req_update_spot_location (context_scim); 929 panel_req_update_spot_location(context_scim);
913 panel_req_update_factory_info (context_scim); 930 panel_req_update_factory_info(context_scim);
914 931
915 if (context_scim->impl->is_on) 932 if (context_scim->impl->is_on)
916 { 933 {
917 _panel_client.turn_on (context_scim->id); 934 _panel_client.turn_on(context_scim->id);
918 _panel_client.hide_preedit_string (context_scim->id); 935 _panel_client.hide_preedit_string(context_scim->id);
919 _panel_client.hide_aux_string (context_scim->id); 936 _panel_client.hide_aux_string(context_scim->id);
920 _panel_client.hide_lookup_table (context_scim->id); 937 _panel_client.hide_lookup_table(context_scim->id);
921 context_scim->impl->si->focus_in (); 938 context_scim->impl->si->focus_in();
922 } 939 }
923 else 940 else
924 { 941 {
925 _panel_client.turn_off (context_scim->id); 942 _panel_client.turn_off(context_scim->id);
926 } 943 }
927 944
928 _panel_client.send (); 945 _panel_client.send();
929 } 946 }
947
948 if (ecore_imf_context_input_panel_enabled_get(ctx))
949 ecore_imf_context_input_panel_show(ctx);
930} 950}
931 951
932/** 952/**
@@ -938,9 +958,9 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
938 * Notify the Input Method Context that the widget to which its correspond has lost focus. 958 * Notify the Input Method Context that the widget to which its correspond has lost focus.
939 */ 959 */
940EAPI void 960EAPI void
941isf_imf_context_focus_out (Ecore_IMF_Context *ctx) 961isf_imf_context_focus_out(Ecore_IMF_Context *ctx)
942{ 962{
943 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 963 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
944 964
945 if (!context_scim) return; 965 if (!context_scim) return;
946 966
@@ -952,23 +972,26 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx)
952 972
953 if (context_scim->impl->need_commit_preedit) 973 if (context_scim->impl->need_commit_preedit)
954 { 974 {
955 if (wstr.length ()) 975 if (wstr.length())
956 { 976 {
957 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); 977 ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str());
958 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); 978 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
959 } 979 }
960 _panel_client.prepare (context_scim->id); 980 _panel_client.prepare(context_scim->id);
961 _panel_client.send (); 981 _panel_client.send();
962 } 982 }
963 983
964 _panel_client.prepare (context_scim->id); 984 _panel_client.prepare(context_scim->id);
965 context_scim->impl->si->focus_out (); 985 context_scim->impl->si->focus_out();
966 context_scim->impl->si->reset (); 986 context_scim->impl->si->reset();
967 _panel_client.turn_off (context_scim->id); 987 _panel_client.turn_off(context_scim->id);
968 _panel_client.focus_out (context_scim->id); 988 _panel_client.focus_out(context_scim->id);
969 _panel_client.send (); 989 _panel_client.send();
970 _focused_ic = 0; 990 _focused_ic = 0;
971 } 991 }
992
993 if (ecore_imf_context_input_panel_enabled_get(ctx))
994 ecore_imf_context_input_panel_hide(ctx);
972} 995}
973 996
974/** 997/**
@@ -984,11 +1007,11 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx)
984 * Notify the Input Method Context that a change in the cursor location has been made. 1007 * Notify the Input Method Context that a change in the cursor location has been made.
985 */ 1008 */
986EAPI void 1009EAPI void
987isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch) 1010isf_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch)
988{ 1011{
989 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1012 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
990 1013
991 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1014 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
992 Ecore_Evas *ee; 1015 Ecore_Evas *ee;
993 int canvas_x, canvas_y; 1016 int canvas_x, canvas_y;
994 1017
@@ -1001,21 +1024,28 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int
1001 if (context_scim->impl->preedit_updating) 1024 if (context_scim->impl->preedit_updating)
1002 return; 1025 return;
1003 1026
1004 if (!context_scim->impl->client_canvas) 1027 if (context_scim->impl->client_canvas)
1005 return; 1028 {
1006 1029 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
1007 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); 1030 if (!ee) return;
1008 if (!ee) return;
1009 1031
1010 ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL); 1032 ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL);
1033 }
1034 else
1035 {
1036 if (context_scim->impl->client_window)
1037 window_to_screen_geometry_get(context_scim->impl->client_window, &canvas_x, &canvas_y);
1038 else
1039 return;
1040 }
1011 1041
1012 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch) 1042 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch)
1013 { 1043 {
1014 context_scim->impl->cursor_x = canvas_x + cx; 1044 context_scim->impl->cursor_x = canvas_x + cx;
1015 context_scim->impl->cursor_y = canvas_y + cy + ch; 1045 context_scim->impl->cursor_y = canvas_y + cy + ch;
1016 _panel_client.prepare (context_scim->id); 1046 _panel_client.prepare(context_scim->id);
1017 panel_req_update_spot_location (context_scim); 1047 panel_req_update_spot_location(context_scim);
1018 _panel_client.send (); 1048 _panel_client.send();
1019 SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n"; 1049 SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n";
1020 } 1050 }
1021 } 1051 }
@@ -1033,11 +1063,11 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int
1033 * display feedback, such as displaying it in a child of the root window. 1063 * display feedback, such as displaying it in a child of the root window.
1034 */ 1064 */
1035EAPI void 1065EAPI void
1036isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit) 1066isf_imf_context_use_preedit_set(Ecore_IMF_Context* ctx, Eina_Bool use_preedit)
1037{ 1067{
1038 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n"; 1068 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n";
1039 1069
1040 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1070 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1041 1071
1042 if (!_on_the_spot) return; 1072 if (!_on_the_spot) return;
1043 1073
@@ -1047,36 +1077,36 @@ isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit)
1047 context_scim->impl->use_preedit = use_preedit; 1077 context_scim->impl->use_preedit = use_preedit;
1048 if (context_scim == _focused_ic) 1078 if (context_scim == _focused_ic)
1049 { 1079 {
1050 _panel_client.prepare (context_scim->id); 1080 _panel_client.prepare(context_scim->id);
1051 1081
1052 if (old != use_preedit) 1082 if (old != use_preedit)
1053 set_ic_capabilities (context_scim); 1083 set_ic_capabilities(context_scim);
1054 1084
1055 if (context_scim->impl->preedit_string.length ()) 1085 if (context_scim->impl->preedit_string.length())
1056 slot_show_preedit_string (context_scim->impl->si); 1086 slot_show_preedit_string(context_scim->impl->si);
1057 1087
1058 _panel_client.send (); 1088 _panel_client.send();
1059 } 1089 }
1060 } 1090 }
1061} 1091}
1062 1092
1063EAPI void 1093EAPI void
1064isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos) 1094isf_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos)
1065{ 1095{
1066 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1096 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1067 1097
1068 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1098 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1069 1099
1070 if (context_scim && context_scim->impl && context_scim->impl->is_on) 1100 if (context_scim && context_scim->impl && context_scim->impl->is_on)
1071 { 1101 {
1072 String mbs = utf8_wcstombs (context_scim->impl->preedit_string); 1102 String mbs = utf8_wcstombs(context_scim->impl->preedit_string);
1073 1103
1074 if (str) 1104 if (str)
1075 { 1105 {
1076 if (mbs.length ()) 1106 if (mbs.length())
1077 *str = strdup (mbs.c_str ()); 1107 *str = strdup(mbs.c_str());
1078 else 1108 else
1079 *str = strdup (""); 1109 *str = strdup("");
1080 } 1110 }
1081 1111
1082 if (cursor_pos) 1112 if (cursor_pos)
@@ -1086,28 +1116,28 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1086 1116
1087 if (attrs) 1117 if (attrs)
1088 { 1118 {
1089 if (mbs.length ()) 1119 if (mbs.length())
1090 { 1120 {
1091 int start_index, end_index; 1121 int start_index, end_index;
1092 int wlen = context_scim->impl->preedit_string.length (); 1122 int wlen = context_scim->impl->preedit_string.length();
1093 1123
1094 Ecore_IMF_Preedit_Attr *attr = NULL; 1124 Ecore_IMF_Preedit_Attr *attr = NULL;
1095 AttributeList::const_iterator i; 1125 AttributeList::const_iterator i;
1096 bool *attrs_flag = new bool [mbs.length ()]; 1126 bool *attrs_flag = new bool [mbs.length()];
1097 memset (attrs_flag, 0, mbs.length () *sizeof (bool)); 1127 memset(attrs_flag, 0, mbs.length() *sizeof(bool));
1098 1128
1099 for (i = context_scim->impl->preedit_attrlist.begin (); 1129 for (i = context_scim->impl->preedit_attrlist.begin();
1100 i != context_scim->impl->preedit_attrlist.end (); ++i) 1130 i != context_scim->impl->preedit_attrlist.end(); ++i)
1101 { 1131 {
1102 start_index = i->get_start (); 1132 start_index = i->get_start();
1103 end_index = i->get_end (); 1133 end_index = i->get_end();
1104 1134
1105 if (end_index <= wlen && start_index < end_index && i->get_type () != SCIM_ATTR_DECORATE_NONE) 1135 if (end_index <= wlen && start_index < end_index && i->get_type() != SCIM_ATTR_DECORATE_NONE)
1106 { 1136 {
1107 start_index = utf8_offset_to_index (mbs.c_str (), i->get_start ()); 1137 start_index = utf8_offset_to_index(mbs.c_str(), i->get_start());
1108 end_index = utf8_offset_to_index (mbs.c_str (), i->get_end ()); 1138 end_index = utf8_offset_to_index(mbs.c_str(), i->get_end());
1109 1139
1110 if (i->get_type () == SCIM_ATTR_DECORATE) 1140 if (i->get_type() == SCIM_ATTR_DECORATE)
1111 { 1141 {
1112 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); 1142 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
1113 if (attr == NULL) 1143 if (attr == NULL)
@@ -1115,24 +1145,24 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1115 attr->start_index = start_index; 1145 attr->start_index = start_index;
1116 attr->end_index = end_index; 1146 attr->end_index = end_index;
1117 1147
1118 if (i->get_value () == SCIM_ATTR_DECORATE_UNDERLINE) 1148 if (i->get_value() == SCIM_ATTR_DECORATE_UNDERLINE)
1119 { 1149 {
1120 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1; 1150 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1;
1121 *attrs = eina_list_append(*attrs, (void *)attr); 1151 *attrs = eina_list_append(*attrs, (void *)attr);
1122 } 1152 }
1123 else if (i->get_value () == SCIM_ATTR_DECORATE_REVERSE) 1153 else if (i->get_value() == SCIM_ATTR_DECORATE_REVERSE)
1124 { 1154 {
1125 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; 1155 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
1126 *attrs = eina_list_append(*attrs, (void *)attr); 1156 *attrs = eina_list_append(*attrs, (void *)attr);
1127 } 1157 }
1128 else if (i->get_value () == SCIM_ATTR_DECORATE_HIGHLIGHT) 1158 else if (i->get_value() == SCIM_ATTR_DECORATE_HIGHLIGHT)
1129 { 1159 {
1130 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3; 1160 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
1131 *attrs = eina_list_append(*attrs, (void *)attr); 1161 *attrs = eina_list_append(*attrs, (void *)attr);
1132 } 1162 }
1133 else 1163 else
1134 { 1164 {
1135 free (attr); 1165 free(attr);
1136 } 1166 }
1137 1167
1138 switch(i->get_value()) 1168 switch(i->get_value())
@@ -1148,11 +1178,11 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1148 break; 1178 break;
1149 } 1179 }
1150 } 1180 }
1151 else if (i->get_type () == SCIM_ATTR_FOREGROUND) 1181 else if (i->get_type() == SCIM_ATTR_FOREGROUND)
1152 { 1182 {
1153 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n"; 1183 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n";
1154 } 1184 }
1155 else if (i->get_type () == SCIM_ATTR_BACKGROUND) 1185 else if (i->get_type() == SCIM_ATTR_BACKGROUND)
1156 { 1186 {
1157 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n"; 1187 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n";
1158 } 1188 }
@@ -1160,13 +1190,13 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1160 } 1190 }
1161 1191
1162 // Add underline for all characters which don't have attribute. 1192 // Add underline for all characters which don't have attribute.
1163 for (unsigned int pos = 0; pos < mbs.length (); ++pos) 1193 for (unsigned int pos = 0; pos < mbs.length(); ++pos)
1164 { 1194 {
1165 if (!attrs_flag [pos]) 1195 if (!attrs_flag [pos])
1166 { 1196 {
1167 int begin_pos = pos; 1197 int begin_pos = pos;
1168 1198
1169 while (pos < mbs.length () && !attrs_flag [pos]) 1199 while (pos < mbs.length() && !attrs_flag[pos])
1170 ++pos; 1200 ++pos;
1171 1201
1172 // use REVERSE style as default 1202 // use REVERSE style as default
@@ -1187,7 +1217,7 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1187 else 1217 else
1188 { 1218 {
1189 if (str) 1219 if (str)
1190 *str = strdup (""); 1220 *str = strdup("");
1191 1221
1192 if (cursor_pos) 1222 if (cursor_pos)
1193 *cursor_pos = 0; 1223 *cursor_pos = 0;
@@ -1208,22 +1238,22 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1208 * To get the preedit string of the input method. 1238 * To get the preedit string of the input method.
1209 */ 1239 */
1210EAPI void 1240EAPI void
1211isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos) 1241isf_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char** str, int *cursor_pos)
1212{ 1242{
1213 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1243 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1214 1244
1215 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1245 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1216 1246
1217 if (context_scim && context_scim->impl && context_scim->impl->is_on) 1247 if (context_scim && context_scim->impl && context_scim->impl->is_on)
1218 { 1248 {
1219 String mbs = utf8_wcstombs (context_scim->impl->preedit_string); 1249 String mbs = utf8_wcstombs(context_scim->impl->preedit_string);
1220 1250
1221 if (str) 1251 if (str)
1222 { 1252 {
1223 if (mbs.length ()) 1253 if (mbs.length())
1224 *str = strdup (mbs.c_str ()); 1254 *str = strdup(mbs.c_str());
1225 else 1255 else
1226 *str = strdup (""); 1256 *str = strdup("");
1227 } 1257 }
1228 1258
1229 if (cursor_pos) 1259 if (cursor_pos)
@@ -1232,7 +1262,7 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur
1232 else 1262 else
1233 { 1263 {
1234 if (str) 1264 if (str)
1235 *str = strdup (""); 1265 *str = strdup("");
1236 1266
1237 if (cursor_pos) 1267 if (cursor_pos)
1238 *cursor_pos = 0; 1268 *cursor_pos = 0;
@@ -1249,11 +1279,11 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur
1249 * Notify the Input Method Context that a change in the cursor position has been made. 1279 * Notify the Input Method Context that a change in the cursor position has been made.
1250 */ 1280 */
1251EAPI void 1281EAPI void
1252isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos) 1282isf_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
1253{ 1283{
1254 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1284 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1255 1285
1256 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1286 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
1257 1287
1258 if (context_scim && context_scim->impl && context_scim == _focused_ic) 1288 if (context_scim && context_scim->impl && context_scim == _focused_ic)
1259 { 1289 {
@@ -1280,11 +1310,11 @@ isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos)
1280 * is in Ecore_IMF.h. 1310 * is in Ecore_IMF.h.
1281 */ 1311 */
1282EAPI void 1312EAPI void
1283isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) 1313isf_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
1284{ 1314{
1285 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1315 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1286 1316
1287 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1317 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1288 if (context_scim && context_scim->impl) 1318 if (context_scim && context_scim->impl)
1289 context_scim->impl->input_mode = input_mode; 1319 context_scim->impl->input_mode = input_mode;
1290} 1320}
@@ -1299,22 +1329,22 @@ isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode inp
1299 * Set whether the IM context should use the prediction. 1329 * Set whether the IM context should use the prediction.
1300 */ 1330 */
1301EAPI void 1331EAPI void
1302isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction) 1332isf_imf_context_prediction_allow_set(Ecore_IMF_Context* ctx, Eina_Bool prediction)
1303{ 1333{
1304 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n"; 1334 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n";
1305 1335
1306 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1336 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
1307 1337
1308 if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction) 1338 if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction)
1309 context_scim->impl->prediction_allow = prediction; 1339 context_scim->impl->prediction_allow = prediction;
1310} 1340}
1311 1341
1312EAPI void 1342EAPI void
1313isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type) 1343isf_imf_context_autocapital_type_set(Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type)
1314{ 1344{
1315 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n"; 1345 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n";
1316 1346
1317 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1347 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
1318 1348
1319 if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type) 1349 if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type)
1320 context_scim->impl->autocapital_type = autocapital_type; 1350 context_scim->impl->autocapital_type = autocapital_type;
@@ -1337,11 +1367,11 @@ isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapi
1337 */ 1367 */
1338 1368
1339EAPI Eina_Bool 1369EAPI Eina_Bool
1340isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) 1370isf_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
1341{ 1371{
1342 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1372 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1343 1373
1344 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1374 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1345 Eina_Bool ret = EINA_FALSE; 1375 Eina_Bool ret = EINA_FALSE;
1346 1376
1347 if (ic == NULL || ic->impl == NULL) 1377 if (ic == NULL || ic->impl == NULL)
@@ -1352,7 +1382,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type,
1352 if (type == ECORE_IMF_EVENT_KEY_DOWN) 1382 if (type == ECORE_IMF_EVENT_KEY_DOWN)
1353 { 1383 {
1354 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; 1384 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
1355 scim_string_to_key (key, ev->key); 1385 scim_string_to_key(key, ev->key);
1356 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; 1386 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
1357 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; 1387 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
1358 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask; 1388 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,
1362 else if (type == ECORE_IMF_EVENT_KEY_UP) 1392 else if (type == ECORE_IMF_EVENT_KEY_UP)
1363 { 1393 {
1364 Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event; 1394 Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event;
1365 scim_string_to_key (key, ev->key); 1395 scim_string_to_key(key, ev->key);
1366 key.mask = SCIM_KEY_ReleaseMask; 1396 key.mask = SCIM_KEY_ReleaseMask;
1367 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; 1397 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
1368 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; 1398 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,
1377 1407
1378 key.mask &= _valid_key_mask; 1408 key.mask &= _valid_key_mask;
1379 1409
1380 _panel_client.prepare (ic->id); 1410 _panel_client.prepare(ic->id);
1381 1411
1382 ret = EINA_TRUE; 1412 ret = EINA_TRUE;
1383 if (!filter_hotkeys (ic, key)) 1413 if (!filter_hotkeys(ic, key))
1384 { 1414 {
1385 if (!_focused_ic || !_focused_ic->impl->is_on || 1415 if (!_focused_ic || !_focused_ic->impl->is_on ||
1386 !_focused_ic->impl->si->process_key_event (key)) 1416 !_focused_ic->impl->si->process_key_event(key))
1387 ret = EINA_FALSE; 1417 ret = EINA_FALSE;
1388 } 1418 }
1389 1419
1390 _panel_client.send (); 1420 _panel_client.send();
1391 1421
1392 return ret; 1422 return ret;
1393} 1423}
1394 1424
1425EAPI void
1426isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
1427{
1428 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1429
1430 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1431 if (ic == NULL || ic->impl == NULL)
1432 return;
1433
1434 ecore_x_e_virtual_keyboard_state_set
1435 (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
1436}
1437
1438EAPI void
1439isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
1440{
1441 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1442
1443 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1444 if (ic == NULL || ic->impl == NULL)
1445 return;
1446
1447 ecore_x_e_virtual_keyboard_state_set
1448 (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
1449}
1450
1395/* Panel Slot functions */ 1451/* Panel Slot functions */
1396static void 1452static void
1397panel_slot_reload_config (int context __UNUSED__) 1453panel_slot_reload_config(int context __UNUSED__)
1398{ 1454{
1399 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1455 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1400 _config->reload (); 1456 _config->reload();
1401} 1457}
1402 1458
1403static void 1459static void
1404panel_slot_exit (int /* context */) 1460panel_slot_exit(int /* context */)
1405{ 1461{
1406 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1462 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1407 1463
1408 finalize (); 1464 finalize();
1409} 1465}
1410 1466
1411static void 1467static void
1412panel_slot_update_lookup_table_page_size (int context, int page_size) 1468panel_slot_update_lookup_table_page_size(int context, int page_size)
1413{ 1469{
1414 EcoreIMFContextISF *ic = find_ic (context); 1470 EcoreIMFContextISF *ic = find_ic(context);
1415 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n"; 1471 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n";
1416 if (ic && ic->impl) 1472 if (ic && ic->impl)
1417 { 1473 {
1418 _panel_client.prepare (ic->id); 1474 _panel_client.prepare(ic->id);
1419 ic->impl->si->update_lookup_table_page_size (page_size); 1475 ic->impl->si->update_lookup_table_page_size(page_size);
1420 _panel_client.send (); 1476 _panel_client.send();
1421 } 1477 }
1422} 1478}
1423 1479
1424static void 1480static void
1425panel_slot_lookup_table_page_up (int context) 1481panel_slot_lookup_table_page_up(int context)
1426{ 1482{
1427 EcoreIMFContextISF *ic = find_ic (context); 1483 EcoreIMFContextISF *ic = find_ic(context);
1428 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1484 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1429 if (ic && ic->impl) 1485 if (ic && ic->impl)
1430 { 1486 {
1431 _panel_client.prepare (ic->id); 1487 _panel_client.prepare(ic->id);
1432 ic->impl->si->lookup_table_page_up (); 1488 ic->impl->si->lookup_table_page_up();
1433 _panel_client.send (); 1489 _panel_client.send();
1434 } 1490 }
1435} 1491}
1436 1492
1437static void 1493static void
1438panel_slot_lookup_table_page_down (int context) 1494panel_slot_lookup_table_page_down(int context)
1439{ 1495{
1440 EcoreIMFContextISF *ic = find_ic (context); 1496 EcoreIMFContextISF *ic = find_ic(context);
1441 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1497 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1442 if (ic && ic->impl) 1498 if (ic && ic->impl)
1443 { 1499 {
1444 _panel_client.prepare (ic->id); 1500 _panel_client.prepare(ic->id);
1445 ic->impl->si->lookup_table_page_down (); 1501 ic->impl->si->lookup_table_page_down();
1446 _panel_client.send (); 1502 _panel_client.send();
1447 } 1503 }
1448} 1504}
1449 1505
1450static void 1506static void
1451panel_slot_trigger_property (int context, const String &property) 1507panel_slot_trigger_property(int context, const String &property)
1452{ 1508{
1453 EcoreIMFContextISF *ic = find_ic (context); 1509 EcoreIMFContextISF *ic = find_ic(context);
1454 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n"; 1510 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n";
1455 if (ic && ic->impl) 1511 if (ic && ic->impl)
1456 { 1512 {
1457 _panel_client.prepare (ic->id); 1513 _panel_client.prepare(ic->id);
1458 ic->impl->si->trigger_property (property); 1514 ic->impl->si->trigger_property(property);
1459 _panel_client.send (); 1515 _panel_client.send();
1460 } 1516 }
1461} 1517}
1462 1518
1463static void 1519static void
1464panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) 1520panel_slot_process_helper_event(int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans)
1465{ 1521{
1466 EcoreIMFContextISF *ic = find_ic (context); 1522 EcoreIMFContextISF *ic = find_ic(context);
1467 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid 1523 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid
1468 << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid=" 1524 << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid="
1469 << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid () : "" ) << "\n"; 1525 << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid() : "" ) << "\n";
1470 if (ic && ic->impl && ic->impl->si->get_factory_uuid () == target_uuid) 1526 if (ic && ic->impl && ic->impl->si->get_factory_uuid() == target_uuid)
1471 { 1527 {
1472 _panel_client.prepare (ic->id); 1528 _panel_client.prepare(ic->id);
1473 SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n"; 1529 SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n";
1474 ic->impl->si->process_helper_event (helper_uuid, trans); 1530 ic->impl->si->process_helper_event(helper_uuid, trans);
1475 _panel_client.send (); 1531 _panel_client.send();
1476 } 1532 }
1477} 1533}
1478 1534
1479static void 1535static void
1480panel_slot_move_preedit_caret (int context, int caret_pos) 1536panel_slot_move_preedit_caret(int context, int caret_pos)
1481{ 1537{
1482 EcoreIMFContextISF *ic = find_ic (context); 1538 EcoreIMFContextISF *ic = find_ic(context);
1483 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n"; 1539 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n";
1484 if (ic && ic->impl) 1540 if (ic && ic->impl)
1485 { 1541 {
1486 _panel_client.prepare (ic->id); 1542 _panel_client.prepare(ic->id);
1487 ic->impl->si->move_preedit_caret (caret_pos); 1543 ic->impl->si->move_preedit_caret(caret_pos);
1488 _panel_client.send (); 1544 _panel_client.send();
1489 } 1545 }
1490} 1546}
1491 1547
1492static void 1548static void
1493panel_slot_select_candidate (int context, int cand_index) 1549panel_slot_select_candidate(int context, int cand_index)
1494{ 1550{
1495 EcoreIMFContextISF *ic = find_ic (context); 1551 EcoreIMFContextISF *ic = find_ic(context);
1496 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n"; 1552 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n";
1497 if (ic && ic->impl) 1553 if (ic && ic->impl)
1498 { 1554 {
1499 _panel_client.prepare (ic->id); 1555 _panel_client.prepare(ic->id);
1500 ic->impl->si->select_candidate (cand_index); 1556 ic->impl->si->select_candidate(cand_index);
1501 _panel_client.send (); 1557 _panel_client.send();
1502 } 1558 }
1503} 1559}
1504 1560
1505static void 1561static void
1506panel_slot_process_key_event (int context, const KeyEvent &key) 1562panel_slot_process_key_event(int context, const KeyEvent &key)
1507{ 1563{
1508 EcoreIMFContextISF *ic = find_ic (context); 1564 EcoreIMFContextISF *ic = find_ic(context);
1509 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; 1565 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n";
1510 1566
1511 if (ic && ic->impl && ic->impl->client_canvas) 1567 if (key.is_key_press())
1512 feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE); 1568 ecore_x_test_fake_key_press(key.get_key_string().c_str());
1513} 1569}
1514 1570
1515static void 1571static void
1516panel_slot_commit_string (int context, const WideString &wstr) 1572panel_slot_commit_string(int context, const WideString &wstr)
1517{ 1573{
1518 EcoreIMFContextISF *ic = find_ic (context); 1574 EcoreIMFContextISF *ic = find_ic(context);
1519 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n"; 1575 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs(wstr) << " ic=" << ic << "\n";
1520 1576
1521 if (ic && ic->impl) 1577 if (ic && ic->impl)
1522 { 1578 {
1523 if (_focused_ic != ic) 1579 if (_focused_ic != ic)
1524 return; 1580 return;
1525 1581
1526 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (wstr).c_str ()); 1582 ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(wstr).c_str());
1527 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); 1583 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
1528 } 1584 }
1529} 1585}
1530 1586
1531static void 1587static void
1532panel_slot_forward_key_event (int context, const KeyEvent &key) 1588panel_slot_forward_key_event(int context, const KeyEvent &key)
1533{ 1589{
1534 EcoreIMFContextISF *ic = find_ic (context); 1590 EcoreIMFContextISF *ic = find_ic(context);
1535 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; 1591 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n";
1536 1592
1537 if (ic && ic->impl && ic->impl->client_canvas) 1593 if (ic && ic->impl && ic->impl->client_canvas)
1538 feed_key_event (ic->impl->client_canvas, key.get_key_string ().c_str (), EINA_TRUE); 1594 feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_TRUE);
1539} 1595}
1540 1596
1541static void 1597static void
1542panel_slot_request_help (int context) 1598panel_slot_request_help(int context)
1543{ 1599{
1544 EcoreIMFContextISF *ic = find_ic (context); 1600 EcoreIMFContextISF *ic = find_ic(context);
1545 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1601 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1546 1602
1547 if (ic && ic->impl) 1603 if (ic && ic->impl)
1548 { 1604 {
1549 _panel_client.prepare (ic->id); 1605 _panel_client.prepare(ic->id);
1550 panel_req_show_help (ic); 1606 panel_req_show_help(ic);
1551 _panel_client.send (); 1607 _panel_client.send();
1552 } 1608 }
1553} 1609}
1554 1610
1555static void 1611static void
1556panel_slot_request_factory_menu (int context) 1612panel_slot_request_factory_menu(int context)
1557{ 1613{
1558 EcoreIMFContextISF *ic = find_ic (context); 1614 EcoreIMFContextISF *ic = find_ic(context);
1559 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1615 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1560 1616
1561 if (ic && ic->impl) 1617 if (ic && ic->impl)
1562 { 1618 {
1563 _panel_client.prepare (ic->id); 1619 _panel_client.prepare(ic->id);
1564 panel_req_show_factory_menu (ic); 1620 panel_req_show_factory_menu(ic);
1565 _panel_client.send (); 1621 _panel_client.send();
1566 } 1622 }
1567} 1623}
1568 1624
1569static void 1625static void
1570panel_slot_change_factory (int context, const String &uuid) 1626panel_slot_change_factory(int context, const String &uuid)
1571{ 1627{
1572 EcoreIMFContextISF *ic = find_ic (context); 1628 EcoreIMFContextISF *ic = find_ic(context);
1573 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n"; 1629 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n";
1574 1630
1575 if (ic && ic->impl) 1631 if (ic && ic->impl)
1576 { 1632 {
1577 ic->impl->si->reset (); 1633 ic->impl->si->reset();
1578 _panel_client.prepare (ic->id); 1634 _panel_client.prepare(ic->id);
1579 open_specific_factory (ic, uuid); 1635 open_specific_factory(ic, uuid);
1580 _panel_client.send (); 1636 _panel_client.send();
1581 } 1637 }
1582} 1638}
1583 1639
1584/* Panel Requestion functions. */ 1640/* Panel Requestion functions. */
1585static void 1641static void
1586panel_req_show_help (EcoreIMFContextISF *ic) 1642panel_req_show_help(EcoreIMFContextISF *ic)
1587{ 1643{
1588 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1644 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1589 1645
1590 String help; 1646 String help;
1591 1647
1592 help = String ("Smart Common Input Method platform ") + 1648 help = String("Smart Common Input Method platform ") +
1593 //String (SCIM_VERSION) + 1649 //String(SCIM_VERSION) +
1594 String ("\n(C) 2002-2005 James Su <suzhe@tsinghua.org.cn>\n\n"); 1650 String("\n(C) 2002-2005 James Su <suzhe@tsinghua.org.cn>\n\n");
1595 1651
1596 if (ic && ic->impl) 1652 if (ic && ic->impl)
1597 { 1653 {
1598 IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); 1654 IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid());
1599 if (sf) 1655 if (sf)
1600 { 1656 {
1601 help += utf8_wcstombs (sf->get_name ()); 1657 help += utf8_wcstombs(sf->get_name());
1602 help += String (":\n\n"); 1658 help += String(":\n\n");
1603 1659
1604 help += utf8_wcstombs (sf->get_help ()); 1660 help += utf8_wcstombs(sf->get_help());
1605 help += String ("\n\n"); 1661 help += String("\n\n");
1606 1662
1607 help += utf8_wcstombs (sf->get_credits ()); 1663 help += utf8_wcstombs(sf->get_credits());
1608 } 1664 }
1609 _panel_client.show_help (ic->id, help); 1665 _panel_client.show_help(ic->id, help);
1610 } 1666 }
1611} 1667}
1612 1668
1613static void 1669static void
1614panel_req_show_factory_menu (EcoreIMFContextISF *ic) 1670panel_req_show_factory_menu(EcoreIMFContextISF *ic)
1615{ 1671{
1616 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1672 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1617 1673
1618 std::vector<IMEngineFactoryPointer> factories; 1674 std::vector<IMEngineFactoryPointer> factories;
1619 std::vector <PanelFactoryInfo> menu; 1675 std::vector <PanelFactoryInfo> menu;
1620 1676
1621 _backend->get_factories_for_encoding (factories, "UTF-8"); 1677 _backend->get_factories_for_encoding(factories, "UTF-8");
1622 1678
1623 for (size_t i = 0; i < factories.size (); ++ i) 1679 for (size_t i = 0; i < factories.size(); ++ i)
1624 { 1680 {
1625 menu.push_back (PanelFactoryInfo ( 1681 menu.push_back(PanelFactoryInfo(
1626 factories [i]->get_uuid (), 1682 factories [i]->get_uuid(),
1627 utf8_wcstombs (factories [i]->get_name ()), 1683 utf8_wcstombs(factories [i]->get_name()),
1628 factories [i]->get_language (), 1684 factories [i]->get_language(),
1629 factories [i]->get_icon_file ())); 1685 factories [i]->get_icon_file()));
1630 } 1686 }
1631 1687
1632 if (menu.size ()) 1688 if (menu.size())
1633 _panel_client.show_factory_menu (ic->id, menu); 1689 _panel_client.show_factory_menu(ic->id, menu);
1634} 1690}
1635 1691
1636static void 1692static void
1637panel_req_update_factory_info (EcoreIMFContextISF *ic) 1693panel_req_update_factory_info(EcoreIMFContextISF *ic)
1638{ 1694{
1639 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1695 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1640 1696
@@ -1643,160 +1699,160 @@ panel_req_update_factory_info (EcoreIMFContextISF *ic)
1643 PanelFactoryInfo info; 1699 PanelFactoryInfo info;
1644 if (ic->impl->is_on) 1700 if (ic->impl->is_on)
1645 { 1701 {
1646 IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); 1702 IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid());
1647 if (sf) 1703 if (sf)
1648 info = PanelFactoryInfo (sf->get_uuid (), utf8_wcstombs (sf->get_name ()), sf->get_language (), sf->get_icon_file ()); 1704 info = PanelFactoryInfo(sf->get_uuid(), utf8_wcstombs(sf->get_name()), sf->get_language(), sf->get_icon_file());
1649 } 1705 }
1650 else 1706 else
1651 { 1707 {
1652 info = PanelFactoryInfo (String (""), String ("English/Keyboard"), String ("C"), ""); 1708 info = PanelFactoryInfo(String(""), String("English/Keyboard"), String("C"), "");
1653 } 1709 }
1654 _panel_client.update_factory_info (ic->id, info); 1710 _panel_client.update_factory_info(ic->id, info);
1655 } 1711 }
1656} 1712}
1657 1713
1658static void 1714static void
1659panel_req_focus_in (EcoreIMFContextISF *ic) 1715panel_req_focus_in(EcoreIMFContextISF *ic)
1660{ 1716{
1661 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1717 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1662 1718
1663 _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ()); 1719 _panel_client.focus_in(ic->id, ic->impl->si->get_factory_uuid());
1664} 1720}
1665 1721
1666static void 1722static void
1667panel_req_update_spot_location (EcoreIMFContextISF *ic) 1723panel_req_update_spot_location(EcoreIMFContextISF *ic)
1668{ 1724{
1669 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1725 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1670 1726
1671 _panel_client.update_spot_location (ic->id, ic->impl->cursor_x, ic->impl->cursor_y); 1727 _panel_client.update_spot_location(ic->id, ic->impl->cursor_x, ic->impl->cursor_y);
1672} 1728}
1673 1729
1674static bool 1730static bool
1675filter_hotkeys (EcoreIMFContextISF *ic, const KeyEvent &key) 1731filter_hotkeys(EcoreIMFContextISF *ic, const KeyEvent &key)
1676{ 1732{
1677 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1678 1734
1679 bool ret = false; 1735 bool ret = false;
1680 1736
1681 _frontend_hotkey_matcher.push_key_event (key); 1737 _frontend_hotkey_matcher.push_key_event(key);
1682 _imengine_hotkey_matcher.push_key_event (key); 1738 _imengine_hotkey_matcher.push_key_event(key);
1683 1739
1684 FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result (); 1740 FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result();
1685 1741
1686 if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER) 1742 if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER)
1687 { 1743 {
1688 if (!ic->impl->is_on) 1744 if (!ic->impl->is_on)
1689 turn_on_ic (ic); 1745 turn_on_ic(ic);
1690 else 1746 else
1691 turn_off_ic (ic); 1747 turn_off_ic(ic);
1692 ret = true; 1748 ret = true;
1693 } 1749 }
1694 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) 1750 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON)
1695 { 1751 {
1696 if (!ic->impl->is_on) 1752 if (!ic->impl->is_on)
1697 turn_on_ic (ic); 1753 turn_on_ic(ic);
1698 ret = true; 1754 ret = true;
1699 } 1755 }
1700 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF) 1756 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF)
1701 { 1757 {
1702 if (ic->impl->is_on) 1758 if (ic->impl->is_on)
1703 turn_off_ic (ic); 1759 turn_off_ic(ic);
1704 ret = true; 1760 ret = true;
1705 } 1761 }
1706 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY) 1762 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY)
1707 { 1763 {
1708 open_next_factory (ic); 1764 open_next_factory(ic);
1709 ret = true; 1765 ret = true;
1710 } 1766 }
1711 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY) 1767 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY)
1712 { 1768 {
1713 open_previous_factory (ic); 1769 open_previous_factory(ic);
1714 ret = true; 1770 ret = true;
1715 } 1771 }
1716 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU) 1772 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU)
1717 { 1773 {
1718 panel_req_show_factory_menu (ic); 1774 panel_req_show_factory_menu(ic);
1719 ret = true; 1775 ret = true;
1720 } 1776 }
1721 else if (_imengine_hotkey_matcher.is_matched ()) 1777 else if (_imengine_hotkey_matcher.is_matched())
1722 { 1778 {
1723 String sfid = _imengine_hotkey_matcher.get_match_result (); 1779 String sfid = _imengine_hotkey_matcher.get_match_result();
1724 open_specific_factory (ic, sfid); 1780 open_specific_factory(ic, sfid);
1725 ret = true; 1781 ret = true;
1726 } 1782 }
1727 return ret; 1783 return ret;
1728} 1784}
1729 1785
1730static bool 1786static bool
1731panel_initialize (void) 1787panel_initialize(void)
1732{ 1788{
1733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1789 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1734 1790
1735 String display_name; 1791 String display_name;
1736 { 1792 {
1737 const char *p = getenv ("DISPLAY"); 1793 const char *p = getenv("DISPLAY");
1738 if (p) display_name = String (p); 1794 if (p) display_name = String(p);
1739 } 1795 }
1740 1796
1741 if (_panel_client.open_connection (_config->get_name (), display_name) >= 0) 1797 if (_panel_client.open_connection(_config->get_name(), display_name) >= 0)
1742 { 1798 {
1743 int fd = _panel_client.get_connection_number (); 1799 int fd = _panel_client.get_connection_number();
1744 1800
1745 _panel_iochannel_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL); 1801 _panel_iochannel_read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL);
1746 1802
1747 SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n"; 1803 SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n";
1748 1804
1749 return true; 1805 return true;
1750 } 1806 }
1751 std::cerr << "panel_initialize () failed!!!\n"; 1807 std::cerr << "panel_initialize() failed!!!\n";
1752 return false; 1808 return false;
1753} 1809}
1754 1810
1755static void 1811static void
1756panel_finalize (void) 1812panel_finalize(void)
1757{ 1813{
1758 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1814 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1759 1815
1760 _panel_client.close_connection (); 1816 _panel_client.close_connection();
1761 1817
1762 if (_panel_iochannel_read_handler) 1818 if (_panel_iochannel_read_handler)
1763 { 1819 {
1764 ecore_main_fd_handler_del (_panel_iochannel_read_handler); 1820 ecore_main_fd_handler_del(_panel_iochannel_read_handler);
1765 _panel_iochannel_read_handler = 0; 1821 _panel_iochannel_read_handler = 0;
1766 } 1822 }
1767 1823
1768 if (_panel_iochannel_err_handler) 1824 if (_panel_iochannel_err_handler)
1769 { 1825 {
1770 ecore_main_fd_handler_del (_panel_iochannel_err_handler); 1826 ecore_main_fd_handler_del(_panel_iochannel_err_handler);
1771 _panel_iochannel_err_handler = 0; 1827 _panel_iochannel_err_handler = 0;
1772 } 1828 }
1773} 1829}
1774 1830
1775static Eina_Bool 1831static Eina_Bool
1776panel_iochannel_handler (void *data __UNUSED__, Ecore_Fd_Handler *fd_handler) 1832panel_iochannel_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler)
1777{ 1833{
1778 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1834 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1779 1835
1780 if (fd_handler == _panel_iochannel_read_handler) 1836 if (fd_handler == _panel_iochannel_read_handler)
1781 { 1837 {
1782 if (!_panel_client.filter_event ()) 1838 if (!_panel_client.filter_event())
1783 { 1839 {
1784 panel_finalize (); 1840 panel_finalize();
1785 panel_initialize (); 1841 panel_initialize();
1786 return ECORE_CALLBACK_CANCEL; 1842 return ECORE_CALLBACK_CANCEL;
1787 } 1843 }
1788 } 1844 }
1789 else if (fd_handler == _panel_iochannel_err_handler) 1845 else if (fd_handler == _panel_iochannel_err_handler)
1790 { 1846 {
1791 panel_finalize (); 1847 panel_finalize();
1792 panel_initialize (); 1848 panel_initialize();
1793 return ECORE_CALLBACK_CANCEL; 1849 return ECORE_CALLBACK_CANCEL;
1794 } 1850 }
1795 return ECORE_CALLBACK_RENEW; 1851 return ECORE_CALLBACK_RENEW;
1796} 1852}
1797 1853
1798static void 1854static void
1799turn_on_ic (EcoreIMFContextISF *ic) 1855turn_on_ic(EcoreIMFContextISF *ic)
1800{ 1856{
1801 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1857 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1802 1858
@@ -1806,25 +1862,25 @@ turn_on_ic (EcoreIMFContextISF *ic)
1806 1862
1807 if (ic == _focused_ic) 1863 if (ic == _focused_ic)
1808 { 1864 {
1809 panel_req_focus_in (ic); 1865 panel_req_focus_in(ic);
1810 panel_req_update_spot_location (ic); 1866 panel_req_update_spot_location(ic);
1811 panel_req_update_factory_info (ic); 1867 panel_req_update_factory_info(ic);
1812 _panel_client.turn_on (ic->id); 1868 _panel_client.turn_on(ic->id);
1813 _panel_client.hide_preedit_string (ic->id); 1869 _panel_client.hide_preedit_string(ic->id);
1814 _panel_client.hide_aux_string (ic->id); 1870 _panel_client.hide_aux_string(ic->id);
1815 _panel_client.hide_lookup_table (ic->id); 1871 _panel_client.hide_lookup_table(ic->id);
1816 ic->impl->si->focus_in (); 1872 ic->impl->si->focus_in();
1817 } 1873 }
1818 1874
1819 //Record the IC on/off status 1875 //Record the IC on/off status
1820 if (_shared_input_method) 1876 if (_shared_input_method)
1821 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); 1877 _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true);
1822 1878
1823 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 1879 if (ic->impl->use_preedit && ic->impl->preedit_string.length())
1824 { 1880 {
1825 ecore_imf_context_preedit_start_event_add (ic->ctx); 1881 ecore_imf_context_preedit_start_event_add(ic->ctx);
1826 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 1882 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
1827 ecore_imf_context_preedit_changed_event_add (ic->ctx); 1883 ecore_imf_context_preedit_changed_event_add(ic->ctx);
1828 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 1884 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1829 ic->impl->preedit_started = true; 1885 ic->impl->preedit_started = true;
1830 } 1886 }
@@ -1832,7 +1888,7 @@ turn_on_ic (EcoreIMFContextISF *ic)
1832} 1888}
1833 1889
1834static void 1890static void
1835turn_off_ic (EcoreIMFContextISF *ic) 1891turn_off_ic(EcoreIMFContextISF *ic)
1836{ 1892{
1837 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1893 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1838 1894
@@ -1842,21 +1898,21 @@ turn_off_ic (EcoreIMFContextISF *ic)
1842 1898
1843 if (ic == _focused_ic) 1899 if (ic == _focused_ic)
1844 { 1900 {
1845 ic->impl->si->focus_out (); 1901 ic->impl->si->focus_out();
1846 1902
1847 panel_req_update_factory_info (ic); 1903 panel_req_update_factory_info(ic);
1848 _panel_client.turn_off (ic->id); 1904 _panel_client.turn_off(ic->id);
1849 } 1905 }
1850 1906
1851 //Record the IC on/off status 1907 //Record the IC on/off status
1852 if (_shared_input_method) 1908 if (_shared_input_method)
1853 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); 1909 _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
1854 1910
1855 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 1911 if (ic->impl->use_preedit && ic->impl->preedit_string.length())
1856 { 1912 {
1857 ecore_imf_context_preedit_changed_event_add (ic->ctx); 1913 ecore_imf_context_preedit_changed_event_add(ic->ctx);
1858 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 1914 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1859 ecore_imf_context_preedit_end_event_add (ic->ctx); 1915 ecore_imf_context_preedit_end_event_add(ic->ctx);
1860 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); 1916 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
1861 ic->impl->preedit_started = false; 1917 ic->impl->preedit_started = false;
1862 } 1918 }
@@ -1864,7 +1920,7 @@ turn_off_ic (EcoreIMFContextISF *ic)
1864} 1920}
1865 1921
1866static void 1922static void
1867set_ic_capabilities (EcoreIMFContextISF *ic) 1923set_ic_capabilities(EcoreIMFContextISF *ic)
1868{ 1924{
1869 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1925 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1870 1926
@@ -1875,12 +1931,12 @@ set_ic_capabilities (EcoreIMFContextISF *ic)
1875 if (!_on_the_spot || !ic->impl->use_preedit) 1931 if (!_on_the_spot || !ic->impl->use_preedit)
1876 cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT; 1932 cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT;
1877 1933
1878 ic->impl->si->update_client_capabilities (cap); 1934 ic->impl->si->update_client_capabilities(cap);
1879 } 1935 }
1880} 1936}
1881 1937
1882static bool 1938static bool
1883check_socket_frontend (void) 1939check_socket_frontend(void)
1884{ 1940{
1885 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1941 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1886 1942
@@ -1889,23 +1945,23 @@ check_socket_frontend (void)
1889 1945
1890 uint32 magic; 1946 uint32 magic;
1891 1947
1892 address.set_address (scim_get_default_socket_frontend_address ()); 1948 address.set_address(scim_get_default_socket_frontend_address());
1893 1949
1894 if (!client.connect (address)) 1950 if (!client.connect(address))
1895 return false; 1951 return false;
1896 1952
1897 if (!scim_socket_open_connection (magic, 1953 if (!scim_socket_open_connection(magic,
1898 String ("ConnectionTester"), 1954 String("ConnectionTester"),
1899 String ("SocketFrontEnd"), 1955 String("SocketFrontEnd"),
1900 client, 1956 client,
1901 1000)) 1957 1000))
1902 return false; 1958 return false;
1903 1959
1904 return true; 1960 return true;
1905} 1961}
1906 1962
1907void 1963void
1908initialize (void) 1964initialize(void)
1909{ 1965{
1910 std::vector<String> config_list; 1966 std::vector<String> config_list;
1911 std::vector<String> engine_list; 1967 std::vector<String> engine_list;
@@ -1924,31 +1980,31 @@ initialize (void)
1924 SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n"; 1980 SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n";
1925 1981
1926 // Get system language. 1982 // Get system language.
1927 _language = scim_get_locale_language (scim_get_current_locale ()); 1983 _language = scim_get_locale_language(scim_get_current_locale());
1928 1984
1929 if (socket) 1985 if (socket)
1930 { 1986 {
1931 // If no Socket FrontEnd is running, then launch one. 1987 // If no Socket FrontEnd is running, then launch one.
1932 // And set manual to false. 1988 // And set manual to false.
1933 bool check_result = check_socket_frontend (); 1989 bool check_result = check_socket_frontend();
1934 if (!check_result) 1990 if (!check_result)
1935 { 1991 {
1936 std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n"; 1992 std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n";
1937 //get modules list 1993 //get modules list
1938 scim_get_imengine_module_list (engine_list); 1994 scim_get_imengine_module_list(engine_list);
1939 1995
1940 for (it = engine_list.begin (); it != engine_list.end (); it++) 1996 for (it = engine_list.begin(); it != engine_list.end(); it++)
1941 { 1997 {
1942 if (*it != "socket") 1998 if (*it != "socket")
1943 load_engine_list.push_back (*it); 1999 load_engine_list.push_back(*it);
1944 } 2000 }
1945 2001
1946 const char *new_argv [] = { "--no-stay", 0 }; 2002 const char *new_argv [] = { "--no-stay", 0 };
1947 scim_launch (true, 2003 scim_launch(true,
1948 config_module_name, 2004 config_module_name,
1949 (load_engine_list.size () ? scim_combine_string_list (load_engine_list, ',') : "none"), 2005 (load_engine_list.size() ? scim_combine_string_list(load_engine_list, ',') : "none"),
1950 "socket", 2006 "socket",
1951 (char **)new_argv); 2007 (char **)new_argv);
1952 manual = false; 2008 manual = false;
1953 } 2009 }
1954 2010
@@ -1961,12 +2017,12 @@ initialize (void)
1961 if (check_result) 2017 if (check_result)
1962 { 2018 {
1963 config_module_name = "socket"; 2019 config_module_name = "socket";
1964 load_engine_list.clear (); 2020 load_engine_list.clear();
1965 load_engine_list.push_back ("socket"); 2021 load_engine_list.push_back("socket");
1966 break; 2022 break;
1967 } 2023 }
1968 scim_usleep (50000); 2024 scim_usleep(50000);
1969 check_result = check_socket_frontend (); 2025 check_result = check_socket_frontend();
1970 } 2026 }
1971 } 2027 }
1972 } 2028 }
@@ -1975,69 +2031,69 @@ initialize (void)
1975 { 2031 {
1976 //load config module 2032 //load config module
1977 SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n"; 2033 SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n";
1978 _config_module = new ConfigModule (config_module_name); 2034 _config_module = new ConfigModule(config_module_name);
1979 2035
1980 //create config instance 2036 //create config instance
1981 if (_config_module != NULL && _config_module->valid ()) 2037 if (_config_module != NULL && _config_module->valid())
1982 _config = _config_module->create_config (); 2038 _config = _config_module->create_config();
1983 } 2039 }
1984 2040
1985 if (_config.null ()) 2041 if (_config.null())
1986 { 2042 {
1987 SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n"; 2043 SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n";
1988 2044
1989 if (_config_module) delete _config_module; 2045 if (_config_module) delete _config_module;
1990 _config_module = NULL; 2046 _config_module = NULL;
1991 2047
1992 _config = new DummyConfig (); 2048 _config = new DummyConfig();
1993 config_module_name = "dummy"; 2049 config_module_name = "dummy";
1994 } 2050 }
1995 2051
1996 reload_config_callback (_config); 2052 reload_config_callback(_config);
1997 _config->signal_connect_reload (slot (reload_config_callback)); 2053 _config->signal_connect_reload(slot(reload_config_callback));
1998 2054
1999 // create backend 2055 // create backend
2000 _backend = new CommonBackEnd (_config, load_engine_list.size () ? load_engine_list : engine_list); 2056 _backend = new CommonBackEnd(_config, load_engine_list.size() ? load_engine_list : engine_list);
2001 2057
2002 if (_backend.null ()) 2058 if (_backend.null())
2003 std::cerr << "Cannot create BackEnd Object!\n"; 2059 std::cerr << "Cannot create BackEnd Object!\n";
2004 else 2060 else
2005 _fallback_factory = _backend->get_factory (SCIM_COMPOSE_KEY_FACTORY_UUID); 2061 _fallback_factory = _backend->get_factory(SCIM_COMPOSE_KEY_FACTORY_UUID);
2006 2062
2007 if (_fallback_factory.null ()) 2063 if (_fallback_factory.null())
2008 _fallback_factory = new DummyIMEngineFactory (); 2064 _fallback_factory = new DummyIMEngineFactory();
2009 2065
2010 _fallback_instance = _fallback_factory->create_instance (String ("UTF-8"), 0); 2066 _fallback_instance = _fallback_factory->create_instance(String("UTF-8"), 0);
2011 _fallback_instance->signal_connect_commit_string (slot (fallback_commit_string_cb)); 2067 _fallback_instance->signal_connect_commit_string(slot(fallback_commit_string_cb));
2012 2068
2013 // Attach Panel Client signal. 2069 // Attach Panel Client signal.
2014 _panel_client.signal_connect_reload_config (slot (panel_slot_reload_config)); 2070 _panel_client.signal_connect_reload_config (slot(panel_slot_reload_config));
2015 _panel_client.signal_connect_exit (slot (panel_slot_exit)); 2071 _panel_client.signal_connect_exit (slot(panel_slot_exit));
2016 _panel_client.signal_connect_update_lookup_table_page_size (slot (panel_slot_update_lookup_table_page_size)); 2072 _panel_client.signal_connect_update_lookup_table_page_size(slot(panel_slot_update_lookup_table_page_size));
2017 _panel_client.signal_connect_lookup_table_page_up (slot (panel_slot_lookup_table_page_up)); 2073 _panel_client.signal_connect_lookup_table_page_up (slot(panel_slot_lookup_table_page_up));
2018 _panel_client.signal_connect_lookup_table_page_down (slot (panel_slot_lookup_table_page_down)); 2074 _panel_client.signal_connect_lookup_table_page_down (slot(panel_slot_lookup_table_page_down));
2019 _panel_client.signal_connect_trigger_property (slot (panel_slot_trigger_property)); 2075 _panel_client.signal_connect_trigger_property (slot(panel_slot_trigger_property));
2020 _panel_client.signal_connect_process_helper_event (slot (panel_slot_process_helper_event)); 2076 _panel_client.signal_connect_process_helper_event (slot(panel_slot_process_helper_event));
2021 _panel_client.signal_connect_move_preedit_caret (slot (panel_slot_move_preedit_caret)); 2077 _panel_client.signal_connect_move_preedit_caret (slot(panel_slot_move_preedit_caret));
2022 _panel_client.signal_connect_select_candidate (slot (panel_slot_select_candidate)); 2078 _panel_client.signal_connect_select_candidate (slot(panel_slot_select_candidate));
2023 _panel_client.signal_connect_process_key_event (slot (panel_slot_process_key_event)); 2079 _panel_client.signal_connect_process_key_event (slot(panel_slot_process_key_event));
2024 _panel_client.signal_connect_commit_string (slot (panel_slot_commit_string)); 2080 _panel_client.signal_connect_commit_string (slot(panel_slot_commit_string));
2025 _panel_client.signal_connect_forward_key_event (slot (panel_slot_forward_key_event)); 2081 _panel_client.signal_connect_forward_key_event (slot(panel_slot_forward_key_event));
2026 _panel_client.signal_connect_request_help (slot (panel_slot_request_help)); 2082 _panel_client.signal_connect_request_help (slot(panel_slot_request_help));
2027 _panel_client.signal_connect_request_factory_menu (slot (panel_slot_request_factory_menu)); 2083 _panel_client.signal_connect_request_factory_menu (slot(panel_slot_request_factory_menu));
2028 _panel_client.signal_connect_change_factory (slot (panel_slot_change_factory)); 2084 _panel_client.signal_connect_change_factory (slot(panel_slot_change_factory));
2029 2085
2030 if (!panel_initialize ()) 2086 if (!panel_initialize())
2031 std::cerr << "Ecore IM Module: Cannot connect to Panel!\n"; 2087 std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
2032} 2088}
2033 2089
2034static void 2090static void
2035finalize (void) 2091finalize(void)
2036{ 2092{
2037 SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n"; 2093 SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n";
2038 2094
2039 // Reset this first so that the shared instance could be released correctly afterwards. 2095 // Reset this first so that the shared instance could be released correctly afterwards.
2040 _default_instance.reset (); 2096 _default_instance.reset();
2041 2097
2042 SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n"; 2098 SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n";
2043 while (_used_ic_impl_list) 2099 while (_used_ic_impl_list)
@@ -2045,20 +2101,20 @@ finalize (void)
2045 // In case in "shared input method" mode, 2101 // In case in "shared input method" mode,
2046 // all contexts share only one instance, 2102 // all contexts share only one instance,
2047 // so we need point the reference pointer correctly before finalizing. 2103 // so we need point the reference pointer correctly before finalizing.
2048 _used_ic_impl_list->si->set_frontend_data (static_cast <void*> (_used_ic_impl_list->parent)); 2104 _used_ic_impl_list->si->set_frontend_data(static_cast <void*>(_used_ic_impl_list->parent));
2049 isf_imf_context_del (_used_ic_impl_list->parent->ctx); 2105 isf_imf_context_del(_used_ic_impl_list->parent->ctx);
2050 } 2106 }
2051 2107
2052 delete_all_ic_impl (); 2108 delete_all_ic_impl();
2053 2109
2054 _fallback_instance.reset (); 2110 _fallback_instance.reset();
2055 _fallback_factory.reset (); 2111 _fallback_factory.reset();
2056 2112
2057 SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n"; 2113 SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n";
2058 _backend.reset (); 2114 _backend.reset();
2059 2115
2060 SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n"; 2116 SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n";
2061 _config.reset (); 2117 _config.reset();
2062 2118
2063 if (_config_module) 2119 if (_config_module)
2064 { 2120 {
@@ -2072,27 +2128,27 @@ finalize (void)
2072 2128
2073 _scim_initialized = false; 2129 _scim_initialized = false;
2074 2130
2075 panel_finalize (); 2131 panel_finalize();
2076} 2132}
2077 2133
2078static void 2134static void
2079open_next_factory (EcoreIMFContextISF *ic) 2135open_next_factory(EcoreIMFContextISF *ic)
2080{ 2136{
2081 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; 2137 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2082 IMEngineFactoryPointer sf = _backend->get_next_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); 2138 IMEngineFactoryPointer sf = _backend->get_next_factory("", "UTF-8", ic->impl->si->get_factory_uuid());
2083 2139
2084 if (!sf.null ()) 2140 if (!sf.null())
2085 { 2141 {
2086 turn_off_ic (ic); 2142 turn_off_ic(ic);
2087 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); 2143 ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
2088 ic->impl->si->set_frontend_data (static_cast <void*> (ic)); 2144 ic->impl->si->set_frontend_data(static_cast <void*>(ic));
2089 ic->impl->preedit_string = WideString (); 2145 ic->impl->preedit_string = WideString();
2090 ic->impl->preedit_caret = 0; 2146 ic->impl->preedit_caret = 0;
2091 attach_instance (ic->impl->si); 2147 attach_instance(ic->impl->si);
2092 _backend->set_default_factory (_language, sf->get_uuid ()); 2148 _backend->set_default_factory(_language, sf->get_uuid());
2093 _panel_client.register_input_context (ic->id, sf->get_uuid ()); 2149 _panel_client.register_input_context(ic->id, sf->get_uuid());
2094 set_ic_capabilities (ic); 2150 set_ic_capabilities(ic);
2095 turn_on_ic (ic); 2151 turn_on_ic(ic);
2096 2152
2097 if (_shared_input_method) 2153 if (_shared_input_method)
2098 { 2154 {
@@ -2103,26 +2159,26 @@ open_next_factory (EcoreIMFContextISF *ic)
2103} 2159}
2104 2160
2105static void 2161static void
2106open_previous_factory (EcoreIMFContextISF *ic) 2162open_previous_factory(EcoreIMFContextISF *ic)
2107{ 2163{
2108 if (ic == NULL) 2164 if (ic == NULL)
2109 return; 2165 return;
2110 2166
2111 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; 2167 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2112 IMEngineFactoryPointer sf = _backend->get_previous_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); 2168 IMEngineFactoryPointer sf = _backend->get_previous_factory("", "UTF-8", ic->impl->si->get_factory_uuid());
2113 2169
2114 if (!sf.null ()) 2170 if (!sf.null())
2115 { 2171 {
2116 turn_off_ic (ic); 2172 turn_off_ic(ic);
2117 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); 2173 ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
2118 ic->impl->si->set_frontend_data (static_cast <void*> (ic)); 2174 ic->impl->si->set_frontend_data(static_cast <void*>(ic));
2119 ic->impl->preedit_string = WideString (); 2175 ic->impl->preedit_string = WideString();
2120 ic->impl->preedit_caret = 0; 2176 ic->impl->preedit_caret = 0;
2121 attach_instance (ic->impl->si); 2177 attach_instance(ic->impl->si);
2122 _backend->set_default_factory (_language, sf->get_uuid ()); 2178 _backend->set_default_factory(_language, sf->get_uuid());
2123 _panel_client.register_input_context (ic->id, sf->get_uuid ()); 2179 _panel_client.register_input_context(ic->id, sf->get_uuid());
2124 set_ic_capabilities (ic); 2180 set_ic_capabilities(ic);
2125 turn_on_ic (ic); 2181 turn_on_ic(ic);
2126 2182
2127 if (_shared_input_method) 2183 if (_shared_input_method)
2128 { 2184 {
@@ -2133,7 +2189,7 @@ open_previous_factory (EcoreIMFContextISF *ic)
2133} 2189}
2134 2190
2135static void 2191static void
2136open_specific_factory (EcoreIMFContextISF *ic, 2192open_specific_factory(EcoreIMFContextISF *ic,
2137 const String &uuid) 2193 const String &uuid)
2138{ 2194{
2139 if (ic == NULL) 2195 if (ic == NULL)
@@ -2142,26 +2198,26 @@ open_specific_factory (EcoreIMFContextISF *ic,
2142 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; 2198 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2143 2199
2144 // The same input method is selected, just turn on the IC. 2200 // The same input method is selected, just turn on the IC.
2145 if (ic->impl->si->get_factory_uuid () == uuid) 2201 if (ic->impl->si->get_factory_uuid() == uuid)
2146 { 2202 {
2147 turn_on_ic (ic); 2203 turn_on_ic(ic);
2148 return; 2204 return;
2149 } 2205 }
2150 2206
2151 IMEngineFactoryPointer sf = _backend->get_factory (uuid); 2207 IMEngineFactoryPointer sf = _backend->get_factory(uuid);
2152 2208
2153 if (uuid.length () && !sf.null ()) 2209 if (uuid.length() && !sf.null())
2154 { 2210 {
2155 turn_off_ic (ic); 2211 turn_off_ic(ic);
2156 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); 2212 ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
2157 ic->impl->si->set_frontend_data (static_cast <void*> (ic)); 2213 ic->impl->si->set_frontend_data(static_cast <void*>(ic));
2158 ic->impl->preedit_string = WideString (); 2214 ic->impl->preedit_string = WideString();
2159 ic->impl->preedit_caret = 0; 2215 ic->impl->preedit_caret = 0;
2160 attach_instance (ic->impl->si); 2216 attach_instance(ic->impl->si);
2161 _backend->set_default_factory (_language, sf->get_uuid ()); 2217 _backend->set_default_factory(_language, sf->get_uuid());
2162 _panel_client.register_input_context (ic->id, sf->get_uuid ()); 2218 _panel_client.register_input_context(ic->id, sf->get_uuid());
2163 set_ic_capabilities (ic); 2219 set_ic_capabilities(ic);
2164 turn_on_ic (ic); 2220 turn_on_ic(ic);
2165 2221
2166 if (_shared_input_method) 2222 if (_shared_input_method)
2167 { 2223 {
@@ -2171,29 +2227,29 @@ open_specific_factory (EcoreIMFContextISF *ic,
2171 } 2227 }
2172 else 2228 else
2173 { 2229 {
2174 // turn_off_ic comment out panel_req_update_factory_info () 2230 // turn_off_ic comment out panel_req_update_factory_info()
2175 turn_off_ic (ic); 2231 turn_off_ic(ic);
2176 if (ic && ic->impl->is_on) 2232 if (ic && ic->impl->is_on)
2177 { 2233 {
2178 ic->impl->is_on = false; 2234 ic->impl->is_on = false;
2179 2235
2180 if (ic == _focused_ic) 2236 if (ic == _focused_ic)
2181 { 2237 {
2182 ic->impl->si->focus_out (); 2238 ic->impl->si->focus_out();
2183 2239
2184 panel_req_update_factory_info (ic); 2240 panel_req_update_factory_info(ic);
2185 _panel_client.turn_off (ic->id); 2241 _panel_client.turn_off(ic->id);
2186 } 2242 }
2187 2243
2188 //Record the IC on/off status 2244 //Record the IC on/off status
2189 if (_shared_input_method) 2245 if (_shared_input_method)
2190 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); 2246 _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
2191 2247
2192 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 2248 if (ic->impl->use_preedit && ic->impl->preedit_string.length())
2193 { 2249 {
2194 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2250 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2195 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2251 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2196 ecore_imf_context_preedit_end_event_add (ic->ctx); 2252 ecore_imf_context_preedit_end_event_add(ic->ctx);
2197 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); 2253 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2198 ic->impl->preedit_started = false; 2254 ic->impl->preedit_started = false;
2199 } 2255 }
@@ -2201,7 +2257,7 @@ open_specific_factory (EcoreIMFContextISF *ic,
2201 } 2257 }
2202} 2258}
2203 2259
2204static void initialize_modifier_bits (Display *display) 2260static void initialize_modifier_bits(Display *display)
2205{ 2261{
2206 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2262 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2207 2263
@@ -2222,21 +2278,21 @@ static void initialize_modifier_bits (Display *display)
2222 2278
2223 XModifierKeymap *mods = NULL; 2279 XModifierKeymap *mods = NULL;
2224 2280
2225 ::KeyCode ctrl_l = XKeysymToKeycode (display, XK_Control_L); 2281 ::KeyCode ctrl_l = XKeysymToKeycode(display, XK_Control_L);
2226 ::KeyCode ctrl_r = XKeysymToKeycode (display, XK_Control_R); 2282 ::KeyCode ctrl_r = XKeysymToKeycode(display, XK_Control_R);
2227 ::KeyCode meta_l = XKeysymToKeycode (display, XK_Meta_L); 2283 ::KeyCode meta_l = XKeysymToKeycode(display, XK_Meta_L);
2228 ::KeyCode meta_r = XKeysymToKeycode (display, XK_Meta_R); 2284 ::KeyCode meta_r = XKeysymToKeycode(display, XK_Meta_R);
2229 ::KeyCode alt_l = XKeysymToKeycode (display, XK_Alt_L); 2285 ::KeyCode alt_l = XKeysymToKeycode(display, XK_Alt_L);
2230 ::KeyCode alt_r = XKeysymToKeycode (display, XK_Alt_R); 2286 ::KeyCode alt_r = XKeysymToKeycode(display, XK_Alt_R);
2231 ::KeyCode super_l = XKeysymToKeycode (display, XK_Super_L); 2287 ::KeyCode super_l = XKeysymToKeycode(display, XK_Super_L);
2232 ::KeyCode super_r = XKeysymToKeycode (display, XK_Super_R); 2288 ::KeyCode super_r = XKeysymToKeycode(display, XK_Super_R);
2233 ::KeyCode hyper_l = XKeysymToKeycode (display, XK_Hyper_L); 2289 ::KeyCode hyper_l = XKeysymToKeycode(display, XK_Hyper_L);
2234 ::KeyCode hyper_r = XKeysymToKeycode (display, XK_Hyper_R); 2290 ::KeyCode hyper_r = XKeysymToKeycode(display, XK_Hyper_R);
2235 ::KeyCode numlock = XKeysymToKeycode (display, XK_Num_Lock); 2291 ::KeyCode numlock = XKeysymToKeycode(display, XK_Num_Lock);
2236 2292
2237 int i, j; 2293 int i, j;
2238 2294
2239 mods = XGetModifierMapping (display); 2295 mods = XGetModifierMapping(display);
2240 if (mods == NULL) 2296 if (mods == NULL)
2241 return; 2297 return;
2242 2298
@@ -2283,13 +2339,13 @@ static void initialize_modifier_bits (Display *display)
2283 xkey.same_screen = False; 2339 xkey.same_screen = False;
2284 xkey.subwindow = None; 2340 xkey.subwindow = None;
2285 xkey.window = None; 2341 xkey.window = None;
2286 xkey.root = DefaultRootWindow (display); 2342 xkey.root = DefaultRootWindow(display);
2287 xkey.state = ShiftMask; 2343 xkey.state = ShiftMask;
2288 2344
2289 xkey.keycode = meta_l; 2345 xkey.keycode = meta_l;
2290 XLookupString (&xkey, buf, 32, &keysym_l, 0); 2346 XLookupString(&xkey, buf, 32, &keysym_l, 0);
2291 xkey.keycode = meta_r; 2347 xkey.keycode = meta_r;
2292 XLookupString (&xkey, buf, 32, &keysym_r, 0); 2348 XLookupString(&xkey, buf, 32, &keysym_r, 0);
2293 2349
2294 if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R)) 2350 if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R))
2295 __current_meta_mask = ShiftMask + __current_alt_mask; 2351 __current_meta_mask = ShiftMask + __current_alt_mask;
@@ -2297,16 +2353,16 @@ static void initialize_modifier_bits (Display *display)
2297 __current_meta_mask = ShiftMask + ControlMask; 2353 __current_meta_mask = ShiftMask + ControlMask;
2298 } 2354 }
2299 2355
2300 XFreeModifiermap (mods); 2356 XFreeModifiermap(mods);
2301} 2357}
2302 2358
2303static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask) 2359static unsigned int scim_x11_keymask_scim_to_x11(Display *display, uint16 scimkeymask)
2304{ 2360{
2305 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2361 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2306 2362
2307 unsigned int state = 0; 2363 unsigned int state = 0;
2308 2364
2309 initialize_modifier_bits (display); 2365 initialize_modifier_bits(display);
2310 2366
2311 if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask; 2367 if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask;
2312 if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask; 2368 if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask;
@@ -2320,9 +2376,9 @@ static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimk
2320 return state; 2376 return state;
2321} 2377}
2322 2378
2323static XKeyEvent createKeyEvent (Display *display, Window &win, 2379static XKeyEvent createKeyEvent(Display *display, Window &win,
2324 Window &winRoot, bool press, 2380 Window &winRoot, bool press,
2325 int keycode, int modifiers) 2381 int keycode, int modifiers)
2326{ 2382{
2327 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2383 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2328 2384
@@ -2339,7 +2395,7 @@ static XKeyEvent createKeyEvent (Display *display, Window &win,
2339 event.y_root = 1; 2395 event.y_root = 1;
2340 event.same_screen = EINA_TRUE; 2396 event.same_screen = EINA_TRUE;
2341 event.state = modifiers; 2397 event.state = modifiers;
2342 event.keycode = XKeysymToKeycode (display, keycode); 2398 event.keycode = XKeysymToKeycode(display, keycode);
2343 if (press) 2399 if (press)
2344 event.type = KeyPress; 2400 event.type = KeyPress;
2345 else 2401 else
@@ -2350,12 +2406,12 @@ static XKeyEvent createKeyEvent (Display *display, Window &win,
2350 return event; 2406 return event;
2351} 2407}
2352 2408
2353static void _x_send_key_event (const KeyEvent &key) 2409static void _x_send_key_event(const KeyEvent &key)
2354{ 2410{
2355 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2411 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2356 2412
2357 // Obtain the X11 display. 2413 // Obtain the X11 display.
2358 Display *display = XOpenDisplay (NULL); 2414 Display *display = XOpenDisplay(NULL);
2359 if (display == NULL) 2415 if (display == NULL)
2360 { 2416 {
2361 std::cerr << "XOpenDisplay failed\n"; 2417 std::cerr << "XOpenDisplay failed\n";
@@ -2363,98 +2419,98 @@ static void _x_send_key_event (const KeyEvent &key)
2363 } 2419 }
2364 2420
2365 // Get the root window for the current display. 2421 // Get the root window for the current display.
2366 Window winRoot = 0;// = XRootWindow (display, 1); 2422 Window winRoot = 0;
2367 2423
2368 // Find the window which has the current keyboard focus. 2424 // Find the window which has the current keyboard focus.
2369 Window winFocus = 0; 2425 Window winFocus = 0;
2370 int revert = RevertToParent; 2426 int revert = RevertToParent;
2371 2427
2372 XGetInputFocus (display, &winFocus, &revert); 2428 XGetInputFocus(display, &winFocus, &revert);
2373 2429
2374 // Send a fake key press event to the window. 2430 // Send a fake key press event to the window.
2375 XSelectInput (display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); 2431 XSelectInput(display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask);
2376 XMapWindow (display, winFocus); 2432 XMapWindow(display, winFocus);
2377 2433
2378 unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask); 2434 unsigned int modifier = scim_x11_keymask_scim_to_x11(display, key.mask);
2379 XKeyEvent event; 2435 XKeyEvent event;
2380 if (key.is_key_press ()) 2436 if (key.is_key_press())
2381 { 2437 {
2382 event = createKeyEvent (display, winFocus, winRoot, true, key.code, modifier); 2438 event = createKeyEvent(display, winFocus, winRoot, true, key.code, modifier);
2383 XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event); 2439 XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
2384 } 2440 }
2385 else 2441 else
2386 { 2442 {
2387 event = createKeyEvent (display, winFocus, winRoot, false, key.code, modifier); 2443 event = createKeyEvent(display, winFocus, winRoot, false, key.code, modifier);
2388 XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event); 2444 XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
2389 } 2445 }
2390 2446
2391 XCloseDisplay (display); 2447 XCloseDisplay(display);
2392} 2448}
2393 2449
2394static void 2450static void
2395attach_instance (const IMEngineInstancePointer &si) 2451attach_instance(const IMEngineInstancePointer &si)
2396{ 2452{
2397 si->signal_connect_show_preedit_string ( 2453 si->signal_connect_show_preedit_string(
2398 slot (slot_show_preedit_string)); 2454 slot(slot_show_preedit_string));
2399 si->signal_connect_show_aux_string ( 2455 si->signal_connect_show_aux_string(
2400 slot (slot_show_aux_string)); 2456 slot(slot_show_aux_string));
2401 si->signal_connect_show_lookup_table ( 2457 si->signal_connect_show_lookup_table(
2402 slot (slot_show_lookup_table)); 2458 slot(slot_show_lookup_table));
2403 2459
2404 si->signal_connect_hide_preedit_string ( 2460 si->signal_connect_hide_preedit_string(
2405 slot (slot_hide_preedit_string)); 2461 slot(slot_hide_preedit_string));
2406 si->signal_connect_hide_aux_string ( 2462 si->signal_connect_hide_aux_string(
2407 slot (slot_hide_aux_string)); 2463 slot(slot_hide_aux_string));
2408 si->signal_connect_hide_lookup_table ( 2464 si->signal_connect_hide_lookup_table(
2409 slot (slot_hide_lookup_table)); 2465 slot(slot_hide_lookup_table));
2410 2466
2411 si->signal_connect_update_preedit_caret ( 2467 si->signal_connect_update_preedit_caret(
2412 slot (slot_update_preedit_caret)); 2468 slot(slot_update_preedit_caret));
2413 si->signal_connect_update_preedit_string ( 2469 si->signal_connect_update_preedit_string(
2414 slot (slot_update_preedit_string)); 2470 slot(slot_update_preedit_string));
2415 si->signal_connect_update_aux_string ( 2471 si->signal_connect_update_aux_string(
2416 slot (slot_update_aux_string)); 2472 slot(slot_update_aux_string));
2417 si->signal_connect_update_lookup_table ( 2473 si->signal_connect_update_lookup_table(
2418 slot (slot_update_lookup_table)); 2474 slot(slot_update_lookup_table));
2419 2475
2420 si->signal_connect_commit_string ( 2476 si->signal_connect_commit_string(
2421 slot (slot_commit_string)); 2477 slot(slot_commit_string));
2422 2478
2423 si->signal_connect_forward_key_event ( 2479 si->signal_connect_forward_key_event(
2424 slot (slot_forward_key_event)); 2480 slot(slot_forward_key_event));
2425 2481
2426 si->signal_connect_register_properties ( 2482 si->signal_connect_register_properties(
2427 slot (slot_register_properties)); 2483 slot(slot_register_properties));
2428 2484
2429 si->signal_connect_update_property ( 2485 si->signal_connect_update_property(
2430 slot (slot_update_property)); 2486 slot(slot_update_property));
2431 2487
2432 si->signal_connect_beep ( 2488 si->signal_connect_beep(
2433 slot (slot_beep)); 2489 slot(slot_beep));
2434 2490
2435 si->signal_connect_start_helper ( 2491 si->signal_connect_start_helper(
2436 slot (slot_start_helper)); 2492 slot(slot_start_helper));
2437 2493
2438 si->signal_connect_stop_helper ( 2494 si->signal_connect_stop_helper(
2439 slot (slot_stop_helper)); 2495 slot(slot_stop_helper));
2440 2496
2441 si->signal_connect_send_helper_event ( 2497 si->signal_connect_send_helper_event(
2442 slot (slot_send_helper_event)); 2498 slot(slot_send_helper_event));
2443 2499
2444 si->signal_connect_get_surrounding_text ( 2500 si->signal_connect_get_surrounding_text(
2445 slot (slot_get_surrounding_text)); 2501 slot(slot_get_surrounding_text));
2446 2502
2447 si->signal_connect_delete_surrounding_text ( 2503 si->signal_connect_delete_surrounding_text(
2448 slot (slot_delete_surrounding_text)); 2504 slot(slot_delete_surrounding_text));
2449} 2505}
2450 2506
2451// Implementation of slot functions 2507// Implementation of slot functions
2452static void 2508static void
2453slot_show_preedit_string (IMEngineInstanceBase *si) 2509slot_show_preedit_string(IMEngineInstanceBase *si)
2454{ 2510{
2455 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2511 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2456 2512
2457 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2513 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2458 2514
2459 if (ic && ic->impl && _focused_ic == ic) 2515 if (ic && ic->impl && _focused_ic == ic)
2460 { 2516 {
@@ -2462,102 +2518,102 @@ slot_show_preedit_string (IMEngineInstanceBase *si)
2462 { 2518 {
2463 if (!ic->impl->preedit_started) 2519 if (!ic->impl->preedit_started)
2464 { 2520 {
2465 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); 2521 ecore_imf_context_preedit_start_event_add(_focused_ic->ctx);
2466 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 2522 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2467 ic->impl->preedit_started = true; 2523 ic->impl->preedit_started = true;
2468 } 2524 }
2469 } 2525 }
2470 else 2526 else
2471 _panel_client.show_preedit_string (ic->id); 2527 _panel_client.show_preedit_string(ic->id);
2472 } 2528 }
2473} 2529}
2474 2530
2475static void 2531static void
2476slot_show_aux_string (IMEngineInstanceBase *si) 2532slot_show_aux_string(IMEngineInstanceBase *si)
2477{ 2533{
2478 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2534 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2479 2535
2480 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2536 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2481 2537
2482 if (ic && ic->impl && _focused_ic == ic) 2538 if (ic && ic->impl && _focused_ic == ic)
2483 _panel_client.show_aux_string (ic->id); 2539 _panel_client.show_aux_string(ic->id);
2484} 2540}
2485 2541
2486static void 2542static void
2487slot_show_lookup_table (IMEngineInstanceBase *si) 2543slot_show_lookup_table(IMEngineInstanceBase *si)
2488{ 2544{
2489 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2545 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2490 2546
2491 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2547 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2492 2548
2493 if (ic && ic->impl && _focused_ic == ic) 2549 if (ic && ic->impl && _focused_ic == ic)
2494 _panel_client.show_lookup_table (ic->id); 2550 _panel_client.show_lookup_table(ic->id);
2495} 2551}
2496 2552
2497static void 2553static void
2498slot_hide_preedit_string (IMEngineInstanceBase *si) 2554slot_hide_preedit_string(IMEngineInstanceBase *si)
2499{ 2555{
2500 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2556 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2501 2557
2502 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2558 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2503 2559
2504 if (ic && ic->impl && _focused_ic == ic) 2560 if (ic && ic->impl && _focused_ic == ic)
2505 { 2561 {
2506 bool emit = false; 2562 bool emit = false;
2507 if (ic->impl->preedit_string.length ()) 2563 if (ic->impl->preedit_string.length())
2508 { 2564 {
2509 ic->impl->preedit_string = WideString (); 2565 ic->impl->preedit_string = WideString();
2510 ic->impl->preedit_caret = 0; 2566 ic->impl->preedit_caret = 0;
2511 ic->impl->preedit_attrlist.clear (); 2567 ic->impl->preedit_attrlist.clear();
2512 emit = true; 2568 emit = true;
2513 } 2569 }
2514 if (ic->impl->use_preedit) 2570 if (ic->impl->use_preedit)
2515 { 2571 {
2516 if (emit) 2572 if (emit)
2517 { 2573 {
2518 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2574 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2519 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2575 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2520 } 2576 }
2521 if (ic->impl->preedit_started) 2577 if (ic->impl->preedit_started)
2522 { 2578 {
2523 ecore_imf_context_preedit_end_event_add (ic->ctx); 2579 ecore_imf_context_preedit_end_event_add(ic->ctx);
2524 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); 2580 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2525 ic->impl->preedit_started = false; 2581 ic->impl->preedit_started = false;
2526 } 2582 }
2527 } 2583 }
2528 else 2584 else
2529 _panel_client.hide_preedit_string (ic->id); 2585 _panel_client.hide_preedit_string(ic->id);
2530 } 2586 }
2531} 2587}
2532 2588
2533static void 2589static void
2534slot_hide_aux_string (IMEngineInstanceBase *si) 2590slot_hide_aux_string(IMEngineInstanceBase *si)
2535{ 2591{
2536 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2592 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2537 2593
2538 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2594 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2539 2595
2540 if (ic && ic->impl && _focused_ic == ic) 2596 if (ic && ic->impl && _focused_ic == ic)
2541 _panel_client.hide_aux_string (ic->id); 2597 _panel_client.hide_aux_string(ic->id);
2542} 2598}
2543 2599
2544static void 2600static void
2545slot_hide_lookup_table (IMEngineInstanceBase *si) 2601slot_hide_lookup_table(IMEngineInstanceBase *si)
2546{ 2602{
2547 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2603 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2548 2604
2549 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2605 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2550 2606
2551 if (ic && ic->impl && _focused_ic == ic) 2607 if (ic && ic->impl && _focused_ic == ic)
2552 _panel_client.hide_lookup_table (ic->id); 2608 _panel_client.hide_lookup_table(ic->id);
2553} 2609}
2554 2610
2555static void 2611static void
2556slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) 2612slot_update_preedit_caret(IMEngineInstanceBase *si, int caret)
2557{ 2613{
2558 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2614 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2559 2615
2560 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2616 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2561 2617
2562 if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) 2618 if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret)
2563 { 2619 {
@@ -2566,28 +2622,28 @@ slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
2566 { 2622 {
2567 if (!ic->impl->preedit_started) 2623 if (!ic->impl->preedit_started)
2568 { 2624 {
2569 ecore_imf_context_preedit_start_event_add (ic->ctx); 2625 ecore_imf_context_preedit_start_event_add(ic->ctx);
2570 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 2626 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2571 ic->impl->preedit_started = true; 2627 ic->impl->preedit_started = true;
2572 } 2628 }
2573 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2629 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2574 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2630 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2575 } 2631 }
2576 else 2632 else
2577 _panel_client.update_preedit_caret (ic->id, caret); 2633 _panel_client.update_preedit_caret(ic->id, caret);
2578 } 2634 }
2579} 2635}
2580 2636
2581static void 2637static void
2582slot_update_preedit_string (IMEngineInstanceBase *si, 2638slot_update_preedit_string(IMEngineInstanceBase *si,
2583 const WideString & str, 2639 const WideString & str,
2584 const AttributeList & attrs) 2640 const AttributeList & attrs)
2585{ 2641{
2586 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2642 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2587 2643
2588 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2644 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2589 2645
2590 if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ())) 2646 if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length()))
2591 { 2647 {
2592 ic->impl->preedit_string = str; 2648 ic->impl->preedit_string = str;
2593 ic->impl->preedit_attrlist = attrs; 2649 ic->impl->preedit_attrlist = attrs;
@@ -2595,178 +2651,178 @@ slot_update_preedit_string (IMEngineInstanceBase *si,
2595 { 2651 {
2596 if (!ic->impl->preedit_started) 2652 if (!ic->impl->preedit_started)
2597 { 2653 {
2598 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); 2654 ecore_imf_context_preedit_start_event_add(_focused_ic->ctx);
2599 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 2655 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2600 ic->impl->preedit_started = true; 2656 ic->impl->preedit_started = true;
2601 } 2657 }
2602 ic->impl->preedit_caret = str.length (); 2658 ic->impl->preedit_caret = str.length();
2603 ic->impl->preedit_updating = true; 2659 ic->impl->preedit_updating = true;
2604 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2660 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2605 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2661 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2606 ic->impl->preedit_updating = false; 2662 ic->impl->preedit_updating = false;
2607 } 2663 }
2608 else 2664 else
2609 { 2665 {
2610 _panel_client.update_preedit_string (ic->id, str, attrs); 2666 _panel_client.update_preedit_string(ic->id, str, attrs);
2611 } 2667 }
2612 } 2668 }
2613} 2669}
2614 2670
2615static void 2671static void
2616slot_update_aux_string (IMEngineInstanceBase *si, 2672slot_update_aux_string(IMEngineInstanceBase *si,
2617 const WideString & str, 2673 const WideString & str,
2618 const AttributeList & attrs) 2674 const AttributeList & attrs)
2619{ 2675{
2620 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2676 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2621 2677
2622 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2678 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2623 2679
2624 if (ic && ic->impl && _focused_ic == ic) 2680 if (ic && ic->impl && _focused_ic == ic)
2625 _panel_client.update_aux_string (ic->id, str, attrs); 2681 _panel_client.update_aux_string(ic->id, str, attrs);
2626} 2682}
2627 2683
2628static void 2684static void
2629slot_commit_string (IMEngineInstanceBase *si, 2685slot_commit_string(IMEngineInstanceBase *si,
2630 const WideString & str) 2686 const WideString & str)
2631{ 2687{
2632 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2688 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2633 2689
2634 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2690 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2635 2691
2636 if (ic && ic->ctx) 2692 if (ic && ic->ctx)
2637 { 2693 {
2638 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (str).c_str ()); 2694 ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(str).c_str());
2639 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); 2695 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
2640 } 2696 }
2641} 2697}
2642 2698
2643static void 2699static void
2644slot_forward_key_event (IMEngineInstanceBase *si, 2700slot_forward_key_event(IMEngineInstanceBase *si,
2645 const KeyEvent & key) 2701 const KeyEvent & key)
2646{ 2702{
2647 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2703 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2648 2704
2649 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2705 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2650 2706
2651 if (ic && _focused_ic == ic) 2707 if (ic && _focused_ic == ic)
2652 { 2708 {
2653 if (!_fallback_instance->process_key_event (key)) 2709 if (!_fallback_instance->process_key_event(key))
2654 _x_send_key_event(key); 2710 _x_send_key_event(key);
2655 } 2711 }
2656} 2712}
2657 2713
2658static void 2714static void
2659slot_update_lookup_table (IMEngineInstanceBase *si, 2715slot_update_lookup_table(IMEngineInstanceBase *si,
2660 const LookupTable & table) 2716 const LookupTable & table)
2661{ 2717{
2662 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2718 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2663 2719
2664 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2720 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2665 2721
2666 if (ic && ic->impl && _focused_ic == ic) 2722 if (ic && ic->impl && _focused_ic == ic)
2667 _panel_client.update_lookup_table (ic->id, table); 2723 _panel_client.update_lookup_table(ic->id, table);
2668} 2724}
2669 2725
2670static void 2726static void
2671slot_register_properties (IMEngineInstanceBase *si, 2727slot_register_properties(IMEngineInstanceBase *si,
2672 const PropertyList & properties) 2728 const PropertyList & properties)
2673{ 2729{
2674 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2730 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2675 2731
2676 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2732 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2677 2733
2678 if (ic && ic->impl && _focused_ic == ic) 2734 if (ic && ic->impl && _focused_ic == ic)
2679 _panel_client.register_properties (ic->id, properties); 2735 _panel_client.register_properties(ic->id, properties);
2680} 2736}
2681 2737
2682static void 2738static void
2683slot_update_property (IMEngineInstanceBase *si, 2739slot_update_property(IMEngineInstanceBase *si,
2684 const Property & property) 2740 const Property & property)
2685{ 2741{
2686 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2742 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2687 2743
2688 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2744 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2689 2745
2690 if (ic && ic->impl && _focused_ic == ic) 2746 if (ic && ic->impl && _focused_ic == ic)
2691 _panel_client.update_property (ic->id, property); 2747 _panel_client.update_property(ic->id, property);
2692} 2748}
2693 2749
2694static void 2750static void
2695slot_beep (IMEngineInstanceBase *si __UNUSED__) 2751slot_beep(IMEngineInstanceBase *si __UNUSED__)
2696{ 2752{
2697 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2753 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2698} 2754}
2699 2755
2700static void 2756static void
2701slot_start_helper (IMEngineInstanceBase *si, 2757slot_start_helper(IMEngineInstanceBase *si,
2702 const String &helper_uuid) 2758 const String &helper_uuid)
2703{ 2759{
2704 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2760 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2705 2761
2706 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" 2762 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
2707 << (ic ? ic->id : -1) << " ic=" << ic 2763 << (ic ? ic->id : -1) << " ic=" << ic
2708 << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; 2764 << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid() : "") << "...\n";
2709 2765
2710 if (ic && ic->impl) 2766 if (ic && ic->impl)
2711 _panel_client.start_helper (ic->id, helper_uuid); 2767 _panel_client.start_helper(ic->id, helper_uuid);
2712} 2768}
2713 2769
2714static void 2770static void
2715slot_stop_helper (IMEngineInstanceBase *si, 2771slot_stop_helper(IMEngineInstanceBase *si,
2716 const String &helper_uuid) 2772 const String &helper_uuid)
2717{ 2773{
2718 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2774 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2719 2775
2720 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n"; 2776 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n";
2721 2777
2722 if (ic && ic->impl) 2778 if (ic && ic->impl)
2723 _panel_client.stop_helper (ic->id, helper_uuid); 2779 _panel_client.stop_helper(ic->id, helper_uuid);
2724} 2780}
2725 2781
2726static void 2782static void
2727slot_send_helper_event (IMEngineInstanceBase *si, 2783slot_send_helper_event(IMEngineInstanceBase *si,
2728 const String &helper_uuid, 2784 const String &helper_uuid,
2729 const Transaction &trans) 2785 const Transaction &trans)
2730{ 2786{
2731 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2787 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2732 2788
2733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" 2789 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
2734 << (ic ? ic->id : -1) << " ic=" << ic 2790 << (ic ? ic->id : -1) << " ic=" << ic
2735 << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; 2791 << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid() : "") << "...\n";
2736 2792
2737 if (ic && ic->impl) 2793 if (ic && ic->impl)
2738 _panel_client.send_helper_event (ic->id, helper_uuid, trans); 2794 _panel_client.send_helper_event(ic->id, helper_uuid, trans);
2739} 2795}
2740 2796
2741static bool 2797static bool
2742slot_get_surrounding_text (IMEngineInstanceBase *si, 2798slot_get_surrounding_text(IMEngineInstanceBase *si,
2743 WideString &text, 2799 WideString &text,
2744 int &cursor, 2800 int &cursor,
2745 int maxlen_before, 2801 int maxlen_before,
2746 int maxlen_after) 2802 int maxlen_after)
2747{ 2803{
2748 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2804 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2749 2805
2750 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2806 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2751 2807
2752 if (ic && ic->impl && _focused_ic == ic) 2808 if (ic && ic->impl && _focused_ic == ic)
2753 { 2809 {
2754 char *surrounding = NULL; 2810 char *surrounding = NULL;
2755 int cursor_index; 2811 int cursor_index;
2756 if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index)) 2812 if (ecore_imf_context_surrounding_get(_focused_ic->ctx, &surrounding, &cursor_index))
2757 { 2813 {
2758 SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n"; 2814 SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n";
2759 SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n"; 2815 SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n";
2760 WideString before (utf8_mbstowcs (String (surrounding, surrounding + cursor_index))); 2816 WideString before(utf8_mbstowcs(String(surrounding, surrounding + cursor_index)));
2761 WideString after (utf8_mbstowcs (String (surrounding + cursor_index))); 2817 WideString after(utf8_mbstowcs(String(surrounding + cursor_index)));
2762 if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length ()) 2818 if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length())
2763 before = WideString (before.begin () + (before.length () - maxlen_before), before.end ()); 2819 before = WideString(before.begin() + (before.length() - maxlen_before), before.end());
2764 else if (maxlen_before == 0) before = WideString (); 2820 else if (maxlen_before == 0) before = WideString();
2765 if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length ()) 2821 if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length())
2766 after = WideString (after.begin (), after.begin () + maxlen_after); 2822 after = WideString(after.begin(), after.begin() + maxlen_after);
2767 else if (maxlen_after == 0) after = WideString (); 2823 else if (maxlen_after == 0) after = WideString();
2768 text = before + after; 2824 text = before + after;
2769 cursor = before.length (); 2825 cursor = before.length();
2770 return true; 2826 return true;
2771 } 2827 }
2772 } 2828 }
@@ -2774,13 +2830,13 @@ slot_get_surrounding_text (IMEngineInstanceBase *si,
2774} 2830}
2775 2831
2776static bool 2832static bool
2777slot_delete_surrounding_text (IMEngineInstanceBase *si, 2833slot_delete_surrounding_text(IMEngineInstanceBase *si,
2778 int offset, 2834 int offset,
2779 int len) 2835 int len)
2780{ 2836{
2781 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2837 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2782 2838
2783 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2839 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2784 2840
2785 if (ic && ic->impl && _focused_ic == ic) 2841 if (ic && ic->impl && _focused_ic == ic)
2786 { 2842 {
@@ -2788,7 +2844,7 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si,
2788 ev.ctx = _focused_ic->ctx; 2844 ev.ctx = _focused_ic->ctx;
2789 ev.n_chars = len; 2845 ev.n_chars = len;
2790 ev.offset = offset; 2846 ev.offset = offset;
2791 ecore_imf_context_delete_surrounding_event_add (_focused_ic->ctx, offset, len); 2847 ecore_imf_context_delete_surrounding_event_add(_focused_ic->ctx, offset, len);
2792 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev); 2848 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev);
2793 return true; 2849 return true;
2794 } 2850 }
@@ -2796,43 +2852,43 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si,
2796} 2852}
2797 2853
2798static void 2854static void
2799reload_config_callback (const ConfigPointer &config) 2855reload_config_callback(const ConfigPointer &config)
2800{ 2856{
2801 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2857 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2802 2858
2803 _frontend_hotkey_matcher.load_hotkeys (config); 2859 _frontend_hotkey_matcher.load_hotkeys(config);
2804 _imengine_hotkey_matcher.load_hotkeys (config); 2860 _imengine_hotkey_matcher.load_hotkeys(config);
2805 2861
2806 KeyEvent key; 2862 KeyEvent key;
2807 2863
2808 scim_string_to_key (key, 2864 scim_string_to_key(key,
2809 config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK), 2865 config->read(String(SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK),
2810 String ("Shift+Control+Alt+Lock"))); 2866 String("Shift+Control+Alt+Lock")));
2811 2867
2812 _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF; 2868 _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF;
2813 _valid_key_mask |= SCIM_KEY_ReleaseMask; 2869 _valid_key_mask |= SCIM_KEY_ReleaseMask;
2814 // Special treatment for two backslash keys on jp106 keyboard. 2870 // Special treatment for two backslash keys on jp106 keyboard.
2815 _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask; 2871 _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask;
2816 2872
2817 _on_the_spot = config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); 2873 _on_the_spot = config->read(String(SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot);
2818 _shared_input_method = config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); 2874 _shared_input_method = config->read(String(SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method);
2819 2875
2820 // Get keyboard layout setting 2876 // Get keyboard layout setting
2821 // Flush the global config first, in order to load the new configs from disk. 2877 // Flush the global config first, in order to load the new configs from disk.
2822 scim_global_config_flush (); 2878 scim_global_config_flush();
2823 2879
2824 _keyboard_layout = scim_get_default_keyboard_layout (); 2880 _keyboard_layout = scim_get_default_keyboard_layout();
2825} 2881}
2826 2882
2827static void 2883static void
2828fallback_commit_string_cb (IMEngineInstanceBase *si __UNUSED__, 2884fallback_commit_string_cb(IMEngineInstanceBase *si __UNUSED__,
2829 const WideString &str) 2885 const WideString &str)
2830{ 2886{
2831 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2887 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2832 2888
2833 if (_focused_ic && _focused_ic->impl) 2889 if (_focused_ic && _focused_ic->impl)
2834 { 2890 {
2835 ecore_imf_context_commit_event_add (_focused_ic->ctx, utf8_wcstombs (str).c_str ()); 2891 ecore_imf_context_commit_event_add(_focused_ic->ctx, utf8_wcstombs(str).c_str());
2836 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); 2892 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
2837 } 2893 }
2838} 2894}
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
32void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction); 32void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction);
33void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type); 33void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type);
34void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout); 34void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout);
35void isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx);
36void isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx);
35 37
36EcoreIMFContextISF* isf_imf_context_new (void); 38EcoreIMFContextISF* isf_imf_context_new (void);
37void isf_imf_context_shutdown (void); 39void 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"
19 isf_imf_context_del, /* del */ 19 isf_imf_context_del, /* del */
20 isf_imf_context_client_window_set, /* client_window_set */ 20 isf_imf_context_client_window_set, /* client_window_set */
21 isf_imf_context_client_canvas_set, /* client_canvas_set */ 21 isf_imf_context_client_canvas_set, /* client_canvas_set */
22 NULL, /* isf_imf_context_input_panel_show, - show */ 22 isf_imf_context_input_panel_show, /* input_panel_show, - show */
23 NULL, /* isf_imf_context_input_panel_hide, - hide */ 23 isf_imf_context_input_panel_hide, /* input_panel_hide, - hide */
24 isf_imf_context_preedit_string_get, /* get_preedit_string */ 24 isf_imf_context_preedit_string_get, /* get_preedit_string */
25 isf_imf_context_focus_in, /* focus_in */ 25 isf_imf_context_focus_in, /* focus_in */
26 isf_imf_context_focus_out, /* focus_out */ 26 isf_imf_context_focus_out, /* focus_out */
@@ -38,7 +38,12 @@ extern "C"
38 NULL, /* isf_imf_context_input_panel_layout_get, */ 38 NULL, /* isf_imf_context_input_panel_layout_get, */
39 NULL, /* isf_imf_context_input_panel_language_set, */ 39 NULL, /* isf_imf_context_input_panel_language_set, */
40 NULL, /* isf_imf_context_input_panel_language_get, */ 40 NULL, /* isf_imf_context_input_panel_language_get, */
41 isf_imf_context_cursor_location_set /* cursor_location_set */ 41 isf_imf_context_cursor_location_set, /* cursor_location_set */
42 NULL, /* input_panel_imdata_set */
43 NULL, /* input_panel_imdata_get */
44 NULL, /* input_panel_return_key_type_set */
45 NULL, /* input_panel_return_key_disabled_set */
46 NULL /* input_panel_caps_lock_mode_set */
42 }; 47 };
43 48
44 static Ecore_IMF_Context *imf_module_create (void); 49 static Ecore_IMF_Context *imf_module_create (void);