aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/modules
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-23 23:30:42 +1000
committerDavid Walter Seikel2012-01-23 23:30:42 +1000
commit825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch)
tree75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/ecore/src/modules
parentAdd ability to disable the test harness, or the Lua compile test. (diff)
downloadSledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2
SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to 'libraries/ecore/src/modules')
-rw-r--r--libraries/ecore/src/modules/Makefile.in14
-rw-r--r--libraries/ecore/src/modules/immodules/Makefile.am4
-rw-r--r--libraries/ecore/src/modules/immodules/Makefile.in19
-rw-r--r--libraries/ecore/src/modules/immodules/scim/Makefile.am36
-rw-r--r--libraries/ecore/src/modules/immodules/scim/Makefile.in849
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp2839
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_imcontext.h40
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_module.cpp93
-rw-r--r--libraries/ecore/src/modules/immodules/xim/Makefile.in14
-rw-r--r--libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c614
10 files changed, 4298 insertions, 224 deletions
diff --git a/libraries/ecore/src/modules/Makefile.in b/libraries/ecore/src/modules/Makefile.in
index 62cbce2..4bb9420 100644
--- a/libraries/ecore/src/modules/Makefile.in
+++ b/libraries/ecore/src/modules/Makefile.in
@@ -227,10 +227,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
227PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 227PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
228PIXMAN_LIBS = @PIXMAN_LIBS@ 228PIXMAN_LIBS = @PIXMAN_LIBS@
229PKG_CONFIG = @PKG_CONFIG@ 229PKG_CONFIG = @PKG_CONFIG@
230PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
231PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
232POSUB = @POSUB@ 230POSUB = @POSUB@
233RANLIB = @RANLIB@ 231RANLIB = @RANLIB@
232SCIM_CFLAGS = @SCIM_CFLAGS@
233SCIM_LIBS = @SCIM_LIBS@
234SDL_CFLAGS = @SDL_CFLAGS@ 234SDL_CFLAGS = @SDL_CFLAGS@
235SDL_CONFIG = @SDL_CONFIG@ 235SDL_CONFIG = @SDL_CONFIG@
236SDL_LIBS = @SDL_LIBS@ 236SDL_LIBS = @SDL_LIBS@
@@ -249,6 +249,10 @@ TSLIB_LIBS = @TSLIB_LIBS@
249USE_NLS = @USE_NLS@ 249USE_NLS = @USE_NLS@
250VERSION = @VERSION@ 250VERSION = @VERSION@
251VMAJ = @VMAJ@ 251VMAJ = @VMAJ@
252WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
253WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
254WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
255WAYLAND_LIBS = @WAYLAND_LIBS@
252WIN32_CFLAGS = @WIN32_CFLAGS@ 256WIN32_CFLAGS = @WIN32_CFLAGS@
253WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ 257WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
254WIN32_LIBS = @WIN32_LIBS@ 258WIN32_LIBS = @WIN32_LIBS@
@@ -362,6 +366,8 @@ ecore_imf_cflags = @ecore_imf_cflags@
362ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ 366ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
363ecore_imf_evas_libs = @ecore_imf_evas_libs@ 367ecore_imf_evas_libs = @ecore_imf_evas_libs@
364ecore_imf_libs = @ecore_imf_libs@ 368ecore_imf_libs = @ecore_imf_libs@
369ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
370ecore_imf_scim_libs = @ecore_imf_scim_libs@
365ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ 371ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
366ecore_imf_xim_libs = @ecore_imf_xim_libs@ 372ecore_imf_xim_libs = @ecore_imf_xim_libs@
367ecore_input_cflags = @ecore_input_cflags@ 373ecore_input_cflags = @ecore_input_cflags@
@@ -374,6 +380,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
374ecore_psl1ght_libs = @ecore_psl1ght_libs@ 380ecore_psl1ght_libs = @ecore_psl1ght_libs@
375ecore_sdl_cflags = @ecore_sdl_cflags@ 381ecore_sdl_cflags = @ecore_sdl_cflags@
376ecore_sdl_libs = @ecore_sdl_libs@ 382ecore_sdl_libs = @ecore_sdl_libs@
383ecore_wayland_cflags = @ecore_wayland_cflags@
384ecore_wayland_libs = @ecore_wayland_libs@
377ecore_win32_cflags = @ecore_win32_cflags@ 385ecore_win32_cflags = @ecore_win32_cflags@
378ecore_win32_libs = @ecore_win32_libs@ 386ecore_win32_libs = @ecore_win32_libs@
379ecore_wince_cflags = @ecore_wince_cflags@ 387ecore_wince_cflags = @ecore_wince_cflags@
@@ -418,12 +426,14 @@ requirements_ecore_fb = @requirements_ecore_fb@
418requirements_ecore_file = @requirements_ecore_file@ 426requirements_ecore_file = @requirements_ecore_file@
419requirements_ecore_imf = @requirements_ecore_imf@ 427requirements_ecore_imf = @requirements_ecore_imf@
420requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ 428requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
429requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
421requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ 430requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
422requirements_ecore_input = @requirements_ecore_input@ 431requirements_ecore_input = @requirements_ecore_input@
423requirements_ecore_input_evas = @requirements_ecore_input_evas@ 432requirements_ecore_input_evas = @requirements_ecore_input_evas@
424requirements_ecore_ipc = @requirements_ecore_ipc@ 433requirements_ecore_ipc = @requirements_ecore_ipc@
425requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ 434requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
426requirements_ecore_sdl = @requirements_ecore_sdl@ 435requirements_ecore_sdl = @requirements_ecore_sdl@
436requirements_ecore_wayland = @requirements_ecore_wayland@
427requirements_ecore_win32 = @requirements_ecore_win32@ 437requirements_ecore_win32 = @requirements_ecore_win32@
428requirements_ecore_wince = @requirements_ecore_wince@ 438requirements_ecore_wince = @requirements_ecore_wince@
429requirements_ecore_x = @requirements_ecore_x@ 439requirements_ecore_x = @requirements_ecore_x@
diff --git a/libraries/ecore/src/modules/immodules/Makefile.am b/libraries/ecore/src/modules/immodules/Makefile.am
index 6978672..2f121ae 100644
--- a/libraries/ecore/src/modules/immodules/Makefile.am
+++ b/libraries/ecore/src/modules/immodules/Makefile.am
@@ -5,3 +5,7 @@ SUBDIRS =
5if BUILD_ECORE_IMF_XIM 5if BUILD_ECORE_IMF_XIM
6SUBDIRS += xim 6SUBDIRS += xim
7endif 7endif
8
9if BUILD_ECORE_IMF_SCIM
10SUBDIRS += scim
11endif
diff --git a/libraries/ecore/src/modules/immodules/Makefile.in b/libraries/ecore/src/modules/immodules/Makefile.in
index 2ebe9fe..e65881c 100644
--- a/libraries/ecore/src/modules/immodules/Makefile.in
+++ b/libraries/ecore/src/modules/immodules/Makefile.in
@@ -34,6 +34,7 @@ POST_UNINSTALL = :
34build_triplet = @build@ 34build_triplet = @build@
35host_triplet = @host@ 35host_triplet = @host@
36@BUILD_ECORE_IMF_XIM_TRUE@am__append_1 = xim 36@BUILD_ECORE_IMF_XIM_TRUE@am__append_1 = xim
37@BUILD_ECORE_IMF_SCIM_TRUE@am__append_2 = scim
37subdir = src/modules/immodules 38subdir = src/modules/immodules
38DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 39DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
39ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 40ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -83,7 +84,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
83 distdir 84 distdir
84ETAGS = etags 85ETAGS = etags
85CTAGS = ctags 86CTAGS = ctags
86DIST_SUBDIRS = xim 87DIST_SUBDIRS = xim scim
87DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 88DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
88am__relativize = \ 89am__relativize = \
89 dir0=`pwd`; \ 90 dir0=`pwd`; \
@@ -228,10 +229,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
228PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 229PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
229PIXMAN_LIBS = @PIXMAN_LIBS@ 230PIXMAN_LIBS = @PIXMAN_LIBS@
230PKG_CONFIG = @PKG_CONFIG@ 231PKG_CONFIG = @PKG_CONFIG@
231PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
232PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
233POSUB = @POSUB@ 232POSUB = @POSUB@
234RANLIB = @RANLIB@ 233RANLIB = @RANLIB@
234SCIM_CFLAGS = @SCIM_CFLAGS@
235SCIM_LIBS = @SCIM_LIBS@
235SDL_CFLAGS = @SDL_CFLAGS@ 236SDL_CFLAGS = @SDL_CFLAGS@
236SDL_CONFIG = @SDL_CONFIG@ 237SDL_CONFIG = @SDL_CONFIG@
237SDL_LIBS = @SDL_LIBS@ 238SDL_LIBS = @SDL_LIBS@
@@ -250,6 +251,10 @@ TSLIB_LIBS = @TSLIB_LIBS@
250USE_NLS = @USE_NLS@ 251USE_NLS = @USE_NLS@
251VERSION = @VERSION@ 252VERSION = @VERSION@
252VMAJ = @VMAJ@ 253VMAJ = @VMAJ@
254WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
255WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
256WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
257WAYLAND_LIBS = @WAYLAND_LIBS@
253WIN32_CFLAGS = @WIN32_CFLAGS@ 258WIN32_CFLAGS = @WIN32_CFLAGS@
254WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ 259WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
255WIN32_LIBS = @WIN32_LIBS@ 260WIN32_LIBS = @WIN32_LIBS@
@@ -363,6 +368,8 @@ ecore_imf_cflags = @ecore_imf_cflags@
363ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ 368ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
364ecore_imf_evas_libs = @ecore_imf_evas_libs@ 369ecore_imf_evas_libs = @ecore_imf_evas_libs@
365ecore_imf_libs = @ecore_imf_libs@ 370ecore_imf_libs = @ecore_imf_libs@
371ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
372ecore_imf_scim_libs = @ecore_imf_scim_libs@
366ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ 373ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
367ecore_imf_xim_libs = @ecore_imf_xim_libs@ 374ecore_imf_xim_libs = @ecore_imf_xim_libs@
368ecore_input_cflags = @ecore_input_cflags@ 375ecore_input_cflags = @ecore_input_cflags@
@@ -375,6 +382,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
375ecore_psl1ght_libs = @ecore_psl1ght_libs@ 382ecore_psl1ght_libs = @ecore_psl1ght_libs@
376ecore_sdl_cflags = @ecore_sdl_cflags@ 383ecore_sdl_cflags = @ecore_sdl_cflags@
377ecore_sdl_libs = @ecore_sdl_libs@ 384ecore_sdl_libs = @ecore_sdl_libs@
385ecore_wayland_cflags = @ecore_wayland_cflags@
386ecore_wayland_libs = @ecore_wayland_libs@
378ecore_win32_cflags = @ecore_win32_cflags@ 387ecore_win32_cflags = @ecore_win32_cflags@
379ecore_win32_libs = @ecore_win32_libs@ 388ecore_win32_libs = @ecore_win32_libs@
380ecore_wince_cflags = @ecore_wince_cflags@ 389ecore_wince_cflags = @ecore_wince_cflags@
@@ -419,12 +428,14 @@ requirements_ecore_fb = @requirements_ecore_fb@
419requirements_ecore_file = @requirements_ecore_file@ 428requirements_ecore_file = @requirements_ecore_file@
420requirements_ecore_imf = @requirements_ecore_imf@ 429requirements_ecore_imf = @requirements_ecore_imf@
421requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ 430requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
431requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
422requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ 432requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
423requirements_ecore_input = @requirements_ecore_input@ 433requirements_ecore_input = @requirements_ecore_input@
424requirements_ecore_input_evas = @requirements_ecore_input_evas@ 434requirements_ecore_input_evas = @requirements_ecore_input_evas@
425requirements_ecore_ipc = @requirements_ecore_ipc@ 435requirements_ecore_ipc = @requirements_ecore_ipc@
426requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ 436requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
427requirements_ecore_sdl = @requirements_ecore_sdl@ 437requirements_ecore_sdl = @requirements_ecore_sdl@
438requirements_ecore_wayland = @requirements_ecore_wayland@
428requirements_ecore_win32 = @requirements_ecore_win32@ 439requirements_ecore_win32 = @requirements_ecore_win32@
429requirements_ecore_wince = @requirements_ecore_wince@ 440requirements_ecore_wince = @requirements_ecore_wince@
430requirements_ecore_x = @requirements_ecore_x@ 441requirements_ecore_x = @requirements_ecore_x@
@@ -442,7 +453,7 @@ x_cflags = @x_cflags@
442x_includes = @x_includes@ 453x_includes = @x_includes@
443x_libs = @x_libs@ 454x_libs = @x_libs@
444MAINTAINERCLEANFILES = Makefile.in 455MAINTAINERCLEANFILES = Makefile.in
445SUBDIRS = $(am__append_1) 456SUBDIRS = $(am__append_1) $(am__append_2)
446all: all-recursive 457all: all-recursive
447 458
448.SUFFIXES: 459.SUFFIXES:
diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.am b/libraries/ecore/src/modules/immodules/scim/Makefile.am
new file mode 100644
index 0000000..40579ca
--- /dev/null
+++ b/libraries/ecore/src/modules/immodules/scim/Makefile.am
@@ -0,0 +1,36 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4-I$(top_srcdir) \
5-I$(top_srcdir)/src/lib/ecore \
6-I$(top_srcdir)/src/lib/ecore_input \
7-I$(top_srcdir)/src/lib/ecore_x \
8-I$(top_srcdir)/src/lib/ecore_imf \
9-I$(top_srcdir)/src/lib/ecore_evas \
10-I$(top_builddir)/src/lib/ecore \
11-I$(top_builddir)/src/lib/ecore_input \
12-I$(top_builddir)/src/lib/ecore_x \
13-I$(top_builddir)/src/lib/ecore_imf \
14-I$(top_builddir)/src/lib/ecore_evas \
15-DPACKAGE_LIB_DIR=\"$(libdir)\" \
16-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
17@SCIM_CFLAGS@ \
18@EVAS_CFLAGS@ \
19@EINA_CFLAGS@
20
21pkgdir = $(libdir)/ecore/immodules
22
23pkg_LTLIBRARIES = scim.la
24scim_la_SOURCES = \
25scim_imcontext.cpp \
26scim_module.cpp \
27scim_imcontext.h
28
29scim_la_LIBADD = \
30 $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
31 $(top_builddir)/src/lib/ecore_x/libecore_x.la \
32 @SCIM_LIBS@ \
33 @EVAS_LIBS@ \
34 @EINA_LIBS@
35scim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
36scim_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.in b/libraries/ecore/src/modules/immodules/scim/Makefile.in
new file mode 100644
index 0000000..9fc3283
--- /dev/null
+++ b/libraries/ecore/src/modules/immodules/scim/Makefile.in
@@ -0,0 +1,849 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18VPATH = @srcdir@
19pkgdatadir = $(datadir)/@PACKAGE@
20pkgincludedir = $(includedir)/@PACKAGE@
21pkglibdir = $(libdir)/@PACKAGE@
22pkglibexecdir = $(libexecdir)/@PACKAGE@
23am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
24install_sh_DATA = $(install_sh) -c -m 644
25install_sh_PROGRAM = $(install_sh) -c
26install_sh_SCRIPT = $(install_sh) -c
27INSTALL_HEADER = $(INSTALL_DATA)
28transform = $(program_transform_name)
29NORMAL_INSTALL = :
30PRE_INSTALL = :
31POST_INSTALL = :
32NORMAL_UNINSTALL = :
33PRE_UNINSTALL = :
34POST_UNINSTALL = :
35build_triplet = @build@
36host_triplet = @host@
37subdir = src/modules/immodules/scim
38DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
39ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
41 $(top_srcdir)/m4/ac_path_generic.m4 \
42 $(top_srcdir)/m4/check_x_extension.m4 \
43 $(top_srcdir)/m4/ecore_check_module.m4 \
44 $(top_srcdir)/m4/ecore_check_options.m4 \
45 $(top_srcdir)/m4/efl_compiler_flag.m4 \
46 $(top_srcdir)/m4/efl_doxygen.m4 \
47 $(top_srcdir)/m4/efl_examples.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 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
61CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES =
64am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
65am__vpath_adj = case $$p in \
66 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
67 *) f=$$p;; \
68 esac;
69am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
70am__install_max = 40
71am__nobase_strip_setup = \
72 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
73am__nobase_strip = \
74 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
75am__nobase_list = $(am__nobase_strip_setup); \
76 for p in $$list; do echo "$$p $$p"; done | \
77 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
78 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
79 if (++n[$$2] == $(am__install_max)) \
80 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
81 END { for (dir in files) print dir, files[dir] }'
82am__base_list = \
83 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
84 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
85am__installdirs = "$(DESTDIR)$(pkgdir)"
86LTLIBRARIES = $(pkg_LTLIBRARIES)
87scim_la_DEPENDENCIES = \
88 $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
89 $(top_builddir)/src/lib/ecore_x/libecore_x.la
90am_scim_la_OBJECTS = scim_la-scim_imcontext.lo scim_la-scim_module.lo
91scim_la_OBJECTS = $(am_scim_la_OBJECTS)
92AM_V_lt = $(am__v_lt_$(V))
93am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
94am__v_lt_0 = --silent
95scim_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) \
96 $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
97 $(CXXFLAGS) $(scim_la_LDFLAGS) $(LDFLAGS) -o $@
98DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
99depcomp = $(SHELL) $(top_srcdir)/depcomp
100am__depfiles_maybe = depfiles
101am__mv = mv -f
102CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
103 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
104LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
105 $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
106 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
107 $(AM_CXXFLAGS) $(CXXFLAGS)
108AM_V_CXX = $(am__v_CXX_$(V))
109am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
110am__v_CXX_0 = @echo " CXX " $@;
111AM_V_at = $(am__v_at_$(V))
112am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
113am__v_at_0 = @
114CXXLD = $(CXX)
115CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
116 $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
117 $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
118AM_V_CXXLD = $(am__v_CXXLD_$(V))
119am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
120am__v_CXXLD_0 = @echo " CXXLD " $@;
121COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
122 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
123LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
124 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
125 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
126 $(AM_CFLAGS) $(CFLAGS)
127AM_V_CC = $(am__v_CC_$(V))
128am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
129am__v_CC_0 = @echo " CC " $@;
130CCLD = $(CC)
131LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
132 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
133 $(AM_LDFLAGS) $(LDFLAGS) -o $@
134AM_V_CCLD = $(am__v_CCLD_$(V))
135am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
136am__v_CCLD_0 = @echo " CCLD " $@;
137AM_V_GEN = $(am__v_GEN_$(V))
138am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
139am__v_GEN_0 = @echo " GEN " $@;
140SOURCES = $(scim_la_SOURCES)
141DIST_SOURCES = $(scim_la_SOURCES)
142ETAGS = etags
143CTAGS = ctags
144DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
145ACLOCAL = @ACLOCAL@
146ALLOCA = @ALLOCA@
147AMTAR = @AMTAR@
148AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
149AR = @AR@
150AS = @AS@
151AUTOCONF = @AUTOCONF@
152AUTOHEADER = @AUTOHEADER@
153AUTOMAKE = @AUTOMAKE@
154AWK = @AWK@
155CARES_CFLAGS = @CARES_CFLAGS@
156CARES_LIBS = @CARES_LIBS@
157CC = @CC@
158CCDEPMODE = @CCDEPMODE@
159CFLAGS = @CFLAGS@
160CHECK_CFLAGS = @CHECK_CFLAGS@
161CHECK_LIBS = @CHECK_LIBS@
162CPP = @CPP@
163CPPFLAGS = @CPPFLAGS@
164CURL_CFLAGS = @CURL_CFLAGS@
165CURL_LIBS = @CURL_LIBS@
166CXX = @CXX@
167CXXCPP = @CXXCPP@
168CXXDEPMODE = @CXXDEPMODE@
169CXXFLAGS = @CXXFLAGS@
170CYGPATH_W = @CYGPATH_W@
171DEFS = @DEFS@
172DEPDIR = @DEPDIR@
173DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
174DIRECTFB_LIBS = @DIRECTFB_LIBS@
175DLLTOOL = @DLLTOOL@
176DSYMUTIL = @DSYMUTIL@
177DUMPBIN = @DUMPBIN@
178ECHO_C = @ECHO_C@
179ECHO_N = @ECHO_N@
180ECHO_T = @ECHO_T@
181ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@
182ECORE_XCB_LIBS = @ECORE_XCB_LIBS@
183EFL_ECORE_BUILD = @EFL_ECORE_BUILD@
184EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@
185EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@
186EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@
187EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@
188EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@
189EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@
190EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@
191EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@
192EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@
193EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@
194EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@
195EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@
196EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@
197EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@
198EGREP = @EGREP@
199EINA_CFLAGS = @EINA_CFLAGS@
200EINA_LIBS = @EINA_LIBS@
201ESCAPE_CFLAGS = @ESCAPE_CFLAGS@
202ESCAPE_LIBS = @ESCAPE_LIBS@
203EVAS_CFLAGS = @EVAS_CFLAGS@
204EVAS_LIBS = @EVAS_LIBS@
205EVIL_CFLAGS = @EVIL_CFLAGS@
206EVIL_LIBS = @EVIL_LIBS@
207EXEEXT = @EXEEXT@
208FGREP = @FGREP@
209GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
210GLIB_CFLAGS = @GLIB_CFLAGS@
211GLIB_LIBS = @GLIB_LIBS@
212GMSGFMT = @GMSGFMT@
213GMSGFMT_015 = @GMSGFMT_015@
214GREP = @GREP@
215INSTALL = @INSTALL@
216INSTALL_DATA = @INSTALL_DATA@
217INSTALL_PROGRAM = @INSTALL_PROGRAM@
218INSTALL_SCRIPT = @INSTALL_SCRIPT@
219INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
220INTLLIBS = @INTLLIBS@
221INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
222KEYSYMDEFS = @KEYSYMDEFS@
223LD = @LD@
224LDFLAGS = @LDFLAGS@
225LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
226LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
227LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
228LIBICONV = @LIBICONV@
229LIBINTL = @LIBINTL@
230LIBOBJS = @LIBOBJS@
231LIBS = @LIBS@
232LIBTOOL = @LIBTOOL@
233LIPO = @LIPO@
234LN_S = @LN_S@
235LTLIBICONV = @LTLIBICONV@
236LTLIBINTL = @LTLIBINTL@
237LTLIBOBJS = @LTLIBOBJS@
238MAKEINFO = @MAKEINFO@
239MKDIR_P = @MKDIR_P@
240MSGFMT = @MSGFMT@
241MSGFMT_015 = @MSGFMT_015@
242MSGMERGE = @MSGMERGE@
243NM = @NM@
244NMEDIT = @NMEDIT@
245OBJC = @OBJC@
246OBJCDEPMODE = @OBJCDEPMODE@
247OBJCFLAGS = @OBJCFLAGS@
248OBJDUMP = @OBJDUMP@
249OBJEXT = @OBJEXT@
250OTOOL = @OTOOL@
251OTOOL64 = @OTOOL64@
252PACKAGE = @PACKAGE@
253PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
254PACKAGE_NAME = @PACKAGE_NAME@
255PACKAGE_STRING = @PACKAGE_STRING@
256PACKAGE_TARNAME = @PACKAGE_TARNAME@
257PACKAGE_URL = @PACKAGE_URL@
258PACKAGE_VERSION = @PACKAGE_VERSION@
259PATH_SEPARATOR = @PATH_SEPARATOR@
260PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
261PIXMAN_LIBS = @PIXMAN_LIBS@
262PKG_CONFIG = @PKG_CONFIG@
263POSUB = @POSUB@
264RANLIB = @RANLIB@
265SCIM_CFLAGS = @SCIM_CFLAGS@
266SCIM_LIBS = @SCIM_LIBS@
267SDL_CFLAGS = @SDL_CFLAGS@
268SDL_CONFIG = @SDL_CONFIG@
269SDL_LIBS = @SDL_LIBS@
270SED = @SED@
271SET_MAKE = @SET_MAKE@
272SHELL = @SHELL@
273SSL_CFLAGS = @SSL_CFLAGS@
274SSL_LIBS = @SSL_LIBS@
275STRIP = @STRIP@
276TLS2_CFLAGS = @TLS2_CFLAGS@
277TLS2_LIBS = @TLS2_LIBS@
278TLS_CFLAGS = @TLS_CFLAGS@
279TLS_LIBS = @TLS_LIBS@
280TSLIB_CFLAGS = @TSLIB_CFLAGS@
281TSLIB_LIBS = @TSLIB_LIBS@
282USE_NLS = @USE_NLS@
283VERSION = @VERSION@
284VMAJ = @VMAJ@
285WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
286WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
287WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
288WAYLAND_LIBS = @WAYLAND_LIBS@
289WIN32_CFLAGS = @WIN32_CFLAGS@
290WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
291WIN32_LIBS = @WIN32_LIBS@
292XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@
293XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@
294XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@
295XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@
296XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@
297XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@
298XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@
299XCB_DPMS_LIBS = @XCB_DPMS_LIBS@
300XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@
301XCB_RANDR_LIBS = @XCB_RANDR_LIBS@
302XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@
303XCB_RENDER_LIBS = @XCB_RENDER_LIBS@
304XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@
305XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@
306XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@
307XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@
308XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@
309XCB_SYNC_LIBS = @XCB_SYNC_LIBS@
310XCB_X11_CFLAGS = @XCB_X11_CFLAGS@
311XCB_X11_LIBS = @XCB_X11_LIBS@
312XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@
313XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@
314XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@
315XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@
316XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@
317XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@
318XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@
319XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@
320XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@
321XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@
322XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@
323XCB_XTEST_LIBS = @XCB_XTEST_LIBS@
324XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@
325XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@
326XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@
327XDAMAGE_LIBS = @XDAMAGE_LIBS@
328XDPMS_CFLAGS = @XDPMS_CFLAGS@
329XDPMS_LIBS = @XDPMS_LIBS@
330XFIXES_CFLAGS = @XFIXES_CFLAGS@
331XFIXES_LIBS = @XFIXES_LIBS@
332XGESTURE_CFLAGS = @XGESTURE_CFLAGS@
333XGESTURE_LIBS = @XGESTURE_LIBS@
334XGETTEXT = @XGETTEXT@
335XGETTEXT_015 = @XGETTEXT_015@
336XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
337XI2_CFLAGS = @XI2_CFLAGS@
338XI2_LIBS = @XI2_LIBS@
339XINERAMA_CFLAGS = @XINERAMA_CFLAGS@
340XINERAMA_LIBS = @XINERAMA_LIBS@
341XKB_CFLAGS = @XKB_CFLAGS@
342XKB_LIBS = @XKB_LIBS@
343XMKMF = @XMKMF@
344XPRINT_CFLAGS = @XPRINT_CFLAGS@
345XPRINT_LIBS = @XPRINT_LIBS@
346XRANDR_CFLAGS = @XRANDR_CFLAGS@
347XRANDR_LIBS = @XRANDR_LIBS@
348XRENDER_CFLAGS = @XRENDER_CFLAGS@
349XRENDER_LIBS = @XRENDER_LIBS@
350XSS_CFLAGS = @XSS_CFLAGS@
351XSS_LIBS = @XSS_LIBS@
352XTEST_CFLAGS = @XTEST_CFLAGS@
353XTEST_LIBS = @XTEST_LIBS@
354X_CFLAGS = @X_CFLAGS@
355X_EXTRA_LIBS = @X_EXTRA_LIBS@
356X_LIBS = @X_LIBS@
357X_PRE_LIBS = @X_PRE_LIBS@
358Xcursor_cflags = @Xcursor_cflags@
359Xcursor_libs = @Xcursor_libs@
360abs_builddir = @abs_builddir@
361abs_srcdir = @abs_srcdir@
362abs_top_builddir = @abs_top_builddir@
363abs_top_srcdir = @abs_top_srcdir@
364ac_ct_CC = @ac_ct_CC@
365ac_ct_CXX = @ac_ct_CXX@
366ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
367ac_ct_OBJC = @ac_ct_OBJC@
368am__include = @am__include@
369am__leading_dot = @am__leading_dot@
370am__quote = @am__quote@
371am__tar = @am__tar@
372am__untar = @am__untar@
373bindir = @bindir@
374build = @build@
375build_alias = @build_alias@
376build_cpu = @build_cpu@
377build_os = @build_os@
378build_vendor = @build_vendor@
379builddir = @builddir@
380cocoa_ldflags = @cocoa_ldflags@
381datadir = @datadir@
382datarootdir = @datarootdir@
383dlopen_libs = @dlopen_libs@
384docdir = @docdir@
385dvidir = @dvidir@
386ecore_cocoa_cflags = @ecore_cocoa_cflags@
387ecore_cocoa_libs = @ecore_cocoa_libs@
388ecore_con_cflags = @ecore_con_cflags@
389ecore_con_libs = @ecore_con_libs@
390ecore_directfb_cflags = @ecore_directfb_cflags@
391ecore_directfb_libs = @ecore_directfb_libs@
392ecore_evas_cflags = @ecore_evas_cflags@
393ecore_evas_libs = @ecore_evas_libs@
394ecore_fb_cflags = @ecore_fb_cflags@
395ecore_fb_libs = @ecore_fb_libs@
396ecore_file_cflags = @ecore_file_cflags@
397ecore_file_libs = @ecore_file_libs@
398ecore_imf_cflags = @ecore_imf_cflags@
399ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
400ecore_imf_evas_libs = @ecore_imf_evas_libs@
401ecore_imf_libs = @ecore_imf_libs@
402ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
403ecore_imf_scim_libs = @ecore_imf_scim_libs@
404ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
405ecore_imf_xim_libs = @ecore_imf_xim_libs@
406ecore_input_cflags = @ecore_input_cflags@
407ecore_input_evas_cflags = @ecore_input_evas_cflags@
408ecore_input_evas_libs = @ecore_input_evas_libs@
409ecore_input_libs = @ecore_input_libs@
410ecore_ipc_cflags = @ecore_ipc_cflags@
411ecore_ipc_libs = @ecore_ipc_libs@
412ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
413ecore_psl1ght_libs = @ecore_psl1ght_libs@
414ecore_sdl_cflags = @ecore_sdl_cflags@
415ecore_sdl_libs = @ecore_sdl_libs@
416ecore_wayland_cflags = @ecore_wayland_cflags@
417ecore_wayland_libs = @ecore_wayland_libs@
418ecore_win32_cflags = @ecore_win32_cflags@
419ecore_win32_libs = @ecore_win32_libs@
420ecore_wince_cflags = @ecore_wince_cflags@
421ecore_wince_libs = @ecore_wince_libs@
422ecore_x_cflags = @ecore_x_cflags@
423ecore_x_libs = @ecore_x_libs@
424ecore_x_libs_private = @ecore_x_libs_private@
425efl_doxygen = @efl_doxygen@
426efl_have_doxygen = @efl_have_doxygen@
427exec_prefix = @exec_prefix@
428have_ecore_x_xcb_define = @have_ecore_x_xcb_define@
429host = @host@
430host_alias = @host_alias@
431host_cpu = @host_cpu@
432host_os = @host_os@
433host_vendor = @host_vendor@
434htmldir = @htmldir@
435includedir = @includedir@
436infodir = @infodir@
437install_sh = @install_sh@
438libdir = @libdir@
439libexecdir = @libexecdir@
440localedir = @localedir@
441localstatedir = @localstatedir@
442lt_ECHO = @lt_ECHO@
443lt_enable_auto_import = @lt_enable_auto_import@
444mandir = @mandir@
445mkdir_p = @mkdir_p@
446oldincludedir = @oldincludedir@
447pdfdir = @pdfdir@
448pkgconfig_requires_private = @pkgconfig_requires_private@
449prefix = @prefix@
450program_transform_name = @program_transform_name@
451psdir = @psdir@
452release_info = @release_info@
453requirements_ecore = @requirements_ecore@
454requirements_ecore_cocoa = @requirements_ecore_cocoa@
455requirements_ecore_con = @requirements_ecore_con@
456requirements_ecore_directfb = @requirements_ecore_directfb@
457requirements_ecore_evas = @requirements_ecore_evas@
458requirements_ecore_fb = @requirements_ecore_fb@
459requirements_ecore_file = @requirements_ecore_file@
460requirements_ecore_imf = @requirements_ecore_imf@
461requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
462requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
463requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
464requirements_ecore_input = @requirements_ecore_input@
465requirements_ecore_input_evas = @requirements_ecore_input_evas@
466requirements_ecore_ipc = @requirements_ecore_ipc@
467requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
468requirements_ecore_sdl = @requirements_ecore_sdl@
469requirements_ecore_wayland = @requirements_ecore_wayland@
470requirements_ecore_win32 = @requirements_ecore_win32@
471requirements_ecore_wince = @requirements_ecore_wince@
472requirements_ecore_x = @requirements_ecore_x@
473rt_libs = @rt_libs@
474sbindir = @sbindir@
475sharedstatedir = @sharedstatedir@
476srcdir = @srcdir@
477sysconfdir = @sysconfdir@
478target_alias = @target_alias@
479top_build_prefix = @top_build_prefix@
480top_builddir = @top_builddir@
481top_srcdir = @top_srcdir@
482version_info = @version_info@
483x_cflags = @x_cflags@
484x_includes = @x_includes@
485x_libs = @x_libs@
486MAINTAINERCLEANFILES = Makefile.in
487AM_CPPFLAGS = \
488-I$(top_srcdir) \
489-I$(top_srcdir)/src/lib/ecore \
490-I$(top_srcdir)/src/lib/ecore_input \
491-I$(top_srcdir)/src/lib/ecore_x \
492-I$(top_srcdir)/src/lib/ecore_imf \
493-I$(top_srcdir)/src/lib/ecore_evas \
494-I$(top_builddir)/src/lib/ecore \
495-I$(top_builddir)/src/lib/ecore_input \
496-I$(top_builddir)/src/lib/ecore_x \
497-I$(top_builddir)/src/lib/ecore_imf \
498-I$(top_builddir)/src/lib/ecore_evas \
499-DPACKAGE_LIB_DIR=\"$(libdir)\" \
500-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
501@SCIM_CFLAGS@ \
502@EVAS_CFLAGS@ \
503@EINA_CFLAGS@
504
505pkgdir = $(libdir)/ecore/immodules
506pkg_LTLIBRARIES = scim.la
507scim_la_SOURCES = \
508scim_imcontext.cpp \
509scim_module.cpp \
510scim_imcontext.h
511
512scim_la_LIBADD = \
513 $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \
514 $(top_builddir)/src/lib/ecore_x/libecore_x.la \
515 @SCIM_LIBS@ \
516 @EVAS_LIBS@ \
517 @EINA_LIBS@
518
519scim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
520scim_la_LIBTOOLFLAGS = --tag=disable-static
521all: all-am
522
523.SUFFIXES:
524.SUFFIXES: .cpp .lo .o .obj
525$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
526 @for dep in $?; do \
527 case '$(am__configure_deps)' in \
528 *$$dep*) \
529 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
530 && { if test -f $@; then exit 0; else break; fi; }; \
531 exit 1;; \
532 esac; \
533 done; \
534 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/immodules/scim/Makefile'; \
535 $(am__cd) $(top_srcdir) && \
536 $(AUTOMAKE) --gnu src/modules/immodules/scim/Makefile
537.PRECIOUS: Makefile
538Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
539 @case '$?' in \
540 *config.status*) \
541 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
542 *) \
543 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
544 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
545 esac;
546
547$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
548 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
549
550$(top_srcdir)/configure: $(am__configure_deps)
551 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
552$(ACLOCAL_M4): $(am__aclocal_m4_deps)
553 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
554$(am__aclocal_m4_deps):
555install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES)
556 @$(NORMAL_INSTALL)
557 test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)"
558 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
559 list2=; for p in $$list; do \
560 if test -f $$p; then \
561 list2="$$list2 $$p"; \
562 else :; fi; \
563 done; \
564 test -z "$$list2" || { \
565 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \
566 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \
567 }
568
569uninstall-pkgLTLIBRARIES:
570 @$(NORMAL_UNINSTALL)
571 @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \
572 for p in $$list; do \
573 $(am__strip_dir) \
574 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \
575 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \
576 done
577
578clean-pkgLTLIBRARIES:
579 -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES)
580 @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \
581 dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
582 test "$$dir" != "$$p" || dir=.; \
583 echo "rm -f \"$${dir}/so_locations\""; \
584 rm -f "$${dir}/so_locations"; \
585 done
586scim.la: $(scim_la_OBJECTS) $(scim_la_DEPENDENCIES)
587 $(AM_V_CXXLD)$(scim_la_LINK) -rpath $(pkgdir) $(scim_la_OBJECTS) $(scim_la_LIBADD) $(LIBS)
588
589mostlyclean-compile:
590 -rm -f *.$(OBJEXT)
591
592distclean-compile:
593 -rm -f *.tab.c
594
595@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_la-scim_imcontext.Plo@am__quote@
596@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_la-scim_module.Plo@am__quote@
597
598.cpp.o:
599@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
600@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
601@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
602@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
603@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
604@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
605
606.cpp.obj:
607@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
608@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
609@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
610@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
611@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
612@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
613
614.cpp.lo:
615@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
616@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
617@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
618@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
619@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
620@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
621
622scim_la-scim_imcontext.lo: scim_imcontext.cpp
623@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scim_la-scim_imcontext.lo -MD -MP -MF $(DEPDIR)/scim_la-scim_imcontext.Tpo -c -o scim_la-scim_imcontext.lo `test -f 'scim_imcontext.cpp' || echo '$(srcdir)/'`scim_imcontext.cpp
624@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scim_la-scim_imcontext.Tpo $(DEPDIR)/scim_la-scim_imcontext.Plo
625@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
626@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scim_imcontext.cpp' object='scim_la-scim_imcontext.lo' libtool=yes @AMDEPBACKSLASH@
627@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
628@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scim_la-scim_imcontext.lo `test -f 'scim_imcontext.cpp' || echo '$(srcdir)/'`scim_imcontext.cpp
629
630scim_la-scim_module.lo: scim_module.cpp
631@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scim_la-scim_module.lo -MD -MP -MF $(DEPDIR)/scim_la-scim_module.Tpo -c -o scim_la-scim_module.lo `test -f 'scim_module.cpp' || echo '$(srcdir)/'`scim_module.cpp
632@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scim_la-scim_module.Tpo $(DEPDIR)/scim_la-scim_module.Plo
633@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
634@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scim_module.cpp' object='scim_la-scim_module.lo' libtool=yes @AMDEPBACKSLASH@
635@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
636@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scim_la-scim_module.lo `test -f 'scim_module.cpp' || echo '$(srcdir)/'`scim_module.cpp
637
638mostlyclean-libtool:
639 -rm -f *.lo
640
641clean-libtool:
642 -rm -rf .libs _libs
643
644ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
645 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
646 unique=`for i in $$list; do \
647 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
648 done | \
649 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
650 END { if (nonempty) { for (i in files) print i; }; }'`; \
651 mkid -fID $$unique
652tags: TAGS
653
654TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
655 $(TAGS_FILES) $(LISP)
656 set x; \
657 here=`pwd`; \
658 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
659 unique=`for i in $$list; do \
660 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
661 done | \
662 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
663 END { if (nonempty) { for (i in files) print i; }; }'`; \
664 shift; \
665 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
666 test -n "$$unique" || unique=$$empty_fix; \
667 if test $$# -gt 0; then \
668 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
669 "$$@" $$unique; \
670 else \
671 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
672 $$unique; \
673 fi; \
674 fi
675ctags: CTAGS
676CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
677 $(TAGS_FILES) $(LISP)
678 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
679 unique=`for i in $$list; do \
680 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
681 done | \
682 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
683 END { if (nonempty) { for (i in files) print i; }; }'`; \
684 test -z "$(CTAGS_ARGS)$$unique" \
685 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
686 $$unique
687
688GTAGS:
689 here=`$(am__cd) $(top_builddir) && pwd` \
690 && $(am__cd) $(top_srcdir) \
691 && gtags -i $(GTAGS_ARGS) "$$here"
692
693distclean-tags:
694 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
695
696distdir: $(DISTFILES)
697 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
698 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
699 list='$(DISTFILES)'; \
700 dist_files=`for file in $$list; do echo $$file; done | \
701 sed -e "s|^$$srcdirstrip/||;t" \
702 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
703 case $$dist_files in \
704 */*) $(MKDIR_P) `echo "$$dist_files" | \
705 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
706 sort -u` ;; \
707 esac; \
708 for file in $$dist_files; do \
709 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
710 if test -d $$d/$$file; then \
711 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
712 if test -d "$(distdir)/$$file"; then \
713 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
714 fi; \
715 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
716 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
717 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
718 fi; \
719 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
720 else \
721 test -f "$(distdir)/$$file" \
722 || cp -p $$d/$$file "$(distdir)/$$file" \
723 || exit 1; \
724 fi; \
725 done
726check-am: all-am
727check: check-am
728all-am: Makefile $(LTLIBRARIES)
729installdirs:
730 for dir in "$(DESTDIR)$(pkgdir)"; do \
731 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
732 done
733install: install-am
734install-exec: install-exec-am
735install-data: install-data-am
736uninstall: uninstall-am
737
738install-am: all-am
739 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
740
741installcheck: installcheck-am
742install-strip:
743 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
744 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
745 `test -z '$(STRIP)' || \
746 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
747mostlyclean-generic:
748
749clean-generic:
750
751distclean-generic:
752 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
753 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
754
755maintainer-clean-generic:
756 @echo "This command is intended for maintainers to use"
757 @echo "it deletes files that may require special tools to rebuild."
758 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
759clean: clean-am
760
761clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \
762 mostlyclean-am
763
764distclean: distclean-am
765 -rm -rf ./$(DEPDIR)
766 -rm -f Makefile
767distclean-am: clean-am distclean-compile distclean-generic \
768 distclean-tags
769
770dvi: dvi-am
771
772dvi-am:
773
774html: html-am
775
776html-am:
777
778info: info-am
779
780info-am:
781
782install-data-am: install-pkgLTLIBRARIES
783
784install-dvi: install-dvi-am
785
786install-dvi-am:
787
788install-exec-am:
789
790install-html: install-html-am
791
792install-html-am:
793
794install-info: install-info-am
795
796install-info-am:
797
798install-man:
799
800install-pdf: install-pdf-am
801
802install-pdf-am:
803
804install-ps: install-ps-am
805
806install-ps-am:
807
808installcheck-am:
809
810maintainer-clean: maintainer-clean-am
811 -rm -rf ./$(DEPDIR)
812 -rm -f Makefile
813maintainer-clean-am: distclean-am maintainer-clean-generic
814
815mostlyclean: mostlyclean-am
816
817mostlyclean-am: mostlyclean-compile mostlyclean-generic \
818 mostlyclean-libtool
819
820pdf: pdf-am
821
822pdf-am:
823
824ps: ps-am
825
826ps-am:
827
828uninstall-am: uninstall-pkgLTLIBRARIES
829
830.MAKE: install-am install-strip
831
832.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
833 clean-libtool clean-pkgLTLIBRARIES ctags distclean \
834 distclean-compile distclean-generic distclean-libtool \
835 distclean-tags distdir dvi dvi-am html html-am info info-am \
836 install install-am install-data install-data-am install-dvi \
837 install-dvi-am install-exec install-exec-am install-html \
838 install-html-am install-info install-info-am install-man \
839 install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \
840 install-ps-am install-strip installcheck installcheck-am \
841 installdirs maintainer-clean maintainer-clean-generic \
842 mostlyclean mostlyclean-compile mostlyclean-generic \
843 mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
844 uninstall-am uninstall-pkgLTLIBRARIES
845
846
847# Tell versions [3.59,3.63) of GNU make to not export all variables.
848# Otherwise a system limit (for SysV at least) may be exceeded.
849.NOEXPORT:
diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp
new file mode 100644
index 0000000..6cb72c2
--- /dev/null
+++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp
@@ -0,0 +1,2839 @@
1#ifdef HAVE_CONFIG_H
2#include <config.h>
3#endif
4
5#define Uses_SCIM_DEBUG
6#define Uses_SCIM_BACKEND
7#define Uses_SCIM_IMENGINE_MODULE
8#define Uses_SCIM_HOTKEY
9#define Uses_SCIM_PANEL_CLIENT
10
11#include <sys/types.h>
12#include <sys/wait.h>
13#include <sys/time.h>
14#include <sys/times.h>
15#include <unistd.h>
16#include <pthread.h>
17#include <Ecore_Evas.h>
18#include <Ecore_X.h>
19#include <Ecore.h>
20#include <Evas.h>
21
22#include <X11/Xlib.h>
23#include <X11/keysym.h>
24#include <X11/Xutil.h>
25
26#include <scim.h>
27#include "scim_imcontext.h"
28
29using namespace scim;
30
31struct _EcoreIMFContextISFImpl
32{
33 EcoreIMFContextISF *parent;
34 IMEngineInstancePointer si;
35 Ecore_X_Window client_window;
36 Evas *client_canvas;
37 Ecore_IMF_Input_Mode input_mode;
38 WideString preedit_string;
39 AttributeList preedit_attrlist;
40 Ecore_IMF_Autocapital_Type autocapital_type;
41 int preedit_caret;
42 int cursor_x;
43 int cursor_y;
44 int cursor_pos;
45 bool use_preedit;
46 bool is_on;
47 bool shared_si;
48 bool preedit_started;
49 bool preedit_updating;
50 bool need_commit_preedit;
51 bool uppercase;
52 bool prediction_allow;
53
54 EcoreIMFContextISFImpl *next;
55};
56
57/* Input Context handling functions. */
58static EcoreIMFContextISFImpl *new_ic_impl (EcoreIMFContextISF *parent);
59static void delete_ic_impl (EcoreIMFContextISFImpl *impl);
60static void delete_all_ic_impl (void);
61
62static EcoreIMFContextISF *find_ic (int id);
63
64
65/* private functions */
66static void panel_slot_reload_config (int context);
67static void panel_slot_exit (int context);
68static void panel_slot_update_lookup_table_page_size(int context,
69 int page_size);
70static void panel_slot_lookup_table_page_up (int context);
71static void panel_slot_lookup_table_page_down (int context);
72static void panel_slot_trigger_property (int context,
73 const String &property);
74static void panel_slot_process_helper_event (int context,
75 const String &target_uuid,
76 const String &helper_uuid,
77 const Transaction &trans);
78static void panel_slot_move_preedit_caret (int context,
79 int caret_pos);
80static void panel_slot_select_candidate (int context,
81 int cand_index);
82static void panel_slot_process_key_event (int context,
83 const KeyEvent &key);
84static void panel_slot_commit_string (int context,
85 const WideString &wstr);
86static void panel_slot_forward_key_event (int context,
87 const KeyEvent &key);
88static void panel_slot_request_help (int context);
89static void panel_slot_request_factory_menu (int context);
90static void panel_slot_change_factory (int context,
91 const String &uuid);
92
93static void panel_req_focus_in (EcoreIMFContextISF *ic);
94static void panel_req_update_factory_info (EcoreIMFContextISF *ic);
95static void panel_req_update_spot_location (EcoreIMFContextISF *ic);
96static void panel_req_show_help (EcoreIMFContextISF *ic);
97static void panel_req_show_factory_menu (EcoreIMFContextISF *ic);
98
99/* Panel iochannel handler*/
100static bool panel_initialize (void);
101static void panel_finalize (void);
102static Eina_Bool panel_iochannel_handler (void *data,
103 Ecore_Fd_Handler *fd_handler);
104
105/* utility functions */
106static bool filter_hotkeys (EcoreIMFContextISF *ic,
107 const KeyEvent &key);
108static void turn_on_ic (EcoreIMFContextISF *ic);
109static void turn_off_ic (EcoreIMFContextISF *ic);
110static void set_ic_capabilities (EcoreIMFContextISF *ic);
111
112static void initialize (void);
113static void finalize (void);
114
115static void open_next_factory (EcoreIMFContextISF *ic);
116static void open_previous_factory (EcoreIMFContextISF *ic);
117static void open_specific_factory (EcoreIMFContextISF *ic,
118 const String &uuid);
119static void initialize_modifier_bits (Display *display);
120static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask);
121static XKeyEvent createKeyEvent (Display *display, Window &win,
122 Window &winRoot, bool press,
123 int keycode, int modifiers);
124static void _x_send_key_event (const KeyEvent &key);
125
126static void attach_instance (const IMEngineInstancePointer &si);
127
128/* slot functions */
129static void slot_show_preedit_string (IMEngineInstanceBase *si);
130static void slot_show_aux_string (IMEngineInstanceBase *si);
131static void slot_show_lookup_table (IMEngineInstanceBase *si);
132
133static void slot_hide_preedit_string (IMEngineInstanceBase *si);
134static void slot_hide_aux_string (IMEngineInstanceBase *si);
135static void slot_hide_lookup_table (IMEngineInstanceBase *si);
136
137static void slot_update_preedit_caret (IMEngineInstanceBase *si,
138 int caret);
139static void slot_update_preedit_string (IMEngineInstanceBase *si,
140 const WideString &str,
141 const AttributeList &attrs);
142static void slot_update_aux_string (IMEngineInstanceBase *si,
143 const WideString &str,
144 const AttributeList &attrs);
145static void slot_commit_string (IMEngineInstanceBase *si,
146 const WideString &str);
147static void slot_forward_key_event (IMEngineInstanceBase *si,
148 const KeyEvent &key);
149static void slot_update_lookup_table (IMEngineInstanceBase *si,
150 const LookupTable &table);
151
152static void slot_register_properties (IMEngineInstanceBase *si,
153 const PropertyList &properties);
154static void slot_update_property (IMEngineInstanceBase *si,
155 const Property &property);
156static void slot_beep (IMEngineInstanceBase *si);
157static void slot_start_helper (IMEngineInstanceBase *si,
158 const String &helper_uuid);
159static void slot_stop_helper (IMEngineInstanceBase *si,
160 const String &helper_uuid);
161static void slot_send_helper_event (IMEngineInstanceBase *si,
162 const String &helper_uuid,
163 const Transaction &trans);
164static bool slot_get_surrounding_text (IMEngineInstanceBase *si,
165 WideString &text,
166 int &cursor,
167 int maxlen_before,
168 int maxlen_after);
169static bool slot_delete_surrounding_text (IMEngineInstanceBase *si,
170 int offset,
171 int len);
172
173static void reload_config_callback (const ConfigPointer &config);
174
175static void fallback_commit_string_cb (IMEngineInstanceBase *si,
176 const WideString &str);
177
178static void caps_mode_check (Ecore_IMF_Context *ctx, Eina_Bool force);
179
180/* Local variables declaration */
181static String _language;
182static EcoreIMFContextISFImpl *_used_ic_impl_list = 0;
183static EcoreIMFContextISFImpl *_free_ic_impl_list = 0;
184static EcoreIMFContextISF *_ic_list = 0;
185
186static KeyboardLayout _keyboard_layout = SCIM_KEYBOARD_Default;
187static int _valid_key_mask = SCIM_KEY_AllMasks;
188
189static FrontEndHotkeyMatcher _frontend_hotkey_matcher;
190static IMEngineHotkeyMatcher _imengine_hotkey_matcher;
191
192static IMEngineInstancePointer _default_instance;
193
194static ConfigModule *_config_module = 0;
195static ConfigPointer _config;
196static BackEndPointer _backend;
197
198static EcoreIMFContextISF *_focused_ic = 0;
199
200static bool _scim_initialized = false;
201
202static int _instance_count = 0;
203static int _context_count = 0;
204
205static IMEngineFactoryPointer _fallback_factory;
206static IMEngineInstancePointer _fallback_instance;
207static PanelClient _panel_client;
208
209static Ecore_Fd_Handler *_panel_iochannel_read_handler = 0;
210static Ecore_Fd_Handler *_panel_iochannel_err_handler = 0;
211
212static Ecore_X_Window _client_window = 0;
213
214static bool _on_the_spot = true;
215static bool _shared_input_method = false;
216
217static Eina_Bool autocap_allow = EINA_FALSE;
218
219static Display *__current_display = 0;
220static int __current_alt_mask = Mod1Mask;
221static int __current_meta_mask = 0;
222static int __current_super_mask = 0;
223static int __current_hyper_mask = 0;
224static int __current_numlock_mask = Mod2Mask;
225
226// A hack to shutdown the immodule cleanly even if im_module_exit () is not called when exiting.
227class FinalizeHandler
228{
229public:
230 FinalizeHandler ()
231 {
232 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler ()\n";
233 }
234 ~FinalizeHandler ()
235 {
236 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler ()\n";
237 isf_imf_context_shutdown ();
238 }
239};
240
241static FinalizeHandler _finalize_handler;
242
243static unsigned int
244utf8_offset_to_index(const char *str, int offset)
245{
246 int index = 0;
247 int i;
248 for (i = 0; i < offset; i++)
249 {
250 eina_unicode_utf8_get_next(str, &index);
251 }
252
253 return index;
254}
255
256static unsigned int
257get_time (void)
258{
259 unsigned int tint;
260 struct timeval tv;
261 struct timezone tz; /* is not used since ages */
262 gettimeofday (&tv, &tz);
263 tint = tv.tv_sec * 1000;
264 tint = tint / 1000 * 1000;
265 tint = tint + tv.tv_usec / 1000;
266 return tint;
267}
268
269/* Function Implementations */
270static EcoreIMFContextISFImpl *
271new_ic_impl (EcoreIMFContextISF *parent)
272{
273 EcoreIMFContextISFImpl *impl = NULL;
274
275 if (_free_ic_impl_list != NULL)
276 {
277 impl = _free_ic_impl_list;
278 _free_ic_impl_list = _free_ic_impl_list->next;
279 }
280 else
281 {
282 impl = new EcoreIMFContextISFImpl;
283 if (impl == NULL)
284 return NULL;
285 }
286
287 impl->uppercase = false;
288 impl->autocapital_type = ECORE_IMF_AUTOCAPITAL_TYPE_NONE;
289 impl->next = _used_ic_impl_list;
290 _used_ic_impl_list = impl;
291
292 impl->parent = parent;
293
294 return impl;
295}
296
297static void
298delete_ic_impl (EcoreIMFContextISFImpl *impl)
299{
300 EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0;
301
302 for (; rec != 0; last = rec, rec = rec->next)
303 {
304 if (rec == impl)
305 {
306 if (last != 0)
307 last->next = rec->next;
308 else
309 _used_ic_impl_list = rec->next;
310
311 rec->next = _free_ic_impl_list;
312 _free_ic_impl_list = rec;
313
314 rec->parent = 0;
315 rec->si.reset ();
316 rec->client_window = 0;
317 rec->preedit_string = WideString ();
318 rec->preedit_attrlist.clear ();
319
320 return;
321 }
322 }
323}
324
325static void
326delete_all_ic_impl (void)
327{
328 EcoreIMFContextISFImpl *it = _used_ic_impl_list;
329
330 while (it != 0)
331 {
332 _used_ic_impl_list = it->next;
333 delete it;
334 it = _used_ic_impl_list;
335 }
336
337 it = _free_ic_impl_list;
338 while (it != 0)
339 {
340 _free_ic_impl_list = it->next;
341 delete it;
342 it = _free_ic_impl_list;
343 }
344}
345
346static EcoreIMFContextISF *
347find_ic (int id)
348{
349 EcoreIMFContextISFImpl *rec = _used_ic_impl_list;
350
351 while (rec != 0)
352 {
353 if (rec->parent && rec->parent->id == id)
354 return rec->parent;
355 rec = rec->next;
356 }
357
358 return 0;
359}
360
361static Eina_Bool
362analyze_surrounding_text(Ecore_IMF_Context *ctx)
363{
364 char *plain_str = NULL;
365 char *markup_str = NULL;
366 const char *puncs[3] = {". ", "! ", "? "};
367 Eina_Bool ret = EINA_FALSE;
368 int cursor_pos = 0;
369 int i = 0;
370 Eina_Unicode *tail = NULL;
371 Eina_Unicode *ustr = NULL;
372 Eina_Unicode *uni_puncs[3];
373 EcoreIMFContextISF *context_scim;
374
375 if (!ctx) return EINA_FALSE;
376 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
377 if (!context_scim || !context_scim->impl) return EINA_FALSE;
378
379 switch (context_scim->impl->autocapital_type)
380 {
381 case ECORE_IMF_AUTOCAPITAL_TYPE_NONE:
382 return EINA_FALSE;
383 case ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER:
384 return EINA_TRUE;
385 default:
386 break;
387 }
388
389 for (i=0; i<3; i++)
390 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL);
391
392 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos);
393 if (!markup_str) goto done;
394
395 if (cursor_pos == 0)
396 {
397 ret = EINA_TRUE;
398 goto done;
399 }
400
401 // Convert into plain string
402 plain_str = evas_textblock_text_markup_to_utf8(NULL, markup_str);
403 if (!plain_str) goto done;
404
405 // Convert string from utf8 to unicode
406 ustr = eina_unicode_utf8_to_unicode(plain_str, NULL);
407 if (!ustr) goto done;
408
409 if (cursor_pos >= 1)
410 {
411 if (context_scim->impl->autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_WORD)
412 {
413 if (ustr[cursor_pos-1] == ' ')
414 {
415 ret = EINA_TRUE;
416 goto done;
417 }
418 }
419
420 // Check paragraph separator <PS> and carrage return <br>
421 if ((ustr[cursor_pos-1] == 0x2029) || (ustr[cursor_pos-1] == '\n'))
422 {
423 ret = EINA_TRUE;
424 goto done;
425 }
426 }
427
428 // check punctuation
429 if (cursor_pos >= 2)
430 {
431 tail = eina_unicode_strndup(ustr+cursor_pos-2, 2);
432
433 if (tail)
434 {
435 for (i=0; i<3; i++)
436 {
437 if (!eina_unicode_strcmp(tail, uni_puncs[i]))
438 {
439 ret = EINA_TRUE;
440 break;
441 }
442 }
443 free(tail);
444 tail = NULL;
445 }
446 }
447
448done:
449 if (ustr) free(ustr);
450 if (markup_str) free(markup_str);
451 if (plain_str) free(plain_str);
452
453 for (i=0; i<3; i++)
454 if (uni_puncs[i]) free(uni_puncs[i]);
455
456 return ret;
457}
458
459static void
460caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force)
461{
462 Eina_Bool uppercase;
463 EcoreIMFContextISF *context_scim;
464
465 if (!ctx) return;
466 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
467
468 if (autocap_allow == EINA_FALSE)
469 return;
470
471 // Check autocapital type
472 if (!context_scim || !context_scim->impl)
473 return;
474
475 if (analyze_surrounding_text(ctx))
476 uppercase = EINA_TRUE;
477 else
478 uppercase = EINA_FALSE;
479
480 if (force)
481 context_scim->impl->uppercase = uppercase;
482 else
483 if (context_scim->impl->uppercase != uppercase)
484 context_scim->impl->uppercase = uppercase;
485}
486
487static void
488feed_key_event (Evas *evas, const char *str, Eina_Bool fake)
489{
490 char key_string[128] = {0};
491 unsigned int timestamp = 0;
492
493 if (!fake)
494 timestamp = get_time ();
495
496 if (strncmp (str, "KeyRelease+", 11) == 0)
497 {
498 strncpy(key_string, str + 11, strlen(str)-11);
499 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 }
502 else
503 {
504 strncpy(key_string, str, strlen(str));
505 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 }
508}
509
510/* Public functions */
511/**
512 * isf_imf_context_new
513 *
514 * This function will be called by Ecore IMF.
515 * Create a instance of type EcoreIMFContextISF.
516 *
517 * Return value: A pointer to the newly created EcoreIMFContextISF instance
518 */
519EAPI EcoreIMFContextISF *
520isf_imf_context_new (void)
521{
522 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
523 char *env;
524
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;
533 if (context_scim == NULL)
534 {
535 std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n";
536 return NULL;
537 }
538
539 context_scim->id = _context_count++;
540
541 if (!_scim_initialized)
542 {
543 initialize ();
544 _scim_initialized = true;
545 }
546
547 env = getenv("ECORE_IMF_AUTOCAPITAL_ALLOW");
548 if (env)
549 autocap_allow = !!atoi(env);
550
551 return context_scim;
552}
553
554/**
555 * isf_imf_shutdown
556 *
557 * It will be called when the scim im module is unloaded by ecore. It will do some
558 * cleanup job.
559 */
560EAPI void
561isf_imf_context_shutdown (void)
562{
563 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
564
565 if (_scim_initialized)
566 {
567 _scim_initialized = false;
568 finalize ();
569 }
570}
571
572EAPI void
573isf_imf_context_add (Ecore_IMF_Context *ctx)
574{
575 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
576
577 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
578
579 if (!context_scim) return;
580
581 context_scim->impl = NULL;
582
583 if (_backend.null ())
584 return;
585
586 IMEngineInstancePointer si;
587
588 // Use the default instance if "shared input method" mode is enabled.
589 if (_shared_input_method && !_default_instance.null ())
590 {
591 si = _default_instance;
592 SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n";
593 }
594
595 // Not in "shared input method" mode, or no default instance, create an instance.
596 if (si.null ())
597 {
598 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8");
599 if (factory.null ()) return;
600 si = factory->create_instance ("UTF-8", _instance_count++);
601 if (si.null ()) return;
602 attach_instance (si);
603 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n";
604 }
605
606 // If "shared input method" mode is enabled, and there is no default instance,
607 // then store this instance as default one.
608 if (_shared_input_method && _default_instance.null ())
609 {
610 SCIM_DEBUG_FRONTEND(2) << "update default instance.\n";
611 _default_instance = si;
612 }
613
614 context_scim->ctx = ctx;
615 context_scim->impl = new_ic_impl (context_scim);
616 if (context_scim->impl == NULL)
617 {
618 std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n";
619 return;
620 }
621
622 context_scim->impl->si = si;
623 context_scim->impl->client_window = 0;
624 context_scim->impl->client_canvas = NULL;
625 context_scim->impl->preedit_caret = 0;
626 context_scim->impl->cursor_x = 0;
627 context_scim->impl->cursor_y = 0;
628 context_scim->impl->cursor_pos = -1;
629 context_scim->impl->is_on = false;
630 context_scim->impl->shared_si = _shared_input_method;
631 context_scim->impl->use_preedit = _on_the_spot;
632 context_scim->impl->preedit_started = false;
633 context_scim->impl->preedit_updating = false;
634 context_scim->impl->need_commit_preedit = false;
635
636 if (!_ic_list)
637 context_scim->next = NULL;
638 else
639 context_scim->next = _ic_list;
640 _ic_list = context_scim;
641
642 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);
644
645 _panel_client.prepare (context_scim->id);
646 _panel_client.register_input_context (context_scim->id, si->get_factory_uuid ());
647 set_ic_capabilities (context_scim);
648 _panel_client.send ();
649
650 SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n";
651}
652
653EAPI void
654isf_imf_context_del (Ecore_IMF_Context *ctx)
655{
656 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
657
658 if (!_ic_list) return;
659
660 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
661
662 if (context_scim)
663 {
664 if (context_scim->id != _ic_list->id)
665 {
666 EcoreIMFContextISF * pre = _ic_list;
667 EcoreIMFContextISF * cur = _ic_list->next;
668 while (cur != NULL)
669 {
670 if (cur->id == context_scim->id)
671 {
672 pre->next = cur->next;
673 break;
674 }
675 pre = cur;
676 cur = cur->next;
677 }
678 }
679 else
680 _ic_list = _ic_list->next;
681 }
682
683 if (context_scim && context_scim->impl)
684 {
685 _panel_client.prepare (context_scim->id);
686
687 if (context_scim == _focused_ic)
688 context_scim->impl->si->focus_out ();
689
690 // Delete the instance.
691 EcoreIMFContextISF *old_focused = _focused_ic;
692 _focused_ic = context_scim;
693 context_scim->impl->si.reset ();
694 _focused_ic = old_focused;
695
696 if (context_scim == _focused_ic)
697 {
698 _panel_client.turn_off (context_scim->id);
699 _panel_client.focus_out (context_scim->id);
700 }
701
702 _panel_client.remove_input_context (context_scim->id);
703 _panel_client.send ();
704
705 if (context_scim->impl->client_window)
706 isf_imf_context_client_window_set (ctx, NULL);
707
708 if (context_scim->impl)
709 {
710 delete_ic_impl (context_scim->impl);
711 context_scim->impl = 0;
712 }
713 }
714
715 if (context_scim == _focused_ic)
716 _focused_ic = 0;
717
718 if (context_scim)
719 {
720 delete context_scim;
721 context_scim = 0;
722 }
723}
724
725/**
726 * isf_imf_context_client_canvas_set
727 * @ctx: a #Ecore_IMF_Context
728 * @canvas: the client canvas
729 *
730 * This function will be called by Ecore IMF.
731 *
732 * Set the client canvas for the Input Method Context; this is the canvas
733 * in which the input appears.
734 *
735 * The canvas type can be determined by using the context canvas type.
736 * Actually only canvas with type "evas" (Evas *) is supported. This canvas
737 * may be used in order to correctly position status windows, and may also
738 * be used for purposes internal to the Input Method Context.
739 */
740EAPI void
741isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas)
742{
743 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
744
745 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
746
747 if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas)
748 context_scim->impl->client_canvas = (Evas*)canvas;
749}
750
751/**
752 * isf_imf_context_client_window_set
753 * @ctx: a #Ecore_IMF_Context
754 * @window: the client window
755 *
756 * This function will be called by Ecore IMF.
757 *
758 * Set the client window for the Input Method Context; this is the Ecore_X_Window
759 * when using X11, Ecore_Win32_Window when using Win32, etc.
760 *
761 * This window is used in order to correctly position status windows,
762 * and may also be used for purposes internal to the Input Method Context.
763 */
764EAPI void
765isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window)
766{
767 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
768
769 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
770
771 if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window))
772 {
773 context_scim->impl->client_window = (Ecore_X_Window)((Ecore_Window)window);
774
775 if ((context_scim->impl->client_window != 0) &&
776 (context_scim->impl->client_window != _client_window))
777 _client_window = context_scim->impl->client_window;
778 }
779}
780
781/**
782 * isf_imf_context_reset
783 * @ctx: a #Ecore_IMF_Context
784 *
785 * This function will be called by Ecore IMF.
786 *
787 * Notify the Input Method Context that a change such as a change in cursor
788 * position has been made. This will typically cause the Input Method Context
789 * to clear the preedit state.
790 */
791EAPI void
792isf_imf_context_reset (Ecore_IMF_Context *ctx)
793{
794 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
795
796 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
797
798 if (context_scim && context_scim->impl && context_scim == _focused_ic)
799 {
800 WideString wstr = context_scim->impl->preedit_string;
801
802 _panel_client.prepare (context_scim->id);
803 context_scim->impl->si->reset ();
804 _panel_client.send ();
805
806 if (context_scim->impl->need_commit_preedit)
807 {
808 if (wstr.length ())
809 {
810 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());
812 }
813 _panel_client.prepare (context_scim->id);
814 _panel_client.send ();
815 }
816 }
817}
818
819/**
820 * isf_imf_context_focus_in
821 * @ctx: a #Ecore_IMF_Context
822 *
823 * This function will be called by Ecore IMF.
824 *
825 * Notify the Input Method Context that the widget to which its correspond has gained focus.
826 */
827EAPI void
828isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
829{
830 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
831
832 if (!context_scim)
833 return;
834
835 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__<< "(" << context_scim->id << ")...\n";
836
837 if (_focused_ic)
838 {
839 if (_focused_ic == context_scim)
840 {
841 SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n";
842 //isf_imf_context_cursor_position_set (ctx, 0);
843 return;
844 }
845 SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n";
846 if (_focused_ic->ctx)
847 isf_imf_context_focus_out (_focused_ic->ctx);
848 }
849
850 bool need_cap = false;
851 bool need_reset = false;
852 bool need_reg = false;
853
854 if (context_scim && context_scim->impl)
855 {
856 _focused_ic = context_scim;
857 _panel_client.prepare (context_scim->id);
858
859 // Handle the "Shared Input Method" mode.
860 if (_shared_input_method)
861 {
862 SCIM_DEBUG_FRONTEND(2) << "shared input method.\n";
863 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8");
864 if (!factory.null ())
865 {
866 if (_default_instance.null () || _default_instance->get_factory_uuid () != factory->get_uuid ())
867 {
868 _default_instance = factory->create_instance ("UTF-8", _default_instance.null () ? _instance_count++ : _default_instance->get_id ());
869 attach_instance (_default_instance);
870 SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n";
871 }
872
873 context_scim->impl->shared_si = true;
874 context_scim->impl->si = _default_instance;
875
876 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 ();
878 context_scim->impl->preedit_attrlist.clear ();
879 context_scim->impl->preedit_caret = 0;
880 context_scim->impl->preedit_started = false;
881 need_cap = true;
882 need_reset = true;
883 need_reg = true;
884 }
885 }
886 else if (context_scim->impl->shared_si)
887 {
888 SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n";
889 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8");
890 if (!factory.null ())
891 {
892 context_scim->impl->si = factory->create_instance ("UTF-8", _instance_count++);
893 context_scim->impl->preedit_string.clear ();
894 context_scim->impl->preedit_attrlist.clear ();
895 context_scim->impl->preedit_caret = 0;
896 context_scim->impl->preedit_started = false;
897 attach_instance (context_scim->impl->si);
898 need_cap = true;
899 need_reg = true;
900 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";
902 }
903 }
904
905 context_scim->impl->si->set_frontend_data (static_cast <void*> (context_scim));
906
907 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);
909 if (need_reset) context_scim->impl->si->reset ();
910
911 panel_req_focus_in (context_scim);
912 panel_req_update_spot_location (context_scim);
913 panel_req_update_factory_info (context_scim);
914
915 if (context_scim->impl->is_on)
916 {
917 _panel_client.turn_on (context_scim->id);
918 _panel_client.hide_preedit_string (context_scim->id);
919 _panel_client.hide_aux_string (context_scim->id);
920 _panel_client.hide_lookup_table (context_scim->id);
921 context_scim->impl->si->focus_in ();
922 }
923 else
924 {
925 _panel_client.turn_off (context_scim->id);
926 }
927
928 _panel_client.send ();
929 }
930}
931
932/**
933 * isf_imf_context_focus_out
934 * @ctx: a #Ecore_IMF_Context
935 *
936 * This function will be called by Ecore IMF.
937 *
938 * Notify the Input Method Context that the widget to which its correspond has lost focus.
939 */
940EAPI void
941isf_imf_context_focus_out (Ecore_IMF_Context *ctx)
942{
943 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
944
945 if (!context_scim) return;
946
947 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "(" << context_scim->id << ")...\n";
948
949 if (context_scim && context_scim->impl && context_scim == _focused_ic)
950 {
951 WideString wstr = context_scim->impl->preedit_string;
952
953 if (context_scim->impl->need_commit_preedit)
954 {
955 if (wstr.length ())
956 {
957 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());
959 }
960 _panel_client.prepare (context_scim->id);
961 _panel_client.send ();
962 }
963
964 _panel_client.prepare (context_scim->id);
965 context_scim->impl->si->focus_out ();
966 context_scim->impl->si->reset ();
967 _panel_client.turn_off (context_scim->id);
968 _panel_client.focus_out (context_scim->id);
969 _panel_client.send ();
970 _focused_ic = 0;
971 }
972}
973
974/**
975 * isf_imf_context_cursor_location_set
976 * @ctx: a #Ecore_IMF_Context
977 * @x: x position of New cursor.
978 * @y: y position of New cursor.
979 * @w: the width of New cursor.
980 * @h: the height of New cursor.
981 *
982 * This function will be called by Ecore IMF.
983 *
984 * Notify the Input Method Context that a change in the cursor location has been made.
985 */
986EAPI void
987isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch)
988{
989 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
990
991 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
992 Ecore_Evas *ee;
993 int canvas_x, canvas_y;
994
995 if (cw == 0 && ch == 0)
996 return;
997
998 if (context_scim && context_scim->impl && context_scim == _focused_ic)
999 {
1000 // Don't update spot location while updating preedit string.
1001 if (context_scim->impl->preedit_updating)
1002 return;
1003
1004 if (!context_scim->impl->client_canvas)
1005 return;
1006
1007 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
1008 if (!ee) return;
1009
1010 ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL);
1011
1012 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch)
1013 {
1014 context_scim->impl->cursor_x = canvas_x + cx;
1015 context_scim->impl->cursor_y = canvas_y + cy + ch;
1016 _panel_client.prepare (context_scim->id);
1017 panel_req_update_spot_location (context_scim);
1018 _panel_client.send ();
1019 SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n";
1020 }
1021 }
1022}
1023
1024/**
1025 * isf_imf_context_use_preedit_set
1026 * @ctx: a #Ecore_IMF_Context
1027 * @use_preedit: Whether the IM context should use the preedit string.
1028 *
1029 * This function will be called by Ecore IMF.
1030 *
1031 * Set whether the IM context should use the preedit string to display feedback.
1032 * If is 0 (default is 1), then the IM context may use some other method to
1033 * display feedback, such as displaying it in a child of the root window.
1034 */
1035EAPI void
1036isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit)
1037{
1038 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n";
1039
1040 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
1041
1042 if (!_on_the_spot) return;
1043
1044 if (context_scim && context_scim->impl)
1045 {
1046 bool old = context_scim->impl->use_preedit;
1047 context_scim->impl->use_preedit = use_preedit;
1048 if (context_scim == _focused_ic)
1049 {
1050 _panel_client.prepare (context_scim->id);
1051
1052 if (old != use_preedit)
1053 set_ic_capabilities (context_scim);
1054
1055 if (context_scim->impl->preedit_string.length ())
1056 slot_show_preedit_string (context_scim->impl->si);
1057
1058 _panel_client.send ();
1059 }
1060 }
1061}
1062
1063EAPI void
1064isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos)
1065{
1066 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1067
1068 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
1069
1070 if (context_scim && context_scim->impl && context_scim->impl->is_on)
1071 {
1072 String mbs = utf8_wcstombs (context_scim->impl->preedit_string);
1073
1074 if (str)
1075 {
1076 if (mbs.length ())
1077 *str = strdup (mbs.c_str ());
1078 else
1079 *str = strdup ("");
1080 }
1081
1082 if (cursor_pos)
1083 {
1084 *cursor_pos = context_scim->impl->preedit_caret;
1085 }
1086
1087 if (attrs)
1088 {
1089 if (mbs.length ())
1090 {
1091 int start_index, end_index;
1092 int wlen = context_scim->impl->preedit_string.length ();
1093
1094 Ecore_IMF_Preedit_Attr *attr = NULL;
1095 AttributeList::const_iterator i;
1096 bool *attrs_flag = new bool [mbs.length ()];
1097 memset (attrs_flag, 0, mbs.length () *sizeof (bool));
1098
1099 for (i = context_scim->impl->preedit_attrlist.begin ();
1100 i != context_scim->impl->preedit_attrlist.end (); ++i)
1101 {
1102 start_index = i->get_start ();
1103 end_index = i->get_end ();
1104
1105 if (end_index <= wlen && start_index < end_index && i->get_type () != SCIM_ATTR_DECORATE_NONE)
1106 {
1107 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 ());
1109
1110 if (i->get_type () == SCIM_ATTR_DECORATE)
1111 {
1112 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
1113 if (attr == NULL)
1114 continue;
1115 attr->start_index = start_index;
1116 attr->end_index = end_index;
1117
1118 if (i->get_value () == SCIM_ATTR_DECORATE_UNDERLINE)
1119 {
1120 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1;
1121 *attrs = eina_list_append(*attrs, (void *)attr);
1122 }
1123 else if (i->get_value () == SCIM_ATTR_DECORATE_REVERSE)
1124 {
1125 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
1126 *attrs = eina_list_append(*attrs, (void *)attr);
1127 }
1128 else if (i->get_value () == SCIM_ATTR_DECORATE_HIGHLIGHT)
1129 {
1130 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
1131 *attrs = eina_list_append(*attrs, (void *)attr);
1132 }
1133 else
1134 {
1135 free (attr);
1136 }
1137
1138 switch(i->get_value())
1139 {
1140 case SCIM_ATTR_DECORATE_UNDERLINE:
1141 case SCIM_ATTR_DECORATE_REVERSE:
1142 case SCIM_ATTR_DECORATE_HIGHLIGHT:
1143 // Record which character has attribute.
1144 for (int pos = start_index; pos < end_index; ++pos)
1145 attrs_flag [pos] = 1;
1146 break;
1147 default:
1148 break;
1149 }
1150 }
1151 else if (i->get_type () == SCIM_ATTR_FOREGROUND)
1152 {
1153 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n";
1154 }
1155 else if (i->get_type () == SCIM_ATTR_BACKGROUND)
1156 {
1157 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n";
1158 }
1159 }
1160 }
1161
1162 // Add underline for all characters which don't have attribute.
1163 for (unsigned int pos = 0; pos < mbs.length (); ++pos)
1164 {
1165 if (!attrs_flag [pos])
1166 {
1167 int begin_pos = pos;
1168
1169 while (pos < mbs.length () && !attrs_flag [pos])
1170 ++pos;
1171
1172 // use REVERSE style as default
1173 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
1174 if (attr == NULL)
1175 continue;
1176 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
1177 attr->start_index = begin_pos;
1178 attr->end_index = pos;
1179 *attrs = eina_list_append(*attrs, (void *)attr);
1180 }
1181 }
1182
1183 delete [] attrs_flag;
1184 }
1185 }
1186 }
1187 else
1188 {
1189 if (str)
1190 *str = strdup ("");
1191
1192 if (cursor_pos)
1193 *cursor_pos = 0;
1194
1195 if (attrs)
1196 *attrs = NULL;
1197 }
1198}
1199
1200/**
1201 * isf_imf_context_preedit_string_get
1202 * @ctx: a #Ecore_IMF_Context
1203 * @str: the preedit string
1204 * @cursor_pos: the cursor position
1205 *
1206 * This function will be called by Ecore IMF.
1207 *
1208 * To get the preedit string of the input method.
1209 */
1210EAPI void
1211isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos)
1212{
1213 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1214
1215 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
1216
1217 if (context_scim && context_scim->impl && context_scim->impl->is_on)
1218 {
1219 String mbs = utf8_wcstombs (context_scim->impl->preedit_string);
1220
1221 if (str)
1222 {
1223 if (mbs.length ())
1224 *str = strdup (mbs.c_str ());
1225 else
1226 *str = strdup ("");
1227 }
1228
1229 if (cursor_pos)
1230 *cursor_pos = context_scim->impl->preedit_caret;
1231 }
1232 else
1233 {
1234 if (str)
1235 *str = strdup ("");
1236
1237 if (cursor_pos)
1238 *cursor_pos = 0;
1239 }
1240}
1241
1242/**
1243 * isf_imf_context_cursor_position_set
1244 * @ctx: a #Ecore_IMF_Context
1245 * @cursor_pos: New cursor position in characters.
1246 *
1247 * This function will be called by Ecore IMF.
1248 *
1249 * Notify the Input Method Context that a change in the cursor position has been made.
1250 */
1251EAPI void
1252isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos)
1253{
1254 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1255
1256 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
1257
1258 if (context_scim && context_scim->impl && context_scim == _focused_ic)
1259 {
1260 // Don't update spot location while updating preedit string.
1261 if (context_scim->impl->preedit_updating)
1262 return;
1263
1264 if (context_scim->impl->cursor_pos != cursor_pos)
1265 {
1266 context_scim->impl->cursor_pos = cursor_pos;
1267 caps_mode_check(ctx, EINA_FALSE);
1268 }
1269 }
1270}
1271
1272/**
1273 * isf_imf_context_input_mode_set
1274 * @ctx: a #Ecore_IMF_Context
1275 * @input_mode: the input mode
1276 *
1277 * This function will be called by Ecore IMF.
1278 *
1279 * To set the input mode of input method. The definition of Ecore_IMF_Input_Mode
1280 * is in Ecore_IMF.h.
1281 */
1282EAPI void
1283isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
1284{
1285 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1286
1287 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
1288 if (context_scim && context_scim->impl)
1289 context_scim->impl->input_mode = input_mode;
1290}
1291
1292/**
1293 * isf_imf_context_prediction_allow_set
1294 * @ctx: a #Ecore_IMF_Context
1295 * @use_prediction: Whether the IM context should use the prediction.
1296 *
1297 * This function will be called by Ecore IMF.
1298 *
1299 * Set whether the IM context should use the prediction.
1300 */
1301EAPI void
1302isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction)
1303{
1304 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n";
1305
1306 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
1307
1308 if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction)
1309 context_scim->impl->prediction_allow = prediction;
1310}
1311
1312EAPI void
1313isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type)
1314{
1315 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n";
1316
1317 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx);
1318
1319 if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type)
1320 context_scim->impl->autocapital_type = autocapital_type;
1321}
1322
1323/**
1324 * isf_imf_context_filter_event
1325 * @ctx: a #Ecore_IMF_Context
1326 * @type: The type of event defined by Ecore_IMF_Event_Type.
1327 * @event: The event itself.
1328 * Return value: %TRUE if the input method handled the key event.
1329 *
1330 * This function will be called by Ecore IMF.
1331 *
1332 * Allow an Ecore Input Context to internally handle an event. If this function
1333 * returns 1, then no further processing should be done for this event. Input
1334 * methods must be able to accept all types of events (simply returning 0 if
1335 * the event was not handled), but there is no obligation of any events to be
1336 * submitted to this function.
1337 */
1338
1339EAPI Eina_Bool
1340isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
1341{
1342 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1343
1344 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx);
1345 Eina_Bool ret = EINA_FALSE;
1346
1347 if (ic == NULL || ic->impl == NULL)
1348 return ret;
1349
1350 KeyEvent key;
1351
1352 if (type == ECORE_IMF_EVENT_KEY_DOWN)
1353 {
1354 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
1355 scim_string_to_key (key, ev->key);
1356 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;
1358 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
1359 if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_CAPS) key.mask |=SCIM_KEY_CapsLockMask;
1360 if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_NUM) key.mask |=SCIM_KEY_NumLockMask;
1361 }
1362 else if (type == ECORE_IMF_EVENT_KEY_UP)
1363 {
1364 Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event;
1365 scim_string_to_key (key, ev->key);
1366 key.mask = SCIM_KEY_ReleaseMask;
1367 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;
1369 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
1370 if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_CAPS) key.mask |=SCIM_KEY_CapsLockMask;
1371 if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_NUM) key.mask |=SCIM_KEY_NumLockMask;
1372 }
1373 else
1374 {
1375 return ret;
1376 }
1377
1378 key.mask &= _valid_key_mask;
1379
1380 _panel_client.prepare (ic->id);
1381
1382 ret = EINA_TRUE;
1383 if (!filter_hotkeys (ic, key))
1384 {
1385 if (!_focused_ic || !_focused_ic->impl->is_on ||
1386 !_focused_ic->impl->si->process_key_event (key))
1387 ret = EINA_FALSE;
1388 }
1389
1390 _panel_client.send ();
1391
1392 return ret;
1393}
1394
1395/* Panel Slot functions */
1396static void
1397panel_slot_reload_config (int context __UNUSED__)
1398{
1399 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1400 _config->reload ();
1401}
1402
1403static void
1404panel_slot_exit (int /* context */)
1405{
1406 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1407
1408 finalize ();
1409}
1410
1411static void
1412panel_slot_update_lookup_table_page_size (int context, int page_size)
1413{
1414 EcoreIMFContextISF *ic = find_ic (context);
1415 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n";
1416 if (ic && ic->impl)
1417 {
1418 _panel_client.prepare (ic->id);
1419 ic->impl->si->update_lookup_table_page_size (page_size);
1420 _panel_client.send ();
1421 }
1422}
1423
1424static void
1425panel_slot_lookup_table_page_up (int context)
1426{
1427 EcoreIMFContextISF *ic = find_ic (context);
1428 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1429 if (ic && ic->impl)
1430 {
1431 _panel_client.prepare (ic->id);
1432 ic->impl->si->lookup_table_page_up ();
1433 _panel_client.send ();
1434 }
1435}
1436
1437static void
1438panel_slot_lookup_table_page_down (int context)
1439{
1440 EcoreIMFContextISF *ic = find_ic (context);
1441 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1442 if (ic && ic->impl)
1443 {
1444 _panel_client.prepare (ic->id);
1445 ic->impl->si->lookup_table_page_down ();
1446 _panel_client.send ();
1447 }
1448}
1449
1450static void
1451panel_slot_trigger_property (int context, const String &property)
1452{
1453 EcoreIMFContextISF *ic = find_ic (context);
1454 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n";
1455 if (ic && ic->impl)
1456 {
1457 _panel_client.prepare (ic->id);
1458 ic->impl->si->trigger_property (property);
1459 _panel_client.send ();
1460 }
1461}
1462
1463static void
1464panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans)
1465{
1466 EcoreIMFContextISF *ic = find_ic (context);
1467 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid
1468 << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid="
1469 << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid () : "" ) << "\n";
1470 if (ic && ic->impl && ic->impl->si->get_factory_uuid () == target_uuid)
1471 {
1472 _panel_client.prepare (ic->id);
1473 SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n";
1474 ic->impl->si->process_helper_event (helper_uuid, trans);
1475 _panel_client.send ();
1476 }
1477}
1478
1479static void
1480panel_slot_move_preedit_caret (int context, int caret_pos)
1481{
1482 EcoreIMFContextISF *ic = find_ic (context);
1483 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n";
1484 if (ic && ic->impl)
1485 {
1486 _panel_client.prepare (ic->id);
1487 ic->impl->si->move_preedit_caret (caret_pos);
1488 _panel_client.send ();
1489 }
1490}
1491
1492static void
1493panel_slot_select_candidate (int context, int cand_index)
1494{
1495 EcoreIMFContextISF *ic = find_ic (context);
1496 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n";
1497 if (ic && ic->impl)
1498 {
1499 _panel_client.prepare (ic->id);
1500 ic->impl->si->select_candidate (cand_index);
1501 _panel_client.send ();
1502 }
1503}
1504
1505static void
1506panel_slot_process_key_event (int context, const KeyEvent &key)
1507{
1508 EcoreIMFContextISF *ic = find_ic (context);
1509 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
1510
1511 if (ic && ic->impl && ic->impl->client_canvas)
1512 feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE);
1513}
1514
1515static void
1516panel_slot_commit_string (int context, const WideString &wstr)
1517{
1518 EcoreIMFContextISF *ic = find_ic (context);
1519 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n";
1520
1521 if (ic && ic->impl)
1522 {
1523 if (_focused_ic != ic)
1524 return;
1525
1526 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());
1528 }
1529}
1530
1531static void
1532panel_slot_forward_key_event (int context, const KeyEvent &key)
1533{
1534 EcoreIMFContextISF *ic = find_ic (context);
1535 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
1536
1537 if (ic && ic->impl && ic->impl->client_canvas)
1538 feed_key_event (ic->impl->client_canvas, key.get_key_string ().c_str (), EINA_TRUE);
1539}
1540
1541static void
1542panel_slot_request_help (int context)
1543{
1544 EcoreIMFContextISF *ic = find_ic (context);
1545 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1546
1547 if (ic && ic->impl)
1548 {
1549 _panel_client.prepare (ic->id);
1550 panel_req_show_help (ic);
1551 _panel_client.send ();
1552 }
1553}
1554
1555static void
1556panel_slot_request_factory_menu (int context)
1557{
1558 EcoreIMFContextISF *ic = find_ic (context);
1559 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1560
1561 if (ic && ic->impl)
1562 {
1563 _panel_client.prepare (ic->id);
1564 panel_req_show_factory_menu (ic);
1565 _panel_client.send ();
1566 }
1567}
1568
1569static void
1570panel_slot_change_factory (int context, const String &uuid)
1571{
1572 EcoreIMFContextISF *ic = find_ic (context);
1573 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n";
1574
1575 if (ic && ic->impl)
1576 {
1577 ic->impl->si->reset ();
1578 _panel_client.prepare (ic->id);
1579 open_specific_factory (ic, uuid);
1580 _panel_client.send ();
1581 }
1582}
1583
1584/* Panel Requestion functions. */
1585static void
1586panel_req_show_help (EcoreIMFContextISF *ic)
1587{
1588 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1589
1590 String help;
1591
1592 help = String ("Smart Common Input Method platform ") +
1593 //String (SCIM_VERSION) +
1594 String ("\n(C) 2002-2005 James Su <suzhe@tsinghua.org.cn>\n\n");
1595
1596 if (ic && ic->impl)
1597 {
1598 IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ());
1599 if (sf)
1600 {
1601 help += utf8_wcstombs (sf->get_name ());
1602 help += String (":\n\n");
1603
1604 help += utf8_wcstombs (sf->get_help ());
1605 help += String ("\n\n");
1606
1607 help += utf8_wcstombs (sf->get_credits ());
1608 }
1609 _panel_client.show_help (ic->id, help);
1610 }
1611}
1612
1613static void
1614panel_req_show_factory_menu (EcoreIMFContextISF *ic)
1615{
1616 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1617
1618 std::vector<IMEngineFactoryPointer> factories;
1619 std::vector <PanelFactoryInfo> menu;
1620
1621 _backend->get_factories_for_encoding (factories, "UTF-8");
1622
1623 for (size_t i = 0; i < factories.size (); ++ i)
1624 {
1625 menu.push_back (PanelFactoryInfo (
1626 factories [i]->get_uuid (),
1627 utf8_wcstombs (factories [i]->get_name ()),
1628 factories [i]->get_language (),
1629 factories [i]->get_icon_file ()));
1630 }
1631
1632 if (menu.size ())
1633 _panel_client.show_factory_menu (ic->id, menu);
1634}
1635
1636static void
1637panel_req_update_factory_info (EcoreIMFContextISF *ic)
1638{
1639 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1640
1641 if (ic && ic->impl && ic == _focused_ic)
1642 {
1643 PanelFactoryInfo info;
1644 if (ic->impl->is_on)
1645 {
1646 IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ());
1647 if (sf)
1648 info = PanelFactoryInfo (sf->get_uuid (), utf8_wcstombs (sf->get_name ()), sf->get_language (), sf->get_icon_file ());
1649 }
1650 else
1651 {
1652 info = PanelFactoryInfo (String (""), String ("English/Keyboard"), String ("C"), "");
1653 }
1654 _panel_client.update_factory_info (ic->id, info);
1655 }
1656}
1657
1658static void
1659panel_req_focus_in (EcoreIMFContextISF *ic)
1660{
1661 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1662
1663 _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ());
1664}
1665
1666static void
1667panel_req_update_spot_location (EcoreIMFContextISF *ic)
1668{
1669 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1670
1671 _panel_client.update_spot_location (ic->id, ic->impl->cursor_x, ic->impl->cursor_y);
1672}
1673
1674static bool
1675filter_hotkeys (EcoreIMFContextISF *ic, const KeyEvent &key)
1676{
1677 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1678
1679 bool ret = false;
1680
1681 _frontend_hotkey_matcher.push_key_event (key);
1682 _imengine_hotkey_matcher.push_key_event (key);
1683
1684 FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result ();
1685
1686 if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER)
1687 {
1688 if (!ic->impl->is_on)
1689 turn_on_ic (ic);
1690 else
1691 turn_off_ic (ic);
1692 ret = true;
1693 }
1694 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON)
1695 {
1696 if (!ic->impl->is_on)
1697 turn_on_ic (ic);
1698 ret = true;
1699 }
1700 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF)
1701 {
1702 if (ic->impl->is_on)
1703 turn_off_ic (ic);
1704 ret = true;
1705 }
1706 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY)
1707 {
1708 open_next_factory (ic);
1709 ret = true;
1710 }
1711 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY)
1712 {
1713 open_previous_factory (ic);
1714 ret = true;
1715 }
1716 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU)
1717 {
1718 panel_req_show_factory_menu (ic);
1719 ret = true;
1720 }
1721 else if (_imengine_hotkey_matcher.is_matched ())
1722 {
1723 String sfid = _imengine_hotkey_matcher.get_match_result ();
1724 open_specific_factory (ic, sfid);
1725 ret = true;
1726 }
1727 return ret;
1728}
1729
1730static bool
1731panel_initialize (void)
1732{
1733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1734
1735 String display_name;
1736 {
1737 const char *p = getenv ("DISPLAY");
1738 if (p) display_name = String (p);
1739 }
1740
1741 if (_panel_client.open_connection (_config->get_name (), display_name) >= 0)
1742 {
1743 int fd = _panel_client.get_connection_number ();
1744
1745 _panel_iochannel_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL);
1746
1747 SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n";
1748
1749 return true;
1750 }
1751 std::cerr << "panel_initialize () failed!!!\n";
1752 return false;
1753}
1754
1755static void
1756panel_finalize (void)
1757{
1758 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1759
1760 _panel_client.close_connection ();
1761
1762 if (_panel_iochannel_read_handler)
1763 {
1764 ecore_main_fd_handler_del (_panel_iochannel_read_handler);
1765 _panel_iochannel_read_handler = 0;
1766 }
1767
1768 if (_panel_iochannel_err_handler)
1769 {
1770 ecore_main_fd_handler_del (_panel_iochannel_err_handler);
1771 _panel_iochannel_err_handler = 0;
1772 }
1773}
1774
1775static Eina_Bool
1776panel_iochannel_handler (void *data __UNUSED__, Ecore_Fd_Handler *fd_handler)
1777{
1778 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1779
1780 if (fd_handler == _panel_iochannel_read_handler)
1781 {
1782 if (!_panel_client.filter_event ())
1783 {
1784 panel_finalize ();
1785 panel_initialize ();
1786 return ECORE_CALLBACK_CANCEL;
1787 }
1788 }
1789 else if (fd_handler == _panel_iochannel_err_handler)
1790 {
1791 panel_finalize ();
1792 panel_initialize ();
1793 return ECORE_CALLBACK_CANCEL;
1794 }
1795 return ECORE_CALLBACK_RENEW;
1796}
1797
1798static void
1799turn_on_ic (EcoreIMFContextISF *ic)
1800{
1801 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1802
1803 if (ic && ic->impl && !ic->impl->is_on)
1804 {
1805 ic->impl->is_on = true;
1806
1807 if (ic == _focused_ic)
1808 {
1809 panel_req_focus_in (ic);
1810 panel_req_update_spot_location (ic);
1811 panel_req_update_factory_info (ic);
1812 _panel_client.turn_on (ic->id);
1813 _panel_client.hide_preedit_string (ic->id);
1814 _panel_client.hide_aux_string (ic->id);
1815 _panel_client.hide_lookup_table (ic->id);
1816 ic->impl->si->focus_in ();
1817 }
1818
1819 //Record the IC on/off status
1820 if (_shared_input_method)
1821 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true);
1822
1823 if (ic->impl->use_preedit && ic->impl->preedit_string.length ())
1824 {
1825 ecore_imf_context_preedit_start_event_add (ic->ctx);
1826 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
1827 ecore_imf_context_preedit_changed_event_add (ic->ctx);
1828 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1829 ic->impl->preedit_started = true;
1830 }
1831 }
1832}
1833
1834static void
1835turn_off_ic (EcoreIMFContextISF *ic)
1836{
1837 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1838
1839 if (ic && ic->impl && ic->impl->is_on)
1840 {
1841 ic->impl->is_on = false;
1842
1843 if (ic == _focused_ic)
1844 {
1845 ic->impl->si->focus_out ();
1846
1847 panel_req_update_factory_info (ic);
1848 _panel_client.turn_off (ic->id);
1849 }
1850
1851 //Record the IC on/off status
1852 if (_shared_input_method)
1853 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
1854
1855 if (ic->impl->use_preedit && ic->impl->preedit_string.length ())
1856 {
1857 ecore_imf_context_preedit_changed_event_add (ic->ctx);
1858 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1859 ecore_imf_context_preedit_end_event_add (ic->ctx);
1860 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
1861 ic->impl->preedit_started = false;
1862 }
1863 }
1864}
1865
1866static void
1867set_ic_capabilities (EcoreIMFContextISF *ic)
1868{
1869 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1870
1871 if (ic && ic->impl)
1872 {
1873 unsigned int cap = SCIM_CLIENT_CAP_ALL_CAPABILITIES;
1874
1875 if (!_on_the_spot || !ic->impl->use_preedit)
1876 cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT;
1877
1878 ic->impl->si->update_client_capabilities (cap);
1879 }
1880}
1881
1882static bool
1883check_socket_frontend (void)
1884{
1885 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1886
1887 SocketAddress address;
1888 SocketClient client;
1889
1890 uint32 magic;
1891
1892 address.set_address (scim_get_default_socket_frontend_address ());
1893
1894 if (!client.connect (address))
1895 return false;
1896
1897 if (!scim_socket_open_connection (magic,
1898 String ("ConnectionTester"),
1899 String ("SocketFrontEnd"),
1900 client,
1901 1000))
1902 return false;
1903
1904 return true;
1905}
1906
1907void
1908initialize (void)
1909{
1910 std::vector<String> config_list;
1911 std::vector<String> engine_list;
1912 std::vector<String> load_engine_list;
1913
1914 std::vector<String>::iterator it;
1915
1916 bool manual = false;
1917
1918 bool socket = true;
1919
1920 String config_module_name = "simple";
1921
1922 printf("Initializing Ecore SCIM IMModule...\n");
1923
1924 SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n";
1925
1926 // Get system language.
1927 _language = scim_get_locale_language (scim_get_current_locale ());
1928
1929 if (socket)
1930 {
1931 // If no Socket FrontEnd is running, then launch one.
1932 // And set manual to false.
1933 bool check_result = check_socket_frontend ();
1934 if (!check_result)
1935 {
1936 std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n";
1937 //get modules list
1938 scim_get_imengine_module_list (engine_list);
1939
1940 for (it = engine_list.begin (); it != engine_list.end (); it++)
1941 {
1942 if (*it != "socket")
1943 load_engine_list.push_back (*it);
1944 }
1945
1946 const char *new_argv [] = { "--no-stay", 0 };
1947 scim_launch (true,
1948 config_module_name,
1949 (load_engine_list.size () ? scim_combine_string_list (load_engine_list, ',') : "none"),
1950 "socket",
1951 (char **)new_argv);
1952 manual = false;
1953 }
1954
1955 // If there is one Socket FrontEnd running and it's not manual mode,
1956 // then just use this Socket Frontend.
1957 if (!manual)
1958 {
1959 for (int i = 0; i < 200; ++i)
1960 {
1961 if (check_result)
1962 {
1963 config_module_name = "socket";
1964 load_engine_list.clear ();
1965 load_engine_list.push_back ("socket");
1966 break;
1967 }
1968 scim_usleep (50000);
1969 check_result = check_socket_frontend ();
1970 }
1971 }
1972 }
1973
1974 if (config_module_name != "dummy")
1975 {
1976 //load config module
1977 SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n";
1978 _config_module = new ConfigModule (config_module_name);
1979
1980 //create config instance
1981 if (_config_module != NULL && _config_module->valid ())
1982 _config = _config_module->create_config ();
1983 }
1984
1985 if (_config.null ())
1986 {
1987 SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n";
1988
1989 if (_config_module) delete _config_module;
1990 _config_module = NULL;
1991
1992 _config = new DummyConfig ();
1993 config_module_name = "dummy";
1994 }
1995
1996 reload_config_callback (_config);
1997 _config->signal_connect_reload (slot (reload_config_callback));
1998
1999 // create backend
2000 _backend = new CommonBackEnd (_config, load_engine_list.size () ? load_engine_list : engine_list);
2001
2002 if (_backend.null ())
2003 std::cerr << "Cannot create BackEnd Object!\n";
2004 else
2005 _fallback_factory = _backend->get_factory (SCIM_COMPOSE_KEY_FACTORY_UUID);
2006
2007 if (_fallback_factory.null ())
2008 _fallback_factory = new DummyIMEngineFactory ();
2009
2010 _fallback_instance = _fallback_factory->create_instance (String ("UTF-8"), 0);
2011 _fallback_instance->signal_connect_commit_string (slot (fallback_commit_string_cb));
2012
2013 // Attach Panel Client signal.
2014 _panel_client.signal_connect_reload_config (slot (panel_slot_reload_config));
2015 _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));
2017 _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));
2019 _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));
2021 _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));
2023 _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));
2025 _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));
2027 _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));
2029
2030 if (!panel_initialize ())
2031 std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
2032}
2033
2034static void
2035finalize (void)
2036{
2037 SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n";
2038
2039 // Reset this first so that the shared instance could be released correctly afterwards.
2040 _default_instance.reset ();
2041
2042 SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n";
2043 while (_used_ic_impl_list)
2044 {
2045 // In case in "shared input method" mode,
2046 // all contexts share only one instance,
2047 // 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));
2049 isf_imf_context_del (_used_ic_impl_list->parent->ctx);
2050 }
2051
2052 delete_all_ic_impl ();
2053
2054 _fallback_instance.reset ();
2055 _fallback_factory.reset ();
2056
2057 SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n";
2058 _backend.reset ();
2059
2060 SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n";
2061 _config.reset ();
2062
2063 if (_config_module)
2064 {
2065 SCIM_DEBUG_FRONTEND(2) << " Deleting _config_module...\n";
2066 delete _config_module;
2067 _config_module = 0;
2068 }
2069
2070 _focused_ic = NULL;
2071 _ic_list = NULL;
2072
2073 _scim_initialized = false;
2074
2075 panel_finalize ();
2076}
2077
2078static void
2079open_next_factory (EcoreIMFContextISF *ic)
2080{
2081 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2082 IMEngineFactoryPointer sf = _backend->get_next_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ());
2083
2084 if (!sf.null ())
2085 {
2086 turn_off_ic (ic);
2087 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ());
2088 ic->impl->si->set_frontend_data (static_cast <void*> (ic));
2089 ic->impl->preedit_string = WideString ();
2090 ic->impl->preedit_caret = 0;
2091 attach_instance (ic->impl->si);
2092 _backend->set_default_factory (_language, sf->get_uuid ());
2093 _panel_client.register_input_context (ic->id, sf->get_uuid ());
2094 set_ic_capabilities (ic);
2095 turn_on_ic (ic);
2096
2097 if (_shared_input_method)
2098 {
2099 _default_instance = ic->impl->si;
2100 ic->impl->shared_si = true;
2101 }
2102 }
2103}
2104
2105static void
2106open_previous_factory (EcoreIMFContextISF *ic)
2107{
2108 if (ic == NULL)
2109 return;
2110
2111 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2112 IMEngineFactoryPointer sf = _backend->get_previous_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ());
2113
2114 if (!sf.null ())
2115 {
2116 turn_off_ic (ic);
2117 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ());
2118 ic->impl->si->set_frontend_data (static_cast <void*> (ic));
2119 ic->impl->preedit_string = WideString ();
2120 ic->impl->preedit_caret = 0;
2121 attach_instance (ic->impl->si);
2122 _backend->set_default_factory (_language, sf->get_uuid ());
2123 _panel_client.register_input_context (ic->id, sf->get_uuid ());
2124 set_ic_capabilities (ic);
2125 turn_on_ic (ic);
2126
2127 if (_shared_input_method)
2128 {
2129 _default_instance = ic->impl->si;
2130 ic->impl->shared_si = true;
2131 }
2132 }
2133}
2134
2135static void
2136open_specific_factory (EcoreIMFContextISF *ic,
2137 const String &uuid)
2138{
2139 if (ic == NULL)
2140 return;
2141
2142 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2143
2144 // The same input method is selected, just turn on the IC.
2145 if (ic->impl->si->get_factory_uuid () == uuid)
2146 {
2147 turn_on_ic (ic);
2148 return;
2149 }
2150
2151 IMEngineFactoryPointer sf = _backend->get_factory (uuid);
2152
2153 if (uuid.length () && !sf.null ())
2154 {
2155 turn_off_ic (ic);
2156 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ());
2157 ic->impl->si->set_frontend_data (static_cast <void*> (ic));
2158 ic->impl->preedit_string = WideString ();
2159 ic->impl->preedit_caret = 0;
2160 attach_instance (ic->impl->si);
2161 _backend->set_default_factory (_language, sf->get_uuid ());
2162 _panel_client.register_input_context (ic->id, sf->get_uuid ());
2163 set_ic_capabilities (ic);
2164 turn_on_ic (ic);
2165
2166 if (_shared_input_method)
2167 {
2168 _default_instance = ic->impl->si;
2169 ic->impl->shared_si = true;
2170 }
2171 }
2172 else
2173 {
2174 // turn_off_ic comment out panel_req_update_factory_info ()
2175 turn_off_ic (ic);
2176 if (ic && ic->impl->is_on)
2177 {
2178 ic->impl->is_on = false;
2179
2180 if (ic == _focused_ic)
2181 {
2182 ic->impl->si->focus_out ();
2183
2184 panel_req_update_factory_info (ic);
2185 _panel_client.turn_off (ic->id);
2186 }
2187
2188 //Record the IC on/off status
2189 if (_shared_input_method)
2190 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
2191
2192 if (ic->impl->use_preedit && ic->impl->preedit_string.length ())
2193 {
2194 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2195 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2196 ecore_imf_context_preedit_end_event_add (ic->ctx);
2197 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2198 ic->impl->preedit_started = false;
2199 }
2200 }
2201 }
2202}
2203
2204static void initialize_modifier_bits (Display *display)
2205{
2206 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2207
2208 if (__current_display == display)
2209 return;
2210
2211 __current_display = display;
2212
2213 if (display == 0)
2214 {
2215 __current_alt_mask = Mod1Mask;
2216 __current_meta_mask = ShiftMask | Mod1Mask;
2217 __current_super_mask = 0;
2218 __current_hyper_mask = 0;
2219 __current_numlock_mask = Mod2Mask;
2220 return;
2221 }
2222
2223 XModifierKeymap *mods = NULL;
2224
2225 ::KeyCode ctrl_l = XKeysymToKeycode (display, XK_Control_L);
2226 ::KeyCode ctrl_r = XKeysymToKeycode (display, XK_Control_R);
2227 ::KeyCode meta_l = XKeysymToKeycode (display, XK_Meta_L);
2228 ::KeyCode meta_r = XKeysymToKeycode (display, XK_Meta_R);
2229 ::KeyCode alt_l = XKeysymToKeycode (display, XK_Alt_L);
2230 ::KeyCode alt_r = XKeysymToKeycode (display, XK_Alt_R);
2231 ::KeyCode super_l = XKeysymToKeycode (display, XK_Super_L);
2232 ::KeyCode super_r = XKeysymToKeycode (display, XK_Super_R);
2233 ::KeyCode hyper_l = XKeysymToKeycode (display, XK_Hyper_L);
2234 ::KeyCode hyper_r = XKeysymToKeycode (display, XK_Hyper_R);
2235 ::KeyCode numlock = XKeysymToKeycode (display, XK_Num_Lock);
2236
2237 int i, j;
2238
2239 mods = XGetModifierMapping (display);
2240 if (mods == NULL)
2241 return;
2242
2243 __current_alt_mask = 0;
2244 __current_meta_mask = 0;
2245 __current_super_mask = 0;
2246 __current_hyper_mask = 0;
2247 __current_numlock_mask = 0;
2248
2249 /* We skip the first three sets for Shift, Lock, and Control. The
2250 remaining sets are for Mod1, Mod2, Mod3, Mod4, and Mod5. */
2251 for (i = 3; i < 8; i++)
2252 {
2253 for (j = 0; j < mods->max_keypermod; j++)
2254 {
2255 ::KeyCode code = mods->modifiermap [i * mods->max_keypermod + j];
2256 if (! code) continue;
2257 if (code == alt_l || code == alt_r)
2258 __current_alt_mask |= (1 << i);
2259 else if (code == meta_l || code == meta_r)
2260 __current_meta_mask |= (1 << i);
2261 else if (code == super_l || code == super_r)
2262 __current_super_mask |= (1 << i);
2263 else if (code == hyper_l || code == hyper_r)
2264 __current_hyper_mask |= (1 << i);
2265 else if (code == numlock)
2266 __current_numlock_mask |= (1 << i);
2267 }
2268 }
2269
2270 /* Check whether there is a combine keys mapped to Meta */
2271 if (__current_meta_mask == 0)
2272 {
2273 char buf [32];
2274 XKeyEvent xkey;
2275 KeySym keysym_l, keysym_r;
2276
2277 xkey.type = KeyPress;
2278 xkey.display = display;
2279 xkey.serial = 0L;
2280 xkey.send_event = False;
2281 xkey.x = xkey.y = xkey.x_root = xkey.y_root = 0;
2282 xkey.time = 0;
2283 xkey.same_screen = False;
2284 xkey.subwindow = None;
2285 xkey.window = None;
2286 xkey.root = DefaultRootWindow (display);
2287 xkey.state = ShiftMask;
2288
2289 xkey.keycode = meta_l;
2290 XLookupString (&xkey, buf, 32, &keysym_l, 0);
2291 xkey.keycode = meta_r;
2292 XLookupString (&xkey, buf, 32, &keysym_r, 0);
2293
2294 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;
2296 else if ((meta_l == ctrl_l && keysym_l == XK_Meta_L) || (meta_r == ctrl_r && keysym_r == XK_Meta_R))
2297 __current_meta_mask = ShiftMask + ControlMask;
2298 }
2299
2300 XFreeModifiermap (mods);
2301}
2302
2303static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask)
2304{
2305 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2306
2307 unsigned int state = 0;
2308
2309 initialize_modifier_bits (display);
2310
2311 if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask;
2312 if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask;
2313 if (scimkeymask & SCIM_KEY_ControlMask) state |= ControlMask;
2314 if (scimkeymask & SCIM_KEY_AltMask) state |= __current_alt_mask;
2315 if (scimkeymask & SCIM_KEY_MetaMask) state |= __current_meta_mask;
2316 if (scimkeymask & SCIM_KEY_SuperMask) state |= __current_super_mask;
2317 if (scimkeymask & SCIM_KEY_HyperMask) state |= __current_hyper_mask;
2318 if (scimkeymask & SCIM_KEY_NumLockMask) state |= __current_numlock_mask;
2319
2320 return state;
2321}
2322
2323static XKeyEvent createKeyEvent (Display *display, Window &win,
2324 Window &winRoot, bool press,
2325 int keycode, int modifiers)
2326{
2327 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2328
2329 XKeyEvent event;
2330
2331 event.display = display;
2332 event.window = win;
2333 event.root = winRoot;
2334 event.subwindow = None;
2335 event.time = CurrentTime;
2336 event.x = 1;
2337 event.y = 1;
2338 event.x_root = 1;
2339 event.y_root = 1;
2340 event.same_screen = EINA_TRUE;
2341 event.state = modifiers;
2342 event.keycode = XKeysymToKeycode (display, keycode);
2343 if (press)
2344 event.type = KeyPress;
2345 else
2346 event.type = KeyRelease;
2347 event.send_event = EINA_FALSE;
2348 event.serial = 0;
2349
2350 return event;
2351}
2352
2353static void _x_send_key_event (const KeyEvent &key)
2354{
2355 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2356
2357 // Obtain the X11 display.
2358 Display *display = XOpenDisplay (NULL);
2359 if (display == NULL)
2360 {
2361 std::cerr << "XOpenDisplay failed\n";
2362 return;
2363 }
2364
2365 // Get the root window for the current display.
2366 Window winRoot = 0;// = XRootWindow (display, 1);
2367
2368 // Find the window which has the current keyboard focus.
2369 Window winFocus = 0;
2370 int revert = RevertToParent;
2371
2372 XGetInputFocus (display, &winFocus, &revert);
2373
2374 // Send a fake key press event to the window.
2375 XSelectInput (display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask);
2376 XMapWindow (display, winFocus);
2377
2378 unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask);
2379 XKeyEvent event;
2380 if (key.is_key_press ())
2381 {
2382 event = createKeyEvent (display, winFocus, winRoot, true, key.code, modifier);
2383 XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event);
2384 }
2385 else
2386 {
2387 event = createKeyEvent (display, winFocus, winRoot, false, key.code, modifier);
2388 XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
2389 }
2390
2391 XCloseDisplay (display);
2392}
2393
2394static void
2395attach_instance (const IMEngineInstancePointer &si)
2396{
2397 si->signal_connect_show_preedit_string (
2398 slot (slot_show_preedit_string));
2399 si->signal_connect_show_aux_string (
2400 slot (slot_show_aux_string));
2401 si->signal_connect_show_lookup_table (
2402 slot (slot_show_lookup_table));
2403
2404 si->signal_connect_hide_preedit_string (
2405 slot (slot_hide_preedit_string));
2406 si->signal_connect_hide_aux_string (
2407 slot (slot_hide_aux_string));
2408 si->signal_connect_hide_lookup_table (
2409 slot (slot_hide_lookup_table));
2410
2411 si->signal_connect_update_preedit_caret (
2412 slot (slot_update_preedit_caret));
2413 si->signal_connect_update_preedit_string (
2414 slot (slot_update_preedit_string));
2415 si->signal_connect_update_aux_string (
2416 slot (slot_update_aux_string));
2417 si->signal_connect_update_lookup_table (
2418 slot (slot_update_lookup_table));
2419
2420 si->signal_connect_commit_string (
2421 slot (slot_commit_string));
2422
2423 si->signal_connect_forward_key_event (
2424 slot (slot_forward_key_event));
2425
2426 si->signal_connect_register_properties (
2427 slot (slot_register_properties));
2428
2429 si->signal_connect_update_property (
2430 slot (slot_update_property));
2431
2432 si->signal_connect_beep (
2433 slot (slot_beep));
2434
2435 si->signal_connect_start_helper (
2436 slot (slot_start_helper));
2437
2438 si->signal_connect_stop_helper (
2439 slot (slot_stop_helper));
2440
2441 si->signal_connect_send_helper_event (
2442 slot (slot_send_helper_event));
2443
2444 si->signal_connect_get_surrounding_text (
2445 slot (slot_get_surrounding_text));
2446
2447 si->signal_connect_delete_surrounding_text (
2448 slot (slot_delete_surrounding_text));
2449}
2450
2451// Implementation of slot functions
2452static void
2453slot_show_preedit_string (IMEngineInstanceBase *si)
2454{
2455 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2456
2457 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2458
2459 if (ic && ic->impl && _focused_ic == ic)
2460 {
2461 if (ic->impl->use_preedit)
2462 {
2463 if (!ic->impl->preedit_started)
2464 {
2465 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);
2467 ic->impl->preedit_started = true;
2468 }
2469 }
2470 else
2471 _panel_client.show_preedit_string (ic->id);
2472 }
2473}
2474
2475static void
2476slot_show_aux_string (IMEngineInstanceBase *si)
2477{
2478 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2479
2480 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2481
2482 if (ic && ic->impl && _focused_ic == ic)
2483 _panel_client.show_aux_string (ic->id);
2484}
2485
2486static void
2487slot_show_lookup_table (IMEngineInstanceBase *si)
2488{
2489 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2490
2491 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2492
2493 if (ic && ic->impl && _focused_ic == ic)
2494 _panel_client.show_lookup_table (ic->id);
2495}
2496
2497static void
2498slot_hide_preedit_string (IMEngineInstanceBase *si)
2499{
2500 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2501
2502 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2503
2504 if (ic && ic->impl && _focused_ic == ic)
2505 {
2506 bool emit = false;
2507 if (ic->impl->preedit_string.length ())
2508 {
2509 ic->impl->preedit_string = WideString ();
2510 ic->impl->preedit_caret = 0;
2511 ic->impl->preedit_attrlist.clear ();
2512 emit = true;
2513 }
2514 if (ic->impl->use_preedit)
2515 {
2516 if (emit)
2517 {
2518 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2519 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2520 }
2521 if (ic->impl->preedit_started)
2522 {
2523 ecore_imf_context_preedit_end_event_add (ic->ctx);
2524 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2525 ic->impl->preedit_started = false;
2526 }
2527 }
2528 else
2529 _panel_client.hide_preedit_string (ic->id);
2530 }
2531}
2532
2533static void
2534slot_hide_aux_string (IMEngineInstanceBase *si)
2535{
2536 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2537
2538 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2539
2540 if (ic && ic->impl && _focused_ic == ic)
2541 _panel_client.hide_aux_string (ic->id);
2542}
2543
2544static void
2545slot_hide_lookup_table (IMEngineInstanceBase *si)
2546{
2547 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2548
2549 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2550
2551 if (ic && ic->impl && _focused_ic == ic)
2552 _panel_client.hide_lookup_table (ic->id);
2553}
2554
2555static void
2556slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
2557{
2558 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2559
2560 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2561
2562 if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret)
2563 {
2564 ic->impl->preedit_caret = caret;
2565 if (ic->impl->use_preedit)
2566 {
2567 if (!ic->impl->preedit_started)
2568 {
2569 ecore_imf_context_preedit_start_event_add (ic->ctx);
2570 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2571 ic->impl->preedit_started = true;
2572 }
2573 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2574 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2575 }
2576 else
2577 _panel_client.update_preedit_caret (ic->id, caret);
2578 }
2579}
2580
2581static void
2582slot_update_preedit_string (IMEngineInstanceBase *si,
2583 const WideString & str,
2584 const AttributeList & attrs)
2585{
2586 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2587
2588 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2589
2590 if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ()))
2591 {
2592 ic->impl->preedit_string = str;
2593 ic->impl->preedit_attrlist = attrs;
2594 if (ic->impl->use_preedit)
2595 {
2596 if (!ic->impl->preedit_started)
2597 {
2598 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);
2600 ic->impl->preedit_started = true;
2601 }
2602 ic->impl->preedit_caret = str.length ();
2603 ic->impl->preedit_updating = true;
2604 ecore_imf_context_preedit_changed_event_add (ic->ctx);
2605 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2606 ic->impl->preedit_updating = false;
2607 }
2608 else
2609 {
2610 _panel_client.update_preedit_string (ic->id, str, attrs);
2611 }
2612 }
2613}
2614
2615static void
2616slot_update_aux_string (IMEngineInstanceBase *si,
2617 const WideString & str,
2618 const AttributeList & attrs)
2619{
2620 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2621
2622 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2623
2624 if (ic && ic->impl && _focused_ic == ic)
2625 _panel_client.update_aux_string (ic->id, str, attrs);
2626}
2627
2628static void
2629slot_commit_string (IMEngineInstanceBase *si,
2630 const WideString & str)
2631{
2632 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2633
2634 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2635
2636 if (ic && ic->ctx)
2637 {
2638 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());
2640 }
2641}
2642
2643static void
2644slot_forward_key_event (IMEngineInstanceBase *si,
2645 const KeyEvent & key)
2646{
2647 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2648
2649 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2650
2651 if (ic && _focused_ic == ic)
2652 {
2653 if (!_fallback_instance->process_key_event (key))
2654 _x_send_key_event(key);
2655 }
2656}
2657
2658static void
2659slot_update_lookup_table (IMEngineInstanceBase *si,
2660 const LookupTable & table)
2661{
2662 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2663
2664 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2665
2666 if (ic && ic->impl && _focused_ic == ic)
2667 _panel_client.update_lookup_table (ic->id, table);
2668}
2669
2670static void
2671slot_register_properties (IMEngineInstanceBase *si,
2672 const PropertyList & properties)
2673{
2674 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2675
2676 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2677
2678 if (ic && ic->impl && _focused_ic == ic)
2679 _panel_client.register_properties (ic->id, properties);
2680}
2681
2682static void
2683slot_update_property (IMEngineInstanceBase *si,
2684 const Property & property)
2685{
2686 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2687
2688 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2689
2690 if (ic && ic->impl && _focused_ic == ic)
2691 _panel_client.update_property (ic->id, property);
2692}
2693
2694static void
2695slot_beep (IMEngineInstanceBase *si __UNUSED__)
2696{
2697 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2698}
2699
2700static void
2701slot_start_helper (IMEngineInstanceBase *si,
2702 const String &helper_uuid)
2703{
2704 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2705
2706 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
2707 << (ic ? ic->id : -1) << " ic=" << ic
2708 << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid () : "") << "...\n";
2709
2710 if (ic && ic->impl)
2711 _panel_client.start_helper (ic->id, helper_uuid);
2712}
2713
2714static void
2715slot_stop_helper (IMEngineInstanceBase *si,
2716 const String &helper_uuid)
2717{
2718 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2719
2720 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n";
2721
2722 if (ic && ic->impl)
2723 _panel_client.stop_helper (ic->id, helper_uuid);
2724}
2725
2726static void
2727slot_send_helper_event (IMEngineInstanceBase *si,
2728 const String &helper_uuid,
2729 const Transaction &trans)
2730{
2731 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2732
2733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
2734 << (ic ? ic->id : -1) << " ic=" << ic
2735 << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid () : "") << "...\n";
2736
2737 if (ic && ic->impl)
2738 _panel_client.send_helper_event (ic->id, helper_uuid, trans);
2739}
2740
2741static bool
2742slot_get_surrounding_text (IMEngineInstanceBase *si,
2743 WideString &text,
2744 int &cursor,
2745 int maxlen_before,
2746 int maxlen_after)
2747{
2748 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2749
2750 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2751
2752 if (ic && ic->impl && _focused_ic == ic)
2753 {
2754 char *surrounding = NULL;
2755 int cursor_index;
2756 if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index))
2757 {
2758 SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n";
2759 SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n";
2760 WideString before (utf8_mbstowcs (String (surrounding, surrounding + cursor_index)));
2761 WideString after (utf8_mbstowcs (String (surrounding + cursor_index)));
2762 if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length ())
2763 before = WideString (before.begin () + (before.length () - maxlen_before), before.end ());
2764 else if (maxlen_before == 0) before = WideString ();
2765 if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length ())
2766 after = WideString (after.begin (), after.begin () + maxlen_after);
2767 else if (maxlen_after == 0) after = WideString ();
2768 text = before + after;
2769 cursor = before.length ();
2770 return true;
2771 }
2772 }
2773 return false;
2774}
2775
2776static bool
2777slot_delete_surrounding_text (IMEngineInstanceBase *si,
2778 int offset,
2779 int len)
2780{
2781 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2782
2783 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ());
2784
2785 if (ic && ic->impl && _focused_ic == ic)
2786 {
2787 Ecore_IMF_Event_Delete_Surrounding ev;
2788 ev.ctx = _focused_ic->ctx;
2789 ev.n_chars = len;
2790 ev.offset = offset;
2791 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);
2793 return true;
2794 }
2795 return false;
2796}
2797
2798static void
2799reload_config_callback (const ConfigPointer &config)
2800{
2801 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2802
2803 _frontend_hotkey_matcher.load_hotkeys (config);
2804 _imengine_hotkey_matcher.load_hotkeys (config);
2805
2806 KeyEvent key;
2807
2808 scim_string_to_key (key,
2809 config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK),
2810 String ("Shift+Control+Alt+Lock")));
2811
2812 _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF;
2813 _valid_key_mask |= SCIM_KEY_ReleaseMask;
2814 // Special treatment for two backslash keys on jp106 keyboard.
2815 _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask;
2816
2817 _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);
2819
2820 // Get keyboard layout setting
2821 // Flush the global config first, in order to load the new configs from disk.
2822 scim_global_config_flush ();
2823
2824 _keyboard_layout = scim_get_default_keyboard_layout ();
2825}
2826
2827static void
2828fallback_commit_string_cb (IMEngineInstanceBase *si __UNUSED__,
2829 const WideString &str)
2830{
2831 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2832
2833 if (_focused_ic && _focused_ic->impl)
2834 {
2835 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());
2837 }
2838}
2839
diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h
new file mode 100644
index 0000000..84f1a2f
--- /dev/null
+++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h
@@ -0,0 +1,40 @@
1#ifndef __ISF_IMF_CONTEXT_H
2#define __ISF_IMF_CONTEXT_H
3
4#include <Ecore_IMF.h>
5
6typedef struct _EcoreIMFContextISF EcoreIMFContextISF;
7typedef struct _EcoreIMFContextISFImpl EcoreIMFContextISFImpl;
8
9struct _EcoreIMFContextISF {
10 Ecore_IMF_Context *ctx;
11
12 EcoreIMFContextISFImpl *impl;
13
14 int id; /* Input Context id*/
15 struct _EcoreIMFContextISF *next;
16};
17
18void isf_imf_context_add (Ecore_IMF_Context *ctx);
19void isf_imf_context_del (Ecore_IMF_Context *ctx);
20void isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window);
21void isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *window);
22void isf_imf_context_focus_in (Ecore_IMF_Context *ctx);
23void isf_imf_context_focus_out (Ecore_IMF_Context *ctx);
24void isf_imf_context_reset (Ecore_IMF_Context *ctx);
25void isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos);
26void isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
27void isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode);
28void isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos);
29void isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos);
30void isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit);
31Eina_Bool isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event);
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);
34void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout);
35
36EcoreIMFContextISF* isf_imf_context_new (void);
37void isf_imf_context_shutdown (void);
38
39#endif /* __ISF_IMF_CONTEXT_H */
40
diff --git a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp
new file mode 100644
index 0000000..eff6381
--- /dev/null
+++ b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp
@@ -0,0 +1,93 @@
1#include <stdio.h>
2#include "scim_imcontext.h"
3
4#ifdef __cplusplus
5extern "C"
6{
7#endif /* __cplusplus */
8
9 static const Ecore_IMF_Context_Info isf_imf_info = {
10 "scim", /* ID */
11 "SCIM immodule for Ecore", /* Description */
12 "*", /* Default locales */
13 NULL, /* Canvas type */
14 0 /* Canvas required */
15 };
16
17 static Ecore_IMF_Context_Class isf_imf_class = {
18 isf_imf_context_add, /* add */
19 isf_imf_context_del, /* del */
20 isf_imf_context_client_window_set, /* client_window_set */
21 isf_imf_context_client_canvas_set, /* client_canvas_set */
22 NULL, /* isf_imf_context_input_panel_show, - show */
23 NULL, /* isf_imf_context_input_panel_hide, - hide */
24 isf_imf_context_preedit_string_get, /* get_preedit_string */
25 isf_imf_context_focus_in, /* focus_in */
26 isf_imf_context_focus_out, /* focus_out */
27 isf_imf_context_reset, /* reset */
28 isf_imf_context_cursor_position_set, /* cursor_position_set */
29 isf_imf_context_use_preedit_set, /* use_preedit_set */
30 isf_imf_context_input_mode_set, /* input_mode_set */
31 isf_imf_context_filter_event, /* filter_event */
32 isf_imf_context_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */
33 isf_imf_context_prediction_allow_set, /* prediction_allow_set */
34 isf_imf_context_autocapital_type_set, /* autocapital_type_set */
35 NULL, /* control panel show */
36 NULL, /* control panel hide */
37 NULL, /* input_panel_layout_set */
38 NULL, /* isf_imf_context_input_panel_layout_get, */
39 NULL, /* isf_imf_context_input_panel_language_set, */
40 NULL, /* isf_imf_context_input_panel_language_get, */
41 isf_imf_context_cursor_location_set /* cursor_location_set */
42 };
43
44 static Ecore_IMF_Context *imf_module_create (void);
45 static Ecore_IMF_Context *imf_module_exit (void);
46
47 static Eina_Bool imf_module_init (void)
48 {
49 ecore_imf_module_register (&isf_imf_info, imf_module_create, imf_module_exit);
50 return EINA_TRUE;
51 }
52
53 static void imf_module_shutdown (void)
54 {
55 isf_imf_context_shutdown ();
56 }
57
58 static Ecore_IMF_Context *imf_module_create (void)
59 {
60 Ecore_IMF_Context *ctx = NULL;
61 EcoreIMFContextISF *ctxd = NULL;
62
63 ctxd = isf_imf_context_new ();
64 if (!ctxd)
65 {
66 printf ("isf_imf_context_new () failed!!!\n");
67 return NULL;
68 }
69
70 ctx = ecore_imf_context_new (&isf_imf_class);
71 if (!ctx)
72 {
73 delete ctxd;
74 return NULL;
75 }
76
77 ecore_imf_context_data_set (ctx, ctxd);
78
79 return ctx;
80 }
81
82 static Ecore_IMF_Context *imf_module_exit (void)
83 {
84 return NULL;
85 }
86
87 EINA_MODULE_INIT(imf_module_init);
88 EINA_MODULE_SHUTDOWN(imf_module_shutdown);
89
90#ifdef __cplusplus
91}
92#endif /* __cplusplus */
93
diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.in b/libraries/ecore/src/modules/immodules/xim/Makefile.in
index ec58d4b..5b78946 100644
--- a/libraries/ecore/src/modules/immodules/xim/Makefile.in
+++ b/libraries/ecore/src/modules/immodules/xim/Makefile.in
@@ -244,10 +244,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
244PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 244PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
245PIXMAN_LIBS = @PIXMAN_LIBS@ 245PIXMAN_LIBS = @PIXMAN_LIBS@
246PKG_CONFIG = @PKG_CONFIG@ 246PKG_CONFIG = @PKG_CONFIG@
247PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
248PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
249POSUB = @POSUB@ 247POSUB = @POSUB@
250RANLIB = @RANLIB@ 248RANLIB = @RANLIB@
249SCIM_CFLAGS = @SCIM_CFLAGS@
250SCIM_LIBS = @SCIM_LIBS@
251SDL_CFLAGS = @SDL_CFLAGS@ 251SDL_CFLAGS = @SDL_CFLAGS@
252SDL_CONFIG = @SDL_CONFIG@ 252SDL_CONFIG = @SDL_CONFIG@
253SDL_LIBS = @SDL_LIBS@ 253SDL_LIBS = @SDL_LIBS@
@@ -266,6 +266,10 @@ TSLIB_LIBS = @TSLIB_LIBS@
266USE_NLS = @USE_NLS@ 266USE_NLS = @USE_NLS@
267VERSION = @VERSION@ 267VERSION = @VERSION@
268VMAJ = @VMAJ@ 268VMAJ = @VMAJ@
269WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
270WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
271WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
272WAYLAND_LIBS = @WAYLAND_LIBS@
269WIN32_CFLAGS = @WIN32_CFLAGS@ 273WIN32_CFLAGS = @WIN32_CFLAGS@
270WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ 274WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
271WIN32_LIBS = @WIN32_LIBS@ 275WIN32_LIBS = @WIN32_LIBS@
@@ -379,6 +383,8 @@ ecore_imf_cflags = @ecore_imf_cflags@
379ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ 383ecore_imf_evas_cflags = @ecore_imf_evas_cflags@
380ecore_imf_evas_libs = @ecore_imf_evas_libs@ 384ecore_imf_evas_libs = @ecore_imf_evas_libs@
381ecore_imf_libs = @ecore_imf_libs@ 385ecore_imf_libs = @ecore_imf_libs@
386ecore_imf_scim_cflags = @ecore_imf_scim_cflags@
387ecore_imf_scim_libs = @ecore_imf_scim_libs@
382ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ 388ecore_imf_xim_cflags = @ecore_imf_xim_cflags@
383ecore_imf_xim_libs = @ecore_imf_xim_libs@ 389ecore_imf_xim_libs = @ecore_imf_xim_libs@
384ecore_input_cflags = @ecore_input_cflags@ 390ecore_input_cflags = @ecore_input_cflags@
@@ -391,6 +397,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@
391ecore_psl1ght_libs = @ecore_psl1ght_libs@ 397ecore_psl1ght_libs = @ecore_psl1ght_libs@
392ecore_sdl_cflags = @ecore_sdl_cflags@ 398ecore_sdl_cflags = @ecore_sdl_cflags@
393ecore_sdl_libs = @ecore_sdl_libs@ 399ecore_sdl_libs = @ecore_sdl_libs@
400ecore_wayland_cflags = @ecore_wayland_cflags@
401ecore_wayland_libs = @ecore_wayland_libs@
394ecore_win32_cflags = @ecore_win32_cflags@ 402ecore_win32_cflags = @ecore_win32_cflags@
395ecore_win32_libs = @ecore_win32_libs@ 403ecore_win32_libs = @ecore_win32_libs@
396ecore_wince_cflags = @ecore_wince_cflags@ 404ecore_wince_cflags = @ecore_wince_cflags@
@@ -435,12 +443,14 @@ requirements_ecore_fb = @requirements_ecore_fb@
435requirements_ecore_file = @requirements_ecore_file@ 443requirements_ecore_file = @requirements_ecore_file@
436requirements_ecore_imf = @requirements_ecore_imf@ 444requirements_ecore_imf = @requirements_ecore_imf@
437requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ 445requirements_ecore_imf_evas = @requirements_ecore_imf_evas@
446requirements_ecore_imf_scim = @requirements_ecore_imf_scim@
438requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ 447requirements_ecore_imf_xim = @requirements_ecore_imf_xim@
439requirements_ecore_input = @requirements_ecore_input@ 448requirements_ecore_input = @requirements_ecore_input@
440requirements_ecore_input_evas = @requirements_ecore_input_evas@ 449requirements_ecore_input_evas = @requirements_ecore_input_evas@
441requirements_ecore_ipc = @requirements_ecore_ipc@ 450requirements_ecore_ipc = @requirements_ecore_ipc@
442requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ 451requirements_ecore_psl1ght = @requirements_ecore_psl1ght@
443requirements_ecore_sdl = @requirements_ecore_sdl@ 452requirements_ecore_sdl = @requirements_ecore_sdl@
453requirements_ecore_wayland = @requirements_ecore_wayland@
444requirements_ecore_win32 = @requirements_ecore_win32@ 454requirements_ecore_win32 = @requirements_ecore_win32@
445requirements_ecore_wince = @requirements_ecore_wince@ 455requirements_ecore_wince = @requirements_ecore_wince@
446requirements_ecore_x = @requirements_ecore_x@ 456requirements_ecore_x = @requirements_ecore_x@
diff --git a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c
index 7c40606..ea7ee7f 100644
--- a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c
+++ b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c
@@ -1,3 +1,7 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
1#include <Eina.h> 5#include <Eina.h>
2#include <Ecore.h> 6#include <Ecore.h>
3#include <Ecore_Input.h> 7#include <Ecore_Input.h>
@@ -12,9 +16,6 @@
12#include <string.h> 16#include <string.h>
13#include <langinfo.h> 17#include <langinfo.h>
14#include <assert.h> 18#include <assert.h>
15#ifdef HAVE_CONFIG_H
16# include <config.h>
17#endif
18 19
19#define CLAMP(x, low, high) (x > high) ? high : (x < low) ? low : x 20#define CLAMP(x, low, high) (x > high) ? high : (x < low) ? low : x
20#define _(x) x 21#define _(x) x
@@ -23,6 +24,8 @@
23static Eina_List *open_ims = NULL; 24static Eina_List *open_ims = NULL;
24#endif 25#endif
25 26
27#define FEEDBACK_MASK (XIMReverse | XIMUnderline | XIMHighlight)
28
26typedef struct _XIM_Im_Info XIM_Im_Info; 29typedef struct _XIM_Im_Info XIM_Im_Info;
27struct _XIM_Im_Info 30struct _XIM_Im_Info
28{ 31{
@@ -51,6 +54,7 @@ struct _Ecore_IMF_Context_Data
51 Eina_Bool finalizing; 54 Eina_Bool finalizing;
52 Eina_Bool has_focus; 55 Eina_Bool has_focus;
53 Eina_Bool in_toplevel; 56 Eina_Bool in_toplevel;
57 XIMFeedback *feedbacks;
54 58
55 XIMCallback preedit_start_cb; 59 XIMCallback preedit_start_cb;
56 XIMCallback preedit_done_cb; 60 XIMCallback preedit_done_cb;
@@ -63,40 +67,62 @@ Ecore_IMF_Context_Data *imf_context_data_new();
63void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data); 67void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data);
64 68
65#ifdef ENABLE_XIM 69#ifdef ENABLE_XIM
66static void reinitialize_ic(Ecore_IMF_Context *ctx); 70static void add_feedback_attr(Eina_List **attrs,
67static void reinitialize_all_ics(XIM_Im_Info *info); 71 const char *str,
68static void set_ic_client_window(Ecore_IMF_Context *ctx, 72 XIMFeedback feedback,
69 Ecore_X_Window window); 73 int start_pos,
70static int preedit_start_callback(XIC xic, 74 int end_pos);
71 XPointer client_data, 75
72 XPointer call_data); 76static void reinitialize_ic(Ecore_IMF_Context *ctx);
73static void preedit_done_callback(XIC xic, 77static void reinitialize_all_ics(XIM_Im_Info *info);
74 XPointer client_data, 78static void set_ic_client_window(Ecore_IMF_Context *ctx,
75 XPointer call_data); 79 Ecore_X_Window window);
76static int xim_text_to_utf8(Ecore_IMF_Context *ctx, 80static int preedit_start_callback(XIC xic,
77 XIMText *xim_text, 81 XPointer client_data,
78 char **text); 82 XPointer call_data);
79static void preedit_draw_callback(XIC xic, 83static void preedit_done_callback(XIC xic,
80 XPointer client_data, 84 XPointer client_data,
81 XIMPreeditDrawCallbackStruct *call_data); 85 XPointer call_data);
82static void preedit_caret_callback(XIC xic, 86static int xim_text_to_utf8(Ecore_IMF_Context *ctx,
83 XPointer client_data, 87 XIMText *xim_text,
84 XIMPreeditCaretCallbackStruct *call_data); 88 char **text);
89static void preedit_draw_callback(XIC xic,
90 XPointer client_data,
91 XIMPreeditDrawCallbackStruct *call_data);
92static void preedit_caret_callback(XIC xic,
93 XPointer client_data,
94 XIMPreeditCaretCallbackStruct *call_data);
85static XVaNestedList preedit_callback_set(Ecore_IMF_Context *ctx); 95static XVaNestedList preedit_callback_set(Ecore_IMF_Context *ctx);
86static XIC get_ic(Ecore_IMF_Context *ctx); 96static XIC get_ic(Ecore_IMF_Context *ctx);
87static XIM_Im_Info *get_im(Ecore_X_Window window, 97static XIM_Im_Info *get_im(Ecore_X_Window window,
88 char *locale); 98 char *locale);
89static void xim_info_try_im(XIM_Im_Info *info); 99static void xim_info_try_im(XIM_Im_Info *info);
90static void xim_info_display_closed(Ecore_X_Display *display, 100static void xim_info_display_closed(Ecore_X_Display *display,
91 int is_error, 101 int is_error,
92 XIM_Im_Info *info); 102 XIM_Im_Info *info);
93static void xim_instantiate_callback(Display *display, 103static void xim_instantiate_callback(Display *display,
94 XPointer client_data, 104 XPointer client_data,
95 XPointer call_data); 105 XPointer call_data);
96static void setup_im(XIM_Im_Info *info); 106static void setup_im(XIM_Im_Info *info);
97static void xim_destroy_callback(XIM xim, 107static void xim_destroy_callback(XIM xim,
98 XPointer client_data, 108 XPointer client_data,
99 XPointer call_data); 109 XPointer call_data);
110#endif
111
112#ifdef ENABLE_XIM
113static unsigned int
114utf8_offset_to_index(const char *str, int offset)
115{
116 int index = 0;
117 int i;
118 for (i = 0; i < offset; i++)
119 {
120 eina_unicode_utf8_get_next(str, &index);
121 }
122
123 return index;
124}
125
100#endif 126#endif
101 127
102static void 128static void
@@ -107,7 +133,7 @@ _ecore_imf_context_xim_add(Ecore_IMF_Context *ctx)
107 Ecore_IMF_Context_Data *imf_context_data = NULL; 133 Ecore_IMF_Context_Data *imf_context_data = NULL;
108 134
109 imf_context_data = imf_context_data_new(); 135 imf_context_data = imf_context_data_new();
110 if(!imf_context_data) return; 136 if (!imf_context_data) return;
111 137
112 imf_context_data->use_preedit = EINA_TRUE; 138 imf_context_data->use_preedit = EINA_TRUE;
113 imf_context_data->finalizing = EINA_FALSE; 139 imf_context_data->finalizing = EINA_FALSE;
@@ -115,6 +141,8 @@ _ecore_imf_context_xim_add(Ecore_IMF_Context *ctx)
115 imf_context_data->in_toplevel = EINA_FALSE; 141 imf_context_data->in_toplevel = EINA_FALSE;
116 142
117 ecore_imf_context_data_set(ctx, imf_context_data); 143 ecore_imf_context_data_set(ctx, imf_context_data);
144#else
145 (void)ctx;
118#endif 146#endif
119} 147}
120 148
@@ -127,48 +155,53 @@ _ecore_imf_context_xim_del(Ecore_IMF_Context *ctx)
127 imf_context_data = ecore_imf_context_data_get(ctx); 155 imf_context_data = ecore_imf_context_data_get(ctx);
128 156
129 imf_context_data->finalizing = EINA_TRUE; 157 imf_context_data->finalizing = EINA_TRUE;
130 if(imf_context_data->im_info && !imf_context_data->im_info->ics->next) 158 if (imf_context_data->im_info && !imf_context_data->im_info->ics->next)
131 { 159 {
132 if(imf_context_data->im_info->reconnecting == EINA_TRUE) 160 if (imf_context_data->im_info->reconnecting == EINA_TRUE)
133 { 161 {
134 Ecore_X_Display *dsp; 162 Ecore_X_Display *dsp;
135 dsp = ecore_x_display_get(); 163 dsp = ecore_x_display_get();
136 XUnregisterIMInstantiateCallback (dsp, 164 XUnregisterIMInstantiateCallback(dsp,
137 NULL, NULL, NULL, 165 NULL, NULL, NULL,
138 xim_instantiate_callback, 166 xim_instantiate_callback,
139 (XPointer)imf_context_data->im_info); 167 (XPointer)imf_context_data->im_info);
140 } 168 }
141 else if(imf_context_data->im_info->im) 169 else if (imf_context_data->im_info->im)
142 { 170 {
143 XIMCallback im_destroy_callback; 171 XIMCallback im_destroy_callback;
144 im_destroy_callback.client_data = NULL; 172 im_destroy_callback.client_data = NULL;
145 im_destroy_callback.callback = NULL; 173 im_destroy_callback.callback = NULL;
146 XSetIMValues (imf_context_data->im_info->im, 174 XSetIMValues(imf_context_data->im_info->im,
147 XNDestroyCallback, &im_destroy_callback, 175 XNDestroyCallback, &im_destroy_callback,
148 NULL); 176 NULL);
149 } 177 }
150 } 178 }
151 179
152 set_ic_client_window(ctx, 0); 180 set_ic_client_window(ctx, 0);
153 181
154 imf_context_data_destroy(imf_context_data); 182 imf_context_data_destroy(imf_context_data);
183#else
184 (void)ctx;
155#endif 185#endif
156} 186}
157 187
158static void 188static void
159_ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx, 189_ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx,
160 void *window) 190 void *window)
161{ 191{
162 EINA_LOG_DBG("in"); 192 EINA_LOG_DBG("in");
163#ifdef ENABLE_XIM 193#ifdef ENABLE_XIM
164 set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window)); 194 set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window));
195#else
196 (void)ctx;
197 (void)window;
165#endif 198#endif
166} 199}
167 200
168static void 201static void
169_ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx, 202_ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx,
170 char **str, 203 char **str,
171 int *cursor_pos) 204 int *cursor_pos)
172{ 205{
173 EINA_LOG_DBG("in"); 206 EINA_LOG_DBG("in");
174#ifdef ENABLE_XIM 207#ifdef ENABLE_XIM
@@ -180,25 +213,73 @@ _ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx,
180 { 213 {
181 utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars, 214 utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars,
182 &len); 215 &len);
183 if(str) 216 if (str)
184 *str = utf8; 217 *str = utf8;
185 else 218 else
186 free(utf8); 219 free(utf8);
187 } 220 }
188 else 221 else
189 { 222 {
190 if(str) 223 if (str)
191 *str = NULL; 224 *str = NULL;
192 if(cursor_pos) 225 if (cursor_pos)
193 *cursor_pos = 0; 226 *cursor_pos = 0;
194 } 227 }
195 228
196 if(cursor_pos) 229 if (cursor_pos)
197 *cursor_pos = imf_context_data->preedit_cursor; 230 *cursor_pos = imf_context_data->preedit_cursor;
198#else 231#else
199 if(str) 232 (void)ctx;
233 if (str)
234 *str = NULL;
235 if (cursor_pos)
236 *cursor_pos = 0;
237#endif
238}
239
240static void
241_ecore_imf_context_xim_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx,
242 char **str,
243 Eina_List **attrs,
244 int *cursor_pos)
245{
246 EINA_LOG_DBG("in");
247
248#ifdef ENABLE_XIM
249 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
250
251 _ecore_imf_context_xim_preedit_string_get(ctx, str, cursor_pos);
252
253 if (!attrs) return;
254 if (!imf_context_data || !imf_context_data->feedbacks) return;
255
256 int i = 0;
257 XIMFeedback last_feedback = 0;
258 int start = -1;
259
260 for (i = 0; i < imf_context_data->preedit_length; i++)
261 {
262 XIMFeedback new_feedback = imf_context_data->feedbacks[i] & FEEDBACK_MASK;
263
264 if (new_feedback != last_feedback)
265 {
266 if (start >= 0)
267 add_feedback_attr(attrs, *str, last_feedback, start, i);
268
269 last_feedback = new_feedback;
270 start = i;
271 }
272 }
273
274 if (start >= 0)
275 add_feedback_attr(attrs, *str, last_feedback, start, i);
276#else
277 (void)ctx;
278 if (str)
200 *str = NULL; 279 *str = NULL;
201 if(cursor_pos) 280 if (attrs)
281 *attrs = NULL;
282 if (cursor_pos)
202 *cursor_pos = 0; 283 *cursor_pos = 0;
203#endif 284#endif
204} 285}
@@ -213,7 +294,7 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx)
213 imf_context_data = ecore_imf_context_data_get(ctx); 294 imf_context_data = ecore_imf_context_data_get(ctx);
214 ic = imf_context_data->ic; 295 ic = imf_context_data->ic;
215 imf_context_data->has_focus = EINA_TRUE; 296 imf_context_data->has_focus = EINA_TRUE;
216 if(ic) 297 if (ic)
217 { 298 {
218 char *str; 299 char *str;
219 300
@@ -226,6 +307,8 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx)
226 307
227 XSetICFocus(ic); 308 XSetICFocus(ic);
228 } 309 }
310#else
311 (void)ctx;
229#endif 312#endif
230} 313}
231 314
@@ -237,13 +320,15 @@ _ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx)
237 XIC ic; 320 XIC ic;
238 Ecore_IMF_Context_Data *imf_context_data; 321 Ecore_IMF_Context_Data *imf_context_data;
239 imf_context_data = ecore_imf_context_data_get(ctx); 322 imf_context_data = ecore_imf_context_data_get(ctx);
240 if(imf_context_data->has_focus == EINA_TRUE) 323 if (imf_context_data->has_focus == EINA_TRUE)
241 { 324 {
242 imf_context_data->has_focus = EINA_FALSE; 325 imf_context_data->has_focus = EINA_FALSE;
243 ic = imf_context_data->ic; 326 ic = imf_context_data->ic;
244 if(ic) 327 if (ic)
245 XUnsetICFocus(ic); 328 XUnsetICFocus(ic);
246 } 329 }
330#else
331 (void)ctx;
247#endif 332#endif
248} 333}
249 334
@@ -263,18 +348,18 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx)
263 348
264 imf_context_data = ecore_imf_context_data_get(ctx); 349 imf_context_data = ecore_imf_context_data_get(ctx);
265 ic = imf_context_data->ic; 350 ic = imf_context_data->ic;
266 if(!ic) 351 if (!ic)
267 return; 352 return;
268 353
269 if(imf_context_data->preedit_length == 0) 354 if (imf_context_data->preedit_length == 0)
270 return; 355 return;
271 356
272 preedit_attr = XVaCreateNestedList(0, 357 preedit_attr = XVaCreateNestedList(0,
273 XNPreeditState, &preedit_state, 358 XNPreeditState, &preedit_state,
274 NULL); 359 NULL);
275 if(!XGetICValues(ic, 360 if (!XGetICValues(ic,
276 XNPreeditAttributes, preedit_attr, 361 XNPreeditAttributes, preedit_attr,
277 NULL)) 362 NULL))
278 have_preedit_state = EINA_TRUE; 363 have_preedit_state = EINA_TRUE;
279 364
280 XFree(preedit_attr); 365 XFree(preedit_attr);
@@ -284,38 +369,49 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx)
284 preedit_attr = XVaCreateNestedList(0, 369 preedit_attr = XVaCreateNestedList(0,
285 XNPreeditState, preedit_state, 370 XNPreeditState, preedit_state,
286 NULL); 371 NULL);
287 if(have_preedit_state) 372 if (have_preedit_state)
288 XSetICValues(ic, 373 XSetICValues(ic,
289 XNPreeditAttributes, preedit_attr, 374 XNPreeditAttributes, preedit_attr,
290 NULL); 375 NULL);
291 376
292 XFree(preedit_attr); 377 XFree(preedit_attr);
293 378
294 if(imf_context_data->preedit_length) 379 if (imf_context_data->feedbacks)
380 {
381 free(imf_context_data->feedbacks);
382 imf_context_data->feedbacks = NULL;
383 }
384
385 if (imf_context_data->preedit_length)
295 { 386 {
296 imf_context_data->preedit_length = 0; 387 imf_context_data->preedit_length = 0;
297 free(imf_context_data->preedit_chars); 388 free(imf_context_data->preedit_chars);
298 imf_context_data->preedit_chars = NULL; 389 imf_context_data->preedit_chars = NULL;
390
299 ecore_imf_context_preedit_changed_event_add(ctx); 391 ecore_imf_context_preedit_changed_event_add(ctx);
392 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
300 } 393 }
301 394
302 if(result) 395 if (result)
303 { 396 {
304 char *result_utf8 = strdup(result); 397 char *result_utf8 = strdup(result);
305 if(result_utf8) 398 if (result_utf8)
306 { 399 {
307 ecore_imf_context_commit_event_add(ctx, result_utf8); 400 ecore_imf_context_commit_event_add(ctx, result_utf8);
308 free(result_utf8); 401 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, result_utf8);
309 } 402 free(result_utf8);
403 }
310 } 404 }
311 405
312 XFree (result); 406 XFree(result);
407#else
408 (void)ctx;
313#endif 409#endif
314} 410}
315 411
316static void 412static void
317_ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx, 413_ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx,
318 Eina_Bool use_preedit) 414 Eina_Bool use_preedit)
319{ 415{
320 EINA_LOG_DBG("in"); 416 EINA_LOG_DBG("in");
321#ifdef ENABLE_XIM 417#ifdef ENABLE_XIM
@@ -324,17 +420,53 @@ _ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx,
324 420
325 use_preedit = use_preedit != EINA_FALSE; 421 use_preedit = use_preedit != EINA_FALSE;
326 422
327 if(imf_context_data->use_preedit != use_preedit) 423 if (imf_context_data->use_preedit != use_preedit)
328 { 424 {
329 imf_context_data->use_preedit = use_preedit; 425 imf_context_data->use_preedit = use_preedit;
330 reinitialize_ic(ctx); 426 reinitialize_ic(ctx);
331 } 427 }
428#else
429 (void)ctx;
430 (void)use_preedit;
332#endif 431#endif
333} 432}
334 433
434#ifdef ENABLE_XIM
435static void
436add_feedback_attr(Eina_List **attrs,
437 const char *str,
438 XIMFeedback feedback,
439 int start_pos,
440 int end_pos)
441{
442 Ecore_IMF_Preedit_Attr *attr = NULL;
443
444 unsigned int start_index = utf8_offset_to_index(str, start_pos);
445 unsigned int end_index = utf8_offset_to_index(str, end_pos);
446
447 if (feedback & FEEDBACK_MASK)
448 {
449 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
450 attr->start_index = start_index;
451 attr->end_index = end_index;
452 *attrs = eina_list_append(*attrs, (void *)attr);
453 }
454
455 if (feedback & XIMUnderline)
456 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1;
457
458 if (feedback & XIMReverse)
459 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
460
461 if (feedback & XIMHighlight)
462 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
463}
464
465#endif
466
335static void 467static void
336_ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx, 468_ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx,
337 int x, int y, int w, int h) 469 int x, int y, int w, int h)
338{ 470{
339 EINA_LOG_DBG("%s in", __FUNCTION__); 471 EINA_LOG_DBG("%s in", __FUNCTION__);
340 472
@@ -342,7 +474,7 @@ _ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx,
342 Ecore_IMF_Context_Data *imf_context_data; 474 Ecore_IMF_Context_Data *imf_context_data;
343 XIC ic; 475 XIC ic;
344 XVaNestedList preedit_attr; 476 XVaNestedList preedit_attr;
345 XPoint spot; 477 XPoint spot;
346 478
347 imf_context_data = ecore_imf_context_data_get(ctx); 479 imf_context_data = ecore_imf_context_data_get(ctx);
348 ic = imf_context_data->ic; 480 ic = imf_context_data->ic;
@@ -351,15 +483,20 @@ _ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx,
351 483
352 spot.x = x; 484 spot.x = x;
353 spot.y = y + h; 485 spot.y = y + h;
354 486
355 preedit_attr = XVaCreateNestedList (0, 487 preedit_attr = XVaCreateNestedList(0,
356 XNSpotLocation, &spot, 488 XNSpotLocation, &spot,
357 NULL); 489 NULL);
358 XSetICValues (ic, 490 XSetICValues(ic,
359 XNPreeditAttributes, preedit_attr, 491 XNPreeditAttributes, preedit_attr,
360 NULL); 492 NULL);
361 493
362 XFree(preedit_attr); 494 XFree(preedit_attr);
495#else
496 (void)ctx;
497 (void)x;
498 (void)y;
499 (void)h;
363#endif 500#endif
364 (void)(w); // yes w is unused, but only a bi-product of the algorithm 501 (void)(w); // yes w is unused, but only a bi-product of the algorithm
365} 502}
@@ -371,19 +508,19 @@ _ecore_x_event_reverse_modifiers(unsigned int state)
371 unsigned int modifiers = 0; 508 unsigned int modifiers = 0;
372 509
373 /**< "Control" is pressed */ 510 /**< "Control" is pressed */
374 if(state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) 511 if (state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL)
375 modifiers |= ControlMask; 512 modifiers |= ControlMask;
376 513
377 /**< "Alt" is pressed */ 514 /**< "Alt" is pressed */
378 if(state & ECORE_IMF_KEYBOARD_MODIFIER_ALT) 515 if (state & ECORE_IMF_KEYBOARD_MODIFIER_ALT)
379 modifiers |= Mod1Mask; 516 modifiers |= Mod1Mask;
380 517
381 /**< "Shift" is pressed */ 518 /**< "Shift" is pressed */
382 if(state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) 519 if (state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT)
383 modifiers |= ShiftMask; 520 modifiers |= ShiftMask;
384 521
385 /**< "Win" (between "Ctrl" and "A */ 522 /**< "Win" (between "Ctrl" and "A */
386 if(state & ECORE_IMF_KEYBOARD_MODIFIER_WIN) 523 if (state & ECORE_IMF_KEYBOARD_MODIFIER_WIN)
387 modifiers |= Mod5Mask; 524 modifiers |= Mod5Mask;
388 525
389 return modifiers; 526 return modifiers;
@@ -395,14 +532,14 @@ _ecore_x_event_reverse_locks(unsigned int state)
395 unsigned int locks = 0; 532 unsigned int locks = 0;
396 533
397 /**< "Num" lock is active */ 534 /**< "Num" lock is active */
398 if(state & ECORE_IMF_KEYBOARD_LOCK_NUM) 535 if (state & ECORE_IMF_KEYBOARD_LOCK_NUM)
399 locks |= Mod3Mask; 536 locks |= Mod3Mask;
400 537
401 if(state & ECORE_IMF_KEYBOARD_LOCK_CAPS) 538 if (state & ECORE_IMF_KEYBOARD_LOCK_CAPS)
402 locks |= LockMask; 539 locks |= LockMask;
403 540
404#if 0 /* FIXME: add mask. */ 541#if 0 /* FIXME: add mask. */
405 if(state & ECORE_IMF_KEYBOARD_LOCK_SCROLL) 542 if (state & ECORE_IMF_KEYBOARD_LOCK_SCROLL)
406 ; 543 ;
407#endif 544#endif
408 545
@@ -411,12 +548,12 @@ _ecore_x_event_reverse_locks(unsigned int state)
411 548
412static KeyCode 549static KeyCode
413_keycode_get(Ecore_X_Display *dsp, 550_keycode_get(Ecore_X_Display *dsp,
414 const char *keyname) 551 const char *keyname)
415{ 552{
416 KeyCode keycode; 553 KeyCode keycode;
417 554
418 // EINA_LOG_DBG("keyname:%s keysym:%lu", keyname, XStringToKeysym(keyname)); 555 // EINA_LOG_DBG("keyname:%s keysym:%lu", keyname, XStringToKeysym(keyname));
419 if(strcmp(keyname, "Keycode-0") == 0) 556 if (strcmp(keyname, "Keycode-0") == 0)
420 { 557 {
421 keycode = 0; 558 keycode = 0;
422 } 559 }
@@ -430,9 +567,9 @@ _keycode_get(Ecore_X_Display *dsp,
430#endif 567#endif
431 568
432static Eina_Bool 569static Eina_Bool
433_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, 570_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
434 Ecore_IMF_Event_Type type, 571 Ecore_IMF_Event_Type type,
435 Ecore_IMF_Event *event) 572 Ecore_IMF_Event *event)
436{ 573{
437 EINA_LOG_DBG("%s in", __FUNCTION__); 574 EINA_LOG_DBG("%s in", __FUNCTION__);
438#ifdef ENABLE_XIM 575#ifdef ENABLE_XIM
@@ -451,12 +588,12 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
451 588
452 imf_context_data = ecore_imf_context_data_get(ctx); 589 imf_context_data = ecore_imf_context_data_get(ctx);
453 ic = imf_context_data->ic; 590 ic = imf_context_data->ic;
454 if(!ic) 591 if (!ic)
455 { 592 {
456 ic = get_ic(ctx); 593 ic = get_ic(ctx);
457 } 594 }
458 595
459 if(type == ECORE_IMF_EVENT_KEY_DOWN) 596 if (type == ECORE_IMF_EVENT_KEY_DOWN)
460 { 597 {
461 XKeyPressedEvent xev; 598 XKeyPressedEvent xev;
462 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; 599 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
@@ -481,7 +618,7 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
481 xev.keycode = _keycode_get(dsp, ev->keyname); 618 xev.keycode = _keycode_get(dsp, ev->keyname);
482 xev.same_screen = True; 619 xev.same_screen = True;
483 620
484 if(ic) 621 if (ic)
485 { 622 {
486 Status mbstatus; 623 Status mbstatus;
487#ifdef X_HAVE_UTF8_STRING 624#ifdef X_HAVE_UTF8_STRING
@@ -563,15 +700,16 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
563 } 700 }
564 } 701 }
565 702
566 if(compose) 703 if (compose)
567 { 704 {
568 Eina_Unicode *unicode; 705 Eina_Unicode *unicode;
569 int len; 706 int len;
570 unicode = eina_unicode_utf8_to_unicode(compose, &len); 707 unicode = eina_unicode_utf8_to_unicode(compose, &len);
571 if(!unicode) abort(); 708 if (!unicode) abort();
572 if(unicode[0] >= 0x20 && unicode[0] != 0x7f) 709 if (unicode[0] >= 0x20 && unicode[0] != 0x7f)
573 { 710 {
574 ecore_imf_context_commit_event_add(ctx, compose); 711 ecore_imf_context_commit_event_add(ctx, compose);
712 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, compose);
575 result = EINA_TRUE; 713 result = EINA_TRUE;
576 } 714 }
577 free(compose); 715 free(compose);
@@ -581,6 +719,9 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx,
581 719
582 return result; 720 return result;
583#else 721#else
722 (void)ctx;
723 (void)type;
724 (void)event;
584 return EINA_FALSE; 725 return EINA_FALSE;
585#endif 726#endif
586} 727}
@@ -608,7 +749,7 @@ static Ecore_IMF_Context_Class xim_class = {
608 .use_preedit_set = _ecore_imf_context_xim_use_preedit_set, 749 .use_preedit_set = _ecore_imf_context_xim_use_preedit_set,
609 .input_mode_set = NULL, 750 .input_mode_set = NULL,
610 .filter_event = _ecore_imf_context_xim_filter_event, 751 .filter_event = _ecore_imf_context_xim_filter_event,
611 .preedit_string_with_attributes_get = NULL, 752 .preedit_string_with_attributes_get = _ecore_imf_context_xim_preedit_string_with_attributes_get,
612 .prediction_allow_set = NULL, 753 .prediction_allow_set = NULL,
613 .autocapital_type_set = NULL, 754 .autocapital_type_set = NULL,
614 .control_panel_show = NULL, 755 .control_panel_show = NULL,
@@ -627,7 +768,7 @@ xim_imf_module_create(void)
627 Ecore_IMF_Context *ctx = NULL; 768 Ecore_IMF_Context *ctx = NULL;
628 769
629 ctx = ecore_imf_context_new(&xim_class); 770 ctx = ecore_imf_context_new(&xim_class);
630 if(!ctx) 771 if (!ctx)
631 goto error; 772 goto error;
632 773
633 return ctx; 774 return ctx;
@@ -686,15 +827,15 @@ imf_context_data_new()
686 char *locale; 827 char *locale;
687 828
688 locale = setlocale(LC_CTYPE, ""); 829 locale = setlocale(LC_CTYPE, "");
689 if(!locale) return NULL; 830 if (!locale) return NULL;
690 831
691 if(!XSupportsLocale()) return NULL; 832 if (!XSupportsLocale()) return NULL;
692 833
693 imf_context_data = calloc(1, sizeof(Ecore_IMF_Context_Data)); 834 imf_context_data = calloc(1, sizeof(Ecore_IMF_Context_Data));
694 if(!imf_context_data) return NULL; 835 if (!imf_context_data) return NULL;
695 836
696 imf_context_data->locale = strdup(locale); 837 imf_context_data->locale = strdup(locale);
697 if(!imf_context_data->locale) goto error; 838 if (!imf_context_data->locale) goto error;
698 839
699 return imf_context_data; 840 return imf_context_data;
700error: 841error:
@@ -705,19 +846,26 @@ error:
705void 846void
706imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data) 847imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data)
707{ 848{
708 if(!imf_context_data) 849 if (!imf_context_data)
709 return; 850 return;
710 851
711 if(imf_context_data->ic) 852 if (imf_context_data->ic)
712 XDestroyIC(imf_context_data->ic); 853 XDestroyIC(imf_context_data->ic);
713 854
714 free(imf_context_data->preedit_chars); 855 free(imf_context_data->preedit_chars);
856
857 if (imf_context_data->feedbacks)
858 {
859 free(imf_context_data->feedbacks);
860 imf_context_data->feedbacks = NULL;
861 }
862
715 free(imf_context_data->locale); 863 free(imf_context_data->locale);
716 free(imf_context_data); 864 free(imf_context_data);
717} 865}
718 866
719static int 867static int
720preedit_start_callback(XIC xic __UNUSED__, 868preedit_start_callback(XIC xic __UNUSED__,
721 XPointer client_data, 869 XPointer client_data,
722 XPointer call_data __UNUSED__) 870 XPointer call_data __UNUSED__)
723{ 871{
@@ -726,14 +874,16 @@ preedit_start_callback(XIC xic __UNUSED__,
726 Ecore_IMF_Context_Data *imf_context_data; 874 Ecore_IMF_Context_Data *imf_context_data;
727 imf_context_data = ecore_imf_context_data_get(ctx); 875 imf_context_data = ecore_imf_context_data_get(ctx);
728 876
729 if(imf_context_data->finalizing == EINA_FALSE) 877 if (imf_context_data->finalizing == EINA_FALSE)
730 ecore_imf_context_preedit_start_event_add(ctx); 878 {
731 879 ecore_imf_context_preedit_start_event_add(ctx);
880 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
881 }
732 return -1; 882 return -1;
733} 883}
734 884
735static void 885static void
736preedit_done_callback(XIC xic __UNUSED__, 886preedit_done_callback(XIC xic __UNUSED__,
737 XPointer client_data, 887 XPointer client_data,
738 XPointer call_data __UNUSED__) 888 XPointer call_data __UNUSED__)
739{ 889{
@@ -742,30 +892,34 @@ preedit_done_callback(XIC xic __UNUSED__,
742 Ecore_IMF_Context_Data *imf_context_data; 892 Ecore_IMF_Context_Data *imf_context_data;
743 imf_context_data = ecore_imf_context_data_get(ctx); 893 imf_context_data = ecore_imf_context_data_get(ctx);
744 894
745 if(imf_context_data->preedit_length) 895 if (imf_context_data->preedit_length)
746 { 896 {
747 imf_context_data->preedit_length = 0; 897 imf_context_data->preedit_length = 0;
748 free(imf_context_data->preedit_chars); 898 free(imf_context_data->preedit_chars);
749 imf_context_data->preedit_chars = NULL; 899 imf_context_data->preedit_chars = NULL;
750 ecore_imf_context_preedit_changed_event_add(ctx); 900 ecore_imf_context_preedit_changed_event_add(ctx);
901 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
751 } 902 }
752 903
753 if(imf_context_data->finalizing == EINA_FALSE) 904 if (imf_context_data->finalizing == EINA_FALSE)
754 ecore_imf_context_preedit_end_event_add(ctx); 905 {
906 ecore_imf_context_preedit_end_event_add(ctx);
907 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
908 }
755} 909}
756 910
757/* FIXME */ 911/* FIXME */
758static int 912static int
759xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__, 913xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
760 XIMText *xim_text, 914 XIMText *xim_text,
761 char **text) 915 char **text)
762{ 916{
763 int text_length = 0; 917 int text_length = 0;
764 char *result = NULL; 918 char *result = NULL;
765 919
766 if(xim_text && xim_text->string.multi_byte) 920 if (xim_text && xim_text->string.multi_byte)
767 { 921 {
768 if(xim_text->encoding_is_wchar) 922 if (xim_text->encoding_is_wchar)
769 { 923 {
770 EINA_LOG_WARN("Wide character return from Xlib not currently supported"); 924 EINA_LOG_WARN("Wide character return from Xlib not currently supported");
771 *text = NULL; 925 *text = NULL;
@@ -774,7 +928,7 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
774 928
775 /* XXX Convert to UTF-8 */ 929 /* XXX Convert to UTF-8 */
776 result = strdup(xim_text->string.multi_byte); 930 result = strdup(xim_text->string.multi_byte);
777 if(result) 931 if (result)
778 { 932 {
779 text_length = eina_unicode_utf8_get_len(result); 933 text_length = eina_unicode_utf8_get_len(result);
780 if (text_length != xim_text->length) 934 if (text_length != xim_text->length)
@@ -798,8 +952,8 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__,
798} 952}
799 953
800static void 954static void
801preedit_draw_callback(XIC xic __UNUSED__, 955preedit_draw_callback(XIC xic __UNUSED__,
802 XPointer client_data, 956 XPointer client_data,
803 XIMPreeditDrawCallbackStruct *call_data) 957 XIMPreeditDrawCallbackStruct *call_data)
804{ 958{
805 EINA_LOG_DBG("in"); 959 EINA_LOG_DBG("in");
@@ -811,59 +965,83 @@ preedit_draw_callback(XIC xic __UNUSED__,
811 Eina_Unicode *new_text = NULL; 965 Eina_Unicode *new_text = NULL;
812 Eina_UStrbuf *preedit_bufs = NULL; 966 Eina_UStrbuf *preedit_bufs = NULL;
813 int new_text_length; 967 int new_text_length;
968 int i = 0;
814 969
815 preedit_bufs = eina_ustrbuf_new(); 970 preedit_bufs = eina_ustrbuf_new();
816 if(imf_context_data->preedit_chars) { 971 if (imf_context_data->preedit_chars)
817 ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars); 972 {
818 if(ret == EINA_FALSE) goto done; 973 ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars);
819 } 974 if (ret == EINA_FALSE) goto done;
975 }
820 976
821 new_text_length = xim_text_to_utf8(ctx, t, &tmp); 977 new_text_length = xim_text_to_utf8(ctx, t, &tmp);
822 if(tmp) 978 if (tmp)
823 { 979 {
824 int tmp_len; 980 int tmp_len;
825 new_text = eina_unicode_utf8_to_unicode((const char *)tmp, &tmp_len); 981 new_text = eina_unicode_utf8_to_unicode((const char *)tmp, &tmp_len);
826 free(tmp); 982 free(tmp);
827 } 983 }
828 984
829 if(t == NULL) { 985 if (t == NULL)
830 /* delete string */ 986 {
831 ret = eina_ustrbuf_remove(preedit_bufs, 987 /* delete string */
832 call_data->chg_first, call_data->chg_length); 988 ret = eina_ustrbuf_remove(preedit_bufs,
833 } else if(call_data->chg_length == 0) { 989 call_data->chg_first, call_data->chg_length);
834 /* insert string */ 990 }
835 ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first); 991 else if (call_data->chg_length == 0)
836 } else if(call_data->chg_length > 0) { 992 {
837 /* replace string */ 993 /* insert string */
838 ret = eina_ustrbuf_remove(preedit_bufs, 994 ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first);
839 call_data->chg_first, call_data->chg_length); 995 }
840 if(ret == EINA_FALSE) goto done; 996 else if (call_data->chg_length > 0)
841 997 {
842 ret = eina_ustrbuf_insert_n(preedit_bufs, new_text, 998 /* replace string */
843 new_text_length, call_data->chg_first); 999 ret = eina_ustrbuf_remove(preedit_bufs,
844 if(ret == EINA_FALSE) goto done; 1000 call_data->chg_first, call_data->chg_length);
845 } else { 1001 if (ret == EINA_FALSE) goto done;
846 ret = EINA_FALSE; 1002
847 } 1003 ret = eina_ustrbuf_insert_n(preedit_bufs, new_text,
848 1004 new_text_length, call_data->chg_first);
849 done: 1005 if (ret == EINA_FALSE) goto done;
850 if(ret == EINA_TRUE) { 1006 }
851 free(imf_context_data->preedit_chars); 1007 else {
852 imf_context_data->preedit_chars = 1008 ret = EINA_FALSE;
1009 }
1010
1011done:
1012 if (ret == EINA_TRUE)
1013 {
1014 free(imf_context_data->preedit_chars);
1015 imf_context_data->preedit_chars =
853 eina_ustrbuf_string_steal(preedit_bufs); 1016 eina_ustrbuf_string_steal(preedit_bufs);
854 imf_context_data->preedit_length = 1017 imf_context_data->preedit_length =
855 eina_unicode_strlen(imf_context_data->preedit_chars); 1018 eina_unicode_strlen(imf_context_data->preedit_chars);
856 1019
857 ecore_imf_context_preedit_changed_event_add(ctx); 1020 if (imf_context_data->feedbacks)
858 } 1021 {
1022 free(imf_context_data->feedbacks);
1023 imf_context_data->feedbacks = NULL;
1024 }
1025
1026 if (imf_context_data->preedit_length > 0)
1027 {
1028 imf_context_data->feedbacks = calloc(imf_context_data->preedit_length, sizeof(XIMFeedback));
1029
1030 for (i = 0; i < imf_context_data->preedit_length; i++)
1031 imf_context_data->feedbacks[i] = t->feedback[i];
1032 }
1033
1034 ecore_imf_context_preedit_changed_event_add(ctx);
1035 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1036 }
859 1037
860 free(new_text); 1038 free(new_text);
861 eina_ustrbuf_free(preedit_bufs); 1039 eina_ustrbuf_free(preedit_bufs);
862} 1040}
863 1041
864static void 1042static void
865preedit_caret_callback(XIC xic __UNUSED__, 1043preedit_caret_callback(XIC xic __UNUSED__,
866 XPointer client_data, 1044 XPointer client_data,
867 XIMPreeditCaretCallbackStruct *call_data) 1045 XIMPreeditCaretCallbackStruct *call_data)
868{ 1046{
869 EINA_LOG_DBG("in"); 1047 EINA_LOG_DBG("in");
@@ -871,12 +1049,15 @@ preedit_caret_callback(XIC xic __UNUSED__,
871 Ecore_IMF_Context_Data *imf_context_data; 1049 Ecore_IMF_Context_Data *imf_context_data;
872 imf_context_data = ecore_imf_context_data_get(ctx); 1050 imf_context_data = ecore_imf_context_data_get(ctx);
873 1051
874 if(call_data->direction == XIMAbsolutePosition) 1052 if (call_data->direction == XIMAbsolutePosition)
875 { 1053 {
876 // printf("call_data->position:%d\n", call_data->position); 1054 // printf("call_data->position:%d\n", call_data->position);
877 imf_context_data->preedit_cursor = call_data->position; 1055 imf_context_data->preedit_cursor = call_data->position;
878 if(imf_context_data->finalizing == EINA_FALSE) 1056 if (imf_context_data->finalizing == EINA_FALSE)
879 ecore_imf_context_preedit_changed_event_add(ctx); 1057 {
1058 ecore_imf_context_preedit_changed_event_add(ctx);
1059 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1060 }
880 } 1061 }
881} 1062}
882 1063
@@ -917,7 +1098,7 @@ get_ic(Ecore_IMF_Context *ctx)
917 XIC ic; 1098 XIC ic;
918 imf_context_data = ecore_imf_context_data_get(ctx); 1099 imf_context_data = ecore_imf_context_data_get(ctx);
919 ic = imf_context_data->ic; 1100 ic = imf_context_data->ic;
920 if(!ic) 1101 if (!ic)
921 { 1102 {
922 XIM_Im_Info *im_info = imf_context_data->im_info; 1103 XIM_Im_Info *im_info = imf_context_data->im_info;
923 XVaNestedList preedit_attr = NULL; 1104 XVaNestedList preedit_attr = NULL;
@@ -930,7 +1111,7 @@ get_ic(Ecore_IMF_Context *ctx)
930 EINA_LOG_WARN("Doesn't open XIM."); 1111 EINA_LOG_WARN("Doesn't open XIM.");
931 return NULL; 1112 return NULL;
932 } 1113 }
933 1114
934 // supported styles 1115 // supported styles
935#if 0 1116#if 0
936 int i; 1117 int i;
@@ -940,23 +1121,23 @@ get_ic(Ecore_IMF_Context *ctx)
940 { 1121 {
941 printf("%i: ", i); 1122 printf("%i: ", i);
942 if (im_info->xim_styles->supported_styles[i] & XIMPreeditCallbacks) 1123 if (im_info->xim_styles->supported_styles[i] & XIMPreeditCallbacks)
943 printf("XIMPreeditCallbacks | "); 1124 printf("XIMPreeditCallbacks | ");
944 if (im_info->xim_styles->supported_styles[i] & XIMPreeditPosition) 1125 if (im_info->xim_styles->supported_styles[i] & XIMPreeditPosition)
945 printf("XIMPreeditPosition | "); 1126 printf("XIMPreeditPosition | ");
946 if (im_info->xim_styles->supported_styles[i] & XIMPreeditArea) 1127 if (im_info->xim_styles->supported_styles[i] & XIMPreeditArea)
947 printf("XIMPreeditArea | "); 1128 printf("XIMPreeditArea | ");
948 if (im_info->xim_styles->supported_styles[i] & XIMPreeditNothing) 1129 if (im_info->xim_styles->supported_styles[i] & XIMPreeditNothing)
949 printf("XIMPreeditNothing | "); 1130 printf("XIMPreeditNothing | ");
950 if (im_info->xim_styles->supported_styles[i] & XIMPreeditNone) 1131 if (im_info->xim_styles->supported_styles[i] & XIMPreeditNone)
951 printf("XIMPreeditNone | "); 1132 printf("XIMPreeditNone | ");
952 if (im_info->xim_styles->supported_styles[i] & XIMStatusArea) 1133 if (im_info->xim_styles->supported_styles[i] & XIMStatusArea)
953 printf("XIMStatusArea | "); 1134 printf("XIMStatusArea | ");
954 if (im_info->xim_styles->supported_styles[i] & XIMStatusCallbacks) 1135 if (im_info->xim_styles->supported_styles[i] & XIMStatusCallbacks)
955 printf("XIMStatusCallbacks | "); 1136 printf("XIMStatusCallbacks | ");
956 if (im_info->xim_styles->supported_styles[i] & XIMStatusNothing) 1137 if (im_info->xim_styles->supported_styles[i] & XIMStatusNothing)
957 printf("XIMStatusNothing | "); 1138 printf("XIMStatusNothing | ");
958 if (im_info->xim_styles->supported_styles[i] & XIMStatusNone) 1139 if (im_info->xim_styles->supported_styles[i] & XIMStatusNone)
959 printf("XIMStatusNone | "); 1140 printf("XIMStatusNone | ");
960 printf("\n"); 1141 printf("\n");
961 } 1142 }
962 } 1143 }
@@ -969,12 +1150,12 @@ get_ic(Ecore_IMF_Context *ctx)
969 { 1150 {
970 if (im_info->supports_cursor) 1151 if (im_info->supports_cursor)
971 { 1152 {
972 // kinput2 DOES do this... 1153 // kinput2 DOES do this...
973 XFontSet fs; 1154 XFontSet fs;
974 char **missing_charset_list; 1155 char **missing_charset_list;
975 int missing_charset_count; 1156 int missing_charset_count;
976 char *def_string; 1157 char *def_string;
977 1158
978 im_style |= XIMPreeditPosition; 1159 im_style |= XIMPreeditPosition;
979 im_style |= XIMStatusNothing; 1160 im_style |= XIMStatusNothing;
980 fs = XCreateFontSet(ecore_x_display_get(), 1161 fs = XCreateFontSet(ecore_x_display_get(),
@@ -995,7 +1176,7 @@ get_ic(Ecore_IMF_Context *ctx)
995 } 1176 }
996 name = XNPreeditAttributes; 1177 name = XNPreeditAttributes;
997 } 1178 }
998 else 1179 else
999 { 1180 {
1000 im_style |= XIMPreeditNothing; 1181 im_style |= XIMPreeditNothing;
1001 im_style |= XIMStatusNothing; 1182 im_style |= XIMStatusNothing;
@@ -1009,18 +1190,18 @@ get_ic(Ecore_IMF_Context *ctx)
1009 name, preedit_attr, NULL); 1190 name, preedit_attr, NULL);
1010 } 1191 }
1011 XFree(preedit_attr); 1192 XFree(preedit_attr);
1012 if(ic) 1193 if (ic)
1013 { 1194 {
1014 unsigned long mask = 0xaaaaaaaa; 1195 unsigned long mask = 0xaaaaaaaa;
1015 XGetICValues (ic, 1196 XGetICValues(ic,
1016 XNFilterEvents, &mask, 1197 XNFilterEvents, &mask,
1017 NULL); 1198 NULL);
1018 imf_context_data->mask = mask; 1199 imf_context_data->mask = mask;
1019 ecore_x_event_mask_set(imf_context_data->win, mask); 1200 ecore_x_event_mask_set(imf_context_data->win, mask);
1020 } 1201 }
1021 1202
1022 imf_context_data->ic = ic; 1203 imf_context_data->ic = ic;
1023 if(ic && imf_context_data->has_focus == EINA_TRUE) 1204 if (ic && imf_context_data->has_focus == EINA_TRUE)
1024 XSetICFocus(ic); 1205 XSetICFocus(ic);
1025 } 1206 }
1026 1207
@@ -1032,16 +1213,17 @@ reinitialize_ic(Ecore_IMF_Context *ctx)
1032{ 1213{
1033 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); 1214 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
1034 XIC ic = imf_context_data->ic; 1215 XIC ic = imf_context_data->ic;
1035 if(ic) 1216 if (ic)
1036 { 1217 {
1037 XDestroyIC(ic); 1218 XDestroyIC(ic);
1038 imf_context_data->ic = NULL; 1219 imf_context_data->ic = NULL;
1039 if(imf_context_data->preedit_length) 1220 if (imf_context_data->preedit_length)
1040 { 1221 {
1041 imf_context_data->preedit_length = 0; 1222 imf_context_data->preedit_length = 0;
1042 free(imf_context_data->preedit_chars); 1223 free(imf_context_data->preedit_chars);
1043 imf_context_data->preedit_chars = NULL; 1224 imf_context_data->preedit_chars = NULL;
1044 ecore_imf_context_preedit_changed_event_add(ctx); 1225 ecore_imf_context_preedit_changed_event_add(ctx);
1226 ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1045 } 1227 }
1046 } 1228 }
1047} 1229}
@@ -1052,13 +1234,13 @@ reinitialize_all_ics(XIM_Im_Info *info)
1052 Eina_List *tmp_list; 1234 Eina_List *tmp_list;
1053 Ecore_IMF_Context *ctx; 1235 Ecore_IMF_Context *ctx;
1054 1236
1055 EINA_LIST_FOREACH(info->ics, tmp_list, ctx) 1237 EINA_LIST_FOREACH (info->ics, tmp_list, ctx)
1056 reinitialize_ic(ctx); 1238 reinitialize_ic(ctx);
1057} 1239}
1058 1240
1059static void 1241static void
1060set_ic_client_window(Ecore_IMF_Context *ctx, 1242set_ic_client_window(Ecore_IMF_Context *ctx,
1061 Ecore_X_Window window) 1243 Ecore_X_Window window)
1062{ 1244{
1063 EINA_LOG_DBG("in"); 1245 EINA_LOG_DBG("in");
1064 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); 1246 Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx);
@@ -1069,7 +1251,7 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
1069 1251
1070 old_win = imf_context_data->win; 1252 old_win = imf_context_data->win;
1071 EINA_LOG_DBG("old_win:%d window:%d ", old_win, window); 1253 EINA_LOG_DBG("old_win:%d window:%d ", old_win, window);
1072 if(old_win != 0 && old_win != window) /* XXX how do check window... */ 1254 if (old_win != 0 && old_win != window) /* XXX how do check window... */
1073 { 1255 {
1074 XIM_Im_Info *info; 1256 XIM_Im_Info *info;
1075 info = imf_context_data->im_info; 1257 info = imf_context_data->im_info;
@@ -1079,7 +1261,7 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
1079 1261
1080 imf_context_data->win = window; 1262 imf_context_data->win = window;
1081 1263
1082 if(window) /* XXX */ 1264 if (window) /* XXX */
1083 { 1265 {
1084 XIM_Im_Info *info = NULL; 1266 XIM_Im_Info *info = NULL;
1085 info = get_im(window, imf_context_data->locale); 1267 info = get_im(window, imf_context_data->locale);
@@ -1092,17 +1274,17 @@ set_ic_client_window(Ecore_IMF_Context *ctx,
1092 1274
1093static XIM_Im_Info * 1275static XIM_Im_Info *
1094get_im(Ecore_X_Window window, 1276get_im(Ecore_X_Window window,
1095 char *locale) 1277 char *locale)
1096{ 1278{
1097 EINA_LOG_DBG("in"); 1279 EINA_LOG_DBG("in");
1098 1280
1099 Eina_List *l; 1281 Eina_List *l;
1100 XIM_Im_Info *im_info = NULL; 1282 XIM_Im_Info *im_info = NULL;
1101 XIM_Im_Info *info = NULL; 1283 XIM_Im_Info *info = NULL;
1102 EINA_LIST_FOREACH(open_ims, l, im_info) { 1284 EINA_LIST_FOREACH (open_ims, l, im_info) {
1103 if(strcmp(im_info->locale, locale) == 0) 1285 if (strcmp(im_info->locale, locale) == 0)
1104 { 1286 {
1105 if(im_info->im) 1287 if (im_info->im)
1106 { 1288 {
1107 return im_info; 1289 return im_info;
1108 } 1290 }
@@ -1113,10 +1295,10 @@ get_im(Ecore_X_Window window,
1113 } 1295 }
1114 } 1296 }
1115 1297
1116 if(!info) 1298 if (!info)
1117 { 1299 {
1118 info = calloc(1, sizeof(XIM_Im_Info)); 1300 info = calloc(1, sizeof(XIM_Im_Info));
1119 if(!info) return NULL; 1301 if (!info) return NULL;
1120 open_ims = eina_list_prepend(open_ims, info); 1302 open_ims = eina_list_prepend(open_ims, info);
1121 info->win = window; 1303 info->win = window;
1122 info->locale = strdup(locale); 1304 info->locale = strdup(locale);
@@ -1137,13 +1319,13 @@ xim_info_try_im(XIM_Im_Info *info)
1137 if (info->reconnecting == EINA_TRUE) 1319 if (info->reconnecting == EINA_TRUE)
1138 return; 1320 return;
1139 1321
1140 if(XSupportsLocale()) 1322 if (XSupportsLocale())
1141 { 1323 {
1142 if (!XSetLocaleModifiers ("")) 1324 if (!XSetLocaleModifiers(""))
1143 EINA_LOG_WARN("Unable to set locale modifiers with XSetLocaleModifiers()"); 1325 EINA_LOG_WARN("Unable to set locale modifiers with XSetLocaleModifiers()");
1144 dsp = ecore_x_display_get(); 1326 dsp = ecore_x_display_get();
1145 info->im = XOpenIM(dsp, NULL, NULL, NULL); 1327 info->im = XOpenIM(dsp, NULL, NULL, NULL);
1146 if(!info->im) 1328 if (!info->im)
1147 { 1329 {
1148 XRegisterIMInstantiateCallback(dsp, 1330 XRegisterIMInstantiateCallback(dsp,
1149 NULL, NULL, NULL, 1331 NULL, NULL, NULL,
@@ -1158,8 +1340,8 @@ xim_info_try_im(XIM_Im_Info *info)
1158 1340
1159static void 1341static void
1160xim_info_display_closed(Ecore_X_Display *display __UNUSED__, 1342xim_info_display_closed(Ecore_X_Display *display __UNUSED__,
1161 int is_error __UNUSED__, 1343 int is_error __UNUSED__,
1162 XIM_Im_Info *info) 1344 XIM_Im_Info *info)
1163{ 1345{
1164 Eina_List *ics, *tmp_list; 1346 Eina_List *ics, *tmp_list;
1165 Ecore_IMF_Context *ctx; 1347 Ecore_IMF_Context *ctx;
@@ -1169,21 +1351,21 @@ xim_info_display_closed(Ecore_X_Display *display __UNUSED__,
1169 ics = info->ics; 1351 ics = info->ics;
1170 info->ics = NULL; 1352 info->ics = NULL;
1171 1353
1172 EINA_LIST_FOREACH(ics, tmp_list, ctx) 1354 EINA_LIST_FOREACH (ics, tmp_list, ctx)
1173 set_ic_client_window(ctx, 0); 1355 set_ic_client_window(ctx, 0);
1174 1356
1175 EINA_LIST_FREE(ics, ctx) { 1357 EINA_LIST_FREE (ics, ctx) {
1176 Ecore_IMF_Context_Data *imf_context_data; 1358 Ecore_IMF_Context_Data *imf_context_data;
1177 imf_context_data = ecore_imf_context_data_get(ctx); 1359 imf_context_data = ecore_imf_context_data_get(ctx);
1178 imf_context_data_destroy(imf_context_data); 1360 imf_context_data_destroy(imf_context_data);
1179 } 1361 }
1180 1362
1181 free (info->locale); 1363 free(info->locale);
1182 1364
1183 if (info->im) 1365 if (info->im)
1184 XCloseIM (info->im); 1366 XCloseIM(info->im);
1185 1367
1186 free (info); 1368 free(info);
1187} 1369}
1188 1370
1189static void 1371static void
@@ -1203,11 +1385,11 @@ xim_instantiate_callback(Display *display,
1203 } 1385 }
1204 1386
1205 info->im = im; 1387 info->im = im;
1206 setup_im (info); 1388 setup_im(info);
1207 1389
1208 XUnregisterIMInstantiateCallback (display, NULL, NULL, NULL, 1390 XUnregisterIMInstantiateCallback(display, NULL, NULL, NULL,
1209 xim_instantiate_callback, 1391 xim_instantiate_callback,
1210 (XPointer)info); 1392 (XPointer)info);
1211 info->reconnecting = EINA_FALSE; 1393 info->reconnecting = EINA_FALSE;
1212} 1394}
1213 1395
@@ -1217,7 +1399,7 @@ setup_im(XIM_Im_Info *info)
1217 XIMValuesList *ic_values = NULL; 1399 XIMValuesList *ic_values = NULL;
1218 XIMCallback im_destroy_callback; 1400 XIMCallback im_destroy_callback;
1219 1401
1220 if(!info->im) 1402 if (!info->im)
1221 return; 1403 return;
1222 1404
1223 im_destroy_callback.client_data = (XPointer)info; 1405 im_destroy_callback.client_data = (XPointer)info;
@@ -1239,25 +1421,25 @@ setup_im(XIM_Im_Info *info)
1239 { 1421 {
1240 if (!strcmp(ic_values->supported_values[i], 1422 if (!strcmp(ic_values->supported_values[i],
1241 XNStringConversionCallback)) 1423 XNStringConversionCallback))
1242 info->supports_string_conversion = EINA_TRUE; 1424 info->supports_string_conversion = EINA_TRUE;
1243 if (!strcmp(ic_values->supported_values[i], 1425 if (!strcmp(ic_values->supported_values[i],
1244 XNCursor)) 1426 XNCursor))
1245 info->supports_cursor = EINA_TRUE; 1427 info->supports_cursor = EINA_TRUE;
1246 } 1428 }
1247#if 0 1429#if 0
1248 printf("values........\n"); 1430 printf("values........\n");
1249 for (i = 0; i < ic_values->count_values; i++) 1431 for (i = 0; i < ic_values->count_values; i++)
1250 printf("%s\n", ic_values->supported_values[i]); 1432 printf("%s\n", ic_values->supported_values[i]);
1251 printf("styles........\n"); 1433 printf("styles........\n");
1252 for (i = 0; i < info->xim_styles->count_styles; i++) 1434 for (i = 0; i < info->xim_styles->count_styles; i++)
1253 printf("%lx\n", info->xim_styles->supported_styles[i]); 1435 printf("%lx\n", info->xim_styles->supported_styles[i]);
1254#endif 1436#endif
1255 XFree(ic_values); 1437 XFree(ic_values);
1256 } 1438 }
1257} 1439}
1258 1440
1259static void 1441static void
1260xim_destroy_callback(XIM xim __UNUSED__, 1442xim_destroy_callback(XIM xim __UNUSED__,
1261 XPointer client_data, 1443 XPointer client_data,
1262 XPointer call_data __UNUSED__) 1444 XPointer call_data __UNUSED__)
1263{ 1445{