aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src')
-rw-r--r--libraries/ecore/src/Makefile.in20
-rw-r--r--libraries/ecore/src/bin/Makefile.in20
-rw-r--r--libraries/ecore/src/examples/Makefile.in20
-rw-r--r--libraries/ecore/src/examples/ecore_evas_basics_example.c5
-rw-r--r--libraries/ecore/src/lib/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore/Ecore.h896
-rw-r--r--libraries/ecore/src/lib/ecore/Makefile.am8
-rw-r--r--libraries/ecore/src/lib/ecore/Makefile.in33
-rw-r--r--libraries/ecore/src/lib/ecore/ecore.c6
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_anim.c4
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_events.c158
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_exe.c10
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_getopt.c4
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_main.c185
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_pipe.c17
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_poll.c94
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_private.h6
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_thread.c756
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_time.c6
-rw-r--r--libraries/ecore/src/lib/ecore/ecore_timer.c19
-rw-r--r--libraries/ecore/src/lib/ecore_cocoa/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_con/Ecore_Con.h81
-rw-r--r--libraries/ecore/src/lib/ecore_con/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con.c23
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_private.h47
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_socks.c762
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c3
-rw-r--r--libraries/ecore/src/lib/ecore_con/ecore_con_url.c671
-rw-r--r--libraries/ecore/src/lib/ecore_config/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_directfb/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h256
-rw-r--r--libraries/ecore/src/lib/ecore_evas/Makefile.am1
-rw-r--r--libraries/ecore/src/lib/ecore_evas/Makefile.in21
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas.c252
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c7
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c10
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c7
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c8
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c69
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c7
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h57
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c9
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c189
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c694
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c769
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c19
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c21
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c455
-rw-r--r--libraries/ecore/src/lib/ecore_fb/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_fb/ecore_fb.c23
-rw-r--r--libraries/ecore/src/lib/ecore_file/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file.c2
-rw-r--r--libraries/ecore/src/lib/ecore_file/ecore_file_download.c40
-rw-r--r--libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h143
-rw-r--r--libraries/ecore/src/lib/ecore_imf/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c402
-rw-r--r--libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h3
-rw-r--r--libraries/ecore/src/lib/ecore_imf_evas/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c44
-rw-r--r--libraries/ecore/src/lib/ecore_input/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_input_evas/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c5
-rw-r--r--libraries/ecore/src/lib/ecore_psl1ght/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_sdl/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h271
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Makefile.am8
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Makefile.in33
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl.c1322
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h56
-rw-r--r--libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h9
-rw-r--r--libraries/ecore/src/lib/ecore_win32/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h4
-rw-r--r--libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c173
-rw-r--r--libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h4
-rw-r--r--libraries/ecore/src/lib/ecore_wince/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c52
-rw-r--r--libraries/ecore/src/lib/ecore_x/Ecore_X.h91
-rw-r--r--libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h14
-rw-r--r--libraries/ecore/src/lib/ecore_x/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h14
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c15
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c236
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c8
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c50
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c294
-rw-r--r--libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c4
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/Makefile.in20
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c15
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c233
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c51
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c246
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c12
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c4
-rw-r--r--libraries/ecore/src/modules/Makefile.in20
-rw-r--r--libraries/ecore/src/modules/immodules/Makefile.in20
-rw-r--r--libraries/ecore/src/modules/immodules/scim/Makefile.in20
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp1348
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_imcontext.h2
-rw-r--r--libraries/ecore/src/modules/immodules/scim/scim_module.cpp11
-rw-r--r--libraries/ecore/src/modules/immodules/xim/Makefile.in20
-rw-r--r--libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c48
-rw-r--r--libraries/ecore/src/tests/Makefile.in20
-rw-r--r--libraries/ecore/src/tests/ecore_test_ecore_x.c4
-rw-r--r--libraries/ecore/src/util/Makefile.in20
106 files changed, 7342 insertions, 5157 deletions
diff --git a/libraries/ecore/src/Makefile.in b/libraries/ecore/src/Makefile.in
index bf6f05c..51ad5e0 100644
--- a/libraries/ecore/src/Makefile.in
+++ b/libraries/ecore/src/Makefile.in
@@ -49,16 +49,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
52 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 52 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
53 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 53 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
54 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 54 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
55 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 55 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
56 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 56 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
57 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 57 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
58 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4) 59 $(ACLOCAL_M4)
61mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 60mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h 61CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES = 62CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES = 63CONFIG_CLEAN_VPATH_FILES =
@@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@
174EVIL_CFLAGS = @EVIL_CFLAGS@ 173EVIL_CFLAGS = @EVIL_CFLAGS@
175EVIL_LIBS = @EVIL_LIBS@ 174EVIL_LIBS = @EVIL_LIBS@
176EXEEXT = @EXEEXT@ 175EXEEXT = @EXEEXT@
176EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
177EXOTIC_LIBS = @EXOTIC_LIBS@
177FGREP = @FGREP@ 178FGREP = @FGREP@
178GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 179GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
179GLIB_CFLAGS = @GLIB_CFLAGS@ 180GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
229PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 230PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
230PIXMAN_LIBS = @PIXMAN_LIBS@ 231PIXMAN_LIBS = @PIXMAN_LIBS@
231PKG_CONFIG = @PKG_CONFIG@ 232PKG_CONFIG = @PKG_CONFIG@
233PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
234PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
232POSUB = @POSUB@ 235POSUB = @POSUB@
233RANLIB = @RANLIB@ 236RANLIB = @RANLIB@
234SCIM_CFLAGS = @SCIM_CFLAGS@ 237SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@
239SED = @SED@ 242SED = @SED@
240SET_MAKE = @SET_MAKE@ 243SET_MAKE = @SET_MAKE@
241SHELL = @SHELL@ 244SHELL = @SHELL@
245SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
242SSL_CFLAGS = @SSL_CFLAGS@ 246SSL_CFLAGS = @SSL_CFLAGS@
243SSL_LIBS = @SSL_LIBS@ 247SSL_LIBS = @SSL_LIBS@
244STRIP = @STRIP@ 248STRIP = @STRIP@
diff --git a/libraries/ecore/src/bin/Makefile.in b/libraries/ecore/src/bin/Makefile.in
index 72d2bfd..aabc6ab 100644
--- a/libraries/ecore/src/bin/Makefile.in
+++ b/libraries/ecore/src/bin/Makefile.in
@@ -49,16 +49,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
52 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 52 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
53 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 53 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
54 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 54 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
55 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 55 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
56 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 56 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
57 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 57 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
58 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4) 59 $(ACLOCAL_M4)
61mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 60mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h 61CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES = 62CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES = 63CONFIG_CLEAN_VPATH_FILES =
@@ -168,6 +167,8 @@ EVAS_LIBS = @EVAS_LIBS@
168EVIL_CFLAGS = @EVIL_CFLAGS@ 167EVIL_CFLAGS = @EVIL_CFLAGS@
169EVIL_LIBS = @EVIL_LIBS@ 168EVIL_LIBS = @EVIL_LIBS@
170EXEEXT = @EXEEXT@ 169EXEEXT = @EXEEXT@
170EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
171EXOTIC_LIBS = @EXOTIC_LIBS@
171FGREP = @FGREP@ 172FGREP = @FGREP@
172GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 173GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
173GLIB_CFLAGS = @GLIB_CFLAGS@ 174GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -223,6 +224,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
223PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 224PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
224PIXMAN_LIBS = @PIXMAN_LIBS@ 225PIXMAN_LIBS = @PIXMAN_LIBS@
225PKG_CONFIG = @PKG_CONFIG@ 226PKG_CONFIG = @PKG_CONFIG@
227PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
228PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
226POSUB = @POSUB@ 229POSUB = @POSUB@
227RANLIB = @RANLIB@ 230RANLIB = @RANLIB@
228SCIM_CFLAGS = @SCIM_CFLAGS@ 231SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -233,6 +236,7 @@ SDL_LIBS = @SDL_LIBS@
233SED = @SED@ 236SED = @SED@
234SET_MAKE = @SET_MAKE@ 237SET_MAKE = @SET_MAKE@
235SHELL = @SHELL@ 238SHELL = @SHELL@
239SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
236SSL_CFLAGS = @SSL_CFLAGS@ 240SSL_CFLAGS = @SSL_CFLAGS@
237SSL_LIBS = @SSL_LIBS@ 241SSL_LIBS = @SSL_LIBS@
238STRIP = @STRIP@ 242STRIP = @STRIP@
diff --git a/libraries/ecore/src/examples/Makefile.in b/libraries/ecore/src/examples/Makefile.in
index 7fac88c..5b984ed 100644
--- a/libraries/ecore/src/examples/Makefile.in
+++ b/libraries/ecore/src/examples/Makefile.in
@@ -81,16 +81,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
81 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 81 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
82 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 82 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
83 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 83 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
84 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 84 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
85 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 85 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
86 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 86 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
87 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 87 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
88 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 88 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
89 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 89 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
90 $(top_srcdir)/configure.ac
91am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 90am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
92 $(ACLOCAL_M4) 91 $(ACLOCAL_M4)
93mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 92mkinstalldirs = $(install_sh) -d
94CONFIG_HEADER = $(top_builddir)/config.h 93CONFIG_HEADER = $(top_builddir)/config.h
95CONFIG_CLEAN_FILES = 94CONFIG_CLEAN_FILES =
96CONFIG_CLEAN_VPATH_FILES = 95CONFIG_CLEAN_VPATH_FILES =
@@ -408,6 +407,8 @@ EVAS_LIBS = @EVAS_LIBS@
408EVIL_CFLAGS = @EVIL_CFLAGS@ 407EVIL_CFLAGS = @EVIL_CFLAGS@
409EVIL_LIBS = @EVIL_LIBS@ 408EVIL_LIBS = @EVIL_LIBS@
410EXEEXT = @EXEEXT@ 409EXEEXT = @EXEEXT@
410EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
411EXOTIC_LIBS = @EXOTIC_LIBS@
411FGREP = @FGREP@ 412FGREP = @FGREP@
412GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 413GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
413GLIB_CFLAGS = @GLIB_CFLAGS@ 414GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -463,6 +464,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
463PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 464PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
464PIXMAN_LIBS = @PIXMAN_LIBS@ 465PIXMAN_LIBS = @PIXMAN_LIBS@
465PKG_CONFIG = @PKG_CONFIG@ 466PKG_CONFIG = @PKG_CONFIG@
467PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
468PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
466POSUB = @POSUB@ 469POSUB = @POSUB@
467RANLIB = @RANLIB@ 470RANLIB = @RANLIB@
468SCIM_CFLAGS = @SCIM_CFLAGS@ 471SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -473,6 +476,7 @@ SDL_LIBS = @SDL_LIBS@
473SED = @SED@ 476SED = @SED@
474SET_MAKE = @SET_MAKE@ 477SET_MAKE = @SET_MAKE@
475SHELL = @SHELL@ 478SHELL = @SHELL@
479SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
476SSL_CFLAGS = @SSL_CFLAGS@ 480SSL_CFLAGS = @SSL_CFLAGS@
477SSL_LIBS = @SSL_LIBS@ 481SSL_LIBS = @SSL_LIBS@
478STRIP = @STRIP@ 482STRIP = @STRIP@
diff --git a/libraries/ecore/src/examples/ecore_evas_basics_example.c b/libraries/ecore/src/examples/ecore_evas_basics_example.c
index 5f0231f..942f9c6 100644
--- a/libraries/ecore/src/examples/ecore_evas_basics_example.c
+++ b/libraries/ecore/src/examples/ecore_evas_basics_example.c
@@ -77,10 +77,7 @@ main(void)
77 evas_object_show(bg); 77 evas_object_show(bg);
78 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); 78 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
79 79
80 ecore_main_fd_handler_add(STDIN_FILENO, 80 ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _stdin_cb, NULL, NULL, NULL);
81 ECORE_FD_READ | ECORE_FD_ERROR,
82 _stdin_cb,
83 NULL, NULL, NULL);
84 81
85 ecore_main_loop_begin(); 82 ecore_main_loop_begin();
86 83
diff --git a/libraries/ecore/src/lib/Makefile.in b/libraries/ecore/src/lib/Makefile.in
index 09271c2..a5fd01f 100644
--- a/libraries/ecore/src/lib/Makefile.in
+++ b/libraries/ecore/src/lib/Makefile.in
@@ -65,16 +65,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
65 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 65 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
66 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 66 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
67 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 67 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
68 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 68 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
69 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 69 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
70 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 70 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
71 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 71 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
72 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 72 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
73 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 73 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
74 $(top_srcdir)/configure.ac
75am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 74am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
76 $(ACLOCAL_M4) 75 $(ACLOCAL_M4)
77mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 76mkinstalldirs = $(install_sh) -d
78CONFIG_HEADER = $(top_builddir)/config.h 77CONFIG_HEADER = $(top_builddir)/config.h
79CONFIG_CLEAN_FILES = 78CONFIG_CLEAN_FILES =
80CONFIG_CLEAN_VPATH_FILES = 79CONFIG_CLEAN_VPATH_FILES =
@@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@ 192EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@ 193EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@ 194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@ 197FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@ 199GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@ 250PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@ 251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
251POSUB = @POSUB@ 254POSUB = @POSUB@
252RANLIB = @RANLIB@ 255RANLIB = @RANLIB@
253SCIM_CFLAGS = @SCIM_CFLAGS@ 256SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@
258SED = @SED@ 261SED = @SED@
259SET_MAKE = @SET_MAKE@ 262SET_MAKE = @SET_MAKE@
260SHELL = @SHELL@ 263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
261SSL_CFLAGS = @SSL_CFLAGS@ 265SSL_CFLAGS = @SSL_CFLAGS@
262SSL_LIBS = @SSL_LIBS@ 266SSL_LIBS = @SSL_LIBS@
263STRIP = @STRIP@ 267STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore/Ecore.h b/libraries/ecore/src/lib/ecore/Ecore.h
index fbe4dda..eace560 100644
--- a/libraries/ecore/src/lib/ecore/Ecore.h
+++ b/libraries/ecore/src/lib/ecore/Ecore.h
@@ -9,7 +9,7 @@
9 @mainpage Ecore 9 @mainpage Ecore
10 10
11 @version 1.1 11 @version 1.1
12 @date 2000-2011 12 @date 2000-2012
13 13
14 Please see the @ref authors page for contact details. 14 Please see the @ref authors page for contact details.
15 15
@@ -22,7 +22,7 @@
22 @li @ref Ecore_Main_Loop_Group 22 @li @ref Ecore_Main_Loop_Group
23 @li @ref Ecore_File_Group 23 @li @ref Ecore_File_Group
24 @li @ref Ecore_Con_Group 24 @li @ref Ecore_Con_Group
25 @li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink 25 @li @ref Ecore_Evas_Group
26 @li @ref Ecore_FB_Group 26 @li @ref Ecore_FB_Group
27 @li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink 27 @li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink
28 @li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink 28 @li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink
@@ -35,21 +35,31 @@
35 pkgconfig (.pc) files are installed for every ecore module. 35 pkgconfig (.pc) files are installed for every ecore module.
36 Thus, to compile using any of them, you can use something like the following: 36 Thus, to compile using any of them, you can use something like the following:
37 37
38 @verbatim 38@verbatim
39 gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs) 39gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs)
40 @endverbatim 40@endverbatim
41 41
42 @section install How is it installed? 42 @section install How is it installed?
43 43
44 Suggested configure options for evas for a Linux desktop X display: 44 Suggested configure options for ecore for a Linux desktop X display
45 with OpenGL and Software support, communication (networking) and
46 IPC (inter process communication):
45 47
46 @verbatim 48@verbatim
47 ./configure \ 49./configure \
48 make 50 --enable-ecore-con \
49 su - 51 --enable-ecore-ipc \
50 ... 52 --enable-ecore-file \
51 make install 53 --enable-ecore-input \
52 @endverbatim 54 --enable-ecore-input-evas \
55 --enable-ecore-x \
56 --enable-ecore-evas \
57 --enable-ecore-evas-software-buffer \
58 --enable-ecore-evas-software-x11 \
59 --enable-ecore-evas-opengl-x11
60make
61sudo make install
62@endverbatim
53 63
54 */ 64 */
55 65
@@ -112,140 +122,175 @@
112 */ 122 */
113 123
114/** 124/**
115 @page Ecore_Main_Loop_Page The Ecore Main Loop 125 * @page Ecore_Main_Loop_Page The Ecore Main Loop
116 126 *
117 @section intro What is Ecore? 127 * @section intro What is Ecore?
118 128 *
119 Ecore is a clean and tiny event loop library with many modules to do lots of 129 * Ecore is a clean and tiny event loop library with many modules to do lots of
120 convenient things for a programmer, to save time and effort. 130 * convenient things for a programmer, to save time and effort. It's small and
121 131 * lean, designed to work from embedded systems all the way up to large and
122 It's small and lean, designed to work on embedded systems all the way to 132 * powerful multi-cpu workstations. The main loop has a number of primitives to
123 large and powerful multi-cpu workstations. It serialises all system signals, 133 * be used with its main loop. It serializes all the primitives and allows for
124 events etc. into a single event queue, that is easily processed without 134 * great responsiveness without the need for threads(or any other concurrency).
125 needing to worry about concurrency. A properly written, event-driven program 135 *
126 using this kind of programming doesn't need threads, nor has to worry about 136 * @subsection timers Timers
127 concurrency. It turns a program into a state machine, and makes it very 137 *
128 robust and easy to follow. 138 * Timers serve two main purposes: doing something at a specified time and
129 139 * repeatedly doing something with a set interval.
130 Ecore gives you other handy primitives, such as timers to tick over for you 140 * @see Ecore_Timer_Group
131 and call specified functions at particular times so the programmer can use 141 *
132 this to do things, like animate, or time out on connections or tasks that take 142 * @subsection poolers Poolers
133 too long etc. 143 *
134 144 * Poolers allow for pooling to be centralized into a single place therefore
135 Idle handlers are provided too, as well as calls on entering an idle state 145 * alleviating the need for different parts of the program to wake up at
136 (often a very good time to update the state of the program). All events that 146 * different times to do pooling, thereby making the code simpler and more
137 enter the system are passed to specific callback functions that the program 147 * efficient.
138 sets up to handle those events. Handling them is simple and other Ecore 148 * @see Ecore_Poller_Group
139 modules produce more events on the queue, coming from other sources such as 149 *
140 file descriptors etc. 150 * @subsection idler Idlers
141 151 *
142 Ecore also lets you have functions called when file descriptors become active 152 * There are three types of idlers, enterers, idlers(proper) and exiters, they
143 for reading or writing, allowing for streamlined, non-blocking IO. 153 * are called, respectively, when the program is about to enter an idle state,
144 154 * when the program is idle and when the program is leaving an idle state. Idler
145 Here is an example of a simple program and its basic event loop flow: 155 * enterers are usually a good place to update the program state. Proper idlers
146 156 * are the appropriate place to do heavy computational tasks thereby using what
147 @image html prog_flow.png 157 * would otherwise be wasted CPU cycles. Exiters are the perfect place to do
148 @image latex prog_flow.eps width=\textwidth 158 * anything your program should do just before processing events(also timers,
149 159 * poolers, file descriptor handlers and animators)
150 160 * @see Ecore_Idle_Group
151 161 *
152 @section work How does Ecore work? 162 * @subsection fd_handler File descriptor handlers
153 163 *
154 Ecore is very easy to learn and use. All the function calls are designed to 164 * File descriptor handlers allow you to monitor when there is data available to
155 be easy to remember, explicit in describing what they do, and heavily 165 * read on file descriptors, when writing will not block or if there was an
156 name-spaced. Ecore programs can start and be very simple. 166 * error. Any valid file descriptor can be used with this API, regardless of if
157 167 * was gotten with an OS specific API or from ecore.
158 For example: 168 * @see Ecore_FD_Handler_Group
159 169 *
160 @code 170 * @subsection animators Animators
161 #include <Ecore.h> 171 *
162 172 * Ecore provides a facility called animators, so named since the intended use
163 int 173 * was in animations, that facilitates knowing what percentage of a given
164 main(int argc, const char **argv) 174 * interval has elapsed. This is perfect for performing animations, but is not
165 { 175 * limited to that use, it can, for example, also be used to create a progress
166 ecore_init(); 176 * bar.
167 ecore_app_args_set(argc, argv); 177 * @see Ecore_Animator_Group
168 ecore_main_loop_begin(); 178 *
169 ecore_shutdown(); 179 * @subsection ev_handlers Event handlers
170 return 0; 180 *
171 } 181 * Event handlers are, arguably, the most important feature of the ecore main
172 @endcode 182 * loop, they are what allows the programmer to easily handle user interaction.
173 183 * Events however are not only things the user does, events can represent
174 This program is very simple and doesn't check for errors, but it does start up 184 * anything for which a type is created.
175 and begin a main loop waiting for events or timers to tick off. This program 185 * @see Ecore_Event_Group
176 doesn't set up any, but now we can expand on this simple program a little 186 *
177 more by adding some event handlers and timers. 187 * All of these primitives are discussed in more detail in their respective
178 188 * pages linked above.
179 @code 189 *
180 #include <Ecore.h> 190 * Here is a diagram of the main loop flow of a simple program:
181 191 *
182 Ecore_Timer *timer1 = NULL; 192 * @image html prog_flow.png
183 Ecore_Event_Handler *handler1 = NULL; 193 * @image latex prog_flow.eps width=\textwidth
184 double start_time = 0.0; 194 *
185 195 *
186 int 196 *
187 timer_func(void *data) 197 * @section work How does Ecore work?
188 { 198 *
189 printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); 199 * Ecore is very easy to learn and use. All the function calls are designed to
190 return 1; 200 * be easy to remember, explicit in describing what they do, and heavily
191 } 201 * name-spaced. Ecore programs can start and be very simple.
192 202 *
193 int 203 * For example:
194 exit_func(void *data, int ev_type, void *ev) 204 *
195 { 205 * @code
196 Ecore_Event_Signal_Exit *e; 206 * #include <Ecore.h>
197 207 *
198 e = (Ecore_Event_Signal_Exit *)ev; 208 * int
199 if (e->interrupt) printf("Exit: interrupt\n"); 209 * main(int argc, const char **argv)
200 else if (e->quit) printf("Exit: quit\n"); 210 * {
201 else if (e->terminate) printf("Exit: terminate\n"); 211 * ecore_init();
202 ecore_main_loop_quit(); 212 * ecore_app_args_set(argc, argv);
203 return 1; 213 * ecore_main_loop_begin();
204 } 214 * ecore_shutdown();
205 215 * return 0;
206 int 216 * }
207 main(int argc, const char **argv) 217 * @endcode
208 { 218 *
209 ecore_init(); 219 * This program is very simple and doesn't check for errors, but it does start up
210 ecore_app_args_set(argc, argv); 220 * and begin a main loop waiting for events or timers to tick off. This program
211 start_time = ecore_time_get(); 221 * doesn't set up any, but now we can expand on this simple program a little
212 handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); 222 * more by adding some event handlers and timers.
213 timer1 = ecore_timer_add(0.5, timer_func, NULL); 223 *
214 ecore_main_loop_begin(); 224 * @code
215 ecore_shutdown(); 225 * #include <Ecore.h>
216 return 0; 226 *
217 } 227 * Ecore_Timer *timer1 = NULL;
218 @endcode 228 * Ecore_Event_Handler *handler1 = NULL;
219 229 * double start_time = 0.0;
220 In the previous example, we initialize our application and get the time at 230 *
221 which our program has started so we can calculate an offset. We set 231 * int
222 up a timer to tick off in 0.5 seconds, and since it returns 1, will 232 * timer_func(void *data)
223 keep ticking off every 0.5 seconds until it returns 0, or is deleted 233 * {
224 by hand. An event handler is set up to call a function - 234 * printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time);
225 exit_func(), 235 * return 1;
226 whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C 236 * }
227 on the command line will cause such an event to happen). If this event 237 *
228 occurs it tells you what kind of exit signal was received, and asks 238 * int
229 the main loop to quit when it is finished by calling 239 * exit_func(void *data, int ev_type, void *ev)
230 ecore_main_loop_quit(). 240 * {
231 241 * Ecore_Event_Signal_Exit *e;
232 The handles returned by ecore_timer_add() and 242 *
233 ecore_event_handler_add() are 243 * e = (Ecore_Event_Signal_Exit *)ev;
234 only stored here as an example. If you don't need to address the timer or 244 * if (e->interrupt) printf("Exit: interrupt\n");
235 event handler again you don't need to store the result, so just call the 245 * else if (e->quit) printf("Exit: quit\n");
236 function, and don't assign the result to any variable. 246 * else if (e->terminate) printf("Exit: terminate\n");
237 247 * ecore_main_loop_quit();
238 This program looks slightly more complex than needed to do these simple 248 * return 1;
239 things, but in principle, programs don't get any more complex. You add more 249 * }
240 event handlers, for more events, will have more timers and such, BUT it all 250 *
241 follows the same principles as shown in this example. 251 * int
242 252 * main(int argc, const char **argv)
253 * {
254 * ecore_init();
255 * ecore_app_args_set(argc, argv);
256 * start_time = ecore_time_get();
257 * handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
258 * timer1 = ecore_timer_add(0.5, timer_func, NULL);
259 * ecore_main_loop_begin();
260 * ecore_shutdown();
261 * return 0;
262 * }
263 * @endcode
264 *
265 * In the previous example, we initialize our application and get the time at
266 * which our program has started so we can calculate an offset. We set
267 * up a timer to tick off in 0.5 seconds, and since it returns 1, will
268 * keep ticking off every 0.5 seconds until it returns 0, or is deleted
269 * by hand. An event handler is set up to call a function -
270 * exit_func(),
271 * whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C
272 * on the command line will cause such an event to happen). If this event
273 * occurs it tells you what kind of exit signal was received, and asks
274 * the main loop to quit when it is finished by calling
275 * ecore_main_loop_quit().
276 *
277 * The handles returned by ecore_timer_add() and
278 * ecore_event_handler_add() are
279 * only stored here as an example. If you don't need to address the timer or
280 * event handler again you don't need to store the result, so just call the
281 * function, and don't assign the result to any variable.
282 *
283 * This program looks slightly more complex than needed to do these simple
284 * things, but in principle, programs don't get any more complex. You add more
285 * event handlers, for more events, will have more timers and such, BUT it all
286 * follows the same principles as shown in this example.
287 *
243 */ 288 */
244 289
245/* 290/*
246 @page Ecore_Config_Page The Enlightened Property Library 291 @page Ecore_Config_Page The Enlightened Property Library
247 292
248 The Enlightened Property Library (Ecore_Config) is an adbstraction 293 The Enlightened Property Library (Ecore_Config) is an abstraction
249 from the complexities of writing your own configuration. It provides 294 from the complexities of writing your own configuration. It provides
250 many features using the Enlightenment 17 development libraries. 295 many features using the Enlightenment 17 development libraries.
251 296
@@ -310,7 +355,9 @@
310# include <signal.h> 355# include <signal.h>
311#else 356#else
312# include <sys/time.h> 357# include <sys/time.h>
313# include <signal.h> 358# if !defined (EXOTIC_NO_SIGNAL)
359# include <signal.h>
360# endif
314#endif 361#endif
315 362
316#include <sys/types.h> 363#include <sys/types.h>
@@ -333,47 +380,21 @@ EAPI int ecore_shutdown(void);
333 */ 380 */
334 381
335/** 382/**
383 * @defgroup Ecore_Main_Loop_Group Ecore main loop
336 * 384 *
337 * @defgroup Ecore_Main_Loop_Group Ecore main loop functions 385 * This group discusses functions that are acting on Ecore's main loop itself or
338 * 386 * on events and infrastructure directly linked to it. Most programs only need
339 * These are functions acting on Ecore's main loop itself or on 387 * to start and end the main loop, the rest of the function discussed here are
340 * events and infrastructure directly linked to it. This loop is 388 * meant to be used in special situations, and with great care.
341 * designed to work on embedded systems all the way to large and
342 * powerful multi-cpu workstations.
343 * 389 *
344 * It serialises all system signals and events into a single event 390 * For details on the usage of ecore's main loop and how it interacts with other
345 * queue, that can be easily processed without needing to worry 391 * ecore facilities see: @ref Ecore_Main_Loop_Page.
346 * about concurrency. A properly written, event-driven program
347 * using this kind of programming does not need threads. It makes
348 * the program very robust and easy to follow.
349 *
350 * For example, for the main loop to be of any use, you need to be
351 * able to add @b events and event handlers on it. Events for file
352 * descriptor events are covered in @ref Ecore_FD_Handler_Group.
353 *
354 * Timer functions are covered in @ref Ecore_Time_Group.
355 *
356 * There is also provision for callbacks for when the loop enters or
357 * exits an @b idle state. See @ref Ecore_Idle_Group for more
358 * information on it.
359 *
360 * Functions are also provided for spawning child processes using
361 * @c fork(). See @ref Ecore_Exe_Group for more details on it.
362 *
363 * Here is an example of simple program and its basic event loop
364 * flow:
365 *
366 * @image html prog_flow.png
367 * @image latex prog_flow.eps width=\textwidth
368 *
369 * For examples of setting up and using a main loop, see
370 * @ref Ecore_Main_Loop_Page.
371 * 392 *
372 * @{ 393 * @{
373 */ 394 */
374 395
375#define ECORE_VERSION_MAJOR 1 396#define ECORE_VERSION_MAJOR 1
376#define ECORE_VERSION_MINOR 0 397#define ECORE_VERSION_MINOR 2
377 398
378typedef struct _Ecore_Version 399typedef struct _Ecore_Version
379{ 400{
@@ -469,7 +490,7 @@ EAPI void *ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, void *d
469 * in this thread, if the main loop was suspended correctly. If not, it return @c -1. 490 * in this thread, if the main loop was suspended correctly. If not, it return @c -1.
470 * 491 *
471 * This function suspend the main loop in a know state, this let you 492 * This function suspend the main loop in a know state, this let you
472 * use any EFL call you want after it return. Be carefull, the main loop 493 * use any EFL call you want after it return. Be carefully, the main loop
473 * is blocked until you call ecore_thread_main_loop_end(). This is 494 * is blocked until you call ecore_thread_main_loop_end(). This is
474 * the only sane way to achieve pseudo thread safety. 495 * the only sane way to achieve pseudo thread safety.
475 * 496 *
@@ -489,7 +510,7 @@ EAPI int ecore_thread_main_loop_begin(void);
489 * the main loop is unlocked again. @c -1 will be returned if you are trying to unlock 510 * the main loop is unlocked again. @c -1 will be returned if you are trying to unlock
490 * when there wasn't enough call to ecore_thread_main_loop_begin(). 511 * when there wasn't enough call to ecore_thread_main_loop_begin().
491 * 512 *
492 * After a call to ecore_thread_main_loop_begin(), you need to absolutly 513 * After a call to ecore_thread_main_loop_begin(), you need to absolutely
493 * call ecore_thread_main_loop_end(), or you application will stay frozen. 514 * call ecore_thread_main_loop_end(), or you application will stay frozen.
494 */ 515 */
495EAPI int ecore_thread_main_loop_end(void); 516EAPI int ecore_thread_main_loop_end(void);
@@ -501,34 +522,51 @@ EAPI int ecore_thread_main_loop_end(void);
501/** 522/**
502 * @defgroup Ecore_Event_Group Ecore Event functions 523 * @defgroup Ecore_Event_Group Ecore Event functions
503 * 524 *
504 * Ecore events are used to wake up the Ecore main loop to warn 525 * Ecore events provide two main features that are of use to those using ecore:
505 * about state changes, tasks completed, data available for reading 526 * creating events and being notified of events. Those two will usually be used
506 * or writing, etc. They are the base of the event oriented 527 * in different contexts, creating events is mainly done by libraries wrapping
507 * programming. 528 * some system functionality while being notified of events is mainly a
508 * 529 * necessity of applications.
509 * The idea is to write many functions (callbacks) that will be 530 *
510 * registered to specific events, and called when these events 531 * For a program to be notified of events it's interested in it needs to have a
511 * happen. This way, when the system state changes (a mouse click is 532 * function to process the event and to register that function as the callback
512 * detected, a key is pressed, or the content of a file changes, for 533 * to the event, that's all:
513 * example), the respective callbacks will be called with some 534 * @code
514 * information about that event. Usually the function/callback will 535 * ecore_event_handler_add(EVENT_TYPE, _my_event_handler, some_data);
515 * have a data pointer to the event info (the position in the screen 536 * ...
516 * where the mouse was clicked, the name of the key that was 537 * static Eina_Bool
517 * pressed, or the name of the file that has changed). 538 * _my_event_handler(void *data, int type, void *event)
518 * 539 * {
519 * The basic usage, when one needs to watch for an existing event, 540 * //data is some_data
520 * is to register a callback to it using ecore_event_add(). Of 541 * //event is provided by whoever created the event
521 * course it's necessary to know beforehand what are the types of 542 * //Do really cool stuff with event
522 * events that the system/library will emmit. This should be 543 * }
523 * available with the documentation from that system/library. 544 * @endcode
524 * 545 *
525 * When writing a library or group of functions that need to inform 546 * One very important thing to note here is the @c EVENT_TYPE, to register a
526 * about something, and you already are running on top of a main 547 * handler for an event you must know it's type before hand. This information
527 * loop, it is usually a good approach to use events. This way you 548 * can be found on the documentation of the library emitting the signal, so,
528 * allow others to register as many callbacks as necessary to this 549 * for example, for events related to windowing one would look in @ref
529 * event, and don't have to care about who is registering to it. The 550 * Ecore_Evas_Group.
530 * functions ecore_event_type_new() and ecore_event_add() are 551 *
531 * available for this purpose. 552 * Examples of libraries that integrate into ecore's main loop by providing
553 * events are @ref Ecore_Con_Group, @ref Ecore_Evas_Group and @ref
554 * Ecore_Exe_Group amongst others. This usage can be divided into two parts,
555 * setup and adding events. The setup is very simple, all that needs doing is
556 * getting a type id for the event:
557 * @code
558 * int MY_EV_TYPE = ecore_event_type_new();
559 * @endcode
560 * @note This variable should be declared in the header since it'll be needed by
561 * anyone wishing to register a handler to your event.
562 *
563 * The complexity of adding of an event to the queue depends on whether that
564 * event sends uses @c event, if it doesn't it a one-liner:
565 * @code
566 * ecore_event_add(MY_EV_TYPE, NULL, NULL, NULL);
567 * @endcode
568 * The usage when an @c event is needed is not that much more complex and can be
569 * seen in @ref ecore_event_add.
532 * 570 *
533 * Example that deals with events: 571 * Example that deals with events:
534 * 572 *
@@ -582,7 +620,7 @@ struct _Ecore_Event_Signal_User /** User signal event */
582 int number; /**< The signal number. Either 1 or 2 */ 620 int number; /**< The signal number. Either 1 or 2 */
583 void *ext_data; /**< Extension data - not used */ 621 void *ext_data; /**< Extension data - not used */
584 622
585#if !defined (_WIN32) && !defined (__lv2ppu__) 623#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
586 siginfo_t data; /**< Signal info */ 624 siginfo_t data; /**< Signal info */
587#endif 625#endif
588}; 626};
@@ -591,7 +629,7 @@ struct _Ecore_Event_Signal_Hup /** Hup signal event */
591{ 629{
592 void *ext_data; /**< Extension data - not used */ 630 void *ext_data; /**< Extension data - not used */
593 631
594#if !defined (_WIN32) && !defined (__lv2ppu__) 632#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
595 siginfo_t data; /**< Signal info */ 633 siginfo_t data; /**< Signal info */
596#endif 634#endif
597}; 635};
@@ -600,10 +638,10 @@ struct _Ecore_Event_Signal_Exit /** Exit request event */
600{ 638{
601 Eina_Bool interrupt : 1; /**< Set if the exit request was an interrupt signal*/ 639 Eina_Bool interrupt : 1; /**< Set if the exit request was an interrupt signal*/
602 Eina_Bool quit : 1; /**< set if the exit request was a quit signal */ 640 Eina_Bool quit : 1; /**< set if the exit request was a quit signal */
603 Eina_Bool terminate : 1; /**< Set if the exit request was a terminate singal */ 641 Eina_Bool terminate : 1; /**< Set if the exit request was a terminate signal */
604 void *ext_data; /**< Extension data - not used */ 642 void *ext_data; /**< Extension data - not used */
605 643
606#if !defined (_WIN32) && !defined (__lv2ppu__) 644#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
607 siginfo_t data; /**< Signal info */ 645 siginfo_t data; /**< Signal info */
608#endif 646#endif
609}; 647};
@@ -612,7 +650,7 @@ struct _Ecore_Event_Signal_Power /** Power event */
612{ 650{
613 void *ext_data; /**< Extension data - not used */ 651 void *ext_data; /**< Extension data - not used */
614 652
615#if !defined (_WIN32) && !defined (__lv2ppu__) 653#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
616 siginfo_t data; /**< Signal info */ 654 siginfo_t data; /**< Signal info */
617#endif 655#endif
618}; 656};
@@ -621,21 +659,161 @@ struct _Ecore_Event_Signal_Realtime /** Realtime event */
621{ 659{
622 int num; /**< The realtime signal's number */ 660 int num; /**< The realtime signal's number */
623 661
624#if !defined (_WIN32) && !defined (__lv2ppu__) 662#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
625 siginfo_t data; /**< Signal info */ 663 siginfo_t data; /**< Signal info */
626#endif 664#endif
627}; 665};
628 666
667/**
668 * @brief Add an event handler.
669 * @param type The type of the event this handler will get called for
670 * @param func The function to call when the event is found in the queue
671 * @param data A data pointer to pass to the called function @p func
672 * @return A new Event handler, or NULL on failure
673 *
674 * Add an event handler to the list of handlers. This will, on success, return
675 * a handle to the event handler object that was created, that can be used
676 * later to remove the handler using ecore_event_handler_del(). The @p type
677 * parameter is the integer of the event type that will trigger this callback
678 * to be called. The callback @p func is called when this event is processed
679 * and will be passed the event type, a pointer to the private event
680 * structure that is specific to that event type, and a data pointer that is
681 * provided in this call as the @p data parameter.
682 *
683 * When the callback @p func is called, it must return 1 or 0. If it returns
684 * 1 (or ECORE_CALLBACK_PASS_ON), It will keep being called as per normal, for
685 * each handler set up for that event type. If it returns 0 (or
686 * ECORE_CALLBACK_DONE), it will cease processing handlers for that particular
687 * event, so all handler set to handle that event type that have not already
688 * been called, will not be.
689 */
629EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data); 690EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data);
691/**
692 * @brief Delete an event handler.
693 * @param event_handler Event handler handle to delete
694 * @return Data passed to handler
695 *
696 * Delete a specified event handler from the handler list. On success this will
697 * delete the event handler and return the pointer passed as @p data when the
698 * handler was added by ecore_event_handler_add(). On failure NULL will be
699 * returned. Once a handler is deleted it will no longer be called.
700 */
630EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler); 701EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler);
702/**
703 * @brief Add an event to the event queue.
704 * @param type The event type to add to the end of the event queue
705 * @param ev The data structure passed as @c event to event handlers
706 * @param func_free The function to be called to free @a ev
707 * @param data The data pointer to be passed to the free function
708 * @return A Handle for that event on success, otherwise NULL
709 *
710 * If it succeeds, an event of type @a type will be added to the queue for
711 * processing by event handlers added by ecore_event_handler_add(). The @a ev
712 * parameter will be passed as the @c event parameter of the handler. When the
713 * event is no longer needed, @a func_free will be called and passed @a ev for
714 * cleaning up. If @p func_free is NULL, free() will be called with the private
715 * structure pointer.
716 */
631EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data); 717EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data);
718/**
719 * @brief Delete an event from the queue.
720 * @param event The event handle to delete
721 * @return The data pointer originally set for the event free function
722 *
723 * This deletes the event @p event from the event queue, and returns the
724 * @p data parameter originally set when adding it with ecore_event_add(). This
725 * does not immediately call the free function, and it may be called later on
726 * cleanup, and so if the free function depends on the data pointer to work,
727 * you should defer cleaning of this till the free function is called later.
728 */
632EAPI void *ecore_event_del(Ecore_Event *event); 729EAPI void *ecore_event_del(Ecore_Event *event);
730/**
731 * @brief Get the data associated with an #Ecore_Event_Handler
732 * @param eh The event handler
733 * @return The data
734 *
735 * This function returns the data previously associated with @p eh by
736 * ecore_event_handler_add().
737 */
633EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh); 738EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh);
739/**
740 * @brief Set the data associated with an #Ecore_Event_Handler
741 * @param eh The event handler
742 * @param data The data to associate
743 * @return The previous data
744 *
745 * This function sets @p data to @p eh and returns the old data pointer
746 * which was previously associated with @p eh by ecore_event_handler_add().
747 */
634EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data); 748EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data);
749/**
750 * @brief Allocate a new event type id sensibly and return the new id.
751 * @return A new event type id.
752 *
753 * This function allocates a new event type id and returns it. Once an event
754 * type has been allocated it can never be de-allocated during the life of
755 * the program. There is no guarantee of the contents of this event ID, or how
756 * it is calculated, except that the ID will be unique to the current instance
757 * of the process.
758 */
635EAPI int ecore_event_type_new(void); 759EAPI int ecore_event_type_new(void);
760/**
761 * @brief Add a filter the current event queue.
762 *
763 * @param func_start Function to call just before filtering and return data
764 * @param func_filter Function to call on each event
765 * @param func_end Function to call after the queue has been filtered
766 * @param data Data to pass to the filter functions
767 * @return A filter handle on success, NULL otherwise
768 *
769 * Adds a callback to filter events from the event queue. Filters are called on
770 * the queue just before Event handler processing to try and remove redundant
771 * events. Just as processing is about to start @a func_start is called and
772 * passed the @a data pointer, the return value of this functions is passed to
773 * @a func_filter as loop_data. @a func_filter is also passed @a data and the
774 * event type and event structure. If this @a func_filter returns #EINA_FALSE,
775 * the event is removed from the queue, if it returns #EINA_TRUE, the event is
776 * kept. When processing is finished @p func_end is called and is passed the
777 * loop_data(returned by @c func_start) and @p data pointer to clean up.
778 */
636EAPI Ecore_Event_Filter *ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data); 779EAPI Ecore_Event_Filter *ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, Ecore_End_Cb func_end, const void *data);
780/**
781 * @brief Delete an event filter.
782 * @param ef The event filter handle
783 * @return The data set for the filter on success, NULL otherwise
784 *
785 * Delete a filter that has been added by its @p ef handle.
786 */
637EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef); 787EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef);
788/**
789 * @brief Return the current event type being handled.
790 * @return The current event type being handled if inside a handler callback,
791 * ECORE_EVENT_NONE otherwise
792 *
793 * If the program is currently inside an Ecore event handler callback this
794 * will return the type of the current event being processed.
795 *
796 * This is useful when certain Ecore modules such as Ecore_Evas "swallow"
797 * events and not all the original information is passed on. In special cases
798 * this extra information may be useful or needed and using this call can let
799 * the program know if the event type being handled is one it wants to get more
800 * information about.
801 */
638EAPI int ecore_event_current_type_get(void); 802EAPI int ecore_event_current_type_get(void);
803/**
804 * @brief Return the current event type pointer handled.
805 * @return The current event pointer being handled if inside a handler callback,
806 * NULL otherwise
807 *
808 * If the program is currently inside an Ecore event handler callback this
809 * will return the pointer of the current event being processed.
810 *
811 * This is useful when certain Ecore modules such as Ecore_Evas "swallow"
812 * events and not all the original information is passed on. In special cases
813 * this extra information may be useful or needed and using this call can let
814 * the program access the event data if the type of the event is handled by
815 * the program.
816 */
639EAPI void *ecore_event_current_event_get(void); 817EAPI void *ecore_event_current_event_get(void);
640 818
641/** 819/**
@@ -652,7 +830,8 @@ EAPI void *ecore_event_current_event_get(void);
652 * @{ 830 * @{
653 */ 831 */
654 832
655 #define ECORE_EXE_PRIORITY_INHERIT 9999 833/** Inherit priority from parent process */
834#define ECORE_EXE_PRIORITY_INHERIT 9999
656 835
657EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */ 836EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */
658EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistent with the rest of ecore). */ 837EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistent with the rest of ecore). */
@@ -715,7 +894,7 @@ struct _Ecore_Exe_Event_Del /** Process exit event */
715 Eina_Bool exited : 1; /** < set to 1 if the process exited of its own accord */ 894 Eina_Bool exited : 1; /** < set to 1 if the process exited of its own accord */
716 Eina_Bool signalled : 1; /** < set to 1 id the process exited due to uncaught signal */ 895 Eina_Bool signalled : 1; /** < set to 1 id the process exited due to uncaught signal */
717 void *ext_data; /**< Extension data - not used */ 896 void *ext_data; /**< Extension data - not used */
718#if !defined (_WIN32) && !defined (__lv2ppu__) 897#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL)
719 siginfo_t data; /**< Signal info */ 898 siginfo_t data; /**< Signal info */
720#endif 899#endif
721}; 900};
@@ -768,24 +947,30 @@ EAPI void ecore_exe_hup(Ecore_Exe *exe);
768/** 947/**
769 * @defgroup Ecore_FD_Handler_Group File Event Handling Functions 948 * @defgroup Ecore_FD_Handler_Group File Event Handling Functions
770 * 949 *
771 * Functions that deal with file descriptor handlers. 950 * @brief Functions that deal with file descriptor handlers.
951 *
952 * File descriptor handlers facilitate reading, writing and checking for errors
953 * without blocking the program or doing expensive pooling. This can be used to
954 * monitor a socket, pipe, or other stream for which an FD can be had.
772 * 955 *
773 * The @ref Ecore_Fd_Handler can be used to watch a file descriptor 956 * @warning This function @b can't be used for monitoring to regular files!
774 * for data available for reading, for the availability to write
775 * without blocking, and for errors on the file descriptor.
776 * 957 *
777 *ecore_main_fd_handler_add() is used to setup a handler for a 958 * One common FD to be monitored is the standard input(stdin), monitoring it for
778 * given file descriptor. This file descriptor can be the standard 959 * reading requires a single call:
779 * input, a network socket, a stream received through some driver 960 * @code
780 * of a hardware decoder, etc. Thus it can contain errors, like a 961 * static Eina_Bool
781 * disconnection, a broken pipe, and so, and that's why it's 962 * _my_cb_func(void *data, Ecore_Fd_Handler *handler)
782 * possible to check for these errors with the @ref ECORE_FD_ERROR 963 * {
783 * flag. 964 * char c;
965 * scanf("%c", &c); //Guaranteed not to block
966 * ... do stuff with c ...
967 * }
968 * ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _my_cb_func, NULL, NULL, NULL);
969 * @endcode
784 * 970 *
785 * An @ref Ecore_Fd_Handler can be used to watch on a file 971 * When using a socket, pipe or other stream it's important to remember that
786 * descriptor without blocking, still being able to receive events, 972 * errors may occur and as such to monitor not only for reading/writing but also
787 * expire timers, and other watch for other things that happen in 973 * for errors using the @ref ECORE_FD_ERROR flag.
788 * the Ecore main loop.
789 * 974 *
790 * Example of use of a file descriptor handler: 975 * Example of use of a file descriptor handler:
791 * @li @ref ecore_fd_handler_example_c 976 * @li @ref ecore_fd_handler_example_c
@@ -823,11 +1008,93 @@ typedef void (*Ecore_Fd_Prep_Cb)(void *data, Ecore_Fd_Handler *fd_handler);
823 */ 1008 */
824typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh); 1009typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh);
825 1010
1011/**
1012 * @brief Adds a callback for activity on the given file descriptor.
1013 *
1014 * @param fd The file descriptor to watch.
1015 * @param flags To monitor it for reading use @c ECORE_FD_READ, for writing @c
1016 * ECORE_FD_WRITE, and for error @c ECORE_FD_ERROR. Values bay |(ored).
1017 * @param func The callback function.
1018 * @param data The data to pass to the callback.
1019 * @param buf_func The function to call to check if any data has been buffered
1020 * and already read from the fd. May be @c NULL.
1021 * @param buf_data The data to pass to the @p buf_func function.
1022 * @return A fd handler handle on success, @c NULL otherwise.
1023 *
1024 * @a func will be called during the execution of @ref Ecore_Main_Loop_Page
1025 * when the file descriptor is available for reading, writing, or there has been
1026 * an error(depending on the given @a flags).
1027 *
1028 * When @a func returns ECORE_CALLBACK_CANCEL, it indicates that the
1029 * handler should be marked for deletion (identical to calling @ref
1030 * ecore_main_fd_handler_del).
1031 *
1032 * @warning @a buf_func is meant for @b internal use only and should be @b
1033 * avoided.
1034 *
1035 * The return value of @a buf_func has a different meaning, when it returns
1036 * ECORE_CALLBACK_CANCEL, it indicates that @a func @b shouldn't be called, and
1037 * when it returns ECORE_CALLBACK_RENEW it indicates @a func should be called.
1038 * The return value of @a buf_func will not cause the FD handler to be deleted.
1039 *
1040 * @a buf_func is called during event loop handling to check if data that has
1041 * been read from the file descriptor is in a buffer and is available to read.
1042 * Some systems, notably xlib, handle their own buffering, and would otherwise
1043 * not work with select(). These systems should use a @a buf_func. This is a
1044 * most annoying hack, only ecore_x uses it, so refer to that for an example.
1045 */
826EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data); 1046EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data);
1047/**
1048 * @brief Set the prepare callback with data for a given #Ecore_Fd_Handler
1049 *
1050 * @param fd_handler The fd handler
1051 * @param func The prep function
1052 * @param data The data to pass to the prep function
1053 *
1054 * This function will be called prior to any fd handler's callback function
1055 * (even the other fd handlers), before entering the main loop select function.
1056 *
1057 * @note Once a prepare callback is set for a fd handler, it cannot be changed.
1058 * You need to delete the fd handler and create a new one, to set another
1059 * callback.
1060 * @note You probably don't need this function. It is only necessary for very
1061 * uncommon cases that need special behavior.
1062 */
827EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data); 1063EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data);
1064/**
1065 * @brief Marks an FD handler for deletion.
1066 * @param fd_handler The FD handler.
1067 * @return The data pointer set using @ref ecore_main_fd_handler_add, for @a
1068 * fd_handler on success, @c NULL otherwise.
1069 * This function marks an fd handler to be deleted during an iteration of the
1070 * main loop. It does NOT close the associated fd!
1071 *
1072 * @warning If the underlying fd is already closed ecore may complain if the
1073 * main loop is using epoll internally, and also in some rare cases this may
1074 * cause crashes and instability. Remember to delete your fd handlers before the
1075 * fds they listen to are closed.
1076 */
828EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); 1077EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
1078/**
1079 * @brief Retrieves the file descriptor that the given handler is handling.
1080 * @param fd_handler The given FD handler.
1081 * @return The file descriptor the handler is watching.
1082 */
829EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler); 1083EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
1084/**
1085 * @brief Gets which flags are active on an FD handler.
1086 * @param fd_handler The given FD handler.
1087 * @param flags The flags, @c ECORE_FD_READ, @c ECORE_FD_WRITE or @c
1088 * ECORE_FD_ERROR to query.
1089 * @return #EINA_TRUE if any of the given flags are active, #EINA_FALSE
1090 * otherwise.
1091 */
830EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); 1092EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
1093/**
1094 * @brief Set what active streams the given FD handler should be monitoring.
1095 * @param fd_handler The given FD handler.
1096 * @param flags The flags to be watching.
1097 */
831EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); 1098EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
832 1099
833EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data); 1100EAPI Ecore_Win32_Handler *ecore_main_win32_handler_add(void *h, Ecore_Win32_Handle_Cb func, const void *data);
@@ -840,13 +1107,30 @@ EAPI void *ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler);
840/** 1107/**
841 * @defgroup Ecore_Poller_Group Ecore Poll functions 1108 * @defgroup Ecore_Poller_Group Ecore Poll functions
842 * 1109 *
843 * These functions are for the need to poll information, but provide 1110 * Ecore poller provides infrastructure for the creation of pollers. Pollers
844 * a shared abstracted API to pool such polling to minimise wakeup 1111 * are, in essence, callbacks that share a single timer per type. Because not
845 * and ensure all the polling happens in as few spots as possible 1112 * all pollers need to be called at the same frequency the user may specify the
846 * areound a core poll interval. For now only 1 core poller type is 1113 * frequency in ticks(each expiration of the shared timer is called a tick, in
847 * supprted: ECORE_POLLER_CORE 1114 * ecore poller parlance) for each added poller. Ecore pollers should only be
1115 * used when the poller doesn't have specific requirements on the exact times
1116 * to poll.
848 * 1117 *
849 * Example of @ref Ecore_Poller : 1118 * This architecture means that the main loop is only woken up once to handle
1119 * all pollers of that type, this will save power as the CPU has more of a
1120 * chance to go into a low power state the longer it is asleep for, so this
1121 * should be used in situations where power usage is a concern.
1122 *
1123 * For now only 1 core poller type is supported: ECORE_POLLER_CORE, the default
1124 * interval for ECORE_POLLER_CORE is 0.125(or 1/8th) second.
1125 *
1126 * The creation of a poller is extremely simple and only required one line:
1127 * @code
1128 * ecore_poller_add(ECORE_POLLER_CORE, 1, my_poller_function, NULL);
1129 * @endcode
1130 * This sample creates a poller to call @c my_poller_function at every tick with
1131 * @c NULL as data.
1132 *
1133 * Example:
850 * @li @ref ecore_poller_example_c 1134 * @li @ref ecore_poller_example_c
851 * 1135 *
852 * @ingroup Ecore_Main_Loop_Group 1136 * @ingroup Ecore_Main_Loop_Group
@@ -862,11 +1146,76 @@ typedef enum _Ecore_Poller_Type Ecore_Poller_Type;
862 1146
863typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */ 1147typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */
864 1148
1149/**
1150 * @brief Sets the time(in seconds) between ticks for the given poller type.
1151 * @param type The poller type to adjust.
1152 * @param poll_time The time(in seconds) between ticks of the timer.
1153 *
1154 * This will adjust the time between ticks of the given timer type defined by
1155 * @p type to the time period defined by @p poll_time.
1156 */
865EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time); 1157EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time);
1158/**
1159 * @brief Gets the time(in seconds) between ticks for the given poller type.
1160 * @param type The poller type to query.
1161 * @return The time in seconds between ticks of the poller timer.
1162 *
1163 * This will get the time between ticks of the specified poller timer.
1164 */
866EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type); 1165EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type);
1166/**
1167 * @brief Changes the polling interval rate of @p poller.
1168 * @param poller The Ecore_Poller to change the interval of.
1169 * @param interval The tick interval to set; must be a power of 2 and <= 32768.
1170 * @return Returns true on success, false on failure.
1171 *
1172 * This allows the changing of a poller's polling interval. It is useful when
1173 * you want to alter a poll rate without deleting and re-creating a poller.
1174 */
867EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval); 1175EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval);
1176/**
1177 * @brief Gets the polling interval rate of @p poller.
1178 * @param poller The Ecore_Poller to change the interval of.
1179 * @return Returns the interval, in ticks, that @p poller polls at.
1180 *
1181 * This returns a poller's polling interval, or 0 on error.
1182 */
868EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller); 1183EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller);
1184/**
1185 * @brief Creates a poller to call the given function at a particular tick interval.
1186 * @param type The ticker type to attach the poller to. Must be ECORE_POLLER_CORE.
1187 * @param interval The poll interval.
1188 * @param func The poller function.
1189 * @param data Data to pass to @a func when it is called.
1190 * @return A poller object on success, @c NULL otherwise.
1191 *
1192 * This function adds @a func as a poller callback that will be called every @a
1193 * interval ticks together with other pollers of type @a type. @a func will be
1194 * passed the @p data pointer as a parameter.
1195 *
1196 * The @p interval must be between 1 and 32768 inclusive, and must be a power of
1197 * 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768). The exact tick in which @a func
1198 * will be called is undefined, as only the interval between calls can be
1199 * defined. Ecore will endeavor to keep pollers synchronized and to call as
1200 * many in 1 wakeup event as possible. If @a interval is not a power of two, the
1201 * closest power of 2 greater than @a interval will be used.
1202 *
1203 * When the poller @p func is called, it must return a value of either
1204 * ECORE_CALLBACK_RENEW(or 1) or ECORE_CALLBACK_CANCEL(or 0). If it
1205 * returns 1, it will be called again at the next tick, or if it returns
1206 * 0 it will be deleted automatically making any references/handles for it
1207 * invalid.
1208 */
869EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data); 1209EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data);
1210/**
1211 * @brief Delete the specified poller from the timer list.
1212 * @param poller The poller to delete.
1213 * @return The data pointer set for the timer when @ref ecore_poller_add was
1214 * called on success, @c NULL otherwise.
1215 *
1216 * @note @a poller must be a valid handle. If the poller function has already
1217 * returned 0, the handle is no longer valid (and does not need to be deleted).
1218 */
870EAPI void *ecore_poller_del(Ecore_Poller *poller); 1219EAPI void *ecore_poller_del(Ecore_Poller *poller);
871 1220
872/** 1221/**
@@ -941,7 +1290,7 @@ typedef enum _Ecore_Animator_Source Ecore_Animator_Source;
941typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos); 1290typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos);
942 1291
943/** 1292/**
944 * @brief Add an animator to call @p func at every animaton tick during main 1293 * @brief Add an animator to call @p func at every animation tick during main
945 * loop execution. 1294 * loop execution.
946 * 1295 *
947 * @param func The function to call when it ticks off 1296 * @param func The function to call when it ticks off
@@ -1011,7 +1360,7 @@ EAPI void *ecore_animator_del(Ecore_Animator *animator);
1011 * 1360 *
1012 * @param animator The animator to delete 1361 * @param animator The animator to delete
1013 * 1362 *
1014 * The specified @p animator will be temporarly removed from the set of 1363 * The specified @p animator will be temporarily removed from the set of
1015 * animators that are executed during main loop. 1364 * animators that are executed during main loop.
1016 * 1365 *
1017 * @warning Freezing an animator doesn't freeze accounting of how long that 1366 * @warning Freezing an animator doesn't freeze accounting of how long that
@@ -1069,7 +1418,7 @@ EAPI double ecore_animator_frametime_get(void);
1069 * has "overshot" the mark) using some interpolation (mapping) algorithm. 1418 * has "overshot" the mark) using some interpolation (mapping) algorithm.
1070 * 1419 *
1071 * This function useful to create non-linear animations. It offers a variety 1420 * This function useful to create non-linear animations. It offers a variety
1072 * of possible animaton curves to be used: 1421 * of possible animation curves to be used:
1073 * @li ECORE_POS_MAP_LINEAR - Linear, returns @p pos 1422 * @li ECORE_POS_MAP_LINEAR - Linear, returns @p pos
1074 * @li ECORE_POS_MAP_ACCELERATE - Start slow then speed up 1423 * @li ECORE_POS_MAP_ACCELERATE - Start slow then speed up
1075 * @li ECORE_POS_MAP_DECELERATE - Start fast then slow down 1424 * @li ECORE_POS_MAP_DECELERATE - Start fast then slow down
@@ -1107,7 +1456,7 @@ EAPI double ecore_animator_frametime_get(void);
1107 * y = (y1 * out) + (y2 * (1.0 - out)); 1456 * y = (y1 * out) + (y2 * (1.0 - out));
1108 * move_my_object_to(myobject, x, y); 1457 * move_my_object_to(myobject, x, y);
1109 * @endcode 1458 * @endcode
1110 * This will make an animaton that bounces 7 each times diminishing by a 1459 * This will make an animation that bounces 7 each times diminishing by a
1111 * factor of 1.8. 1460 * factor of 1.8.
1112 * 1461 *
1113 * @see _Ecore_Pos_Map 1462 * @see _Ecore_Pos_Map
@@ -1205,16 +1554,39 @@ EAPI void ecore_animator_custom_tick(void);
1205 */ 1554 */
1206 1555
1207/** 1556/**
1208 * @defgroup Ecore_Time_Group Ecore Time functions 1557 * @defgroup Ecore_Time_Group Ecore time functions
1209 *
1210 * Functions that deal with time. These functions include those
1211 * that simply retrieve it in a given format, and those that create
1212 * events based on it.
1213 * 1558 *
1214 * The timer allows callbacks to be called at specific intervals. 1559 * These are function to retrieve time in a given format.
1215 * 1560 *
1216 * Examples with functions that deal with time: 1561 * Examples:
1217 * @li @ref ecore_time_functions_example_c 1562 * @li @ref ecore_time_functions_example_c
1563 * @{
1564 */
1565EAPI double ecore_time_get(void);
1566EAPI double ecore_time_unix_get(void);
1567EAPI double ecore_loop_time_get(void);
1568
1569/**
1570 * @}
1571 */
1572
1573/**
1574 * @defgroup Ecore_Timer_Group Ecore Timer functions
1575 *
1576 * Ecore provides very flexible timer functionality. The basic usage of timers,
1577 * to call a certain function at a certain interval can be achieved with a
1578 * single line:
1579 * @code
1580 * Eina_Bool my_func(void *data) {
1581 * do_funky_stuff_with_data(data);
1582 * return EINA_TRUE;
1583 * }
1584 * ecore_timer_add(interval_in_seconds, my_func, data_given_to_function);
1585 * @endcode
1586 * @note If the function was to be executed only once simply return EINA_FALSE
1587 * instead.
1588 *
1589 * An example that shows the usage of a lot of these:
1218 * @li @ref ecore_timer_example_c 1590 * @li @ref ecore_timer_example_c
1219 * 1591 *
1220 * @ingroup Ecore_Main_Loop_Group 1592 * @ingroup Ecore_Main_Loop_Group
@@ -1224,10 +1596,6 @@ EAPI void ecore_animator_custom_tick(void);
1224 1596
1225typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */ 1597typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */
1226 1598
1227EAPI double ecore_time_get(void);
1228EAPI double ecore_time_unix_get(void);
1229EAPI double ecore_loop_time_get(void);
1230
1231EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data); 1599EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data);
1232EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data); 1600EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data);
1233EAPI void *ecore_timer_del(Ecore_Timer *timer); 1601EAPI void *ecore_timer_del(Ecore_Timer *timer);
@@ -1249,14 +1617,15 @@ EAPI char *ecore_timer_dump(void);
1249/** 1617/**
1250 * @defgroup Ecore_Idle_Group Ecore Idle functions 1618 * @defgroup Ecore_Idle_Group Ecore Idle functions
1251 * 1619 *
1252 * Callbacks that are called when the program enters or exits an 1620 * The idler functionality in Ecore allows for callbacks to be called when the
1253 * idle state. 1621 * program isn't handling @ref Ecore_Event_Group "events", @ref Ecore_Timer_Group
1622 * "timers" or @ref Ecore_FD_Handler_Group "fd handlers".
1254 * 1623 *
1255 * The ecore main loop enters an idle state when it is waiting for 1624 * There are three types of idlers: Enterers, Idlers(proper) and Exiters. They
1256 * timers to time out, data to come in on a file descriptor or any 1625 * are called, respectively, when the program is about to enter an idle state,
1257 * other event to occur. You can set callbacks to be called when 1626 * when the program is in an idle state and when the program has just left an
1258 * the main loop enters an idle state, during an idle state or just 1627 * idle state and will begin processing @ref Ecore_Event_Group "events", @ref
1259 * after the program wakes up. 1628 * Ecore_Timer_Group "timers" or @ref Ecore_FD_Handler_Group "fd handlers".
1260 * 1629 *
1261 * Enterer callbacks are good for updating your program's state, if 1630 * Enterer callbacks are good for updating your program's state, if
1262 * it has a state engine. Once all of the enterer handlers are 1631 * it has a state engine. Once all of the enterer handlers are
@@ -1266,14 +1635,13 @@ EAPI char *ecore_timer_dump(void);
1266 * enterer handlers. They are useful for interfaces that require 1635 * enterer handlers. They are useful for interfaces that require
1267 * polling and timers would be too slow to use. 1636 * polling and timers would be too slow to use.
1268 * 1637 *
1638 * Exiter callbacks are called when the main loop wakes up from an idle state.
1639 *
1269 * If no idler callbacks are specified, then the process literally 1640 * If no idler callbacks are specified, then the process literally
1270 * goes to sleep. Otherwise, the idler callbacks are called 1641 * goes to sleep. Otherwise, the idler callbacks are called
1271 * continuously while the loop is "idle", using as much CPU as is 1642 * continuously while the loop is "idle", using as much CPU as is
1272 * available to the process. 1643 * available to the process.
1273 * 1644 *
1274 * Exiter callbacks are called when the main loop wakes up from an
1275 * idle state.
1276 *
1277 * @note Idle state doesn't mean that the @b program is idle, but 1645 * @note Idle state doesn't mean that the @b program is idle, but
1278 * that the <b>main loop</b> is idle. It doesn't have any timers, 1646 * that the <b>main loop</b> is idle. It doesn't have any timers,
1279 * events, fd handlers or anything else to process (which in most 1647 * events, fd handlers or anything else to process (which in most
@@ -1343,7 +1711,7 @@ EAPI void *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter);
1343 * thread, the one running the main loop. This problem can be solved 1711 * thread, the one running the main loop. This problem can be solved
1344 * by running a thread that sends messages to the main one using an 1712 * by running a thread that sends messages to the main one using an
1345 * @ref Ecore_Pipe_Group "Ecore_Pipe", but when you need to handle other 1713 * @ref Ecore_Pipe_Group "Ecore_Pipe", but when you need to handle other
1346 * things like cancelling the thread, your code grows in coplexity and gets 1714 * things like cancelling the thread, your code grows in complexity and gets
1347 * much harder to maintain. 1715 * much harder to maintain.
1348 * 1716 *
1349 * Ecore Thread is here to solve that problem. It is @b not a simple wrapper 1717 * Ecore Thread is here to solve that problem. It is @b not a simple wrapper
@@ -1514,7 +1882,7 @@ EAPI Ecore_Thread *ecore_thread_run(Ecore_Thread_Cb func_blocking, Ecore_Thread_
1514 * with ecore_thread_feedback(). 1882 * with ecore_thread_feedback().
1515 * 1883 *
1516 * Like with ecore_thread_run(), a new thread will be launched to run 1884 * Like with ecore_thread_run(), a new thread will be launched to run
1517 * @p func_heavy unless the maximum number of simultaneous threadas has been 1885 * @p func_heavy unless the maximum number of simultaneous threads has been
1518 * reached, in which case the function will be scheduled to run whenever a 1886 * reached, in which case the function will be scheduled to run whenever a
1519 * running task ends and a thread becomes free. But if @p try_no_queue is 1887 * running task ends and a thread becomes free. But if @p try_no_queue is
1520 * set, Ecore will first try to launch a thread outside of the pool to run 1888 * set, Ecore will first try to launch a thread outside of the pool to run
@@ -2076,7 +2444,7 @@ EAPI int ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait);
2076 * also will be executed in the order in which they were added. 2444 * also will be executed in the order in which they were added.
2077 * 2445 *
2078 * A good use for them is when you don't want to execute an action 2446 * A good use for them is when you don't want to execute an action
2079 * immeditately, but want to give the control back to the main loop 2447 * immediately, but want to give the control back to the main loop
2080 * so that it will call your job callback when jobs start being 2448 * so that it will call your job callback when jobs start being
2081 * processed (and if there are other jobs added before yours, they 2449 * processed (and if there are other jobs added before yours, they
2082 * will be processed first). This also gives the chance to other 2450 * will be processed first). This also gives the chance to other
diff --git a/libraries/ecore/src/lib/ecore/Makefile.am b/libraries/ecore/src/lib/ecore/Makefile.am
index ec3d99f..6f14387 100644
--- a/libraries/ecore/src/lib/ecore/Makefile.am
+++ b/libraries/ecore/src/lib/ecore/Makefile.am
@@ -47,6 +47,12 @@ libecore_la_SOURCES += ecore_exe_ps3.c
47 47
48else 48else
49 49
50if ECORE_HAVE_EXOTIC
51
52libecore_la_SOURCES +=
53
54else
55
50libecore_la_SOURCES += ecore_signal.c ecore_exe.c 56libecore_la_SOURCES += ecore_signal.c ecore_exe.c
51 57
52endif 58endif
@@ -55,6 +61,8 @@ endif
55 61
56endif 62endif
57 63
64endif
65
58libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm 66libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm
59libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ 67libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@
60 68
diff --git a/libraries/ecore/src/lib/ecore/Makefile.in b/libraries/ecore/src/lib/ecore/Makefile.in
index 66a25cd..71e2ac4 100644
--- a/libraries/ecore/src/lib/ecore/Makefile.in
+++ b/libraries/ecore/src/lib/ecore/Makefile.in
@@ -38,7 +38,8 @@ host_triplet = @host@
38@ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_exe_win32.c 38@ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_exe_win32.c
39@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__append_2 = ecore_exe_wince.c 39@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__append_2 = ecore_exe_wince.c
40@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_3 = ecore_exe_ps3.c 40@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_3 = ecore_exe_ps3.c
41@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_4 = ecore_signal.c ecore_exe.c 41@ECORE_HAVE_EXOTIC_TRUE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_4 =
42@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_5 = ecore_signal.c ecore_exe.c
42subdir = src/lib/ecore 43subdir = src/lib/ecore
43DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ 44DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \
44 $(srcdir)/Makefile.in 45 $(srcdir)/Makefile.in
@@ -54,16 +55,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
54 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 55 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
55 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 56 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
56 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 57 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
57 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 58 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
58 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 59 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
59 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 60 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
60 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 61 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
61 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 62 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
62 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 63 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
63 $(top_srcdir)/configure.ac
64am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 64am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
65 $(ACLOCAL_M4) 65 $(ACLOCAL_M4)
66mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 66mkinstalldirs = $(install_sh) -d
67CONFIG_HEADER = $(top_builddir)/config.h 67CONFIG_HEADER = $(top_builddir)/config.h
68CONFIG_CLEAN_FILES = 68CONFIG_CLEAN_FILES =
69CONFIG_CLEAN_VPATH_FILES = 69CONFIG_CLEAN_VPATH_FILES =
@@ -100,15 +100,16 @@ am__libecore_la_SOURCES_DIST = ecore.c ecore_alloc.c ecore_anim.c \
100@ECORE_HAVE_WIN32_TRUE@am__objects_1 = ecore_exe_win32.lo 100@ECORE_HAVE_WIN32_TRUE@am__objects_1 = ecore_exe_win32.lo
101@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__objects_2 = ecore_exe_wince.lo 101@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__objects_2 = ecore_exe_wince.lo
102@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_3 = ecore_exe_ps3.lo 102@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_3 = ecore_exe_ps3.lo
103@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_4 = ecore_signal.lo \ 103am__objects_4 =
104@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@ ecore_exe.lo 104@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_5 = ecore_signal.lo \
105@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@ ecore_exe.lo
105am_libecore_la_OBJECTS = ecore.lo ecore_alloc.lo ecore_anim.lo \ 106am_libecore_la_OBJECTS = ecore.lo ecore_alloc.lo ecore_anim.lo \
106 ecore_app.lo ecore_events.lo ecore_getopt.lo \ 107 ecore_app.lo ecore_events.lo ecore_getopt.lo \
107 ecore_idle_enterer.lo ecore_idle_exiter.lo ecore_idler.lo \ 108 ecore_idle_enterer.lo ecore_idle_exiter.lo ecore_idler.lo \
108 ecore_job.lo ecore_main.lo ecore_pipe.lo ecore_poll.lo \ 109 ecore_job.lo ecore_main.lo ecore_pipe.lo ecore_poll.lo \
109 ecore_time.lo ecore_timer.lo ecore_thread.lo ecore_glib.lo \ 110 ecore_time.lo ecore_timer.lo ecore_thread.lo ecore_glib.lo \
110 ecore_throttle.lo $(am__objects_1) $(am__objects_2) \ 111 ecore_throttle.lo $(am__objects_1) $(am__objects_2) \
111 $(am__objects_3) $(am__objects_4) 112 $(am__objects_3) $(am__objects_4) $(am__objects_5)
112libecore_la_OBJECTS = $(am_libecore_la_OBJECTS) 113libecore_la_OBJECTS = $(am_libecore_la_OBJECTS)
113AM_V_lt = $(am__v_lt_$(V)) 114AM_V_lt = $(am__v_lt_$(V))
114am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) 115am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -211,6 +212,8 @@ EVAS_LIBS = @EVAS_LIBS@
211EVIL_CFLAGS = @EVIL_CFLAGS@ 212EVIL_CFLAGS = @EVIL_CFLAGS@
212EVIL_LIBS = @EVIL_LIBS@ 213EVIL_LIBS = @EVIL_LIBS@
213EXEEXT = @EXEEXT@ 214EXEEXT = @EXEEXT@
215EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
216EXOTIC_LIBS = @EXOTIC_LIBS@
214FGREP = @FGREP@ 217FGREP = @FGREP@
215GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 218GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
216GLIB_CFLAGS = @GLIB_CFLAGS@ 219GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -266,6 +269,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
266PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 269PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
267PIXMAN_LIBS = @PIXMAN_LIBS@ 270PIXMAN_LIBS = @PIXMAN_LIBS@
268PKG_CONFIG = @PKG_CONFIG@ 271PKG_CONFIG = @PKG_CONFIG@
272PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
273PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
269POSUB = @POSUB@ 274POSUB = @POSUB@
270RANLIB = @RANLIB@ 275RANLIB = @RANLIB@
271SCIM_CFLAGS = @SCIM_CFLAGS@ 276SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -276,6 +281,7 @@ SDL_LIBS = @SDL_LIBS@
276SED = @SED@ 281SED = @SED@
277SET_MAKE = @SET_MAKE@ 282SET_MAKE = @SET_MAKE@
278SHELL = @SHELL@ 283SHELL = @SHELL@
284SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
279SSL_CFLAGS = @SSL_CFLAGS@ 285SSL_CFLAGS = @SSL_CFLAGS@
280SSL_LIBS = @SSL_LIBS@ 286SSL_LIBS = @SSL_LIBS@
281STRIP = @STRIP@ 287STRIP = @STRIP@
@@ -503,7 +509,8 @@ libecore_la_SOURCES = ecore.c ecore_alloc.c ecore_anim.c ecore_app.c \
503 ecore_idle_exiter.c ecore_idler.c ecore_job.c ecore_main.c \ 509 ecore_idle_exiter.c ecore_idler.c ecore_job.c ecore_main.c \
504 ecore_pipe.c ecore_poll.c ecore_time.c ecore_timer.c \ 510 ecore_pipe.c ecore_poll.c ecore_time.c ecore_timer.c \
505 ecore_thread.c ecore_glib.c ecore_throttle.c $(am__append_1) \ 511 ecore_thread.c ecore_glib.c ecore_throttle.c $(am__append_1) \
506 $(am__append_2) $(am__append_3) $(am__append_4) 512 $(am__append_2) $(am__append_3) $(am__append_4) \
513 $(am__append_5)
507libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm 514libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm
508libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ 515libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@
509EXTRA_DIST = ecore_private.h 516EXTRA_DIST = ecore_private.h
diff --git a/libraries/ecore/src/lib/ecore/ecore.c b/libraries/ecore/src/lib/ecore/ecore.c
index 7e0f973..d8b8723 100644
--- a/libraries/ecore/src/lib/ecore/ecore.c
+++ b/libraries/ecore/src/lib/ecore/ecore.c
@@ -163,8 +163,10 @@ ecore_init(void)
163 if (!ecore_mempool_init()) goto shutdown_mempool; 163 if (!ecore_mempool_init()) goto shutdown_mempool;
164 _ecore_main_loop_init(); 164 _ecore_main_loop_init();
165 _ecore_signal_init(); 165 _ecore_signal_init();
166 _ecore_thread_init(); 166#ifndef HAVE_EXOTIC
167 _ecore_exe_init(); 167 _ecore_exe_init();
168#endif
169 _ecore_thread_init();
168 _ecore_glib_init(); 170 _ecore_glib_init();
169 _ecore_job_init(); 171 _ecore_job_init();
170 _ecore_time_init(); 172 _ecore_time_init();
@@ -252,7 +254,9 @@ ecore_shutdown(void)
252 _ecore_glib_shutdown(); 254 _ecore_glib_shutdown();
253 _ecore_job_shutdown(); 255 _ecore_job_shutdown();
254 _ecore_thread_shutdown(); 256 _ecore_thread_shutdown();
257#ifndef HAVE_EXOTIC
255 _ecore_exe_shutdown(); 258 _ecore_exe_shutdown();
259#endif
256 _ecore_idle_enterer_shutdown(); 260 _ecore_idle_enterer_shutdown();
257 _ecore_idle_exiter_shutdown(); 261 _ecore_idle_exiter_shutdown();
258 _ecore_idler_shutdown(); 262 _ecore_idler_shutdown();
diff --git a/libraries/ecore/src/lib/ecore/ecore_anim.c b/libraries/ecore/src/lib/ecore/ecore_anim.c
index 78abad7..22c1f8c 100644
--- a/libraries/ecore/src/lib/ecore/ecore_anim.c
+++ b/libraries/ecore/src/lib/ecore/ecore_anim.c
@@ -272,11 +272,11 @@ ecore_animator_pos_map(double pos,
272 return pos; 272 return pos;
273 273
274 case ECORE_POS_MAP_ACCELERATE: 274 case ECORE_POS_MAP_ACCELERATE:
275 pos = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0)); 275 pos = 1.0 - _pos_map_sin(M_PI_2 + pos * M_PI_2);
276 return pos; 276 return pos;
277 277
278 case ECORE_POS_MAP_DECELERATE: 278 case ECORE_POS_MAP_DECELERATE:
279 pos = _pos_map_sin((pos * M_PI) / 2.0); 279 pos = _pos_map_sin(pos * M_PI_2);
280 return pos; 280 return pos;
281 281
282 case ECORE_POS_MAP_SINUSOIDAL: 282 case ECORE_POS_MAP_SINUSOIDAL:
diff --git a/libraries/ecore/src/lib/ecore/ecore_events.c b/libraries/ecore/src/lib/ecore/ecore_events.c
index 0550224..500cf74 100644
--- a/libraries/ecore/src/lib/ecore/ecore_events.c
+++ b/libraries/ecore/src/lib/ecore/ecore_events.c
@@ -72,35 +72,6 @@ static void *ecore_raw_event_event = NULL;
72static void _ecore_event_purge_deleted(void); 72static void _ecore_event_purge_deleted(void);
73static void *_ecore_event_del(Ecore_Event *event); 73static void *_ecore_event_del(Ecore_Event *event);
74 74
75/**
76 * @addtogroup Ecore_Event_Group
77 *
78 * @{
79 */
80
81/**
82 * Add an event handler.
83 * @param type The type of the event this handler will get called for
84 * @param func The function to call when the event is found in the queue
85 * @param data A data pointer to pass to the called function @p func
86 * @return A new Event handler, or NULL on failure
87 *
88 * Add an event handler to the list of handlers. This will, on success, return
89 * a handle to the event handler object that was created, that can be used
90 * later to remove the handler using ecore_event_handler_del(). The @p type
91 * parameter is the integer of the event type that will trigger this callback
92 * to be called. The callback @p func is called when this event is processed
93 * and will be passed the event type, a pointer to the private event
94 * structure that is specific to that event type, and a data pointer that is
95 * provided in this call as the @p data parameter.
96 *
97 * When the callback @p func is called, it must return 1 or 0. If it returns
98 * 1 (or ECORE_CALLBACK_PASS_ON), It will keep being called as per normal, for
99 * each handler set up for that event type. If it returns 0 (or
100 * ECORE_CALLBACK_DONE), it will cease processing handlers for that particular
101 * event, so all handler set to handle that event type that have not already
102 * been called, will not be.
103 */
104EAPI Ecore_Event_Handler * 75EAPI Ecore_Event_Handler *
105ecore_event_handler_add(int type, 76ecore_event_handler_add(int type,
106 Ecore_Event_Handler_Cb func, 77 Ecore_Event_Handler_Cb func,
@@ -151,16 +122,6 @@ unlock:
151 return eh; 122 return eh;
152} 123}
153 124
154/**
155 * Delete an event handler.
156 * @param event_handler Event handler handle to delete
157 * @return Data passed to handler
158 *
159 * Delete a specified event handler from the handler list. On success this will
160 * delete the event handler and return the pointer passed as @p data when the
161 * handler was added by ecore_event_handler_add(). On failure NULL will be
162 * returned. Once a handler is deleted it will no longer be called.
163 */
164EAPI void * 125EAPI void *
165ecore_event_handler_del(Ecore_Event_Handler *event_handler) 126ecore_event_handler_del(Ecore_Event_Handler *event_handler)
166{ 127{
@@ -180,14 +141,6 @@ unlock:
180 return data; 141 return data;
181} 142}
182 143
183/**
184 * @brief Get the data associated with an #Ecore_Event_Handler
185 * @param eh The event handler
186 * @return The data
187 *
188 * This function returns the data previously associated with @p eh by
189 * ecore_event_handler_add().
190 */
191EAPI void * 144EAPI void *
192ecore_event_handler_data_get(Ecore_Event_Handler *eh) 145ecore_event_handler_data_get(Ecore_Event_Handler *eh)
193{ 146{
@@ -205,15 +158,6 @@ unlock:
205 return data; 158 return data;
206} 159}
207 160
208/**
209 * @brief Set the data associated with an #Ecore_Event_Handler
210 * @param eh The event handler
211 * @param data The data to associate
212 * @return The previous data
213 *
214 * This function sets @p data to @p eh and returns the old data pointer
215 * which was previously associated with @p eh by ecore_event_handler_add().
216 */
217EAPI void * 161EAPI void *
218ecore_event_handler_data_set(Ecore_Event_Handler *eh, 162ecore_event_handler_data_set(Ecore_Event_Handler *eh,
219 const void *data) 163 const void *data)
@@ -238,27 +182,9 @@ static void
238_ecore_event_generic_free(void *data __UNUSED__, 182_ecore_event_generic_free(void *data __UNUSED__,
239 void *event) 183 void *event)
240{ /* DO NOT MEMPOOL FREE THIS */ 184{ /* DO NOT MEMPOOL FREE THIS */
241 free (event); 185 free(event);
242} 186}
243 187
244/**
245 * Add an event to the event queue.
246 * @param type The event type to add to the end of the event queue
247 * @param ev The private data structure for this event type
248 * @param func_free The function to be called to free this private structure
249 * @param data The data pointer to be passed to the free function
250 * @return A Handle for that event
251 *
252 * On success this function returns a handle to an event on the event queue, or
253 * NULL if it fails. If it succeeds, an event of type @p type will be added
254 * to the queue for processing by event handlers added by
255 * ecore_event_handler_add(). The @p ev parameter will be a pointer to the event
256 * private data that is specific to that event type. When the event is no
257 * longer needed, @p func_free will be called and passed the private structure
258 * pointer for cleaning up. If @p func_free is NULL, free() will be called
259 * with the private structure pointer.
260 * func_free is passed @p data as its data parameter.
261 */
262EAPI Ecore_Event * 188EAPI Ecore_Event *
263ecore_event_add(int type, 189ecore_event_add(int type,
264 void *ev, 190 void *ev,
@@ -279,17 +205,6 @@ unlock:
279 return event; 205 return event;
280} 206}
281 207
282/**
283 * Delete an event from the queue.
284 * @param event The event handle to delete
285 * @return The data pointer originally set for the event free function
286 *
287 * This deletes the event @p event from the event queue, and returns the
288 * @p data parameer originally set when adding it with ecore_event_add(). This
289 * does not immediately call the free function, and it may be called later on
290 * cleanup, and so if the free function depends on the data pointer to work,
291 * you should defer cleaning of this till the free function is called later.
292 */
293EAPI void * 208EAPI void *
294ecore_event_del(Ecore_Event *event) 209ecore_event_del(Ecore_Event *event)
295{ 210{
@@ -309,16 +224,6 @@ unlock:
309 return data; 224 return data;
310} 225}
311 226
312/**
313 * Allocate a new event type id sensibly and return the new id.
314 * @return A new event type id.
315 *
316 * This function allocates a new event type id and returns it. Once an event
317 * type has been allocated it can never be de-allocated during the life of
318 * the program. There is no guarantee of the contents of this event ID, or how
319 * it is calculated, except that the ID will be unique to the current instance
320 * of the process.
321 */
322EAPI int 227EAPI int
323ecore_event_type_new(void) 228ecore_event_type_new(void)
324{ 229{
@@ -331,26 +236,6 @@ ecore_event_type_new(void)
331 return id; 236 return id;
332} 237}
333 238
334/**
335 * Add a filter the current event queue.
336 * @param func_start Function to call just before filtering and return data
337 * @param func_filter Function to call on each event
338 * @param func_end Function to call after the queu has been filtered
339 * @param data Data to pass to the filter functions
340 * @return A filter handle
341 *
342 * This adds a filter to call callbacks to loop through the event queue and
343 * filter events out of the queue. On failure NULL is returned. On success a
344 * Filter handle is returned. Filters are called on the queue just before
345 * Event handler processing to try and remove redundant events. Just as
346 * processing starts @p func_start is called and passed the @p data pointer.
347 * This function returns a pointer that is used as loop_data that is now passed to
348 * @p func_filter as loop_data. @p func_filter is also passed @p data and the
349 * event type and private event structure. If this callback returns 0, the
350 * event is removed from the queue. If it returns 1, the event is kept. When
351 * processing is finished @p func_end is called and is passed the loop_data
352 * and @p data pointer to clean up.
353 */
354EAPI Ecore_Event_Filter * 239EAPI Ecore_Event_Filter *
355ecore_event_filter_add(Ecore_Data_Cb func_start, 240ecore_event_filter_add(Ecore_Data_Cb func_start,
356 Ecore_Filter_Cb func_filter, 241 Ecore_Filter_Cb func_filter,
@@ -374,15 +259,6 @@ unlock:
374 return ef; 259 return ef;
375} 260}
376 261
377/**
378 * Delete an event filter.
379 * @param ef The event filter handle
380 * @return The data set for the filter
381 *
382 * Delete a filter that has been added by its @p ef handle. On success this
383 * will return the data pointer set when this filter was added. On failure
384 * NULL is returned.
385 */
386EAPI void * 262EAPI void *
387ecore_event_filter_del(Ecore_Event_Filter *ef) 263ecore_event_filter_del(Ecore_Event_Filter *ef)
388{ 264{
@@ -404,50 +280,18 @@ unlock:
404 return data; 280 return data;
405} 281}
406 282
407/**
408 * Return the current event type being handled.
409 * @return The current event type being handled if inside a handler callback
410 *
411 * If the program is currently inside an Ecore event handler callback this
412 * will return the type of the current event being processed. If Ecore is
413 * not inside an event handler, ECORE_EVENT_NONE is returned.
414 *
415 * This is useful when certain Ecore modules such as Ecore_Evas "swallow"
416 * events and not all the original information is passed on. In special cases
417 * this extra information may be useful or needed and using this call can let
418 * the program know if the event type being handled is one it wants to get more
419 * information about.
420 */
421EAPI int 283EAPI int
422ecore_event_current_type_get(void) 284ecore_event_current_type_get(void)
423{ 285{
424 return ecore_raw_event_type; 286 return ecore_raw_event_type;
425} 287}
426 288
427/**
428 * Return the current event type pointer handled.
429 * @return The current event pointer being handled if inside a handler callback
430 *
431 * If the program is currently inside an Ecore event handler callback this
432 * will return the pointer of the current event being processed. If Ecore is
433 * not inside an event handler, NULL will be returned.
434 *
435 * This is useful when certain Ecore modules such as Ecore_Evas "swallow"
436 * events and not all the original information is passed on. In special cases
437 * this extra information may be useful or needed and using this call can let
438 * the program access the event data if the type of the event is handled by
439 * the program.
440 */
441EAPI void * 289EAPI void *
442ecore_event_current_event_get(void) 290ecore_event_current_event_get(void)
443{ 291{
444 return ecore_raw_event_event; 292 return ecore_raw_event_event;
445} 293}
446 294
447/**
448 * @}
449 */
450
451EAPI void * 295EAPI void *
452_ecore_event_handler_del(Ecore_Event_Handler *event_handler) 296_ecore_event_handler_del(Ecore_Event_Handler *event_handler)
453{ 297{
diff --git a/libraries/ecore/src/lib/ecore/ecore_exe.c b/libraries/ecore/src/lib/ecore/ecore_exe.c
index d5465fc..47f8dc9 100644
--- a/libraries/ecore/src/lib/ecore/ecore_exe.c
+++ b/libraries/ecore/src/lib/ecore/ecore_exe.c
@@ -331,15 +331,15 @@ static int run_pri = ECORE_EXE_PRIORITY_INHERIT;
331 * This sets the priority of processes run by ecore_exe_run() and 331 * This sets the priority of processes run by ecore_exe_run() and
332 * ecore_exe_pipe_run(). 332 * ecore_exe_pipe_run().
333 * @li On Windows, the child process is created by default with the 333 * @li On Windows, the child process is created by default with the
334 * #ECORE_EXE_WIN32_PRIORITY_NORMAL priority, unless the calling 334 * @ref ECORE_EXE_WIN32_PRIORITY_NORMAL priority, unless the calling
335 * process is in #ECORE_EXE_WIN32_PRIORITY_IDLE or 335 * process is in @ref ECORE_EXE_WIN32_PRIORITY_IDLE or
336 * #ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL priority. In that case, the 336 * @ref ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL priority. In that case, the
337 * child process inherits this priority. 337 * child process inherits this priority.
338 * @li On other platforms, if set to #ECORE_EXE_PRIORITY_INHERIT child 338 * @li On other platforms, if set to @ref ECORE_EXE_PRIORITY_INHERIT child
339 * processes inherits the priority of their parent. This is the default. 339 * processes inherits the priority of their parent. This is the default.
340 * 340 *
341 * @param pri value a Ecore_Exe_Win32_Priority value on Windows, -20 341 * @param pri value a Ecore_Exe_Win32_Priority value on Windows, -20
342 * to 19 or ECORE_EXE_PRIORITY_INHERIT on other OS. 342 * to 19 or @ref ECORE_EXE_PRIORITY_INHERIT on other OS.
343 */ 343 */
344EAPI void 344EAPI void
345ecore_exe_run_priority_set(int pri) 345ecore_exe_run_priority_set(int pri)
diff --git a/libraries/ecore/src/lib/ecore/ecore_getopt.c b/libraries/ecore/src/lib/ecore/ecore_getopt.c
index 76272d3..cd68189 100644
--- a/libraries/ecore/src/lib/ecore/ecore_getopt.c
+++ b/libraries/ecore/src/lib/ecore/ecore_getopt.c
@@ -38,6 +38,10 @@ void *alloca(size_t);
38# include <Evil.h> 38# include <Evil.h>
39#endif 39#endif
40 40
41#ifdef HAVE_EXOTIC
42# include <Exotic.h>
43#endif
44
41#include "Ecore.h" 45#include "Ecore.h"
42#include "Ecore_Getopt.h" 46#include "Ecore_Getopt.h"
43 47
diff --git a/libraries/ecore/src/lib/ecore/ecore_main.c b/libraries/ecore/src/lib/ecore/ecore_main.c
index 76aced6..587c83b 100644
--- a/libraries/ecore/src/lib/ecore/ecore_main.c
+++ b/libraries/ecore/src/lib/ecore/ecore_main.c
@@ -229,10 +229,14 @@ static Eina_Bool win32_handlers_delete_me = EINA_FALSE;
229#ifdef _WIN32 229#ifdef _WIN32
230Ecore_Select_Function main_loop_select = _ecore_main_win32_select; 230Ecore_Select_Function main_loop_select = _ecore_main_win32_select;
231#else 231#else
232# ifdef HAVE_SYS_SELECT_H 232# if !defined EXOTIC_NO_SELECT
233# include <sys/select.h> 233# ifdef HAVE_SYS_SELECT_H
234# endif 234# include <sys/select.h>
235# endif
235Ecore_Select_Function main_loop_select = select; 236Ecore_Select_Function main_loop_select = select;
237# else
238Ecore_Select_Function main_loop_select = NULL;
239# endif
236#endif 240#endif
237 241
238#ifndef USE_G_MAIN_LOOP 242#ifndef USE_G_MAIN_LOOP
@@ -848,6 +852,21 @@ _ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
848 * DO NOT use this function unless you are the person God comes to ask for 852 * DO NOT use this function unless you are the person God comes to ask for
849 * advice when He has trouble managing the Universe. 853 * advice when He has trouble managing the Universe.
850 */ 854 */
855
856EAPI int
857ecore_main_loop_iterate_may_block(int may_block)
858{
859#ifndef USE_G_MAIN_LOOP
860 _ecore_lock();
861in_main_loop++;
862 _ecore_main_loop_iterate_internal(!may_block);
863in_main_loop--;
864 _ecore_unlock();
865 return _ecore_event_exist();
866#else
867 return g_main_context_iteration(NULL, may_block);
868#endif
869}
851EAPI void 870EAPI void
852ecore_main_loop_iterate(void) 871ecore_main_loop_iterate(void)
853{ 872{
@@ -945,39 +964,6 @@ ecore_main_loop_select_func_get(void)
945 return main_loop_select; 964 return main_loop_select;
946} 965}
947 966
948/**
949 * Adds a callback for activity on the given file descriptor.
950 *
951 * @p func will be called during the execution of @ref ecore_main_loop_begin
952 * when the file descriptor is available for reading, or writing, or both.
953 *
954 * Normally when @p func returns ECORE_CALLBACK_CANCEL, it indicates that the
955 * handler should be marked for deletion (identical to calling @ref ecore_main_fd_handler_del).
956 * However, if the @p buf_func is supplied, then the return value from the @p func indicates that
957 * @p func should be called repeatedly until it returns ECORE_CALLBACK_CANCEL.
958 *
959 * @p buf_func is called during event loop handling to check if data that has
960 * been read from the file descriptor is in a buffer and is available to
961 * read. Some systems (notably xlib) handle their own buffering, and would
962 * otherwise not work with select(). These systems should use a @p buf_func.
963 * This is a most annoying hack, only ecore_x uses it, so refer to that for
964 * an example. NOTE - @p func should probably return ECORE_CALLBACK_RENEW always if
965 * @p buf_func is used, to avoid confusion with the other return value
966 * semantics.
967 *
968 * @param fd The file descriptor to watch.
969 * @param flags To watch it for read (@c ECORE_FD_READ) and/or
970 * (@c ECORE_FD_WRITE) write ability. @c ECORE_FD_ERROR
971 *
972 * @param func The callback function.
973 * @param data The data to pass to the callback.
974 * @param buf_func The function to call to check if any data has been
975 * buffered and already read from the fd. Can be @c NULL.
976 * @param buf_data The data to pass to the @p buf_func function.
977 * @return A fd handler handle if successful. @c NULL otherwise.
978 * @note This function CANNOT be used for reading/writing to regular files!
979 * @ingroup Ecore_FD_Handler_Group
980 */
981EAPI Ecore_Fd_Handler * 967EAPI Ecore_Fd_Handler *
982ecore_main_fd_handler_add(int fd, 968ecore_main_fd_handler_add(int fd,
983 Ecore_Fd_Handler_Flags flags, 969 Ecore_Fd_Handler_Flags flags,
@@ -1059,20 +1045,6 @@ ecore_main_win32_handler_add(void *h __UNUSED__,
1059 1045
1060#endif 1046#endif
1061 1047
1062/**
1063 * Marks an FD handler for deletion.
1064 * @param fd_handler The FD handler.
1065 * @return The data pointer set using @ref ecore_main_fd_handler_add,
1066 * for @p fd_handler on success. @c NULL otherwise.
1067 * @ingroup Ecore_FD_Handler_Group
1068 * This function marks an fd handler to be deleted during an iteration of the main loop.
1069 * It does NOT close the associated fd!
1070 *
1071 * @note If the underlying fd is already closed ecore may complain if the main loop
1072 * is using epoll internally, and also in some rare cases this may cause
1073 * crashes and instability. Remember to delete your fd handlers before the
1074 * fds they listen to are closed.
1075 */
1076EAPI void * 1048EAPI void *
1077ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) 1049ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
1078{ 1050{
@@ -1116,24 +1088,6 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__)
1116 1088
1117#endif 1089#endif
1118 1090
1119/**
1120 * @brief Set the prepare callback with data for a given #Ecore_Fd_Handler
1121 *
1122 * @param fd_handler The fd handler
1123 * @param func The prep function
1124 * @param data The data to pass to the prep function
1125 *
1126 * This function will be called prior to any fd handler's callback function
1127 * (even the other fd handlers), before entering the main loop select function.
1128 *
1129 * @note Once a prepare callback is set for a fd handler, it cannot be changed.
1130 * You need to delete the fd handler and create a new one, to set another
1131 * callback.
1132 * @note You probably don't need this function. It is only necessary for very
1133 * uncommon cases that need special behavior.
1134 *
1135 * @ingroup Ecore_FD_Handler_Group
1136 */
1137EAPI void 1091EAPI void
1138ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, 1092ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler,
1139 Ecore_Fd_Prep_Cb func, 1093 Ecore_Fd_Prep_Cb func,
@@ -1157,12 +1111,6 @@ unlock:
1157 _ecore_unlock(); 1111 _ecore_unlock();
1158} 1112}
1159 1113
1160/**
1161 * Retrieves the file descriptor that the given handler is handling.
1162 * @param fd_handler The given FD handler.
1163 * @return The file descriptor the handler is watching.
1164 * @ingroup Ecore_FD_Handler_Group
1165 */
1166EAPI int 1114EAPI int
1167ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler) 1115ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
1168{ 1116{
@@ -1182,15 +1130,6 @@ unlock:
1182 return fd; 1130 return fd;
1183} 1131}
1184 1132
1185/**
1186 * Return if read, write or error, or a combination thereof, is active on the
1187 * file descriptor of the given FD handler.
1188 * @param fd_handler The given FD handler.
1189 * @param flags The flags, @c ECORE_FD_READ, @c ECORE_FD_WRITE or
1190 * @c ECORE_FD_ERROR to query.
1191 * @return #EINA_TRUE if any of the given flags are active. #EINA_FALSE otherwise.
1192 * @ingroup Ecore_FD_Handler_Group
1193 */
1194EAPI Eina_Bool 1133EAPI Eina_Bool
1195ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, 1134ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler,
1196 Ecore_Fd_Handler_Flags flags) 1135 Ecore_Fd_Handler_Flags flags)
@@ -1213,12 +1152,6 @@ unlock:
1213 return ret; 1152 return ret;
1214} 1153}
1215 1154
1216/**
1217 * Set what active streams the given FD handler should be monitoring.
1218 * @param fd_handler The given FD handler.
1219 * @param flags The flags to be watching.
1220 * @ingroup Ecore_FD_Handler_Group
1221 */
1222EAPI void 1155EAPI void
1223ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, 1156ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler,
1224 Ecore_Fd_Handler_Flags flags) 1157 Ecore_Fd_Handler_Flags flags)
@@ -1742,14 +1675,14 @@ _ecore_main_loop_iterate_internal(int once_only)
1742 if (_ecore_event_exist()) 1675 if (_ecore_event_exist())
1743 { 1676 {
1744 /* but first conceptually enter an idle state */ 1677 /* but first conceptually enter an idle state */
1745 _ecore_idle_enterer_call(); 1678 _ecore_idle_enterer_call();
1746 _ecore_throttle(); 1679 _ecore_throttle();
1747 /* now quickly poll to see which input fd's are active */ 1680 /* now quickly poll to see which input fd's are active */
1748 _ecore_main_select(0.0); 1681 _ecore_main_select(0.0);
1749 /* allow newly queued timers to expire from now on */ 1682 /* allow newly queued timers to expire from now on */
1750 _ecore_timer_enable_new(); 1683 _ecore_timer_enable_new();
1751 /* go straight to processing the events we had queued */ 1684 /* go straight to processing the events we had queued */
1752 goto process_all; 1685 goto process_all;
1753 } 1686 }
1754 1687
1755 if (once_only) 1688 if (once_only)
@@ -1758,17 +1691,17 @@ _ecore_main_loop_iterate_internal(int once_only)
1758 * if we got any events or signals, allow new timers to process. 1691 * if we got any events or signals, allow new timers to process.
1759 * use bitwise or to force both conditions to be tested and 1692 * use bitwise or to force both conditions to be tested and
1760 * merged together */ 1693 * merged together */
1761 if (_ecore_main_select(0.0) | _ecore_signal_count_get()) 1694 if (_ecore_main_select(0.0) | _ecore_signal_count_get())
1762 { 1695 {
1763 _ecore_timer_enable_new(); 1696 _ecore_timer_enable_new();
1764 goto process_all; 1697 goto process_all;
1765 } 1698 }
1766 } 1699 }
1767 else 1700 else
1768 { 1701 {
1769 /* call idle enterers ... */ 1702 /* call idle enterers ... */
1770 _ecore_idle_enterer_call(); 1703 _ecore_idle_enterer_call();
1771 _ecore_throttle(); 1704 _ecore_throttle();
1772 } 1705 }
1773 1706
1774 /* if these calls caused any buffered events to appear - deal with them */ 1707 /* if these calls caused any buffered events to appear - deal with them */
@@ -1787,10 +1720,10 @@ _ecore_main_loop_iterate_internal(int once_only)
1787 if (once_only) 1720 if (once_only)
1788 { 1721 {
1789 /* in once_only mode enter idle here instead and then return */ 1722 /* in once_only mode enter idle here instead and then return */
1790 _ecore_idle_enterer_call(); 1723 _ecore_idle_enterer_call();
1791 _ecore_throttle(); 1724 _ecore_throttle();
1792 _ecore_timer_enable_new(); 1725 _ecore_timer_enable_new();
1793 goto done; 1726 goto done;
1794 } 1727 }
1795 1728
1796 _ecore_fps_marker_1(); 1729 _ecore_fps_marker_1();
@@ -1808,23 +1741,23 @@ start_loop: /***************************************************************/
1808 if (!_ecore_event_exist()) 1741 if (!_ecore_event_exist())
1809 { 1742 {
1810 /* init flags */ 1743 /* init flags */
1811 next_time = _ecore_timer_next_get(); 1744 next_time = _ecore_timer_next_get();
1812 /* no idlers */ 1745 /* no idlers */
1813 if (!_ecore_idler_exist()) 1746 if (!_ecore_idler_exist())
1814 { 1747 {
1815 /* sleep until timeout or forever (-1.0) waiting for on fds */ 1748 /* sleep until timeout or forever (-1.0) waiting for on fds */
1816 _ecore_main_select(next_time); 1749 _ecore_main_select(next_time);
1817 } 1750 }
1818 else 1751 else
1819 { 1752 {
1820 int action = LOOP_CONTINUE; 1753 int action = LOOP_CONTINUE;
1821 1754
1822 /* no timers - spin */ 1755 /* no timers - spin */
1823 if (next_time < 0) action = _ecore_main_loop_spin_no_timers(); 1756 if (next_time < 0) action = _ecore_main_loop_spin_no_timers();
1824 /* timers - spin */ 1757 /* timers - spin */
1825 else action = _ecore_main_loop_spin_timers(); 1758 else action = _ecore_main_loop_spin_timers();
1826 if (action == SPIN_RESTART) goto start_loop; 1759 if (action == SPIN_RESTART) goto start_loop;
1827 } 1760 }
1828 } 1761 }
1829 _ecore_fps_marker_2(); 1762 _ecore_fps_marker_2();
1830 1763
@@ -1847,8 +1780,8 @@ process_all: /***********************************************************/
1847 if (once_only) 1780 if (once_only)
1848 { 1781 {
1849 /* if in once_only mode handle idle exiting */ 1782 /* if in once_only mode handle idle exiting */
1850 _ecore_idle_enterer_call(); 1783 _ecore_idle_enterer_call();
1851 _ecore_throttle(); 1784 _ecore_throttle();
1852 } 1785 }
1853 1786
1854done: /*******************************************************************/ 1787done: /*******************************************************************/
diff --git a/libraries/ecore/src/lib/ecore/ecore_pipe.c b/libraries/ecore/src/lib/ecore/ecore_pipe.c
index aa640cd..ea7453e 100644
--- a/libraries/ecore/src/lib/ecore/ecore_pipe.c
+++ b/libraries/ecore/src/lib/ecore/ecore_pipe.c
@@ -36,15 +36,13 @@
36# include <Escape.h> 36# include <Escape.h>
37#endif 37#endif
38 38
39#ifdef HAVE_EXOTIC
40# include <Exotic.h>
41#endif
42
39#include "Ecore.h" 43#include "Ecore.h"
40#include "ecore_private.h" 44#include "ecore_private.h"
41 45
42#ifdef _WIN32
43# define FMT_SSIZE_T "%Id"
44#else
45# define FMT_SSIZE_T "%zd"
46#endif
47
48/* How of then we should retry to write to the pipe */ 46/* How of then we should retry to write to the pipe */
49#define ECORE_PIPE_WRITE_RETRY 6 47#define ECORE_PIPE_WRITE_RETRY 6
50 48
@@ -80,6 +78,9 @@
80 78
81#endif /* ! _WIN32 */ 79#endif /* ! _WIN32 */
82 80
81#include <Ecore.h>
82#include "ecore_private.h"
83
83struct _Ecore_Pipe 84struct _Ecore_Pipe
84{ 85{
85 ECORE_MAGIC; 86 ECORE_MAGIC;
@@ -414,7 +415,7 @@ ecore_pipe_write(Ecore_Pipe *p,
414 ; 415 ;
415 else 416 else
416 { 417 {
417 ERR("An unhandled error (ret: " FMT_SSIZE_T " errno: %d)" 418 ERR("An unhandled error (ret: %zd errno: %d)"
418 "occurred while writing to the pipe the length", 419 "occurred while writing to the pipe the length",
419 ret, errno); 420 ret, errno);
420 } 421 }
@@ -448,7 +449,7 @@ ecore_pipe_write(Ecore_Pipe *p,
448 ; 449 ;
449 else 450 else
450 { 451 {
451 ERR("An unhandled error (ret: " FMT_SSIZE_T " errno: %d)" 452 ERR("An unhandled error (ret: %zd errno: %d)"
452 "occurred while writing to the pipe the length", 453 "occurred while writing to the pipe the length",
453 ret, errno); 454 ret, errno);
454 } 455 }
diff --git a/libraries/ecore/src/lib/ecore/ecore_poll.c b/libraries/ecore/src/lib/ecore/ecore_poll.c
index 732850b..bf4da6a 100644
--- a/libraries/ecore/src/lib/ecore/ecore_poll.c
+++ b/libraries/ecore/src/lib/ecore/ecore_poll.c
@@ -189,20 +189,6 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
189 return ECORE_CALLBACK_RENEW; 189 return ECORE_CALLBACK_RENEW;
190} 190}
191 191
192/**
193 * @addtogroup Ecore_Poller_Group
194 *
195 * @{
196 */
197
198/**
199 * Sets the time between ticks (in seconds) for the given ticker clock.
200 * @param type The ticker type to adjust
201 * @param poll_time The time (in seconds) between ticks of the clock
202 *
203 * This will adjust the time between ticks of the given ticker type defined
204 * by @p type to the time period defined by @p poll_time.
205 */
206EAPI void 192EAPI void
207ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__, 193ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__,
208 double poll_time) 194 double poll_time)
@@ -211,65 +197,12 @@ ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__,
211 _ecore_poller_next_tick_eval(); 197 _ecore_poller_next_tick_eval();
212} 198}
213 199
214/**
215 * Gets the time between ticks (in seconds) for the given ticker clock.
216 * @param type The ticker type to query
217 * @return The time in seconds between ticks of the ticker clock
218 *
219 * This will get the time between ticks of the specified ticker clock.
220 */
221EAPI double 200EAPI double
222ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__) 201ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__)
223{ 202{
224 return poll_interval; 203 return poll_interval;
225} 204}
226 205
227/**
228 * Creates a poller to call the given function at a particular tick interval.
229 * @param type The ticker type to attach the poller to
230 * @param interval The poll interval
231 * @param func The given function. If @p func returns 1, the poller is
232 * rescheduled for the next tick interval.
233 * @param data Data to pass to @p func when it is called.
234 * @return A poller object on success. @c NULL on failure.
235 *
236 * This function adds a poller callback that is to be called regularly
237 * along with all other poller callbacks so the pollers are synchronized with
238 * all other pollers running off the same poller type and at the same tick
239 * interval. This should be used for polling things when polling is desired
240 * or required, and you do not have specific requirements on the exact times
241 * to poll and want to avoid extra process wakeups for polling. This will
242 * save power as the CPU has more of a chance to go into a low power state
243 * the longer it is asleep for, so this should be used if you are at all
244 * power conscious.
245 *
246 * The @p type parameter defines the poller tick type (there is a virtual
247 * clock ticking all the time - though ecore avoids making it tick when
248 * there will not be any work to do at that tick point). There is only one
249 * ticker at the moment - that is ECORE_POLLER_CORE. This is here for future
250 * expansion if multiple clocks with different frequencies are really required.
251 * The default time between ticks for the ECORE_POLLER_CORE ticker is 0.125
252 * seconds.
253 *
254 * The @p interval is the number of ticker ticks that will pass by in between
255 * invocations of the @p func callback. This must be between 1 and 32768
256 * inclusive, and must be a power of 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768).
257 * If it is 1, then the function will be called every tick. if it is 2, then it
258 * will be called every 2nd tick, if it is 8, then every 8th tick etc. Exactly
259 * which tick is undefined, as only the interval between calls can be defined.
260 * Ecore will endeavour to keep pollers synchronised and to call as many in
261 * 1 wakeup event as possible.
262 *
263 * This function adds a poller and returns its handle on success and NULL on
264 * failure. The function @p func will be called at tick intervals described
265 * above. The function will be passed the @p data pointer as its parameter.
266 *
267 * When the poller @p func is called, it must return a value of either
268 * 1 (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). If it
269 * returns 1, it will be called again at the next tick, or if it returns
270 * 0 it will be deleted automatically making any references/handles for it
271 * invalid.
272 */
273EAPI Ecore_Poller * 206EAPI Ecore_Poller *
274ecore_poller_add(Ecore_Poller_Type type __UNUSED__, 207ecore_poller_add(Ecore_Poller_Type type __UNUSED__,
275 int interval, 208 int interval,
@@ -307,16 +240,6 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__,
307 return poller; 240 return poller;
308} 241}
309 242
310/**
311 * Changes the polling interval rate of @p poller.
312 *
313 * @param poller The Ecore_Poller to change the interval of
314 * @param interval The tick interval to set; must be a power of 2 but <= 32768
315 * @return Returns true on success, false on failure
316 *
317 * This allows the changing of a poller's polling interval. It is useful when you want to alter
318 * a poll rate without deleting and re-creating a poller.
319 */
320EAPI Eina_Bool 243EAPI Eina_Bool
321ecore_poller_poller_interval_set(Ecore_Poller *poller, 244ecore_poller_poller_interval_set(Ecore_Poller *poller,
322 int interval) 245 int interval)
@@ -353,14 +276,6 @@ ecore_poller_poller_interval_set(Ecore_Poller *poller,
353 return EINA_TRUE; 276 return EINA_TRUE;
354} 277}
355 278
356/**
357 * Gets the polling interval rate of @p poller.
358 *
359 * @param poller The Ecore_Poller to change the interval of
360 * @return Returns the interval, in ticks, that @p poller polls at
361 *
362 * This returns a poller's polling interval, or 0 on error.
363 */
364EAPI int 279EAPI int
365ecore_poller_poller_interval_get(Ecore_Poller *poller) 280ecore_poller_poller_interval_get(Ecore_Poller *poller)
366{ 281{
@@ -382,15 +297,6 @@ ecore_poller_poller_interval_get(Ecore_Poller *poller)
382 return interval; 297 return interval;
383} 298}
384 299
385/**
386 * Delete the specified poller from the timer list.
387 * @param poller The poller to delete.
388 * @return The data pointer set for the timer when @ref ecore_poller_add was
389 * called. @c NULL is returned if the function is unsuccessful.
390 *
391 * Note: @p poller must be a valid handle. If the poller function has already
392 * returned 0, the handle is no longer valid (and does not need to be delete).
393 */
394EAPI void * 300EAPI void *
395ecore_poller_del(Ecore_Poller *poller) 301ecore_poller_del(Ecore_Poller *poller)
396{ 302{
diff --git a/libraries/ecore/src/lib/ecore/ecore_private.h b/libraries/ecore/src/lib/ecore/ecore_private.h
index 50d502c..f0c5d6b 100644
--- a/libraries/ecore/src/lib/ecore/ecore_private.h
+++ b/libraries/ecore/src/lib/ecore/ecore_private.h
@@ -174,7 +174,7 @@ void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
174 174
175void _ecore_main_shutdown(void); 175void _ecore_main_shutdown(void);
176 176
177#if defined (_WIN32) || defined (__lv2ppu__) 177#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC)
178static inline void _ecore_signal_shutdown(void) { } 178static inline void _ecore_signal_shutdown(void) { }
179 179
180static inline void _ecore_signal_init(void) { } 180static inline void _ecore_signal_init(void) { }
@@ -237,14 +237,14 @@ _ecore_lock(void)
237 EINA_MAIN_LOOP_CHECK_RETURN; 237 EINA_MAIN_LOOP_CHECK_RETURN;
238#endif 238#endif
239 _ecore_main_lock_count++; 239 _ecore_main_lock_count++;
240 assert(_ecore_main_lock_count == 1); 240 /* assert(_ecore_main_lock_count == 1); */
241} 241}
242 242
243static inline void 243static inline void
244_ecore_unlock(void) 244_ecore_unlock(void)
245{ 245{
246 _ecore_main_lock_count--; 246 _ecore_main_lock_count--;
247 assert(_ecore_main_lock_count == 0); 247 /* assert(_ecore_main_lock_count == 0); */
248#ifdef HAVE_THREAD_SAFETY 248#ifdef HAVE_THREAD_SAFETY
249 eina_lock_release(&_ecore_main_loop_lock); 249 eina_lock_release(&_ecore_main_loop_lock);
250#endif 250#endif
diff --git a/libraries/ecore/src/lib/ecore/ecore_thread.c b/libraries/ecore/src/lib/ecore/ecore_thread.c
index 4444ad4..85fbe64 100644
--- a/libraries/ecore/src/lib/ecore/ecore_thread.c
+++ b/libraries/ecore/src/lib/ecore/ecore_thread.c
@@ -17,6 +17,25 @@
17 17
18#ifdef EFL_HAVE_THREADS 18#ifdef EFL_HAVE_THREADS
19 19
20# define LK(x) Eina_Lock x
21# define LKI(x) eina_lock_new(&(x))
22# define LKD(x) eina_lock_free(&(x))
23# define LKL(x) eina_lock_take(&(x))
24# define LKU(x) eina_lock_release(&(x))
25
26# define CD(x) Eina_Condition x
27# define CDI(x, m) eina_condition_new(&(x), &(m))
28# define CDD(x) eina_condition_free(&(x))
29# define CDB(x) eina_condition_broadcast(&(x))
30# define CDW(x, t) eina_condition_timedwait(&(x), t)
31
32# define LRWK(x) Eina_RWLock x
33# define LRWKI(x) eina_rwlock_new(&(x));
34# define LRWKD(x) eina_rwlock_free(&(x));
35# define LRWKWL(x) eina_rwlock_take_write(&(x));
36# define LRWKRL(x) eina_rwlock_take_read(&(x));
37# define LRWKU(x) eina_rwlock_release(&(x));
38
20# ifdef EFL_HAVE_POSIX_THREADS 39# ifdef EFL_HAVE_POSIX_THREADS
21# include <pthread.h> 40# include <pthread.h>
22# ifdef __linux__ 41# ifdef __linux__
@@ -31,28 +50,9 @@
31# define PHE(x, y) pthread_equal(x, y) 50# define PHE(x, y) pthread_equal(x, y)
32# define PHS() pthread_self() 51# define PHS() pthread_self()
33# define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d) 52# define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d)
34# define PHJ(x, p) pthread_join(x, (void **)(&(p))) 53# define PHJ(x) pthread_join(x, NULL)
35# define PHA(x) pthread_cancel(x) 54# define PHA(x) pthread_cancel(x)
36 55
37# define CD(x) pthread_cond_t x
38# define CDI(x) pthread_cond_init(&(x), NULL);
39# define CDD(x) pthread_cond_destroy(&(x));
40# define CDB(x) pthread_cond_broadcast(&(x));
41# define CDW(x, y, t) pthread_cond_timedwait(&(x), &(y), t);
42
43# define LK(x) pthread_mutex_t x
44# define LKI(x) pthread_mutex_init(&(x), NULL);
45# define LKD(x) pthread_mutex_destroy(&(x));
46# define LKL(x) pthread_mutex_lock(&(x));
47# define LKU(x) pthread_mutex_unlock(&(x));
48
49# define LRWK(x) pthread_rwlock_t x
50# define LRWKI(x) pthread_rwlock_init(&(x), NULL);
51# define LRWKD(x) pthread_rwlock_destroy(&(x));
52# define LRWKWL(x) pthread_rwlock_wrlock(&(x));
53# define LRWKRL(x) pthread_rwlock_rdlock(&(x));
54# define LRWKU(x) pthread_rwlock_unlock(&(x));
55
56# else /* EFL_HAVE_WIN32_THREADS */ 56# else /* EFL_HAVE_WIN32_THREADS */
57 57
58# define WIN32_LEAN_AND_MEAN 58# define WIN32_LEAN_AND_MEAN
@@ -108,209 +108,9 @@ _ecore_thread_win32_join(win32_thread *x,
108 return 0; 108 return 0;
109} 109}
110 110
111# define PHJ(x, p) _ecore_thread_win32_join(x, (void **)(&(p))) 111# define PHJ(x) _ecore_thread_win32_join(x, NULL)
112# define PHA(x) TerminateThread(x->thread, 0) 112# define PHA(x) TerminateThread(x->thread, 0)
113 113
114# define LK(x) HANDLE x
115# define LKI(x) x = CreateMutex(NULL, FALSE, NULL)
116# define LKD(x) CloseHandle(x)
117# define LKL(x) WaitForSingleObject(x, INFINITE)
118# define LKU(x) ReleaseMutex(x)
119
120typedef struct
121{
122 HANDLE semaphore;
123 LONG threads_count;
124 CRITICAL_SECTION threads_count_lock;
125} win32_cond;
126
127# define CD(x) win32_cond * x
128
129# define CDI(x) \
130 do { \
131 x = (win32_cond *)calloc(1, sizeof(win32_cond)); \
132 if (x) \
133 { \
134 x->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); \
135 if (x->semaphore) \
136 InitializeCriticalSection(&x->threads_count_lock); \
137 else \
138 { \
139 free(x); \
140 x = NULL; \
141 } \
142 } \
143 } while (0)
144
145# define CDD(x) \
146 do { \
147 CloseHandle(x->semaphore); \
148 free(x); \
149 x = NULL; \
150 } while (0)
151
152# define CDB(x) \
153 do { \
154 EnterCriticalSection(&x->threads_count_lock); \
155 if (x->threads_count > 0) \
156 ReleaseSemaphore(x->semaphore, x->threads_count, NULL); \
157 LeaveCriticalSection (&x->threads_count_lock); \
158 } while (0)
159
160int
161_ecore_thread_win32_cond_timedwait(win32_cond *c,
162 HANDLE *external_mutex,
163 struct timeval *t)
164{
165 DWORD res;
166 DWORD val = t->tv_sec * 1000 + (t->tv_usec / 1000);
167 LKL(external_mutex);
168 EnterCriticalSection (&c->threads_count_lock);
169 c->threads_count++;
170 LeaveCriticalSection (&c->threads_count_lock);
171 LKU(external_mutex);
172 res = WaitForSingleObject(c->semaphore, val);
173 if (res == WAIT_OBJECT_0)
174 return 0;
175 else
176 return -1;
177}
178
179# define CDW(x, y, t) _ecore_thread_win32_cond_timedwait(x, y, t)
180
181typedef struct
182{
183 LONG readers_count;
184 LONG writers_count;
185 int readers;
186 int writers;
187 LK(mutex);
188 CD(cond_read);
189 CD(cond_write);
190} win32_rwl;
191
192# define LRWK(x) win32_rwl * x
193# define LRWKI(x) \
194 do { \
195 x = (win32_rwl *)calloc(1, sizeof(win32_rwl)); \
196 if (x) \
197 { \
198 LKI(x->mutex); \
199 if (x->mutex) \
200 { \
201 CDI(x->cond_read); \
202 if (x->cond_read) \
203 { \
204 CDI(x->cond_write); \
205 if (!x->cond_write) \
206 { \
207 CDD(x->cond_read); \
208 LKD(x->mutex); \
209 free(x); \
210 x = NULL; \
211 } \
212 } \
213 else \
214 { \
215 LKD(x->mutex); \
216 free(x); \
217 x = NULL; \
218 } \
219 } \
220 else \
221 { \
222 free(x); \
223 x = NULL; \
224 } \
225 } \
226 } while (0)
227
228# define LRWKD(x) \
229 do { \
230 LKU(x->mutex); \
231 LKD(x->mutex); \
232 CDD(x->cond_write); \
233 CDD(x->cond_read); \
234 free(x); \
235 } while (0)
236# define LRWKWL(x) \
237 do { \
238 DWORD res; \
239 LKU(x->mutex); \
240 if (x->writers || x->readers > 0) \
241 { \
242 x->writers_count++; \
243 while (x->writers || x->readers > 0) \
244 { \
245 EnterCriticalSection(&x->cond_write->threads_count_lock); \
246 x->cond_read->threads_count++; \
247 LeaveCriticalSection(&x->cond_write->threads_count_lock); \
248 res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \
249 if (res != WAIT_OBJECT_0) break; \
250 } \
251 x->writers_count--; \
252 } \
253 if (res == 0) x->writers_count = 1; \
254 LKU(x->mutex); \
255 } while (0)
256# define LRWKRL(x) \
257 do { \
258 DWORD res; \
259 LKL(x->mutex); \
260 if (x->writers) \
261 { \
262 x->readers_count++; \
263 while (x->writers) \
264 { \
265 EnterCriticalSection(&x->cond_write->threads_count_lock); \
266 x->cond_read->threads_count++; \
267 LeaveCriticalSection(&x->cond_write->threads_count_lock); \
268 res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \
269 if (res != WAIT_OBJECT_0) break; \
270 } \
271 x->readers_count--; \
272 } \
273 if (res == 0) \
274 x->readers++; \
275 LKU(x->mutex); \
276 } while (0)
277# define LRWKU(x) \
278 do { \
279 LKL(x->mutex); \
280 if (x->writers) \
281 { \
282 x->writers = 0; \
283 if (x->readers_count == 1) \
284 { \
285 EnterCriticalSection(&x->cond_read->threads_count_lock); \
286 if (x->cond_read->threads_count > 0) \
287 ReleaseSemaphore(x->cond_read->semaphore, 1, 0); \
288 LeaveCriticalSection(&x->cond_read->threads_count_lock); \
289 } \
290 else if (x->readers_count > 0) \
291 CDB(x->cond_read); \
292 else if (x->writers_count > 0) \
293 { \
294 EnterCriticalSection (&x->cond_write->threads_count_lock); \
295 if (x->cond_write->threads_count > 0) \
296 ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \
297 LeaveCriticalSection (&x->cond_write->threads_count_lock); \
298 } \
299 } \
300 else if (x->readers > 0) \
301 { \
302 x->readers--; \
303 if (x->readers == 0 && x->writers_count > 0) \
304 { \
305 EnterCriticalSection (&x->cond_write->threads_count_lock); \
306 if (x->cond_write->threads_count > 0) \
307 ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \
308 LeaveCriticalSection (&x->cond_write->threads_count_lock); \
309 } \
310 } \
311 LKU(x->mutex); \
312 } while (0)
313
314# endif 114# endif
315 115
316#endif 116#endif
@@ -336,14 +136,24 @@ struct _Ecore_Pthread_Worker
336 { 136 {
337 Ecore_Thread_Cb func_heavy; 137 Ecore_Thread_Cb func_heavy;
338 Ecore_Thread_Notify_Cb func_notify; 138 Ecore_Thread_Notify_Cb func_notify;
339 Ecore_Pipe *notify;
340 139
341 Ecore_Pipe *direct_pipe;
342 Ecore_Pthread_Worker *direct_worker; 140 Ecore_Pthread_Worker *direct_worker;
343 141
344 int send; 142 int send;
345 int received; 143 int received;
346 } feedback_run; 144 } feedback_run;
145 struct {
146 Ecore_Thread_Cb func_main;
147 Ecore_Thread_Notify_Cb func_notify;
148
149 Ecore_Pipe *send;
150 Ecore_Pthread_Worker *direct_worker;
151
152 struct {
153 int send;
154 int received;
155 } from, to;
156 } message_run;
347 } u; 157 } u;
348 158
349 Ecore_Thread_Cb func_cancel; 159 Ecore_Thread_Cb func_cancel;
@@ -357,47 +167,63 @@ struct _Ecore_Pthread_Worker
357 167
358 const void *data; 168 const void *data;
359 169
360 Eina_Bool cancel : 1; 170 volatile int cancel;
361 Eina_Bool feedback_run : 1; 171
362 Eina_Bool kill : 1; 172#ifdef EFL_HAVE_THREADS
363 Eina_Bool reschedule : 1; 173 LK(cancel_mutex);
364 Eina_Bool no_queue : 1; 174#endif
175
176 Eina_Bool message_run : 1;
177 Eina_Bool feedback_run : 1;
178 Eina_Bool kill : 1;
179 Eina_Bool reschedule : 1;
180 Eina_Bool no_queue : 1;
365}; 181};
366 182
367#ifdef EFL_HAVE_THREADS 183#ifdef EFL_HAVE_THREADS
368typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data; 184typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data;
369
370struct _Ecore_Pthread_Data 185struct _Ecore_Pthread_Data
371{ 186{
372 Ecore_Pthread_Worker *death_job; 187 Ecore_Pthread_Worker *death_job;
373 Ecore_Pipe *p;
374 void *data; 188 void *data;
375 PH(thread); 189 PH(thread);
376}; 190};
191
192typedef struct _Ecore_Pthread_Notify Ecore_Pthread_Notify;
193struct _Ecore_Pthread_Notify
194{
195 Ecore_Pthread_Worker *work;
196 const void *user_data;
197};
198
199typedef void *(*Ecore_Thread_Sync_Cb)(void* data, Ecore_Thread *thread);
200
201typedef struct _Ecore_Pthread_Message Ecore_Pthread_Message;
202struct _Ecore_Pthread_Message
203{
204 union {
205 Ecore_Thread_Cb async;
206 Ecore_Thread_Sync_Cb sync;
207 } u;
208
209 const void *data;
210
211 int code;
212
213 Eina_Bool callback : 1;
214 Eina_Bool sync : 1;
215};
216
377#endif 217#endif
378 218
379static int _ecore_thread_count_max = 0; 219static int _ecore_thread_count_max = 0;
380static int ECORE_THREAD_PIPE_DEL = 0;
381static Eina_Array *_ecore_thread_pipe = NULL;
382 220
383#ifdef EFL_HAVE_THREADS 221#ifdef EFL_HAVE_THREADS
384 222
385static void _ecore_thread_handler(void *data __UNUSED__, 223static void _ecore_thread_handler(void *data);
386 void *buffer,
387 unsigned int nbyte);
388
389static Ecore_Pipe *
390_ecore_thread_pipe_get(void)
391{
392 if (eina_array_count(_ecore_thread_pipe) > 0)
393 return eina_array_pop(_ecore_thread_pipe);
394
395 return ecore_pipe_add(_ecore_thread_handler, NULL);
396}
397 224
398static int _ecore_thread_count = 0; 225static int _ecore_thread_count = 0;
399 226
400static Ecore_Event_Handler *del_handler = NULL;
401static Eina_List *_ecore_active_job_threads = NULL; 227static Eina_List *_ecore_active_job_threads = NULL;
402static Eina_List *_ecore_pending_job_threads = NULL; 228static Eina_List *_ecore_pending_job_threads = NULL;
403static Eina_List *_ecore_pending_job_threads_feedback = NULL; 229static Eina_List *_ecore_pending_job_threads_feedback = NULL;
@@ -435,6 +261,10 @@ static PH(get_main_loop_thread) (void)
435static void 261static void
436_ecore_thread_worker_free(Ecore_Pthread_Worker *worker) 262_ecore_thread_worker_free(Ecore_Pthread_Worker *worker)
437{ 263{
264 LKD(worker->cancel_mutex);
265 CDD(worker->cond);
266 LKD(worker->mutex);
267
438 if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16) 268 if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16)
439 { 269 {
440 free(worker); 270 free(worker);
@@ -454,38 +284,15 @@ _ecore_thread_data_free(void *data)
454} 284}
455 285
456static void 286static void
457_ecore_thread_pipe_free(void *data __UNUSED__,
458 void *event)
459{
460 Ecore_Pipe *p = event;
461
462 if (eina_array_count(_ecore_thread_pipe) < 50)
463 eina_array_push(_ecore_thread_pipe, p);
464 else
465 ecore_pipe_del(p);
466 eina_threads_shutdown();
467}
468
469static Eina_Bool
470_ecore_thread_pipe_del(void *data __UNUSED__,
471 int type __UNUSED__,
472 void *event __UNUSED__)
473{
474 /* This is a hack to delay pipe destruction until we are out of its internal loop. */
475 return ECORE_CALLBACK_CANCEL;
476}
477
478static void
479_ecore_thread_end(Ecore_Pthread_Data *pth, 287_ecore_thread_end(Ecore_Pthread_Data *pth,
480 Ecore_Thread *work) 288 Ecore_Thread *work)
481{ 289{
482 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work; 290 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work;
483 Ecore_Pipe *p;
484 291
485 if (!worker->feedback_run || (worker->feedback_run && !worker->no_queue)) 292 if (!worker->message_run || !worker->feedback_run || (worker->feedback_run && !worker->no_queue))
486 _ecore_thread_count--; 293 _ecore_thread_count--;
487 294
488 if (PHJ(pth->thread, p) != 0) 295 if (PHJ(pth->thread) != 0)
489 return; 296 return;
490 297
491 if (eina_list_count(_ecore_pending_job_threads) > 0 298 if (eina_list_count(_ecore_pending_job_threads) > 0
@@ -496,7 +303,7 @@ _ecore_thread_end(Ecore_Pthread_Data *pth,
496 INF("spawning threads because of still pending jobs."); 303 INF("spawning threads because of still pending jobs.");
497 304
498 pth->death_job = _ecore_thread_worker_new(); 305 pth->death_job = _ecore_thread_worker_new();
499 if (!pth->p || !pth->death_job) goto end; 306 if (!pth->death_job) goto end;
500 307
501 eina_threads_init(); 308 eina_threads_init();
502 309
@@ -514,7 +321,6 @@ end:
514 321
515 _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth); 322 _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth);
516 323
517 ecore_event_add(ECORE_THREAD_PIPE_DEL, pth->p, _ecore_thread_pipe_free, NULL);
518 free(pth); 324 free(pth);
519} 325}
520 326
@@ -534,30 +340,18 @@ _ecore_thread_kill(Ecore_Pthread_Worker *work)
534 340
535 if (work->feedback_run) 341 if (work->feedback_run)
536 { 342 {
537 ecore_pipe_del(work->u.feedback_run.notify);
538
539 if (work->u.feedback_run.direct_pipe)
540 eina_array_push(_ecore_thread_pipe, work->u.feedback_run.direct_pipe);
541 if (work->u.feedback_run.direct_worker) 343 if (work->u.feedback_run.direct_worker)
542 _ecore_thread_worker_free(work->u.feedback_run.direct_worker); 344 _ecore_thread_worker_free(work->u.feedback_run.direct_worker);
543 } 345 }
544 CDD(work->cond);
545 LKD(work->mutex);
546 if (work->hash) 346 if (work->hash)
547 eina_hash_free(work->hash); 347 eina_hash_free(work->hash);
548 _ecore_thread_worker_free(work); 348 _ecore_thread_worker_free(work);
549} 349}
550 350
551static void 351static void
552_ecore_thread_handler(void *data __UNUSED__, 352_ecore_thread_handler(void *data)
553 void *buffer,
554 unsigned int nbyte)
555{ 353{
556 Ecore_Pthread_Worker *work; 354 Ecore_Pthread_Worker *work = data;
557
558 if (nbyte != sizeof (Ecore_Pthread_Worker *)) return;
559
560 work = *(Ecore_Pthread_Worker **)buffer;
561 355
562 if (work->feedback_run) 356 if (work->feedback_run)
563 { 357 {
@@ -571,17 +365,20 @@ _ecore_thread_handler(void *data __UNUSED__,
571 _ecore_thread_kill(work); 365 _ecore_thread_kill(work);
572} 366}
573 367
368#if 0
574static void 369static void
575_ecore_notify_handler(void *data, 370_ecore_nothing_handler(void *data __UNUSED__, void *buffer __UNUSED__, unsigned int nbyte __UNUSED__)
576 void *buffer,
577 unsigned int nbyte)
578{ 371{
579 Ecore_Pthread_Worker *work = data; 372}
580 void *user_data; 373#endif
581 374
582 if (nbyte != sizeof (Ecore_Pthread_Worker *)) return; 375static void
376_ecore_notify_handler(void *data)
377{
378 Ecore_Pthread_Notify *notify = data;
379 Ecore_Pthread_Worker *work = notify->work;
380 void *user_data = (void*) notify->user_data;
583 381
584 user_data = *(void **)buffer;
585 work->u.feedback_run.received++; 382 work->u.feedback_run.received++;
586 383
587 if (work->u.feedback_run.func_notify) 384 if (work->u.feedback_run.func_notify)
@@ -592,16 +389,64 @@ _ecore_notify_handler(void *data,
592 { 389 {
593 _ecore_thread_kill(work); 390 _ecore_thread_kill(work);
594 } 391 }
392
393 free(notify);
394}
395
396static void
397_ecore_message_notify_handler(void *data)
398{
399 Ecore_Pthread_Notify *notify = data;
400 Ecore_Pthread_Worker *work = notify->work;
401 Ecore_Pthread_Message *user_data = (void *) notify->user_data;
402 Eina_Bool delete = EINA_TRUE;
403
404 work->u.message_run.from.received++;
405
406 if (!user_data->callback)
407 {
408 if (work->u.message_run.func_notify)
409 work->u.message_run.func_notify((void *) work->data, (Ecore_Thread *) work, (void *) user_data->data);
410 }
411 else
412 {
413 if (user_data->sync)
414 {
415 user_data->data = user_data->u.sync((void*) user_data->data, (Ecore_Thread *) work);
416 user_data->callback = EINA_FALSE;
417 user_data->code = INT_MAX;
418 ecore_pipe_write(work->u.message_run.send, &user_data, sizeof (Ecore_Pthread_Message *));
419
420 delete = EINA_FALSE;
421 }
422 else
423 {
424 user_data->u.async((void*) user_data->data, (Ecore_Thread *) work);
425 }
426 }
427
428 if (delete)
429 {
430 free(user_data);
431 }
432
433 /* Force reading all notify event before killing the thread */
434 if (work->kill && work->u.message_run.from.send == work->u.message_run.from.received)
435 {
436 _ecore_thread_kill(work);
437 }
438 free(notify);
595} 439}
596 440
597static void 441static void
598_ecore_short_job(Ecore_Pipe *end_pipe, 442_ecore_short_job(PH(thread))
599 PH(thread))
600{ 443{
601 Ecore_Pthread_Worker *work; 444 Ecore_Pthread_Worker *work;
602 445
603 while (_ecore_pending_job_threads) 446 while (_ecore_pending_job_threads)
604 { 447 {
448 int cancel;
449
605 LKL(_ecore_pending_job_threads_mutex); 450 LKL(_ecore_pending_job_threads_mutex);
606 451
607 if (!_ecore_pending_job_threads) 452 if (!_ecore_pending_job_threads)
@@ -616,9 +461,12 @@ _ecore_short_job(Ecore_Pipe *end_pipe,
616 461
617 LKU(_ecore_pending_job_threads_mutex); 462 LKU(_ecore_pending_job_threads_mutex);
618 463
464 LKL(work->cancel_mutex);
465 cancel = work->cancel;
466 LKU(work->cancel_mutex);
619 work->self = thread; 467 work->self = thread;
620 if (!work->cancel) 468 if (!cancel)
621 work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work); 469 work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work);
622 470
623 if (work->reschedule) 471 if (work->reschedule)
624 { 472 {
@@ -630,19 +478,20 @@ _ecore_short_job(Ecore_Pipe *end_pipe,
630 } 478 }
631 else 479 else
632 { 480 {
633 ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *)); 481 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
634 } 482 }
635 } 483 }
636} 484}
637 485
638static void 486static void
639_ecore_feedback_job(Ecore_Pipe *end_pipe, 487_ecore_feedback_job(PH(thread))
640 PH(thread))
641{ 488{
642 Ecore_Pthread_Worker *work; 489 Ecore_Pthread_Worker *work;
643 490
644 while (_ecore_pending_job_threads_feedback) 491 while (_ecore_pending_job_threads_feedback)
645 { 492 {
493 int cancel;
494
646 LKL(_ecore_pending_job_threads_mutex); 495 LKL(_ecore_pending_job_threads_mutex);
647 496
648 if (!_ecore_pending_job_threads_feedback) 497 if (!_ecore_pending_job_threads_feedback)
@@ -657,9 +506,12 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe,
657 506
658 LKU(_ecore_pending_job_threads_mutex); 507 LKU(_ecore_pending_job_threads_mutex);
659 508
509 LKL(work->cancel_mutex);
510 cancel = work->cancel;
511 LKU(work->cancel_mutex);
660 work->self = thread; 512 work->self = thread;
661 if (!work->cancel) 513 if (!cancel)
662 work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work); 514 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
663 515
664 if (work->reschedule) 516 if (work->reschedule)
665 { 517 {
@@ -671,7 +523,7 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe,
671 } 523 }
672 else 524 else
673 { 525 {
674 ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *)); 526 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
675 } 527 }
676 } 528 }
677} 529}
@@ -679,6 +531,7 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe,
679static void * 531static void *
680_ecore_direct_worker(Ecore_Pthread_Worker *work) 532_ecore_direct_worker(Ecore_Pthread_Worker *work)
681{ 533{
534 Ecore_Pthread_Worker *end;
682 Ecore_Pthread_Data *pth; 535 Ecore_Pthread_Data *pth;
683 536
684#ifdef EFL_POSIX_THREADS 537#ifdef EFL_POSIX_THREADS
@@ -691,40 +544,49 @@ _ecore_direct_worker(Ecore_Pthread_Worker *work)
691 pth = malloc(sizeof (Ecore_Pthread_Data)); 544 pth = malloc(sizeof (Ecore_Pthread_Data));
692 if (!pth) return NULL; 545 if (!pth) return NULL;
693 546
694 pth->p = work->u.feedback_run.direct_pipe;
695 if (!pth->p)
696 {
697 free(pth);
698 return NULL;
699 }
700 pth->thread = PHS(); 547 pth->thread = PHS();
701 548
702 work->self = pth->thread; 549 work->self = pth->thread;
703 work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work); 550 if (work->message_run)
551 work->u.message_run.func_main((void *) work->data, (Ecore_Thread *) work);
552 else
553 work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
704 554
705 ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); 555 if (work->message_run)
556 {
557 end = work->u.message_run.direct_worker;
558 work->u.message_run.direct_worker = NULL;
559 }
560 else
561 {
562 end = work->u.feedback_run.direct_worker;
563 work->u.feedback_run.direct_worker = NULL;
564 }
706 565
707 work = work->u.feedback_run.direct_worker; 566 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
708 if (!work) 567
568 if (!end)
709 { 569 {
710 free(pth); 570 free(pth);
711 return NULL; 571 return NULL;
712 } 572 }
713 573
714 work->data = pth; 574 end->data = pth;
715 work->u.short_run.func_blocking = NULL; 575 end->u.short_run.func_blocking = NULL;
716 work->func_end = (void *)_ecore_thread_end; 576 end->func_end = (void *)_ecore_thread_end;
717 work->func_cancel = NULL; 577 end->func_cancel = NULL;
718 work->cancel = EINA_FALSE; 578 end->cancel = EINA_FALSE;
719 work->feedback_run = EINA_FALSE; 579 end->feedback_run = EINA_FALSE;
720 work->kill = EINA_FALSE; 580 end->message_run = EINA_FALSE;
721 work->hash = NULL; 581 end->no_queue = EINA_FALSE;
722 CDI(work->cond); 582 end->kill = EINA_FALSE;
723 LKI(work->mutex); 583 end->hash = NULL;
724 584 LKI(end->mutex);
725 ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); 585 CDI(end->cond, end->mutex);
586
587 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, end);
726 588
727 return pth->p; 589 return NULL;
728} 590}
729 591
730static void * 592static void *
@@ -740,8 +602,8 @@ _ecore_thread_worker(Ecore_Pthread_Data *pth)
740 eina_sched_prio_drop(); 602 eina_sched_prio_drop();
741 603
742restart: 604restart:
743 if (_ecore_pending_job_threads) _ecore_short_job(pth->p, pth->thread); 605 if (_ecore_pending_job_threads) _ecore_short_job(pth->thread);
744 if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->p, pth->thread); 606 if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->thread);
745 607
746 /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */ 608 /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */
747 609
@@ -777,14 +639,14 @@ restart:
777 work->func_cancel = NULL; 639 work->func_cancel = NULL;
778 work->cancel = EINA_FALSE; 640 work->cancel = EINA_FALSE;
779 work->feedback_run = EINA_FALSE; 641 work->feedback_run = EINA_FALSE;
642 work->message_run = EINA_FALSE;
780 work->kill = EINA_FALSE; 643 work->kill = EINA_FALSE;
644 work->no_queue = EINA_FALSE;
781 work->hash = NULL; 645 work->hash = NULL;
782 CDI(work->cond);
783 LKI(work->mutex);
784 646
785 ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); 647 ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
786 648
787 return pth->p; 649 return NULL;
788} 650}
789 651
790#endif 652#endif
@@ -800,6 +662,10 @@ _ecore_thread_worker_new(void)
800 if (!result) result = malloc(sizeof (Ecore_Pthread_Worker)); 662 if (!result) result = malloc(sizeof (Ecore_Pthread_Worker));
801 else _ecore_thread_worker_count--; 663 else _ecore_thread_worker_count--;
802 664
665 LKI(result->cancel_mutex);
666 LKI(result->mutex);
667 CDI(result->cond, result->mutex);
668
803 return result; 669 return result;
804#else 670#else
805 return malloc(sizeof (Ecore_Pthread_Worker)); 671 return malloc(sizeof (Ecore_Pthread_Worker));
@@ -813,16 +679,11 @@ _ecore_thread_init(void)
813 if (_ecore_thread_count_max <= 0) 679 if (_ecore_thread_count_max <= 0)
814 _ecore_thread_count_max = 1; 680 _ecore_thread_count_max = 1;
815 681
816 ECORE_THREAD_PIPE_DEL = ecore_event_type_new();
817 _ecore_thread_pipe = eina_array_new(8);
818
819#ifdef EFL_HAVE_THREADS 682#ifdef EFL_HAVE_THREADS
820 del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
821
822 LKI(_ecore_pending_job_threads_mutex); 683 LKI(_ecore_pending_job_threads_mutex);
823 LRWKI(_ecore_thread_global_hash_lock); 684 LRWKI(_ecore_thread_global_hash_lock);
824 LKI(_ecore_thread_global_hash_mutex); 685 LKI(_ecore_thread_global_hash_mutex);
825 CDI(_ecore_thread_global_hash_cond); 686 CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex);
826#endif 687#endif
827} 688}
828 689
@@ -830,10 +691,6 @@ void
830_ecore_thread_shutdown(void) 691_ecore_thread_shutdown(void)
831{ 692{
832 /* FIXME: If function are still running in the background, should we kill them ? */ 693 /* FIXME: If function are still running in the background, should we kill them ? */
833 Ecore_Pipe *p;
834 Eina_Array_Iterator it;
835 unsigned int i;
836
837#ifdef EFL_HAVE_THREADS 694#ifdef EFL_HAVE_THREADS
838 Ecore_Pthread_Worker *work; 695 Ecore_Pthread_Worker *work;
839 Ecore_Pthread_Data *pth; 696 Ecore_Pthread_Data *pth;
@@ -843,46 +700,39 @@ _ecore_thread_shutdown(void)
843 EINA_LIST_FREE(_ecore_pending_job_threads, work) 700 EINA_LIST_FREE(_ecore_pending_job_threads, work)
844 { 701 {
845 if (work->func_cancel) 702 if (work->func_cancel)
846 work->func_cancel((void *)work->data, (Ecore_Thread *)work); 703 work->func_cancel((void *)work->data, (Ecore_Thread *) work);
847 free(work); 704 free(work);
848 } 705 }
849 706
850 EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work) 707 EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work)
851 { 708 {
852 if (work->func_cancel) 709 if (work->func_cancel)
853 work->func_cancel((void *)work->data, (Ecore_Thread *)work); 710 work->func_cancel((void *)work->data, (Ecore_Thread *) work);
854 free(work); 711 free(work);
855 } 712 }
856 713
857 LKU(_ecore_pending_job_threads_mutex); 714 LKU(_ecore_pending_job_threads_mutex);
858 715
859 /* Improve emergency shutdown */ 716 /* FIXME: Improve emergency shutdown, now that we use async call, we can do something */
860 EINA_LIST_FREE(_ecore_active_job_threads, pth) 717 EINA_LIST_FREE(_ecore_active_job_threads, pth)
861 { 718 {
862 Ecore_Pipe *ep;
863
864 PHA(pth->thread); 719 PHA(pth->thread);
865 PHJ(pth->thread, ep); 720 PHJ(pth->thread);
866
867 ecore_pipe_del(pth->p);
868 } 721 }
869 if (_ecore_thread_global_hash) 722 if (_ecore_thread_global_hash)
870 eina_hash_free(_ecore_thread_global_hash); 723 eina_hash_free(_ecore_thread_global_hash);
871 _ecore_event_handler_del(del_handler);
872 have_main_loop_thread = 0; 724 have_main_loop_thread = 0;
873 del_handler = NULL; 725
726 while ((work = eina_trash_pop(&_ecore_thread_worker_trash)))
727 {
728 free(work);
729 }
874 730
875 LKD(_ecore_pending_job_threads_mutex); 731 LKD(_ecore_pending_job_threads_mutex);
876 LRWKD(_ecore_thread_global_hash_lock); 732 LRWKD(_ecore_thread_global_hash_lock);
877 LKD(_ecore_thread_global_hash_mutex); 733 LKD(_ecore_thread_global_hash_mutex);
878 CDD(_ecore_thread_global_hash_cond); 734 CDD(_ecore_thread_global_hash_cond);
879#endif 735#endif
880
881 EINA_ARRAY_ITER_NEXT(_ecore_thread_pipe, i, p, it)
882 ecore_pipe_del(p);
883
884 eina_array_free(_ecore_thread_pipe);
885 _ecore_thread_pipe = NULL;
886} 736}
887 737
888void 738void
@@ -927,15 +777,15 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
927 work->func_cancel = func_cancel; 777 work->func_cancel = func_cancel;
928 work->cancel = EINA_FALSE; 778 work->cancel = EINA_FALSE;
929 work->feedback_run = EINA_FALSE; 779 work->feedback_run = EINA_FALSE;
780 work->message_run = EINA_FALSE;
930 work->kill = EINA_FALSE; 781 work->kill = EINA_FALSE;
931 work->reschedule = EINA_FALSE; 782 work->reschedule = EINA_FALSE;
783 work->no_queue = EINA_FALSE;
932 work->data = data; 784 work->data = data;
933 785
934#ifdef EFL_HAVE_THREADS 786#ifdef EFL_HAVE_THREADS
935 work->self = 0; 787 work->self = 0;
936 work->hash = NULL; 788 work->hash = NULL;
937 CDI(work->cond);
938 LKI(work->mutex);
939 789
940 LKL(_ecore_pending_job_threads_mutex); 790 LKL(_ecore_pending_job_threads_mutex);
941 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work); 791 _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
@@ -952,9 +802,8 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
952 pth = malloc(sizeof (Ecore_Pthread_Data)); 802 pth = malloc(sizeof (Ecore_Pthread_Data));
953 if (!pth) goto on_error; 803 if (!pth) goto on_error;
954 804
955 pth->p = _ecore_thread_pipe_get();
956 pth->death_job = _ecore_thread_worker_new(); 805 pth->death_job = _ecore_thread_worker_new();
957 if (!pth->p || !pth->death_job) goto on_error; 806 if (!pth->death_job) goto on_error;
958 807
959 eina_threads_init(); 808 eina_threads_init();
960 809
@@ -969,7 +818,6 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
969on_error: 818on_error:
970 if (pth) 819 if (pth)
971 { 820 {
972 if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p);
973 if (pth->death_job) _ecore_thread_worker_free(pth->death_job); 821 if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
974 free(pth); 822 free(pth);
975 } 823 }
@@ -981,7 +829,11 @@ on_error:
981 LKU(_ecore_pending_job_threads_mutex); 829 LKU(_ecore_pending_job_threads_mutex);
982 830
983 if (work->func_cancel) 831 if (work->func_cancel)
984 work->func_cancel((void *)work->data, (Ecore_Thread *)work); 832 work->func_cancel((void *) work->data, (Ecore_Thread *) work);
833
834 CDD(work->cond);
835 LKD(work->mutex);
836 LKD(work->cancel_mutex);
985 free(work); 837 free(work);
986 work = NULL; 838 work = NULL;
987 } 839 }
@@ -1013,12 +865,16 @@ EAPI Eina_Bool
1013ecore_thread_cancel(Ecore_Thread *thread) 865ecore_thread_cancel(Ecore_Thread *thread)
1014{ 866{
1015#ifdef EFL_HAVE_THREADS 867#ifdef EFL_HAVE_THREADS
1016 Ecore_Pthread_Worker *work = (Ecore_Pthread_Worker *)thread; 868 Ecore_Pthread_Worker *volatile work = (Ecore_Pthread_Worker *)thread;
1017 Eina_List *l; 869 Eina_List *l;
870 int cancel;
1018 871
1019 if (!work) 872 if (!work)
1020 return EINA_TRUE; 873 return EINA_TRUE;
1021 if (work->cancel) 874 LKL(work->cancel_mutex);
875 cancel = work->cancel;
876 LKU(work->cancel_mutex);
877 if (cancel)
1022 return EINA_FALSE; 878 return EINA_FALSE;
1023 879
1024 if (work->feedback_run) 880 if (work->feedback_run)
@@ -1070,9 +926,14 @@ ecore_thread_cancel(Ecore_Thread *thread)
1070 926
1071 LKU(_ecore_pending_job_threads_mutex); 927 LKU(_ecore_pending_job_threads_mutex);
1072 928
929 work = (Ecore_Pthread_Worker *)thread;
930
1073 /* Delay the destruction */ 931 /* Delay the destruction */
1074on_exit: 932 on_exit:
1075 ((Ecore_Pthread_Worker *)thread)->cancel = EINA_TRUE; 933 LKL(work->cancel_mutex);
934 work->cancel = EINA_TRUE;
935 LKU(work->cancel_mutex);
936
1076 return EINA_FALSE; 937 return EINA_FALSE;
1077#else 938#else
1078 (void) thread; 939 (void) thread;
@@ -1083,10 +944,23 @@ on_exit:
1083EAPI Eina_Bool 944EAPI Eina_Bool
1084ecore_thread_check(Ecore_Thread *thread) 945ecore_thread_check(Ecore_Thread *thread)
1085{ 946{
1086 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; 947 Ecore_Pthread_Worker *volatile worker = (Ecore_Pthread_Worker *) thread;
948 int cancel;
1087 949
1088 if (!worker) return EINA_TRUE; 950 if (!worker) return EINA_TRUE;
1089 return worker->cancel; 951#ifdef EFL_HAVE_THREADS
952 LKL(worker->cancel_mutex);
953#endif
954 cancel = worker->cancel;
955 /* FIXME: there is an insane bug driving me nuts here. I don't know if
956 it's a race condition, some cache issue or some alien attack on our software.
957 But ecore_thread_check will only work correctly with a printf, all the volatile,
958 lock and even usleep don't help here... */
959 /* fprintf(stderr, "wc: %i\n", cancel); */
960#ifdef EFL_HAVE_THREADS
961 LKU(worker->cancel_mutex);
962#endif
963 return cancel;
1090} 964}
1091 965
1092EAPI Ecore_Thread * 966EAPI Ecore_Thread *
@@ -1109,12 +983,11 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
1109 worker->u.feedback_run.func_heavy = func_heavy; 983 worker->u.feedback_run.func_heavy = func_heavy;
1110 worker->u.feedback_run.func_notify = func_notify; 984 worker->u.feedback_run.func_notify = func_notify;
1111 worker->hash = NULL; 985 worker->hash = NULL;
1112 CDI(worker->cond);
1113 LKI(worker->mutex);
1114 worker->func_cancel = func_cancel; 986 worker->func_cancel = func_cancel;
1115 worker->func_end = func_end; 987 worker->func_end = func_end;
1116 worker->data = data; 988 worker->data = data;
1117 worker->cancel = EINA_FALSE; 989 worker->cancel = EINA_FALSE;
990 worker->message_run = EINA_FALSE;
1118 worker->feedback_run = EINA_TRUE; 991 worker->feedback_run = EINA_TRUE;
1119 worker->kill = EINA_FALSE; 992 worker->kill = EINA_FALSE;
1120 worker->reschedule = EINA_FALSE; 993 worker->reschedule = EINA_FALSE;
@@ -1123,15 +996,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
1123 worker->u.feedback_run.send = 0; 996 worker->u.feedback_run.send = 0;
1124 worker->u.feedback_run.received = 0; 997 worker->u.feedback_run.received = 0;
1125 998
1126 worker->u.feedback_run.notify = ecore_pipe_add(_ecore_notify_handler, worker);
1127 worker->u.feedback_run.direct_pipe = NULL;
1128 worker->u.feedback_run.direct_worker = NULL; 999 worker->u.feedback_run.direct_worker = NULL;
1129 1000
1130 if (!try_no_queue) 1001 if (try_no_queue)
1131 { 1002 {
1132 PH(t); 1003 PH(t);
1133 1004
1134 worker->u.feedback_run.direct_pipe = _ecore_thread_pipe_get();
1135 worker->u.feedback_run.direct_worker = _ecore_thread_worker_new(); 1005 worker->u.feedback_run.direct_worker = _ecore_thread_worker_new();
1136 worker->no_queue = EINA_TRUE; 1006 worker->no_queue = EINA_TRUE;
1137 1007
@@ -1140,6 +1010,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
1140 if (PHC(t, _ecore_direct_worker, worker) == 0) 1010 if (PHC(t, _ecore_direct_worker, worker) == 0)
1141 return (Ecore_Thread *)worker; 1011 return (Ecore_Thread *)worker;
1142 1012
1013 if (worker->u.feedback_run.direct_worker)
1014 {
1015 _ecore_thread_worker_free(worker->u.feedback_run.direct_worker);
1016 worker->u.feedback_run.direct_worker = NULL;
1017 }
1018
1143 eina_threads_shutdown(); 1019 eina_threads_shutdown();
1144 } 1020 }
1145 1021
@@ -1160,9 +1036,8 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
1160 pth = malloc(sizeof (Ecore_Pthread_Data)); 1036 pth = malloc(sizeof (Ecore_Pthread_Data));
1161 if (!pth) goto on_error; 1037 if (!pth) goto on_error;
1162 1038
1163 pth->p = _ecore_thread_pipe_get();
1164 pth->death_job = _ecore_thread_worker_new(); 1039 pth->death_job = _ecore_thread_worker_new();
1165 if (!pth->p || !pth->death_job) goto on_error; 1040 if (!pth->death_job) goto on_error;
1166 1041
1167 eina_threads_init(); 1042 eina_threads_init();
1168 1043
@@ -1177,7 +1052,6 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
1177on_error: 1052on_error:
1178 if (pth) 1053 if (pth)
1179 { 1054 {
1180 if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p);
1181 if (pth->death_job) _ecore_thread_worker_free(pth->death_job); 1055 if (pth->death_job) _ecore_thread_worker_free(pth->death_job);
1182 free(pth); 1056 free(pth);
1183 } 1057 }
@@ -1193,7 +1067,8 @@ on_error:
1193 1067
1194 if (worker) 1068 if (worker)
1195 { 1069 {
1196 ecore_pipe_del(worker->u.feedback_run.notify); 1070 CDD(worker->cond);
1071 LKD(worker->mutex);
1197 free(worker); 1072 free(worker);
1198 worker = NULL; 1073 worker = NULL;
1199 } 1074 }
@@ -1211,7 +1086,6 @@ on_error:
1211 */ 1086 */
1212 worker.u.feedback_run.func_heavy = func_heavy; 1087 worker.u.feedback_run.func_heavy = func_heavy;
1213 worker.u.feedback_run.func_notify = func_notify; 1088 worker.u.feedback_run.func_notify = func_notify;
1214 worker.u.feedback_run.notify = NULL;
1215 worker.u.feedback_run.send = 0; 1089 worker.u.feedback_run.send = 0;
1216 worker.u.feedback_run.received = 0; 1090 worker.u.feedback_run.received = 0;
1217 worker.func_cancel = func_cancel; 1091 worker.func_cancel = func_cancel;
@@ -1219,6 +1093,7 @@ on_error:
1219 worker.data = data; 1093 worker.data = data;
1220 worker.cancel = EINA_FALSE; 1094 worker.cancel = EINA_FALSE;
1221 worker.feedback_run = EINA_TRUE; 1095 worker.feedback_run = EINA_TRUE;
1096 worker.message_run = EINA_FALSE;
1222 worker.kill = EINA_FALSE; 1097 worker.kill = EINA_FALSE;
1223 1098
1224 do { 1099 do {
@@ -1241,13 +1116,48 @@ ecore_thread_feedback(Ecore_Thread *thread,
1241 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; 1116 Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread;
1242 1117
1243 if (!worker) return EINA_FALSE; 1118 if (!worker) return EINA_FALSE;
1244 if (!worker->feedback_run) return EINA_FALSE;
1245 1119
1246#ifdef EFL_HAVE_THREADS 1120#ifdef EFL_HAVE_THREADS
1247 if (!PHE(worker->self, PHS())) return EINA_FALSE; 1121 if (!PHE(worker->self, PHS())) return EINA_FALSE;
1248 1122
1249 worker->u.feedback_run.send++; 1123 if (worker->feedback_run)
1250 ecore_pipe_write(worker->u.feedback_run.notify, &data, sizeof (void *)); 1124 {
1125 Ecore_Pthread_Notify *notify;
1126
1127 notify = malloc(sizeof (Ecore_Pthread_Notify));
1128 if (!notify) return EINA_FALSE;
1129
1130 notify->user_data = data;
1131 notify->work = worker;
1132 worker->u.feedback_run.send++;
1133
1134 ecore_main_loop_thread_safe_call_async(_ecore_notify_handler, notify);
1135 }
1136 else if (worker->message_run)
1137 {
1138 Ecore_Pthread_Message *msg;
1139 Ecore_Pthread_Notify *notify;
1140
1141 msg = malloc(sizeof (Ecore_Pthread_Message*));
1142 if (!msg) return EINA_FALSE;
1143 msg->data = data;
1144 msg->callback = EINA_FALSE;
1145 msg->sync = EINA_FALSE;
1146
1147 notify = malloc(sizeof (Ecore_Pthread_Notify));
1148 if (!notify)
1149 {
1150 free(msg);
1151 return EINA_FALSE;
1152 }
1153 notify->work = worker;
1154 notify->user_data = msg;
1155
1156 worker->u.message_run.from.send++;
1157 ecore_main_loop_thread_safe_call_async(_ecore_message_notify_handler, notify);
1158 }
1159 else
1160 return EINA_FALSE;
1251 1161
1252 return EINA_TRUE; 1162 return EINA_TRUE;
1253#else 1163#else
@@ -1257,6 +1167,71 @@ ecore_thread_feedback(Ecore_Thread *thread,
1257#endif 1167#endif
1258} 1168}
1259 1169
1170#if 0
1171EAPI Ecore_Thread *
1172ecore_thread_message_run(Ecore_Thread_Cb func_main,
1173 Ecore_Thread_Notify_Cb func_notify,
1174 Ecore_Thread_Cb func_end,
1175 Ecore_Thread_Cb func_cancel,
1176 const void *data)
1177{
1178#ifdef EFL_HAVE_THREADS
1179 Ecore_Pthread_Worker *worker;
1180 PH(t);
1181
1182 if (!func_main) return NULL;
1183
1184 worker = _ecore_thread_worker_new();
1185 if (!worker) return NULL;
1186
1187 worker->u.message_run.func_main = func_main;
1188 worker->u.message_run.func_notify = func_notify;
1189 worker->u.message_run.direct_worker = _ecore_thread_worker_new();
1190 worker->u.message_run.send = ecore_pipe_add(_ecore_nothing_handler, worker);
1191 worker->u.message_run.from.send = 0;
1192 worker->u.message_run.from.received = 0;
1193 worker->u.message_run.to.send = 0;
1194 worker->u.message_run.to.received = 0;
1195
1196 ecore_pipe_freeze(worker->u.message_run.send);
1197
1198 worker->func_cancel = func_cancel;
1199 worker->func_end = func_end;
1200 worker->hash = NULL;
1201 worker->data = data;
1202
1203 worker->cancel = EINA_FALSE;
1204 worker->message_run = EINA_TRUE;
1205 worker->feedback_run = EINA_FALSE;
1206 worker->kill = EINA_FALSE;
1207 worker->reschedule = EINA_FALSE;
1208 worker->no_queue = EINA_FALSE;
1209 worker->self = 0;
1210
1211 eina_threads_init();
1212
1213 if (PHC(t, _ecore_direct_worker, worker) == 0)
1214 return (Ecore_Thread*) worker;
1215
1216 eina_threads_shutdown();
1217
1218 if (worker->u.message_run.direct_worker) _ecore_thread_worker_free(worker->u.message_run.direct_worker);
1219 if (worker->u.message_run.send) ecore_pipe_del(worker->u.message_run.send);
1220
1221 CDD(worker->cond);
1222 LKD(worker->mutex);
1223#else
1224 /* Note: This type of thread can't and never will work without thread support */
1225 WRN("ecore_thread_message_run called, but threads disable in Ecore, things will go wrong. Starting now !");
1226# warning "You disabled threads support in ecore, I hope you know what you are doing !"
1227#endif
1228
1229 func_cancel((void *) data, NULL);
1230
1231 return NULL;
1232}
1233#endif
1234
1260EAPI Eina_Bool 1235EAPI Eina_Bool
1261ecore_thread_reschedule(Ecore_Thread *thread) 1236ecore_thread_reschedule(Ecore_Thread *thread)
1262{ 1237{
@@ -1641,24 +1616,13 @@ ecore_thread_global_data_wait(const char *key,
1641 1616
1642 while (1) 1617 while (1)
1643 { 1618 {
1644#ifndef _WIN32
1645 struct timespec t = { 0, 0 };
1646
1647 t.tv_sec = (long int)tm;
1648 t.tv_nsec = (long int)((tm - (double)t.tv_sec) * 1000000000);
1649#else
1650 struct timeval t = { 0, 0 };
1651
1652 t.tv_sec = (long int)tm;
1653 t.tv_usec = (long int)((tm - (double)t.tv_sec) * 1000000);
1654#endif
1655 LRWKRL(_ecore_thread_global_hash_lock); 1619 LRWKRL(_ecore_thread_global_hash_lock);
1656 ret = eina_hash_find(_ecore_thread_global_hash, key); 1620 ret = eina_hash_find(_ecore_thread_global_hash, key);
1657 LRWKU(_ecore_thread_global_hash_lock); 1621 LRWKU(_ecore_thread_global_hash_lock);
1658 if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get()))) 1622 if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get())))
1659 break; 1623 break;
1660 LKL(_ecore_thread_global_hash_mutex); 1624 LKL(_ecore_thread_global_hash_mutex);
1661 CDW(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex, &t); 1625 CDW(_ecore_thread_global_hash_cond, tm);
1662 LKU(_ecore_thread_global_hash_mutex); 1626 LKU(_ecore_thread_global_hash_mutex);
1663 } 1627 }
1664 if (ret) return ret->data; 1628 if (ret) return ret->data;
diff --git a/libraries/ecore/src/lib/ecore/ecore_time.c b/libraries/ecore/src/lib/ecore/ecore_time.c
index 8e7611b..0eeb1d6 100644
--- a/libraries/ecore/src/lib/ecore/ecore_time.c
+++ b/libraries/ecore/src/lib/ecore/ecore_time.c
@@ -21,7 +21,7 @@
21 21
22#include <time.h> 22#include <time.h>
23 23
24#ifdef HAVE_CLOCK_GETTIME 24#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
25static clockid_t _ecore_time_clock_id = -1; 25static clockid_t _ecore_time_clock_id = -1;
26#elif defined(__APPLE__) && defined(__MACH__) 26#elif defined(__APPLE__) && defined(__MACH__)
27static double _ecore_time_clock_conversion = 1e-9; 27static double _ecore_time_clock_conversion = 1e-9;
@@ -52,7 +52,7 @@ double _ecore_time_loop_time = -1.0;
52EAPI double 52EAPI double
53ecore_time_get(void) 53ecore_time_get(void)
54{ 54{
55#ifdef HAVE_CLOCK_GETTIME 55#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
56 struct timespec t; 56 struct timespec t;
57 57
58 if (EINA_UNLIKELY(_ecore_time_clock_id < 0)) 58 if (EINA_UNLIKELY(_ecore_time_clock_id < 0))
@@ -136,7 +136,7 @@ ecore_loop_time_get(void)
136void 136void
137_ecore_time_init(void) 137_ecore_time_init(void)
138{ 138{
139#ifdef HAVE_CLOCK_GETTIME 139#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME)
140 struct timespec t; 140 struct timespec t;
141 141
142 if (_ecore_time_clock_id != -1) return; 142 if (_ecore_time_clock_id != -1) return;
diff --git a/libraries/ecore/src/lib/ecore/ecore_timer.c b/libraries/ecore/src/lib/ecore/ecore_timer.c
index cc19e3f..d76733b 100644
--- a/libraries/ecore/src/lib/ecore/ecore_timer.c
+++ b/libraries/ecore/src/lib/ecore/ecore_timer.c
@@ -56,7 +56,7 @@ static double last_check = 0.0;
56static double precision = 10.0 / 1000000.0; 56static double precision = 10.0 / 1000000.0;
57 57
58/** 58/**
59 * @addtogroup Ecore_Time_Group 59 * @addtogroup Ecore_Timer_Group
60 * 60 *
61 * @{ 61 * @{
62 */ 62 */
@@ -73,12 +73,15 @@ ecore_timer_precision_get(void)
73} 73}
74 74
75/** 75/**
76 * Sets the precision to be used by timer infrastructure. 76 * @brief Sets the precision to be used by timer infrastructure.
77 * 77 *
78 * When system calculates time to expire the next timer we'll be able 78 * @param value allowed introduced timeout delay, in seconds.
79 * to delay the timer by the given amount so more timers will fit in 79 *
80 * the same dispatch, waking up the system less often and thus being 80 * This sets the precision for @b all timers. The precision determines how much
81 * able to save power. 81 * of an difference from the requested interval is acceptable. One common reason
82 * to use this function is to @b increase the allowed timeout and thus @b
83 * decrease precision of the timers, this is because less precise the timers
84 * result in the system waking up less often and thus consuming less resources.
82 * 85 *
83 * Be aware that kernel may delay delivery even further, these delays 86 * Be aware that kernel may delay delivery even further, these delays
84 * are always possible due other tasks having higher priorities or 87 * are always possible due other tasks having higher priorities or
@@ -93,8 +96,6 @@ ecore_timer_precision_get(void)
93 * @note Ecore is smart enough to see if there are timers in the 96 * @note Ecore is smart enough to see if there are timers in the
94 * precision range, if it does not, in our example if no second timer 97 * precision range, if it does not, in our example if no second timer
95 * in (T + precision) existed, then it would use the minimum timeout. 98 * in (T + precision) existed, then it would use the minimum timeout.
96 *
97 * @param value allowed introduced timeout delay, in seconds.
98 */ 99 */
99EAPI void 100EAPI void
100ecore_timer_precision_set(double value) 101ecore_timer_precision_set(double value)
@@ -322,7 +323,7 @@ ecore_timer_reset(Ecore_Timer *timer)
322 * Get the pending time regarding a timer. 323 * Get the pending time regarding a timer.
323 * 324 *
324 * @param timer The timer to learn from. 325 * @param timer The timer to learn from.
325 * @ingroup Ecore_Time_Group 326 * @ingroup Ecore_Timer_Group
326 */ 327 */
327EAPI double 328EAPI double
328ecore_timer_pending_get(Ecore_Timer *timer) 329ecore_timer_pending_get(Ecore_Timer *timer)
diff --git a/libraries/ecore/src/lib/ecore_cocoa/Makefile.in b/libraries/ecore/src/lib/ecore_cocoa/Makefile.in
index 15ce879..447c3ef 100644
--- a/libraries/ecore/src/lib/ecore_cocoa/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_cocoa/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -192,6 +191,8 @@ EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@ 191EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@ 192EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@ 193EXEEXT = @EXEEXT@
194EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
195EXOTIC_LIBS = @EXOTIC_LIBS@
195FGREP = @FGREP@ 196FGREP = @FGREP@
196GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
197GLIB_CFLAGS = @GLIB_CFLAGS@ 198GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -247,6 +248,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
247PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
248PIXMAN_LIBS = @PIXMAN_LIBS@ 249PIXMAN_LIBS = @PIXMAN_LIBS@
249PKG_CONFIG = @PKG_CONFIG@ 250PKG_CONFIG = @PKG_CONFIG@
251PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
252PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
250POSUB = @POSUB@ 253POSUB = @POSUB@
251RANLIB = @RANLIB@ 254RANLIB = @RANLIB@
252SCIM_CFLAGS = @SCIM_CFLAGS@ 255SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -257,6 +260,7 @@ SDL_LIBS = @SDL_LIBS@
257SED = @SED@ 260SED = @SED@
258SET_MAKE = @SET_MAKE@ 261SET_MAKE = @SET_MAKE@
259SHELL = @SHELL@ 262SHELL = @SHELL@
263SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
260SSL_CFLAGS = @SSL_CFLAGS@ 264SSL_CFLAGS = @SSL_CFLAGS@
261SSL_LIBS = @SSL_LIBS@ 265SSL_LIBS = @SSL_LIBS@
262STRIP = @STRIP@ 266STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h
index c3af46a..d0ca6f6 100644
--- a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h
+++ b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h
@@ -723,10 +723,13 @@ EAPI Eina_Bool ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_
723 */ 723 */
724 724
725EAPI Ecore_Con_Socks *ecore_con_socks4_remote_add(const char *ip, int port, const char *username); 725EAPI Ecore_Con_Socks *ecore_con_socks4_remote_add(const char *ip, int port, const char *username);
726EAPI void ecore_con_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable);
727EAPI Eina_Bool ecore_con_socks4_lookup_get(Ecore_Con_Socks *ecs);
728EAPI Eina_Bool ecore_con_socks4_remote_exists(const char *ip, int port, const char *username); 726EAPI Eina_Bool ecore_con_socks4_remote_exists(const char *ip, int port, const char *username);
729EAPI void ecore_con_socks4_remote_del(const char *ip, int port, const char *username); 727EAPI void ecore_con_socks4_remote_del(const char *ip, int port, const char *username);
728EAPI Ecore_Con_Socks *ecore_con_socks5_remote_add(const char *ip, int port, const char *username, const char *password);
729EAPI Eina_Bool ecore_con_socks5_remote_exists(const char *ip, int port, const char *username, const char *password);
730EAPI void ecore_con_socks5_remote_del(const char *ip, int port, const char *username, const char *password);
731EAPI void ecore_con_socks_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable);
732EAPI Eina_Bool ecore_con_socks_lookup_get(Ecore_Con_Socks *ecs);
730EAPI void ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind); 733EAPI void ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind);
731EAPI Eina_Bool ecore_con_socks_bind_get(Ecore_Con_Socks *ecs); 734EAPI Eina_Bool ecore_con_socks_bind_get(Ecore_Con_Socks *ecs);
732EAPI unsigned int ecore_con_socks_version_get(Ecore_Con_Socks *ecs); 735EAPI unsigned int ecore_con_socks_version_get(Ecore_Con_Socks *ecs);
@@ -744,8 +747,8 @@ EAPI void ecore_con_socks_apply_always(Ecore_Con_Socks *ecs);
744 * 747 *
745 * Setting up a server is very simple: you just need to start it with 748 * Setting up a server is very simple: you just need to start it with
746 * ecore_con_server_add() and setup some callbacks to the events 749 * ecore_con_server_add() and setup some callbacks to the events
747 * #ECORE_CON_EVENT_CLIENT_ADD, #ECORE_CON_EVENT_CLIENT_DEL and 750 * @ref ECORE_CON_EVENT_CLIENT_ADD, @ref ECORE_CON_EVENT_CLIENT_DEL and
748 * #ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is 751 * @ref ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is
749 * communicating with the server: 752 * communicating with the server:
750 * 753 *
751 * @code 754 * @code
@@ -867,8 +870,8 @@ EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type,
867 * 870 *
868 * However, even if this call returns a valid @ref Ecore_Con_Server, the 871 * However, even if this call returns a valid @ref Ecore_Con_Server, the
869 * connection will only be successfully completed if an event of type 872 * connection will only be successfully completed if an event of type
870 * #ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an 873 * @ref ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an
871 * #ECORE_CON_EVENT_SERVER_DEL will be received. 874 * @ref ECORE_CON_EVENT_SERVER_DEL will be received.
872 * 875 *
873 * The @p data parameter can be fetched later using ecore_con_server_data_get() 876 * The @p data parameter can be fetched later using ecore_con_server_data_get()
874 * or changed with ecore_con_server_data_set(). 877 * or changed with ecore_con_server_data_set().
@@ -1335,6 +1338,35 @@ typedef enum _Ecore_Con_Url_Time
1335} Ecore_Con_Url_Time; 1338} Ecore_Con_Url_Time;
1336 1339
1337/** 1340/**
1341 * @typedef Ecore_Con_Url_Http_Version
1342 * @enum _Ecore_Con_Url_Http_Version
1343 * The http version to use
1344 * @since 1.2
1345 */
1346typedef enum _Ecore_Con_Url_Http_Version
1347{
1348 /**
1349 * HTTP version 1.0
1350 * @since 1.2
1351 */
1352 ECORE_CON_URL_HTTP_VERSION_1_0,
1353 /**
1354 * HTTP version 1.1 (default)
1355 * @since 1.2
1356 */
1357 ECORE_CON_URL_HTTP_VERSION_1_1
1358} Ecore_Con_Url_Http_Version;
1359
1360/**
1361 * Change the HTTP version used for the request
1362 * @param version The version to be used
1363 * @return EINA_TRUE on success, EINA_FALSE on failure to change version
1364 * @since 1.2
1365 * @see ecore_con_url_pipeline_get()
1366 */
1367EAPI Eina_Bool ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version);
1368
1369/**
1338 * Initialises the Ecore_Con_Url library. 1370 * Initialises the Ecore_Con_Url library.
1339 * @return Number of times the library has been initialised without being 1371 * @return Number of times the library has been initialised without being
1340 * shut down. 1372 * shut down.
@@ -1554,33 +1586,6 @@ EAPI Eina_Bool ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
1554 const char *password, 1586 const char *password,
1555 Eina_Bool safe); 1587 Eina_Bool safe);
1556/** 1588/**
1557 * Sends a request.
1558 *
1559 * @param url_con Connection object to perform a request on, previously created
1560 * with ecore_con_url_new() or ecore_con_url_custom_new().
1561 * @param data Payload (data sent on the request)
1562 * @param length Payload length. If @c -1, rely on automatic length
1563 * calculation via @c strlen() on @p data.
1564 * @param content_type Content type of the payload (e.g. text/xml)
1565 *
1566 * @return #EINA_TRUE on success, #EINA_FALSE on error.
1567 *
1568 * @see ecore_con_url_custom_new()
1569 * @see ecore_con_url_additional_headers_clear()
1570 * @see ecore_con_url_additional_header_add()
1571 * @see ecore_con_url_data_set()
1572 * @see ecore_con_url_data_get()
1573 * @see ecore_con_url_response_headers_get()
1574 * @see ecore_con_url_time()
1575 * @see ecore_con_url_get()
1576 * @see ecore_con_url_post()
1577 *
1578 * @deprecated Use ecore_con_url_post() instead of this.
1579 */
1580EINA_DEPRECATED EAPI Eina_Bool ecore_con_url_send(Ecore_Con_Url *url_con,
1581 const void *data, long length,
1582 const char *content_type);
1583/**
1584 * Sends a get request. 1589 * Sends a get request.
1585 * 1590 *
1586 * @param url_con Connection object to perform a request on, previously created 1591 * @param url_con Connection object to perform a request on, previously created
@@ -1913,6 +1918,16 @@ EAPI Eina_Bool ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const ch
1913EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout); 1918EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout);
1914 1919
1915/** 1920/**
1921 * Get the returned HTTP STATUS code
1922 *
1923 * This is used to, at any time, try to return the status code for a transmission.
1924 * @param url_con Connection object
1925 * @return A valid HTTP STATUS code, or 0 on failure
1926 *
1927 * @since 1.2
1928 */
1929EAPI int ecore_con_url_status_code_get(Ecore_Con_Url *url_con);
1930/**
1916 * @} 1931 * @}
1917 */ 1932 */
1918 1933
diff --git a/libraries/ecore/src/lib/ecore_con/Makefile.in b/libraries/ecore/src/lib/ecore_con/Makefile.in
index 58811da..c35b08e 100644
--- a/libraries/ecore/src/lib/ecore_con/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_con/Makefile.in
@@ -54,16 +54,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
54 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 54 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
55 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 55 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
56 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 56 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
57 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 57 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
58 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 58 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
59 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 59 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
60 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 60 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
61 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 61 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
62 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 62 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
63 $(top_srcdir)/configure.ac
64am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 63am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
65 $(ACLOCAL_M4) 64 $(ACLOCAL_M4)
66mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 65mkinstalldirs = $(install_sh) -d
67CONFIG_HEADER = $(top_builddir)/config.h 66CONFIG_HEADER = $(top_builddir)/config.h
68CONFIG_CLEAN_FILES = 67CONFIG_CLEAN_FILES =
69CONFIG_CLEAN_VPATH_FILES = 68CONFIG_CLEAN_VPATH_FILES =
@@ -210,6 +209,8 @@ EVAS_LIBS = @EVAS_LIBS@
210EVIL_CFLAGS = @EVIL_CFLAGS@ 209EVIL_CFLAGS = @EVIL_CFLAGS@
211EVIL_LIBS = @EVIL_LIBS@ 210EVIL_LIBS = @EVIL_LIBS@
212EXEEXT = @EXEEXT@ 211EXEEXT = @EXEEXT@
212EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
213EXOTIC_LIBS = @EXOTIC_LIBS@
213FGREP = @FGREP@ 214FGREP = @FGREP@
214GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 215GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
215GLIB_CFLAGS = @GLIB_CFLAGS@ 216GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -265,6 +266,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
265PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 266PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
266PIXMAN_LIBS = @PIXMAN_LIBS@ 267PIXMAN_LIBS = @PIXMAN_LIBS@
267PKG_CONFIG = @PKG_CONFIG@ 268PKG_CONFIG = @PKG_CONFIG@
269PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
270PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
268POSUB = @POSUB@ 271POSUB = @POSUB@
269RANLIB = @RANLIB@ 272RANLIB = @RANLIB@
270SCIM_CFLAGS = @SCIM_CFLAGS@ 273SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -275,6 +278,7 @@ SDL_LIBS = @SDL_LIBS@
275SED = @SED@ 278SED = @SED@
276SET_MAKE = @SET_MAKE@ 279SET_MAKE = @SET_MAKE@
277SHELL = @SHELL@ 280SHELL = @SHELL@
281SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
278SSL_CFLAGS = @SSL_CFLAGS@ 282SSL_CFLAGS = @SSL_CFLAGS@
279SSL_LIBS = @SSL_LIBS@ 283SSL_LIBS = @SSL_LIBS@
280STRIP = @STRIP@ 284STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con.c b/libraries/ecore/src/lib/ecore_con/ecore_con.c
index de291b3..fe83478 100644
--- a/libraries/ecore/src/lib/ecore_con/ecore_con.c
+++ b/libraries/ecore/src/lib/ecore_con/ecore_con.c
@@ -110,7 +110,10 @@ _ecore_con_client_kill(Ecore_Con_Client *cl)
110 if (cl->delete_me) 110 if (cl->delete_me)
111 DBG("Multi kill request for client %p", cl); 111 DBG("Multi kill request for client %p", cl);
112 else 112 else
113 ecore_con_event_client_del(cl); 113 {
114 ecore_con_event_client_del(cl);
115 if (cl->buf) return;
116 }
114 INF("Lost client %s", (cl->ip) ? cl->ip : ""); 117 INF("Lost client %s", (cl->ip) ? cl->ip : "");
115 if (cl->fd_handler) 118 if (cl->fd_handler)
116 ecore_main_fd_handler_del(cl->fd_handler); 119 ecore_main_fd_handler_del(cl->fd_handler);
@@ -461,7 +464,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
461 (!ecore_con_lookup(svr->name, (Ecore_Con_Dns_Cb)ecore_con_socks_dns_cb, svr))) 464 (!ecore_con_lookup(svr->name, (Ecore_Con_Dns_Cb)ecore_con_socks_dns_cb, svr)))
462 goto error; 465 goto error;
463 if (svr->ecs->lookup) 466 if (svr->ecs->lookup)
464 svr->ecs_state = ECORE_CON_SOCKS_STATE_RESOLVED; 467 svr->ecs_state = ECORE_CON_PROXY_STATE_RESOLVED;
465 } 468 }
466 } 469 }
467 if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL)) 470 if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL))
@@ -1031,7 +1034,7 @@ ecore_con_event_server_del(Ecore_Con_Server *svr)
1031 e->server = svr; 1034 e->server = svr;
1032 if (svr->ecs) 1035 if (svr->ecs)
1033 { 1036 {
1034 svr->ecs_state = svr->ecs->lookup ? ECORE_CON_SOCKS_STATE_RESOLVED : ECORE_CON_SOCKS_STATE_DONE; 1037 svr->ecs_state = svr->ecs->lookup ? ECORE_CON_PROXY_STATE_RESOLVED : ECORE_CON_PROXY_STATE_DONE;
1035 eina_stringshare_replace(&svr->proxyip, NULL); 1038 eina_stringshare_replace(&svr->proxyip, NULL);
1036 svr->proxyport = 0; 1039 svr->proxyport = 0;
1037 } 1040 }
@@ -1320,7 +1323,7 @@ _ecore_con_client_free(Ecore_Con_Client *cl)
1320 if (cl->event_count) return; 1323 if (cl->event_count) return;
1321 ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE); 1324 ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
1322 1325
1323 free(cl->buf); 1326 if (cl->buf) eina_binbuf_free(cl->buf);
1324 1327
1325 if (cl->host_server->type & ECORE_CON_SSL) 1328 if (cl->host_server->type & ECORE_CON_SSL)
1326 ecore_con_ssl_client_shutdown(cl); 1329 ecore_con_ssl_client_shutdown(cl);
@@ -1736,7 +1739,7 @@ svr_try_connect_plain(Ecore_Con_Server *svr)
1736 if (so_err) 1739 if (so_err)
1737 { 1740 {
1738 /* we lost our server! */ 1741 /* we lost our server! */
1739 ecore_con_event_server_error(svr, strerror(errno)); 1742 ecore_con_event_server_error(svr, strerror(so_err));
1740 ERR("Connection lost: %s", strerror(so_err)); 1743 ERR("Connection lost: %s", strerror(so_err));
1741 _ecore_con_server_kill(svr); 1744 _ecore_con_server_kill(svr);
1742 return ECORE_CON_DISCONNECTED; 1745 return ECORE_CON_DISCONNECTED;
@@ -1971,9 +1974,9 @@ _ecore_con_cl_handler(void *data,
1971 ecore_con_event_server_add(svr); 1974 ecore_con_event_server_add(svr);
1972 return ECORE_CALLBACK_RENEW; 1975 return ECORE_CALLBACK_RENEW;
1973 } 1976 }
1974 if (svr->ecs && svr->ecs_state && (svr->ecs_state < ECORE_CON_SOCKS_STATE_READ) && (!svr->ecs_buf)) 1977 if (svr->ecs && svr->ecs_state && (svr->ecs_state < ECORE_CON_PROXY_STATE_READ) && (!svr->ecs_buf))
1975 { 1978 {
1976 if (svr->ecs_state < ECORE_CON_SOCKS_STATE_INIT) 1979 if (svr->ecs_state < ECORE_CON_PROXY_STATE_INIT)
1977 { 1980 {
1978 INF("PROXY STATE++"); 1981 INF("PROXY STATE++");
1979 svr->ecs_state++; 1982 svr->ecs_state++;
@@ -2271,7 +2274,7 @@ _ecore_con_server_flush(Ecore_Con_Server *svr)
2271static void 2274static void
2272_ecore_con_client_flush(Ecore_Con_Client *cl) 2275_ecore_con_client_flush(Ecore_Con_Client *cl)
2273{ 2276{
2274 int num, count = 0; 2277 int num = 0, count = 0;
2275 2278
2276#ifdef _WIN32 2279#ifdef _WIN32
2277 if (ecore_con_local_win32_client_flush(cl)) 2280 if (ecore_con_local_win32_client_flush(cl))
@@ -2314,7 +2317,7 @@ _ecore_con_client_flush(Ecore_Con_Client *cl)
2314 } 2317 }
2315 2318
2316 if (count) ecore_con_event_client_write(cl, count); 2319 if (count) ecore_con_event_client_write(cl, count);
2317 cl->buf_offset += count; 2320 cl->buf_offset += count, num -= count;
2318 if (cl->buf_offset >= eina_binbuf_length_get(cl->buf)) 2321 if (cl->buf_offset >= eina_binbuf_length_get(cl->buf))
2319 { 2322 {
2320 cl->buf_offset = 0; 2323 cl->buf_offset = 0;
@@ -2332,7 +2335,7 @@ _ecore_con_client_flush(Ecore_Con_Client *cl)
2332 if (cl->fd_handler) 2335 if (cl->fd_handler)
2333 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); 2336 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ);
2334 } 2337 }
2335 else if ((count < num) && cl->fd_handler) 2338 else if (cl->fd_handler && (num >= 0))
2336 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); 2339 ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE);
2337} 2340}
2338 2341
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
index 35f2310..91f5d39 100644
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
+++ b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h
@@ -56,7 +56,7 @@ extern int _ecore_con_log_dom;
56 56
57typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup; 57typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup;
58typedef struct _Ecore_Con_Info Ecore_Con_Info; 58typedef struct _Ecore_Con_Info Ecore_Con_Info;
59typedef struct Ecore_Con_Socks_v4 Ecore_Con_Socks_v4; 59typedef struct Ecore_Con_Socks Ecore_Con_Socks_v4;
60typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5; 60typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5;
61typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos); 61typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos);
62 62
@@ -83,13 +83,18 @@ typedef enum _Ecore_Con_Ssl_Handshake
83 ECORE_CON_SSL_STATE_INIT 83 ECORE_CON_SSL_STATE_INIT
84} Ecore_Con_Ssl_State; 84} Ecore_Con_Ssl_State;
85 85
86typedef enum Ecore_Con_Socks_State 86typedef enum Ecore_Con_Proxy_State
87{ 87{ /* named PROXY instead of SOCKS in case some handsome and enterprising
88 ECORE_CON_SOCKS_STATE_DONE = 0, 88 * developer decides to add HTTP CONNECT support
89 ECORE_CON_SOCKS_STATE_RESOLVED, 89 */
90 ECORE_CON_SOCKS_STATE_INIT, 90 ECORE_CON_PROXY_STATE_DONE = 0,
91 ECORE_CON_SOCKS_STATE_READ 91 ECORE_CON_PROXY_STATE_RESOLVED,
92} Ecore_Con_Socks_State; 92 ECORE_CON_PROXY_STATE_INIT,
93 ECORE_CON_PROXY_STATE_READ,
94 ECORE_CON_PROXY_STATE_AUTH,
95 ECORE_CON_PROXY_STATE_REQUEST,
96 ECORE_CON_PROXY_STATE_CONFIRM,
97} Ecore_Con_Proxy_State;
93 98
94struct _Ecore_Con_Client 99struct _Ecore_Con_Client
95{ 100{
@@ -140,7 +145,7 @@ struct _Ecore_Con_Server
140 pid_t ppid; 145 pid_t ppid;
141 /* socks */ 146 /* socks */
142 Ecore_Con_Socks *ecs; 147 Ecore_Con_Socks *ecs;
143 Ecore_Con_Socks_State ecs_state; 148 Ecore_Con_Proxy_State ecs_state;
144 int ecs_addrlen; 149 int ecs_addrlen;
145 unsigned char ecs_addr[16]; 150 unsigned char ecs_addr[16];
146 unsigned int ecs_buf_offset; 151 unsigned int ecs_buf_offset;
@@ -202,6 +207,7 @@ struct _Ecore_Con_Url
202 Eina_List *response_headers; 207 Eina_List *response_headers;
203 const char *url; 208 const char *url;
204 long proxy_type; 209 long proxy_type;
210 int status;
205 211
206 Ecore_Timer *timer; 212 Ecore_Timer *timer;
207 213
@@ -213,6 +219,10 @@ struct _Ecore_Con_Url
213 219
214 int received; 220 int received;
215 int write_fd; 221 int write_fd;
222
223 unsigned int event_count;
224 Eina_Bool dead : 1;
225 Eina_Bool multi : 1;
216}; 226};
217#endif 227#endif
218 228
@@ -239,24 +249,14 @@ struct _Ecore_Con_Lookup
239 v5 = (Ecore_Con_Socks_v5*)(X); \ 249 v5 = (Ecore_Con_Socks_v5*)(X); \
240 else 250 else
241 251
242struct Ecore_Con_Socks 252struct Ecore_Con_Socks /* v4 */
243{
244 unsigned char version;
245
246 const char *ip;
247 int port;
248 const char *username;
249 Eina_Bool lookup : 1;
250 Eina_Bool bind : 1;
251};
252
253struct Ecore_Con_Socks_v4
254{ 253{
255 unsigned char version; 254 unsigned char version;
256 255
257 const char *ip; 256 const char *ip;
258 int port; 257 int port;
259 const char *username; 258 const char *username;
259 unsigned int ulen;
260 Eina_Bool lookup : 1; 260 Eina_Bool lookup : 1;
261 Eina_Bool bind : 1; 261 Eina_Bool bind : 1;
262}; 262};
@@ -268,8 +268,13 @@ struct Ecore_Con_Socks_v5
268 const char *ip; 268 const char *ip;
269 int port; 269 int port;
270 const char *username; 270 const char *username;
271 unsigned int ulen;
271 Eina_Bool lookup : 1; 272 Eina_Bool lookup : 1;
272 Eina_Bool bind : 1; 273 Eina_Bool bind : 1;
274 /* v5 only */
275 unsigned char method;
276 const char *password;
277 unsigned int plen;
273}; 278};
274 279
275extern Ecore_Con_Socks *_ecore_con_proxy_once; 280extern Ecore_Con_Socks *_ecore_con_proxy_once;
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c b/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c
index aecaff0..686f73b 100644
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c
+++ b/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c
@@ -10,6 +10,10 @@
10#include <unistd.h> 10#include <unistd.h>
11#include <fcntl.h> 11#include <fcntl.h>
12 12
13#ifdef HAVE_SYS_SOCKET_H
14# include <sys/socket.h>
15#endif
16
13#ifdef HAVE_NETINET_TCP_H 17#ifdef HAVE_NETINET_TCP_H
14# include <netinet/tcp.h> 18# include <netinet/tcp.h>
15#endif 19#endif
@@ -36,10 +40,6 @@
36# include <arpa/inet.h> 40# include <arpa/inet.h>
37#endif 41#endif
38 42
39#ifdef HAVE_SYS_SOCKET_H
40# include <sys/socket.h>
41#endif
42
43#ifdef HAVE_SYS_UN_H 43#ifdef HAVE_SYS_UN_H
44# include <sys/un.h> 44# include <sys/un.h>
45#endif 45#endif
@@ -57,6 +57,27 @@
57#include "Ecore_Con.h" 57#include "Ecore_Con.h"
58#include "ecore_con_private.h" 58#include "ecore_con_private.h"
59 59
60/* http://tools.ietf.org/html/rfc1928
61 o X'00' NO AUTHENTICATION REQUIRED
62 o X'01' GSSAPI
63 o X'02' USERNAME/PASSWORD
64 o X'03' to X'7F' IANA ASSIGNED
65 o X'80' to X'FE' RESERVED FOR PRIVATE METHODS
66 o X'FF' NO ACCEPTABLE METHODS
67*/
68#define ECORE_CON_SOCKS_V5_METHOD_NONE 0
69#define ECORE_CON_SOCKS_V5_METHOD_GSSAPI 1
70#define ECORE_CON_SOCKS_V5_METHOD_USERPASS 2
71
72static int ECORE_CON_SOCKS_V5_METHODS[] =
73{
74 ECORE_CON_SOCKS_V5_METHOD_NONE,
75// ECORE_CON_SOCKS_V5_METHOD_GSSAPI, TODO
76 ECORE_CON_SOCKS_V5_METHOD_USERPASS
77};
78
79#define ECORE_CON_SOCKS_V5_TOTAL_METHODS sizeof(ECORE_CON_SOCKS_V5_METHODS)
80
60#define _ecore_con_server_kill(svr) do { \ 81#define _ecore_con_server_kill(svr) do { \
61 DBG("KILL %p", (svr)); \ 82 DBG("KILL %p", (svr)); \
62 _ecore_con_server_kill((svr)); \ 83 _ecore_con_server_kill((svr)); \
@@ -65,10 +86,10 @@
65Eina_List *ecore_con_socks_proxies = NULL; 86Eina_List *ecore_con_socks_proxies = NULL;
66 87
67static Ecore_Con_Socks * 88static Ecore_Con_Socks *
68_ecore_con_socks_find(unsigned char version, const char *ip, int port, const char *username) 89_ecore_con_socks_find(unsigned char version, const char *ip, int port, const char *username, size_t ulen, const char *password, size_t plen)
69{ 90{
70 Eina_List *l; 91 Eina_List *l;
71 Ecore_Con_Socks *ecs; 92 Ecore_Con_Socks_v5 *ecs;
72 93
73 if (!ecore_con_socks_proxies) return NULL; 94 if (!ecore_con_socks_proxies) return NULL;
74 95
@@ -77,8 +98,14 @@ _ecore_con_socks_find(unsigned char version, const char *ip, int port, const cha
77 if (ecs->version != version) continue; 98 if (ecs->version != version) continue;
78 if (strcmp(ecs->ip, ip)) continue; 99 if (strcmp(ecs->ip, ip)) continue;
79 if ((port != -1) && (port != ecs->port)) continue; 100 if ((port != -1) && (port != ecs->port)) continue;
101 if (ulen != ecs->ulen) continue;
80 if (username && strcmp(ecs->username, username)) continue; 102 if (username && strcmp(ecs->username, username)) continue;
81 return ecs; 103 if (version == 5)
104 {
105 if (plen != ecs->plen) continue;
106 if (password && strcmp(ecs->password, password)) continue;
107 }
108 return (Ecore_Con_Socks*)ecs;
82 } 109 }
83 return NULL; 110 return NULL;
84} 111}
@@ -94,146 +121,424 @@ _ecore_con_socks_free(Ecore_Con_Socks *ecs)
94 eina_stringshare_del(ecs->username); 121 eina_stringshare_del(ecs->username);
95 free(ecs); 122 free(ecs);
96} 123}
97///////////////////////////////////////////////////////////////////////////////////// 124
98void 125static Eina_Bool
99ecore_con_socks_shutdown(void) 126_ecore_con_socks_svr_init_v4(Ecore_Con_Server *svr, Ecore_Con_Socks_v4 *v4)
100{ 127{
101 Ecore_Con_Socks *ecs; 128 size_t addrlen, buflen, ulen = 1;
102 EINA_LIST_FREE(ecore_con_socks_proxies, ecs) 129 unsigned char *sbuf;
103 _ecore_con_socks_free(ecs); 130
104 _ecore_con_proxy_once = NULL; 131 addrlen = v4->lookup ? strlen(svr->name) + 1 : 0;
105 _ecore_con_proxy_global = NULL; 132 if (v4->username) ulen += v4->ulen;
133 buflen = sizeof(char) * (8 + ulen + addrlen);
134 sbuf = malloc(buflen);
135 if (!sbuf)
136 {
137 ecore_con_event_server_error(svr, "Memory allocation failure!");
138 _ecore_con_server_kill(svr);
139 return EINA_FALSE;
140 }
141 /* http://en.wikipedia.org/wiki/SOCKS */
142 sbuf[0] = 4;
143 sbuf[1] = v4->bind ? 2 : 1;
144 sbuf[2] = svr->port >> 8;
145 sbuf[3] = svr->port & 0xff;
146 if (addrlen)
147 {
148 sbuf[4] = sbuf[5] = sbuf[6] = 0;
149 sbuf[7] = 1;
150 }
151 else
152 /* SOCKSv4 only handles IPV4, so addrlen is always 4 */
153 memcpy(sbuf + 4, svr->ecs_addr, 4);
154 if (v4->username)
155 memcpy(sbuf + 8, v4->username, ulen);
156 else
157 sbuf[8] = 0;
158 if (addrlen) memcpy(sbuf + 8 + ulen, svr->name, addrlen);
159
160 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
161 return EINA_TRUE;
106} 162}
107 163
108void 164static Eina_Bool
109ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num) 165_ecore_con_socks_svr_init_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5)
166{
167 size_t buflen;
168 unsigned int x;
169 unsigned char *sbuf;
170
171 if (v5->username)
172 buflen = sizeof(char) * (2 + ECORE_CON_SOCKS_V5_TOTAL_METHODS);
173 else
174 buflen = 3;
175 sbuf = malloc(buflen);
176 if (!sbuf)
177 {
178 ecore_con_event_server_error(svr, "Memory allocation failure!");
179 _ecore_con_server_kill(svr);
180 return EINA_FALSE;
181 }
182 /* http://en.wikipedia.org/wiki/SOCKS
183 * http://tools.ietf.org/html/rfc1928
184 */
185 sbuf[0] = 5;
186 if (v5->username)
187 {
188 sbuf[1] = ECORE_CON_SOCKS_V5_TOTAL_METHODS;
189 for (x = 2; x < 2 + ECORE_CON_SOCKS_V5_TOTAL_METHODS; x++)
190 sbuf[x] = ECORE_CON_SOCKS_V5_METHODS[x - 2];
191 }
192 else
193 {
194 sbuf[1] = 1;
195 sbuf[2] = ECORE_CON_SOCKS_V5_METHOD_NONE;
196 }
197
198 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
199 return EINA_TRUE;
200}
201
202#define ECORE_CON_SOCKS_READ(EXACT) \
203 if (num < EXACT) \
204 { \
205 if (!svr->ecs_recvbuf) svr->ecs_recvbuf = eina_binbuf_new(); \
206 if (!svr->ecs_recvbuf) goto error; \
207 eina_binbuf_append_length(svr->ecs_recvbuf, buf, num); \
208 /* the slowest connection on earth */ \
209 if (eina_binbuf_length_get(svr->ecs_recvbuf) != EXACT) return; \
210 data = eina_binbuf_string_get(svr->ecs_recvbuf); \
211 } \
212 else if (num > EXACT) goto error; \
213 else \
214 data = buf
215
216static void
217_ecore_con_socks_read_v4(Ecore_Con_Server *svr, Ecore_Con_Socks_v4 *v4 __UNUSED__, const unsigned char *buf, unsigned int num)
110{ 218{
111 const unsigned char *data; 219 const unsigned char *data;
112 ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return; 220 DBG("SOCKS: %d bytes", num);
221 ECORE_CON_SOCKS_READ(8);
113 222
114 if (svr->ecs_state != ECORE_CON_SOCKS_STATE_READ) return; 223/* http://ufasoft.com/doc/socks4_protocol.htm */
224 if (data[0]) goto error;
225 switch (data[1])
226 {
227 case 90:
228 /* success! */
229 break;
230 case 91:
231 ecore_con_event_server_error(svr, "proxy request rejected or failed");
232 goto error;
233 case 92:
234 ecore_con_event_server_error(svr, "proxying SOCKS server could not perform authentication");
235 goto error;
236 case 93:
237 ecore_con_event_server_error(svr, "proxy request authentication rejected");
238 goto error;
239 default:
240 ecore_con_event_server_error(svr, "garbage data from proxy");
241 goto error;
242 }
243 if (svr->ecs->bind)
244 {
245 unsigned int nport;
246 char naddr[IF_NAMESIZE];
115 247
116 if (v4) 248 memcpy(&nport, &data[2], 2);
249 svr->proxyport = ntohl(nport);
250
251 if (!inet_ntop(AF_INET, &data[4], naddr, sizeof(naddr))) goto error;
252 svr->proxyip = eina_stringshare_add(naddr);
253 ecore_con_event_proxy_bind(svr);
254 }
255 svr->ecs_state = ECORE_CON_PROXY_STATE_DONE;
256 INF("PROXY CONNECTED");
257 if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
258 svr->ecs_recvbuf = NULL;
259 svr->ecs_buf_offset = svr->ecs_addrlen = 0;
260 memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr));
261 if (!svr->ssl_state)
262 ecore_con_event_server_add(svr);
263 if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf)))
264 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
265 return;
266error:
267 _ecore_con_server_kill(svr);
268}
269
270static Eina_Bool
271_ecore_con_socks_auth_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5)
272{
273 size_t size;
274 unsigned char *data;
275 switch (v5->method)
276 {
277 case ECORE_CON_SOCKS_V5_METHOD_NONE:
278 svr->ecs_state = ECORE_CON_PROXY_STATE_REQUEST;
279 return EINA_TRUE;
280 case ECORE_CON_SOCKS_V5_METHOD_GSSAPI:
281 return EINA_TRUE;
282 case ECORE_CON_SOCKS_V5_METHOD_USERPASS:
283 if (!v5->username) return EINA_FALSE;
284 if (!v5->password) v5->plen = 1;
285 /* http://tools.ietf.org/html/rfc1929 */
286 size = sizeof(char) * (3 + v5->ulen + v5->plen);
287 data = malloc(size);
288 if (!data) break;
289 data[0] = 1;
290 data[1] = v5->ulen;
291 memcpy(&data[2], v5->username, v5->ulen);
292 data[1 + v5->ulen] = v5->plen;
293 if (v5->password)
294 memcpy(&data[2 + v5->ulen], v5->password, v5->plen);
295 else
296 data[2 + v5->ulen] = 0;
297 svr->ecs_buf = eina_binbuf_manage_new_length(data, size);
298 return EINA_TRUE;
299 default:
300 break;
301 }
302 return EINA_FALSE;
303}
304
305static void
306_ecore_con_socks_read_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5, const unsigned char *buf, unsigned int num)
307{
308 const unsigned char *data;
309
310 DBG("SOCKS: %d bytes", num);
311 switch (svr->ecs_state)
117 { 312 {
118 DBG("SOCKS: %d bytes", num);
119 if (num < 8)
120 {
121 if (!svr->ecs_recvbuf) svr->ecs_recvbuf = eina_binbuf_new();
122 if (!svr->ecs_recvbuf) goto error;
123 eina_binbuf_append_length(svr->ecs_recvbuf, buf, num);
124 /* the slowest connection on earth */
125 if (eina_binbuf_length_get(svr->ecs_recvbuf) != 8) return;
126 data = eina_binbuf_string_get(svr->ecs_recvbuf);
127 }
128 else if (num > 8) goto error;
129 else
130 data = buf;
131 313
132 /* http://ufasoft.com/doc/socks4_protocol.htm */ 314 case ECORE_CON_PROXY_STATE_READ:
133 if (data[0]) goto error; 315 ECORE_CON_SOCKS_READ(2);
134 switch (data[1]) 316 /* http://en.wikipedia.org/wiki/SOCKS */
317 if (data[0] != 5) goto error;
318 if (data[1] == 0xFF)
319 {
320 ecore_con_event_server_error(svr, "proxy authentication methods rejected");
321 goto error;
322 }
323 v5->method = data[1];
324 if (!_ecore_con_socks_auth_v5(svr, v5)) goto error;
325 if (svr->ecs_state == ECORE_CON_PROXY_STATE_REQUEST)
326 {
327 /* run again to skip auth reading */
328 _ecore_con_socks_read_v5(svr, v5, NULL, 0);
329 return;
330 }
331 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
332 svr->ecs_state = ECORE_CON_PROXY_STATE_AUTH;
333 break;
334 case ECORE_CON_PROXY_STATE_AUTH:
335 ECORE_CON_SOCKS_READ(2);
336 switch (v5->method)
337 {
338 case ECORE_CON_SOCKS_V5_METHOD_NONE:
339 CRIT("HOW DID THIS HAPPEN?????????");
340 goto error;
341 case ECORE_CON_SOCKS_V5_METHOD_GSSAPI:
342 /* TODO: this */
343 break;
344 case ECORE_CON_SOCKS_V5_METHOD_USERPASS:
345 if (data[0] != 1)
346 {
347 ecore_con_event_server_error(svr, "protocol error");
348 goto error; /* wrong version */
349 }
350 if (data[1])
351 {
352 ecore_con_event_server_error(svr, "proxy request authentication rejected");
353 goto error;
354 }
355 default:
356 break;
357 }
358 case ECORE_CON_PROXY_STATE_REQUEST:
135 { 359 {
136 case 90: 360 size_t addrlen, buflen;
137 /* success! */ 361 unsigned char *sbuf;
138 break; 362 addrlen = v5->lookup ? strlen(svr->name) + 1 : (unsigned int)svr->ecs_addrlen;
139 case 91: 363 buflen = sizeof(char) * (6 + addrlen);
140 ecore_con_event_server_error(svr, "proxy request rejected or failed"); 364 sbuf = malloc(buflen);
141 goto error; 365 if (!sbuf)
142 case 92: 366 {
143 ecore_con_event_server_error(svr, "proxying SOCKS server could not perform authentication"); 367 ecore_con_event_server_error(svr, "Memory allocation failure!");
144 goto error; 368 goto error;
145 case 93: 369 }
146 ecore_con_event_server_error(svr, "proxy request authentication rejected"); 370 sbuf[0] = 5;
147 goto error; 371 sbuf[1] = v5->bind ? 2 : 1; /* TODO: 0x03 for UDP port association */
148 default: 372 sbuf[2] = 0;
149 ecore_con_event_server_error(svr, "garbage data from proxy"); 373 if (v5->lookup) /* domain name */
150 goto error; 374 {
375 sbuf[3] = 3;
376 sbuf[4] = addrlen - 1;
377 memcpy(sbuf + 5, svr->name, addrlen - 1);
378 }
379 else
380 {
381 sbuf[3] = (svr->ecs_addrlen == 4) ? 1 : 4;
382 memcpy(sbuf + 4, svr->ecs_addr, addrlen);
383 }
384 sbuf[addrlen + 4] = svr->port >> 8;
385 sbuf[addrlen + 5] = svr->port & 0xff;
386
387 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
388 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
389 break;
151 } 390 }
152 if (svr->ecs->bind) 391 case ECORE_CON_PROXY_STATE_CONFIRM:
153 { 392 {
154 unsigned int nport; 393 /* this is ugly because we have to read an exact number of bytes,
155 char naddr[IF_NAMESIZE]; 394 * but we don't know what that number is until we've already read
156 395 * at least 5 bytes to determine the length of the unknown stream.
157 memcpy(&nport, &data[2], 2); 396 * yep.
158 svr->proxyport = ntohl(nport); 397 */
159 398 size_t to_read, len = svr->ecs_recvbuf ? eina_binbuf_length_get(svr->ecs_recvbuf) : 0;
160 if (!inet_ntop(AF_INET, &data[4], naddr, sizeof(naddr))) goto error; 399 if (num + len < 5)
161 svr->proxyip = eina_stringshare_add(naddr); 400 {
162 ecore_con_event_proxy_bind(svr); 401 /* guarantees we get called again */
402 ECORE_CON_SOCKS_READ(5);
403 }
404 if (len >= 5)
405 {
406 data = eina_binbuf_string_get(svr->ecs_recvbuf);
407 data += 3;
408 }
409 else
410 data = buf + 3 - len;
411 switch (data[0])
412 {
413 case 1:
414 to_read = 4;
415 break;
416 case 3:
417 to_read = data[1] + 1;
418 break;
419 case 4:
420 to_read = 16;
421 /* lazy debugging stub comment */
422 break;
423 default:
424 ecore_con_event_server_error(svr, "protocol error");
425 goto error;
426 }
427 /* at this point, we finally know exactly how much we need to read */
428 ECORE_CON_SOCKS_READ(6 + to_read);
429
430 if (data[0] != 5)
431 {
432 ecore_con_event_server_error(svr, "protocol error");
433 goto error; /* wrong version */
434 }
435 switch (data[1])
436 {
437 case 0:
438 break;
439 case 1:
440 ecore_con_event_server_error(svr, "general proxy failure");
441 goto error;
442 case 2:
443 ecore_con_event_server_error(svr, "connection not allowed by ruleset");
444 goto error;
445 case 3:
446 ecore_con_event_server_error(svr, "network unreachable");
447 goto error;
448 case 4:
449 ecore_con_event_server_error(svr, "host unreachable");
450 goto error;
451 case 5:
452 ecore_con_event_server_error(svr, "connection refused by destination host");
453 goto error;
454 case 6:
455 ecore_con_event_server_error(svr, "TTL expired");
456 goto error;
457 case 7:
458 ecore_con_event_server_error(svr, "command not supported / protocol error");
459 goto error;
460 case 8:
461 ecore_con_event_server_error(svr, "address type not supported");
462 default:
463 goto error;
464 }
465 if (data[2])
466 {
467 ecore_con_event_server_error(svr, "protocol error");
468 goto error;
469 }
470 memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr));
471 if (!svr->ssl_state)
472 ecore_con_event_server_add(svr);
473 if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf)))
474 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
475 svr->ecs_buf_offset = svr->ecs_addrlen = 0;
476 svr->ecs_state = ECORE_CON_PROXY_STATE_DONE;
477 INF("PROXY CONNECTED");
478 break;
163 } 479 }
164 svr->ecs_state = ECORE_CON_SOCKS_STATE_DONE; 480 default:
165 INF("PROXY CONNECTED"); 481 break;
166 if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
167 svr->ecs_recvbuf = NULL;
168 svr->ecs_buf_offset = svr->ecs_addrlen = 0;
169 memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr));
170 if (!svr->ssl_state)
171 ecore_con_event_server_add(svr);
172 if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf)))
173 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE);
174 } 482 }
483 if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf);
484 svr->ecs_recvbuf = NULL;
485
175 return; 486 return;
176error: 487error:
177 _ecore_con_server_kill(svr); 488 _ecore_con_server_kill(svr);
178} 489}
179 490
491/////////////////////////////////////////////////////////////////////////////////////
492void
493ecore_con_socks_shutdown(void)
494{
495 Ecore_Con_Socks *ecs;
496 EINA_LIST_FREE(ecore_con_socks_proxies, ecs)
497 _ecore_con_socks_free(ecs);
498 _ecore_con_proxy_once = NULL;
499 _ecore_con_proxy_global = NULL;
500}
501
502void
503ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num)
504{
505 ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return;
506
507 if (svr->ecs_state < ECORE_CON_PROXY_STATE_READ) return;
508
509 if (v4) _ecore_con_socks_read_v4(svr, v4, buf, (unsigned int)num);
510 else _ecore_con_socks_read_v5(svr, v5, buf, (unsigned int)num);
511}
512
180Eina_Bool 513Eina_Bool
181ecore_con_socks_svr_init(Ecore_Con_Server *svr) 514ecore_con_socks_svr_init(Ecore_Con_Server *svr)
182{ 515{
183 unsigned char *sbuf;
184 ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return EINA_FALSE; 516 ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return EINA_FALSE;
185 517
186 if (!svr->ip) return EINA_FALSE; 518 if (!svr->ip) return EINA_FALSE;
187 if (svr->ecs_buf) return EINA_FALSE; 519 if (svr->ecs_buf) return EINA_FALSE;
188 if (svr->ecs_state != ECORE_CON_SOCKS_STATE_INIT) return EINA_FALSE; 520 if (svr->ecs_state != ECORE_CON_PROXY_STATE_INIT) return EINA_FALSE;
189 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); 521 ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE);
190 if (v4) 522 if (v4) return _ecore_con_socks_svr_init_v4(svr, v4);
191 { 523 return _ecore_con_socks_svr_init_v5(svr, v5);
192 size_t addrlen, buflen, ulen = 1;
193 addrlen = svr->ecs->lookup ? strlen(svr->name) + 1: 0;
194 if (svr->ecs->username) ulen += strlen(svr->ecs->username);
195 buflen = sizeof(char) * (8 + ulen + addrlen);
196 sbuf = malloc(buflen);
197 if (!sbuf)
198 {
199 ecore_con_event_server_error(svr, "Memory allocation failure!");
200 _ecore_con_server_kill(svr);
201 return EINA_FALSE;
202 }
203 /* http://en.wikipedia.org/wiki/SOCKS */
204 sbuf[0] = 4;
205 sbuf[1] = v4->bind ? 2 : 1;
206 sbuf[2] = svr->port >> 8;
207 sbuf[3] = svr->port & 0xff;
208 if (addrlen)
209 {
210 sbuf[4] = sbuf[5] = sbuf[6] = 0;
211 sbuf[7] = 1;
212 }
213 else
214 memcpy(sbuf + 4, svr->ecs_addr, 4);
215 if (svr->ecs->username)
216 memcpy(sbuf + 8, svr->ecs->username, ulen);
217 else
218 sbuf[8] = 0;
219 if (addrlen) memcpy(sbuf + 8 + ulen, svr->name, addrlen);
220
221 svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen);
222 }
223 return EINA_TRUE;
224} 524}
225 525
226void 526void
227ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr) 527ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen __UNUSED__, Ecore_Con_Server *svr)
228{ 528{
229 svr->ip = eina_stringshare_add(ip); 529 svr->ip = eina_stringshare_add(ip);
230 svr->ecs_addrlen = addrlen;
231 svr->ecs_state++; 530 svr->ecs_state++;
232 if (addr->sa_family == AF_INET) 531 if (addr->sa_family == AF_INET)
233 memcpy(svr->ecs_addr, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4); 532 {
533 memcpy(svr->ecs_addr, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4);
534 svr->ecs_addrlen = 4;
535 }
234#ifdef HAVE_IPV6 536#ifdef HAVE_IPV6
235 else 537 else
236 memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, addrlen); 538 {
539 memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, 16);
540 svr->ecs_addrlen = 16;
541 }
237#endif 542#endif
238 ecore_con_socks_svr_init(svr); 543 ecore_con_socks_svr_init(svr);
239} 544}
@@ -242,36 +547,57 @@ void
242ecore_con_socks_init(void) 547ecore_con_socks_init(void)
243{ 548{
244 const char *socks; 549 const char *socks;
245 char *u, *h, *p, *l; 550 char *h, *p, *l, *u = NULL;
246 char buf[64]; 551 char buf[512];
247 int port, lookup = 0; 552 int port, lookup = 0;
553 Eina_Bool v5 = EINA_FALSE;
248 Ecore_Con_Socks *ecs; 554 Ecore_Con_Socks *ecs;
249 unsigned char addr[sizeof(struct in_addr)]; 555 unsigned char addr[sizeof(struct in_addr)];
556#ifdef HAVE_IPV6
557 unsigned char addr6[sizeof(struct in6_addr)];
558#endif
250 559
251 /* ECORE_CON_SOCKS_V4=user@host:port:[1|0] */ 560 /* ECORE_CON_SOCKS_V4=[user@]host:port-[1|0] */
252 socks = getenv("ECORE_CON_SOCKS_V4"); 561 socks = getenv("ECORE_CON_SOCKS_V4");
253 if ((!socks) || (!socks[0]) || (strlen(socks) > 64)) return; 562 if (!socks)
563 {
564 /* ECORE_CON_SOCKS_V5=[user@]host-port:[1|0] */
565 socks = getenv("ECORE_CON_SOCKS_V5");
566 v5 = EINA_TRUE;
567 }
568 if ((!socks) || (!socks[0]) || (strlen(socks) > 512)) return;
254 strncpy(buf, socks, sizeof(buf)); 569 strncpy(buf, socks, sizeof(buf));
255 h = strchr(buf, '@'); 570 h = strchr(buf, '@');
256 u = NULL;
257 /* username */ 571 /* username */
258 if (h && (h - buf > 0)) *h++ = 0, u = buf; 572 if (h && (h - buf > 0)) *h++ = 0, u = buf;
259 else h = buf; 573 else h = buf;
260 574
261 /* host ip; I ain't resolvin shit here */ 575 /* host ip; I ain't resolvin shit here */
262 p = strchr(h, ':'); 576 p = strchr(h, '-');
263 if (!p) return; 577 if (!p) return;
264 *p++ = 0; 578 *p++ = 0;
265 if (!inet_pton(AF_INET, h, addr)) return; 579 if (!inet_pton(AF_INET, h, addr))
580#ifdef HAVE_IPV6
581 {
582 if (!v5) return;
583 if (!inet_pton(AF_INET6, h, addr6))
584 return;
585 }
586#else
587 return;
588#endif
266 589
267 errno = 0; 590 errno = 0;
268 port = strtol(p, &l, 10); 591 port = strtol(p, &l, 10);
269 if (errno || (port < 0) || (port > 65535)) return; 592 if (errno || (port < 0) || (port > 65535)) return;
270 if (l && (l[0] == ':')) 593 if (l && (l[0] == ':'))
271 lookup = (l[1] == '1'); 594 lookup = (l[1] == '1');
272 ecs = ecore_con_socks4_remote_add(h, port, u); 595 if (v5)
596 ecs = ecore_con_socks5_remote_add(h, port, u, NULL);
597 else
598 ecs = ecore_con_socks4_remote_add(h, port, u);
273 if (!ecs) return; 599 if (!ecs) return;
274 ecore_con_socks4_lookup_set(ecs, lookup); 600 ecore_con_socks_lookup_set(ecs, lookup);
275 ecore_con_socks_apply_always(ecs); 601 ecore_con_socks_apply_always(ecs);
276 INF("Added global proxy server %s%s%s:%d - DNS lookup %s", 602 INF("Added global proxy server %s%s%s:%d - DNS lookup %s",
277 u ?: "", u ? "@" : "", h, port, lookup ? "ENABLED" : "DISABLED"); 603 u ?: "", u ? "@" : "", h, port, lookup ? "ENABLED" : "DISABLED");
@@ -300,10 +626,17 @@ EAPI Ecore_Con_Socks *
300ecore_con_socks4_remote_add(const char *ip, int port, const char *username) 626ecore_con_socks4_remote_add(const char *ip, int port, const char *username)
301{ 627{
302 Ecore_Con_Socks *ecs; 628 Ecore_Con_Socks *ecs;
629 size_t ulen = 0;
303 630
304 if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL; 631 if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL;
305 632
306 ecs = _ecore_con_socks_find(4, ip, port, username); 633 if (username)
634 {
635 ulen = strlen(username);
636 /* max length for protocol */
637 if ((!ulen) || (ulen > 255)) return NULL;
638 }
639 ecs = _ecore_con_socks_find(4, ip, port, username, ulen, NULL, 0);
307 if (ecs) return ecs; 640 if (ecs) return ecs;
308 641
309 ecs = calloc(1, sizeof(Ecore_Con_Socks_v4)); 642 ecs = calloc(1, sizeof(Ecore_Con_Socks_v4));
@@ -313,92 +646,194 @@ ecore_con_socks4_remote_add(const char *ip, int port, const char *username)
313 ecs->ip = eina_stringshare_add(ip); 646 ecs->ip = eina_stringshare_add(ip);
314 ecs->port = port; 647 ecs->port = port;
315 ecs->username = eina_stringshare_add(username); 648 ecs->username = eina_stringshare_add(username);
649 ecs->ulen = ulen;
316 ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs); 650 ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs);
317 return ecs; 651 return ecs;
318} 652}
319 653
320/** 654/**
321 * Set DNS lookup mode on an existing SOCKS v4 proxy 655 * Find a SOCKS v4 proxy in the proxy list
322 * 656 *
323 * According to RFC, SOCKS v4 does not require that a proxy perform 657 * Use this to determine if a SOCKS proxy was previously added by checking
324 * its own DNS lookups for addresses. SOCKS v4a specifies the protocol 658 * the proxy list against the parameters given.
325 * for this. If you want to enable remote DNS lookup and are sure that your 659 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
326 * proxy supports it, use this function. 660 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
327 * @param ecs The proxy object 661 * @param username The username used for the proxy (OPTIONAL)
328 * @param enable If true, the proxy will perform the dns lookup 662 * @return true only if a proxy exists matching the given params
329 * @note By default, this setting is DISABLED. 663 * @note This function matches slightly more loosely than ecore_con_socks4_remote_add(), and
664 * ecore_con_socks4_remote_add() should be used to return the actual object.
330 * @since 1.2 665 * @since 1.2
331 */ 666 */
332EAPI void 667EAPI Eina_Bool
333ecore_con_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable) 668ecore_con_socks4_remote_exists(const char *ip, int port, const char *username)
334{ 669{
335 ECORE_CON_SOCKS_CAST_ELSE(ecs) return; 670 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])))
336 if (v4) v4->lookup = !!enable; 671 return EINA_FALSE;
672 return !!_ecore_con_socks_find(4, ip, port, username, username ? strlen(username) : 0, NULL, 0);
337} 673}
338 674
339/** 675/**
340 * Get DNS lookup mode on an existing SOCKS v4 proxy 676 * Remove a SOCKS v4 proxy from the proxy list and delete it
341 * 677 *
342 * According to RFC, SOCKS v4 does not require that a proxy perform 678 * Use this to remove a SOCKS proxy from the proxy list by checking
343 * its own DNS lookups for addresses. SOCKS v4a specifies the protocol 679 * the list against the parameters given. The proxy will then be deleted.
344 * for this. This function returns whether lookups are enabled on a proxy object. 680 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
345 * @param ecs The proxy object 681 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
346 * @return If true, the proxy will perform the dns lookup 682 * @param username The username used for the proxy (OPTIONAL)
347 * @note By default, this setting is DISABLED. 683 * @note This function matches in the same way as ecore_con_socks4_remote_exists().
684 * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
348 * @since 1.2 685 * @since 1.2
349 */ 686 */
350EAPI Eina_Bool 687EAPI void
351ecore_con_socks4_lookup_get(Ecore_Con_Socks *ecs) 688ecore_con_socks4_remote_del(const char *ip, int port, const char *username)
352{ 689{
353 ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE; 690 Ecore_Con_Socks_v4 *v4;
354 return v4 ? v4->lookup : EINA_FALSE; 691
692 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) return;
693 if (!ecore_con_socks_proxies) return;
694
695 v4 = (Ecore_Con_Socks_v4*)_ecore_con_socks_find(4, ip, port, username, username ? strlen(username) : 0, NULL, 0);
696 if (!v4) return;
697 ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4);
698 _ecore_con_socks_free((Ecore_Con_Socks*)v4);
699}
700/**
701 * Add a SOCKS v5 proxy to the proxy list
702 *
703 * Use this to create (or return, if previously added) a SOCKS proxy
704 * object which can be used by any ecore_con servers.
705 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
706 * @param port The port to connect to on the proxy
707 * @param username The username to use for the proxy (OPTIONAL)
708 * @param password The password to use for the proxy (OPTIONAL)
709 * @return An allocated proxy object, or NULL on failure
710 * @note This object NEVER needs to be explicitly freed.
711 * @since 1.2
712 */
713EAPI Ecore_Con_Socks *
714ecore_con_socks5_remote_add(const char *ip, int port, const char *username, const char *password)
715{
716 Ecore_Con_Socks_v5 *ecs5;
717 size_t ulen = 0, plen = 0;
718
719 if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL;
720
721 if (username)
722 {
723 ulen = strlen(username);
724 /* max length for protocol */
725 if ((!ulen) || (ulen > 255)) return NULL;
726 }
727 if (password)
728 {
729 plen = strlen(password);
730 /* max length for protocol */
731 if ((!plen) || (plen > 255)) return NULL;
732 }
733 ecs5 = (Ecore_Con_Socks_v5*)_ecore_con_socks_find(5, ip, port, username, ulen, password, plen);
734 if (ecs5) return (Ecore_Con_Socks*)ecs5;
735
736 ecs5 = calloc(1, sizeof(Ecore_Con_Socks_v5));
737 if (!ecs5) return NULL;
738
739 ecs5->version = 5;
740 ecs5->ip = eina_stringshare_add(ip);
741 ecs5->port = port;
742 ecs5->username = eina_stringshare_add(username);
743 ecs5->ulen = ulen;
744 ecs5->password = eina_stringshare_add(password);
745 ecs5->plen = plen;
746 ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs5);
747 return (Ecore_Con_Socks*)ecs5;
355} 748}
356 749
357/** 750/**
358 * Find a SOCKS v4 proxy in the proxy list 751 * Find a SOCKS v5 proxy in the proxy list
359 * 752 *
360 * Use this to determine if a SOCKS proxy was previously added by checking 753 * Use this to determine if a SOCKS proxy was previously added by checking
361 * the proxy list against the parameters given. 754 * the proxy list against the parameters given.
362 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) 755 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
363 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip 756 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
364 * @param username The username used for the proxy (OPTIONAL) 757 * @param username The username used for the proxy (OPTIONAL)
758 * @param password The password used for the proxy (OPTIONAL)
365 * @return true only if a proxy exists matching the given params 759 * @return true only if a proxy exists matching the given params
366 * @note This function matches slightly more loosely than ecore_con_socks4_remote_add(), and 760 * @note This function matches slightly more loosely than ecore_con_socks5_remote_add(), and
367 * ecore_con_socks4_remote_add() should be used to return the actual object. 761 * ecore_con_socks5_remote_add() should be used to return the actual object.
368 * @since 1.2 762 * @since 1.2
369 */ 763 */
370EAPI Eina_Bool 764EAPI Eina_Bool
371ecore_con_socks4_remote_exists(const char *ip, int port, const char *username) 765ecore_con_socks5_remote_exists(const char *ip, int port, const char *username, const char *password)
372{ 766{
373 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) 767 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])) || (password && (!password[0])))
374 return EINA_FALSE; 768 return EINA_FALSE;
375 return !!_ecore_con_socks_find(4, ip, port, username); 769 return !!_ecore_con_socks_find(5, ip, port, username, username ? strlen(username) : 0, password, password ? strlen(password) : 0);
376} 770}
377 771
378/** 772/**
379 * Remove a SOCKS v4 proxy from the proxy list and delete it 773 * Remove a SOCKS v5 proxy from the proxy list and delete it
380 * 774 *
381 * Use this to remove a SOCKS proxy from the proxy list by checking 775 * Use this to remove a SOCKS proxy from the proxy list by checking
382 * the list against the parameters given. The proxy will then be deleted. 776 * the list against the parameters given. The proxy will then be deleted.
383 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) 777 * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.)
384 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip 778 * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip
385 * @param username The username used for the proxy (OPTIONAL) 779 * @param username The username used for the proxy (OPTIONAL)
780 * @param password The password used for the proxy (OPTIONAL)
386 * @note This function matches in the same way as ecore_con_socks4_remote_exists(). 781 * @note This function matches in the same way as ecore_con_socks4_remote_exists().
387 * @warning Be aware that deleting a proxy which is being used WILL ruin your life. 782 * @warning Be aware that deleting a proxy which is being used WILL ruin your life.
388 * @since 1.2 783 * @since 1.2
389 */ 784 */
390EAPI void 785EAPI void
391ecore_con_socks4_remote_del(const char *ip, int port, const char *username) 786ecore_con_socks5_remote_del(const char *ip, int port, const char *username, const char *password)
392{ 787{
393 Ecore_Con_Socks_v4 *v4; 788 Ecore_Con_Socks_v5 *v5;
394 789
395 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) return; 790 if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])) || (password && (!password[0])))
791 return;
396 if (!ecore_con_socks_proxies) return; 792 if (!ecore_con_socks_proxies) return;
397 793
398 v4 = (Ecore_Con_Socks_v4*)_ecore_con_socks_find(4, ip, port, username); 794 v5 = (Ecore_Con_Socks_v5*)_ecore_con_socks_find(5, ip, port, username, username ? strlen(username) : 0, password, password ? strlen(password) : 0);
399 if (!v4) return; 795 if (!v5) return;
400 ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4); 796 ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v5);
401 _ecore_con_socks_free((Ecore_Con_Socks*)v4); 797 _ecore_con_socks_free((Ecore_Con_Socks*)v5);
798}
799
800/**
801 * Set DNS lookup mode on an existing SOCKS proxy
802 *
803 * According to RFC, SOCKS v4 does not require that a proxy perform
804 * its own DNS lookups for addresses. SOCKS v4a specifies the protocol
805 * for this. SOCKS v5 allows DNS lookups.
806 * If you want to enable remote DNS lookup and are sure that your
807 * proxy supports it, use this function.
808 * @param ecs The proxy object
809 * @param enable If true, the proxy will perform the dns lookup
810 * @note By default, this setting is DISABLED.
811 * @since 1.2
812 */
813EAPI void
814ecore_con_socks_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable)
815{
816 ECORE_CON_SOCKS_CAST_ELSE(ecs) return;
817 ecs->lookup = !!enable;
818}
819
820/**
821 * Get DNS lookup mode on an existing SOCKS proxy
822 *
823 * According to RFC, SOCKS v4 does not require that a proxy perform
824 * its own DNS lookups for addresses. SOCKS v4a specifies the protocol
825 * for this. SOCKS v5 allows DNS lookups.
826 * This function returns whether lookups are enabled on a proxy object.
827 * @param ecs The proxy object
828 * @return If true, the proxy will perform the dns lookup
829 * @note By default, this setting is DISABLED.
830 * @since 1.2
831 */
832EAPI Eina_Bool
833ecore_con_socks_lookup_get(Ecore_Con_Socks *ecs)
834{
835 ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE;
836 return ecs->lookup;
402} 837}
403 838
404/** 839/**
@@ -434,6 +869,14 @@ ecore_con_socks_bind_get(Ecore_Con_Socks *ecs)
434 return ecs->bind; 869 return ecs->bind;
435} 870}
436 871
872/**
873 * Return SOCKS version of a SOCKS proxy
874 *
875 * Use this function to return the SOCKS protocol version of a proxy
876 * @param ecs The proxy object
877 * @return 0 on error, else 4/5
878 * @since 1.2
879 */
437EAPI unsigned int 880EAPI unsigned int
438ecore_con_socks_version_get(Ecore_Con_Socks *ecs) 881ecore_con_socks_version_get(Ecore_Con_Socks *ecs)
439{ 882{
@@ -482,7 +925,8 @@ ecore_con_socks_apply_once(Ecore_Con_Socks *ecs)
482 * @see ecore_con_socks_apply_once() 925 * @see ecore_con_socks_apply_once()
483 * @since 1.2 926 * @since 1.2
484 * @note ecore-con supports setting this through environment variables like so: 927 * @note ecore-con supports setting this through environment variables like so:
485 * ECORE_CON_SOCKS_V4=[user@]server:port:lookup 928 * ECORE_CON_SOCKS_V4=[user@]server-port:lookup
929 * ECORE_CON_SOCKS_V5=[user@]server-port:lookup
486 * user is the OPTIONAL string that would be passed to the proxy as the username 930 * user is the OPTIONAL string that would be passed to the proxy as the username
487 * server is the IP_ADDRESS of the proxy server 931 * server is the IP_ADDRESS of the proxy server
488 * port is the port to connect to on the proxy server 932 * port is the port to connect to on the proxy server
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c b/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c
index 6104632..cd8b9c6 100644
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c
+++ b/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c
@@ -652,6 +652,7 @@ ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr)
652 * Use this function to add a SSL PEM certificate. 652 * Use this function to add a SSL PEM certificate.
653 * Simply specify the cert here to use it in the server object for connecting or listening. 653 * Simply specify the cert here to use it in the server object for connecting or listening.
654 * If there is an error loading the certificate, an error will automatically be logged. 654 * If there is an error loading the certificate, an error will automatically be logged.
655 * @param svr The server object
655 * @param cert The path to the certificate. 656 * @param cert The path to the certificate.
656 * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE. 657 * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE.
657 */ 658 */
@@ -683,6 +684,7 @@ ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr,
683 * Use this function to add a SSL PEM CA file. 684 * Use this function to add a SSL PEM CA file.
684 * Simply specify the file here to use it in the server object for connecting or listening. 685 * Simply specify the file here to use it in the server object for connecting or listening.
685 * If there is an error loading the CAs, an error will automatically be logged. 686 * If there is an error loading the CAs, an error will automatically be logged.
687 * @param svr The server object
686 * @param ca_file The path to the CA file. 688 * @param ca_file The path to the CA file.
687 * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE. 689 * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE.
688 * @note since 1.2, this function can load directores 690 * @note since 1.2, this function can load directores
@@ -747,6 +749,7 @@ ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr,
747 * Use this function to add a SSL PEM CRL file 749 * Use this function to add a SSL PEM CRL file
748 * Simply specify the CRL file here to use it in the server object for connecting or listening. 750 * Simply specify the CRL file here to use it in the server object for connecting or listening.
749 * If there is an error loading the CRL, an error will automatically be logged. 751 * If there is an error loading the CRL, an error will automatically be logged.
752 * @param svr The server object
750 * @param crl_file The path to the CRL file. 753 * @param crl_file The path to the CRL file.
751 * @return EINA_FALSE if the file cannot be loaded, 754 * @return EINA_FALSE if the file cannot be loaded,
752 * otherwise EINA_TRUE. 755 * otherwise EINA_TRUE.
diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_url.c b/libraries/ecore/src/lib/ecore_con/ecore_con_url.c
index 709b554..05f0678 100644
--- a/libraries/ecore/src/lib/ecore_con/ecore_con_url.c
+++ b/libraries/ecore/src/lib/ecore_con/ecore_con_url.c
@@ -30,41 +30,31 @@
30#include "Ecore_Con.h" 30#include "Ecore_Con.h"
31#include "ecore_con_private.h" 31#include "ecore_con_private.h"
32 32
33#define CURL_MIN_TIMEOUT 100
34
33int ECORE_CON_EVENT_URL_DATA = 0; 35int ECORE_CON_EVENT_URL_DATA = 0;
34int ECORE_CON_EVENT_URL_COMPLETE = 0; 36int ECORE_CON_EVENT_URL_COMPLETE = 0;
35int ECORE_CON_EVENT_URL_PROGRESS = 0; 37int ECORE_CON_EVENT_URL_PROGRESS = 0;
36 38
37#ifdef HAVE_CURL 39#ifdef HAVE_CURL
40static void _ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg);
41static void _ecore_con_url_multi_remove(Ecore_Con_Url *url_con);
38static Eina_Bool _ecore_con_url_perform(Ecore_Con_Url *url_con); 42static Eina_Bool _ecore_con_url_perform(Ecore_Con_Url *url_con);
39static size_t _ecore_con_url_header_cb(void *ptr, 43static size_t _ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream);
40 size_t size, 44static size_t _ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp);
41 size_t nitems, 45static int _ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
42 void *stream); 46static size_t _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream);
43static size_t _ecore_con_url_data_cb(void *buffer, 47static void _ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev);
44 size_t size, 48static Eina_Bool _ecore_con_url_timer(void *data);
45 size_t nitems, 49static Eina_Bool _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
46 void *userp);
47static int _ecore_con_url_progress_cb(void *clientp,
48 double dltotal,
49 double dlnow,
50 double ultotal,
51 double ulnow);
52static size_t _ecore_con_url_read_cb(void *ptr,
53 size_t size,
54 size_t nitems,
55 void *stream);
56static void _ecore_con_event_url_free(void *data __UNUSED__,
57 void *ev);
58static Eina_Bool _ecore_con_url_idler_handler(void *data);
59static Eina_Bool _ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__);
60static Eina_Bool _ecore_con_url_timeout_cb(void *data); 50static Eina_Bool _ecore_con_url_timeout_cb(void *data);
51static void _ecore_con_url_status_get(Ecore_Con_Url *url_con);
61 52
62static Eina_List *_url_con_list = NULL; 53static Eina_List *_url_con_list = NULL;
63static Eina_List *_fd_hd_list = NULL; 54static Eina_List *_fd_hd_list = NULL;
64static CURLM *_curlm = NULL; 55static CURLM *_curlm = NULL;
65static fd_set _current_fd_set;
66static int _init_count = 0; 56static int _init_count = 0;
67static Ecore_Timer *_curl_timeout = NULL; 57static Ecore_Timer *_curl_timer = NULL;
68static Eina_Bool pipelining = EINA_FALSE; 58static Eina_Bool pipelining = EINA_FALSE;
69 59
70#endif 60#endif
@@ -79,28 +69,28 @@ EAPI int
79ecore_con_url_init(void) 69ecore_con_url_init(void)
80{ 70{
81#ifdef HAVE_CURL 71#ifdef HAVE_CURL
72 long ms;
82 if (++_init_count > 1) return _init_count; 73 if (++_init_count > 1) return _init_count;
83 74
84 if (!ECORE_CON_EVENT_URL_DATA) ECORE_CON_EVENT_URL_DATA = ecore_event_type_new(); 75 ECORE_CON_EVENT_URL_DATA = ecore_event_type_new();
85 if (!ECORE_CON_EVENT_URL_COMPLETE) ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new(); 76 ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new();
86 if (!ECORE_CON_EVENT_URL_PROGRESS) ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new(); 77 ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new();
78
79 // curl_global_init() is not thread safe!
80 if (curl_global_init(CURL_GLOBAL_ALL)) return --_init_count;
87 81
82 _curlm = curl_multi_init();
88 if (!_curlm) 83 if (!_curlm)
89 { 84 {
90 long ms; 85 curl_global_cleanup();
91 86 return --_init_count;
92 // curl_global_init() is not thread safe! 87 }
93 if (curl_global_init(CURL_GLOBAL_ALL)) return --_init_count;
94
95 _curlm = curl_multi_init();
96 if (!_curlm) return --_init_count;
97 88
98 curl_multi_timeout(_curlm, &ms); 89 curl_multi_timeout(_curlm, &ms);
99 if (ms <= 0) ms = 100; 90 if (ms >= CURL_MIN_TIMEOUT || ms <= 0) ms = CURL_MIN_TIMEOUT;
100 91
101 _curl_timeout = ecore_timer_add((double)ms / 1000, _ecore_con_url_idler_handler, (void *)0xACE); 92 _curl_timer = ecore_timer_add((double)ms / 1000, _ecore_con_url_timer, NULL);
102 ecore_timer_freeze(_curl_timeout); 93 ecore_timer_freeze(_curl_timer);
103 }
104 94
105 return _init_count; 95 return _init_count;
106#else 96#else
@@ -112,31 +102,30 @@ EAPI int
112ecore_con_url_shutdown(void) 102ecore_con_url_shutdown(void)
113{ 103{
114#ifdef HAVE_CURL 104#ifdef HAVE_CURL
105 Ecore_Con_Url *url_con;
106 Ecore_Fd_Handler *fd_handler;
115 if (_init_count == 0) return 0; 107 if (_init_count == 0) return 0;
108 --_init_count;
109 if (_init_count) return _init_count;
116 110
117 if (--_init_count == 0) 111 if (_curl_timer)
118 { 112 {
119 Ecore_Con_Url *con_url; 113 ecore_timer_del(_curl_timer);
120 Ecore_Fd_Handler *fd_handler; 114 _curl_timer = NULL;
121 115 }
122 if (_curl_timeout)
123 {
124 ecore_timer_del(_curl_timeout);
125 _curl_timeout = NULL;
126 }
127 116
128 FD_ZERO(&_current_fd_set); 117 EINA_LIST_FREE(_url_con_list, url_con)
129 EINA_LIST_FREE(_url_con_list, con_url) ecore_con_url_free(con_url); 118 ecore_con_url_free(url_con);
130 EINA_LIST_FREE(_fd_hd_list, fd_handler) ecore_main_fd_handler_del(fd_handler); 119 EINA_LIST_FREE(_fd_hd_list, fd_handler)
120 ecore_main_fd_handler_del(fd_handler);
131 121
132 if (_curlm) 122 if (_curlm)
133 { 123 {
134 curl_multi_cleanup(_curlm); 124 curl_multi_cleanup(_curlm);
135 _curlm = NULL; 125 _curlm = NULL;
136 } 126 }
137 curl_global_cleanup(); 127 curl_global_cleanup();
138 } 128 return 0;
139 return _init_count;
140#endif 129#endif
141 return 1; 130 return 1;
142} 131}
@@ -145,14 +134,12 @@ EAPI void
145ecore_con_url_pipeline_set(Eina_Bool enable) 134ecore_con_url_pipeline_set(Eina_Bool enable)
146{ 135{
147#ifdef HAVE_CURL 136#ifdef HAVE_CURL
148 if (enable) 137 if (enable == pipelining) return;
149 curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 1); 138 curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, !!enable);
150 else 139 pipelining = enable;
151 curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 0);
152 pipelining = enable;
153#else 140#else
154 return; 141 return;
155 (void)enable; 142 (void)enable;
156#endif 143#endif
157} 144}
158 145
@@ -160,11 +147,13 @@ EAPI Eina_Bool
160ecore_con_url_pipeline_get(void) 147ecore_con_url_pipeline_get(void)
161{ 148{
162#ifdef HAVE_CURL 149#ifdef HAVE_CURL
163 return pipelining; 150 return pipelining;
164#endif 151#endif
165 return EINA_FALSE; 152 return EINA_FALSE;
166} 153}
167 154
155extern Ecore_Con_Socks *_ecore_con_proxy_global;
156
168EAPI Ecore_Con_Url * 157EAPI Ecore_Con_Url *
169ecore_con_url_new(const char *url) 158ecore_con_url_new(const char *url)
170{ 159{
@@ -196,22 +185,41 @@ ecore_con_url_new(const char *url)
196 return NULL; 185 return NULL;
197 } 186 }
198 187
188 // Read socks proxy
199 url_con->proxy_type = -1; 189 url_con->proxy_type = -1;
200 if (_ecore_con_proxy_global) 190 if (_ecore_con_proxy_global && _ecore_con_proxy_global->ip &&
191 (_ecore_con_proxy_global->version == 4 ||
192 _ecore_con_proxy_global->version == 5))
201 { 193 {
202 if (_ecore_con_proxy_global->ip) 194 char proxy[256];
195 char host[256];
196
197 if (_ecore_con_proxy_global->version == 5)
203 { 198 {
204 char host[128]; 199 if (_ecore_con_proxy_global->lookup)
205 if (_ecore_con_proxy_global->port > 0 && 200 snprintf(host, sizeof(host), "socks5h://%s",
206 _ecore_con_proxy_global->port <= 65535) 201 _ecore_con_proxy_global->ip);
207 snprintf(host, sizeof(host), "socks4://%s:%d", 202 else snprintf(host, sizeof(host), "socks5://%s",
208 _ecore_con_proxy_global->ip, 203 _ecore_con_proxy_global->ip);
209 _ecore_con_proxy_global->port); 204 }
210 else 205 else if (_ecore_con_proxy_global->version == 4)
211 snprintf(host, sizeof(host), "socks4://%s", 206 {
207 if (_ecore_con_proxy_global->lookup)
208 snprintf(host, sizeof(host), "socks4a://%s",
212 _ecore_con_proxy_global->ip); 209 _ecore_con_proxy_global->ip);
213 ecore_con_url_proxy_set(url_con, host); 210 else snprintf(host, sizeof(host), "socks4://%s",
211 _ecore_con_proxy_global->ip);
214 } 212 }
213
214 if (_ecore_con_proxy_global->port > 0 &&
215 _ecore_con_proxy_global->port <= 65535)
216 snprintf(proxy, sizeof(proxy), "%s:%d", host,
217 _ecore_con_proxy_global->port);
218 else snprintf(proxy, sizeof(proxy), "%s", host);
219
220 ecore_con_url_proxy_set(url_con, proxy);
221 ecore_con_url_proxy_username_set(url_con,
222 _ecore_con_proxy_global->username);
215 } 223 }
216 224
217 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate"); 225 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate");
@@ -291,10 +299,8 @@ ecore_con_url_free(Ecore_Con_Url *url_con)
291{ 299{
292#ifdef HAVE_CURL 300#ifdef HAVE_CURL
293 char *s; 301 char *s;
294 CURLMcode ret;
295 302
296 if (!url_con) 303 if (!url_con) return;
297 return;
298 304
299 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 305 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
300 { 306 {
@@ -302,17 +308,16 @@ ecore_con_url_free(Ecore_Con_Url *url_con)
302 return; 308 return;
303 } 309 }
304 310
305 ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
306
307 if (url_con->curl_easy) 311 if (url_con->curl_easy)
308 { 312 {
313 // FIXME : How can we delete curl_easy's fds ?? (Curl do not give this info.)
314 // This cause "Failed to delete epoll fd xx!" error messages
309 curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL); 315 curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL);
310 curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_TRUE); 316 curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_TRUE);
311 317
312 if (eina_list_data_find(_url_con_list, url_con)) 318 if (url_con->multi)
313 { 319 {
314 ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); 320 _ecore_con_url_multi_remove(url_con);
315 if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
316 _url_con_list = eina_list_remove(_url_con_list, url_con); 321 _url_con_list = eina_list_remove(_url_con_list, url_con);
317 } 322 }
318 323
@@ -320,6 +325,12 @@ ecore_con_url_free(Ecore_Con_Url *url_con)
320 } 325 }
321 if (url_con->timer) ecore_timer_del(url_con->timer); 326 if (url_con->timer) ecore_timer_del(url_con->timer);
322 327
328 url_con->curl_easy = NULL;
329 url_con->timer = NULL;
330 url_con->dead = EINA_TRUE;
331 if (url_con->event_count) return;
332 ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE);
333
323 curl_slist_free_all(url_con->headers); 334 curl_slist_free_all(url_con->headers);
324 EINA_LIST_FREE(url_con->additional_headers, s) 335 EINA_LIST_FREE(url_con->additional_headers, s)
325 free(s); 336 free(s);
@@ -350,9 +361,27 @@ ecore_con_url_url_get(Ecore_Con_Url *url_con)
350#endif 361#endif
351} 362}
352 363
364EAPI int
365ecore_con_url_status_code_get(Ecore_Con_Url *url_con)
366{
367#ifdef HAVE_CURL
368 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
369 {
370 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__);
371 return 0;
372 }
373
374 if (url_con->status) return url_con->status;
375 _ecore_con_url_status_get(url_con);
376 return url_con->status;
377#else
378 return -1;
379 (void)url_con;
380#endif
381}
382
353EAPI Eina_Bool 383EAPI Eina_Bool
354ecore_con_url_url_set(Ecore_Con_Url *url_con, 384ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url)
355 const char *url)
356{ 385{
357#ifdef HAVE_CURL 386#ifdef HAVE_CURL
358 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 387 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -361,8 +390,7 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con,
361 return EINA_FALSE; 390 return EINA_FALSE;
362 } 391 }
363 392
364 if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; 393 if (url_con->dead) return EINA_FALSE;
365
366 eina_stringshare_replace(&url_con->url, url); 394 eina_stringshare_replace(&url_con->url, url);
367 395
368 if (url_con->url) 396 if (url_con->url)
@@ -380,8 +408,7 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con,
380} 408}
381 409
382EAPI void 410EAPI void
383ecore_con_url_data_set(Ecore_Con_Url *url_con, 411ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data)
384 void *data)
385{ 412{
386#ifdef HAVE_CURL 413#ifdef HAVE_CURL
387 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 414 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -399,13 +426,12 @@ ecore_con_url_data_set(Ecore_Con_Url *url_con,
399} 426}
400 427
401EAPI void 428EAPI void
402ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, 429ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key, const char *value)
403 const char *key,
404 const char *value)
405{ 430{
406#ifdef HAVE_CURL 431#ifdef HAVE_CURL
407 char *tmp; 432 char *tmp;
408 433
434 if (url_con->dead) return;
409 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 435 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
410 { 436 {
411 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, 437 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL,
@@ -413,6 +439,7 @@ ecore_con_url_additional_header_add(Ecore_Con_Url *url_con,
413 return; 439 return;
414 } 440 }
415 441
442 if (url_con->dead) return;
416 tmp = malloc(strlen(key) + strlen(value) + 3); 443 tmp = malloc(strlen(key) + strlen(value) + 3);
417 if (!tmp) 444 if (!tmp)
418 return; 445 return;
@@ -467,9 +494,7 @@ ecore_con_url_data_get(Ecore_Con_Url *url_con)
467} 494}
468 495
469EAPI void 496EAPI void
470ecore_con_url_time(Ecore_Con_Url *url_con, 497ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, double timestamp)
471 Ecore_Con_Url_Time condition,
472 double timestamp)
473{ 498{
474#ifdef HAVE_CURL 499#ifdef HAVE_CURL
475 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 500 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -478,6 +503,7 @@ ecore_con_url_time(Ecore_Con_Url *url_con,
478 return; 503 return;
479 } 504 }
480 505
506 if (url_con->dead) return;
481 url_con->time_condition = condition; 507 url_con->time_condition = condition;
482 url_con->timestamp = timestamp; 508 url_con->timestamp = timestamp;
483#else 509#else
@@ -489,8 +515,7 @@ ecore_con_url_time(Ecore_Con_Url *url_con,
489} 515}
490 516
491EAPI void 517EAPI void
492ecore_con_url_fd_set(Ecore_Con_Url *url_con, 518ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd)
493 int fd)
494{ 519{
495#ifdef HAVE_CURL 520#ifdef HAVE_CURL
496 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 521 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -499,6 +524,7 @@ ecore_con_url_fd_set(Ecore_Con_Url *url_con,
499 return; 524 return;
500 } 525 }
501 526
527 if (url_con->dead) return;
502 url_con->write_fd = fd; 528 url_con->write_fd = fd;
503#else 529#else
504 return; 530 return;
@@ -537,10 +563,7 @@ ecore_con_url_response_headers_get(Ecore_Con_Url *url_con)
537} 563}
538 564
539EAPI Eina_Bool 565EAPI Eina_Bool
540ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, 566ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe)
541 const char *username,
542 const char *password,
543 Eina_Bool safe)
544{ 567{
545#ifdef HAVE_CURL 568#ifdef HAVE_CURL
546 CURLcode ret; 569 CURLcode ret;
@@ -552,6 +575,7 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
552 return EINA_FALSE; 575 return EINA_FALSE;
553 } 576 }
554 577
578 if (url_con->dead) return EINA_FALSE;
555# if LIBCURL_VERSION_NUM >= 0x071301 579# if LIBCURL_VERSION_NUM >= 0x071301
556 if ((username) && (password)) 580 if ((username) && (password))
557 { 581 {
@@ -596,11 +620,7 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_con,
596#define MODE_POST 2 620#define MODE_POST 2
597 621
598static Eina_Bool 622static Eina_Bool
599_ecore_con_url_send(Ecore_Con_Url *url_con, 623_ecore_con_url_send(Ecore_Con_Url *url_con, int mode, const void *data, long length, const char *content_type)
600 int mode,
601 const void *data,
602 long length,
603 const char *content_type)
604{ 624{
605#ifdef HAVE_CURL 625#ifdef HAVE_CURL
606 Eina_List *l; 626 Eina_List *l;
@@ -613,15 +633,14 @@ _ecore_con_url_send(Ecore_Con_Url *url_con,
613 return EINA_FALSE; 633 return EINA_FALSE;
614 } 634 }
615 635
616 if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; 636 if (!url_con->url) return EINA_FALSE;
617 637 if (url_con->dead) return EINA_FALSE;
618 if (!url_con->url)
619 return EINA_FALSE;
620 638
621 /* Free response headers from previous send() calls */ 639 /* Free response headers from previous send() calls */
622 EINA_LIST_FREE(url_con->response_headers, s) 640 EINA_LIST_FREE(url_con->response_headers, s)
623 free((char *)s); 641 free((char *)s);
624 url_con->response_headers = NULL; 642 url_con->response_headers = NULL;
643 url_con->status = 0;
625 644
626 curl_slist_free_all(url_con->headers); 645 curl_slist_free_all(url_con->headers);
627 url_con->headers = NULL; 646 url_con->headers = NULL;
@@ -693,15 +712,6 @@ _ecore_con_url_send(Ecore_Con_Url *url_con,
693#endif 712#endif
694} 713}
695 714
696EINA_DEPRECATED EAPI Eina_Bool
697ecore_con_url_send(Ecore_Con_Url *url_con,
698 const void *data,
699 long length,
700 const char *content_type)
701{
702 return _ecore_con_url_send(url_con, MODE_AUTO, data, length, content_type);
703}
704
705EAPI Eina_Bool 715EAPI Eina_Bool
706ecore_con_url_get(Ecore_Con_Url *url_con) 716ecore_con_url_get(Ecore_Con_Url *url_con)
707{ 717{
@@ -709,20 +719,13 @@ ecore_con_url_get(Ecore_Con_Url *url_con)
709} 719}
710 720
711EAPI Eina_Bool 721EAPI Eina_Bool
712ecore_con_url_post(Ecore_Con_Url *url_con, 722ecore_con_url_post(Ecore_Con_Url *url_con, const void *data, long length, const char *content_type)
713 const void *data,
714 long length,
715 const char *content_type)
716{ 723{
717 return _ecore_con_url_send(url_con, MODE_POST, data, length, content_type); 724 return _ecore_con_url_send(url_con, MODE_POST, data, length, content_type);
718} 725}
719 726
720EAPI Eina_Bool 727EAPI Eina_Bool
721ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, 728ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir)
722 const char *filename,
723 const char *user,
724 const char *pass,
725 const char *upload_dir)
726{ 729{
727#ifdef HAVE_CURL 730#ifdef HAVE_CURL
728 char url[4096]; 731 char url[4096];
@@ -739,54 +742,50 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
739 return EINA_FALSE; 742 return EINA_FALSE;
740 } 743 }
741 744
742 if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; 745 if (url_con->dead) return EINA_FALSE;
746 if (!url_con->url) return EINA_FALSE;
747 if ((!filename) || (!filename[0])) return EINA_FALSE;
743 748
744 if (!url_con->url) 749 if (stat(filename, &file_info))
745 return EINA_FALSE; 750 return EINA_FALSE;
746 751
747 if (filename) 752 snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass);
753 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd);
754 if (ret != CURLE_OK)
748 { 755 {
749 if (stat(filename, &file_info)) 756 ERR("Could not set username and password for FTP upload: %s",
750 return EINA_FALSE; 757 curl_easy_strerror(ret));
751 758 return EINA_FALSE;
752 snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass); 759 }
753 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd);
754 if (ret != CURLE_OK)
755 {
756 ERR("Could not set username and password for FTP upload: %s",
757 curl_easy_strerror(ret));
758 return EINA_FALSE;
759 }
760 760
761 char tmp[PATH_MAX]; 761 char tmp[PATH_MAX];
762 snprintf(tmp, PATH_MAX, "%s", filename); 762 snprintf(tmp, PATH_MAX, "%s", filename);
763 763
764 if (upload_dir) 764 if (upload_dir)
765 snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url, 765 snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url,
766 upload_dir, basename(tmp)); 766 upload_dir, basename(tmp));
767 else 767 else
768 snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url, 768 snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url,
769 basename(tmp)); 769 basename(tmp));
770 770
771 if (!ecore_con_url_url_set(url_con, url)) 771 if (!ecore_con_url_url_set(url_con, url))
772 return EINA_FALSE; 772 return EINA_FALSE;
773 773
774 curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE, 774 curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE,
775 (curl_off_t)file_info.st_size); 775 (curl_off_t)file_info.st_size);
776 curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1); 776 curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1);
777 curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION, 777 curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION,
778 _ecore_con_url_read_cb); 778 _ecore_con_url_read_cb);
779 779
780 fd = fopen(filename, "rb"); 780 fd = fopen(filename, "rb");
781 if (!fd) 781 if (!fd)
782 { 782 {
783 ERR("Could not open \"%s\" for FTP upload", filename); 783 ERR("Could not open \"%s\" for FTP upload", filename);
784 return EINA_FALSE; 784 return EINA_FALSE;
785 }
786 curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
787
788 return _ecore_con_url_perform(url_con);
789 } 785 }
786 curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd);
787
788 return _ecore_con_url_perform(url_con);
790#else 789#else
791 return EINA_FALSE; 790 return EINA_FALSE;
792 (void)url_con; 791 (void)url_con;
@@ -795,8 +794,6 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con,
795 (void)pass; 794 (void)pass;
796 (void)upload_dir; 795 (void)upload_dir;
797#endif 796#endif
798
799 return EINA_FALSE;
800} 797}
801 798
802EAPI void 799EAPI void
@@ -813,6 +810,7 @@ ecore_con_url_cookies_init(Ecore_Con_Url *url_con)
813 return; 810 return;
814 } 811 }
815 812
813 if (url_con->dead) return;
816 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, ""); 814 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, "");
817#else 815#else
818 return; 816 return;
@@ -834,6 +832,7 @@ ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con, Eina_Bool i
834 return; 832 return;
835 } 833 }
836 834
835 if (url_con->dead) return;
837 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore); 836 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore);
838#else 837#else
839 return; 838 return;
@@ -856,6 +855,7 @@ ecore_con_url_cookies_clear(Ecore_Con_Url *url_con)
856 return; 855 return;
857 } 856 }
858 857
858 if (url_con->dead) return;
859 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL"); 859 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL");
860#else 860#else
861 return; 861 return;
@@ -877,6 +877,7 @@ ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con)
877 return; 877 return;
878 } 878 }
879 879
880 if (url_con->dead) return;
880 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS"); 881 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS");
881#else 882#else
882 return; 883 return;
@@ -885,7 +886,7 @@ ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con)
885} 886}
886 887
887EAPI void 888EAPI void
888ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_name) 889ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char *const file_name)
889{ 890{
890#ifdef HAVE_CURL 891#ifdef HAVE_CURL
891 if (!url_con) 892 if (!url_con)
@@ -898,6 +899,7 @@ ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_n
898 return; 899 return;
899 } 900 }
900 901
902 if (url_con->dead) return;
901 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name); 903 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name);
902#else 904#else
903 return; 905 return;
@@ -907,7 +909,7 @@ ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_n
907} 909}
908 910
909EAPI Eina_Bool 911EAPI Eina_Bool
910ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char * const cookiejar_file) 912ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char *const cookiejar_file)
911{ 913{
912#ifdef HAVE_CURL 914#ifdef HAVE_CURL
913 CURLcode ret; 915 CURLcode ret;
@@ -922,6 +924,7 @@ ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char * const co
922 return EINA_FALSE; 924 return EINA_FALSE;
923 } 925 }
924 926
927 if (url_con->dead) return EINA_FALSE;
925 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR, 928 ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR,
926 cookiejar_file); 929 cookiejar_file);
927 if (ret != CURLE_OK) 930 if (ret != CURLE_OK)
@@ -953,6 +956,7 @@ ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con)
953 return; 956 return;
954 } 957 }
955 958
959 if (url_con->dead) return;
956 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH"); 960 curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH");
957#else 961#else
958 return; 962 return;
@@ -961,8 +965,7 @@ ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con)
961} 965}
962 966
963EAPI void 967EAPI void
964ecore_con_url_verbose_set(Ecore_Con_Url *url_con, 968ecore_con_url_verbose_set(Ecore_Con_Url *url_con, Eina_Bool verbose)
965 Eina_Bool verbose)
966{ 969{
967#ifdef HAVE_CURL 970#ifdef HAVE_CURL
968 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 971 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -972,11 +975,10 @@ ecore_con_url_verbose_set(Ecore_Con_Url *url_con,
972 return; 975 return;
973 } 976 }
974 977
975 if (eina_list_data_find(_url_con_list, url_con)) return;
976
977 if (!url_con->url) 978 if (!url_con->url)
978 return; 979 return;
979 980
981 if (url_con->dead) return;
980 curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose); 982 curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose);
981#else 983#else
982 return; 984 return;
@@ -986,8 +988,7 @@ ecore_con_url_verbose_set(Ecore_Con_Url *url_con,
986} 988}
987 989
988EAPI void 990EAPI void
989ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, 991ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, Eina_Bool use_epsv)
990 Eina_Bool use_epsv)
991{ 992{
992#ifdef HAVE_CURL 993#ifdef HAVE_CURL
993 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 994 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -997,11 +998,10 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con,
997 return; 998 return;
998 } 999 }
999 1000
1000 if (eina_list_data_find(_url_con_list, url_con)) return;
1001
1002 if (!url_con->url) 1001 if (!url_con->url)
1003 return; 1002 return;
1004 1003
1004 if (url_con->dead) return;
1005 curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, (int)use_epsv); 1005 curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, (int)use_epsv);
1006#else 1006#else
1007 return; 1007 return;
@@ -1023,8 +1023,7 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con,
1023 * @since 1.1.0 1023 * @since 1.1.0
1024 */ 1024 */
1025EAPI void 1025EAPI void
1026ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, 1026ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, Eina_Bool verify)
1027 Eina_Bool verify)
1028{ 1027{
1029#ifdef HAVE_CURL 1028#ifdef HAVE_CURL
1030 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 1029 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
@@ -1034,11 +1033,10 @@ ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con,
1034 return; 1033 return;
1035 } 1034 }
1036 1035
1037 if (eina_list_data_find(_url_con_list, url_con)) return;
1038
1039 if (!url_con->url) 1036 if (!url_con->url)
1040 return; 1037 return;
1041 1038
1039 if (url_con->dead) return;
1042 curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, (int)verify); 1040 curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, (int)verify);
1043#else 1041#else
1044 return; 1042 return;
@@ -1073,19 +1071,19 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path)
1073#ifdef HAVE_CURL 1071#ifdef HAVE_CURL
1074 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) 1072 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1075 { 1073 {
1076 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ssl_ca_set"); 1074 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ssl_ca_set");
1077 return -1; 1075 return -1;
1078 } 1076 }
1079 1077
1080 if (eina_list_data_find(_url_con_list, url_con)) return -1;
1081 if (!url_con->url) return -1; 1078 if (!url_con->url) return -1;
1079 if (url_con->dead) return -1;
1082 if (ca_path == NULL) 1080 if (ca_path == NULL)
1083 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 0); 1081 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 0);
1084 else 1082 else
1085 { 1083 {
1086 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 1); 1084 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 1);
1087 if (!res) 1085 if (!res)
1088 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_CAINFO, ca_path); 1086 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_CAINFO, ca_path);
1089 } 1087 }
1090#else 1088#else
1091 return -1; 1089 return -1;
@@ -1097,6 +1095,47 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path)
1097} 1095}
1098 1096
1099EAPI Eina_Bool 1097EAPI Eina_Bool
1098ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version)
1099{
1100#ifdef HAVE_CURL
1101 int res = -1;
1102 if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
1103 {
1104 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_http_version_set");
1105 return EINA_FALSE;
1106 }
1107 if (url_con->dead) return EINA_FALSE;
1108 switch (version)
1109 {
1110 case ECORE_CON_URL_HTTP_VERSION_1_0:
1111 res = curl_easy_setopt(url_con->curl_easy,
1112 CURLOPT_HTTP_VERSION,
1113 CURL_HTTP_VERSION_1_0);
1114 break;
1115
1116 case ECORE_CON_URL_HTTP_VERSION_1_1:
1117 res = curl_easy_setopt(url_con->curl_easy,
1118 CURLOPT_HTTP_VERSION,
1119 CURL_HTTP_VERSION_1_1);
1120 break;
1121
1122 default:
1123 break;
1124 }
1125 if (res != CURLE_OK)
1126 {
1127 ERR("curl http version setting failed: %s", curl_easy_strerror(res));
1128 return EINA_FALSE;
1129 }
1130 return EINA_TRUE;
1131#else
1132 (void)url_con;
1133 (void)version;
1134 return EINA_FALSE;
1135#endif
1136}
1137
1138EAPI Eina_Bool
1100ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy) 1139ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy)
1101{ 1140{
1102#ifdef HAVE_CURL 1141#ifdef HAVE_CURL
@@ -1109,8 +1148,8 @@ ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy)
1109 return EINA_FALSE; 1148 return EINA_FALSE;
1110 } 1149 }
1111 1150
1112 if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE;
1113 if (!url_con->url) return EINA_FALSE; 1151 if (!url_con->url) return EINA_FALSE;
1152 if (url_con->dead) return EINA_FALSE;
1114 1153
1115 if (!proxy) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, ""); 1154 if (!proxy) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, "");
1116 else 1155 else
@@ -1121,14 +1160,20 @@ ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy)
1121 if (vers->version_num < 0x71507) 1160 if (vers->version_num < 0x71507)
1122 { 1161 {
1123 url_con->proxy_type = CURLPROXY_HTTP; 1162 url_con->proxy_type = CURLPROXY_HTTP;
1124 if (strstr(proxy, "socks4")) url_con->proxy_type = CURLPROXY_SOCKS4; 1163 if (strstr(proxy, "socks4a"))
1125 else if (strstr(proxy, "socks4a")) url_con->proxy_type = CURLPROXY_SOCKS4A; 1164 url_con->proxy_type = CURLPROXY_SOCKS4A;
1126 else if (strstr(proxy, "socks5")) url_con->proxy_type = CURLPROXY_SOCKS5; 1165 else if (strstr(proxy, "socks4"))
1127 else if (strstr(proxy, "socks5h")) url_con->proxy_type = CURLPROXY_SOCKS5_HOSTNAME; 1166 url_con->proxy_type = CURLPROXY_SOCKS4;
1128 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXYTYPE, url_con->proxy_type); 1167 else if (strstr(proxy, "socks5h"))
1168 url_con->proxy_type = CURLPROXY_SOCKS5_HOSTNAME;
1169 else if (strstr(proxy, "socks5"))
1170 url_con->proxy_type = CURLPROXY_SOCKS5;
1171 res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXYTYPE,
1172 url_con->proxy_type);
1129 if (res != CURLE_OK) 1173 if (res != CURLE_OK)
1130 { 1174 {
1131 ERR("curl proxy type setting failed: %s", curl_easy_strerror(res)); 1175 ERR("curl proxy type setting failed: %s",
1176 curl_easy_strerror(res));
1132 url_con->proxy_type = -1; 1177 url_con->proxy_type = -1;
1133 return EINA_FALSE; 1178 return EINA_FALSE;
1134 } 1179 }
@@ -1159,7 +1204,7 @@ ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout)
1159 return; 1204 return;
1160 } 1205 }
1161 1206
1162 if (eina_list_data_find(_url_con_list, url_con)) return; 1207 if (url_con->dead) return;
1163 if (!url_con->url || timeout < 0) return; 1208 if (!url_con->url || timeout < 0) return;
1164 if (url_con->timer) ecore_timer_del(url_con->timer); 1209 if (url_con->timer) ecore_timer_del(url_con->timer);
1165 url_con->timer = ecore_timer_add(timeout, _ecore_con_url_timeout_cb, url_con); 1210 url_con->timer = ecore_timer_add(timeout, _ecore_con_url_timeout_cb, url_con);
@@ -1181,9 +1226,9 @@ ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username)
1181 return EINA_FALSE; 1226 return EINA_FALSE;
1182 } 1227 }
1183 1228
1184 if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; 1229 if (url_con->dead) return EINA_FALSE;
1185 if (!url_con->url) return EINA_FALSE; 1230 if (!url_con->url) return EINA_FALSE;
1186 if (!username) return EINA_FALSE; 1231 if ((!username) || (!username[0])) return EINA_FALSE;
1187 if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A) 1232 if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
1188 { 1233 {
1189 ERR("Proxy type should be socks5 and above"); 1234 ERR("Proxy type should be socks5 and above");
@@ -1214,8 +1259,8 @@ ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
1214 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_password_set"); 1259 ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_password_set");
1215 return EINA_FALSE; 1260 return EINA_FALSE;
1216 } 1261 }
1217 if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE;
1218 if (!url_con->url) return EINA_FALSE; 1262 if (!url_con->url) return EINA_FALSE;
1263 if (url_con->dead) return EINA_FALSE;
1219 if (!password) return EINA_FALSE; 1264 if (!password) return EINA_FALSE;
1220 if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A) 1265 if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A)
1221 { 1266 {
@@ -1242,19 +1287,61 @@ ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password)
1242 */ 1287 */
1243 1288
1244#ifdef HAVE_CURL 1289#ifdef HAVE_CURL
1290static void
1291_ecore_con_url_status_get(Ecore_Con_Url *url_con)
1292{
1293 long status = 0;
1294
1295 if (!url_con->curl_easy) return;
1296 if (!curl_easy_getinfo(url_con->curl_easy, CURLINFO_RESPONSE_CODE, &status))
1297 url_con->status = status;
1298 else
1299 url_con->status = 0;
1300}
1301
1302static void
1303_ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg)
1304{
1305 Ecore_Con_Event_Url_Complete *e;
1306
1307 e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
1308 if (!e) return;
1309
1310 if (curlmsg && (curlmsg->data.result == CURLE_OK))
1311 {
1312 if (!url_con->status)
1313 _ecore_con_url_status_get(url_con);
1314 }
1315 else if (curlmsg)
1316 ERR("Curl message have errors: %d", curlmsg->data.result);
1317 else
1318 CRIT("THIS IS BAD.");
1319
1320 e->status = url_con->status;
1321 e->url_con = url_con;
1322 url_con->event_count++;
1323 ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
1324}
1325
1326static void
1327_ecore_con_url_multi_remove(Ecore_Con_Url *url_con)
1328{
1329 CURLMcode ret;
1330
1331 ret = curl_multi_remove_handle(_curlm, url_con->curl_easy);
1332 url_con->multi = EINA_FALSE;
1333 if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
1334}
1335
1245static Eina_Bool 1336static Eina_Bool
1246_ecore_con_url_timeout_cb(void *data) 1337_ecore_con_url_timeout_cb(void *data)
1247{ 1338{
1248 Ecore_Con_Url *url_con = data; 1339 Ecore_Con_Url *url_con = data;
1249 CURLMcode ret;
1250 Ecore_Con_Event_Url_Complete *e;
1251 1340
1252 if (!url_con) return ECORE_CALLBACK_CANCEL; 1341 if (!url_con) return ECORE_CALLBACK_CANCEL;
1253 if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL; 1342 if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL;
1254 if (!eina_list_data_find(_url_con_list, url_con)) return ECORE_CALLBACK_CANCEL;
1255 1343
1256 ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); 1344 _ecore_con_url_multi_remove(url_con);
1257 if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
1258 _url_con_list = eina_list_remove(_url_con_list, url_con); 1345 _url_con_list = eina_list_remove(_url_con_list, url_con);
1259 1346
1260 curl_slist_free_all(url_con->headers); 1347 curl_slist_free_all(url_con->headers);
@@ -1262,21 +1349,12 @@ _ecore_con_url_timeout_cb(void *data)
1262 1349
1263 url_con->timer = NULL; 1350 url_con->timer = NULL;
1264 1351
1265 e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); 1352 _ecore_con_url_event_url_complete(url_con, NULL);
1266 if (e)
1267 {
1268 e->url_con = url_con;
1269 e->status = 0;
1270 ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL);
1271 }
1272 return ECORE_CALLBACK_CANCEL; 1353 return ECORE_CALLBACK_CANCEL;
1273} 1354}
1274 1355
1275static size_t 1356static size_t
1276_ecore_con_url_data_cb(void *buffer, 1357_ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp)
1277 size_t size,
1278 size_t nitems,
1279 void *userp)
1280{ 1358{
1281 Ecore_Con_Url *url_con; 1359 Ecore_Con_Url *url_con;
1282 Ecore_Con_Event_Url_Data *e; 1360 Ecore_Con_Event_Url_Data *e;
@@ -1295,6 +1373,7 @@ _ecore_con_url_data_cb(void *buffer,
1295 1373
1296 url_con->received += real_size; 1374 url_con->received += real_size;
1297 1375
1376 INF("reading from %s", url_con->url);
1298 if (url_con->write_fd < 0) 1377 if (url_con->write_fd < 0)
1299 { 1378 {
1300 e = 1379 e =
@@ -1305,7 +1384,8 @@ _ecore_con_url_data_cb(void *buffer,
1305 e->url_con = url_con; 1384 e->url_con = url_con;
1306 e->size = real_size; 1385 e->size = real_size;
1307 memcpy(e->data, buffer, real_size); 1386 memcpy(e->data, buffer, real_size);
1308 ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, _ecore_con_event_url_free, NULL); 1387 url_con->event_count++;
1388 ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
1309 } 1389 }
1310 } 1390 }
1311 else 1391 else
@@ -1336,10 +1416,7 @@ _ecore_con_url_data_cb(void *buffer,
1336} 1416}
1337 1417
1338static size_t 1418static size_t
1339_ecore_con_url_header_cb(void *ptr, 1419_ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream)
1340 size_t size,
1341 size_t nitems,
1342 void *stream)
1343{ 1420{
1344 size_t real_size = size * nitems; 1421 size_t real_size = size * nitems;
1345 Ecore_Con_Url *url_con = stream; 1422 Ecore_Con_Url *url_con = stream;
@@ -1358,11 +1435,7 @@ _ecore_con_url_header_cb(void *ptr,
1358} 1435}
1359 1436
1360static int 1437static int
1361_ecore_con_url_progress_cb(void *clientp, 1438_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
1362 double dltotal,
1363 double dlnow,
1364 double ultotal,
1365 double ulnow)
1366{ 1439{
1367 Ecore_Con_Event_Url_Progress *e; 1440 Ecore_Con_Event_Url_Progress *e;
1368 Ecore_Con_Url *url_con; 1441 Ecore_Con_Url *url_con;
@@ -1377,17 +1450,15 @@ _ecore_con_url_progress_cb(void *clientp,
1377 e->down.now = dlnow; 1450 e->down.now = dlnow;
1378 e->up.total = ultotal; 1451 e->up.total = ultotal;
1379 e->up.now = ulnow; 1452 e->up.now = ulnow;
1380 ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, _ecore_con_event_url_free, NULL); 1453 url_con->event_count++;
1454 ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con);
1381 } 1455 }
1382 1456
1383 return 0; 1457 return 0;
1384} 1458}
1385 1459
1386static size_t 1460static size_t
1387_ecore_con_url_read_cb(void *ptr, 1461_ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream)
1388 size_t size,
1389 size_t nitems,
1390 void *stream)
1391{ 1462{
1392 size_t retcode = fread(ptr, size, nitems, stream); 1463 size_t retcode = fread(ptr, size, nitems, stream);
1393 1464
@@ -1418,96 +1489,38 @@ _ecore_con_url_info_read(void)
1418 1489
1419 while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining))) 1490 while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining)))
1420 { 1491 {
1492 Eina_List *l, *ll;
1493 Ecore_Con_Url *url_con = NULL;
1494 DBG("Curl message: %d", curlmsg->msg);
1495
1421 if (curlmsg->msg == CURLMSG_DONE) 1496 if (curlmsg->msg == CURLMSG_DONE)
1422 { 1497 {
1423 Eina_List *l, *ll;
1424 Ecore_Con_Url *url_con;
1425
1426 EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_con) 1498 EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_con)
1427 { 1499 {
1428 if (curlmsg->easy_handle == url_con->curl_easy) 1500 if (curlmsg->easy_handle == url_con->curl_easy)
1429 { 1501 _ecore_con_url_event_url_complete(url_con, curlmsg);
1430 CURLMcode ret;
1431 Ecore_Con_Event_Url_Complete *e;
1432
1433 e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
1434 if (e)
1435 {
1436 e->url_con = url_con;
1437 e->status = 0;
1438 if (curlmsg->data.result == CURLE_OK)
1439 {
1440 long status; /* curl API uses long, not int */
1441 status = 0;
1442 curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &status);
1443 e->status = status;
1444 }
1445 ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL);
1446 }
1447
1448 ret = curl_multi_remove_handle(_curlm, url_con->curl_easy);
1449 if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
1450 _url_con_list = eina_list_remove(_url_con_list, url_con);
1451 break;
1452 }
1453 } 1502 }
1454 } 1503 }
1455 } 1504 }
1456} 1505}
1457 1506
1458static void 1507static void
1459_ecore_con_url_curl_clear(void) 1508_ecore_con_url_curl_clear(void)
1460{ 1509{
1510 Ecore_Fd_Handler *fdh;
1461 Ecore_Con_Url *url_con; 1511 Ecore_Con_Url *url_con;
1462 1512
1463 FD_ZERO(&_current_fd_set); 1513 EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh);
1464 if (_fd_hd_list) 1514 EINA_LIST_FREE(_url_con_list, url_con) _ecore_con_url_multi_remove(url_con);
1465 {
1466 Ecore_Fd_Handler *fd_handler;
1467 EINA_LIST_FREE(_fd_hd_list, fd_handler)
1468 {
1469 int fd = ecore_main_fd_handler_fd_get(fd_handler);
1470 FD_CLR(fd, &_current_fd_set);
1471 // FIXME: ecore_main_fd_handler_del() sometimes give errors
1472 // because curl do not make fd itself controlled by users, but it can be ignored.
1473 ecore_main_fd_handler_del(fd_handler);
1474 }
1475 }
1476
1477 EINA_LIST_FREE(_url_con_list, url_con)
1478 {
1479 CURLMcode ret;
1480 Ecore_Con_Event_Url_Complete *e;
1481
1482 e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete));
1483 if (e)
1484 {
1485 e->url_con = url_con;
1486 e->status = 0;
1487 ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL);
1488 }
1489 ret = curl_multi_remove_handle(_curlm, url_con->curl_easy);
1490 if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret));
1491 }
1492} 1515}
1493 1516
1494static Eina_Bool 1517static Eina_Bool
1495_ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) 1518_ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__)
1496{ 1519{
1497 if (_fd_hd_list) 1520 Ecore_Fd_Handler *fdh;
1498 { 1521 EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh);
1499 Ecore_Fd_Handler *fd_handler; 1522 ecore_timer_interval_set(_curl_timer, 0.1);
1500 EINA_LIST_FREE(_fd_hd_list, fd_handler) 1523 return ECORE_CALLBACK_CANCEL;
1501 {
1502 int fd = ecore_main_fd_handler_fd_get(fd_handler);
1503 FD_CLR(fd, &_current_fd_set);
1504 // FIXME: ecore_main_fd_handler_del() sometimes give errors
1505 // because curl do not make fd itself controlled by users, but it can be ignored.
1506 ecore_main_fd_handler_del(fd_handler);
1507 }
1508 }
1509 ecore_timer_thaw(_curl_timeout);
1510 return ECORE_CALLBACK_RENEW;
1511} 1524}
1512 1525
1513static void 1526static void
@@ -1516,7 +1529,6 @@ _ecore_con_url_fdset(void)
1516 CURLMcode ret; 1529 CURLMcode ret;
1517 fd_set read_set, write_set, exc_set; 1530 fd_set read_set, write_set, exc_set;
1518 int fd, fd_max; 1531 int fd, fd_max;
1519 Ecore_Fd_Handler *fd_handler;
1520 1532
1521 FD_ZERO(&read_set); 1533 FD_ZERO(&read_set);
1522 FD_ZERO(&write_set); 1534 FD_ZERO(&write_set);
@@ -1532,53 +1544,61 @@ _ecore_con_url_fdset(void)
1532 for (fd = 0; fd <= fd_max; fd++) 1544 for (fd = 0; fd <= fd_max; fd++)
1533 { 1545 {
1534 int flags = 0; 1546 int flags = 0;
1535 if (FD_ISSET(fd, &read_set)) flags |= ECORE_FD_READ; 1547 if (FD_ISSET(fd, &read_set)) flags |= ECORE_FD_READ;
1536 if (FD_ISSET(fd, &write_set)) flags |= ECORE_FD_WRITE; 1548 if (FD_ISSET(fd, &write_set)) flags |= ECORE_FD_WRITE;
1537 if (FD_ISSET(fd, &exc_set)) flags |= ECORE_FD_ERROR; 1549 if (FD_ISSET(fd, &exc_set)) flags |= ECORE_FD_ERROR;
1538 if (flags) 1550 if (flags)
1539 { 1551 {
1540 if (!FD_ISSET(fd, &_current_fd_set)) 1552 // FIXME: Who is owner (easy_handle) of this fd?? (Curl do not give this info.)
1541 { 1553 // This cause "Failed to delete epoll fd xx!" error messages
1542 FD_SET(fd, &_current_fd_set); 1554 Ecore_Fd_Handler *fd_handler;
1543 fd_handler = ecore_main_fd_handler_add(fd, flags, _ecore_con_url_fd_handler, NULL, NULL, NULL); 1555 fd_handler = ecore_main_fd_handler_add(fd, flags,
1544 if (fd_handler) _fd_hd_list = eina_list_append(_fd_hd_list, fd_handler); 1556 _ecore_con_url_fd_handler,
1545 ecore_timer_freeze(_curl_timeout); 1557 NULL, NULL, NULL);
1546 } 1558 if (fd_handler)
1559 _fd_hd_list = eina_list_append(_fd_hd_list, fd_handler);
1547 } 1560 }
1548 } 1561 }
1549} 1562}
1550 1563
1551static Eina_Bool 1564static Eina_Bool
1552_ecore_con_url_idler_handler(void *data __UNUSED__) 1565_ecore_con_url_timer(void *data __UNUSED__)
1553{ 1566{
1567 Ecore_Fd_Handler *fdh;
1554 int still_running; 1568 int still_running;
1555 CURLMcode ret; 1569 CURLMcode ret;
1556 1570
1571 EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh);
1572 _ecore_con_url_info_read();
1573
1557 ret = curl_multi_perform(_curlm, &still_running); 1574 ret = curl_multi_perform(_curlm, &still_running);
1558 if (ret == CURLM_CALL_MULTI_PERFORM) 1575 if (ret == CURLM_CALL_MULTI_PERFORM)
1559 { 1576 {
1560 DBG("Call multiperform again"); 1577 DBG("curl_multi_perform() again immediately");
1561 return ECORE_CALLBACK_RENEW; 1578 return ECORE_CALLBACK_RENEW;
1562 } 1579 }
1563 else if (ret != CURLM_OK) 1580 else if (ret != CURLM_OK)
1564 { 1581 {
1565 ERR("curl_multi_perform() failed: %s", curl_multi_strerror(ret)); 1582 ERR("curl_multi_perform() failed: %s", curl_multi_strerror(ret));
1566 _ecore_con_url_curl_clear(); 1583 _ecore_con_url_curl_clear();
1567 ecore_timer_freeze(_curl_timeout); 1584 ecore_timer_freeze(_curl_timer);
1568 return ECORE_CALLBACK_RENEW;
1569 } 1585 }
1570 1586
1571 _ecore_con_url_info_read();
1572 if (still_running) 1587 if (still_running)
1573 { 1588 {
1574 DBG("multiperform is still_running"); 1589 long ms;
1575 _ecore_con_url_fdset(); 1590 _ecore_con_url_fdset();
1591 curl_multi_timeout(_curlm, &ms);
1592 DBG("multiperform is still running: %d, timeout: %ld", still_running, ms);
1593 if (ms >= CURL_MIN_TIMEOUT || ms <= 0) ms = CURL_MIN_TIMEOUT;
1594 ecore_timer_interval_set(_curl_timer, (double)ms / 1000);
1576 } 1595 }
1577 else 1596 else
1578 { 1597 {
1579 DBG("multiperform ended"); 1598 DBG("multiperform ended");
1599 _ecore_con_url_info_read();
1580 _ecore_con_url_curl_clear(); 1600 _ecore_con_url_curl_clear();
1581 ecore_timer_freeze(_curl_timeout); 1601 ecore_timer_freeze(_curl_timer);
1582 } 1602 }
1583 1603
1584 return ECORE_CALLBACK_RENEW; 1604 return ECORE_CALLBACK_RENEW;
@@ -1596,17 +1616,20 @@ _ecore_con_url_perform(Ecore_Con_Url *url_con)
1596 return EINA_FALSE; 1616 return EINA_FALSE;
1597 } 1617 }
1598 1618
1619 url_con->multi = EINA_TRUE;
1599 _url_con_list = eina_list_append(_url_con_list, url_con); 1620 _url_con_list = eina_list_append(_url_con_list, url_con);
1600 ecore_timer_thaw(_curl_timeout); 1621 ecore_timer_thaw(_curl_timer);
1601 1622
1602 return EINA_TRUE; 1623 return EINA_TRUE;
1603} 1624}
1604 1625
1605static void 1626static void
1606_ecore_con_event_url_free(void *data __UNUSED__, 1627_ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev)
1607 void *ev)
1608{ 1628{
1609 free(ev); 1629 free(ev);
1630 url_con->event_count--;
1631 if (url_con->dead && (!url_con->event_count))
1632 ecore_con_url_free(url_con);
1610} 1633}
1611 1634
1612#endif 1635#endif
diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.in b/libraries/ecore/src/lib/ecore_config/Makefile.in
index 6870d44..4b908cd 100644
--- a/libraries/ecore/src/lib/ecore_config/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_config/Makefile.in
@@ -55,16 +55,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
55 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 55 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
56 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 56 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
57 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 57 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
58 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 58 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
59 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 59 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
60 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 60 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
61 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 61 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
62 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 62 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
63 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 63 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
64 $(top_srcdir)/configure.ac
65am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 64am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
66 $(ACLOCAL_M4) 65 $(ACLOCAL_M4)
67mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 66mkinstalldirs = $(install_sh) -d
68CONFIG_HEADER = $(top_builddir)/config.h 67CONFIG_HEADER = $(top_builddir)/config.h
69CONFIG_CLEAN_FILES = 68CONFIG_CLEAN_FILES =
70CONFIG_CLEAN_VPATH_FILES = 69CONFIG_CLEAN_VPATH_FILES =
@@ -205,6 +204,8 @@ EVAS_LIBS = @EVAS_LIBS@
205EVIL_CFLAGS = @EVIL_CFLAGS@ 204EVIL_CFLAGS = @EVIL_CFLAGS@
206EVIL_LIBS = @EVIL_LIBS@ 205EVIL_LIBS = @EVIL_LIBS@
207EXEEXT = @EXEEXT@ 206EXEEXT = @EXEEXT@
207EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
208EXOTIC_LIBS = @EXOTIC_LIBS@
208FGREP = @FGREP@ 209FGREP = @FGREP@
209GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 210GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
210GLIB_CFLAGS = @GLIB_CFLAGS@ 211GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -260,6 +261,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
260PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 261PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
261PIXMAN_LIBS = @PIXMAN_LIBS@ 262PIXMAN_LIBS = @PIXMAN_LIBS@
262PKG_CONFIG = @PKG_CONFIG@ 263PKG_CONFIG = @PKG_CONFIG@
264PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
265PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
263POSUB = @POSUB@ 266POSUB = @POSUB@
264RANLIB = @RANLIB@ 267RANLIB = @RANLIB@
265SCIM_CFLAGS = @SCIM_CFLAGS@ 268SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -270,6 +273,7 @@ SDL_LIBS = @SDL_LIBS@
270SED = @SED@ 273SED = @SED@
271SET_MAKE = @SET_MAKE@ 274SET_MAKE = @SET_MAKE@
272SHELL = @SHELL@ 275SHELL = @SHELL@
276SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
273SSL_CFLAGS = @SSL_CFLAGS@ 277SSL_CFLAGS = @SSL_CFLAGS@
274SSL_LIBS = @SSL_LIBS@ 278SSL_LIBS = @SSL_LIBS@
275STRIP = @STRIP@ 279STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_directfb/Makefile.in b/libraries/ecore/src/lib/ecore_directfb/Makefile.in
index b7e1d29..f1b270a 100644
--- a/libraries/ecore/src/lib/ecore_directfb/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_directfb/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -190,6 +189,8 @@ EVAS_LIBS = @EVAS_LIBS@
190EVIL_CFLAGS = @EVIL_CFLAGS@ 189EVIL_CFLAGS = @EVIL_CFLAGS@
191EVIL_LIBS = @EVIL_LIBS@ 190EVIL_LIBS = @EVIL_LIBS@
192EXEEXT = @EXEEXT@ 191EXEEXT = @EXEEXT@
192EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
193EXOTIC_LIBS = @EXOTIC_LIBS@
193FGREP = @FGREP@ 194FGREP = @FGREP@
194GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 195GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
195GLIB_CFLAGS = @GLIB_CFLAGS@ 196GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -245,6 +246,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
245PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 246PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
246PIXMAN_LIBS = @PIXMAN_LIBS@ 247PIXMAN_LIBS = @PIXMAN_LIBS@
247PKG_CONFIG = @PKG_CONFIG@ 248PKG_CONFIG = @PKG_CONFIG@
249PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
250PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
248POSUB = @POSUB@ 251POSUB = @POSUB@
249RANLIB = @RANLIB@ 252RANLIB = @RANLIB@
250SCIM_CFLAGS = @SCIM_CFLAGS@ 253SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -255,6 +258,7 @@ SDL_LIBS = @SDL_LIBS@
255SED = @SED@ 258SED = @SED@
256SET_MAKE = @SET_MAKE@ 259SET_MAKE = @SET_MAKE@
257SHELL = @SHELL@ 260SHELL = @SHELL@
261SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
258SSL_CFLAGS = @SSL_CFLAGS@ 262SSL_CFLAGS = @SSL_CFLAGS@
259SSL_LIBS = @SSL_LIBS@ 263SSL_LIBS = @SSL_LIBS@
260STRIP = @STRIP@ 264STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h
index 8d9abc4..a78824e 100644
--- a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h
+++ b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h
@@ -39,6 +39,9 @@
39 * @li @ref ecore_evas_callbacks_example_c 39 * @li @ref ecore_evas_callbacks_example_c
40 * @li @ref ecore_evas_object_example_c 40 * @li @ref ecore_evas_object_example_c
41 * @li @ref ecore_evas_basics_example_c 41 * @li @ref ecore_evas_basics_example_c
42 * @li @ref Ecore_Evas_Window_Sizes_Example_c
43 * @li @ref Ecore_Evas_Buffer_Example_01_c
44 * @li @ref Ecore_Evas_Buffer_Example_02_c
42 */ 45 */
43 46
44/* FIXME: 47/* FIXME:
@@ -60,10 +63,26 @@ extern "C" {
60/** 63/**
61 * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions 64 * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions
62 * 65 *
66 * Ecore evas is a set of functions that makes it easy to tie together ecore's
67 * main loop and input handling to evas. As such it's a natural base for EFL
68 * applications. While this combination makes it easy to create the basic
69 * aspects all applications need, for normal applications(ones with buttons,
70 * checkboxes and layouts) one should consider using Elementary.
71 *
72 * Ecore evas is extremely well suited for applications that are not based on
73 * widgets. It has a main loop that delivers events, does basic window handling
74 * and leaves all of the drawing up to the user. This works very well if used
75 * in conjunction with Edje or if doing custom drawing as, for example, is done
76 * in games.
77 *
63 * This is a list of examples of these functions: 78 * This is a list of examples of these functions:
64 * - @ref Ecore_Evas_Window_Sizes_Example_c 79 * @li @ref ecore_evas_basics_example_c
65 * - @ref Ecore_Evas_Buffer_Example_01_c 80 * @li @ref ecore_evas_object_example_c
66 * - @ref Ecore_Evas_Buffer_Example_02_c 81 * @li @ref ecore_evas_callbacks_example_c
82 * @li @ref Ecore_Evas_Window_Sizes_Example_c
83 * @li @ref Ecore_Evas_Buffer_Example_01_c
84 * @li @ref Ecore_Evas_Buffer_Example_02_c
85 *
67 * @{ 86 * @{
68 */ 87 */
69 88
@@ -151,6 +170,12 @@ typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
151#ifndef _ECORE_EVAS_PRIVATE_H 170#ifndef _ECORE_EVAS_PRIVATE_H
152/* basic data types */ 171/* basic data types */
153typedef struct _Ecore_Evas Ecore_Evas; 172typedef struct _Ecore_Evas Ecore_Evas;
173typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
174#endif
175
176#ifndef _ECORE_WAYLAND_H_
177#define _ECORE_WAYLAND_WINDOW_PREDEF
178typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
154#endif 179#endif
155 180
156/* module setup/shutdown calls */ 181/* module setup/shutdown calls */
@@ -222,7 +247,7 @@ EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, in
222 * This function allows you to make an Ecore_Evas translucent using an 247 * This function allows you to make an Ecore_Evas translucent using an
223 * alpha channel. See ecore_evas_shaped_set() for details. The difference 248 * alpha channel. See ecore_evas_shaped_set() for details. The difference
224 * between a shaped window and a window with an alpha channel is that an 249 * between a shaped window and a window with an alpha channel is that an
225 * alpha channel supports multiple levels of transpararency, as opposed to 250 * alpha channel supports multiple levels of transparency, as opposed to
226 * the 1 bit transparency of a shaped window (a pixel is either opaque, or 251 * the 1 bit transparency of a shaped window (a pixel is either opaque, or
227 * it's transparent). 252 * it's transparent).
228 * 253 *
@@ -300,7 +325,7 @@ EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, i
300 * This function takes four pointers to (already allocated) ints, and places 325 * This function takes four pointers to (already allocated) ints, and places
301 * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you 326 * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you
302 * may pass NULL on them. 327 * may pass NULL on them.
303 * This function can represent recently requested geomety. 328 * This function can represent recently requested geometry.
304 * ecore_evas_geometry_get function returns the value is updated after engine finished request. 329 * ecore_evas_geometry_get function returns the value is updated after engine finished request.
305 * By comparison, ecore_evas_request_geometry_get returns recently requested value. 330 * By comparison, ecore_evas_request_geometry_get returns recently requested value.
306 * 331 *
@@ -342,7 +367,7 @@ EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee);
342 * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if 367 * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if
343 * @p on is EINA_FALSE. 368 * @p on is EINA_FALSE.
344 * 369 *
345 * @note Iconify and minize are synonims. 370 * @note Iconify and minimize are synonyms.
346 * 371 *
347 * @warning Support for this depends on the underlying windowing system. 372 * @warning Support for this depends on the underlying windowing system.
348 */ 373 */
@@ -353,7 +378,7 @@ EAPI void ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on);
353 * @param ee The Ecore_Evas to set 378 * @param ee The Ecore_Evas to set
354 * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not. 379 * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not.
355 * 380 *
356 * @note Iconify and minize are synonims. 381 * @note Iconify and minimize are synonyms.
357 * 382 *
358 * @see ecore_evas_iconified_set() 383 * @see ecore_evas_iconified_set()
359 */ 384 */
@@ -401,6 +426,161 @@ EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on);
401 */ 426 */
402EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee); 427EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee);
403/** 428/**
429 * @brief Set another window that this window is a group member of
430 *
431 * @param ee The Ecore_Evas
432 * @param ee_group The other group member
433 *
434 * If @p ee_group is NULL, @p ee is removed from the group, otherwise it is
435 * added. Note that if you free the @p ee_group canvas before @p ee, then
436 * getting the group canvas with ecore_evas_window_group_get() will return
437 * an invalid handle.
438 *
439 * @warning Support for this depends on the underlying windowing system.
440 * @since 1.2
441 */
442EAPI void ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group);
443/**
444 * @brief Get the canvas group set.
445 *
446 * This returns the handle set by ecore_evas_window_group_set().
447 *
448 * @param ee The Ecore_Evas to set
449 * @return The Canvas group handle
450 *
451 * @see ecore_evas_window_group_set()
452 * @since 1.2
453 */
454EAPI const Ecore_Evas *ecore_evas_window_group_get(const Ecore_Evas *ee);
455/**
456 * @brief Set the aspect ratio of a canvas window
457 *
458 * @param ee The Ecore_Evas
459 * @param aspect The aspect ratio (width divided by height), or 0 to disable
460 *
461 * This sets the desired aspect ratio of a canvas window
462 *
463 * @warning Support for this depends on the underlying windowing system.
464 * @since 1.2
465 */
466EAPI void ecore_evas_aspect_set(Ecore_Evas *ee, double aspect);
467/**
468 * @brief Get the aspect ratio of a canvas window
469 *
470 * This returns the value set by ecore_evas_aspect_set().
471 *
472 * @param ee The Ecore_Evas to set
473 * @return The aspect ratio
474 *
475 * @see ecore_evas_aspect_set()
476 * @since 1.2
477 */
478EAPI double ecore_evas_aspect_get(const Ecore_Evas *ee);
479/**
480 * @brief Set The urgent hint flag
481 *
482 * @param ee The Ecore_Evas
483 * @param urgent The urgent state flag
484 *
485 * This sets the "urgent" state hint on a window so the desktop environment
486 * can highlight it somehow.
487 *
488 * @warning Support for this depends on the underlying windowing system.
489 * @since 1.2
490 */
491EAPI void ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent);
492/**
493 * @brief Get the urgent state on the cavas window
494 *
495 * This returns the value set by ecore_evas_urgent_set()
496 *
497 * @param ee The Ecore_Evas to set
498 * @return The urgent state set
499 *
500 * @see ecore_evas_urgent_set()
501 * @since 1.2
502 */
503EAPI Eina_Bool ecore_evas_urgent_get(const Ecore_Evas *ee);
504/**
505 * @brief Set the modal state flag on the canvas window
506 *
507 * @param ee The Ecore_Evas
508 * @param modal The modal hint flag
509 *
510 * This hints if the window should be modal (eg if it is also transient
511 * for another window, the other window will maybe be denied focus by
512 * the desktop window manager).
513 *
514 * @warning Support for this depends on the underlying windowing system.
515 * @since 1.2
516 */
517EAPI void ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal);
518/**
519 * @brief Get The modal flag
520 *
521 * This returns the value set by ecore_evas_modal_set().
522 *
523 * @param ee The Ecore_Evas to set
524 * @return The modal flag
525 *
526 * @see ecore_evas_modal_set()
527 * @since 1.2
528 */
529EAPI Eina_Bool ecore_evas_modal_get(const Ecore_Evas *ee);
530/**
531 * @brief Set the "i demand attention" flag on a canvas window
532 *
533 * @param ee The Ecore_Evas
534 * @param demand_attention The flag state to set
535 *
536 * A window may demand attention now (eg you must enter a password before
537 * continuing), and so it may flag a window with this.
538 *
539 * @warning Support for this depends on the underlying windowing system.
540 * @since 1.2
541 */
542EAPI void ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand);
543/**
544 * @brief Get the "i demand attention" flag
545 *
546 * This returns the value set by ecore_evas_demand_attention_set().
547 *
548 * @param ee The Ecore_Evas to set
549 * @return The "i demand attention" flag.
550 *
551 * @see ecore_evas_demand_attention_set()
552 * @since 1.2
553 */
554EAPI Eina_Bool ecore_evas_demand_attention_get(const Ecore_Evas *ee);
555/**
556 * @brief Set the "focus skip" flag
557 *
558 * @param ee The Ecore_Evas
559 * @param skip The "focus skip" state to set.
560 *
561 * A window may not want to accept focus, be in the taskbar, pager etc.
562 * sometimes (example for a small notification window that hovers around
563 * a taskbar or panel, or hovers around a window until some activity
564 * dismisses it).
565 *
566 * @warning Support for this depends on the underlying windowing system.
567 * @since 1.2
568 */
569EAPI void ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip);
570/**
571 * @brief Get the "focus skip" flag
572 *
573 * This returns the value set by ecore_evas_focus_skip_set().
574 *
575 * @param ee The Ecore_Evas to set
576 * @return The "focus skip" flag.
577 *
578 * @see ecore_evas_focus_skip_set()
579 * @since 1.2
580 */
581EAPI Eina_Bool ecore_evas_focus_skip_get(const Ecore_Evas *ee);
582
583/**
404 * @brief Set if this evas should ignore @b all events. 584 * @brief Set if this evas should ignore @b all events.
405 * 585 *
406 * @param ee The Ecore_Evas whose window's to ignore events. 586 * @param ee The Ecore_Evas whose window's to ignore events.
@@ -693,10 +873,13 @@ EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int
693EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); 873EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h);
694EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); 874EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee);
695 875
696EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame); 876
697EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame); 877EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame);
878EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame);
698EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location); 879EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location);
699EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); 880/* EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); */
881/* EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); */
882/* EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); */
700 883
701/** 884/**
702 * @brief Create a new @c Ecore_Evas canvas bound to the Evas 885 * @brief Create a new @c Ecore_Evas canvas bound to the Evas
@@ -1038,7 +1221,7 @@ EAPI void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void
1038 * @warning If and when this function is called depends on the underlying 1221 * @warning If and when this function is called depends on the underlying
1039 * windowing system. 1222 * windowing system.
1040 */ 1223 */
1041EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1224EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1042/** 1225/**
1043 * Set a callback for Ecore_Evas move events. 1226 * Set a callback for Ecore_Evas move events.
1044 * @param ee The Ecore_Evas to set callbacks on 1227 * @param ee The Ecore_Evas to set callbacks on
@@ -1050,7 +1233,7 @@ EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ec
1050 * @warning If and when this function is called depends on the underlying 1233 * @warning If and when this function is called depends on the underlying
1051 * windowing system. 1234 * windowing system.
1052 */ 1235 */
1053EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1236EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1054/** 1237/**
1055 * Set a callback for Ecore_Evas show events. 1238 * Set a callback for Ecore_Evas show events.
1056 * @param ee The Ecore_Evas to set callbacks on 1239 * @param ee The Ecore_Evas to set callbacks on
@@ -1062,7 +1245,7 @@ EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecor
1062 * @warning If and when this function is called depends on the underlying 1245 * @warning If and when this function is called depends on the underlying
1063 * windowing system. 1246 * windowing system.
1064 */ 1247 */
1065EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1248EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1066/** 1249/**
1067 * Set a callback for Ecore_Evas hide events. 1250 * Set a callback for Ecore_Evas hide events.
1068 * @param ee The Ecore_Evas to set callbacks on 1251 * @param ee The Ecore_Evas to set callbacks on
@@ -1074,7 +1257,7 @@ EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecor
1074 * @warning If and when this function is called depends on the underlying 1257 * @warning If and when this function is called depends on the underlying
1075 * windowing system. 1258 * windowing system.
1076 */ 1259 */
1077EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1260EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1078/** 1261/**
1079 * Set a callback for Ecore_Evas delete request events. 1262 * Set a callback for Ecore_Evas delete request events.
1080 * @param ee The Ecore_Evas to set callbacks on 1263 * @param ee The Ecore_Evas to set callbacks on
@@ -1086,7 +1269,7 @@ EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecor
1086 * @warning If and when this function is called depends on the underlying 1269 * @warning If and when this function is called depends on the underlying
1087 * windowing system. 1270 * windowing system.
1088 */ 1271 */
1089EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1272EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1090/** 1273/**
1091 * Set a callback for Ecore_Evas destroy events. 1274 * Set a callback for Ecore_Evas destroy events.
1092 * @param ee The Ecore_Evas to set callbacks on 1275 * @param ee The Ecore_Evas to set callbacks on
@@ -1098,7 +1281,7 @@ EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*f
1098 * @warning If and when this function is called depends on the underlying 1281 * @warning If and when this function is called depends on the underlying
1099 * windowing system. 1282 * windowing system.
1100 */ 1283 */
1101EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1284EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1102/** 1285/**
1103 * Set a callback for Ecore_Evas focus in events. 1286 * Set a callback for Ecore_Evas focus in events.
1104 * @param ee The Ecore_Evas to set callbacks on 1287 * @param ee The Ecore_Evas to set callbacks on
@@ -1110,7 +1293,7 @@ EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (E
1110 * @warning If and when this function is called depends on the underlying 1293 * @warning If and when this function is called depends on the underlying
1111 * windowing system. 1294 * windowing system.
1112 */ 1295 */
1113EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1296EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1114/** 1297/**
1115 * Set a callback for Ecore_Evas focus out events. 1298 * Set a callback for Ecore_Evas focus out events.
1116 * @param ee The Ecore_Evas to set callbacks on 1299 * @param ee The Ecore_Evas to set callbacks on
@@ -1122,7 +1305,7 @@ EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (
1122 * @warning If and when this function is called depends on the underlying 1305 * @warning If and when this function is called depends on the underlying
1123 * windowing system. 1306 * windowing system.
1124 */ 1307 */
1125EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1308EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1126/** 1309/**
1127 * Set a callback for Ecore_Evas sticky events. 1310 * Set a callback for Ecore_Evas sticky events.
1128 * @param ee The Ecore_Evas to set callbacks on 1311 * @param ee The Ecore_Evas to set callbacks on
@@ -1134,7 +1317,7 @@ EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func)
1134 * @warning If and when this function is called depends on the underlying 1317 * @warning If and when this function is called depends on the underlying
1135 * windowing system. 1318 * windowing system.
1136 */ 1319 */
1137EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1320EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1138/** 1321/**
1139 * Set a callback for Ecore_Evas un-sticky events. 1322 * Set a callback for Ecore_Evas un-sticky events.
1140 * @param ee The Ecore_Evas to set callbacks on 1323 * @param ee The Ecore_Evas to set callbacks on
@@ -1146,7 +1329,7 @@ EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ec
1146 * @warning If and when this function is called depends on the underlying 1329 * @warning If and when this function is called depends on the underlying
1147 * windowing system. 1330 * windowing system.
1148 */ 1331 */
1149EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1332EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1150/** 1333/**
1151 * Set a callback for Ecore_Evas mouse in events. 1334 * Set a callback for Ecore_Evas mouse in events.
1152 * @param ee The Ecore_Evas to set callbacks on 1335 * @param ee The Ecore_Evas to set callbacks on
@@ -1158,7 +1341,7 @@ EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (
1158 * @warning If and when this function is called depends on the underlying 1341 * @warning If and when this function is called depends on the underlying
1159 * windowing system. 1342 * windowing system.
1160 */ 1343 */
1161EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1344EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1162/** 1345/**
1163 * Set a callback for Ecore_Evas mouse out events. 1346 * Set a callback for Ecore_Evas mouse out events.
1164 * @param ee The Ecore_Evas to set callbacks on 1347 * @param ee The Ecore_Evas to set callbacks on
@@ -1170,7 +1353,7 @@ EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (
1170 * @warning If and when this function is called depends on the underlying 1353 * @warning If and when this function is called depends on the underlying
1171 * windowing system. 1354 * windowing system.
1172 */ 1355 */
1173EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1356EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1174/** 1357/**
1175 * Set a callback for Ecore_Evas pre render events. 1358 * Set a callback for Ecore_Evas pre render events.
1176 * @param ee The Ecore_Evas to set callbacks on 1359 * @param ee The Ecore_Evas to set callbacks on
@@ -1182,7 +1365,7 @@ EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func)
1182 * @warning If and when this function is called depends on the underlying 1365 * @warning If and when this function is called depends on the underlying
1183 * windowing system. 1366 * windowing system.
1184 */ 1367 */
1185EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1368EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1186/** 1369/**
1187 * Set a callback for Ecore_Evas mouse post render events. 1370 * Set a callback for Ecore_Evas mouse post render events.
1188 * @param ee The Ecore_Evas to set callbacks on 1371 * @param ee The Ecore_Evas to set callbacks on
@@ -1194,7 +1377,7 @@ EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func)
1194 * @warning If and when this function is called depends on the underlying 1377 * @warning If and when this function is called depends on the underlying
1195 * windowing system. 1378 * windowing system.
1196 */ 1379 */
1197EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1380EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1198/** 1381/**
1199 * Set a callback for Ecore_Evas pre-free event. 1382 * Set a callback for Ecore_Evas pre-free event.
1200 * @param ee The Ecore_Evas to set callbacks on 1383 * @param ee The Ecore_Evas to set callbacks on
@@ -1206,7 +1389,21 @@ EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func
1206 * @warning If and when this function is called depends on the underlying 1389 * @warning If and when this function is called depends on the underlying
1207 * windowing system. 1390 * windowing system.
1208 */ 1391 */
1209EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 1392EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1393/**
1394 * Set a callback for Ecore_Evas state changes.
1395 * @param ee The Ecore_Evas to set callbacks on
1396 * @param func The function to call
1397
1398 * A call to this function will set a callback on an Ecore_Evas, causing
1399 * @p func to be called whenever @p ee changes state.
1400 *
1401 * @since 1.2
1402 * @warning If and when this function is called depends on the underlying
1403 * windowing system.
1404 */
1405EAPI void ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1406
1210EAPI Evas *ecore_evas_get(const Ecore_Evas *ee); 1407EAPI Evas *ecore_evas_get(const Ecore_Evas *ee);
1211EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y); 1408EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y);
1212EAPI void ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped); 1409EAPI void ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped);
@@ -1572,7 +1769,7 @@ EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
1572/** 1769/**
1573 * Return the internal backing store in use. 1770 * Return the internal backing store in use.
1574 * 1771 *
1575 * @note this will foced it to be created, making future calls to 1772 * @note this will forced it to be created, making future calls to
1576 * ecore_evas_ews_engine_set() void. 1773 * ecore_evas_ews_engine_set() void.
1577 * 1774 *
1578 * @see ecore_evas_ews_evas_get() 1775 * @see ecore_evas_ews_evas_get()
@@ -1583,7 +1780,7 @@ EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
1583/** 1780/**
1584 * Return the internal backing store in use. 1781 * Return the internal backing store in use.
1585 * 1782 *
1586 * @note this will foced it to be created, making future calls to 1783 * @note this will forced it to be created, making future calls to
1587 * ecore_evas_ews_engine_set() void. 1784 * ecore_evas_ews_engine_set() void.
1588 * 1785 *
1589 * @see ecore_evas_ews_ecore_evas_get() 1786 * @see ecore_evas_ews_ecore_evas_get()
@@ -1762,6 +1959,7 @@ EAPI Ecore_Evas *ecore_evas_extn_socket_new(int w, int h);
1762/** 1959/**
1763 * @brief Create a socket to provide the service for external ecore evas socket. 1960 * @brief Create a socket to provide the service for external ecore evas socket.
1764 * 1961 *
1962 * @param ee The Ecore_Evas
1765 * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail. 1963 * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail.
1766 * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name. 1964 * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name.
1767 * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service. 1965 * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service.
@@ -1791,7 +1989,7 @@ EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname
1791 * image data so the external plug process will not render to it or alter it. 1989 * image data so the external plug process will not render to it or alter it.
1792 * 1990 *
1793 * You should only hold the lock for just as long as you need to read out the 1991 * You should only hold the lock for just as long as you need to read out the
1794 * image data or otherwise deal with it, and then unlokc it with 1992 * image data or otherwise deal with it, and then unlock it with
1795 * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than 1993 * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than
1796 * 1 iteration of the main ecore loop will be problematic, so avoid it. Also 1994 * 1 iteration of the main ecore loop will be problematic, so avoid it. Also
1797 * forgetting to unlock may cause the socket process to freeze and thus create 1995 * forgetting to unlock may cause the socket process to freeze and thus create
@@ -1831,7 +2029,7 @@ EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj);
1831 * in the canvas of the plug process in place of the image object. The image 2029 * in the canvas of the plug process in place of the image object. The image
1832 * object by default is created to be filled (equivalent of 2030 * object by default is created to be filled (equivalent of
1833 * evas_object_image_filled_add() on creation) so image content will scale 2031 * evas_object_image_filled_add() on creation) so image content will scale
1834 * toi fill the image unless otherwise reconfigured. The Ecore_Evas size 2032 * to fill the image unless otherwise reconfigured. The Ecore_Evas size
1835 * of the plug is the master size and determines size in pixels of the 2033 * of the plug is the master size and determines size in pixels of the
1836 * plug canvas. You can change the size with something like: 2034 * plug canvas. You can change the size with something like:
1837 * 2035 *
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am
index a1d9215..c85af09 100644
--- a/libraries/ecore/src/lib/ecore_evas/Makefile.am
+++ b/libraries/ecore/src/lib/ecore_evas/Makefile.am
@@ -151,6 +151,7 @@ $(top_builddir)/src/lib/ecore/libecore.la \
151@EVAS_LIBS@ \ 151@EVAS_LIBS@ \
152@EINA_LIBS@ \ 152@EINA_LIBS@ \
153@EVIL_LIBS@ \ 153@EVIL_LIBS@ \
154@SHM_OPEN_LIBS@ \
154@WAYLAND_EGL_LIBS@ 155@WAYLAND_EGL_LIBS@
155 156
156libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ 157libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.in b/libraries/ecore/src/lib/ecore_evas/Makefile.in
index a269b75..b48f26f 100644
--- a/libraries/ecore/src/lib/ecore_evas/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_evas/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -216,6 +215,8 @@ EVAS_LIBS = @EVAS_LIBS@
216EVIL_CFLAGS = @EVIL_CFLAGS@ 215EVIL_CFLAGS = @EVIL_CFLAGS@
217EVIL_LIBS = @EVIL_LIBS@ 216EVIL_LIBS = @EVIL_LIBS@
218EXEEXT = @EXEEXT@ 217EXEEXT = @EXEEXT@
218EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
219EXOTIC_LIBS = @EXOTIC_LIBS@
219FGREP = @FGREP@ 220FGREP = @FGREP@
220GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 221GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
221GLIB_CFLAGS = @GLIB_CFLAGS@ 222GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -271,6 +272,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
271PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 272PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
272PIXMAN_LIBS = @PIXMAN_LIBS@ 273PIXMAN_LIBS = @PIXMAN_LIBS@
273PKG_CONFIG = @PKG_CONFIG@ 274PKG_CONFIG = @PKG_CONFIG@
275PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
276PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
274POSUB = @POSUB@ 277POSUB = @POSUB@
275RANLIB = @RANLIB@ 278RANLIB = @RANLIB@
276SCIM_CFLAGS = @SCIM_CFLAGS@ 279SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -281,6 +284,7 @@ SDL_LIBS = @SDL_LIBS@
281SED = @SED@ 284SED = @SED@
282SET_MAKE = @SET_MAKE@ 285SET_MAKE = @SET_MAKE@
283SHELL = @SHELL@ 286SHELL = @SHELL@
287SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
284SSL_CFLAGS = @SSL_CFLAGS@ 288SSL_CFLAGS = @SSL_CFLAGS@
285SSL_LIBS = @SSL_LIBS@ 289SSL_LIBS = @SSL_LIBS@
286STRIP = @STRIP@ 290STRIP = @STRIP@
@@ -605,6 +609,7 @@ $(top_builddir)/src/lib/ecore/libecore.la \
605@EVAS_LIBS@ \ 609@EVAS_LIBS@ \
606@EINA_LIBS@ \ 610@EINA_LIBS@ \
607@EVIL_LIBS@ \ 611@EVIL_LIBS@ \
612@SHM_OPEN_LIBS@ \
608@WAYLAND_EGL_LIBS@ 613@WAYLAND_EGL_LIBS@
609 614
610libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ 615libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c
index 2b04488..6ecd609 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c
@@ -509,24 +509,6 @@ _ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, co
509 509
510 return ee; 510 return ee;
511} 511}
512
513static Ecore_Evas *
514_ecore_evas_constructor_sdl16(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options)
515{
516 Ecore_Evas *ee;
517 unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0;
518 char *name = NULL;
519
520 _ecore_evas_parse_extra_options_str(extra_options, "name=", &name);
521 _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen);
522 _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface);
523 _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha);
524
525 ee = ecore_evas_sdl16_new(name, w, h, fullscreen, hwsurface, noframe, alpha);
526 free(name);
527
528 return ee;
529}
530#endif 512#endif
531 513
532#ifdef BUILD_ECORE_EVAS_OPENGL_SDL 514#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
@@ -606,12 +588,13 @@ static Ecore_Evas *
606_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options) 588_ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options)
607{ 589{
608 char *disp_name = NULL; 590 char *disp_name = NULL;
609 unsigned int frame = 0; 591 unsigned int frame = 0, parent = 0;
610 Ecore_Evas *ee; 592 Ecore_Evas *ee;
611 593
612 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); 594 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
613 _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); 595 _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
614 ee = ecore_evas_wayland_shm_new(disp_name, x, y, w, h, frame); 596 _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
597 ee = ecore_evas_wayland_shm_new(disp_name, parent, x, y, w, h, frame);
615 free(disp_name); 598 free(disp_name);
616 599
617 return ee; 600 return ee;
@@ -623,12 +606,13 @@ static Ecore_Evas *
623_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options) 606_ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options)
624{ 607{
625 char *disp_name = NULL; 608 char *disp_name = NULL;
626 unsigned int frame = 0; 609 unsigned int frame = 0, parent = 0;
627 Ecore_Evas *ee; 610 Ecore_Evas *ee;
628 611
629 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); 612 _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name);
630 _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); 613 _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame);
631 ee = ecore_evas_wayland_egl_new(disp_name, x, y, w, h, frame); 614 _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent);
615 ee = ecore_evas_wayland_egl_new(disp_name, parent, x, y, w, h, frame);
632 free(disp_name); 616 free(disp_name);
633 617
634 return ee; 618 return ee;
@@ -788,7 +772,6 @@ static const struct ecore_evas_engine _engines[] = {
788 772
789#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL 773#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
790 {"sdl", _ecore_evas_constructor_sdl}, 774 {"sdl", _ecore_evas_constructor_sdl},
791 {"software_16_sdl", _ecore_evas_constructor_sdl16},
792#endif 775#endif
793 776
794 /* independent */ 777 /* independent */
@@ -944,7 +927,7 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
944#define IFE return;} 927#define IFE return;}
945 928
946EAPI void 929EAPI void
947ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 930ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
948{ 931{
949 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 932 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
950 { 933 {
@@ -958,7 +941,7 @@ ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
958} 941}
959 942
960EAPI void 943EAPI void
961ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 944ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
962{ 945{
963 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 946 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
964 { 947 {
@@ -972,7 +955,7 @@ ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
972} 955}
973 956
974EAPI void 957EAPI void
975ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 958ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
976{ 959{
977 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 960 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
978 { 961 {
@@ -986,7 +969,7 @@ ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
986} 969}
987 970
988EAPI void 971EAPI void
989ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 972ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
990{ 973{
991 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 974 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
992 { 975 {
@@ -1000,7 +983,7 @@ ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1000} 983}
1001 984
1002EAPI void 985EAPI void
1003ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 986ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1004{ 987{
1005 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 988 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1006 { 989 {
@@ -1014,7 +997,7 @@ ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas
1014} 997}
1015 998
1016EAPI void 999EAPI void
1017ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1000ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1018{ 1001{
1019 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1002 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1020 { 1003 {
@@ -1028,7 +1011,7 @@ ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1028} 1011}
1029 1012
1030EAPI void 1013EAPI void
1031ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1014ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1032{ 1015{
1033 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1016 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1034 { 1017 {
@@ -1042,7 +1025,7 @@ ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1042} 1025}
1043 1026
1044EAPI void 1027EAPI void
1045ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1028ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1046{ 1029{
1047 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1030 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1048 { 1031 {
@@ -1056,7 +1039,7 @@ ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1056} 1039}
1057 1040
1058EAPI void 1041EAPI void
1059ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1042ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1060{ 1043{
1061 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1044 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1062 { 1045 {
@@ -1070,7 +1053,7 @@ ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1070} 1053}
1071 1054
1072EAPI void 1055EAPI void
1073ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1056ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1074{ 1057{
1075 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1058 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1076 { 1059 {
@@ -1084,7 +1067,7 @@ ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1084} 1067}
1085 1068
1086EAPI void 1069EAPI void
1087ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1070ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1088{ 1071{
1089 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1072 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1090 { 1073 {
@@ -1098,7 +1081,7 @@ ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1098} 1081}
1099 1082
1100EAPI void 1083EAPI void
1101ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1084ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1102{ 1085{
1103 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1086 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1104 { 1087 {
@@ -1112,7 +1095,7 @@ ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1112} 1095}
1113 1096
1114EAPI void 1097EAPI void
1115ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1098ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1116{ 1099{
1117 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1100 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1118 { 1101 {
@@ -1126,7 +1109,7 @@ ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)
1126} 1109}
1127 1110
1128EAPI void 1111EAPI void
1129ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1112ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1130{ 1113{
1131 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1114 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1132 { 1115 {
@@ -1140,7 +1123,7 @@ ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee
1140} 1123}
1141 1124
1142EAPI void 1125EAPI void
1143ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1126ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1144{ 1127{
1145 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 1128 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1146 { 1129 {
@@ -1151,6 +1134,18 @@ ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
1151 ee->func.fn_pre_free = func; 1134 ee->func.fn_pre_free = func;
1152} 1135}
1153 1136
1137EAPI void
1138ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1139{
1140 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1141 {
1142 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1143 "ecore_evas_callback_state_change_set");
1144 return;
1145 }
1146 ee->func.fn_state_change = func;
1147}
1148
1154/** 1149/**
1155 * Get an Ecore_Evas's Evas 1150 * Get an Ecore_Evas's Evas
1156 * @param ee The Ecore_Evas whose Evas you wish to get 1151 * @param ee The Ecore_Evas whose Evas you wish to get
@@ -2120,6 +2115,162 @@ ecore_evas_sticky_get(const Ecore_Evas *ee)
2120} 2115}
2121 2116
2122EAPI void 2117EAPI void
2118ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group)
2119{
2120 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2121 {
2122 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2123 "XXX");
2124 return;
2125 }
2126
2127 IFC(ee, fn_window_group_set) (ee, ee_group);
2128 IFE;
2129}
2130
2131EAPI const Ecore_Evas *
2132ecore_evas_window_group_get(const Ecore_Evas *ee)
2133{
2134 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2135 {
2136 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2137 "XXX");
2138 return EINA_FALSE;
2139 }
2140 return ee->prop.group_ee;
2141}
2142
2143EAPI void
2144ecore_evas_aspect_set(Ecore_Evas *ee, double aspect)
2145{
2146 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2147 {
2148 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2149 "XXX");
2150 return;
2151 }
2152
2153 IFC(ee, fn_aspect_set) (ee, aspect);
2154 IFE;
2155}
2156
2157EAPI double
2158ecore_evas_aspect_get(const Ecore_Evas *ee)
2159{
2160 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2161 {
2162 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2163 "XXX");
2164 return EINA_FALSE;
2165 }
2166 return ee->prop.aspect;
2167}
2168
2169EAPI void
2170ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent)
2171{
2172 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2173 {
2174 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2175 "XXX");
2176 return;
2177 }
2178
2179 IFC(ee, fn_urgent_set) (ee, urgent);
2180 IFE;
2181}
2182
2183EAPI Eina_Bool
2184ecore_evas_urgent_get(const Ecore_Evas *ee)
2185{
2186 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2187 {
2188 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2189 "XXX");
2190 return EINA_FALSE;
2191 }
2192 return ee->prop.urgent ? EINA_TRUE : EINA_FALSE;
2193}
2194
2195EAPI void
2196ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal)
2197{
2198 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2199 {
2200 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2201 "XXX");
2202 return;
2203 }
2204
2205 IFC(ee, fn_modal_set) (ee, modal);
2206 IFE;
2207}
2208
2209EAPI Eina_Bool
2210ecore_evas_modal_get(const Ecore_Evas *ee)
2211{
2212 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2213 {
2214 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2215 "XXX");
2216 return EINA_FALSE;
2217 }
2218 return ee->prop.modal ? EINA_TRUE : EINA_FALSE;
2219}
2220
2221EAPI void
2222ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand)
2223{
2224 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2225 {
2226 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2227 "XXX");
2228 return;
2229 }
2230
2231 IFC(ee, fn_demands_attention_set) (ee, demand);
2232 IFE;
2233}
2234
2235EAPI Eina_Bool
2236ecore_evas_demand_attention_get(const Ecore_Evas *ee)
2237{
2238 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2239 {
2240 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2241 "XXX");
2242 return EINA_FALSE;
2243 }
2244 return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE;
2245}
2246
2247EAPI void
2248ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip)
2249{
2250 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2251 {
2252 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2253 "XXX");
2254 return;
2255 }
2256
2257 IFC(ee, fn_focus_skip_set) (ee, skip);
2258 IFE;
2259}
2260
2261EAPI Eina_Bool
2262ecore_evas_focus_skip_get(const Ecore_Evas *ee)
2263{
2264 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
2265 {
2266 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
2267 "XXX");
2268 return EINA_FALSE;
2269 }
2270 return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE;
2271}
2272
2273EAPI void
2123ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) 2274ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore)
2124{ 2275{
2125 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) 2276 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
@@ -2695,35 +2846,10 @@ ecore_evas_wayland_resize(Ecore_Evas *ee, int location)
2695 } 2846 }
2696} 2847}
2697 2848
2698EAPI void
2699ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
2700{
2701 if ((!ee) || (!source)) return;
2702 if (!ee->engine.wl.surface) return;
2703
2704 if (!strcmp(ee->driver, "wayland_shm"))
2705 {
2706#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
2707 _ecore_evas_wayland_shm_drag_start(ee, drag_ee, source);
2708#endif
2709 }
2710 else if (!strcmp(ee->driver, "wayland_egl"))
2711 {
2712#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
2713 _ecore_evas_wayland_egl_drag_start(ee, drag_ee, source);
2714#endif
2715 }
2716}
2717#else 2849#else
2718EAPI void 2850EAPI void
2719ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__) 2851ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__)
2720{ 2852{
2721 2853
2722} 2854}
2723
2724EAPI void
2725ecore_evas_wayland_drag_start(Ecore_Evas *ee __UNUSED__, Ecore_Evas *drag_ee __UNUSED__, void *source __UNUSED__)
2726{
2727
2728}
2729#endif 2855#endif
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c
index 3f82efb..4c81db7 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -513,6 +513,13 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
513 _ecore_evas_buffer_alpha_set, 513 _ecore_evas_buffer_alpha_set,
514 NULL, //transparent 514 NULL, //transparent
515 515
516 NULL,
517 NULL,
518 NULL,
519 NULL,
520 NULL,
521 NULL,
522
516 _ecore_evas_buffer_render, 523 _ecore_evas_buffer_render,
517 NULL // screen_geometry_get 524 NULL // screen_geometry_get
518}; 525};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c
index 36d41f8..0947b11 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c
@@ -9,7 +9,7 @@
9 9
10#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA 10#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA
11#include <Ecore_Cocoa.h> 11#include <Ecore_Cocoa.h>
12#include <Evas_Engine_Gl_Cocoa.h> 12#include <Evas_Engine_GL_Cocoa.h>
13#endif 13#endif
14 14
15#include "ecore_evas_private.h" 15#include "ecore_evas_private.h"
@@ -463,6 +463,14 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
463 NULL, 463 NULL,
464 NULL, 464 NULL,
465 NULL, //transparent 465 NULL, //transparent
466
467 NULL,
468 NULL,
469 NULL,
470 NULL,
471 NULL,
472 NULL,
473
466 NULL, // render 474 NULL, // render
467 NULL 475 NULL
468 }; 476 };
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c
index 457f9e9..ed24355 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c
@@ -490,6 +490,13 @@ static Ecore_Evas_Engine_Func _ecore_directfb_engine_func =
490 NULL, /* alpha */ 490 NULL, /* alpha */
491 NULL, //transparent 491 NULL, //transparent
492 492
493 NULL,
494 NULL,
495 NULL,
496 NULL,
497 NULL,
498 NULL,
499
493 NULL, // render 500 NULL, // render
494 NULL // screen_geometry_get 501 NULL // screen_geometry_get
495}; 502};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c
index eccf98b..ec02472 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c
@@ -683,6 +683,14 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
683 _ecore_evas_ews_ignore_events_set, 683 _ecore_evas_ews_ignore_events_set,
684 _ecore_evas_ews_alpha_set, 684 _ecore_evas_ews_alpha_set,
685 _ecore_evas_ews_transparent_set, 685 _ecore_evas_ews_transparent_set,
686
687 NULL,
688 NULL,
689 NULL,
690 NULL,
691 NULL,
692 NULL,
693
686 _ecore_evas_ews_render, 694 _ecore_evas_ews_render,
687 _ecore_evas_ews_screen_geometry_get 695 _ecore_evas_ews_screen_geometry_get
688}; 696};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c
index e46ab4a..a7ea4c3 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c
@@ -2,35 +2,37 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <stdio.h>
5#include <stdlib.h> 6#include <stdlib.h>
7#include <sys/types.h>
8#include <unistd.h>
9#include <math.h>
10#include <time.h>
11#ifdef HAVE_SYS_MMAN_H
12# include <sys/mman.h>
13#endif
14#include <sys/stat.h>
15#include <fcntl.h>
16#include <string.h>
17#include <sys/file.h>
6#include <unistd.h> 18#include <unistd.h>
7 19
8#include <Ecore.h> 20#include <Ecore.h>
9#include "ecore_private.h" 21#include "ecore_private.h"
10#include <Ecore_Input.h> 22#include <Ecore_Input.h>
11 23
12#ifdef BUILD_ECORE_IPC 24#ifdef BUILD_ECORE_EVAS_EXTN
13# ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER 25
14# define EXTN_ENABLED 1 26#include <Ecore_Ipc.h>
15# endif 27
16#endif 28#endif
17 29
18#include "ecore_evas_private.h" 30#include "ecore_evas_private.h"
19#include "Ecore_Evas.h" 31#include "Ecore_Evas.h"
20#ifdef EXTN_ENABLED
21#include "Ecore_Ipc.h"
22 32
23#include <stdio.h> 33
24#include <stdlib.h> 34#ifdef BUILD_ECORE_EVAS_EXTN
25#include <sys/types.h> 35
26#include <unistd.h>
27#include <math.h>
28#include <time.h>
29#include <sys/mman.h>
30#include <sys/stat.h>
31#include <fcntl.h>
32#include <string.h>
33#include <sys/file.h>
34 36
35typedef struct _Shmfile Shmfile; 37typedef struct _Shmfile Shmfile;
36 38
@@ -1102,6 +1104,13 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
1102 NULL, 1104 NULL,
1103 NULL, //transparent 1105 NULL, //transparent
1104 1106
1107 NULL,
1108 NULL,
1109 NULL,
1110 NULL,
1111 NULL,
1112 NULL,
1113
1105 NULL, // render 1114 NULL, // render
1106 NULL // screen_geometry_get 1115 NULL // screen_geometry_get
1107}; 1116};
@@ -1286,12 +1295,13 @@ void
1286_ecore_evas_extn_shutdown(void) 1295_ecore_evas_extn_shutdown(void)
1287{ 1296{
1288} 1297}
1289#endif 1298
1299#endif /* BUILD_ECORE_EVAS_EXTN */
1290 1300
1291EAPI Evas_Object * 1301EAPI Evas_Object *
1292ecore_evas_extn_plug_new(Ecore_Evas *ee_target) 1302ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
1293{ 1303{
1294#ifdef EXTN_ENABLED 1304#ifdef BUILD_ECORE_EVAS_EXTN
1295 Evas_Object *o; 1305 Evas_Object *o;
1296 Ecore_Evas *ee; 1306 Ecore_Evas *ee;
1297 int w = 1, h = 1; 1307 int w = 1, h = 1;
@@ -1408,7 +1418,7 @@ ecore_evas_extn_plug_new(Ecore_Evas *ee_target)
1408EAPI Eina_Bool 1418EAPI Eina_Bool
1409ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) 1419ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
1410{ 1420{
1411#ifdef EXTN_ENABLED 1421#ifdef BUILD_ECORE_EVAS_EXTN
1412 Extn *extn; 1422 Extn *extn;
1413 Ecore_Evas *ee = NULL; 1423 Ecore_Evas *ee = NULL;
1414 1424
@@ -1459,7 +1469,7 @@ ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum,
1459EAPI void 1469EAPI void
1460ecore_evas_extn_plug_object_data_lock(Evas_Object *obj) 1470ecore_evas_extn_plug_object_data_lock(Evas_Object *obj)
1461{ 1471{
1462#ifdef EXTN_ENABLED 1472#ifdef BUILD_ECORE_EVAS_EXTN
1463 Ecore_Evas *ee; 1473 Ecore_Evas *ee;
1464 1474
1465 ee = ecore_evas_object_ecore_evas_get(obj); 1475 ee = ecore_evas_object_ecore_evas_get(obj);
@@ -1471,7 +1481,7 @@ ecore_evas_extn_plug_object_data_lock(Evas_Object *obj)
1471EAPI void 1481EAPI void
1472ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj) 1482ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj)
1473{ 1483{
1474#ifdef EXTN_ENABLED 1484#ifdef BUILD_ECORE_EVAS_EXTN
1475 Ecore_Evas *ee; 1485 Ecore_Evas *ee;
1476 1486
1477 ee = ecore_evas_object_ecore_evas_get(obj); 1487 ee = ecore_evas_object_ecore_evas_get(obj);
@@ -1480,7 +1490,7 @@ ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj)
1480#endif 1490#endif
1481} 1491}
1482 1492
1483#ifdef EXTN_ENABLED 1493#ifdef BUILD_ECORE_EVAS_EXTN
1484static void 1494static void
1485_ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h) 1495_ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h)
1486{ 1496{
@@ -1830,7 +1840,7 @@ _ipc_client_data(void *data, int type __UNUSED__, void *event)
1830 1840
1831#define STRGET(val) \ 1841#define STRGET(val) \
1832 do { \ 1842 do { \
1833 if ((ipc->val) && (ipc->val < (char *)(e->size - 1))) \ 1843 if ((ipc->val) && (ipc->val < (char *)(long)(e->size - 1))) \
1834 ipc->val = ((char *)ipc) + (long)ipc->val; \ 1844 ipc->val = ((char *)ipc) + (long)ipc->val; \
1835 else \ 1845 else \
1836 ipc->val = NULL; \ 1846 ipc->val = NULL; \
@@ -1978,6 +1988,13 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func =
1978 _ecore_evas_extn_socket_alpha_set, 1988 _ecore_evas_extn_socket_alpha_set,
1979 NULL, //transparent 1989 NULL, //transparent
1980 1990
1991 NULL,
1992 NULL,
1993 NULL,
1994 NULL,
1995 NULL,
1996 NULL,
1997
1981 _ecore_evas_extn_socket_render, // render 1998 _ecore_evas_extn_socket_render, // render
1982 NULL // screen_geometry_get 1999 NULL // screen_geometry_get
1983}; 2000};
@@ -1987,7 +2004,7 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func =
1987EAPI Ecore_Evas * 2004EAPI Ecore_Evas *
1988ecore_evas_extn_socket_new(int w, int h) 2005ecore_evas_extn_socket_new(int w, int h)
1989{ 2006{
1990#ifdef EXTN_ENABLED 2007#ifdef BUILD_ECORE_EVAS_EXTN
1991 Evas_Engine_Info_Buffer *einfo; 2008 Evas_Engine_Info_Buffer *einfo;
1992 Ecore_Evas *ee; 2009 Ecore_Evas *ee;
1993 int rmethod; 2010 int rmethod;
@@ -2077,7 +2094,7 @@ ecore_evas_extn_socket_new(int w, int h)
2077EAPI Eina_Bool 2094EAPI Eina_Bool
2078ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys) 2095ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys)
2079{ 2096{
2080#ifdef EXTN_ENABLED 2097#ifdef BUILD_ECORE_EVAS_EXTN
2081 Extn *extn; 2098 Extn *extn;
2082 2099
2083 extn = calloc(1, sizeof(Extn)); 2100 extn = calloc(1, sizeof(Extn));
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c
index 74caada..11e2ffd 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c
@@ -541,6 +541,13 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
541 NULL, 541 NULL,
542 NULL, //transparent 542 NULL, //transparent
543 543
544 NULL,
545 NULL,
546 NULL,
547 NULL,
548 NULL,
549 NULL,
550
544 NULL, // render 551 NULL, // render
545 NULL // screen_geometry_get 552 NULL // screen_geometry_get
546}; 553};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h
index 9a88a7a..e31653a 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h
@@ -123,6 +123,7 @@ extern int _ecore_evas_log_dom;
123#define IDLE_FLUSH_TIME 0.5 123#define IDLE_FLUSH_TIME 0.5
124#ifndef _ECORE_EVAS_H 124#ifndef _ECORE_EVAS_H
125typedef struct _Ecore_Evas Ecore_Evas; 125typedef struct _Ecore_Evas Ecore_Evas;
126typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee);
126#endif 127#endif
127 128
128typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; 129typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine;
@@ -131,20 +132,20 @@ typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func;
131struct _Ecore_Evas_Engine_Func 132struct _Ecore_Evas_Engine_Func
132{ 133{
133 void (*fn_free) (Ecore_Evas *ee); 134 void (*fn_free) (Ecore_Evas *ee);
134 void (*fn_callback_resize_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 135 void (*fn_callback_resize_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
135 void (*fn_callback_move_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 136 void (*fn_callback_move_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
136 void (*fn_callback_show_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 137 void (*fn_callback_show_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
137 void (*fn_callback_hide_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 138 void (*fn_callback_hide_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
138 void (*fn_callback_delete_request_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 139 void (*fn_callback_delete_request_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
139 void (*fn_callback_destroy_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 140 void (*fn_callback_destroy_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
140 void (*fn_callback_focus_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 141 void (*fn_callback_focus_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
141 void (*fn_callback_focus_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 142 void (*fn_callback_focus_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
142 void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 143 void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
143 void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 144 void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
144 void (*fn_callback_sticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 145 void (*fn_callback_sticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
145 void (*fn_callback_unsticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 146 void (*fn_callback_unsticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
146 void (*fn_callback_pre_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 147 void (*fn_callback_pre_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
147 void (*fn_callback_post_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); 148 void (*fn_callback_post_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
148 void (*fn_move) (Ecore_Evas *ee, int x, int y); 149 void (*fn_move) (Ecore_Evas *ee, int x, int y);
149 void (*fn_managed_move) (Ecore_Evas *ee, int x, int y); 150 void (*fn_managed_move) (Ecore_Evas *ee, int x, int y);
150 void (*fn_resize) (Ecore_Evas *ee, int w, int h); 151 void (*fn_resize) (Ecore_Evas *ee, int w, int h);
@@ -177,6 +178,13 @@ struct _Ecore_Evas_Engine_Func
177 void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); 178 void (*fn_alpha_set) (Ecore_Evas *ee, int alpha);
178 void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); 179 void (*fn_transparent_set) (Ecore_Evas *ee, int transparent);
179 180
181 void (*fn_window_group_set) (Ecore_Evas *ee, const Ecore_Evas *ee_group);
182 void (*fn_aspect_set) (Ecore_Evas *ee, double aspect);
183 void (*fn_urgent_set) (Ecore_Evas *ee, int urgent);
184 void (*fn_modal_set) (Ecore_Evas *ee, int modal);
185 void (*fn_demands_attention_set) (Ecore_Evas *ee, int demand);
186 void (*fn_focus_skip_set) (Ecore_Evas *ee, int skip);
187
180 int (*fn_render) (Ecore_Evas *ee); 188 int (*fn_render) (Ecore_Evas *ee);
181 void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); 189 void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
182}; 190};
@@ -271,11 +279,13 @@ struct _Ecore_Evas_Engine
271#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL) 279#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL)
272 struct 280 struct
273 { 281 {
282 Ecore_Wl_Window *parent, *win;
274 Evas_Object *frame; 283 Evas_Object *frame;
275 284
276 struct wl_shell_surface *shell_surface; 285# if defined(BUILD_ECORE_EVAS_WAYLAND_SHM)
277 struct wl_surface *surface;
278 struct wl_buffer *buffer; 286 struct wl_buffer *buffer;
287# endif
288
279 } wl; 289 } wl;
280#endif 290#endif
281 291
@@ -333,6 +343,9 @@ struct _Ecore_Evas
333 int layer; 343 int layer;
334 Ecore_Window window; 344 Ecore_Window window;
335 unsigned char avoid_damage; 345 unsigned char avoid_damage;
346 Ecore_Evas *group_ee;
347 Ecore_Window group_ee_win;
348 double aspect;
336 char focused : 1; 349 char focused : 1;
337 char iconified : 1; 350 char iconified : 1;
338 char borderless : 1; 351 char borderless : 1;
@@ -343,7 +356,12 @@ struct _Ecore_Evas
343 char sticky : 1; 356 char sticky : 1;
344 char request_pos : 1; 357 char request_pos : 1;
345 char draw_frame : 1; 358 char draw_frame : 1;
346 } prop; 359 char hwsurface : 1;
360 char urgent : 1;
361 char modal : 1;
362 char demand_attention : 1;
363 char focus_skip : 1;
364 } prop;
347 365
348 struct { 366 struct {
349 void (*fn_resize) (Ecore_Evas *ee); 367 void (*fn_resize) (Ecore_Evas *ee);
@@ -361,6 +379,7 @@ struct _Ecore_Evas
361 void (*fn_pre_render) (Ecore_Evas *ee); 379 void (*fn_pre_render) (Ecore_Evas *ee);
362 void (*fn_post_render) (Ecore_Evas *ee); 380 void (*fn_post_render) (Ecore_Evas *ee);
363 void (*fn_pre_free) (Ecore_Evas *ee); 381 void (*fn_pre_free) (Ecore_Evas *ee);
382 void (*fn_state_change) (Ecore_Evas *ee);
364 } func; 383 } func;
365 384
366 Ecore_Evas_Engine engine; 385 Ecore_Evas_Engine engine;
@@ -406,11 +425,15 @@ int _ecore_evas_ews_shutdown(void);
406#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM 425#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
407void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location); 426void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location);
408void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); 427void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
428void _ecore_evas_wayland_shm_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y);
429void _ecore_evas_wayland_shm_type_set(Ecore_Evas *ee, int type);
409#endif 430#endif
410 431
411#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL 432#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
412void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location); 433void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location);
413void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); 434void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source);
435void _ecore_evas_wayland_egl_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y);
436void _ecore_evas_wayland_egl_type_set(Ecore_Evas *ee, int type);
414#endif 437#endif
415 438
416void _ecore_evas_fps_debug_init(void); 439void _ecore_evas_fps_debug_init(void);
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c
index be130ad..038654a 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c
@@ -233,7 +233,7 @@ _ecore_evas_psl1ght_free(Ecore_Evas *ee)
233} 233}
234 234
235static void 235static void
236_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 236_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
237{ 237{
238 ee->func.fn_delete_request = func; 238 ee->func.fn_delete_request = func;
239} 239}
@@ -396,6 +396,13 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
396 NULL, 396 NULL,
397 NULL, //transparent 397 NULL, //transparent
398 398
399 NULL,
400 NULL,
401 NULL,
402 NULL,
403 NULL,
404 NULL,
405
399 NULL, // render 406 NULL, // render
400 _ecore_evas_screen_geometry_get // screen_geometry_get 407 _ecore_evas_screen_geometry_get // screen_geometry_get
401}; 408};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c
index a3be2c7..b246a26 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c
@@ -7,9 +7,6 @@
7#include <Ecore_Input_Evas.h> 7#include <Ecore_Input_Evas.h>
8#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) 8#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
9# include <Ecore_Sdl.h> 9# include <Ecore_Sdl.h>
10# ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
11# include <Evas_Engine_SDL.h>
12# endif
13# ifdef BUILD_ECORE_EVAS_OPENGL_SDL 10# ifdef BUILD_ECORE_EVAS_OPENGL_SDL
14# include <Evas_Engine_GL_SDL.h> 11# include <Evas_Engine_GL_SDL.h>
15# endif 12# endif
@@ -18,10 +15,17 @@
18#include <stdlib.h> 15#include <stdlib.h>
19#include <string.h> 16#include <string.h>
20 17
18#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
19#include <SDL/SDL.h>
20#endif
21
21#include "ecore_evas_private.h" 22#include "ecore_evas_private.h"
22#include "Ecore_Evas.h" 23#include "Ecore_Evas.h"
23 24
24// fixme: 1 sdl window only at a time? seems wrong 25/**
26 ** SDL only handle one window at a time. That's by definition, there is nothing wrong here.
27 **
28 **/
25 29
26#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) 30#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL)
27 31
@@ -45,6 +49,13 @@ _ecore_evas_sdl_match(void)
45 return sdl_ee; 49 return sdl_ee;
46} 50}
47 51
52static void *
53_ecore_evas_sdl_switch_buffer(void *data, void *dest __UNUSED__)
54{
55 SDL_Flip(data);
56 return ((SDL_Surface*)data)->pixels;
57}
58
48static Eina_Bool 59static Eina_Bool
49_ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) 60_ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
50{ 61{
@@ -80,12 +91,54 @@ _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, v
80{ 91{
81 Ecore_Sdl_Event_Video_Resize *e; 92 Ecore_Sdl_Event_Video_Resize *e;
82 Ecore_Evas *ee; 93 Ecore_Evas *ee;
94 int rmethod;
83 95
84 e = event; 96 e = event;
85 ee = _ecore_evas_sdl_match(); 97 ee = _ecore_evas_sdl_match();
86 98
87 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ 99 if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
100
101 rmethod = evas_output_method_get(ee->evas);
102 if (rmethod == evas_render_method_lookup("buffer"))
103 {
104 Evas_Engine_Info_Buffer *einfo;
105
106 einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
107 if (einfo)
108 {
109 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
110 einfo->info.switch_data = SDL_SetVideoMode(e->w, e->h, 32,
111 (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
112 | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0)
113 | (ee->alpha ? SDL_SRCALPHA : 0)
114 | SDL_DOUBLEBUF);
115 if (!einfo->info.switch_data)
116 {
117 return EINA_FALSE;
118 }
119
120 SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
121 SDL_FillRect(einfo->info.switch_data, NULL, 0);
122
123 einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
124 einfo->info.dest_buffer_row_bytes = e->w * sizeof (int);
125 einfo->info.use_color_key = 0;
126 einfo->info.alpha_threshold = 0;
127 einfo->info.func.new_update_region = NULL;
128 einfo->info.func.free_update_region = NULL;
129 einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
130 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
131 {
132 return EINA_FALSE;
133 }
134 }
135 }
136
137 ee->w = e->w;
138 ee->h = e->h;
139
88 evas_output_size_set(ee->evas, e->w, e->h); 140 evas_output_size_set(ee->evas, e->w, e->h);
141 evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h);
89 142
90 return ECORE_CALLBACK_PASS_ON; 143 return ECORE_CALLBACK_PASS_ON;
91} 144}
@@ -191,7 +244,7 @@ _ecore_evas_sdl_shutdown(void)
191 _ecore_evas_init_count--; 244 _ecore_evas_init_count--;
192 if (_ecore_evas_init_count == 0) 245 if (_ecore_evas_init_count == 0)
193 { 246 {
194 int i; 247 unsigned int i;
195 248
196 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) 249 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
197 ecore_event_handler_del(ecore_evas_event_handlers[i]); 250 ecore_event_handler_del(ecore_evas_event_handlers[i]);
@@ -219,10 +272,48 @@ _ecore_evas_sdl_free(Ecore_Evas *ee)
219static void 272static void
220_ecore_evas_resize(Ecore_Evas *ee, int w, int h) 273_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
221{ 274{
275 int rmethod;
276
222 if ((w == ee->w) && (h == ee->h)) return; 277 if ((w == ee->w) && (h == ee->h)) return;
223 ee->w = w; 278 ee->w = w;
224 ee->h = h; 279 ee->h = h;
225 280
281 rmethod = evas_output_method_get(ee->evas);
282 if (rmethod == evas_render_method_lookup("buffer"))
283 {
284 Evas_Engine_Info_Buffer *einfo;
285
286 einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
287 if (einfo)
288 {
289 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
290 einfo->info.switch_data = SDL_SetVideoMode(w, h, 32,
291 (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
292 | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0)
293 | (ee->alpha ? SDL_SRCALPHA : 0)
294 | SDL_DOUBLEBUF);
295 if (!einfo->info.switch_data)
296 {
297 return ;
298 }
299
300 SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
301 SDL_FillRect(einfo->info.switch_data, NULL, 0);
302
303 einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
304 einfo->info.dest_buffer_row_bytes = w * sizeof (int);
305 einfo->info.use_color_key = 0;
306 einfo->info.alpha_threshold = 0;
307 einfo->info.func.new_update_region = NULL;
308 einfo->info.func.free_update_region = NULL;
309 einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
310 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
311 {
312 return ;
313 }
314 }
315 }
316
226 evas_output_size_set(ee->evas, ee->w, ee->h); 317 evas_output_size_set(ee->evas, ee->w, ee->h);
227 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 318 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
228 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 319 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
@@ -342,6 +433,13 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
342 NULL, 433 NULL,
343 NULL, //transparent 434 NULL, //transparent
344 435
436 NULL,
437 NULL,
438 NULL,
439 NULL,
440 NULL,
441 NULL,
442
345 NULL, // render 443 NULL, // render
346 NULL // screen_geometry_get 444 NULL // screen_geometry_get
347}; 445};
@@ -349,7 +447,6 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
349static Ecore_Evas* 447static Ecore_Evas*
350_ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) 448_ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha)
351{ 449{
352 void *einfo;
353 Ecore_Evas *ee; 450 Ecore_Evas *ee;
354 451
355 if (!name) 452 if (!name)
@@ -382,6 +479,8 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
382 ee->prop.withdrawn = 0; 479 ee->prop.withdrawn = 0;
383 ee->prop.sticky = 0; 480 ee->prop.sticky = 0;
384 ee->prop.window = 0; 481 ee->prop.window = 0;
482 ee->alpha = alpha;
483 ee->prop.hwsurface = hwsurface;
385 484
386 /* init evas here */ 485 /* init evas here */
387 ee->evas = evas_new(); 486 ee->evas = evas_new();
@@ -391,19 +490,47 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
391 evas_output_size_set(ee->evas, w, h); 490 evas_output_size_set(ee->evas, w, h);
392 evas_output_viewport_set(ee->evas, 0, 0, w, h); 491 evas_output_viewport_set(ee->evas, 0, 0, w, h);
393 492
394 if (rmethod == evas_render_method_lookup("software_sdl") || 493 if (rmethod == evas_render_method_lookup("buffer"))
395 rmethod == evas_render_method_lookup("software_16_sdl") )
396 { 494 {
397#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL 495 Evas_Engine_Info_Buffer *einfo;
398 einfo = evas_engine_info_get(ee->evas); 496
497 einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas);
399 if (einfo) 498 if (einfo)
400 { 499 {
401 ((Evas_Engine_Info_SDL *)einfo)->info.rotation = 0; 500 SDL_Init(SDL_INIT_NOPARACHUTE);
402 ((Evas_Engine_Info_SDL *)einfo)->info.fullscreen = fullscreen; 501
403 ((Evas_Engine_Info_SDL *)einfo)->info.hwsurface = hwsurface; 502 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
404 ((Evas_Engine_Info_SDL *)einfo)->info.noframe = noframe; 503 {
405 ((Evas_Engine_Info_SDL *)einfo)->info.alpha = alpha; 504 ERR("SDL_Init failed with %s", SDL_GetError());
406 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 505 SDL_Quit();
506 return NULL;
507 }
508
509 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
510 einfo->info.switch_data = SDL_SetVideoMode(w, h, 32,
511 (hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE)
512 | (fullscreen ? SDL_FULLSCREEN : 0)
513 | (noframe ? SDL_NOFRAME : 0)
514 | (alpha ? SDL_SRCALPHA : 0)
515 | SDL_DOUBLEBUF);
516 if (!einfo->info.switch_data)
517 {
518 ERR("SDL_SetVideoMode failed !");
519 ecore_evas_free(ee);
520 return NULL;
521 }
522
523 SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0);
524 SDL_FillRect(einfo->info.switch_data, NULL, 0);
525
526 einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels;
527 einfo->info.dest_buffer_row_bytes = w * sizeof (int);
528 einfo->info.use_color_key = 0;
529 einfo->info.alpha_threshold = 0;
530 einfo->info.func.new_update_region = NULL;
531 einfo->info.func.free_update_region = NULL;
532 einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer;
533 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo))
407 { 534 {
408 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); 535 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
409 ecore_evas_free(ee); 536 ecore_evas_free(ee);
@@ -416,16 +543,17 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
416 ecore_evas_free(ee); 543 ecore_evas_free(ee);
417 return NULL; 544 return NULL;
418 } 545 }
419#endif
420 } 546 }
421 else if (rmethod == evas_render_method_lookup("gl_sdl")) 547 else if (rmethod == evas_render_method_lookup("gl_sdl"))
422 { 548 {
423#ifdef BUILD_ECORE_EVAS_OPENGL_SDL 549#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
424 einfo = evas_engine_info_get(ee->evas); 550 Evas_Engine_Info_GL_SDL *einfo;
551
552 einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas);
425 if (einfo) 553 if (einfo)
426 { 554 {
427 ((Evas_Engine_Info_GL_SDL *)einfo)->flags.fullscreen = fullscreen; 555 einfo->flags.fullscreen = fullscreen;
428 ((Evas_Engine_Info_GL_SDL *)einfo)->flags.noframe = noframe; 556 einfo->flags.noframe = noframe;
429 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 557 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
430 { 558 {
431 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); 559 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
@@ -464,7 +592,7 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
464 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, 592 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
465 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); 593 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
466 594
467 SDL_ShowCursor(SDL_DISABLE); 595 SDL_ShowCursor(SDL_ENABLE);
468 596
469 ee->engine.func->fn_render = _ecore_evas_sdl_render; 597 ee->engine.func->fn_render = _ecore_evas_sdl_render;
470 _ecore_evas_register(ee); 598 _ecore_evas_register(ee);
@@ -481,11 +609,10 @@ ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface
481 Ecore_Evas *ee; 609 Ecore_Evas *ee;
482 int rmethod; 610 int rmethod;
483 611
484 rmethod = evas_render_method_lookup("software_sdl"); 612 rmethod = evas_render_method_lookup("buffer");
485 if (!rmethod) return NULL; 613 if (!rmethod) return NULL;
486 614
487 ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); 615 ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha);
488 ee->driver = "sdl";
489 return ee; 616 return ee;
490} 617}
491#else 618#else
@@ -497,28 +624,12 @@ ecore_evas_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED
497} 624}
498#endif 625#endif
499 626
500#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL
501EAPI Ecore_Evas*
502ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha)
503{
504 Ecore_Evas *ee;
505 int rmethod;
506
507 rmethod = evas_render_method_lookup("software_16_sdl");
508 if (!rmethod) return NULL;
509
510 ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha);
511 ee->driver = "software_16_sdl";
512 return ee;
513}
514#else
515EAPI Ecore_Evas* 627EAPI Ecore_Evas*
516ecore_evas_sdl16_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int hwsurface __UNUSED__, int noframe __UNUSED__, int alpha __UNUSED__) 628ecore_evas_sdl16_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int hwsurface __UNUSED__, int noframe __UNUSED__, int alpha __UNUSED__)
517{ 629{
518 ERR("OUTCH !"); 630 ERR("OUTCH !");
519 return NULL; 631 return NULL;
520} 632}
521#endif
522 633
523#ifdef BUILD_ECORE_EVAS_OPENGL_SDL 634#ifdef BUILD_ECORE_EVAS_OPENGL_SDL
524EAPI Ecore_Evas* 635EAPI Ecore_Evas*
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c
index 72e8555..e88fc35 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c
@@ -1,8 +1,8 @@
1#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
2# include <config.h> 2# include "config.h"
3#endif 3#endif
4 4
5#define LOGFNS 1 5//#define LOGFNS 1
6 6
7#ifdef LOGFNS 7#ifdef LOGFNS
8# include <stdio.h> 8# include <stdio.h>
@@ -28,15 +28,15 @@
28#include "Ecore_Evas.h" 28#include "Ecore_Evas.h"
29 29
30#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL 30#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL
31# include <wayland-egl.h>
32# include <Evas_Engine_Wayland_Egl.h> 31# include <Evas_Engine_Wayland_Egl.h>
33# include <Ecore_Wayland.h> 32# include <Ecore_Wayland.h>
34 33
35/* local structures */ 34/* local structures */
36typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; 35typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data;
37struct _EE_Wl_Smart_Data 36struct _EE_Wl_Smart_Data
38{ 37{
39 Evas_Object *frame, *text; 38 Evas_Object *frame;
39 Evas_Object *text;
40 Evas_Coord x, y, w, h; 40 Evas_Coord x, y, w, h;
41}; 41};
42 42
@@ -51,40 +51,33 @@ static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*fu
51static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); 51static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
52static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); 52static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
53static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); 53static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
54static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
54static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); 55static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
55static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); 56static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
56static void _ecore_evas_wl_show(Ecore_Evas *ee); 57static void _ecore_evas_wl_show(Ecore_Evas *ee);
57static void _ecore_evas_wl_hide(Ecore_Evas *ee); 58static void _ecore_evas_wl_hide(Ecore_Evas *ee);
58static void _ecore_evas_wl_raise(Ecore_Evas *ee); 59static void _ecore_evas_wl_raise(Ecore_Evas *ee);
59static void _ecore_evas_wl_lower(Ecore_Evas *ee); 60static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title);
60static void _ecore_evas_wl_activate(Ecore_Evas *ee);
61static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t);
62static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); 61static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
63static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); 62static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
64static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); 63static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
65static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); 64static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
66static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); 65static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
67static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
68static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__);
69static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); 66static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
70static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__);
71static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); 67static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
72static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); 68static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
73static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__); 69static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
70static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
71static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
72static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
74static int _ecore_evas_wl_render(Ecore_Evas *ee); 73static int _ecore_evas_wl_render(Ecore_Evas *ee);
75static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); 74static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
76 75
77static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event); 76static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
78static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event); 77static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
79static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); 78static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
80static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); 79static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
81static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); 80static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
82static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
83static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
84static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
85
86static void _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height);
87static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__);
88 81
89/* SMART stuff for frame */ 82/* SMART stuff for frame */
90static Evas_Smart *_ecore_evas_wl_smart = NULL; 83static Evas_Smart *_ecore_evas_wl_smart = NULL;
@@ -100,94 +93,94 @@ static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
100 93
101/* local variables */ 94/* local variables */
102static int _ecore_evas_wl_init_count = 0; 95static int _ecore_evas_wl_init_count = 0;
103static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8]; 96static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5];
104static uint32_t _ecore_evas_wl_btn_timestamp;
105static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener =
106{
107 _ecore_evas_wl_handle_configure,
108 _ecore_evas_wl_handle_popup_done
109};
110 97
111static Ecore_Evas_Engine_Func _ecore_wl_engine_func = 98static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
112{ 99{
113 _ecore_evas_wl_free, 100 _ecore_evas_wl_free,
114 _ecore_evas_wl_callback_resize_set, 101 _ecore_evas_wl_callback_resize_set,
115 _ecore_evas_wl_callback_move_set, 102 _ecore_evas_wl_callback_move_set,
116 NULL, // callback show set 103 NULL,
117 NULL, // callback hide set 104 NULL,
118 _ecore_evas_wl_callback_delete_request_set, 105 _ecore_evas_wl_callback_delete_request_set,
119 NULL, // callback destroy set 106 NULL,
120 _ecore_evas_wl_callback_focus_in_set, 107 _ecore_evas_wl_callback_focus_in_set,
121 _ecore_evas_wl_callback_focus_out_set, 108 _ecore_evas_wl_callback_focus_out_set,
122 _ecore_evas_wl_callback_mouse_in_set, 109 _ecore_evas_wl_callback_mouse_in_set,
123 NULL, // callback mouse out set 110 _ecore_evas_wl_callback_mouse_out_set,
124 NULL, // callback sticky set 111 NULL, // sticky_set
125 NULL, // callback unsticky set 112 NULL, // unsticky_set
126 NULL, // callback pre render set 113 NULL, // pre_render_set
127 NULL, // callback post render set 114 NULL, // post_render_set
128 _ecore_evas_wl_move, 115 _ecore_evas_wl_move,
129 NULL, // func managed move 116 NULL, // managed_move
130 _ecore_evas_wl_resize, 117 _ecore_evas_wl_resize,
131 NULL, // _ecore_evas_wl_move_resize, 118 NULL, // move_resize
132 NULL, // func rotation set 119 NULL, // rotation_set
133 NULL, // func shaped set 120 NULL, // shaped_set
134 _ecore_evas_wl_show, 121 _ecore_evas_wl_show,
135 _ecore_evas_wl_hide, 122 _ecore_evas_wl_hide,
136 _ecore_evas_wl_raise, 123 _ecore_evas_wl_raise,
137 _ecore_evas_wl_lower, 124 NULL, // lower
138 _ecore_evas_wl_activate, 125 NULL, // activate
139 _ecore_evas_wl_title_set, 126 _ecore_evas_wl_title_set,
140 _ecore_evas_wl_name_class_set, 127 _ecore_evas_wl_name_class_set,
141 _ecore_evas_wl_size_min_set, 128 _ecore_evas_wl_size_min_set,
142 _ecore_evas_wl_size_max_set, 129 _ecore_evas_wl_size_max_set,
143 _ecore_evas_wl_size_base_set, 130 _ecore_evas_wl_size_base_set,
144 _ecore_evas_wl_size_step_set, 131 _ecore_evas_wl_size_step_set,
145 _ecore_evas_wl_object_cursor_set, 132 NULL, // object_cursor_set
146 _ecore_evas_wl_layer_set, 133 _ecore_evas_wl_layer_set,
147 _ecore_evas_wl_focus_set, 134 NULL, // focus set
148 _ecore_evas_wl_iconified_set, 135 _ecore_evas_wl_iconified_set,
149 NULL, // func borderless set 136 NULL, // borderless set
150 NULL, // func override set 137 NULL, // override set
151 _ecore_evas_wl_maximized_set, 138 _ecore_evas_wl_maximized_set,
152 _ecore_evas_wl_fullscreen_set, 139 _ecore_evas_wl_fullscreen_set,
153 NULL, // _ecore_evas_wl_avoid_damage_set, 140 NULL, // func avoid_damage set
154 NULL, // func withdrawn set 141 NULL, // func withdrawn set
155 NULL, // func sticky set 142 NULL, // func sticky set
156 NULL, // func ignore events set 143 _ecore_evas_wl_ignore_events_set,
157 NULL, // func alpha set 144 _ecore_evas_wl_alpha_set,
158 NULL, // func transparent set 145 _ecore_evas_wl_transparent_set,
146 NULL,
147 NULL,
148 NULL,
149 NULL,
150 NULL,
151 NULL,
159 _ecore_evas_wl_render, 152 _ecore_evas_wl_render,
160 _ecore_evas_wl_screen_geometry_get 153 _ecore_evas_wl_screen_geometry_get
161}; 154};
162 155
163#endif 156/* external variables */
164 157
165#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL 158/* external functions */
166EAPI Ecore_Evas * 159EAPI Ecore_Evas *
167ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame) 160ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
168{ 161{
162 Ecore_Wl_Window *p = NULL;
169 Evas_Engine_Info_Wayland_Egl *einfo; 163 Evas_Engine_Info_Wayland_Egl *einfo;
170 Ecore_Evas *ee; 164 Ecore_Evas *ee;
171 int method = 0; 165 int method = 0;
172 static int _win_id = 1;
173 166
174 LOGFN(__FILE__, __LINE__, __FUNCTION__); 167 LOGFN(__FILE__, __LINE__, __FUNCTION__);
175 168
176 if (!(method = evas_render_method_lookup("wayland_egl"))) 169 if (!(method = evas_render_method_lookup("wayland_egl")))
177 { 170 {
178 printf("Render method lookup failed for Wayland Egl"); 171 ERR("Render method lookup failed for Wayland_Egl");
179 return NULL; 172 return NULL;
180 } 173 }
181 174
182 if (!ecore_wl_init(disp_name)) 175 if (!ecore_wl_init(disp_name))
183 { 176 {
184 printf("Failed to initialize Ecore Wayland"); 177 ERR("Failed to initialize Ecore_Wayland");
185 return NULL; 178 return NULL;
186 } 179 }
187 180
188 if (!(ee = calloc(1, sizeof(Ecore_Evas)))) 181 if (!(ee = calloc(1, sizeof(Ecore_Evas))))
189 { 182 {
190 printf("Failed to allocate Ecore_Evas."); 183 ERR("Failed to allocate Ecore_Evas");
191 ecore_wl_shutdown(); 184 ecore_wl_shutdown();
192 return NULL; 185 return NULL;
193 } 186 }
@@ -204,17 +197,22 @@ ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, in
204 if (w < 1) w = 1; 197 if (w < 1) w = 1;
205 if (h < 1) h = 1; 198 if (h < 1) h = 1;
206 199
207 ee->req.x = ee->x = x; 200 ee->x = x;
208 ee->req.y = ee->y = y; 201 ee->y = y;
209 ee->req.w = ee->w = w; 202 ee->w = w;
210 ee->req.h = ee->h = h; 203 ee->h = h;
204 ee->req.x = ee->x;
205 ee->req.y = ee->y;
206 ee->req.w = ee->w;
207 ee->req.h = ee->h;
211 ee->rotation = 0; 208 ee->rotation = 0;
212 ee->prop.max.w = ee->prop.max.h = 32767; 209 ee->prop.max.w = 32767;
210 ee->prop.max.h = 32767;
213 ee->prop.layer = 4; 211 ee->prop.layer = 4;
214 ee->prop.request_pos = 0; 212 ee->prop.request_pos = 0;
215 ee->prop.sticky = 0; 213 ee->prop.sticky = 0;
216 ee->prop.draw_frame = frame; 214 ee->prop.draw_frame = frame;
217 ee->prop.window = _win_id++; 215 ee->alpha = EINA_FALSE;
218 216
219 ee->evas = evas_new(); 217 ee->evas = evas_new();
220 evas_data_attach_set(ee->evas, ee); 218 evas_data_attach_set(ee->evas, ee);
@@ -222,29 +220,43 @@ ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, in
222 evas_output_size_set(ee->evas, ee->w, ee->h); 220 evas_output_size_set(ee->evas, ee->w, ee->h);
223 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 221 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
224 222
225 if (ee->prop.draw_frame) 223 /* FIXME: This needs to be set based on theme & scale */
224 if (ee->prop.draw_frame)
226 evas_output_framespace_set(ee->evas, 4, 18, 8, 22); 225 evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
227 226
228 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) 227 if (parent)
228 p = ecore_wl_window_find(parent);
229
230 /* FIXME: Get if parent is alpha, and set */
231
232 ee->engine.wl.parent = p;
233 ee->engine.wl.win =
234 ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
235 ee->prop.window = ee->engine.wl.win->id;
236
237 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
229 { 238 {
230 einfo->info.display = ecore_wl_display_get(); 239 einfo->info.display = ecore_wl_display_get();
240 einfo->info.destination_alpha = EINA_FALSE;
231 einfo->info.rotation = ee->rotation; 241 einfo->info.rotation = ee->rotation;
232 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 242 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
233 { 243 {
234 printf("Failed to set Evas Engine Info for '%s'.", ee->driver); 244 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
235 ecore_evas_free(ee); 245 ecore_evas_free(ee);
246 _ecore_evas_wl_shutdown();
247 ecore_wl_shutdown();
236 return NULL; 248 return NULL;
237 } 249 }
238 } 250 }
239 else 251 else
240 { 252 {
241 printf("Failed to get Evas Engine Info for '%s'.", ee->driver); 253 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
242 ecore_evas_free(ee); 254 ecore_evas_free(ee);
255 _ecore_evas_wl_shutdown();
256 ecore_wl_shutdown();
243 return NULL; 257 return NULL;
244 } 258 }
245 259
246 /* NB: we need to be notified before 'free' so we can munmap the evas
247 * engine destination */
248 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); 260 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
249 261
250 if (ee->prop.draw_frame) 262 if (ee->prop.draw_frame)
@@ -270,37 +282,28 @@ ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, in
270 282
271/* local functions */ 283/* local functions */
272static int 284static int
273_ecore_evas_wl_init(void) 285_ecore_evas_wl_init(void)
274{ 286{
275 LOGFN(__FILE__, __LINE__, __FUNCTION__); 287 LOGFN(__FILE__, __LINE__, __FUNCTION__);
276 288
277 if (++_ecore_evas_wl_init_count != 1) 289 if (++_ecore_evas_wl_init_count != 1)
278 return _ecore_evas_wl_init_count; 290 return _ecore_evas_wl_init_count;
279 291
280 _ecore_evas_wl_event_handlers[0] = 292 _ecore_evas_wl_event_hdls[0] =
281 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
282 _ecore_evas_wl_event_mouse_down, NULL);
283 _ecore_evas_wl_event_handlers[1] =
284 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
285 _ecore_evas_wl_event_mouse_up, NULL);
286 _ecore_evas_wl_event_handlers[2] =
287 ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
288 _ecore_evas_wl_event_mouse_move, NULL);
289 _ecore_evas_wl_event_handlers[3] =
290 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
291 _ecore_evas_wl_event_mouse_wheel, NULL);
292 _ecore_evas_wl_event_handlers[4] =
293 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, 293 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
294 _ecore_evas_wl_event_mouse_in, NULL); 294 _ecore_evas_wl_cb_mouse_in, NULL);
295 _ecore_evas_wl_event_handlers[5] = 295 _ecore_evas_wl_event_hdls[1] =
296 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, 296 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
297 _ecore_evas_wl_event_mouse_out, NULL); 297 _ecore_evas_wl_cb_mouse_out, NULL);
298 _ecore_evas_wl_event_handlers[6] = 298 _ecore_evas_wl_event_hdls[2] =
299 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, 299 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
300 _ecore_evas_wl_event_focus_in, NULL); 300 _ecore_evas_wl_cb_focus_in, NULL);
301 _ecore_evas_wl_event_handlers[7] = 301 _ecore_evas_wl_event_hdls[3] =
302 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, 302 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
303 _ecore_evas_wl_event_focus_out, NULL); 303 _ecore_evas_wl_cb_focus_out, NULL);
304 _ecore_evas_wl_event_hdls[4] =
305 ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
306 _ecore_evas_wl_cb_window_configure, NULL);
304 307
305 ecore_event_evas_init(); 308 ecore_event_evas_init();
306 309
@@ -308,7 +311,7 @@ _ecore_evas_wl_init(void)
308} 311}
309 312
310static int 313static int
311_ecore_evas_wl_shutdown(void) 314_ecore_evas_wl_shutdown(void)
312{ 315{
313 unsigned int i = 0; 316 unsigned int i = 0;
314 317
@@ -317,10 +320,10 @@ _ecore_evas_wl_shutdown(void)
317 if (--_ecore_evas_wl_init_count != 0) 320 if (--_ecore_evas_wl_init_count != 0)
318 return _ecore_evas_wl_init_count; 321 return _ecore_evas_wl_init_count;
319 322
320 for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++) 323 for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++)
321 { 324 {
322 if (_ecore_evas_wl_event_handlers[i]) 325 if (_ecore_evas_wl_event_hdls[i])
323 ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); 326 ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
324 } 327 }
325 328
326 ecore_event_evas_shutdown(); 329 ecore_event_evas_shutdown();
@@ -338,24 +341,16 @@ _ecore_evas_wl_pre_free(Ecore_Evas *ee)
338} 341}
339 342
340static void 343static void
341_ecore_evas_wl_free(Ecore_Evas *ee) 344_ecore_evas_wl_free(Ecore_Evas *ee)
342{ 345{
343 LOGFN(__FILE__, __LINE__, __FUNCTION__); 346 LOGFN(__FILE__, __LINE__, __FUNCTION__);
344 347
345 if (ee) 348 if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win);
346 { 349 ee->engine.wl.win = NULL;
347 /* destroy shell surface */
348 if (ee->engine.wl.shell_surface)
349 wl_shell_surface_destroy(ee->engine.wl.shell_surface);
350 ee->engine.wl.shell_surface = NULL;
351 350
352 /* destroy surface */ 351 ecore_event_window_unregister(ee->prop.window);
353 if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); 352 ecore_evas_input_event_unregister(ee);
354 ee->engine.wl.surface = NULL;
355 353
356 ecore_event_window_unregister(ee->prop.window);
357 ecore_evas_input_event_unregister(ee);
358 }
359 _ecore_evas_wl_shutdown(); 354 _ecore_evas_wl_shutdown();
360 ecore_wl_shutdown(); 355 ecore_wl_shutdown();
361} 356}
@@ -415,138 +410,131 @@ _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee
415} 410}
416 411
417static void 412static void
418_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) 413_ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
414{
415 LOGFN(__FILE__, __LINE__, __FUNCTION__);
416
417 if (!ee) return;
418 ee->func.fn_mouse_out = func;
419}
420
421static void
422_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
419{ 423{
420 LOGFN(__FILE__, __LINE__, __FUNCTION__); 424 LOGFN(__FILE__, __LINE__, __FUNCTION__);
421 425
422 if (!ee) return; 426 if (!ee) return;
423// if ((ee->x == x) && (ee->y == y)) return;
424 ee->req.x = x; 427 ee->req.x = x;
425 ee->req.y = y; 428 ee->req.y = y;
426
427 ee->x = x; 429 ee->x = x;
428 ee->y = y; 430 ee->y = y;
429 if (ee->engine.wl.shell_surface) 431 if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y);
430 {
431 wl_shell_surface_move(ee->engine.wl.shell_surface,
432 ecore_wl_input_device_get(),
433 _ecore_evas_wl_btn_timestamp);
434 }
435 if (ee->func.fn_move) ee->func.fn_move(ee); 432 if (ee->func.fn_move) ee->func.fn_move(ee);
436} 433}
437 434
438static void 435static void
439_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) 436_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
440{ 437{
441 LOGFN(__FILE__, __LINE__, __FUNCTION__); 438 LOGFN(__FILE__, __LINE__, __FUNCTION__);
442 439
443 if (!ee) return; 440 if (!ee) return;
444 if (w < 1) w = 1; 441 if (w < 1) w = 1;
445 if (h < 1) h = 1; 442 if (h < 1) h = 1;
446 if ((ee->w == w) && (ee->h == h)) return; 443// if ((ee->w == w) && (ee->h == h)) return;
444
445 if (ee->prop.min.w > w) w = ee->prop.min.w;
446 else if (w > ee->prop.max.w) w = ee->prop.max.w;
447 if (ee->prop.min.h > h) h = ee->prop.min.h;
448 else if (h > ee->prop.max.h) h = ee->prop.max.h;
447 449
448 ee->req.w = w; 450 ee->req.w = w;
449 ee->req.h = h; 451 ee->req.h = h;
450 452
451 /* if (ee->visible) */ 453// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
452 /* { */
453 /* damage old surface, if it exists */
454
455 /* NB: This removes any lingering screen artifacts in the compositor.
456 * This may be a 'HACK' if the issue is actually in the wayland
457 * compositor, but for now lets implement this so we don't have screen
458 * artifacts laying around during a resize */
459 /* if (ee->engine.wl.surface) */
460 /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */
461 /* } */
462 454
463 ee->w = w; 455 ee->w = w;
464 ee->h = h; 456 ee->h = h;
465 457
466// ecore_wl_flush(); 458 /* change evas output & viewport sizes */
467
468 evas_output_size_set(ee->evas, ee->w, ee->h); 459 evas_output_size_set(ee->evas, ee->w, ee->h);
469 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 460 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
470 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 461 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
471 if (ee->engine.wl.frame) 462 if (ee->engine.wl.frame)
472 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); 463 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
473 464
474 /* if ((ee->visible) && (ee->engine.wl.surface)) */ 465 /* set new engine destination */
475 /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ 466 /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
467
468 /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
469 ecore_wl_flush();
470
471 ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
476 472
477 if (ee->func.fn_resize) ee->func.fn_resize(ee); 473 if (ee->func.fn_resize) ee->func.fn_resize(ee);
478} 474}
479 475
480static void 476static void
481_ecore_evas_wl_show(Ecore_Evas *ee) 477_ecore_evas_wl_show(Ecore_Evas *ee)
482{ 478{
483 Evas_Engine_Info_Wayland_Egl *einfo; 479 Evas_Engine_Info_Wayland_Egl *einfo;
484 480
485 LOGFN(__FILE__, __LINE__, __FUNCTION__); 481 LOGFN(__FILE__, __LINE__, __FUNCTION__);
486 482
487 if (!ee) return; 483 if ((!ee) || (ee->visible)) return;
488 if (ee->visible) return;
489
490 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
491 484
492 /* create new surface */ 485 if (ee->engine.wl.win)
493 ee->engine.wl.surface = 486 {
494 wl_compositor_create_surface(ecore_wl_compositor_get()); 487 ecore_wl_window_show(ee->engine.wl.win);
495 wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window); 488 ecore_wl_flush();
489 }
496 490
497 /* create new shell surface */ 491 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
498 ee->engine.wl.shell_surface = 492 if (!einfo)
499 wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); 493 {
494 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
495 return;
496 }
500 497
501 /* set the engine surface here. This should trigger an egl window create */ 498 einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win);
502 einfo->info.surface = ee->engine.wl.surface;
503 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); 499 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
504 500
505 /* add listener for configure events (happen on shell surface resize) */
506 wl_shell_surface_add_listener(ee->engine.wl.shell_surface,
507 &_ecore_evas_wl_shell_surface_listener, ee);
508
509 /* Raise this surface to the top */
510 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
511
512 if (ee->engine.wl.frame) 501 if (ee->engine.wl.frame)
513 { 502 {
514 evas_object_show(ee->engine.wl.frame); 503 evas_object_show(ee->engine.wl.frame);
515 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); 504 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
516 } 505 }
517 506
518 ecore_wl_flush(); 507 /* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */
519 508
520 ee->visible = 1; 509 ee->visible = 1;
521 if (ee->func.fn_show) ee->func.fn_show(ee); 510 if (ee->func.fn_show) ee->func.fn_show(ee);
522} 511}
523 512
524static void 513static void
525_ecore_evas_wl_hide(Ecore_Evas *ee) 514_ecore_evas_wl_hide(Ecore_Evas *ee)
526{ 515{
527 Evas_Engine_Info_Wayland_Egl *einfo; 516 Evas_Engine_Info_Wayland_Egl *einfo;
528 517
529 LOGFN(__FILE__, __LINE__, __FUNCTION__); 518 LOGFN(__FILE__, __LINE__, __FUNCTION__);
530 519
531 if (!ee) return; 520 if ((!ee) || (!ee->visible)) return;
532 if (!ee->visible) return;
533
534 /* get engine info */
535 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
536 einfo->info.surface = NULL;
537 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
538 521
539 /* destroy shell surface */ 522 if (ee->engine.wl.win)
540 if (ee->engine.wl.shell_surface) 523 {
541 wl_shell_surface_destroy(ee->engine.wl.shell_surface); 524 ecore_wl_window_hide(ee->engine.wl.win);
542 ee->engine.wl.shell_surface = NULL; 525 ecore_wl_flush();
526 }
543 527
544 /* destroy surface */ 528 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
545 if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); 529 if (einfo)
546 ee->engine.wl.surface = NULL; 530 {
531 einfo->info.surface = NULL;
532 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
533 }
547 534
548 ee->visible = 0; 535 ee->visible = 0;
549 ee->should_be_visible = 0; 536 ee->should_be_visible = 0;
537
550 if (ee->func.fn_hide) ee->func.fn_hide(ee); 538 if (ee->func.fn_hide) ee->func.fn_hide(ee);
551} 539}
552 540
@@ -556,39 +544,18 @@ _ecore_evas_wl_raise(Ecore_Evas *ee)
556 LOGFN(__FILE__, __LINE__, __FUNCTION__); 544 LOGFN(__FILE__, __LINE__, __FUNCTION__);
557 545
558 if ((!ee) || (!ee->visible)) return; 546 if ((!ee) || (!ee->visible)) return;
559 if (!ee->engine.wl.shell_surface) return; 547 ecore_wl_window_raise(ee->engine.wl.win);
560 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
561}
562
563static void
564_ecore_evas_wl_lower(Ecore_Evas *ee)
565{
566 LOGFN(__FILE__, __LINE__, __FUNCTION__);
567
568 if ((!ee) || (!ee->visible)) return;
569 /* FIXME: Need a way to tell Wayland to lower */
570}
571
572static void
573_ecore_evas_wl_activate(Ecore_Evas *ee)
574{
575 LOGFN(__FILE__, __LINE__, __FUNCTION__);
576
577 if ((!ee) || (!ee->visible)) return;
578 if (!ee->engine.wl.shell_surface) return;
579 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
580} 548}
581 549
582static void 550static void
583_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) 551_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
584{ 552{
585 LOGFN(__FILE__, __LINE__, __FUNCTION__); 553 LOGFN(__FILE__, __LINE__, __FUNCTION__);
586 554
587 if (!ee) return; 555 if (!ee) return;
588 if (ee->prop.title) free(ee->prop.title); 556 if (ee->prop.title) free(ee->prop.title);
589 ee->prop.title = NULL; 557 ee->prop.title = NULL;
590 if (t) ee->prop.title = strdup(t); 558 if (title) ee->prop.title = strdup(title);
591
592 if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) 559 if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
593 { 560 {
594 EE_Wl_Smart_Data *sd; 561 EE_Wl_Smart_Data *sd;
@@ -666,106 +633,101 @@ _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
666} 633}
667 634
668static void 635static void
669_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) 636_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
670{ 637{
671 int x = 0, y = 0;
672
673 LOGFN(__FILE__, __LINE__, __FUNCTION__); 638 LOGFN(__FILE__, __LINE__, __FUNCTION__);
674 639
675 if (!ee) return; 640 if (!ee) return;
676 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); 641 if (ee->prop.layer == layer) return;
677 ee->prop.cursor.object = NULL; 642 if (layer < 1) layer = 1;
678 643 else if (layer > 255) layer = 255;
679 if (!obj) 644 ee->prop.layer = layer;
680 {
681 ee->prop.cursor.layer = 0;
682 ee->prop.cursor.hot.x = 0;
683 ee->prop.cursor.hot.y = 0;
684 return;
685 }
686
687 ee->prop.cursor.object = obj;
688 ee->prop.cursor.layer = layer;
689 ee->prop.cursor.hot.x = hot_x;
690 ee->prop.cursor.hot.y = hot_y;
691
692 evas_pointer_output_xy_get(ee->evas, &x, &y);
693 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
694 evas_object_move(ee->prop.cursor.object,
695 x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y);
696 evas_object_pass_events_set(ee->prop.cursor.object, 1);
697 if (evas_pointer_inside_get(ee->evas))
698 evas_object_show(ee->prop.cursor.object);
699
700 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
701 _ecore_evas_wl_object_cursor_del, ee);
702} 645}
703 646
704static void 647static void
705_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 648_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
706{ 649{
707 Ecore_Evas *ee; 650 LOGFN(__FILE__, __LINE__, __FUNCTION__);
708 651
709 if (!(ee = data)) return; 652 if (!ee) return;
710 ee->prop.cursor.object = NULL; 653 if (ee->prop.iconified == iconify) return;
654 ee->prop.iconified = iconify;
655 /* FIXME: Implement this in Wayland someshow */
711} 656}
712 657
713static void 658static void
714_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) 659_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
715{ 660{
716 LOGFN(__FILE__, __LINE__, __FUNCTION__); 661 LOGFN(__FILE__, __LINE__, __FUNCTION__);
717 662
718 if (!ee) return; 663 if (!ee) return;
719 if (ee->prop.layer == layer) return; 664 if (ee->prop.maximized == max) return;
720 if (layer < 1) layer = 1; 665 ee->prop.maximized = max;
721 else if (layer > 255) layer = 255; 666 ecore_wl_window_maximized_set(ee->engine.wl.win, max);
722 ee->prop.layer = layer;
723} 667}
724 668
725static void 669static void
726_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) 670_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
727{ 671{
728 LOGFN(__FILE__, __LINE__, __FUNCTION__); 672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
729 673
730 if ((!ee) || (!ee->visible)) return; 674 if ((!ee) || (!ee->visible)) return;
731 if (!ee->engine.wl.shell_surface) return; 675 if (ee->prop.fullscreen == full) return;
732 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); 676 ee->prop.fullscreen = full;
677 ecore_wl_window_fullscreen_set(ee->engine.wl.win, full);
733} 678}
734 679
735static void 680static void
736_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) 681_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
737{ 682{
738 LOGFN(__FILE__, __LINE__, __FUNCTION__); 683 LOGFN(__FILE__, __LINE__, __FUNCTION__);
739 684
740 if (!ee) return; 685 if (!ee) return;
741 if (ee->prop.iconified == iconify) return; 686 ee->ignore_events = ignore;
742 ee->prop.iconified = iconify; 687 /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */
743 /* FIXME: Implement this in Wayland someshow */
744} 688}
745 689
746static void 690static void
747_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) 691_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
748{ 692{
693 Evas_Engine_Info_Wayland_Egl *einfo;
694
749 LOGFN(__FILE__, __LINE__, __FUNCTION__); 695 LOGFN(__FILE__, __LINE__, __FUNCTION__);
750 696
751 if (!ee) return; 697 if (!ee) return;
752 if (ee->prop.maximized == max) return; 698 if ((ee->alpha == alpha)) return;
753 ee->prop.maximized = max; 699 ee->alpha = alpha;
754 /* FIXME: Implement this in Wayland someshow */ 700 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
701 {
702 einfo->info.destination_alpha = alpha;
703 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
704 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
705 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
706 }
755} 707}
756 708
757static void 709static void
758_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) 710_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
759{ 711{
712 Evas_Engine_Info_Wayland_Egl *einfo;
713
760 LOGFN(__FILE__, __LINE__, __FUNCTION__); 714 LOGFN(__FILE__, __LINE__, __FUNCTION__);
761 715
762 if ((!ee) || (!ee->visible)) return; 716 if (!ee) return;
763 if (!ee->engine.wl.shell_surface) return; 717 if ((ee->transparent == transparent)) return;
764 wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface); 718 ee->transparent = transparent;
719 if (!ee->visible) return;
720 if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas)))
721 {
722 einfo->info.destination_alpha = transparent;
723 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
724 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
725 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
726 }
765} 727}
766 728
767static int 729static int
768_ecore_evas_wl_render(Ecore_Evas *ee) 730_ecore_evas_wl_render(Ecore_Evas *ee)
769{ 731{
770 int rend = 0; 732 int rend = 0;
771 733
@@ -789,26 +751,24 @@ _ecore_evas_wl_render(Ecore_Evas *ee)
789 751
790 if ((updates = evas_render_updates(ee->evas))) 752 if ((updates = evas_render_updates(ee->evas)))
791 { 753 {
792 /* if (ee->engine.wl.surface) */ 754 Eina_List *l = NULL;
793 /* { */ 755 Eina_Rectangle *r;
794 /* Eina_List *l = NULL; */ 756
795 /* Eina_Rectangle *r; */ 757 LOGFN(__FILE__, __LINE__, __FUNCTION__);
796 758
797 /* EINA_LIST_FOREACH(updates, l, r) */ 759 EINA_LIST_FOREACH(updates, l, r)
798 /* wl_surface_damage(ee->engine.wl.surface, */ 760 ecore_wl_window_damage(ee->engine.wl.win,
799 /* r->x, r->y, r->w, r->h); */ 761 r->x, r->y, r->w, r->h);
800 /* } */ 762
763 ecore_wl_flush();
801 764
802 evas_render_updates_free(updates); 765 evas_render_updates_free(updates);
803 _ecore_evas_idle_timeout_update(ee); 766 _ecore_evas_idle_timeout_update(ee);
804 rend = 1; 767 rend = 1;
805
806 ecore_wl_flush();
807 } 768 }
808 769
809 if (ee->func.fn_post_render) ee->func.fn_post_render(ee); 770 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
810 } 771 }
811
812 return rend; 772 return rend;
813} 773}
814 774
@@ -822,77 +782,18 @@ _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int
822 ecore_wl_screen_size_get(w, h); 782 ecore_wl_screen_size_get(w, h);
823} 783}
824 784
825static Eina_Bool 785void
826_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) 786_ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
827{
828 Ecore_Evas *ee;
829 Ecore_Event_Mouse_Button *ev;
830
831 LOGFN(__FILE__, __LINE__, __FUNCTION__);
832
833 ev = event;
834 _ecore_evas_wl_btn_timestamp = ev->timestamp;
835 ee = ecore_event_window_match(ev->window);
836 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
837 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
838 evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers,
839 ev->timestamp, NULL);
840 return ECORE_CALLBACK_PASS_ON;
841}
842
843static Eina_Bool
844_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
845{
846 Ecore_Evas *ee;
847 Ecore_Event_Mouse_Button *ev;
848
849 LOGFN(__FILE__, __LINE__, __FUNCTION__);
850
851 ev = event;
852 ee = ecore_event_window_match(ev->window);
853 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
854 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
855 evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers,
856 ev->timestamp, NULL);
857 return ECORE_CALLBACK_PASS_ON;
858}
859
860static Eina_Bool
861_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
862{
863 Ecore_Evas *ee;
864 Ecore_Event_Mouse_Move *ev;
865
866 ev = event;
867 ee = ecore_event_window_match(ev->window);
868 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
869 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
870 ee->mouse.x = ev->x;
871 ee->mouse.y = ev->y;
872 evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL);
873 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
874 return ECORE_CALLBACK_PASS_ON;
875}
876
877static Eina_Bool
878_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
879{ 787{
880 Ecore_Evas *ee;
881 Ecore_Event_Mouse_Wheel *ev;
882
883 LOGFN(__FILE__, __LINE__, __FUNCTION__); 788 LOGFN(__FILE__, __LINE__, __FUNCTION__);
884 789
885 ev = event; 790 if (!ee) return;
886 ee = ecore_event_window_match(ev->window); 791 if (ee->engine.wl.win)
887 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 792 ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location);
888 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
889 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z,
890 ev->timestamp, NULL);
891 return ECORE_CALLBACK_PASS_ON;
892} 793}
893 794
894static Eina_Bool 795static Eina_Bool
895_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) 796_ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
896{ 797{
897 Ecore_Evas *ee; 798 Ecore_Evas *ee;
898 Ecore_Wl_Event_Mouse_In *ev; 799 Ecore_Wl_Event_Mouse_In *ev;
@@ -900,18 +801,18 @@ _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *
900 LOGFN(__FILE__, __LINE__, __FUNCTION__); 801 LOGFN(__FILE__, __LINE__, __FUNCTION__);
901 802
902 ev = event; 803 ev = event;
903 ee = ecore_event_window_match(ev->window); 804 ee = ecore_event_window_match(ev->win);
904 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 805 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
905 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 806 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
906 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); 807 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
907 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); 808 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
908 evas_event_feed_mouse_in(ee->evas, ev->time, NULL); 809 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
909 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); 810 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
910 return ECORE_CALLBACK_PASS_ON; 811 return ECORE_CALLBACK_PASS_ON;
911} 812}
912 813
913static Eina_Bool 814static Eina_Bool
914_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) 815_ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
915{ 816{
916 Ecore_Evas *ee; 817 Ecore_Evas *ee;
917 Ecore_Wl_Event_Mouse_Out *ev; 818 Ecore_Wl_Event_Mouse_Out *ev;
@@ -919,19 +820,19 @@ _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void
919 LOGFN(__FILE__, __LINE__, __FUNCTION__); 820 LOGFN(__FILE__, __LINE__, __FUNCTION__);
920 821
921 ev = event; 822 ev = event;
922 ee = ecore_event_window_match(ev->window); 823 ee = ecore_event_window_match(ev->win);
923 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 824 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
924 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 825 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
925 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); 826 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
926 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); 827 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
927 evas_event_feed_mouse_out(ee->evas, ev->time, NULL); 828 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
928 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); 829 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
929 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); 830 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
930 return ECORE_CALLBACK_PASS_ON; 831 return ECORE_CALLBACK_PASS_ON;
931} 832}
932 833
933static Eina_Bool 834static Eina_Bool
934_ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) 835_ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
935{ 836{
936 Ecore_Evas *ee; 837 Ecore_Evas *ee;
937 Ecore_Wl_Event_Focus_In *ev; 838 Ecore_Wl_Event_Focus_In *ev;
@@ -939,9 +840,9 @@ _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *
939 LOGFN(__FILE__, __LINE__, __FUNCTION__); 840 LOGFN(__FILE__, __LINE__, __FUNCTION__);
940 841
941 ev = event; 842 ev = event;
942 ee = ecore_event_window_match(ev->window); 843 ee = ecore_event_window_match(ev->win);
943 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 844 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
944 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 845 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
945 ee->prop.focused = 1; 846 ee->prop.focused = 1;
946 evas_focus_in(ee->evas); 847 evas_focus_in(ee->evas);
947 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); 848 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
@@ -949,45 +850,51 @@ _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *
949} 850}
950 851
951static Eina_Bool 852static Eina_Bool
952_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) 853_ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
953{ 854{
954 Ecore_Evas *ee; 855 Ecore_Evas *ee;
955 Ecore_Wl_Event_Focus_Out *ev; 856 Ecore_Wl_Event_Focus_In *ev;
956 857
957 LOGFN(__FILE__, __LINE__, __FUNCTION__); 858 LOGFN(__FILE__, __LINE__, __FUNCTION__);
958 859
959 ev = event; 860 ev = event;
960 ee = ecore_event_window_match(ev->window); 861 ee = ecore_event_window_match(ev->win);
961 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 862 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
962 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 863 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
963 evas_focus_out(ee->evas); 864 evas_focus_out(ee->evas);
964 ee->prop.focused = 0; 865 ee->prop.focused = 0;
965 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); 866 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
966 return ECORE_CALLBACK_PASS_ON; 867 return ECORE_CALLBACK_PASS_ON;
967} 868}
968 869
969static void 870static Eina_Bool
970_ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height) 871_ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
971{ 872{
972 Ecore_Evas *ee; 873 Ecore_Evas *ee;
874 Ecore_Wl_Event_Window_Configure *ev;
973 875
974 /* NB: Trap to prevent compositor from crashing */ 876 LOGFN(__FILE__, __LINE__, __FUNCTION__);
975 if ((width <= 0) || (height <= 0)) return;
976
977 if (!(ee = data)) return;
978 877
979 printf("EGL Handle Configure Message\n"); 878 ev = event;
980 if ((shell_surface) && (ee->engine.wl.shell_surface)) 879 ee = ecore_event_window_match(ev->win);
880 if (!ee) return ECORE_CALLBACK_PASS_ON;
881 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
882 if ((ee->x != ev->x) || (ee->y != ev->y))
981 { 883 {
982 if (ee->engine.wl.shell_surface != shell_surface) return; 884 ee->x = ev->x;
983 ecore_evas_resize(ee, width, height); 885 ee->y = ev->y;
886 ee->req.x = ee->x;
887 ee->req.y = ee->y;
888 if (ee->func.fn_move) ee->func.fn_move(ee);
889 }
890 if ((ee->req.w != ev->w) || (ee->req.h != ev->h))
891 {
892 ee->req.w = ev->w;
893 ee->req.h = ev->h;
894 if (ee->func.fn_resize) ee->func.fn_resize(ee);
984 } 895 }
985}
986
987static void
988_ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__)
989{
990 896
897 return ECORE_CALLBACK_PASS_ON;
991} 898}
992 899
993static void 900static void
@@ -1101,30 +1008,9 @@ _ecore_evas_wl_frame_add(Evas *evas)
1101 return evas_object_smart_add(evas, _ecore_evas_wl_smart); 1008 return evas_object_smart_add(evas, _ecore_evas_wl_smart);
1102} 1009}
1103 1010
1104void
1105_ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location)
1106{
1107 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1108
1109 if ((!ee) || (!ee->engine.wl.shell_surface)) return;
1110 wl_shell_surface_resize(ee->engine.wl.shell_surface,
1111 ecore_wl_input_device_get(),
1112 _ecore_evas_wl_btn_timestamp, location);
1113}
1114
1115void
1116_ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
1117{
1118 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1119
1120 if ((!ee) || (!ee->engine.wl.surface)) return;
1121 if ((!source) || (!drag_ee)) return;
1122 ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer);
1123}
1124
1125#else 1011#else
1126EAPI Ecore_Evas * 1012EAPI Ecore_Evas *
1127ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__) 1013ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__)
1128{ 1014{
1129 return NULL; 1015 return NULL;
1130} 1016}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c
index e3b15c8..4c7ee2d 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c
@@ -2,7 +2,7 @@
2# include "config.h" 2# include "config.h"
3#endif 3#endif
4 4
5//#define LOGFNS 1 5#define LOGFNS 1
6 6
7#ifdef LOGFNS 7#ifdef LOGFNS
8# include <stdio.h> 8# include <stdio.h>
@@ -20,12 +20,12 @@
20# include <sys/mman.h> 20# include <sys/mman.h>
21#endif 21#endif
22 22
23# include <Eina.h> 23#include <Eina.h>
24# include <Evas.h> 24#include <Evas.h>
25# include <Ecore.h> 25#include <Ecore.h>
26 26
27# include "ecore_evas_private.h" 27#include "ecore_evas_private.h"
28# include "Ecore_Evas.h" 28#include "Ecore_Evas.h"
29 29
30#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM 30#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM
31# include <Evas_Engine_Wayland_Shm.h> 31# include <Evas_Engine_Wayland_Shm.h>
@@ -51,41 +51,34 @@ static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*fu
51static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); 51static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
52static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); 52static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
53static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); 53static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
54static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee));
54static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); 55static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y);
55static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); 56static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h);
56static void _ecore_evas_wl_show(Ecore_Evas *ee); 57static void _ecore_evas_wl_show(Ecore_Evas *ee);
57static void _ecore_evas_wl_hide(Ecore_Evas *ee); 58static void _ecore_evas_wl_hide(Ecore_Evas *ee);
58static void _ecore_evas_wl_raise(Ecore_Evas *ee); 59static void _ecore_evas_wl_raise(Ecore_Evas *ee);
59static void _ecore_evas_wl_lower(Ecore_Evas *ee); 60static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title);
60static void _ecore_evas_wl_activate(Ecore_Evas *ee);
61static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t);
62static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); 61static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
63static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); 62static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h);
64static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); 63static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h);
65static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); 64static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h);
66static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); 65static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h);
67static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
68static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__);
69static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); 66static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer);
70static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__);
71static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); 67static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify);
72static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); 68static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max);
73static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__); 69static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full);
70static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore);
71static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
72static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
74static int _ecore_evas_wl_render(Ecore_Evas *ee); 73static int _ecore_evas_wl_render(Ecore_Evas *ee);
75static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); 74static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h);
76static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest); 75static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest);
77 76
78static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event); 77static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
79static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event); 78static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
80static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); 79static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
81static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); 80static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
82static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); 81static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event);
83static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
84static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
85static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
86
87static void _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height);
88static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__);
89 82
90/* SMART stuff for frame */ 83/* SMART stuff for frame */
91static Evas_Smart *_ecore_evas_wl_smart = NULL; 84static Evas_Smart *_ecore_evas_wl_smart = NULL;
@@ -101,95 +94,94 @@ static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas);
101 94
102/* local variables */ 95/* local variables */
103static int _ecore_evas_wl_init_count = 0; 96static int _ecore_evas_wl_init_count = 0;
104static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8]; 97static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5];
105static uint32_t _ecore_evas_wl_btn_timestamp;
106static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener =
107{
108 _ecore_evas_wl_handle_configure,
109 _ecore_evas_wl_handle_popup_done
110};
111 98
112static Ecore_Evas_Engine_Func _ecore_wl_engine_func = 99static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
113{ 100{
114 _ecore_evas_wl_free, 101 _ecore_evas_wl_free,
115 _ecore_evas_wl_callback_resize_set, 102 _ecore_evas_wl_callback_resize_set,
116 _ecore_evas_wl_callback_move_set, 103 _ecore_evas_wl_callback_move_set,
117 NULL, // callback show set 104 NULL,
118 NULL, // callback hide set 105 NULL,
119 _ecore_evas_wl_callback_delete_request_set, 106 _ecore_evas_wl_callback_delete_request_set,
120 NULL, // callback destroy set 107 NULL,
121 _ecore_evas_wl_callback_focus_in_set, 108 _ecore_evas_wl_callback_focus_in_set,
122 _ecore_evas_wl_callback_focus_out_set, 109 _ecore_evas_wl_callback_focus_out_set,
123 _ecore_evas_wl_callback_mouse_in_set, 110 _ecore_evas_wl_callback_mouse_in_set,
124 NULL, // callback mouse out set 111 _ecore_evas_wl_callback_mouse_out_set,
125 NULL, // callback sticky set 112 NULL, // sticky_set
126 NULL, // callback unsticky set 113 NULL, // unsticky_set
127 NULL, // callback pre render set 114 NULL, // pre_render_set
128 NULL, // callback post render set 115 NULL, // post_render_set
129 _ecore_evas_wl_move, 116 _ecore_evas_wl_move,
130 NULL, // func managed move 117 NULL, // managed_move
131 _ecore_evas_wl_resize, 118 _ecore_evas_wl_resize,
132 NULL, // func move_resize 119 NULL, // move_resize
133 NULL, // func rotation set 120 NULL, // rotation_set
134 NULL, // func shaped set 121 NULL, // shaped_set
135 _ecore_evas_wl_show, 122 _ecore_evas_wl_show,
136 _ecore_evas_wl_hide, 123 _ecore_evas_wl_hide,
137 _ecore_evas_wl_raise, 124 _ecore_evas_wl_raise,
138 _ecore_evas_wl_lower, 125 NULL, // lower
139 _ecore_evas_wl_activate, 126 NULL, // activate
140 _ecore_evas_wl_title_set, 127 _ecore_evas_wl_title_set,
141 _ecore_evas_wl_name_class_set, 128 _ecore_evas_wl_name_class_set,
142 _ecore_evas_wl_size_min_set, 129 _ecore_evas_wl_size_min_set,
143 _ecore_evas_wl_size_max_set, 130 _ecore_evas_wl_size_max_set,
144 _ecore_evas_wl_size_base_set, 131 _ecore_evas_wl_size_base_set,
145 _ecore_evas_wl_size_step_set, 132 _ecore_evas_wl_size_step_set,
146 _ecore_evas_wl_object_cursor_set, 133 NULL, // object_cursor_set
147 _ecore_evas_wl_layer_set, 134 _ecore_evas_wl_layer_set,
148 _ecore_evas_wl_focus_set, 135 NULL, // focus set
149 _ecore_evas_wl_iconified_set, 136 _ecore_evas_wl_iconified_set,
150 NULL, // func borderless set 137 NULL, // borderless set
151 NULL, // func override set 138 NULL, // override set
152 _ecore_evas_wl_maximized_set, 139 _ecore_evas_wl_maximized_set,
153 _ecore_evas_wl_fullscreen_set, 140 _ecore_evas_wl_fullscreen_set,
154 NULL, // func avoid_damage set 141 NULL, // func avoid_damage set
155 NULL, // func withdrawn set 142 NULL, // func withdrawn set
156 NULL, // func sticky set 143 NULL, // func sticky set
157 NULL, // func ignore_events set 144 _ecore_evas_wl_ignore_events_set,
158 NULL, // func alpha set 145 _ecore_evas_wl_alpha_set,
159 NULL, // func transparent set 146 _ecore_evas_wl_transparent_set,
147 NULL,
148 NULL,
149 NULL,
150 NULL,
151 NULL,
152 NULL,
160 _ecore_evas_wl_render, 153 _ecore_evas_wl_render,
161 _ecore_evas_wl_screen_geometry_get 154 _ecore_evas_wl_screen_geometry_get
162}; 155};
163 156
164/* external variables */ 157/* external variables */
165#endif
166 158
167#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM 159/* external functions */
168EAPI Ecore_Evas * 160EAPI Ecore_Evas *
169ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame) 161ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame)
170{ 162{
163 Ecore_Wl_Window *p = NULL;
171 Evas_Engine_Info_Wayland_Shm *einfo; 164 Evas_Engine_Info_Wayland_Shm *einfo;
172 Ecore_Evas *ee; 165 Ecore_Evas *ee;
173 int method = 0; 166 int method = 0;
174 static int _win_id = 1;
175 167
176 LOGFN(__FILE__, __LINE__, __FUNCTION__); 168 LOGFN(__FILE__, __LINE__, __FUNCTION__);
177 169
178 if (!(method = evas_render_method_lookup("wayland_shm"))) 170 if (!(method = evas_render_method_lookup("wayland_shm")))
179 { 171 {
180 ERR("Render method lookup failed."); 172 ERR("Render method lookup failed for Wayland_Shm");
181 return NULL; 173 return NULL;
182 } 174 }
183 175
184 if (!(ecore_wl_init(disp_name))) 176 if (!ecore_wl_init(disp_name))
185 { 177 {
186 ERR("Failed to initialize Ecore Wayland."); 178 ERR("Failed to initialize Ecore_Wayland");
187 return NULL; 179 return NULL;
188 } 180 }
189 181
190 if (!(ee = calloc(1, sizeof(Ecore_Evas)))) 182 if (!(ee = calloc(1, sizeof(Ecore_Evas))))
191 { 183 {
192 ERR("Failed to allocate Ecore_Evas."); 184 ERR("Failed to allocate Ecore_Evas");
193 ecore_wl_shutdown(); 185 ecore_wl_shutdown();
194 return NULL; 186 return NULL;
195 } 187 }
@@ -206,17 +198,21 @@ ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, in
206 if (w < 1) w = 1; 198 if (w < 1) w = 1;
207 if (h < 1) h = 1; 199 if (h < 1) h = 1;
208 200
209 ee->req.x = ee->x = x; 201 ee->x = x;
210 ee->req.y = ee->y = y; 202 ee->y = y;
211 ee->req.w = ee->w = w; 203 ee->w = w;
212 ee->req.h = ee->h = h; 204 ee->h = h;
205 ee->req.x = ee->x;
206 ee->req.y = ee->y;
207 ee->req.w = ee->w;
208 ee->req.h = ee->h;
213 ee->rotation = 0; 209 ee->rotation = 0;
214 ee->prop.max.w = ee->prop.max.h = 32767; 210 ee->prop.max.w = 32767;
211 ee->prop.max.h = 32767;
215 ee->prop.layer = 4; 212 ee->prop.layer = 4;
216 ee->prop.request_pos = 0; 213 ee->prop.request_pos = 0;
217 ee->prop.sticky = 0; 214 ee->prop.sticky = 0;
218 ee->prop.draw_frame = frame; 215 ee->prop.draw_frame = frame;
219 ee->prop.window = _win_id++;
220 216
221 ee->evas = evas_new(); 217 ee->evas = evas_new();
222 evas_data_attach_set(ee->evas, ee); 218 evas_data_attach_set(ee->evas, ee);
@@ -224,29 +220,42 @@ ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, in
224 evas_output_size_set(ee->evas, ee->w, ee->h); 220 evas_output_size_set(ee->evas, ee->w, ee->h);
225 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 221 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
226 222
227 if (ee->prop.draw_frame) 223 /* FIXME: This needs to be set based on theme & scale */
224 if (ee->prop.draw_frame)
228 evas_output_framespace_set(ee->evas, 4, 18, 8, 22); 225 evas_output_framespace_set(ee->evas, 4, 18, 8, 22);
229 226
230 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) 227 if (parent)
228 p = ecore_wl_window_find(parent);
229
230 /* FIXME: Get if parent is alpha, and set */
231
232 ee->engine.wl.parent = p;
233 ee->engine.wl.win =
234 ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
235 ee->prop.window = ee->engine.wl.win->id;
236
237 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
231 { 238 {
232 einfo->info.rotation = ee->rotation; 239 einfo->info.rotation = ee->rotation;
233 einfo->info.debug = EINA_FALSE; 240 einfo->info.debug = EINA_FALSE;
234 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 241 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
235 { 242 {
236 ERR("Failed to set Evas Engine Info for '%s'.", ee->driver); 243 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
237 ecore_evas_free(ee); 244 ecore_evas_free(ee);
245 _ecore_evas_wl_shutdown();
246 ecore_wl_shutdown();
238 return NULL; 247 return NULL;
239 } 248 }
240 } 249 }
241 else 250 else
242 { 251 {
243 ERR("Failed to get Evas Engine Info for '%s'.", ee->driver); 252 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
244 ecore_evas_free(ee); 253 ecore_evas_free(ee);
254 _ecore_evas_wl_shutdown();
255 ecore_wl_shutdown();
245 return NULL; 256 return NULL;
246 } 257 }
247 258
248 /* NB: we need to be notified before 'free' so we can munmap the evas
249 * engine destination */
250 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); 259 ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free);
251 260
252 if (ee->prop.draw_frame) 261 if (ee->prop.draw_frame)
@@ -279,30 +288,21 @@ _ecore_evas_wl_init(void)
279 if (++_ecore_evas_wl_init_count != 1) 288 if (++_ecore_evas_wl_init_count != 1)
280 return _ecore_evas_wl_init_count; 289 return _ecore_evas_wl_init_count;
281 290
282 _ecore_evas_wl_event_handlers[0] = 291 _ecore_evas_wl_event_hdls[0] =
283 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
284 _ecore_evas_wl_event_mouse_down, NULL);
285 _ecore_evas_wl_event_handlers[1] =
286 ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
287 _ecore_evas_wl_event_mouse_up, NULL);
288 _ecore_evas_wl_event_handlers[2] =
289 ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
290 _ecore_evas_wl_event_mouse_move, NULL);
291 _ecore_evas_wl_event_handlers[3] =
292 ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
293 _ecore_evas_wl_event_mouse_wheel, NULL);
294 _ecore_evas_wl_event_handlers[4] =
295 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, 292 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN,
296 _ecore_evas_wl_event_mouse_in, NULL); 293 _ecore_evas_wl_cb_mouse_in, NULL);
297 _ecore_evas_wl_event_handlers[5] = 294 _ecore_evas_wl_event_hdls[1] =
298 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, 295 ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT,
299 _ecore_evas_wl_event_mouse_out, NULL); 296 _ecore_evas_wl_cb_mouse_out, NULL);
300 _ecore_evas_wl_event_handlers[6] = 297 _ecore_evas_wl_event_hdls[2] =
301 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, 298 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN,
302 _ecore_evas_wl_event_focus_in, NULL); 299 _ecore_evas_wl_cb_focus_in, NULL);
303 _ecore_evas_wl_event_handlers[7] = 300 _ecore_evas_wl_event_hdls[3] =
304 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, 301 ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT,
305 _ecore_evas_wl_event_focus_out, NULL); 302 _ecore_evas_wl_cb_focus_out, NULL);
303 _ecore_evas_wl_event_hdls[4] =
304 ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
305 _ecore_evas_wl_cb_window_configure, NULL);
306 306
307 ecore_event_evas_init(); 307 ecore_event_evas_init();
308 308
@@ -319,10 +319,10 @@ _ecore_evas_wl_shutdown(void)
319 if (--_ecore_evas_wl_init_count != 0) 319 if (--_ecore_evas_wl_init_count != 0)
320 return _ecore_evas_wl_init_count; 320 return _ecore_evas_wl_init_count;
321 321
322 for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++) 322 for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++)
323 { 323 {
324 if (_ecore_evas_wl_event_handlers[i]) 324 if (_ecore_evas_wl_event_hdls[i])
325 ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); 325 ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]);
326 } 326 }
327 327
328 ecore_event_evas_shutdown(); 328 ecore_event_evas_shutdown();
@@ -337,17 +337,15 @@ _ecore_evas_wl_pre_free(Ecore_Evas *ee)
337 337
338 LOGFN(__FILE__, __LINE__, __FUNCTION__); 338 LOGFN(__FILE__, __LINE__, __FUNCTION__);
339 339
340 /* destroy frame */
341 if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); 340 if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame);
342 341
343 /* get engine info */
344 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); 342 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
345 if ((einfo) && (einfo->info.dest)) 343 if ((einfo) && (einfo->info.dest))
346 { 344 {
347 int ret = 0; 345 int ret = 0;
348 346
349 /* munmap previous engine destination */
350 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); 347 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
348 if (!ret) ERR("Failed to unmap engine destination: %m");
351 } 349 }
352} 350}
353 351
@@ -356,18 +354,11 @@ _ecore_evas_wl_free(Ecore_Evas *ee)
356{ 354{
357 LOGFN(__FILE__, __LINE__, __FUNCTION__); 355 LOGFN(__FILE__, __LINE__, __FUNCTION__);
358 356
359 /* destroy buffer */
360 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); 357 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
361 ee->engine.wl.buffer = NULL; 358 ee->engine.wl.buffer = NULL;
362 359
363 /* destroy shell surface */ 360 if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win);
364 if (ee->engine.wl.shell_surface) 361 ee->engine.wl.win = NULL;
365 wl_shell_surface_destroy(ee->engine.wl.shell_surface);
366 ee->engine.wl.shell_surface = NULL;
367
368 /* destroy surface */
369 if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface);
370 ee->engine.wl.surface = NULL;
371 362
372 ecore_event_window_unregister(ee->prop.window); 363 ecore_event_window_unregister(ee->prop.window);
373 ecore_evas_input_event_unregister(ee); 364 ecore_evas_input_event_unregister(ee);
@@ -431,25 +422,25 @@ _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee
431} 422}
432 423
433static void 424static void
434_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) 425_ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee))
426{
427 LOGFN(__FILE__, __LINE__, __FUNCTION__);
428
429 if (!ee) return;
430 ee->func.fn_mouse_out = func;
431}
432
433static void
434_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y)
435{ 435{
436 LOGFN(__FILE__, __LINE__, __FUNCTION__); 436 LOGFN(__FILE__, __LINE__, __FUNCTION__);
437 437
438 if (!ee) return; 438 if (!ee) return;
439// if ((ee->x == x) && (ee->y == y)) return;
440 ee->req.x = x; 439 ee->req.x = x;
441 ee->req.y = y; 440 ee->req.y = y;
442
443 ee->x = x; 441 ee->x = x;
444 ee->y = y; 442 ee->y = y;
445 443 if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y);
446 if (ee->engine.wl.shell_surface)
447 {
448 wl_shell_surface_move(ee->engine.wl.shell_surface,
449 ecore_wl_input_device_get(),
450 _ecore_evas_wl_btn_timestamp);
451 }
452
453 if (ee->func.fn_move) ee->func.fn_move(ee); 444 if (ee->func.fn_move) ee->func.fn_move(ee);
454} 445}
455 446
@@ -458,49 +449,44 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
458{ 449{
459 Evas_Engine_Info_Wayland_Shm *einfo; 450 Evas_Engine_Info_Wayland_Shm *einfo;
460 451
461 LOGFN(__FILE__, __LINE__, __FUNCTION__);
462
463 if (!ee) return; 452 if (!ee) return;
464 if (w < 1) w = 1; 453 if (w < 1) w = 1;
465 if (h < 1) h = 1; 454 if (h < 1) h = 1;
466 if ((ee->w == w) && (ee->h == h)) return; 455// if ((ee->w == w) && (ee->h == h)) return;
456
457 LOGFN(__FILE__, __LINE__, __FUNCTION__);
458
459 if (ee->prop.min.w > w) w = ee->prop.min.w;
460 else if (w > ee->prop.max.w) w = ee->prop.max.w;
461 if (ee->prop.min.h > h) h = ee->prop.min.h;
462 else if (h > ee->prop.max.h) h = ee->prop.max.h;
467 463
468 ee->req.w = w; 464 ee->req.w = w;
469 ee->req.h = h; 465 ee->req.h = h;
470 466
471 if (ee->visible) 467// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h);
472 {
473 /* damage old surface, if it exists */
474
475 /* NB: This removes any lingering screen artifacts in the compositor.
476 * This may be a 'HACK' if the issue is actually in the wayland
477 * compositor, but for now lets implement this so we don't have screen
478 * artifacts laying around during a resize */
479 if (ee->engine.wl.surface)
480 wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h);
481 }
482 468
483 /* get engine info */
484 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); 469 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
485 if (einfo->info.dest) 470 if ((einfo) && (einfo->info.dest))
486 { 471 {
487 int ret = 0; 472 int ret = 0;
488 473
489 /* munmap previous engine destination */
490 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); 474 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
475 if (!ret) ERR("Failed to unmap engine destination: %m");
476 }
477 else if (!einfo)
478 {
479 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
480 return;
491 } 481 }
492 482
493 /* free old buffer */
494 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); 483 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
495 ee->engine.wl.buffer = NULL; 484 ee->engine.wl.buffer = NULL;
496 485
497 ee->w = w; 486 ee->w = w;
498 ee->h = h; 487 ee->h = h;
499 488
500 /* create buffer @ new size (also mmaps the new destination) */
501 _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); 489 _ecore_evas_wl_buffer_new(ee, &einfo->info.dest);
502
503 /* flush new buffer fd */
504 ecore_wl_flush(); 490 ecore_wl_flush();
505 491
506 /* change evas output & viewport sizes */ 492 /* change evas output & viewport sizes */
@@ -514,16 +500,13 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
514 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); 500 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
515 501
516 /* damage buffer */ 502 /* damage buffer */
517 wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h); 503// wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h);
518 504
519 if (ee->visible) 505 ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0);
520 { 506 /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */
521 /* damage surface */ 507 /* ecore_wl_flush(); */
522 wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h);
523 508
524 /* if visible, attach to surface */ 509 ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h);
525 wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0);
526 }
527 510
528 if (ee->func.fn_resize) ee->func.fn_resize(ee); 511 if (ee->func.fn_resize) ee->func.fn_resize(ee);
529} 512}
@@ -535,93 +518,64 @@ _ecore_evas_wl_show(Ecore_Evas *ee)
535 518
536 LOGFN(__FILE__, __LINE__, __FUNCTION__); 519 LOGFN(__FILE__, __LINE__, __FUNCTION__);
537 520
538 if (!ee) return; 521 if ((!ee) || (ee->visible)) return;
539 if (ee->visible) return;
540 522
541 /* get engine info */ 523 if (ee->engine.wl.win)
542 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); 524 ecore_wl_window_show(ee->engine.wl.win);
543
544 /* create new surface */
545 ee->engine.wl.surface =
546 wl_compositor_create_surface(ecore_wl_compositor_get());
547 wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window);
548 525
549 /* get new shell surface */ 526 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
550 ee->engine.wl.shell_surface = 527 if (!einfo)
551 wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); 528 {
552 529 ERR("Failed to get Evas Engine Info for '%s'", ee->driver);
553 /* set toplevel */ 530 return;
554 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); 531 }
555 532
556 /* create buffer @ new size (also mmaps the new destination) */
557 _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); 533 _ecore_evas_wl_buffer_new(ee, &einfo->info.dest);
534 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
558 535
559 if (ee->engine.wl.frame) 536 if (ee->engine.wl.frame)
560 { 537 {
561 evas_object_show(ee->engine.wl.frame); 538 evas_object_show(ee->engine.wl.frame);
562 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); 539 evas_object_resize(ee->engine.wl.frame, ee->w, ee->h);
563 } 540 }
564 541
565 /* set new engine destination */
566 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
567
568 /* add configure listener for wayland resize events */
569 wl_shell_surface_add_listener(ee->engine.wl.shell_surface,
570 &_ecore_evas_wl_shell_surface_listener, ee);
571
572 /* flush new buffer fd */
573 ecore_wl_flush(); 542 ecore_wl_flush();
574 543
575 /* attach buffer to surface */ 544 if (ee->engine.wl.win)
576 wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0); 545 ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0);
577
578 /* NB: No need to do a damage here. If we do, we end up w/ screen
579 * artifacts in the compositor */
580 /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */
581 546
582 ee->visible = 1; 547 ee->visible = 1;
583 if (ee->func.fn_show) ee->func.fn_show(ee); 548 if (ee->func.fn_show) ee->func.fn_show(ee);
584} 549}
585 550
586static void 551static void
587_ecore_evas_wl_hide(Ecore_Evas *ee) 552_ecore_evas_wl_hide(Ecore_Evas *ee)
588{ 553{
589 Evas_Engine_Info_Wayland_Shm *einfo; 554 Evas_Engine_Info_Wayland_Shm *einfo;
590 555
591 LOGFN(__FILE__, __LINE__, __FUNCTION__); 556 LOGFN(__FILE__, __LINE__, __FUNCTION__);
592 557
593 if (!ee) return; 558 if ((!ee) || (!ee->visible)) return;
594 if (!ee->visible) return;
595 559
596 /* get engine info */
597 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); 560 einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas);
598 if (einfo->info.dest) 561 if ((einfo) && (einfo->info.dest))
599 { 562 {
600 int ret = 0; 563 int ret = 0;
601 564
602 /* munmap previous engine destination */
603 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); 565 ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h));
604 einfo->info.dest = NULL; 566 if (!ret) ERR("Failed to unmap engine destination: %m");
605 } 567 }
606 568
607 /* free old buffer */
608 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); 569 if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer);
609 ee->engine.wl.buffer = NULL; 570 ee->engine.wl.buffer = NULL;
610 571
611 /* set new engine destination */
612 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); 572 evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
613 573
614 /* destroy shell surface */ 574 ecore_wl_window_hide(ee->engine.wl.win);
615 if (ee->engine.wl.shell_surface)
616 wl_shell_surface_destroy(ee->engine.wl.shell_surface);
617 ee->engine.wl.shell_surface = NULL;
618
619 /* destroy surface */
620 if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface);
621 ee->engine.wl.surface = NULL;
622 575
623 ee->visible = 0; 576 ee->visible = 0;
624 ee->should_be_visible = 0; 577 ee->should_be_visible = 0;
578
625 if (ee->func.fn_hide) ee->func.fn_hide(ee); 579 if (ee->func.fn_hide) ee->func.fn_hide(ee);
626} 580}
627 581
@@ -631,39 +585,18 @@ _ecore_evas_wl_raise(Ecore_Evas *ee)
631 LOGFN(__FILE__, __LINE__, __FUNCTION__); 585 LOGFN(__FILE__, __LINE__, __FUNCTION__);
632 586
633 if ((!ee) || (!ee->visible)) return; 587 if ((!ee) || (!ee->visible)) return;
634 if (!ee->engine.wl.shell_surface) return; 588 ecore_wl_window_raise(ee->engine.wl.win);
635 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
636} 589}
637 590
638static void 591static void
639_ecore_evas_wl_lower(Ecore_Evas *ee) 592_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title)
640{
641 LOGFN(__FILE__, __LINE__, __FUNCTION__);
642
643 if ((!ee) || (!ee->visible)) return;
644 /* FIXME: Need a way to tell Wayland to lower */
645}
646
647static void
648_ecore_evas_wl_activate(Ecore_Evas *ee)
649{
650 LOGFN(__FILE__, __LINE__, __FUNCTION__);
651
652 if ((!ee) || (!ee->visible)) return;
653 if (!ee->engine.wl.shell_surface) return;
654 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface);
655}
656
657static void
658_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t)
659{ 593{
660 LOGFN(__FILE__, __LINE__, __FUNCTION__); 594 LOGFN(__FILE__, __LINE__, __FUNCTION__);
661 595
662 if (!ee) return; 596 if (!ee) return;
663 if (ee->prop.title) free(ee->prop.title); 597 if (ee->prop.title) free(ee->prop.title);
664 ee->prop.title = NULL; 598 ee->prop.title = NULL;
665 if (t) ee->prop.title = strdup(t); 599 if (title) ee->prop.title = strdup(title);
666
667 if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) 600 if ((ee->prop.draw_frame) && (ee->engine.wl.frame))
668 { 601 {
669 EE_Wl_Smart_Data *sd; 602 EE_Wl_Smart_Data *sd;
@@ -741,102 +674,96 @@ _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h)
741} 674}
742 675
743static void 676static void
744_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) 677_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer)
745{ 678{
746 int x = 0, y = 0;
747
748 LOGFN(__FILE__, __LINE__, __FUNCTION__); 679 LOGFN(__FILE__, __LINE__, __FUNCTION__);
749 680
750 if (!ee) return; 681 if (!ee) return;
751 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); 682 if (ee->prop.layer == layer) return;
752 ee->prop.cursor.object = NULL; 683 if (layer < 1) layer = 1;
753 684 else if (layer > 255) layer = 255;
754 if (!obj) 685 ee->prop.layer = layer;
755 {
756 ee->prop.cursor.layer = 0;
757 ee->prop.cursor.hot.x = 0;
758 ee->prop.cursor.hot.y = 0;
759 return;
760 }
761
762 ee->prop.cursor.object = obj;
763 ee->prop.cursor.layer = layer;
764 ee->prop.cursor.hot.x = hot_x;
765 ee->prop.cursor.hot.y = hot_y;
766
767 evas_pointer_output_xy_get(ee->evas, &x, &y);
768 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
769 evas_object_move(ee->prop.cursor.object,
770 x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y);
771 evas_object_pass_events_set(ee->prop.cursor.object, 1);
772 if (evas_pointer_inside_get(ee->evas))
773 evas_object_show(ee->prop.cursor.object);
774
775 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
776 _ecore_evas_wl_object_cursor_del, ee);
777} 686}
778 687
779static void 688static void
780_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) 689_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify)
781{ 690{
782 Ecore_Evas *ee; 691 LOGFN(__FILE__, __LINE__, __FUNCTION__);
783 692
784 if (!(ee = data)) return; 693 if (!ee) return;
785 ee->prop.cursor.object = NULL; 694 if (ee->prop.iconified == iconify) return;
695 ee->prop.iconified = iconify;
696 /* FIXME: Implement this in Wayland someshow */
786} 697}
787 698
788static void 699static void
789_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) 700_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max)
790{ 701{
791 LOGFN(__FILE__, __LINE__, __FUNCTION__); 702 LOGFN(__FILE__, __LINE__, __FUNCTION__);
792 703
793 if (!ee) return; 704 if (!ee) return;
794 if (ee->prop.layer == layer) return; 705 if (ee->prop.maximized == max) return;
795 if (layer < 1) layer = 1; 706 ee->prop.maximized = max;
796 else if (layer > 255) layer = 255; 707 ecore_wl_window_maximized_set(ee->engine.wl.win, max);
797 ee->prop.layer = layer;
798} 708}
799 709
800static void 710static void
801_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) 711_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full)
802{ 712{
803 LOGFN(__FILE__, __LINE__, __FUNCTION__); 713 LOGFN(__FILE__, __LINE__, __FUNCTION__);
804 714
805 if ((!ee) || (!ee->visible)) return; 715 if ((!ee) || (!ee->visible)) return;
806 if (!ee->engine.wl.shell_surface) return; 716 if (ee->prop.fullscreen == full) return;
807 wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); 717 ee->prop.fullscreen = full;
718 ecore_wl_window_fullscreen_set(ee->engine.wl.win, full);
808} 719}
809 720
810static void 721static void
811_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) 722_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore)
812{ 723{
813 LOGFN(__FILE__, __LINE__, __FUNCTION__); 724 LOGFN(__FILE__, __LINE__, __FUNCTION__);
814 725
815 if (!ee) return; 726 if (!ee) return;
816 if (ee->prop.iconified == iconify) return; 727 ee->ignore_events = ignore;
817 ee->prop.iconified = iconify; 728 /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */
818 /* FIXME: Implement this in Wayland someshow */
819} 729}
820 730
821static void 731static void
822_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) 732_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha)
823{ 733{
734 Evas_Engine_Info_Wayland_Shm *einfo;
735
824 LOGFN(__FILE__, __LINE__, __FUNCTION__); 736 LOGFN(__FILE__, __LINE__, __FUNCTION__);
825 737
826 if (!ee) return; 738 if (!ee) return;
827 if (ee->prop.maximized == max) return; 739 if ((ee->alpha == alpha)) return;
828 ee->prop.maximized = max; 740 ee->alpha = alpha;
829 /* FIXME: Implement this in Wayland someshow */ 741 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
742 {
743 einfo->info.destination_alpha = alpha;
744 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
745 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
746 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
747 }
830} 748}
831 749
832static void 750static void
833_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) 751_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent)
834{ 752{
753 Evas_Engine_Info_Wayland_Shm *einfo;
754
835 LOGFN(__FILE__, __LINE__, __FUNCTION__); 755 LOGFN(__FILE__, __LINE__, __FUNCTION__);
836 756
837 if ((!ee) || (!ee->visible)) return; 757 if (!ee) return;
838 if (!ee->engine.wl.shell_surface) return; 758 if ((ee->transparent == transparent)) return;
839 wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface); 759 ee->transparent = transparent;
760 if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas)))
761 {
762 einfo->info.destination_alpha = transparent;
763 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
764 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
765 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
766 }
840} 767}
841 768
842static int 769static int
@@ -845,9 +772,9 @@ _ecore_evas_wl_render(Ecore_Evas *ee)
845 int rend = 0; 772 int rend = 0;
846 773
847 if (!ee) return 0; 774 if (!ee) return 0;
848 if (!ee->visible) 775 if (!ee->visible)
849 evas_norender(ee->evas); 776 evas_norender(ee->evas);
850 else 777 else
851 { 778 {
852 Eina_List *ll = NULL, *updates = NULL; 779 Eina_List *ll = NULL, *updates = NULL;
853 Ecore_Evas *ee2 = NULL; 780 Ecore_Evas *ee2 = NULL;
@@ -867,27 +794,27 @@ _ecore_evas_wl_render(Ecore_Evas *ee)
867 Eina_List *l = NULL; 794 Eina_List *l = NULL;
868 Eina_Rectangle *r; 795 Eina_Rectangle *r;
869 796
797 LOGFN(__FILE__, __LINE__, __FUNCTION__);
798
870 EINA_LIST_FOREACH(updates, l, r) 799 EINA_LIST_FOREACH(updates, l, r)
871 { 800 {
872 if (ee->engine.wl.buffer) 801 if (ee->engine.wl.buffer)
873 wl_buffer_damage(ee->engine.wl.buffer, 802 wl_buffer_damage(ee->engine.wl.buffer,
874 r->x, r->y, r->w, r->h); 803 r->x, r->y, r->w, r->h);
875 804
876 if (ee->engine.wl.surface) 805 ecore_wl_window_damage(ee->engine.wl.win,
877 wl_surface_damage(ee->engine.wl.surface, 806 r->x, r->y, r->w, r->h);
878 r->x, r->y, r->w, r->h);
879 } 807 }
880 808
809 ecore_wl_flush();
810
881 evas_render_updates_free(updates); 811 evas_render_updates_free(updates);
882 _ecore_evas_idle_timeout_update(ee); 812 _ecore_evas_idle_timeout_update(ee);
883 rend = 1; 813 rend = 1;
884
885 ecore_wl_flush();
886 } 814 }
887 815
888 if (ee->func.fn_post_render) ee->func.fn_post_render(ee); 816 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
889 } 817 }
890
891 return rend; 818 return rend;
892} 819}
893 820
@@ -901,77 +828,67 @@ _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int
901 ecore_wl_screen_size_get(w, h); 828 ecore_wl_screen_size_get(w, h);
902} 829}
903 830
904static Eina_Bool 831static void
905_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) 832_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest)
906{ 833{
907 Ecore_Evas *ee; 834 struct wl_shm *shm;
908 Ecore_Event_Mouse_Button *ev; 835 static unsigned int format;
836 char tmp[PATH_MAX];
837 int fd = -1, stride = 0, size = 0;
838 void *ret;
909 839
910 LOGFN(__FILE__, __LINE__, __FUNCTION__); 840 LOGFN(__FILE__, __LINE__, __FUNCTION__);
911 841
912 ev = event; 842 if (dest) *dest = NULL;
913 _ecore_evas_wl_btn_timestamp = ev->timestamp; 843 if (!(shm = ecore_wl_shm_get())) return;
914 ee = ecore_event_window_match(ev->window); 844 if (!format) format = WL_SHM_FORMAT_ARGB8888; //ecore_wl_format_get();
915 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
916 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
917 evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers,
918 ev->timestamp, NULL);
919 return ECORE_CALLBACK_PASS_ON;
920}
921 845
922static Eina_Bool 846 strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX");
923_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) 847 if ((fd = mkstemp(tmp)) < 0)
924{ 848 {
925 Ecore_Evas *ee; 849 ERR("Could not create temporary file.");
926 Ecore_Event_Mouse_Button *ev; 850 return;
851 }
927 852
928 LOGFN(__FILE__, __LINE__, __FUNCTION__); 853 stride = (ee->w * sizeof(int));
854 size = (stride * ee->h);
855 if (ftruncate(fd, size) < 0)
856 {
857 ERR("Could not truncate temporary file.");
858 close(fd);
859 return;
860 }
929 861
930 ev = event; 862 ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
931 ee = ecore_event_window_match(ev->window); 863 unlink(tmp);
932 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
933 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
934 evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers,
935 ev->timestamp, NULL);
936 return ECORE_CALLBACK_PASS_ON;
937}
938 864
939static Eina_Bool 865 if (ret == MAP_FAILED)
940_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) 866 {
941{ 867 ERR("mmap of temporary file failed.");
942 Ecore_Evas *ee; 868 close(fd);
943 Ecore_Event_Mouse_Move *ev; 869 return;
870 }
944 871
945 ev = event; 872 if (dest) *dest = ret;
946 ee = ecore_event_window_match(ev->window); 873
947 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 874 ee->engine.wl.buffer =
948 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 875 wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format);
949 ee->mouse.x = ev->x; 876
950 ee->mouse.y = ev->y; 877 close(fd);
951 evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL);
952 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
953 return ECORE_CALLBACK_PASS_ON;
954} 878}
955 879
956static Eina_Bool 880void
957_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) 881_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
958{ 882{
959 Ecore_Evas *ee;
960 Ecore_Event_Mouse_Wheel *ev;
961
962 LOGFN(__FILE__, __LINE__, __FUNCTION__); 883 LOGFN(__FILE__, __LINE__, __FUNCTION__);
963 884
964 ev = event; 885 if (!ee) return;
965 ee = ecore_event_window_match(ev->window); 886 if (ee->engine.wl.win)
966 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 887 ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location);
967 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
968 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z,
969 ev->timestamp, NULL);
970 return ECORE_CALLBACK_PASS_ON;
971} 888}
972 889
973static Eina_Bool 890static Eina_Bool
974_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) 891_ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
975{ 892{
976 Ecore_Evas *ee; 893 Ecore_Evas *ee;
977 Ecore_Wl_Event_Mouse_In *ev; 894 Ecore_Wl_Event_Mouse_In *ev;
@@ -979,18 +896,18 @@ _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *
979 LOGFN(__FILE__, __LINE__, __FUNCTION__); 896 LOGFN(__FILE__, __LINE__, __FUNCTION__);
980 897
981 ev = event; 898 ev = event;
982 ee = ecore_event_window_match(ev->window); 899 ee = ecore_event_window_match(ev->win);
983 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 900 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
984 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 901 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
985 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); 902 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
986 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); 903 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
987 evas_event_feed_mouse_in(ee->evas, ev->time, NULL); 904 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
988 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); 905 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
989 return ECORE_CALLBACK_PASS_ON; 906 return ECORE_CALLBACK_PASS_ON;
990} 907}
991 908
992static Eina_Bool 909static Eina_Bool
993_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) 910_ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
994{ 911{
995 Ecore_Evas *ee; 912 Ecore_Evas *ee;
996 Ecore_Wl_Event_Mouse_Out *ev; 913 Ecore_Wl_Event_Mouse_Out *ev;
@@ -998,19 +915,19 @@ _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void
998 LOGFN(__FILE__, __LINE__, __FUNCTION__); 915 LOGFN(__FILE__, __LINE__, __FUNCTION__);
999 916
1000 ev = event; 917 ev = event;
1001 ee = ecore_event_window_match(ev->window); 918 ee = ecore_event_window_match(ev->win);
1002 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 919 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1003 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 920 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1004 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); 921 ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
1005 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); 922 _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
1006 evas_event_feed_mouse_out(ee->evas, ev->time, NULL); 923 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
1007 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); 924 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
1008 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); 925 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
1009 return ECORE_CALLBACK_PASS_ON; 926 return ECORE_CALLBACK_PASS_ON;
1010} 927}
1011 928
1012static Eina_Bool 929static Eina_Bool
1013_ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) 930_ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
1014{ 931{
1015 Ecore_Evas *ee; 932 Ecore_Evas *ee;
1016 Ecore_Wl_Event_Focus_In *ev; 933 Ecore_Wl_Event_Focus_In *ev;
@@ -1018,9 +935,9 @@ _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *
1018 LOGFN(__FILE__, __LINE__, __FUNCTION__); 935 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1019 936
1020 ev = event; 937 ev = event;
1021 ee = ecore_event_window_match(ev->window); 938 ee = ecore_event_window_match(ev->win);
1022 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 939 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1023 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 940 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1024 ee->prop.focused = 1; 941 ee->prop.focused = 1;
1025 evas_focus_in(ee->evas); 942 evas_focus_in(ee->evas);
1026 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); 943 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
@@ -1028,92 +945,53 @@ _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *
1028} 945}
1029 946
1030static Eina_Bool 947static Eina_Bool
1031_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) 948_ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
1032{ 949{
1033 Ecore_Evas *ee; 950 Ecore_Evas *ee;
1034 Ecore_Wl_Event_Focus_Out *ev; 951 Ecore_Wl_Event_Focus_In *ev;
1035 952
1036 LOGFN(__FILE__, __LINE__, __FUNCTION__); 953 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1037 954
1038 ev = event; 955 ev = event;
1039 ee = ecore_event_window_match(ev->window); 956 ee = ecore_event_window_match(ev->win);
1040 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 957 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
1041 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 958 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1042 evas_focus_out(ee->evas); 959 evas_focus_out(ee->evas);
1043 ee->prop.focused = 0; 960 ee->prop.focused = 0;
1044 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); 961 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
1045 return ECORE_CALLBACK_PASS_ON; 962 return ECORE_CALLBACK_PASS_ON;
1046} 963}
1047 964
1048static void 965static Eina_Bool
1049_ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height) 966_ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event)
1050{ 967{
1051 Ecore_Evas *ee; 968 Ecore_Evas *ee;
1052 969 Ecore_Wl_Event_Window_Configure *ev;
1053 /* NB: Trap to prevent compositor from crashing */
1054 if ((width <= 0) || (height <= 0)) return;
1055
1056 if (!(ee = data)) return;
1057
1058 if ((shell_surface) && (ee->engine.wl.shell_surface))
1059 {
1060 if (ee->engine.wl.shell_surface != shell_surface) return;
1061 ecore_evas_resize(ee, width, height);
1062 }
1063}
1064
1065static void
1066_ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__)
1067{
1068
1069}
1070
1071static void
1072_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest)
1073{
1074 static unsigned int format;
1075 char tmp[PATH_MAX];
1076 int fd = -1, stride = 0, size = 0;
1077 void *ret;
1078 970
1079 LOGFN(__FILE__, __LINE__, __FUNCTION__); 971 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1080 972
1081 if (dest) *dest = NULL; 973 ev = event;
1082 974 ee = ecore_event_window_match(ev->win);
1083 if (!format) format = ecore_wl_format_get(); 975 if (!ee) return ECORE_CALLBACK_PASS_ON;
1084 976 if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1085 strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX"); 977 if ((ee->x != ev->x) || (ee->y != ev->y))
1086 if ((fd = mkstemp(tmp)) < 0)
1087 {
1088 ERR("Could not create temporary file.");
1089 return;
1090 }
1091
1092 stride = (ee->w * sizeof(int));
1093 size = (stride * ee->h);
1094 if (ftruncate(fd, size) < 0)
1095 { 978 {
1096 ERR("Could not truncate temporary file."); 979 ee->x = ev->x;
1097 close(fd); 980 ee->y = ev->y;
1098 return; 981 ee->req.x = ee->x;
982 ee->req.y = ee->y;
983 if (ee->func.fn_move) ee->func.fn_move(ee);
1099 } 984 }
1100 985 if ((ee->req.w != ev->w) || (ee->req.h != ev->h))
1101 ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
1102 unlink(tmp);
1103
1104 if (ret == MAP_FAILED)
1105 { 986 {
1106 ERR("mmap of temporary file failed."); 987 /* ee->w = ev->w; */
1107 close(fd); 988 /* ee->h = ev->h; */
1108 return; 989 ee->req.w = ev->w;
990 ee->req.h = ev->h;
991 if (ee->func.fn_resize) ee->func.fn_resize(ee);
1109 } 992 }
1110 993
1111 if (dest) *dest = ret; 994 return ECORE_CALLBACK_PASS_ON;
1112
1113 ee->engine.wl.buffer =
1114 wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format);
1115
1116 close(fd);
1117} 995}
1118 996
1119static void 997static void
@@ -1227,30 +1105,9 @@ _ecore_evas_wl_frame_add(Evas *evas)
1227 return evas_object_smart_add(evas, _ecore_evas_wl_smart); 1105 return evas_object_smart_add(evas, _ecore_evas_wl_smart);
1228} 1106}
1229 1107
1230void
1231_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location)
1232{
1233 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1234
1235 if ((!ee) || (!ee->engine.wl.shell_surface)) return;
1236 wl_shell_surface_resize(ee->engine.wl.shell_surface,
1237 ecore_wl_input_device_get(),
1238 _ecore_evas_wl_btn_timestamp, location);
1239}
1240
1241void
1242_ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source)
1243{
1244 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1245
1246 if ((!ee) || (!ee->engine.wl.surface)) return;
1247 if ((!source) || (!drag_ee)) return;
1248 ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer);
1249}
1250
1251#else 1108#else
1252EAPI Ecore_Evas * 1109EAPI Ecore_Evas *
1253ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__) 1110ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, unsigned int parent __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, Eina_Bool frame __UNUSED__)
1254{ 1111{
1255 return NULL; 1112 return NULL;
1256} 1113}
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c
index cfec528..32132b3 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c
@@ -420,7 +420,7 @@ _ecore_evas_win32_free(Ecore_Evas *ee)
420 420
421static void 421static void
422_ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee, 422_ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee,
423 void (*func) (Ecore_Evas *ee)) 423 Ecore_Evas_Event_Cb func)
424{ 424{
425 ee->func.fn_delete_request = func; 425 ee->func.fn_delete_request = func;
426} 426}
@@ -717,7 +717,7 @@ _ecore_evas_win32_activate(Ecore_Evas *ee)
717{ 717{
718 INF("ecore evas activate"); 718 INF("ecore evas activate");
719 719
720 ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); 720 ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window);
721} 721}
722 722
723static void 723static void
@@ -819,7 +819,7 @@ _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho
819static void 819static void
820_ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__) 820_ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__)
821{ 821{
822 ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); 822 ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window);
823} 823}
824 824
825static void 825static void
@@ -879,18 +879,12 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on)
879 879
880 if (on != 0) 880 if (on != 0)
881 { 881 {
882 ecore_win32_window_shape_set((struct _Ecore_Win32_Window *)ee->prop.window,
883 0, 0, NULL);
884 ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, 882 ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window,
885 on); 883 on);
886 } 884 }
887 else 885 else
888 { 886 {
889 ecore_win32_window_fullscreen_set(window, on); 887 ecore_win32_window_fullscreen_set(window, on);
890 ecore_win32_window_shape_set(window,
891 window->shape.width,
892 window->shape.height,
893 window->shape.mask);
894 } 888 }
895 889
896 /* Nothing to be done for the GDI backend at the evas level */ 890 /* Nothing to be done for the GDI backend at the evas level */
@@ -982,6 +976,13 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
982 NULL, /* _ecore_evas_x_alpha_set */ 976 NULL, /* _ecore_evas_x_alpha_set */
983 NULL, //transparent 977 NULL, //transparent
984 978
979 NULL,
980 NULL,
981 NULL,
982 NULL,
983 NULL,
984 NULL,
985
985 NULL, // render 986 NULL, // render
986 NULL //screen_geometry_get 987 NULL //screen_geometry_get
987}; 988};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
index e102cb7..fecf26b 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
@@ -345,7 +345,7 @@ _ecore_evas_wince_free(Ecore_Evas *ee)
345 345
346static void 346static void
347_ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee, 347_ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee,
348 void (*func) (Ecore_Evas *ee)) 348 Ecore_Evas_Event_Cb func)
349{ 349{
350 ee->func.fn_delete_request = func; 350 ee->func.fn_delete_request = func;
351} 351}
@@ -641,11 +641,11 @@ _ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho
641#endif 641#endif
642} 642}
643 643
644/* static void */ 644static void
645/* _ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__) */ 645_ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__)
646/* { */ 646{
647/* ecore_wince_window_focus_set(ee->prop.window); */ 647 ecore_wince_window_focus(ee->prop.window);
648/* } */ 648}
649 649
650/* static void */ 650/* static void */
651/* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */ 651/* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */
@@ -760,7 +760,7 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
760 NULL, //_ecore_evas_wince_size_step_set, 760 NULL, //_ecore_evas_wince_size_step_set,
761 _ecore_evas_wince_cursor_set, 761 _ecore_evas_wince_cursor_set,
762 NULL, /* _ecore_evas_x_layer_set */ 762 NULL, /* _ecore_evas_x_layer_set */
763 NULL, //_ecore_evas_wince_focus_set, 763 _ecore_evas_wince_focus_set,
764 NULL, //_ecore_evas_wince_iconified_set, 764 NULL, //_ecore_evas_wince_iconified_set,
765 NULL, //_ecore_evas_wince_borderless_set, 765 NULL, //_ecore_evas_wince_borderless_set,
766 NULL, /* _ecore_evas_x_override_set */ 766 NULL, /* _ecore_evas_x_override_set */
@@ -773,6 +773,13 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
773 NULL, /* _ecore_evas_x_alpha_set */ 773 NULL, /* _ecore_evas_x_alpha_set */
774 NULL, //transparent 774 NULL, //transparent
775 775
776 NULL,
777 NULL,
778 NULL,
779 NULL,
780 NULL,
781 NULL,
782
776 NULL, // render 783 NULL, // render
777 NULL // screen_geometry_get 784 NULL // screen_geometry_get
778}; 785};
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c
index 7d3af12..6dd13de 100644
--- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c
@@ -20,6 +20,22 @@ static int leader_ref = 0;
20static Ecore_X_Window leader_win = 0; 20static Ecore_X_Window leader_win = 0;
21 21
22static void 22static void
23_ecore_evas_x_hints_update(Ecore_Evas *ee)
24{
25 ecore_x_icccm_hints_set
26 (ee->prop.window,
27 !ee->prop.focus_skip /* accepts_focus */,
28 ee->prop.iconified ? ECORE_X_WINDOW_STATE_HINT_ICONIC :
29 ee->prop.withdrawn ? ECORE_X_WINDOW_STATE_HINT_WITHDRAWN :
30 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
31 0 /* icon_pixmap */,
32 0 /* icon_mask */,
33 0 /* icon_window */,
34 ee->prop.group_ee_win /* window_group */,
35 ee->prop.urgent /* is_urgent */);
36}
37
38static void
23_ecore_evas_x_group_leader_set(Ecore_Evas *ee) 39_ecore_evas_x_group_leader_set(Ecore_Evas *ee)
24{ 40{
25 leader_ref++; 41 leader_ref++;
@@ -537,6 +553,7 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__,
537{ 553{
538 Ecore_Evas *ee; 554 Ecore_Evas *ee;
539 Ecore_X_Event_Window_Property *e; 555 Ecore_X_Event_Window_Property *e;
556 int state_change = 0;
540 557
541 e = event; 558 e = event;
542 ee = ecore_event_window_match(e->win); 559 ee = ecore_event_window_match(e->win);
@@ -546,20 +563,62 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__,
546 { 563 {
547 unsigned int i, num; 564 unsigned int i, num;
548 Ecore_X_Window_State *state; 565 Ecore_X_Window_State *state;
549 int sticky = 0; 566 struct {
550 567 struct {
551 /* TODO: we need to move those to the end, with if statements */ 568 unsigned char modal : 1;
552 ee->engine.x.state.modal = 0; 569 unsigned char sticky : 1;
553 ee->engine.x.state.maximized_v = 0; 570 unsigned char maximized_v : 1;
554 ee->engine.x.state.maximized_h = 0; 571 unsigned char maximized_h : 1;
555 ee->engine.x.state.shaded = 0; 572 unsigned char shaded : 1;
573 unsigned char skip_taskbar : 1;
574 unsigned char skip_pager : 1;
575 unsigned char fullscreen : 1;
576 unsigned char above : 1;
577 unsigned char below : 1;
578 } x;
579 struct {
580 char modal : 1;
581 char maximized : 1;
582 char sticky : 1;
583 char fullscreen : 1;
584 char focus_skip : 1;
585 } prop;
586 } prev;
587
588 prev.x.modal = ee->engine.x.state.modal;
589 prev.x.sticky = ee->engine.x.state.sticky;
590 prev.x.maximized_v = ee->engine.x.state.maximized_v;
591 prev.x.maximized_h = ee->engine.x.state.maximized_h;
592 prev.x.shaded = ee->engine.x.state.shaded;
593 prev.x.skip_taskbar = ee->engine.x.state.skip_taskbar;
594 prev.x.skip_pager = ee->engine.x.state.skip_pager;
595 prev.x.fullscreen = ee->engine.x.state.fullscreen;
596 prev.x.above = ee->engine.x.state.above;
597 prev.x.below = ee->engine.x.state.below;
598
599 prev.prop.modal = ee->prop.modal;
600 prev.prop.maximized = ee->prop.maximized;
601 prev.prop.sticky = ee->prop.sticky;
602 prev.prop.fullscreen = ee->prop.fullscreen;
603 prev.prop.focus_skip = ee->prop.focus_skip;
604
605 ee->engine.x.state.modal = 0;
606 ee->engine.x.state.sticky = 0;
607 ee->engine.x.state.maximized_v = 0;
608 ee->engine.x.state.maximized_h = 0;
609 ee->engine.x.state.shaded = 0;
556 ee->engine.x.state.skip_taskbar = 0; 610 ee->engine.x.state.skip_taskbar = 0;
557 ee->engine.x.state.skip_pager = 0; 611 ee->engine.x.state.skip_pager = 0;
612 ee->engine.x.state.fullscreen = 0;
613 ee->engine.x.state.above = 0;
614 ee->engine.x.state.below = 0;
615
616 ee->prop.modal = 0;
617 ee->prop.maximized = 0;
618 ee->prop.sticky = 0;
558 ee->prop.fullscreen = 0; 619 ee->prop.fullscreen = 0;
559 ee->engine.x.state.fullscreen = 0; 620 ee->prop.focus_skip = 0;
560 ee->engine.x.state.above = 0; 621
561 ee->engine.x.state.below = 0;
562
563 ecore_x_netwm_window_state_get(e->win, &state, &num); 622 ecore_x_netwm_window_state_get(e->win, &state, &num);
564 if (state) 623 if (state)
565 { 624 {
@@ -568,56 +627,106 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__,
568 switch (state[i]) 627 switch (state[i])
569 { 628 {
570 case ECORE_X_WINDOW_STATE_MODAL: 629 case ECORE_X_WINDOW_STATE_MODAL:
571 ee->engine.x.state.modal = 1; 630 ee->engine.x.state.modal = 1;
572 break; 631 ee->prop.modal = 1;
632 break;
573 case ECORE_X_WINDOW_STATE_STICKY: 633 case ECORE_X_WINDOW_STATE_STICKY:
574 if (ee->prop.sticky && ee->engine.x.state.sticky) 634 ee->prop.sticky = 1;
575 break; 635 ee->engine.x.state.sticky = 1;
576 636 break;
577 sticky = 1;
578 ee->prop.sticky = 1;
579 ee->engine.x.state.sticky = 1;
580 if (ee->func.fn_sticky) ee->func.fn_sticky(ee);
581 break;
582 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: 637 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
583 ee->engine.x.state.maximized_v = 1; 638 ee->engine.x.state.maximized_v = 1;
584 break; 639 ee->prop.maximized = 1;
640 break;
585 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: 641 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
586 ee->engine.x.state.maximized_h = 1; 642 ee->engine.x.state.maximized_h = 1;
587 break; 643 ee->prop.maximized = 1;
644 break;
588 case ECORE_X_WINDOW_STATE_SHADED: 645 case ECORE_X_WINDOW_STATE_SHADED:
589 ee->engine.x.state.shaded = 1; 646 ee->engine.x.state.shaded = 1;
590 break; 647 break;
591 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: 648 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
592 ee->engine.x.state.skip_taskbar = 1; 649 ee->engine.x.state.skip_taskbar = 1;
593 break; 650 ee->prop.focus_skip = 1;
651 break;
594 case ECORE_X_WINDOW_STATE_SKIP_PAGER: 652 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
595 ee->engine.x.state.skip_pager = 1; 653 ee->engine.x.state.skip_pager = 1;
596 break; 654 ee->prop.focus_skip = 1;
655 break;
597 case ECORE_X_WINDOW_STATE_FULLSCREEN: 656 case ECORE_X_WINDOW_STATE_FULLSCREEN:
598 ee->prop.fullscreen = 1; 657 ee->prop.fullscreen = 1;
599 ee->engine.x.state.fullscreen = 1; 658 ee->engine.x.state.fullscreen = 1;
600 break; 659 break;
601 case ECORE_X_WINDOW_STATE_ABOVE: 660 case ECORE_X_WINDOW_STATE_ABOVE:
602 ee->engine.x.state.above = 1; 661 ee->engine.x.state.above = 1;
603 break; 662 break;
604 case ECORE_X_WINDOW_STATE_BELOW: 663 case ECORE_X_WINDOW_STATE_BELOW:
605 ee->engine.x.state.below = 1; 664 ee->engine.x.state.below = 1;
606 break; 665 break;
607 default: 666 default:
608 break; 667 break;
609 } 668 }
610 } 669 }
611 free(state); 670 free(state);
612 } 671 }
613 672 if (
614 if ((ee->prop.sticky) && (!sticky)) 673// (prev.x.modal != ee->engine.x.state.modal) ||
674 (prev.x.sticky != ee->engine.x.state.sticky) ||
675 (prev.x.maximized_v != ee->engine.x.state.maximized_v) ||
676 (prev.x.maximized_h != ee->engine.x.state.maximized_h) ||
677// (prev.x.shaded != ee->engine.x.state.shaded) ||
678// (prev.x.skip_taskbar != ee->engine.x.state.skip_taskbar) ||
679// (prev.x.skip_pager != ee->engine.x.state.skip_pager) ||
680 (prev.x.fullscreen != ee->engine.x.state.fullscreen) ||
681// (prev.x.above != ee->engine.x.state.above) ||
682// (prev.x.below != ee->engine.x.state.below) ||
683// (prev.prop.modal != ee->prop.modal) ||
684 (prev.prop.maximized != ee->prop.maximized) ||
685 (prev.prop.sticky != ee->prop.sticky) ||
686 (prev.prop.fullscreen != ee->prop.fullscreen) ||
687 (prev.prop.focus_skip != ee->prop.focus_skip))
688 state_change = 1;
689 }
690 else if (e->atom == ECORE_X_ATOM_WM_STATE)
691 {
692 Ecore_X_Window_State_Hint state;
693
694 // handle WM_STATE changes
695 state = ecore_x_icccm_state_get(e->win);
696 switch (state)
615 { 697 {
616 ee->prop.sticky = 0; 698 case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN:
617 ee->engine.x.state.sticky = 0; 699 if ((!ee->prop.withdrawn) || (ee->prop.iconified))
618 if (ee->func.fn_unsticky) ee->func.fn_unsticky(ee); 700 {
701 state_change = 1;
702 ee->prop.withdrawn = 1;
703 ee->prop.iconified = 0;
704 }
705 break;
706 case ECORE_X_WINDOW_STATE_HINT_ICONIC:
707 if ((!ee->prop.iconified) || (ee->prop.withdrawn))
708 {
709 state_change = 1;
710 ee->prop.iconified = 1;
711 ee->prop.withdrawn = 0;
712 }
713 break;
714 case ECORE_X_WINDOW_STATE_HINT_NORMAL:
715 if ((ee->prop.iconified) || (ee->prop.withdrawn))
716 {
717 state_change = 1;
718 ee->prop.iconified = 0;
719 ee->prop.withdrawn = 0;
720 }
721 break;
722 default:
723 break;
619 } 724 }
620 } 725 }
726 if (state_change)
727 {
728 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
729 }
621 730
622 return ECORE_CALLBACK_PASS_ON; 731 return ECORE_CALLBACK_PASS_ON;
623} 732}
@@ -826,7 +935,8 @@ _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__,
826 ee = ecore_event_window_match(e->win); 935 ee = ecore_event_window_match(e->win);
827 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ 936 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
828 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 937 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
829 if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; 938//xx// filtering with these doesnt help
939//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON;
830 ee->prop.focused = 1; 940 ee->prop.focused = 1;
831 evas_focus_in(ee->evas); 941 evas_focus_in(ee->evas);
832 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); 942 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
@@ -843,7 +953,9 @@ _ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__,
843 ee = ecore_event_window_match(e->win); 953 ee = ecore_event_window_match(e->win);
844 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ 954 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */
845 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 955 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
846 if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; 956//xx// filtering with these doesnt help
957//xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON;
958
847// if (ee->prop.fullscreen) 959// if (ee->prop.fullscreen)
848// ecore_x_window_focus(ee->prop.window); 960// ecore_x_window_focus(ee->prop.window);
849 evas_focus_out(ee->evas); 961 evas_focus_out(ee->evas);
@@ -1078,8 +1190,8 @@ _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee)
1078 ee->prop.base.h /* base_h */, 1190 ee->prop.base.h /* base_h */,
1079 ee->prop.step.w /* step_x */, 1191 ee->prop.step.w /* step_x */,
1080 ee->prop.step.h /* step_y */, 1192 ee->prop.step.h /* step_y */,
1081 0 /* min_aspect */, 1193 ee->prop.aspect /* min_aspect */,
1082 0 /* max_aspect */); 1194 ee->prop.aspect /* max_aspect */);
1083} 1195}
1084 1196
1085/* FIXME, should be in idler */ 1197/* FIXME, should be in idler */
@@ -1089,32 +1201,30 @@ _ecore_evas_x_state_update(Ecore_Evas *ee)
1089 Ecore_X_Window_State state[10]; 1201 Ecore_X_Window_State state[10];
1090 int num = 0; 1202 int num = 0;
1091 1203
1092 /* 1204 if (ee->prop.modal)
1093 if (bd->client.netwm.state.modal)
1094 state[num++] = ECORE_X_WINDOW_STATE_MODAL; 1205 state[num++] = ECORE_X_WINDOW_STATE_MODAL;
1095 */ 1206 if (ee->prop.sticky)
1096 if (ee->engine.x.state.sticky)
1097 state[num++] = ECORE_X_WINDOW_STATE_STICKY; 1207 state[num++] = ECORE_X_WINDOW_STATE_STICKY;
1098 /* 1208 if (ee->prop.maximized)
1099 if (bd->client.netwm.state.maximized_v)
1100 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; 1209 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
1101 if (bd->client.netwm.state.maximized_h) 1210 if (ee->prop.maximized)
1102 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; 1211 state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
1103 if (bd->client.netwm.state.shaded) 1212// if (bd->client.netwm.state.shaded)
1104 state[num++] = ECORE_X_WINDOW_STATE_SHADED; 1213// state[num++] = ECORE_X_WINDOW_STATE_SHADED;
1105 if (bd->client.netwm.state.skip_taskbar) 1214 if (ee->prop.focus_skip)
1106 state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; 1215 state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
1107 if (bd->client.netwm.state.skip_pager) 1216 if (ee->prop.focus_skip)
1108 state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER; 1217 state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
1109 if (bd->client.netwm.state.hidden) 1218// if (bd->client.netwm.state.hidden)
1110 state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; 1219// state[num++] = ECORE_X_WINDOW_STATE_HIDDEN;
1111 */
1112 if (ee->engine.x.state.fullscreen) 1220 if (ee->engine.x.state.fullscreen)
1113 state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN; 1221 state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN;
1114 if (ee->engine.x.state.above) 1222 if (ee->engine.x.state.above)
1115 state[num++] = ECORE_X_WINDOW_STATE_ABOVE; 1223 state[num++] = ECORE_X_WINDOW_STATE_ABOVE;
1116 if (ee->engine.x.state.below) 1224 if (ee->engine.x.state.below)
1117 state[num++] = ECORE_X_WINDOW_STATE_BELOW; 1225 state[num++] = ECORE_X_WINDOW_STATE_BELOW;
1226 if (ee->prop.demand_attention)
1227 state[num++] = ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
1118 1228
1119 ecore_x_netwm_window_state_set(ee->prop.window, state, num); 1229 ecore_x_netwm_window_state_set(ee->prop.window, state, num);
1120} 1230}
@@ -1292,7 +1402,7 @@ _ecore_evas_x_free(Ecore_Evas *ee)
1292} 1402}
1293 1403
1294static void 1404static void
1295_ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) 1405_ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1296{ 1406{
1297 ee->func.fn_delete_request = func; 1407 ee->func.fn_delete_request = func;
1298 _ecore_evas_x_protocols_set(ee); 1408 _ecore_evas_x_protocols_set(ee);
@@ -1578,6 +1688,10 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
1578static void 1688static void
1579_ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) 1689_ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1580{ 1690{
1691 int angles[2];
1692 angles[0] = rotation;
1693 angles[1] = ee->rotation;
1694
1581 if (ee->rotation == rotation) return; 1695 if (ee->rotation == rotation) return;
1582 if (!strcmp(ee->driver, "opengl_x11")) 1696 if (!strcmp(ee->driver, "opengl_x11"))
1583 { 1697 {
@@ -1589,6 +1703,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1589 einfo->info.rotation = rotation; 1703 einfo->info.rotation = rotation;
1590 _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 1704 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1591 (Evas_Engine_Info *)einfo); 1705 (Evas_Engine_Info *)einfo);
1706 ecore_x_window_prop_property_set(ee->prop.window,
1707 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1708 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1592#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ 1709#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
1593 } 1710 }
1594 else if (!strcmp(ee->driver, "software_x11")) 1711 else if (!strcmp(ee->driver, "software_x11"))
@@ -1601,6 +1718,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1601 einfo->info.rotation = rotation; 1718 einfo->info.rotation = rotation;
1602 _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 1719 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1603 (Evas_Engine_Info *)einfo); 1720 (Evas_Engine_Info *)einfo);
1721 ecore_x_window_prop_property_set(ee->prop.window,
1722 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1723 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1604#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ 1724#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
1605 } 1725 }
1606 else if (!strcmp(ee->driver, "software_16_x11")) 1726 else if (!strcmp(ee->driver, "software_16_x11"))
@@ -1613,6 +1733,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1613 einfo->info.rotation = rotation; 1733 einfo->info.rotation = rotation;
1614 _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 1734 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1615 (Evas_Engine_Info *)einfo); 1735 (Evas_Engine_Info *)einfo);
1736 ecore_x_window_prop_property_set(ee->prop.window,
1737 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1738 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1616#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ 1739#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
1617 } 1740 }
1618 else if (!strcmp(ee->driver, "software_8_x11")) 1741 else if (!strcmp(ee->driver, "software_8_x11"))
@@ -1625,6 +1748,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
1625 einfo->info.rotation = rotation; 1748 einfo->info.rotation = rotation;
1626 _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 1749 _ecore_evas_x_rotation_set_internal(ee, rotation, resize,
1627 (Evas_Engine_Info *)einfo); 1750 (Evas_Engine_Info *)einfo);
1751 ecore_x_window_prop_property_set(ee->prop.window,
1752 ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
1753 ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
1628#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ 1754#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
1629 } 1755 }
1630} 1756}
@@ -1839,14 +1965,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
1839 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); 1965 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1840 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); 1966 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1841 } 1967 }
1842 ecore_x_icccm_hints_set(ee->prop.window, 1968 _ecore_evas_x_hints_update(ee);
1843 1 /* accepts_focus */,
1844 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
1845 0 /* icon_pixmap */,
1846 0 /* icon_mask */,
1847 0 /* icon_window */,
1848 0 /* window_group */,
1849 0 /* is_urgent */);
1850 _ecore_evas_x_group_leader_update(ee); 1969 _ecore_evas_x_group_leader_update(ee);
1851 ecore_x_window_defaults_set(ee->prop.window); 1970 ecore_x_window_defaults_set(ee->prop.window);
1852 _ecore_evas_x_protocols_set(ee); 1971 _ecore_evas_x_protocols_set(ee);
@@ -1962,14 +2081,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
1962 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); 2081 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
1963 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); 2082 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
1964 } 2083 }
1965 ecore_x_icccm_hints_set(ee->prop.window, 2084 _ecore_evas_x_hints_update(ee);
1966 1 /* accepts_focus */,
1967 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
1968 0 /* icon_pixmap */,
1969 0 /* icon_mask */,
1970 0 /* icon_window */,
1971 0 /* window_group */,
1972 0 /* is_urgent */);
1973 _ecore_evas_x_group_leader_update(ee); 2085 _ecore_evas_x_group_leader_update(ee);
1974 ecore_x_window_defaults_set(ee->prop.window); 2086 ecore_x_window_defaults_set(ee->prop.window);
1975 _ecore_evas_x_protocols_set(ee); 2087 _ecore_evas_x_protocols_set(ee);
@@ -2048,14 +2160,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
2048 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); 2160 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2049 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); 2161 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2050 } 2162 }
2051 ecore_x_icccm_hints_set(ee->prop.window, 2163 _ecore_evas_x_hints_update(ee);
2052 1 /* accepts_focus */,
2053 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2054 0 /* icon_pixmap */,
2055 0 /* icon_mask */,
2056 0 /* icon_window */,
2057 0 /* window_group */,
2058 0 /* is_urgent */);
2059 _ecore_evas_x_group_leader_update(ee); 2164 _ecore_evas_x_group_leader_update(ee);
2060 ecore_x_window_defaults_set(ee->prop.window); 2165 ecore_x_window_defaults_set(ee->prop.window);
2061 _ecore_evas_x_protocols_set(ee); 2166 _ecore_evas_x_protocols_set(ee);
@@ -2134,14 +2239,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
2134 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); 2239 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
2135 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); 2240 ecore_x_netwm_name_set(ee->prop.window, ee->prop.title);
2136 } 2241 }
2137 ecore_x_icccm_hints_set(ee->prop.window, 2242 _ecore_evas_x_hints_update(ee);
2138 1 /* accepts_focus */,
2139 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2140 0 /* icon_pixmap */,
2141 0 /* icon_mask */,
2142 0 /* icon_window */,
2143 0 /* window_group */,
2144 0 /* is_urgent */);
2145 _ecore_evas_x_group_leader_update(ee); 2243 _ecore_evas_x_group_leader_update(ee);
2146 ecore_x_window_defaults_set(ee->prop.window); 2244 ecore_x_window_defaults_set(ee->prop.window);
2147 _ecore_evas_x_protocols_set(ee); 2245 _ecore_evas_x_protocols_set(ee);
@@ -2182,6 +2280,88 @@ _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent)
2182#endif 2280#endif
2183 } 2281 }
2184} 2282}
2283
2284static void
2285_ecore_evas_x_window_group_set(Ecore_Evas *ee, const Ecore_Evas *group_ee)
2286{
2287 if (ee->prop.group_ee == group_ee) return;
2288
2289 ee->prop.group_ee = (Ecore_Evas *)group_ee;
2290 if (ee->prop.group_ee)
2291 ee->prop.group_ee_win = group_ee->prop.window;
2292 else
2293 ee->prop.group_ee_win = 0;
2294 _ecore_evas_x_hints_update(ee);
2295}
2296
2297static void
2298_ecore_evas_x_aspect_set(Ecore_Evas *ee, double aspect)
2299{
2300 if (ee->prop.aspect == aspect) return;
2301
2302 ee->prop.aspect = aspect;
2303 _ecore_evas_x_size_pos_hints_update(ee);
2304// netwm state
2305// if (ee->should_be_visible)
2306// ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2307// ECORE_X_WINDOW_STATE_STICKY, -1, sticky);
2308// else
2309// _ecore_evas_x_state_update(ee);
2310}
2311
2312static void
2313_ecore_evas_x_urgent_set(Ecore_Evas *ee, int urgent)
2314{
2315 if (ee->prop.urgent == urgent) return;
2316
2317 ee->prop.urgent = urgent;
2318 _ecore_evas_x_hints_update(ee);
2319}
2320
2321static void
2322_ecore_evas_x_modal_set(Ecore_Evas *ee, int modal)
2323{
2324 if (ee->prop.modal == modal) return;
2325
2326 ee->prop.modal = modal;
2327 if (ee->should_be_visible)
2328 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2329 ECORE_X_WINDOW_STATE_MODAL, -1, modal);
2330 else
2331 _ecore_evas_x_state_update(ee);
2332}
2333
2334static void
2335_ecore_evas_x_demand_attention_set(Ecore_Evas *ee, int demand)
2336{
2337 if (ee->prop.demand_attention == demand) return;
2338
2339 ee->prop.demand_attention = demand;
2340 if (ee->should_be_visible)
2341 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2342 ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION, -1, demand);
2343 else
2344 _ecore_evas_x_state_update(ee);
2345}
2346
2347static void
2348_ecore_evas_x_focus_skip_set(Ecore_Evas *ee, int skip)
2349{
2350 if (ee->prop.focus_skip == skip) return;
2351
2352 ee->prop.focus_skip = skip;
2353 if (ee->should_be_visible)
2354 {
2355 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2356 ECORE_X_WINDOW_STATE_SKIP_TASKBAR, -1, skip);
2357 ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root,
2358 ECORE_X_WINDOW_STATE_SKIP_PAGER, -1, skip);
2359 }
2360 else
2361 _ecore_evas_x_state_update(ee);
2362 _ecore_evas_x_hints_update(ee);
2363}
2364
2185#endif /* BUILD_ECORE_EVAS_X11 */ 2365#endif /* BUILD_ECORE_EVAS_X11 */
2186 2366
2187#ifdef BUILD_ECORE_EVAS_X11 2367#ifdef BUILD_ECORE_EVAS_X11
@@ -2369,30 +2549,11 @@ _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on)
2369{ 2549{
2370 if (ee->prop.iconified == on) return; 2550 if (ee->prop.iconified == on) return;
2371 ee->prop.iconified = on; 2551 ee->prop.iconified = on;
2552 _ecore_evas_x_hints_update(ee);
2372 if (on) 2553 if (on)
2373 { 2554 ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root);
2374 ecore_x_icccm_hints_set(ee->prop.window,
2375 1 /* accepts_focus */,
2376 ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */,
2377 0 /* icon_pixmap */,
2378 0 /* icon_mask */,
2379 0 /* icon_window */,
2380 0 /* window_group */,
2381 0 /* is_urgent */);
2382 ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root);
2383 }
2384 else 2555 else
2385 { 2556 ecore_evas_show(ee);
2386 ecore_x_icccm_hints_set(ee->prop.window,
2387 1 /* accepts_focus */,
2388 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
2389 0 /* icon_pixmap */,
2390 0 /* icon_mask */,
2391 0 /* icon_window */,
2392 0 /* window_group */,
2393 0 /* is_urgent */);
2394 ecore_evas_show(ee);
2395 }
2396} 2557}
2397 2558
2398static void 2559static void
@@ -2408,24 +2569,9 @@ _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on)
2408static void 2569static void
2409_ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) 2570_ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn)
2410{ 2571{
2411 Ecore_X_Window_State_Hint hint;
2412
2413 if (ee->prop.withdrawn == withdrawn) return; 2572 if (ee->prop.withdrawn == withdrawn) return;
2414
2415 ee->prop.withdrawn = withdrawn; 2573 ee->prop.withdrawn = withdrawn;
2416 if (withdrawn) 2574 _ecore_evas_x_hints_update(ee);
2417 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
2418 else
2419 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
2420
2421 ecore_x_icccm_hints_set(ee->prop.window,
2422 1 /* accepts_focus */,
2423 hint /* initial_state */,
2424 0 /* icon_pixmap */,
2425 0 /* icon_mask */,
2426 0 /* icon_window */,
2427 0 /* window_group */,
2428 0 /* is_urgent */);
2429} 2575}
2430 2576
2431static void 2577static void
@@ -2762,6 +2908,13 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
2762 _ecore_evas_x_ignore_events_set, 2908 _ecore_evas_x_ignore_events_set,
2763 _ecore_evas_x_alpha_set, 2909 _ecore_evas_x_alpha_set,
2764 _ecore_evas_x_transparent_set, 2910 _ecore_evas_x_transparent_set,
2911
2912 _ecore_evas_x_window_group_set,
2913 _ecore_evas_x_aspect_set,
2914 _ecore_evas_x_urgent_set,
2915 _ecore_evas_x_modal_set,
2916 _ecore_evas_x_demand_attention_set,
2917 _ecore_evas_x_focus_skip_set,
2765 2918
2766 NULL, // render 2919 NULL, // render
2767 _ecore_evas_x_screen_geometry_get 2920 _ecore_evas_x_screen_geometry_get
@@ -3003,14 +3156,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent,
3003 } 3156 }
3004 } 3157 }
3005 3158
3006 ecore_x_icccm_hints_set(ee->prop.window, 3159 _ecore_evas_x_hints_update(ee);
3007 1 /* accepts_focus */,
3008 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3009 0 /* icon_pixmap */,
3010 0 /* icon_mask */,
3011 0 /* icon_window */,
3012 0 /* window_group */,
3013 0 /* is_urgent */);
3014 _ecore_evas_x_group_leader_set(ee); 3160 _ecore_evas_x_group_leader_set(ee);
3015 ecore_x_window_defaults_set(ee->prop.window); 3161 ecore_x_window_defaults_set(ee->prop.window);
3016 _ecore_evas_x_protocols_set(ee); 3162 _ecore_evas_x_protocols_set(ee);
@@ -3240,14 +3386,7 @@ ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent,
3240// putenv((char*)"DESKTOP_STARTUP_ID="); 3386// putenv((char*)"DESKTOP_STARTUP_ID=");
3241 } 3387 }
3242 3388
3243 ecore_x_icccm_hints_set(ee->prop.window, 3389 _ecore_evas_x_hints_update(ee);
3244 1 /* accepts_focus */,
3245 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3246 0 /* icon_pixmap */,
3247 0 /* icon_mask */,
3248 0 /* icon_window */,
3249 0 /* window_group */,
3250 0 /* is_urgent */);
3251 _ecore_evas_x_group_leader_set(ee); 3390 _ecore_evas_x_group_leader_set(ee);
3252 ecore_x_window_defaults_set(ee->prop.window); 3391 ecore_x_window_defaults_set(ee->prop.window);
3253 _ecore_evas_x_protocols_set(ee); 3392 _ecore_evas_x_protocols_set(ee);
@@ -3571,14 +3710,7 @@ ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent,
3571 return NULL; 3710 return NULL;
3572 } 3711 }
3573 3712
3574 ecore_x_icccm_hints_set(ee->prop.window, 3713 _ecore_evas_x_hints_update(ee);
3575 1 /* accepts_focus */,
3576 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3577 0 /* icon_pixmap */,
3578 0 /* icon_mask */,
3579 0 /* icon_window */,
3580 0 /* window_group */,
3581 0 /* is_urgent */);
3582 _ecore_evas_x_group_leader_set(ee); 3714 _ecore_evas_x_group_leader_set(ee);
3583 ecore_x_window_defaults_set(ee->prop.window); 3715 ecore_x_window_defaults_set(ee->prop.window);
3584 _ecore_evas_x_protocols_set(ee); 3716 _ecore_evas_x_protocols_set(ee);
@@ -3895,14 +4027,7 @@ ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent,
3895 return NULL; 4027 return NULL;
3896 } 4028 }
3897 4029
3898 ecore_x_icccm_hints_set(ee->prop.window, 4030 _ecore_evas_x_hints_update(ee);
3899 1 /* accepts_focus */,
3900 ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
3901 0 /* icon_pixmap */,
3902 0 /* icon_mask */,
3903 0 /* icon_window */,
3904 0 /* window_group */,
3905 0 /* is_urgent */);
3906 _ecore_evas_x_group_leader_set(ee); 4031 _ecore_evas_x_group_leader_set(ee);
3907 ecore_x_window_defaults_set(ee->prop.window); 4032 ecore_x_window_defaults_set(ee->prop.window);
3908 _ecore_evas_x_protocols_set(ee); 4033 _ecore_evas_x_protocols_set(ee);
diff --git a/libraries/ecore/src/lib/ecore_fb/Makefile.in b/libraries/ecore/src/lib/ecore_fb/Makefile.in
index c0c30a5..e8030b1 100644
--- a/libraries/ecore/src/lib/ecore_fb/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_fb/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -194,6 +193,8 @@ EVAS_LIBS = @EVAS_LIBS@
194EVIL_CFLAGS = @EVIL_CFLAGS@ 193EVIL_CFLAGS = @EVIL_CFLAGS@
195EVIL_LIBS = @EVIL_LIBS@ 194EVIL_LIBS = @EVIL_LIBS@
196EXEEXT = @EXEEXT@ 195EXEEXT = @EXEEXT@
196EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
197EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@ 198FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@ 200GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -249,6 +250,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@ 251PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@ 252PKG_CONFIG = @PKG_CONFIG@
253PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
254PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
252POSUB = @POSUB@ 255POSUB = @POSUB@
253RANLIB = @RANLIB@ 256RANLIB = @RANLIB@
254SCIM_CFLAGS = @SCIM_CFLAGS@ 257SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -259,6 +262,7 @@ SDL_LIBS = @SDL_LIBS@
259SED = @SED@ 262SED = @SED@
260SET_MAKE = @SET_MAKE@ 263SET_MAKE = @SET_MAKE@
261SHELL = @SHELL@ 264SHELL = @SHELL@
265SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
262SSL_CFLAGS = @SSL_CFLAGS@ 266SSL_CFLAGS = @SSL_CFLAGS@
263SSL_LIBS = @SSL_LIBS@ 267SSL_LIBS = @SSL_LIBS@
264STRIP = @STRIP@ 268STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb.c
index ca7d73d..daeea0f 100644
--- a/libraries/ecore/src/lib/ecore_fb/ecore_fb.c
+++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb.c
@@ -92,21 +92,18 @@ _ecore_fb_size_get(int *w, int *h)
92 92
93 fb = open("/dev/fb0", O_RDWR); 93 fb = open("/dev/fb0", O_RDWR);
94 if (fb < 0) 94 if (fb < 0)
95 { 95 goto exit;
96 if (w) *w = 0; 96
97 if (h) *h = 0;
98 return;
99 }
100 if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1) 97 if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1)
101 { 98 goto err_ioctl;
102 if (w) *w = 0; 99
103 if (h) *h = 0; 100 *w = fb_var.xres;
104 close(fb); 101 *h = fb_var.yres;
105 return; 102
106 } 103err_ioctl:
107 close(fb); 104 close(fb);
108 if (w) *w = fb_var.xres; 105exit:
109 if (h) *h = fb_var.yres; 106 return;
110} 107}
111 108
112/** 109/**
diff --git a/libraries/ecore/src/lib/ecore_file/Makefile.in b/libraries/ecore/src/lib/ecore_file/Makefile.in
index 04e0bf1..a80ece3 100644
--- a/libraries/ecore/src/lib/ecore_file/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_file/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -195,6 +194,8 @@ EVAS_LIBS = @EVAS_LIBS@
195EVIL_CFLAGS = @EVIL_CFLAGS@ 194EVIL_CFLAGS = @EVIL_CFLAGS@
196EVIL_LIBS = @EVIL_LIBS@ 195EVIL_LIBS = @EVIL_LIBS@
197EXEEXT = @EXEEXT@ 196EXEEXT = @EXEEXT@
197EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
198EXOTIC_LIBS = @EXOTIC_LIBS@
198FGREP = @FGREP@ 199FGREP = @FGREP@
199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 200GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
200GLIB_CFLAGS = @GLIB_CFLAGS@ 201GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -250,6 +251,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 251PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
251PIXMAN_LIBS = @PIXMAN_LIBS@ 252PIXMAN_LIBS = @PIXMAN_LIBS@
252PKG_CONFIG = @PKG_CONFIG@ 253PKG_CONFIG = @PKG_CONFIG@
254PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
255PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
253POSUB = @POSUB@ 256POSUB = @POSUB@
254RANLIB = @RANLIB@ 257RANLIB = @RANLIB@
255SCIM_CFLAGS = @SCIM_CFLAGS@ 258SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -260,6 +263,7 @@ SDL_LIBS = @SDL_LIBS@
260SED = @SED@ 263SED = @SED@
261SET_MAKE = @SET_MAKE@ 264SET_MAKE = @SET_MAKE@
262SHELL = @SHELL@ 265SHELL = @SHELL@
266SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
263SSL_CFLAGS = @SSL_CFLAGS@ 267SSL_CFLAGS = @SSL_CFLAGS@
264SSL_LIBS = @SSL_LIBS@ 268SSL_LIBS = @SSL_LIBS@
265STRIP = @STRIP@ 269STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file.c b/libraries/ecore/src/lib/ecore_file/ecore_file.c
index cfbf2b5..cb03717 100644
--- a/libraries/ecore/src/lib/ecore_file/ecore_file.c
+++ b/libraries/ecore/src/lib/ecore_file/ecore_file.c
@@ -821,6 +821,8 @@ ecore_file_ls(const char *dir)
821 Eina_List *list = NULL; 821 Eina_List *list = NULL;
822 822
823 ls = eina_file_direct_ls(dir); 823 ls = eina_file_direct_ls(dir);
824 if (!ls) return NULL;
825
824 EINA_ITERATOR_FOREACH(ls, info) 826 EINA_ITERATOR_FOREACH(ls, info)
825 { 827 {
826 char *f; 828 char *f;
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_download.c b/libraries/ecore/src/lib/ecore_file/ecore_file_download.c
index c5e56bd..971493e 100644
--- a/libraries/ecore/src/lib/ecore_file/ecore_file_download.c
+++ b/libraries/ecore/src/lib/ecore_file/ecore_file_download.c
@@ -45,22 +45,27 @@ static Ecore_Event_Handler *_url_complete_handler = NULL;
45static Ecore_Event_Handler *_url_progress_download = NULL; 45static Ecore_Event_Handler *_url_progress_download = NULL;
46static Eina_List *_job_list; 46static Eina_List *_job_list;
47 47
48static int download_init = 0;
49
48#endif /* BUILD_ECORE_CON */ 50#endif /* BUILD_ECORE_CON */
49 51
50int 52int
51ecore_file_download_init(void) 53ecore_file_download_init(void)
52{ 54{
53#ifdef BUILD_ECORE_CON 55#ifdef BUILD_ECORE_CON
54 if (!ecore_con_url_init()) 56 download_init++;
55 return 0; 57 if (download_init > 1) return 1;
56 58 if (!ecore_con_init()) return 0;
59 if (!ecore_con_url_init())
60 {
61 ecore_con_shutdown();
62 return 0;
63 }
57# ifdef HAVE_CURL 64# ifdef HAVE_CURL
58 _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); 65 _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL);
59 _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); 66 _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
60# endif 67# endif
61
62#endif /* BUILD_ECORE_CON */ 68#endif /* BUILD_ECORE_CON */
63
64 return 1; 69 return 1;
65} 70}
66 71
@@ -68,15 +73,17 @@ void
68ecore_file_download_shutdown(void) 73ecore_file_download_shutdown(void)
69{ 74{
70#ifdef BUILD_ECORE_CON 75#ifdef BUILD_ECORE_CON
71 if (_url_complete_handler) 76 download_init--;
72 ecore_event_handler_del(_url_complete_handler); 77 if (download_init > 0) return;
73 if (_url_progress_download) 78 if (_url_complete_handler)
74 ecore_event_handler_del(_url_progress_download); 79 ecore_event_handler_del(_url_complete_handler);
75 _url_complete_handler = NULL; 80 if (_url_progress_download)
76 _url_progress_download = NULL; 81 ecore_event_handler_del(_url_progress_download);
77 ecore_file_download_abort_all(); 82 _url_complete_handler = NULL;
78 83 _url_progress_download = NULL;
79 ecore_con_url_shutdown(); 84 ecore_file_download_abort_all();
85 ecore_con_url_shutdown();
86 ecore_con_shutdown();
80#endif /* BUILD_ECORE_CON */ 87#endif /* BUILD_ECORE_CON */
81} 88}
82 89
@@ -362,7 +369,6 @@ _ecore_file_download_curl(const char *url, const char *dst,
362 } 369 }
363 370
364 if (headers) eina_hash_foreach(headers, _ecore_file_download_headers_foreach_cb, job); 371 if (headers) eina_hash_foreach(headers, _ecore_file_download_headers_foreach_cb, job);
365 ecore_con_url_timeout_set(job->url_con, ECORE_FILE_DOWNLOAD_TIMEOUT);
366 ecore_con_url_fd_set(job->url_con, fileno(job->file)); 372 ecore_con_url_fd_set(job->url_con, fileno(job->file));
367 ecore_con_url_data_set(job->url_con, data); 373 ecore_con_url_data_set(job->url_con, data);
368 374
diff --git a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h
index adea35d..1757d79 100644
--- a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h
+++ b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h
@@ -33,6 +33,12 @@
33extern "C" { 33extern "C" {
34#endif 34#endif
35 35
36/**
37 * @addtogroup Ecore_IMF_Context_Group
38 *
39 * @{
40 */
41
36/* Events sent by the Input Method */ 42/* Events sent by the Input Method */
37typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start; 43typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start;
38typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End; 44typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End;
@@ -66,25 +72,41 @@ EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING;
66 72
67typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info); 73typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info);
68 74
75/**
76 * @enum _Ecore_IMF_Callback_Type
77 * @typedef Ecore_IMF_Callback_Type
78 *
79 * Ecore IMF Event callback types.
80 *
81 * @see ecore_imf_context_event_callback_add()
82 */
69typedef enum 83typedef enum
70{ 84{
71 ECORE_IMF_CALLBACK_PREEDIT_START, 85 ECORE_IMF_CALLBACK_PREEDIT_START, /**< "PREEDIT_START" is called when a new preediting sequence starts. */
72 ECORE_IMF_CALLBACK_PREEDIT_END, 86 ECORE_IMF_CALLBACK_PREEDIT_END, /**< "PREEDIT_END" is called when a preediting sequence has been completed or canceled. */
73 ECORE_IMF_CALLBACK_PREEDIT_CHANGED, 87 ECORE_IMF_CALLBACK_PREEDIT_CHANGED, /**< "PREEDIT_CHANGED" is called whenever the preedit sequence currently being entered has changed. */
74 ECORE_IMF_CALLBACK_COMMIT, 88 ECORE_IMF_CALLBACK_COMMIT, /**< "COMMIT" is called when a complete input sequence has been entered by the user */
75 ECORE_IMF_CALLBACK_DELETE_SURROUNDING 89 ECORE_IMF_CALLBACK_DELETE_SURROUNDING /**< "DELETE_SURROUNDING" is called when the input method needs to delete all or part of the context surrounding the cursor */
76} Ecore_IMF_Callback_Type; 90} Ecore_IMF_Callback_Type;
77 91
92/**
93 * @enum _Ecore_IMF_Event_Type
94 * @typedef Ecore_IMF_Event_Type
95 *
96 * Ecore IMF event types.
97 *
98 * @see ecore_imf_context_filter_event()
99 */
78typedef enum 100typedef enum
79{ 101{
80 ECORE_IMF_EVENT_MOUSE_DOWN, 102 ECORE_IMF_EVENT_MOUSE_DOWN, /**< Mouse Down event */
81 ECORE_IMF_EVENT_MOUSE_UP, 103 ECORE_IMF_EVENT_MOUSE_UP, /**< Mouse Up event */
82 ECORE_IMF_EVENT_MOUSE_IN, 104 ECORE_IMF_EVENT_MOUSE_IN, /**< Mouse In event */
83 ECORE_IMF_EVENT_MOUSE_OUT, 105 ECORE_IMF_EVENT_MOUSE_OUT, /**< Mouse Out event */
84 ECORE_IMF_EVENT_MOUSE_MOVE, 106 ECORE_IMF_EVENT_MOUSE_MOVE, /**< Mouse Move event */
85 ECORE_IMF_EVENT_MOUSE_WHEEL, 107 ECORE_IMF_EVENT_MOUSE_WHEEL, /**< Mouse Wheel event */
86 ECORE_IMF_EVENT_KEY_DOWN, 108 ECORE_IMF_EVENT_KEY_DOWN, /**< Key Down event */
87 ECORE_IMF_EVENT_KEY_UP 109 ECORE_IMF_EVENT_KEY_UP /**< Key Up event */
88} Ecore_IMF_Event_Type; 110} Ecore_IMF_Event_Type;
89 111
90typedef enum 112typedef enum
@@ -123,22 +145,46 @@ typedef enum
123 ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30 145 ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30
124} Ecore_IMF_Input_Mode; 146} Ecore_IMF_Input_Mode;
125 147
148/**
149 * @enum _Ecore_IMF_Preedit_Type
150 * @typedef Ecore_IMF_Preedit_Type
151 *
152 * Ecore IMF Preedit style types
153 *
154 * @see ecore_imf_context_preedit_string_with_attributes_get()
155 */
126typedef enum 156typedef enum
127{ 157{
128 ECORE_IMF_PREEDIT_TYPE_NONE, 158 ECORE_IMF_PREEDIT_TYPE_NONE, /**< None style */
129 ECORE_IMF_PREEDIT_TYPE_SUB1, 159 ECORE_IMF_PREEDIT_TYPE_SUB1, /**< Substring style 1 */
130 ECORE_IMF_PREEDIT_TYPE_SUB2, 160 ECORE_IMF_PREEDIT_TYPE_SUB2, /**< Substring style 2 */
131 ECORE_IMF_PREEDIT_TYPE_SUB3 161 ECORE_IMF_PREEDIT_TYPE_SUB3 /**< Substring style 3 */
132} Ecore_IMF_Preedit_Type; 162} Ecore_IMF_Preedit_Type;
133 163
164/**
165 * @enum _Ecore_IMF_Autocapital_Type
166 * @typedef Ecore_IMF_Autocapital_Type
167 *
168 * Autocapitalization Types.
169 *
170 * @see ecore_imf_context_autocapital_type_set()
171 */
134typedef enum 172typedef enum
135{ 173{
136 ECORE_IMF_AUTOCAPITAL_TYPE_NONE, 174 ECORE_IMF_AUTOCAPITAL_TYPE_NONE, /**< No auto-capitalization when typing */
137 ECORE_IMF_AUTOCAPITAL_TYPE_WORD, 175 ECORE_IMF_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed */
138 ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, 176 ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence */
139 ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER 177 ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER, /**< Autocapitalize all letters */
140} Ecore_IMF_Autocapital_Type; 178} Ecore_IMF_Autocapital_Type;
141 179
180/**
181 * @enum _Ecore_IMF_Input_Panel_Layout
182 * @typedef Ecore_IMF_Input_Panel_Layout
183 *
184 * Input panel (virtual keyboard) layout types.
185 *
186 * @see ecore_imf_context_input_panel_layout_set()
187 */
142typedef enum 188typedef enum
143{ 189{
144 ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */ 190 ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */
@@ -155,12 +201,40 @@ typedef enum
155 ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */ 201 ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */
156} Ecore_IMF_Input_Panel_Layout; 202} Ecore_IMF_Input_Panel_Layout;
157 203
204/**
205 * @enum _Ecore_IMF_Input_Panel_Lang
206 * @typedef Ecore_IMF_Input_Panel_Lang
207 *
208 * Input panel (virtual keyboard) language modes.
209 *
210 * @see ecore_imf_context_input_panel_language_set()
211 */
158typedef enum 212typedef enum
159{ 213{
160 ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ 214 ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic @since 1.2 */
161 ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ 215 ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet @since 1.2 */
162} Ecore_IMF_Input_Panel_Lang; 216} Ecore_IMF_Input_Panel_Lang;
163 217
218/**
219 * @enum _Ecore_IMF_Input_Panel_Return_Key_Type
220 * @typedef Ecore_IMF_Input_Panel_Return_Key_Type
221 *
222 * "Return" Key types on the input panel (virtual keyboard).
223 *
224 * @see ecore_imf_context_input_panel_return_key_type_set()
225 */
226typedef enum
227{
228 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, /**< Default @since 1.2 */
229 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE, /**< Done @since 1.2 */
230 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO, /**< Go @since 1.2 */
231 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, /**< Join @since 1.2 */
232 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, /**< Login @since 1.2 */
233 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, /**< Next @since 1.2 */
234 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, /**< Search or magnifier icon @since 1.2 */
235 ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND /**< Send @since 1.2 */
236} Ecore_IMF_Input_Panel_Return_Key_Type;
237
164struct _Ecore_IMF_Event_Preedit_Start 238struct _Ecore_IMF_Event_Preedit_Start
165{ 239{
166 Ecore_IMF_Context *ctx; 240 Ecore_IMF_Context *ctx;
@@ -314,9 +388,9 @@ union _Ecore_IMF_Event
314 388
315struct _Ecore_IMF_Preedit_Attr 389struct _Ecore_IMF_Preedit_Attr
316{ 390{
317 Ecore_IMF_Preedit_Type preedit_type; 391 Ecore_IMF_Preedit_Type preedit_type; /**< preedit style type */
318 unsigned int start_index; 392 unsigned int start_index; /**< start index of the range (in bytes) */
319 unsigned int end_index; 393 unsigned int end_index; /**< end index of the range (in bytes) */
320}; 394};
321 395
322struct _Ecore_IMF_Context_Class 396struct _Ecore_IMF_Context_Class
@@ -345,6 +419,11 @@ struct _Ecore_IMF_Context_Class
345 void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); 419 void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang);
346 Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx); 420 Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx);
347 void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h); 421 void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h);
422 void (*input_panel_imdata_set)(Ecore_IMF_Context *ctx, const void* data, int len);
423 void (*input_panel_imdata_get)(Ecore_IMF_Context *ctx, void* data, int *len);
424 void (*input_panel_return_key_type_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type);
425 void (*input_panel_return_key_disabled_set) (Ecore_IMF_Context *ctx, Eina_Bool disabled);
426 void (*input_panel_caps_lock_mode_set) (Ecore_IMF_Context *ctx, Eina_Bool mode);
348}; 427};
349 428
350struct _Ecore_IMF_Context_Info 429struct _Ecore_IMF_Context_Info
@@ -418,6 +497,14 @@ EAPI void ecore_imf_context_input_panel_language_set(Ec
418EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx); 497EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx);
419EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable); 498EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable);
420EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx); 499EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx);
500EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len);
501EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len);
502EAPI void ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type);
503EAPI Ecore_IMF_Input_Panel_Return_Key_Type ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx);
504EAPI void ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled);
505EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx);
506EAPI void ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode);
507EAPI Eina_Bool ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx);
421 508
422/* The following entry points must be exported by each input method module 509/* The following entry points must be exported by each input method module
423 */ 510 */
@@ -433,3 +520,7 @@ EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Eco
433#endif 520#endif
434 521
435#endif 522#endif
523
524/**
525 * @}
526 */
diff --git a/libraries/ecore/src/lib/ecore_imf/Makefile.in b/libraries/ecore/src/lib/ecore_imf/Makefile.in
index 9f91360..4d71b5d 100644
--- a/libraries/ecore/src/lib/ecore_imf/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_imf/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@ 192EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@ 193EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@ 194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@ 197FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@ 199GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@ 250PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@ 251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
251POSUB = @POSUB@ 254POSUB = @POSUB@
252RANLIB = @RANLIB@ 255RANLIB = @RANLIB@
253SCIM_CFLAGS = @SCIM_CFLAGS@ 256SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@
258SED = @SED@ 261SED = @SED@
259SET_MAKE = @SET_MAKE@ 262SET_MAKE = @SET_MAKE@
260SHELL = @SHELL@ 263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
261SSL_CFLAGS = @SSL_CFLAGS@ 265SSL_CFLAGS = @SSL_CFLAGS@
262SSL_LIBS = @SSL_LIBS@ 266SSL_LIBS = @SSL_LIBS@
263STRIP = @STRIP@ 267STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
index b65ee26..423c461 100644
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
+++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c
@@ -143,6 +143,32 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type)
143 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id; 143 * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id;
144 * on failure it returns NULL. 144 * on failure it returns NULL.
145 * @ingroup Ecore_IMF_Context_Group 145 * @ingroup Ecore_IMF_Context_Group
146 *
147 * Example
148 * @code
149 *
150 * const char *ctx_id;
151 * const Ecore_IMF_Context_Info *ctx_info;
152 * Ecore_IMF_Context *imf_context;
153 * ctx_id = ecore_imf_context_default_id_get();
154 * if (ctx_id)
155 * {
156 * ctx_info = ecore_imf_context_info_by_id_get(ctx_id);
157 * if (!ctx_info->canvas_type ||
158 * strcmp(ctx_info->canvas_type, "evas") == 0)
159 * {
160 * imf_context = ecore_imf_context_add(ctx_id);
161 * }
162 * else
163 * {
164 * ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
165 * if (ctx_id)
166 * {
167 * imf_context = ecore_imf_context_add(ctx_id);
168 * }
169 * }
170 * }
171 * @endcode
146 */ 172 */
147EAPI const Ecore_IMF_Context_Info * 173EAPI const Ecore_IMF_Context_Info *
148ecore_imf_context_info_by_id_get(const char *id) 174ecore_imf_context_info_by_id_get(const char *id)
@@ -188,6 +214,10 @@ ecore_imf_context_add(const char *id)
188 * set on the immodule */ 214 * set on the immodule */
189 ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE); 215 ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE);
190 216
217 /* default input panel layout type is NORMAL type, so let's make sure it's
218 * set on the immodule */
219 ecore_imf_context_input_panel_layout_set(ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL);
220
191 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's 221 /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's
192 * set on the immodule */ 222 * set on the immodule */
193 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL); 223 ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL);
@@ -403,7 +433,7 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu
403} 433}
404 434
405/** 435/**
406 * Retrieve the current preedit string, atrributes and 436 * Retrieve the current preedit string, attributes and
407 * cursor position for the Input Method Context. 437 * cursor position for the Input Method Context.
408 * 438 *
409 * @param ctx An #Ecore_IMF_Context. 439 * @param ctx An #Ecore_IMF_Context.
@@ -413,6 +443,49 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu
413 * @param cursor_pos Location to store position of cursor (in characters) 443 * @param cursor_pos Location to store position of cursor (in characters)
414 * within the preedit string. 444 * within the preedit string.
415 * @ingroup Ecore_IMF_Context_Group 445 * @ingroup Ecore_IMF_Context_Group
446 *
447 * Example
448 * @code
449 * char *preedit_string;
450 * int cursor_pos;
451 * Eina_List *attrs = NULL, *l = NULL;
452 * Ecore_IMF_Preedit_Attr *attr;
453 *
454 * ecore_imf_context_preedit_string_with_attributes_get(imf_context,
455 * &preedit_string,
456 * &attrs, &cursor_pos);
457 * if (!preedit_string) return;
458 *
459 * if (strlen(preedit_string) > 0)
460 * {
461 * if (attrs)
462 * {
463 * EINA_LIST_FOREACH(attrs, l, attr)
464 * {
465 * if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1)
466 * {
467 * // Something to do
468 * }
469 * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2)
470 * {
471 * // Something to do
472 * }
473 * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3)
474 * {
475 * // Something to do
476 * }
477 * }
478 * }
479 * }
480 *
481 * // delete attribute list
482 * if (attrs)
483 * {
484 * EINA_LIST_FREE(attrs, attr) free(attr);
485 * }
486 *
487 * free(preedit_string);
488 * @endcode
416 * @since 1.1.0 489 * @since 1.1.0
417 */ 490 */
418EAPI void 491EAPI void
@@ -440,6 +513,18 @@ ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, cha
440 * 513 *
441 * @param ctx An #Ecore_IMF_Context. 514 * @param ctx An #Ecore_IMF_Context.
442 * @ingroup Ecore_IMF_Context_Group 515 * @ingroup Ecore_IMF_Context_Group
516 *
517 * Example
518 * @code
519 * static void
520 * _focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source)
521 * {
522 * ecore_imf_context_reset(imf_context);
523 * ecore_imf_context_focus_in(imf_context);
524 * }
525 *
526 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _focus_in_cb, ed);
527 * @endcode
443 */ 528 */
444EAPI void 529EAPI void
445ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) 530ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
@@ -459,6 +544,18 @@ ecore_imf_context_focus_in(Ecore_IMF_Context *ctx)
459 * 544 *
460 * @param ctx An #Ecore_IMF_Context. 545 * @param ctx An #Ecore_IMF_Context.
461 * @ingroup Ecore_IMF_Context_Group 546 * @ingroup Ecore_IMF_Context_Group
547 *
548 * Example
549 * @code
550 * static void
551 * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source)
552 * {
553 * ecore_imf_context_reset(imf_context);
554 * ecore_imf_context_focus_out(imf_context);
555 * }
556 *
557 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed);
558 * @endcode
462 */ 559 */
463EAPI void 560EAPI void
464ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) 561ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
@@ -479,6 +576,18 @@ ecore_imf_context_focus_out(Ecore_IMF_Context *ctx)
479 * 576 *
480 * @param ctx An #Ecore_IMF_Context. 577 * @param ctx An #Ecore_IMF_Context.
481 * @ingroup Ecore_IMF_Context_Group 578 * @ingroup Ecore_IMF_Context_Group
579 *
580 * Example
581 * @code
582 * static void
583 * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source)
584 * {
585 * ecore_imf_context_reset(imf_context);
586 * ecore_imf_context_focus_out(imf_context);
587 * }
588 *
589 * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed);
590 * @endcode
482 */ 591 */
483EAPI void 592EAPI void
484ecore_imf_context_reset(Ecore_IMF_Context *ctx) 593ecore_imf_context_reset(Ecore_IMF_Context *ctx)
@@ -515,10 +624,12 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
515/** 624/**
516 * Notify the Input Method Context that a change in the cursor 625 * Notify the Input Method Context that a change in the cursor
517 * location has been made. The location is relative to the canvas. 626 * location has been made. The location is relative to the canvas.
627 * The cursor location can be used to determine the position of
628 * candidate word window in the immodule.
518 * 629 *
519 * @param ctx An #Ecore_IMF_Context. 630 * @param ctx An #Ecore_IMF_Context.
520 * @param x cursor x position. 631 * @param x cursor x position.
521 * @param x cursor y position. 632 * @param y cursor y position.
522 * @param w cursor width. 633 * @param w cursor width.
523 * @param h cursor height. 634 * @param h cursor height.
524 * @ingroup Ecore_IMF_Context_Group 635 * @ingroup Ecore_IMF_Context_Group
@@ -605,7 +716,7 @@ ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx)
605} 716}
606 717
607/** 718/**
608 * Set the autocapitalization type on the immodule. 719 * Set the autocapitalization type on the immodule.
609 * 720 *
610 * @param ctx An #Ecore_IMF_Context. 721 * @param ctx An #Ecore_IMF_Context.
611 * @param autocapital_type the autocapitalization type. 722 * @param autocapital_type the autocapitalization type.
@@ -732,6 +843,28 @@ ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx)
732 * @param event The event itself. 843 * @param event The event itself.
733 * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE. 844 * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE.
734 * @ingroup Ecore_IMF_Context_Group 845 * @ingroup Ecore_IMF_Context_Group
846 *
847 * Example
848 * @code
849 * static void
850 * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
851 * {
852 * Evas_Event_Key_Down *ev = event_info;
853 * if (!ev->keyname) return;
854 *
855 * if (imf_context)
856 * {
857 * Ecore_IMF_Event_Key_Down ecore_ev;
858 * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
859 * if (ecore_imf_context_filter_event(imf_context,
860 * ECORE_IMF_EVENT_KEY_DOWN,
861 * (Ecore_IMF_Event *)&ecore_ev))
862 * return;
863 * }
864 * }
865 *
866 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data);
867 * @endcode
735 */ 868 */
736EAPI Eina_Bool 869EAPI Eina_Bool
737ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) 870ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
@@ -839,7 +972,7 @@ EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx)
839 * If the function returns EINA_TRUE, then you must free 972 * If the function returns EINA_TRUE, then you must free
840 * the result stored in this location with free(). 973 * the result stored in this location with free().
841 * @param cursor_pos Location to store the position in characters of 974 * @param cursor_pos Location to store the position in characters of
842 * the insertion cursor within @text. 975 * the insertion cursor within @p text.
843 * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE. 976 * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE.
844 * @ingroup Ecore_IMF_Context_Module_Group 977 * @ingroup Ecore_IMF_Context_Module_Group
845 */ 978 */
@@ -877,6 +1010,8 @@ _ecore_imf_event_free_preedit(void *data __UNUSED__, void *event)
877 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue. 1010 * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue.
878 * 1011 *
879 * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts. 1012 * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts.
1013 * It's asynchronous method to put event to the event queue.
1014 * ecore_imf_context_event_callback_call() can be used as synchronous method.
880 * 1015 *
881 * @param ctx An #Ecore_IMF_Context. 1016 * @param ctx An #Ecore_IMF_Context.
882 * @ingroup Ecore_IMF_Context_Module_Group 1017 * @ingroup Ecore_IMF_Context_Module_Group
@@ -903,6 +1038,8 @@ ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx)
903 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue. 1038 * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue.
904 * 1039 *
905 * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled. 1040 * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled.
1041 * It's asynchronous method to put event to the event queue.
1042 * ecore_imf_context_event_callback_call() can be used as synchronous method.
906 * 1043 *
907 * @param ctx An #Ecore_IMF_Context. 1044 * @param ctx An #Ecore_IMF_Context.
908 * @ingroup Ecore_IMF_Context_Module_Group 1045 * @ingroup Ecore_IMF_Context_Module_Group
@@ -928,6 +1065,9 @@ ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx)
928/** 1065/**
929 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue. 1066 * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue.
930 * 1067 *
1068 * It's asynchronous method to put event to the event queue.
1069 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1070 *
931 * @param ctx An #Ecore_IMF_Context. 1071 * @param ctx An #Ecore_IMF_Context.
932 * @ingroup Ecore_IMF_Context_Module_Group 1072 * @ingroup Ecore_IMF_Context_Module_Group
933 */ 1073 */
@@ -962,6 +1102,9 @@ _ecore_imf_event_free_commit(void *data __UNUSED__, void *event)
962/** 1102/**
963 * Adds ECORE_IMF_EVENT_COMMIT to the event queue. 1103 * Adds ECORE_IMF_EVENT_COMMIT to the event queue.
964 * 1104 *
1105 * It's asynchronous method to put event to the event queue.
1106 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1107 *
965 * @param ctx An #Ecore_IMF_Context. 1108 * @param ctx An #Ecore_IMF_Context.
966 * @param str The committed string. 1109 * @param str The committed string.
967 * @ingroup Ecore_IMF_Context_Module_Group 1110 * @ingroup Ecore_IMF_Context_Module_Group
@@ -999,6 +1142,9 @@ _ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event)
999 * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. 1142 * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue.
1000 * Note that offset and n_chars are in characters not in bytes. 1143 * Note that offset and n_chars are in characters not in bytes.
1001 * 1144 *
1145 * It's asynchronous method to put ECORE_IMF_EVENT_DELETE_SURROUNDING event to the event queue.
1146 * ecore_imf_context_event_callback_call() can be used as synchronous method.
1147 *
1002 * @param ctx An #Ecore_IMF_Context. 1148 * @param ctx An #Ecore_IMF_Context.
1003 * @param offset The start offset of surrounding to be deleted. 1149 * @param offset The start offset of surrounding to be deleted.
1004 * @param n_chars The number of characters to be deleted. 1150 * @param n_chars The number of characters to be deleted.
@@ -1041,8 +1187,20 @@ ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offse
1041 * @param func The (callback) function to be called when the event is 1187 * @param func The (callback) function to be called when the event is
1042 * triggered 1188 * triggered
1043 * @param data The data pointer to be passed to @p func 1189 * @param data The data pointer to be passed to @p func
1044 * @ingroup Ecore_IMF_Context_Module_Group 1190 * @ingroup Ecore_IMF_Context_Group
1045 * @since 1.2.0 1191 * @since 1.2.0
1192 *
1193 * Example
1194 * @code
1195 * static void
1196 * _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
1197 * {
1198 * char *commit_str = event_info;
1199 * // something to do
1200 * }
1201 *
1202 * ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data);
1203 * @endcode
1046 */ 1204 */
1047EAPI void 1205EAPI void
1048ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data) 1206ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data)
@@ -1079,10 +1237,10 @@ ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_
1079 * @see ecore_imf_context_event_callback_add() for more details 1237 * @see ecore_imf_context_event_callback_add() for more details
1080 * 1238 *
1081 * @param ctx Ecore_IMF_Context to remove a callback from. 1239 * @param ctx Ecore_IMF_Context to remove a callback from.
1082 * @param type The type of event that was trigerring the callback 1240 * @param type The type of event that was triggering the callback
1083 * @param func The (callback) function that was to be called when the event was triggered 1241 * @param func The (callback) function that was to be called when the event was triggered
1084 * @return the data pointer 1242 * @return the data pointer
1085 * @ingroup Ecore_IMF_Context_Module_Group 1243 * @ingroup Ecore_IMF_Context_Group
1086 * @since 1.2.0 1244 * @since 1.2.0
1087 */ 1245 */
1088EAPI void * 1246EAPI void *
@@ -1096,7 +1254,7 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_
1096 { 1254 {
1097 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, 1255 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1098 "ecore_imf_context_event_callback_del"); 1256 "ecore_imf_context_event_callback_del");
1099 return; 1257 return NULL;
1100 } 1258 }
1101 1259
1102 if (!func) return NULL; 1260 if (!func) return NULL;
@@ -1106,7 +1264,7 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_
1106 { 1264 {
1107 if ((fn) && (fn->func == func) && (fn->type == type)) 1265 if ((fn) && (fn->func == func) && (fn->type == type))
1108 { 1266 {
1109 void *tmp = fn->data; 1267 void *tmp = (void *)fn->data;
1110 free(fn); 1268 free(fn);
1111 ctx->callbacks = eina_list_remove_list(ctx->callbacks, l); 1269 ctx->callbacks = eina_list_remove_list(ctx->callbacks, l);
1112 return tmp; 1270 return tmp;
@@ -1156,11 +1314,11 @@ ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback
1156 * Ask the Input Method Context to show the control panel of using Input Method. 1314 * Ask the Input Method Context to show the control panel of using Input Method.
1157 * 1315 *
1158 * @param ctx An #Ecore_IMF_Context. 1316 * @param ctx An #Ecore_IMF_Context.
1159 * @ingroup Ecore_IMF_Context_IMControl_Group 1317 * @ingroup Ecore_IMF_Context_Group
1160 * @since 1.1.0 1318 * @since 1.1.0
1161 */ 1319 */
1162EAPI void 1320EAPI void
1163ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx) 1321ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx)
1164{ 1322{
1165 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1323 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1166 { 1324 {
@@ -1176,11 +1334,11 @@ ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx)
1176 * Ask the Input Method Context to hide the control panel of using Input Method. 1334 * Ask the Input Method Context to hide the control panel of using Input Method.
1177 * 1335 *
1178 * @param ctx An #Ecore_IMF_Context. 1336 * @param ctx An #Ecore_IMF_Context.
1179 * @ingroup Ecore_IMF_Context_IMControl_Group 1337 * @ingroup Ecore_IMF_Context_Group
1180 * @since 1.1.0 1338 * @since 1.1.0
1181 */ 1339 */
1182EAPI void 1340EAPI void
1183ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx) 1341ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx)
1184{ 1342{
1185 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1343 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1186 { 1344 {
@@ -1196,7 +1354,7 @@ ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx)
1196 * Ask the Input Method Context to show the input panel (virtual keyboard). 1354 * Ask the Input Method Context to show the input panel (virtual keyboard).
1197 * 1355 *
1198 * @param ctx An #Ecore_IMF_Context. 1356 * @param ctx An #Ecore_IMF_Context.
1199 * @ingroup Ecore_IMF_Context_IMControl_Group 1357 * @ingroup Ecore_IMF_Context_Group
1200 * @since 1.1.0 1358 * @since 1.1.0
1201 */ 1359 */
1202EAPI void 1360EAPI void
@@ -1216,7 +1374,7 @@ ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
1216 * Ask the Input Method Context to hide the input panel. 1374 * Ask the Input Method Context to hide the input panel.
1217 * 1375 *
1218 * @param ctx An #Ecore_IMF_Context. 1376 * @param ctx An #Ecore_IMF_Context.
1219 * @ingroup Ecore_IMF_Context_IMControl_Group 1377 * @ingroup Ecore_IMF_Context_Group
1220 * @since 1.1.0 1378 * @since 1.1.0
1221 */ 1379 */
1222EAPI void 1380EAPI void
@@ -1236,12 +1394,12 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
1236 * Set the layout of the input panel. 1394 * Set the layout of the input panel.
1237 * 1395 *
1238 * @param ctx An #Ecore_IMF_Context. 1396 * @param ctx An #Ecore_IMF_Context.
1239 * @param layout see #ECORE_IMF_INPUT_PANEL_LAYOUT 1397 * @param layout see #Ecore_IMF_Input_Panel_Layout
1240 * @ingroup Ecore_IMF_Context_IMControl_Group 1398 * @ingroup Ecore_IMF_Context_Group
1241 * @since 1.1.0 1399 * @since 1.1.0
1242 */ 1400 */
1243EAPI void 1401EAPI void
1244ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout) 1402ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
1245{ 1403{
1246 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1404 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1247 { 1405 {
@@ -1261,11 +1419,11 @@ ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Inpu
1261 * 1419 *
1262 * @param ctx An #Ecore_IMF_Context. 1420 * @param ctx An #Ecore_IMF_Context.
1263 * @return layout see #Ecore_IMF_Input_Panel_Layout 1421 * @return layout see #Ecore_IMF_Input_Panel_Layout
1264 * @ingroup Ecore_IMF_Context_IMControl_Group 1422 * @ingroup Ecore_IMF_Context_Group
1265 * @since 1.1.0 1423 * @since 1.1.0
1266 */ 1424 */
1267EAPI Ecore_IMF_Input_Panel_Layout 1425EAPI Ecore_IMF_Input_Panel_Layout
1268ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx) 1426ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx)
1269{ 1427{
1270 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1428 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1271 { 1429 {
@@ -1275,9 +1433,7 @@ ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx)
1275 } 1433 }
1276 1434
1277 if (ctx->klass->input_panel_layout_get) 1435 if (ctx->klass->input_panel_layout_get)
1278 { 1436 return ctx->input_panel_layout;
1279 return ctx->input_panel_layout;
1280 }
1281 else 1437 else
1282 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; 1438 return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID;
1283} 1439}
@@ -1288,11 +1444,11 @@ ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx)
1288 * 1444 *
1289 * @param ctx An #Ecore_IMF_Context. 1445 * @param ctx An #Ecore_IMF_Context.
1290 * @param lang the language to be set to the input panel. 1446 * @param lang the language to be set to the input panel.
1291 * @ingroup Ecore_IMF_Context_IMControl_Group 1447 * @ingroup Ecore_IMF_Context_Group
1292 * @since 1.1.0 1448 * @since 1.1.0
1293 */ 1449 */
1294EAPI void 1450EAPI void
1295ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang) 1451ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang)
1296{ 1452{
1297 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1453 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1298 { 1454 {
@@ -1312,11 +1468,11 @@ ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_In
1312 * 1468 *
1313 * @param ctx An #Ecore_IMF_Context. 1469 * @param ctx An #Ecore_IMF_Context.
1314 * @return Ecore_IMF_Input_Panel_Lang 1470 * @return Ecore_IMF_Input_Panel_Lang
1315 * @ingroup Ecore_IMF_Context_IMControl_Group 1471 * @ingroup Ecore_IMF_Context_Group
1316 * @since 1.1.0 1472 * @since 1.1.0
1317 */ 1473 */
1318EAPI Ecore_IMF_Input_Panel_Lang 1474EAPI Ecore_IMF_Input_Panel_Lang
1319ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx) 1475ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx)
1320{ 1476{
1321 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1477 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1322 { 1478 {
@@ -1338,7 +1494,7 @@ ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx)
1338 * @since 1.1.0 1494 * @since 1.1.0
1339 */ 1495 */
1340EAPI void 1496EAPI void
1341ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx, 1497ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx,
1342 Eina_Bool enabled) 1498 Eina_Bool enabled)
1343{ 1499{
1344 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1500 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
@@ -1360,7 +1516,7 @@ ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx,
1360 * @since 1.1.0 1516 * @since 1.1.0
1361 */ 1517 */
1362EAPI Eina_Bool 1518EAPI Eina_Bool
1363ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx) 1519ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx)
1364{ 1520{
1365 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) 1521 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1366 { 1522 {
@@ -1372,3 +1528,191 @@ ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx)
1372 return ctx->input_panel_enabled; 1528 return ctx->input_panel_enabled;
1373} 1529}
1374 1530
1531/**
1532 * Set the input panel-specific data to deliver to the input panel.
1533 * This API is used by applications to deliver specific data to the input panel.
1534 * The data format MUST be negotiated by both application and the input panel.
1535 * The size and format of data are defined by the input panel.
1536 *
1537 * @param ctx An #Ecore_IMF_Context.
1538 * @param data The specific data to be set to the input panel.
1539 * @param len the length of data, in bytes, to send to the input panel
1540 * @ingroup Ecore_IMF_Context_Group
1541 * @since 1.2.0
1542 */
1543EAPI void
1544ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len)
1545{
1546 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1547 {
1548 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1549 "ecore_imf_context_input_panel_imdata_set");
1550 return;
1551 }
1552
1553 if (!data) return;
1554
1555 if (ctx->klass->input_panel_imdata_set)
1556 ctx->klass->input_panel_imdata_set(ctx, data, len);
1557}
1558
1559/**
1560 * Get the specific data of the current active input panel.
1561 *
1562 * @param ctx An #Ecore_IMF_Context.
1563 * @param data The specific data to be got from the input panel
1564 * @param len The length of data
1565 * @ingroup Ecore_IMF_Context_Group
1566 * @since 1.2.0
1567 */
1568EAPI void
1569ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len)
1570{
1571 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1572 {
1573 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1574 "ecore_imf_context_input_panel_imdata_get");
1575 return;
1576 }
1577
1578 if (!data) return;
1579
1580 if (ctx->klass->input_panel_imdata_get)
1581 ctx->klass->input_panel_imdata_get(ctx, data, len);
1582}
1583
1584/**
1585 * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel.
1586 *
1587 * An input panel displays the string or icon associated with this type
1588 *
1589 * @param ctx An #Ecore_IMF_Context.
1590 * @param return_key_type The type of "return" key on the input panel
1591 * @ingroup Ecore_IMF_Context_Group
1592 * @since 1.2.0
1593 */
1594EAPI void
1595ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type)
1596{
1597 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1598 {
1599 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1600 "ecore_imf_context_input_panel_return_key_type_set");
1601 return;
1602 }
1603
1604 ctx->input_panel_return_key_type = return_key_type;
1605 if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type);
1606}
1607
1608/**
1609 * Get the "return" key type.
1610 *
1611 * @see ecore_imf_context_input_panel_return_key_type_set() for more details
1612 *
1613 * @param ctx An #Ecore_IMF_Context.
1614 * @return The type of "return" key on the input panel
1615 * @ingroup Ecore_IMF_Context_Group
1616 * @since 1.2.0
1617 */
1618EAPI Ecore_IMF_Input_Panel_Return_Key_Type
1619ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx)
1620{
1621 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1622 {
1623 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1624 "ecore_imf_context_input_panel_return_key_type_get");
1625 return EINA_FALSE;
1626 }
1627
1628 return ctx->input_panel_return_key_type;
1629}
1630
1631/**
1632 * Set the return key on the input panel to be disabled.
1633 *
1634 * @param ctx An #Ecore_IMF_Context.
1635 * @param disabled The state
1636 * @ingroup Ecore_IMF_Context_Group
1637 * @since 1.2.0
1638 */
1639EAPI void
1640ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled)
1641{
1642 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1643 {
1644 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1645 "ecore_imf_context_input_panel_return_key_disabled_set");
1646 return;
1647 }
1648
1649 ctx->input_panel_return_key_disabled = disabled;
1650 if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled);
1651}
1652
1653/**
1654 * Get whether the return key on the input panel should be disabled or not.
1655 *
1656 * @param ctx An #Ecore_IMF_Context.
1657 * @return EINA_TRUE if it should be disabled
1658 * @ingroup Ecore_IMF_Context_Group
1659 * @since 1.2.0
1660 */
1661EAPI Eina_Bool
1662ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx)
1663{
1664 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1665 {
1666 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1667 "ecore_imf_context_input_panel_return_key_disabled_get");
1668 return EINA_FALSE;
1669 }
1670
1671 return ctx->input_panel_return_key_disabled;
1672}
1673
1674/**
1675 * Set the caps lock mode on the input panel.
1676 *
1677 * @param ctx An #Ecore_IMF_Context.
1678 * @param mode Turn on caps lock on the input panel if EINA_TRUE
1679 * @ingroup Ecore_IMF_Context_Group
1680 * @since 1.2.0
1681 */
1682EAPI void
1683ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode)
1684{
1685 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1686 {
1687 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1688 "ecore_imf_context_input_panel_caps_lock_mode_set");
1689 return;
1690 }
1691
1692 if (ctx->klass->input_panel_caps_lock_mode_set)
1693 ctx->klass->input_panel_caps_lock_mode_set(ctx, mode);
1694
1695 ctx->input_panel_caps_lock_mode = mode;
1696}
1697
1698/**
1699 * Get the caps lock mode on the input panel.
1700 *
1701 * @param ctx An #Ecore_IMF_Context.
1702 * @return EINA_TRUE if the caps lock is turned on.
1703 * @ingroup Ecore_IMF_Context_Group
1704 * @since 1.2.0
1705 */
1706EAPI Eina_Bool
1707ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx)
1708{
1709 if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT))
1710 {
1711 ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT,
1712 "ecore_imf_context_input_panel_caps_lock_mode_get");
1713 return EINA_FALSE;
1714 }
1715
1716 return ctx->input_panel_caps_lock_mode;
1717}
1718
diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h b/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h
index d9dae80..b4ff0f2 100644
--- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h
+++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h
@@ -52,8 +52,11 @@ struct _Ecore_IMF_Context
52 Ecore_IMF_Autocapital_Type autocapital_type; 52 Ecore_IMF_Autocapital_Type autocapital_type;
53 Ecore_IMF_Input_Panel_Layout input_panel_layout; 53 Ecore_IMF_Input_Panel_Layout input_panel_layout;
54 Ecore_IMF_Input_Panel_Lang input_panel_lang; 54 Ecore_IMF_Input_Panel_Lang input_panel_lang;
55 Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type;
55 Eina_Bool allow_prediction : 1; 56 Eina_Bool allow_prediction : 1;
56 Eina_Bool input_panel_enabled : 1; 57 Eina_Bool input_panel_enabled : 1;
58 Eina_Bool input_panel_return_key_disabled : 1;
59 Eina_Bool input_panel_caps_lock_mode : 1;
57}; 60};
58 61
59struct _Ecore_IMF_Module 62struct _Ecore_IMF_Module
diff --git a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in
index ab6503b..1542919 100644
--- a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -192,6 +191,8 @@ EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@ 191EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@ 192EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@ 193EXEEXT = @EXEEXT@
194EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
195EXOTIC_LIBS = @EXOTIC_LIBS@
195FGREP = @FGREP@ 196FGREP = @FGREP@
196GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
197GLIB_CFLAGS = @GLIB_CFLAGS@ 198GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -247,6 +248,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
247PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
248PIXMAN_LIBS = @PIXMAN_LIBS@ 249PIXMAN_LIBS = @PIXMAN_LIBS@
249PKG_CONFIG = @PKG_CONFIG@ 250PKG_CONFIG = @PKG_CONFIG@
251PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
252PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
250POSUB = @POSUB@ 253POSUB = @POSUB@
251RANLIB = @RANLIB@ 254RANLIB = @RANLIB@
252SCIM_CFLAGS = @SCIM_CFLAGS@ 255SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -257,6 +260,7 @@ SDL_LIBS = @SDL_LIBS@
257SED = @SED@ 260SED = @SED@
258SET_MAKE = @SET_MAKE@ 261SET_MAKE = @SET_MAKE@
259SHELL = @SHELL@ 262SHELL = @SHELL@
263SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
260SSL_CFLAGS = @SSL_CFLAGS@ 264SSL_CFLAGS = @SSL_CFLAGS@
261SSL_LIBS = @SSL_LIBS@ 265SSL_LIBS = @SSL_LIBS@
262STRIP = @STRIP@ 266STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c b/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c
index 86badf5..62ba4c8 100644
--- a/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c
+++ b/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c
@@ -221,6 +221,28 @@ ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event,
221 * @param evas_event The received Evas event. 221 * @param evas_event The received Evas event.
222 * @param imf_event The location to store the converted Ecore_IMF event. 222 * @param imf_event The location to store the converted Ecore_IMF event.
223 * @ingroup Ecore_IMF_Evas_Group 223 * @ingroup Ecore_IMF_Evas_Group
224 *
225 * Example
226 * @code
227 * static void
228 * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
229 * {
230 * Evas_Event_Key_Down *ev = event_info;
231 * if (!ev->keyname) return;
232 *
233 * if (imf_context)
234 * {
235 * Ecore_IMF_Event_Key_Down ecore_ev;
236 * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
237 * if (ecore_imf_context_filter_event(imf_context,
238 * ECORE_IMF_EVENT_KEY_DOWN,
239 * (Ecore_IMF_Event *)&ecore_ev))
240 * return;
241 * }
242 * }
243 *
244 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data);
245 * @endcode
224 */ 246 */
225EAPI void 247EAPI void
226ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, 248ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event,
@@ -244,6 +266,28 @@ ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event,
244 * @param evas_event The received Evas event. 266 * @param evas_event The received Evas event.
245 * @param imf_event The location to store the converted Ecore_IMF event. 267 * @param imf_event The location to store the converted Ecore_IMF event.
246 * @ingroup Ecore_IMF_Evas_Group 268 * @ingroup Ecore_IMF_Evas_Group
269 *
270 * Example
271 * @code
272 * static void
273 * _key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
274 * {
275 * Evas_Event_Key_Up *ev = event_info;
276 * if (!ev->keyname) return;
277 *
278 * if (imf_context)
279 * {
280 * Ecore_IMF_Event_Key_Up ecore_ev;
281 * ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
282 * if (ecore_imf_context_filter_event(imf_context,
283 * ECORE_IMF_EVENT_KEY_UP,
284 * (Ecore_IMF_Event *)&ecore_ev))
285 * return;
286 * }
287 * }
288 *
289 * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, _key_up_cb, data);
290 * @endcode
247 */ 291 */
248EAPI void 292EAPI void
249ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, 293ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event,
diff --git a/libraries/ecore/src/lib/ecore_input/Makefile.in b/libraries/ecore/src/lib/ecore_input/Makefile.in
index f9fc99a..a3eeb2e 100644
--- a/libraries/ecore/src/lib/ecore_input/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_input/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -192,6 +191,8 @@ EVAS_LIBS = @EVAS_LIBS@
192EVIL_CFLAGS = @EVIL_CFLAGS@ 191EVIL_CFLAGS = @EVIL_CFLAGS@
193EVIL_LIBS = @EVIL_LIBS@ 192EVIL_LIBS = @EVIL_LIBS@
194EXEEXT = @EXEEXT@ 193EXEEXT = @EXEEXT@
194EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
195EXOTIC_LIBS = @EXOTIC_LIBS@
195FGREP = @FGREP@ 196FGREP = @FGREP@
196GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
197GLIB_CFLAGS = @GLIB_CFLAGS@ 198GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -247,6 +248,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
247PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
248PIXMAN_LIBS = @PIXMAN_LIBS@ 249PIXMAN_LIBS = @PIXMAN_LIBS@
249PKG_CONFIG = @PKG_CONFIG@ 250PKG_CONFIG = @PKG_CONFIG@
251PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
252PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
250POSUB = @POSUB@ 253POSUB = @POSUB@
251RANLIB = @RANLIB@ 254RANLIB = @RANLIB@
252SCIM_CFLAGS = @SCIM_CFLAGS@ 255SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -257,6 +260,7 @@ SDL_LIBS = @SDL_LIBS@
257SED = @SED@ 260SED = @SED@
258SET_MAKE = @SET_MAKE@ 261SET_MAKE = @SET_MAKE@
259SHELL = @SHELL@ 262SHELL = @SHELL@
263SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
260SSL_CFLAGS = @SSL_CFLAGS@ 264SSL_CFLAGS = @SSL_CFLAGS@
261SSL_LIBS = @SSL_LIBS@ 265SSL_LIBS = @SSL_LIBS@
262STRIP = @STRIP@ 266STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_input_evas/Makefile.in b/libraries/ecore/src/lib/ecore_input_evas/Makefile.in
index d0ac95e..d3937d9 100644
--- a/libraries/ecore/src/lib/ecore_input_evas/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_input_evas/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@ 192EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@ 193EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@ 194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@ 197FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@ 199GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@ 250PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@ 251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
251POSUB = @POSUB@ 254POSUB = @POSUB@
252RANLIB = @RANLIB@ 255RANLIB = @RANLIB@
253SCIM_CFLAGS = @SCIM_CFLAGS@ 256SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@
258SED = @SED@ 261SED = @SED@
259SET_MAKE = @SET_MAKE@ 262SET_MAKE = @SET_MAKE@
260SHELL = @SHELL@ 263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
261SSL_CFLAGS = @SSL_CFLAGS@ 265SSL_CFLAGS = @SSL_CFLAGS@
262SSL_LIBS = @SSL_LIBS@ 266SSL_LIBS = @SSL_LIBS@
263STRIP = @STRIP@ 267STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_ipc/Makefile.in b/libraries/ecore/src/lib/ecore_ipc/Makefile.in
index ac2cf6f..e339ffc 100644
--- a/libraries/ecore/src/lib/ecore_ipc/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_ipc/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@ 192EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@ 193EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@ 194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@ 197FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@ 199GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@ 250PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@ 251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
251POSUB = @POSUB@ 254POSUB = @POSUB@
252RANLIB = @RANLIB@ 255RANLIB = @RANLIB@
253SCIM_CFLAGS = @SCIM_CFLAGS@ 256SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@
258SED = @SED@ 261SED = @SED@
259SET_MAKE = @SET_MAKE@ 262SET_MAKE = @SET_MAKE@
260SHELL = @SHELL@ 263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
261SSL_CFLAGS = @SSL_CFLAGS@ 265SSL_CFLAGS = @SSL_CFLAGS@
262SSL_LIBS = @SSL_LIBS@ 266SSL_LIBS = @SSL_LIBS@
263STRIP = @STRIP@ 267STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c
index e27134d..0210f1d 100644
--- a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c
+++ b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c
@@ -316,7 +316,10 @@ ecore_ipc_shutdown(void)
316 if (--_ecore_ipc_init_count != 0) 316 if (--_ecore_ipc_init_count != 0)
317 return _ecore_ipc_init_count; 317 return _ecore_ipc_init_count;
318 318
319 while (servers) ecore_ipc_server_del(eina_list_data_get(servers)); 319 Eina_List *l, *l2;
320 Ecore_Ipc_Server *svr;
321 EINA_LIST_FOREACH_SAFE(servers, l, l2, svr)
322 ecore_ipc_server_del(svr);
320 323
321 for (i = 0; i < 6; i++) 324 for (i = 0; i < 6; i++)
322 ecore_event_handler_del(handler[i]); 325 ecore_event_handler_del(handler[i]);
diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
index 487231b..54a0435 100644
--- a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -194,6 +193,8 @@ EVAS_LIBS = @EVAS_LIBS@
194EVIL_CFLAGS = @EVIL_CFLAGS@ 193EVIL_CFLAGS = @EVIL_CFLAGS@
195EVIL_LIBS = @EVIL_LIBS@ 194EVIL_LIBS = @EVIL_LIBS@
196EXEEXT = @EXEEXT@ 195EXEEXT = @EXEEXT@
196EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
197EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@ 198FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@ 200GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -249,6 +250,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@ 251PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@ 252PKG_CONFIG = @PKG_CONFIG@
253PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
254PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
252POSUB = @POSUB@ 255POSUB = @POSUB@
253RANLIB = @RANLIB@ 256RANLIB = @RANLIB@
254SCIM_CFLAGS = @SCIM_CFLAGS@ 257SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -259,6 +262,7 @@ SDL_LIBS = @SDL_LIBS@
259SED = @SED@ 262SED = @SED@
260SET_MAKE = @SET_MAKE@ 263SET_MAKE = @SET_MAKE@
261SHELL = @SHELL@ 264SHELL = @SHELL@
265SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
262SSL_CFLAGS = @SSL_CFLAGS@ 266SSL_CFLAGS = @SSL_CFLAGS@
263SSL_LIBS = @SSL_LIBS@ 267SSL_LIBS = @SSL_LIBS@
264STRIP = @STRIP@ 268STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_sdl/Makefile.in b/libraries/ecore/src/lib/ecore_sdl/Makefile.in
index c0312b0..50003ab 100644
--- a/libraries/ecore/src/lib/ecore_sdl/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_sdl/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@
193EVIL_CFLAGS = @EVIL_CFLAGS@ 192EVIL_CFLAGS = @EVIL_CFLAGS@
194EVIL_LIBS = @EVIL_LIBS@ 193EVIL_LIBS = @EVIL_LIBS@
195EXEEXT = @EXEEXT@ 194EXEEXT = @EXEEXT@
195EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
196EXOTIC_LIBS = @EXOTIC_LIBS@
196FGREP = @FGREP@ 197FGREP = @FGREP@
197GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
198GLIB_CFLAGS = @GLIB_CFLAGS@ 199GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
248PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
249PIXMAN_LIBS = @PIXMAN_LIBS@ 250PIXMAN_LIBS = @PIXMAN_LIBS@
250PKG_CONFIG = @PKG_CONFIG@ 251PKG_CONFIG = @PKG_CONFIG@
252PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
253PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
251POSUB = @POSUB@ 254POSUB = @POSUB@
252RANLIB = @RANLIB@ 255RANLIB = @RANLIB@
253SCIM_CFLAGS = @SCIM_CFLAGS@ 256SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@
258SED = @SED@ 261SED = @SED@
259SET_MAKE = @SET_MAKE@ 262SET_MAKE = @SET_MAKE@
260SHELL = @SHELL@ 263SHELL = @SHELL@
264SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
261SSL_CFLAGS = @SSL_CFLAGS@ 265SSL_CFLAGS = @SSL_CFLAGS@
262SSL_LIBS = @SSL_LIBS@ 266SSL_LIBS = @SSL_LIBS@
263STRIP = @STRIP@ 267STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
index fdf6314..7dab37c 100644
--- a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -1,8 +1,13 @@
1#ifndef _ECORE_WAYLAND_H_ 1#ifndef _ECORE_WAYLAND_H_
2# define _ECORE_WAYLAND_H_ 2# define _ECORE_WAYLAND_H_
3 3
4# define GL_GLEXT_PROTOTYPES
5
4# include <Eina.h> 6# include <Eina.h>
5# include <wayland-client.h> 7# include <wayland-client.h>
8# include <wayland-egl.h> // NB: already includes wayland-client.h
9# include <EGL/egl.h>
10# include <EGL/eglext.h>
6 11
7# ifdef EAPI 12# ifdef EAPI
8# undef EAPI 13# undef EAPI
@@ -18,71 +23,233 @@
18# define EAPI 23# define EAPI
19# endif 24# endif
20 25
26typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
27typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
28
29typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
30typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
31typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
32# ifndef _ECORE_WAYLAND_WINDOW_PREDEF
33typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
34# endif
35typedef struct _Ecore_Wl_Dnd_Source Ecore_Wl_Dnd_Source;
36typedef struct _Ecore_Wl_Dnd_Target Ecore_Wl_Dnd_Target;
37
21typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In; 38typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In;
22typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out; 39typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out;
23typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In; 40typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In;
24typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out; 41typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out;
42typedef struct _Ecore_Wl_Event_Window_Configure Ecore_Wl_Event_Window_Configure;
43typedef struct _Ecore_Wl_Event_Dnd_Enter Ecore_Wl_Event_Dnd_Enter;
44typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position;
45typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave;
46typedef struct _Ecore_Wl_Event_Dnd_Drop Ecore_Wl_Event_Dnd_Drop;
47typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound;
25 48
26typedef struct _Ecore_Wl_Drag_Source Ecore_Wl_Drag_Source; 49enum _Ecore_Wl_Window_Type
50{
51 ECORE_WL_WINDOW_TYPE_TOPLEVEL,
52 ECORE_WL_WINDOW_TYPE_FULLSCREEN,
53 ECORE_WL_WINDOW_TYPE_MAXIMIZED,
54 ECORE_WL_WINDOW_TYPE_TRANSIENT,
55 ECORE_WL_WINDOW_TYPE_MENU,
56 ECORE_WL_WINDOW_TYPE_CUSTOM
57};
27 58
28typedef struct _Ecore_Wl_Event_Drag_Start Ecore_Wl_Event_Drag_Start; 59enum _Ecore_Wl_Window_Buffer_Type
29typedef struct _Ecore_Wl_Event_Drag_Stop Ecore_Wl_Event_Drag_Stop; 60{
61 ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW,
62 ECORE_WL_WINDOW_BUFFER_TYPE_EGL_IMAGE,
63 ECORE_WL_WINDOW_BUFFER_TYPE_SHM
64};
30 65
31struct _Ecore_Wl_Event_Mouse_In 66struct _Ecore_Wl_Display
32{ 67{
33 int modifiers; 68 struct
34 int x, y; 69 {
70 struct wl_display *display;
71 struct wl_compositor *compositor;
72 struct wl_shell *shell;
73 struct wl_shm *shm;
74 struct wl_data_device_manager *data_device_manager;
75 } wl;
35 76
36 struct 77 struct
37 { 78 {
38 int x, y; 79 EGLDisplay display;
39 } root; 80 EGLConfig rgb_config;
81 EGLConfig argb_config;
82 EGLContext rgb_context;
83 EGLContext argb_context;
84 } egl;
85
86 int fd;
87 unsigned int mask;
88 Ecore_Fd_Handler *fd_hdl;
89
90 struct wl_list inputs;
91 struct wl_list outputs;
92
93 struct xkb_desc *xkb;
94
95 Ecore_Wl_Output *output;
96
97 PFNEGLCREATEIMAGEKHRPROC create_image;
98 PFNEGLDESTROYIMAGEKHRPROC destroy_image;
99
100 void (*output_configure)(Ecore_Wl_Output *output, void *data);
101 void *data;
102};
103
104struct _Ecore_Wl_Output
105{
106 Ecore_Wl_Display *display;
107 struct wl_output *output;
108 Eina_Rectangle allocation;
109 struct wl_list link;
110
111 void (*destroy) (Ecore_Wl_Output *output, void *data);
112 void *data;
113};
114
115struct _Ecore_Wl_Input
116{
117 Ecore_Wl_Display *display;
118 struct wl_input_device *input_device;
119 struct wl_data_device *data_device;
120
121 Ecore_Wl_Window *pointer_focus;
122 Ecore_Wl_Window *keyboard_focus;
123
124 unsigned int button;
125 unsigned int timestamp;
126 unsigned int modifiers;
127 int sx, sy;
128
129 struct wl_list link;
130
131 /* TODO: grab */
132 unsigned int grab_button;
133
134 Ecore_Wl_Dnd_Source *drag_source;
135 Ecore_Wl_Dnd_Source *selection_source;
136};
40 137
41 unsigned int window; 138struct _Ecore_Wl_Window
139{
140 Ecore_Wl_Display *display;
141 Ecore_Wl_Window *parent;
142
143 struct wl_surface *surface;
144 struct wl_shell_surface *shell_surface;
145
146 int id;
147 int x, y;
148 int edges;
149
150 Eina_Rectangle allocation, pending_allocation;
151 Eina_Rectangle saved_allocation, server_allocation;
42 152
43 unsigned int time; 153 /* Eina_Bool redraw_scheduled : 1; */
154 /* Eina_Bool resize_scheduled : 1; */
155 Eina_Bool transparent : 1;
156
157 Ecore_Wl_Window_Type type;
158 Ecore_Wl_Window_Buffer_Type buffer_type;
159
160 Ecore_Wl_Input *pointer_device;
161 Ecore_Wl_Input *keyboard_device;
162
163 void *data;
44}; 164};
45 165
46struct _Ecore_Wl_Event_Mouse_Out 166struct _Ecore_Wl_Event_Mouse_In
47{ 167{
48 int modifiers; 168 int modifiers;
49 int x, y; 169 int x, y;
170 struct
171 {
172 int x, y;
173 } root;
174 unsigned int win;
175 unsigned int event_win;
176 unsigned int root_win;
177 unsigned int timestamp;
178};
50 179
180struct _Ecore_Wl_Event_Mouse_Out
181{
182 int modifiers;
183 int x, y;
51 struct 184 struct
52 { 185 {
53 int x, y; 186 int x, y;
54 } root; 187 } root;
188 unsigned int win;
189 unsigned int event_win;
190 unsigned int root_win;
191 unsigned int timestamp;
192};
55 193
56 unsigned int window; 194struct _Ecore_Wl_Event_Focus_In
195{
196 unsigned int win;
197 unsigned int timestamp;
198};
57 199
58 unsigned int time; 200struct _Ecore_Wl_Event_Focus_Out
201{
202 unsigned int win;
203 unsigned int timestamp;
59}; 204};
60 205
61struct _Ecore_Wl_Event_Focus_In 206struct _Ecore_Wl_Event_Window_Configure
62{ 207{
63 unsigned int window; 208 unsigned int win;
64 /* TODO: mode & detail */ 209 unsigned int event_win;
65 unsigned int time; 210 int x, y, w, h;
211 unsigned int timestamp;
66}; 212};
67 213
68struct _Ecore_Wl_Event_Focus_Out 214struct _Ecore_Wl_Event_Dnd_Enter
69{ 215{
70 unsigned int window; 216 unsigned int win, source;
71 /* TODO: mode & detail */ 217 char **types;
72 unsigned int time; 218 int num_types;
219 struct
220 {
221 int x, y;
222 } position;
73}; 223};
74 224
75struct _Ecore_Wl_Event_Drag_Start 225struct _Ecore_Wl_Event_Dnd_Position
76{ 226{
77 struct wl_data_device *device; 227 unsigned int win, source;
78 struct wl_surface *surface; 228 struct
79 const char *mime_type; 229 {
80 uint32_t timestamp; 230 int x, y;
231 } position;
81}; 232};
82 233
83struct _Ecore_Wl_Event_Drag_Stop 234struct _Ecore_Wl_Event_Dnd_Leave
84{ 235{
236 unsigned int win, source;
237};
85 238
239struct _Ecore_Wl_Event_Dnd_Drop
240{
241 unsigned int win, source;
242 struct
243 {
244 int x, y;
245 } position;
246};
247
248struct _Ecore_Wl_Event_Interfaces_Bound
249{
250 Eina_Bool compositor : 1;
251 Eina_Bool shm : 1;
252 Eina_Bool shell : 1;
86}; 253};
87 254
88/** 255/**
@@ -92,32 +259,46 @@ struct _Ecore_Wl_Event_Drag_Stop
92 * Ecore_Wl provides a wrapper and convenience functions for using the 259 * Ecore_Wl provides a wrapper and convenience functions for using the
93 * Wayland window system. Function groups for this part of the library 260 * Wayland window system. Function groups for this part of the library
94 * include the following: 261 * include the following:
262 *
95 * @li @ref Ecore_Wl_Init_Group 263 * @li @ref Ecore_Wl_Init_Group
264 * @li @ref Ecore_Wl_Display_Group
265 * @li @ref Ecore_Wl_Flush_Group
266 * @li @ref Ecore_Wl_Window_Group
96 */ 267 */
97 268
269EAPI extern int ECORE_WL_EVENT_MOUSE_IN;
270EAPI extern int ECORE_WL_EVENT_MOUSE_OUT;
271EAPI extern int ECORE_WL_EVENT_FOCUS_IN;
272EAPI extern int ECORE_WL_EVENT_FOCUS_OUT;
273EAPI extern int ECORE_WL_EVENT_WINDOW_CONFIGURE;
274EAPI extern int ECORE_WL_EVENT_DND_ENTER;
275EAPI extern int ECORE_WL_EVENT_DND_POSITION;
276EAPI extern int ECORE_WL_EVENT_DND_LEAVE;
277EAPI extern int ECORE_WL_EVENT_DND_DROP;
278EAPI extern int ECORE_WL_EVENT_INTERFACES_BOUND;
279
98EAPI int ecore_wl_init(const char *name); 280EAPI int ecore_wl_init(const char *name);
99EAPI int ecore_wl_shutdown(void); 281EAPI int ecore_wl_shutdown(void);
100
101EAPI struct wl_display *ecore_wl_display_get(void);
102EAPI struct wl_shm *ecore_wl_shm_get(void);
103EAPI struct wl_compositor *ecore_wl_compositor_get(void);
104EAPI struct wl_shell *ecore_wl_shell_get(void);
105EAPI struct wl_input_device *ecore_wl_input_device_get(void);
106EAPI void ecore_wl_screen_size_get(int *w, int *h);
107EAPI unsigned int ecore_wl_format_get(void);
108EAPI void ecore_wl_flush(void); 282EAPI void ecore_wl_flush(void);
109EAPI void ecore_wl_sync(void); 283EAPI void ecore_wl_sync(void);
284EAPI struct wl_shm *ecore_wl_shm_get(void);
285EAPI struct wl_display *ecore_wl_display_get(void);
286EAPI void ecore_wl_screen_size_get(int *w, int *h);
110EAPI void ecore_wl_pointer_xy_get(int *x, int *y); 287EAPI void ecore_wl_pointer_xy_get(int *x, int *y);
111 288
112EAPI Ecore_Wl_Drag_Source *ecore_wl_drag_source_create(int hotspot_x, int hotspot_y, int offset_x, int offset_y, const char *mimetype, unsigned int timestamp, void *data); 289EAPI Ecore_Wl_Window *ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type);
113EAPI void ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer); 290EAPI void ecore_wl_window_free(Ecore_Wl_Window *win);
114EAPI void ecore_wl_drag_stop(void); 291EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y);
115 292EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location);
116EAPI extern int ECORE_WL_EVENT_MOUSE_IN; 293EAPI void ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h);
117EAPI extern int ECORE_WL_EVENT_MOUSE_OUT; 294EAPI void ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y);
118EAPI extern int ECORE_WL_EVENT_FOCUS_IN; 295EAPI void ecore_wl_window_show(Ecore_Wl_Window *win);
119EAPI extern int ECORE_WL_EVENT_FOCUS_OUT; 296EAPI void ecore_wl_window_hide(Ecore_Wl_Window *win);
120EAPI extern int ECORE_WL_EVENT_DRAG_START; 297EAPI void ecore_wl_window_raise(Ecore_Wl_Window *win);
121EAPI extern int ECORE_WL_EVENT_DRAG_STOP; 298EAPI void ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized);
299EAPI void ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen);
300EAPI void ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h);
301EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win);
302EAPI Ecore_Wl_Window *ecore_wl_window_find(unsigned int id);
122 303
123#endif 304#endif
diff --git a/libraries/ecore/src/lib/ecore_wayland/Makefile.am b/libraries/ecore/src/lib/ecore_wayland/Makefile.am
index ea005b2..f6b801d 100644
--- a/libraries/ecore/src/lib/ecore_wayland/Makefile.am
+++ b/libraries/ecore/src/lib/ecore_wayland/Makefile.am
@@ -14,9 +14,11 @@ includes_HEADERS = Ecore_Wayland.h
14includesdir = $(includedir)/ecore-@VMAJ@ 14includesdir = $(includedir)/ecore-@VMAJ@
15 15
16libecore_wayland_la_SOURCES = \ 16libecore_wayland_la_SOURCES = \
17ecore_wl.c 17ecore_wl.c \
18 18ecore_wl_output.c \
19## ecore_wl_window.c 19ecore_wl_input.c \
20ecore_wl_window.c \
21ecore_wl_dnd.c
20 22
21libecore_wayland_la_LIBADD = \ 23libecore_wayland_la_LIBADD = \
22$(top_builddir)/src/lib/ecore/libecore.la \ 24$(top_builddir)/src/lib/ecore/libecore.la \
diff --git a/libraries/ecore/src/lib/ecore_wayland/Makefile.in b/libraries/ecore/src/lib/ecore_wayland/Makefile.in
index 411da19..39c633d 100644
--- a/libraries/ecore/src/lib/ecore_wayland/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_wayland/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -86,7 +85,8 @@ am__base_list = \
86 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 85 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
87am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" 86am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"
88LTLIBRARIES = $(lib_LTLIBRARIES) 87LTLIBRARIES = $(lib_LTLIBRARIES)
89am_libecore_wayland_la_OBJECTS = ecore_wl.lo 88am_libecore_wayland_la_OBJECTS = ecore_wl.lo ecore_wl_output.lo \
89 ecore_wl_input.lo ecore_wl_window.lo ecore_wl_dnd.lo
90libecore_wayland_la_OBJECTS = $(am_libecore_wayland_la_OBJECTS) 90libecore_wayland_la_OBJECTS = $(am_libecore_wayland_la_OBJECTS)
91AM_V_lt = $(am__v_lt_$(V)) 91AM_V_lt = $(am__v_lt_$(V))
92am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) 92am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -190,6 +190,8 @@ EVAS_LIBS = @EVAS_LIBS@
190EVIL_CFLAGS = @EVIL_CFLAGS@ 190EVIL_CFLAGS = @EVIL_CFLAGS@
191EVIL_LIBS = @EVIL_LIBS@ 191EVIL_LIBS = @EVIL_LIBS@
192EXEEXT = @EXEEXT@ 192EXEEXT = @EXEEXT@
193EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
194EXOTIC_LIBS = @EXOTIC_LIBS@
193FGREP = @FGREP@ 195FGREP = @FGREP@
194GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 196GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
195GLIB_CFLAGS = @GLIB_CFLAGS@ 197GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -245,6 +247,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
245PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 247PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
246PIXMAN_LIBS = @PIXMAN_LIBS@ 248PIXMAN_LIBS = @PIXMAN_LIBS@
247PKG_CONFIG = @PKG_CONFIG@ 249PKG_CONFIG = @PKG_CONFIG@
250PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
251PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
248POSUB = @POSUB@ 252POSUB = @POSUB@
249RANLIB = @RANLIB@ 253RANLIB = @RANLIB@
250SCIM_CFLAGS = @SCIM_CFLAGS@ 254SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -255,6 +259,7 @@ SDL_LIBS = @SDL_LIBS@
255SED = @SED@ 259SED = @SED@
256SET_MAKE = @SET_MAKE@ 260SET_MAKE = @SET_MAKE@
257SHELL = @SHELL@ 261SHELL = @SHELL@
262SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
258SSL_CFLAGS = @SSL_CFLAGS@ 263SSL_CFLAGS = @SSL_CFLAGS@
259SSL_LIBS = @SSL_LIBS@ 264SSL_LIBS = @SSL_LIBS@
260STRIP = @STRIP@ 265STRIP = @STRIP@
@@ -482,7 +487,11 @@ lib_LTLIBRARIES = libecore_wayland.la
482includes_HEADERS = Ecore_Wayland.h 487includes_HEADERS = Ecore_Wayland.h
483includesdir = $(includedir)/ecore-@VMAJ@ 488includesdir = $(includedir)/ecore-@VMAJ@
484libecore_wayland_la_SOURCES = \ 489libecore_wayland_la_SOURCES = \
485ecore_wl.c 490ecore_wl.c \
491ecore_wl_output.c \
492ecore_wl_input.c \
493ecore_wl_window.c \
494ecore_wl_dnd.c
486 495
487libecore_wayland_la_LIBADD = \ 496libecore_wayland_la_LIBADD = \
488$(top_builddir)/src/lib/ecore/libecore.la \ 497$(top_builddir)/src/lib/ecore/libecore.la \
@@ -569,6 +578,10 @@ distclean-compile:
569 -rm -f *.tab.c 578 -rm -f *.tab.c
570 579
571@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl.Plo@am__quote@ 580@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl.Plo@am__quote@
581@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_dnd.Plo@am__quote@
582@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_input.Plo@am__quote@
583@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_output.Plo@am__quote@
584@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_window.Plo@am__quote@
572 585
573.c.o: 586.c.o:
574@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 587@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c
index f62503b..5f1b20d 100644
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c
+++ b/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c
@@ -1,16 +1,11 @@
1#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
2# include "config.h" 2# include <config.h>
3#endif 3#endif
4 4
5#include "Ecore.h" 5#include <fcntl.h>
6#include "ecore_private.h"
7#include "Ecore_Input.h"
8#include "ecore_wl_private.h"
9#include "Ecore_Wayland.h"
10 6
11/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ... 7/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ...
12 * What about other OSs ?? */ 8 * What about other OSs ?? */
13#include <fcntl.h>
14#ifdef __linux__ 9#ifdef __linux__
15# include <linux/input.h> 10# include <linux/input.h>
16#else 11#else
@@ -23,150 +18,86 @@
23# define BTN_BACK 0x116 18# define BTN_BACK 0x116
24#endif 19#endif
25 20
26#include <X11/extensions/XKBcommon.h> 21#include "Ecore.h"
22#include "ecore_private.h"
23#include "Ecore_Input.h"
24#include "ecore_wl_private.h"
25#include "Ecore_Wayland.h"
27 26
28/* local function prototypes */ 27/* local function prototypes */
29static Eina_Bool _ecore_wl_shutdown(Eina_Bool close_display); 28static Eina_Bool _ecore_wl_shutdown(Eina_Bool close);
30static void _ecore_wl_cb_disp_handle_global(struct wl_display *disp, uint32_t id, const char *interface, uint32_t version __UNUSED__, void *data __UNUSED__); 29static int _ecore_wl_cb_event_mask_update(unsigned int mask, void *data);
31static int _ecore_wl_cb_disp_event_mask_update(uint32_t mask, void *data __UNUSED__); 30static Eina_Bool _ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__);
32static void _ecore_wl_cb_disp_handle_geometry(void *data __UNUSED__, struct wl_output *output __UNUSED__, int x, int y, int pw __UNUSED__, int ph __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__); 31static void _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data);
33static void _ecore_wl_cb_disp_handle_mode(void *data __UNUSED__, struct wl_output *output __UNUSED__, uint32_t flags, int w, int h, int refresh __UNUSED__); 32static Eina_Bool _ecore_wl_egl_init(Ecore_Wl_Display *ewd);
34static Eina_Bool _ecore_wl_cb_fd_handle(void *data, Ecore_Fd_Handler *hdl __UNUSED__); 33static Eina_Bool _ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd);
35static void _ecore_wl_cb_handle_motion(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, int32_t x, int32_t y, int32_t sx, int32_t sy); 34static Eina_Bool _ecore_wl_xkb_init(Ecore_Wl_Display *ewd);
36static void _ecore_wl_cb_handle_button(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, uint32_t btn, uint32_t state); 35static Eina_Bool _ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd);
37static void _ecore_wl_cb_handle_key(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, uint32_t key, uint32_t state);
38static void _ecore_wl_cb_handle_pointer_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, struct wl_surface *surface, int32_t x, int32_t y, int32_t sx, int32_t sy);
39static void _ecore_wl_cb_handle_keyboard_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, struct wl_surface *surface, struct wl_array *keys);
40static void _ecore_wl_cb_handle_touch_down(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, struct wl_surface *surface, int32_t id, int32_t x, int32_t y);
41static void _ecore_wl_cb_handle_touch_up(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id);
42static void _ecore_wl_cb_handle_touch_motion(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id, int32_t x, int32_t y);
43static void _ecore_wl_cb_handle_touch_frame(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__);
44static void _ecore_wl_cb_handle_touch_cancel(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__);
45static void _ecore_wl_cb_source_target(void *data, struct wl_data_source *source __UNUSED__, const char *mime_type __UNUSED__);
46static void _ecore_wl_cb_source_send(void *data, struct wl_data_source *source, const char *mime_type, int32_t fd);
47static void _ecore_wl_cb_source_cancelled(void *data, struct wl_data_source *source __UNUSED__);
48static void _ecore_wl_cb_source_offer(void *data, struct wl_data_offer *offer __UNUSED__, const char *type);
49static void _ecore_wl_cb_data_offer(void *data, struct wl_data_device *data_dev, uint32_t id);
50static void _ecore_wl_cb_data_enter(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, struct wl_surface *surface, int32_t x, int32_t y, struct wl_data_offer *offer);
51static void _ecore_wl_cb_data_leave(void *data __UNUSED__, struct wl_data_device *data_dev);
52static void _ecore_wl_cb_data_motion(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, int32_t x, int32_t y);
53static void _ecore_wl_cb_data_drop(void *data __UNUSED__, struct wl_data_device *data_dev);
54static void _ecore_wl_cb_data_selection(void *data, struct wl_data_device *data_dev, struct wl_data_offer *offer);
55
56static void _ecore_wl_mouse_move_send(uint32_t timestamp);
57static void _ecore_wl_mouse_out_send(struct wl_surface *surface, uint32_t timestamp);
58static void _ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp);
59static void _ecore_wl_mouse_up_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp);
60static void _ecore_wl_mouse_down_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp);
61static void _ecore_wl_focus_out_send(struct wl_surface *surface, uint32_t timestamp);
62static void _ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp);
63 36
64/* local variables */ 37/* local variables */
65static int _ecore_wl_init_count = 0; 38static int _ecore_wl_init_count = 0;
66static struct wl_display *_ecore_wl_disp = NULL;
67static uint32_t _ecore_wl_disp_mask = 0;
68static uint32_t _ecore_wl_disp_format = WL_SHM_FORMAT_ARGB8888;
69static Eina_Rectangle _ecore_wl_screen;
70static Ecore_Fd_Handler *_ecore_wl_fd_hdl = NULL;
71static int _ecore_wl_screen_x = 0;
72static int _ecore_wl_screen_y = 0;
73static int _ecore_wl_surface_x = 0;
74static int _ecore_wl_surface_y = 0;
75static int _ecore_wl_touch_x = 0;
76static int _ecore_wl_touch_y = 0;
77static int _ecore_wl_input_modifiers = 0;
78static struct xkb_desc *_ecore_wl_xkb;
79static uint32_t _ecore_wl_input_button = 0;
80
81static struct wl_compositor *_ecore_wl_comp;
82static struct wl_shm *_ecore_wl_shm;
83static struct wl_shell *_ecore_wl_shell;
84static struct wl_output *_ecore_wl_output;
85static struct wl_input_device *_ecore_wl_input_dev;
86static struct wl_surface *_ecore_wl_input_surface;
87static struct wl_surface *_ecore_wl_touch_surface;
88static struct wl_data_device_manager *_ecore_wl_data_manager;
89static struct wl_data_device *_ecore_wl_data_dev;
90
91static const struct wl_output_listener _ecore_wl_output_listener =
92{
93 _ecore_wl_cb_disp_handle_geometry,
94 _ecore_wl_cb_disp_handle_mode
95};
96static const struct wl_input_device_listener _ecore_wl_input_listener =
97{
98 _ecore_wl_cb_handle_motion,
99 _ecore_wl_cb_handle_button,
100 _ecore_wl_cb_handle_key,
101 _ecore_wl_cb_handle_pointer_focus,
102 _ecore_wl_cb_handle_keyboard_focus,
103 _ecore_wl_cb_handle_touch_down,
104 _ecore_wl_cb_handle_touch_up,
105 _ecore_wl_cb_handle_touch_motion,
106 _ecore_wl_cb_handle_touch_frame,
107 _ecore_wl_cb_handle_touch_cancel,
108};
109static const struct wl_data_source_listener _ecore_wl_source_listener =
110{
111 _ecore_wl_cb_source_target,
112 _ecore_wl_cb_source_send,
113 _ecore_wl_cb_source_cancelled
114};
115static const struct wl_data_device_listener _ecore_wl_data_listener =
116{
117 _ecore_wl_cb_data_offer,
118 _ecore_wl_cb_data_enter,
119 _ecore_wl_cb_data_leave,
120 _ecore_wl_cb_data_motion,
121 _ecore_wl_cb_data_drop,
122 _ecore_wl_cb_data_selection
123};
124static const struct wl_data_offer_listener _ecore_wl_offer_listener =
125{
126 _ecore_wl_cb_source_offer,
127};
128 39
129/* external variables */ 40/* external variables */
130int _ecore_wl_log_dom = -1; 41int _ecore_wl_log_dom = -1;
42Ecore_Wl_Display *_ecore_wl_disp = NULL;
43
131EAPI int ECORE_WL_EVENT_MOUSE_IN = 0; 44EAPI int ECORE_WL_EVENT_MOUSE_IN = 0;
132EAPI int ECORE_WL_EVENT_MOUSE_OUT = 0; 45EAPI int ECORE_WL_EVENT_MOUSE_OUT = 0;
133EAPI int ECORE_WL_EVENT_FOCUS_IN = 0; 46EAPI int ECORE_WL_EVENT_FOCUS_IN = 0;
134EAPI int ECORE_WL_EVENT_FOCUS_OUT = 0; 47EAPI int ECORE_WL_EVENT_FOCUS_OUT = 0;
135EAPI int ECORE_WL_EVENT_DRAG_START = 0; 48EAPI int ECORE_WL_EVENT_WINDOW_CONFIGURE = 0;
136EAPI int ECORE_WL_EVENT_DRAG_STOP = 0; 49EAPI int ECORE_WL_EVENT_DND_ENTER = 0;
137 50EAPI int ECORE_WL_EVENT_DND_POSITION = 0;
51EAPI int ECORE_WL_EVENT_DND_LEAVE = 0;
52EAPI int ECORE_WL_EVENT_DND_DROP = 0;
53EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0;
54
55/**
56 * @defgroup Ecore_Wl_Init_Group Wayland Library Init and Shutdown Functions
57 *
58 * Functions that start and shutdown the Ecore Wayland Library.
59 */
60
61/**
62 * Initialize the Wayland display connection to the given display.
63 *
64 * @param name Display target name. if @c NULL, the default display is
65 * assumed.
66 * @return The number of times the library has been initialized without being
67 * shut down. 0 is returned if an error occurs.
68 *
69 * @ingroup Ecore_Wl_Init_Group
70 */
138EAPI int 71EAPI int
139ecore_wl_init(const char *name) 72ecore_wl_init(const char *name)
140{ 73{
141 struct xkb_rule_names xkb_names;
142 int fd = 0;
143
144 if (++_ecore_wl_init_count != 1)
145 return _ecore_wl_init_count;
146
147 LOGFN(__FILE__, __LINE__, __FUNCTION__); 74 LOGFN(__FILE__, __LINE__, __FUNCTION__);
148 75
76 if (++_ecore_wl_init_count != 1) return _ecore_wl_init_count;
77
149 if (!eina_init()) return --_ecore_wl_init_count; 78 if (!eina_init()) return --_ecore_wl_init_count;
150 79
151 _ecore_wl_log_dom = 80 _ecore_wl_log_dom =
152 eina_log_domain_register("ecore_wl", ECORE_WL_DEFAULT_LOG_COLOR); 81 eina_log_domain_register("ecore_wl", ECORE_WL_DEFAULT_LOG_COLOR);
153 if (_ecore_wl_log_dom < 0) 82 if (_ecore_wl_log_dom < 0)
154 { 83 {
155 EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland."); 84 EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland");
156 eina_shutdown(); 85 eina_shutdown();
157 return --_ecore_wl_init_count; 86 return --_ecore_wl_init_count;
158 } 87 }
159 88
160 if (!ecore_init()) 89 if (!ecore_init())
161 { 90 {
91 ERR("Could not initialize ecore");
162 eina_log_domain_unregister(_ecore_wl_log_dom); 92 eina_log_domain_unregister(_ecore_wl_log_dom);
163 _ecore_wl_log_dom = -1; 93 _ecore_wl_log_dom = -1;
164 eina_shutdown(); 94 eina_shutdown();
165 return --_ecore_wl_init_count; 95 return --_ecore_wl_init_count;
166 } 96 }
167 97
168 if (!ecore_event_init()) 98 if (!ecore_event_init())
169 { 99 {
100 ERR("Could not initialize ecore_event");
170 eina_log_domain_unregister(_ecore_wl_log_dom); 101 eina_log_domain_unregister(_ecore_wl_log_dom);
171 _ecore_wl_log_dom = -1; 102 _ecore_wl_log_dom = -1;
172 ecore_shutdown(); 103 ecore_shutdown();
@@ -174,26 +105,23 @@ ecore_wl_init(const char *name)
174 return --_ecore_wl_init_count; 105 return --_ecore_wl_init_count;
175 } 106 }
176 107
177 if (!ECORE_WL_EVENT_MOUSE_IN) 108 if (!ECORE_WL_EVENT_MOUSE_IN)
178 { 109 {
179 ECORE_WL_EVENT_MOUSE_IN = ecore_event_type_new(); 110 ECORE_WL_EVENT_MOUSE_IN = ecore_event_type_new();
180 ECORE_WL_EVENT_MOUSE_OUT = ecore_event_type_new(); 111 ECORE_WL_EVENT_MOUSE_OUT = ecore_event_type_new();
181 ECORE_WL_EVENT_FOCUS_IN = ecore_event_type_new(); 112 ECORE_WL_EVENT_FOCUS_IN = ecore_event_type_new();
182 ECORE_WL_EVENT_FOCUS_OUT = ecore_event_type_new(); 113 ECORE_WL_EVENT_FOCUS_OUT = ecore_event_type_new();
183 ECORE_WL_EVENT_DRAG_START = ecore_event_type_new(); 114 ECORE_WL_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
184 ECORE_WL_EVENT_DRAG_STOP = ecore_event_type_new(); 115 ECORE_WL_EVENT_DND_ENTER = ecore_event_type_new();
116 ECORE_WL_EVENT_DND_POSITION = ecore_event_type_new();
117 ECORE_WL_EVENT_DND_LEAVE = ecore_event_type_new();
118 ECORE_WL_EVENT_DND_DROP = ecore_event_type_new();
119 ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new();
185 } 120 }
186 121
187 /* init xkb */ 122 if (!(_ecore_wl_disp = malloc(sizeof(Ecore_Wl_Display))))
188 /* FIXME: Somehow make this portable to other languages/countries */
189 xkb_names.rules = "evdev";
190 xkb_names.model = "evdev";
191 xkb_names.layout = "us";
192 xkb_names.variant = "";
193 xkb_names.options = "";
194 if (!(_ecore_wl_xkb = xkb_compile_keymap_from_rules(&xkb_names)))
195 { 123 {
196 ERR("Could not compile keymap"); 124 ERR("Could not allocate memory for Ecore_Wl_Display structure");
197 eina_log_domain_unregister(_ecore_wl_log_dom); 125 eina_log_domain_unregister(_ecore_wl_log_dom);
198 _ecore_wl_log_dom = -1; 126 _ecore_wl_log_dom = -1;
199 ecore_event_shutdown(); 127 ecore_event_shutdown();
@@ -202,9 +130,11 @@ ecore_wl_init(const char *name)
202 return --_ecore_wl_init_count; 130 return --_ecore_wl_init_count;
203 } 131 }
204 132
205 /* connect to the wayland display */ 133 memset(_ecore_wl_disp, 0, sizeof(Ecore_Wl_Display));
206 if (!(_ecore_wl_disp = wl_display_connect(name))) 134
135 if (!(_ecore_wl_disp->wl.display = wl_display_connect(name)))
207 { 136 {
137 ERR("Could not connect to Wayland display");
208 eina_log_domain_unregister(_ecore_wl_log_dom); 138 eina_log_domain_unregister(_ecore_wl_log_dom);
209 _ecore_wl_log_dom = -1; 139 _ecore_wl_log_dom = -1;
210 ecore_event_shutdown(); 140 ecore_event_shutdown();
@@ -213,23 +143,48 @@ ecore_wl_init(const char *name)
213 return --_ecore_wl_init_count; 143 return --_ecore_wl_init_count;
214 } 144 }
215 145
216 /* setup handler for wayland interfaces */ 146 _ecore_wl_disp->fd =
217 wl_display_add_global_listener(_ecore_wl_disp, 147 wl_display_get_fd(_ecore_wl_disp->wl.display,
218 _ecore_wl_cb_disp_handle_global, NULL); 148 _ecore_wl_cb_event_mask_update, _ecore_wl_disp);
149
150 _ecore_wl_disp->fd_hdl =
151 ecore_main_fd_handler_add(_ecore_wl_disp->fd, ECORE_FD_READ,
152 _ecore_wl_cb_handle_data, _ecore_wl_disp,
153 NULL, NULL);
154
155 wl_list_init(&_ecore_wl_disp->inputs);
156 wl_list_init(&_ecore_wl_disp->outputs);
157
158 wl_display_add_global_listener(_ecore_wl_disp->wl.display,
159 _ecore_wl_cb_handle_global, _ecore_wl_disp);
160
161 /* FIXME: Process connection events ?? */
162 wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE);
163
164 /* if (!_ecore_wl_egl_init(_ecore_wl_disp)) */
165 /* { */
166 /* ERR("Could not initialize EGL"); */
167 /* free(_ecore_wl_disp); */
168 /* eina_log_domain_unregister(_ecore_wl_log_dom); */
169 /* _ecore_wl_log_dom = -1; */
170 /* ecore_event_shutdown(); */
171 /* ecore_shutdown(); */
172 /* eina_shutdown(); */
173 /* return --_ecore_wl_init_count; */
174 /* } */
219 175
220 /* process connection events */ 176 /* _ecore_wl_disp->create_image = */
221 wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); 177 /* (void *)eglGetProcAddress("eglCreateImageKHR"); */
178 /* _ecore_wl_disp->destroy_image = */
179 /* (void *)eglGetProcAddress("eglDestroyImageKHR"); */
222 180
223 fd = wl_display_get_fd(_ecore_wl_disp, 181 /* TODO: create pointer surfaces */
224 _ecore_wl_cb_disp_event_mask_update, NULL);
225 182
226 _ecore_wl_fd_hdl = 183 if (!_ecore_wl_xkb_init(_ecore_wl_disp))
227 ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_wl_cb_fd_handle,
228 _ecore_wl_disp, NULL, NULL);
229 if (!_ecore_wl_fd_hdl)
230 { 184 {
231 wl_display_destroy(_ecore_wl_disp); 185 ERR("Could not initialize XKB");
232 _ecore_wl_disp = NULL; 186 _ecore_wl_egl_shutdown(_ecore_wl_disp);
187 free(_ecore_wl_disp);
233 eina_log_domain_unregister(_ecore_wl_log_dom); 188 eina_log_domain_unregister(_ecore_wl_log_dom);
234 _ecore_wl_log_dom = -1; 189 _ecore_wl_log_dom = -1;
235 ecore_event_shutdown(); 190 ecore_event_shutdown();
@@ -238,976 +193,359 @@ ecore_wl_init(const char *name)
238 return --_ecore_wl_init_count; 193 return --_ecore_wl_init_count;
239 } 194 }
240 195
196 _ecore_wl_window_init();
197
241 return _ecore_wl_init_count; 198 return _ecore_wl_init_count;
242} 199}
243 200
201/**
202 * Shuts down the Ecore Wayland Library
203 *
204 * In shutting down the library, the Wayland display connection is terminated
205 * and any event handlers for it are removed.
206 *
207 * @return The number of times the library has been initialized without
208 * being shut down.
209 *
210 * @ingroup Ecore_Wl_Init_Group
211 */
244EAPI int 212EAPI int
245ecore_wl_shutdown(void) 213ecore_wl_shutdown(void)
246{ 214{
247 return _ecore_wl_shutdown(EINA_TRUE); 215 LOGFN(__FILE__, __LINE__, __FUNCTION__);
248}
249
250EAPI struct wl_display *
251ecore_wl_display_get(void)
252{
253 return _ecore_wl_disp;
254}
255
256EAPI struct wl_shm *
257ecore_wl_shm_get(void)
258{
259 return _ecore_wl_shm;
260}
261
262EAPI struct wl_compositor *
263ecore_wl_compositor_get(void)
264{
265 return _ecore_wl_comp;
266}
267 216
268EAPI struct wl_shell * 217 return _ecore_wl_shutdown(EINA_TRUE);
269ecore_wl_shell_get(void)
270{
271 return _ecore_wl_shell;
272} 218}
273 219
274EAPI struct wl_input_device * 220/**
275ecore_wl_input_device_get(void) 221 * @defgroup Ecore_Wl_Flush_Group Wayland Synchronization Functions
276{ 222 *
277 return _ecore_wl_input_dev; 223 * Functions that ensure that all commands which have been issued by the
278} 224 * Ecore Wayland library have been sent to the server.
225 */
279 226
227/**
228 * Sends all Wayland commands to the Wayland Display.
229 *
230 * @ingroup Ecore_Wl_Flush_Group
231 * @since 1.2
232 */
280EAPI void 233EAPI void
281ecore_wl_screen_size_get(int *w, int *h) 234ecore_wl_flush(void)
282{ 235{
283 if (w) *w = _ecore_wl_screen.w; 236 LOGFN(__FILE__, __LINE__, __FUNCTION__);
284 if (h) *h = _ecore_wl_screen.h;
285}
286
287EAPI unsigned int
288ecore_wl_format_get(void)
289{
290 return _ecore_wl_disp_format;
291}
292 237
293EAPI void 238 while (_ecore_wl_disp->mask & WL_DISPLAY_WRITABLE)
294ecore_wl_flush(void) 239 wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_WRITABLE);
295{ 240// wl_display_flush(_ecore_wl_disp->wl.display); // old flush code
296 wl_display_flush(_ecore_wl_disp);
297} 241}
298 242
243/**
244 * Flushes the command buffer and waits until all requests have been
245 * processed by the server.
246 *
247 * @ingroup Ecore_Wl_Flush_Group
248 * @since 1.2
249 */
299EAPI void 250EAPI void
300ecore_wl_sync(void) 251ecore_wl_sync(void)
301{ 252{
302 wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); 253 LOGFN(__FILE__, __LINE__, __FUNCTION__);
303}
304 254
305EAPI void 255 wl_display_roundtrip(_ecore_wl_disp->wl.display);
306ecore_wl_pointer_xy_get(int *x, int *y) 256 // old sync code
257// wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE);
258}
259
260/**
261 * @defgroup Ecore_Wl_Display_Group Wayland Display Functions
262 *
263 * Functions that set and retrieve various information about the Wayland Display.
264 */
265
266/**
267 * Retrieves the Wayland Shm Interface used for the current Wayland connection.
268 *
269 * @return The current wayland shm interface
270 *
271 * @ingroup Ecore_Wl_Display_Group
272 * @since 1.2
273 */
274EAPI struct wl_shm *
275ecore_wl_shm_get(void)
307{ 276{
308 if (x) *x = _ecore_wl_screen_x; 277 return _ecore_wl_disp->wl.shm;
309 if (y) *y = _ecore_wl_screen_y;
310} 278}
311 279
312EAPI Ecore_Wl_Drag_Source * 280/**
313ecore_wl_drag_source_create(int hotspot_x, int hotspot_y, int offset_x, int offset_y, const char *mimetype, unsigned int timestamp, void *data) 281 * Retrieves the Wayland Display Interface used for the current Wayland connection.
282 *
283 * @return The current wayland display interface
284 *
285 * @ingroup Ecore_Wl_Display_Group
286 * @since 1.2
287 */
288EAPI struct wl_display *
289ecore_wl_display_get(void)
314{ 290{
315 Ecore_Wl_Drag_Source *source; 291 return _ecore_wl_disp->wl.display;
316
317 if (!(source = calloc(1, sizeof(Ecore_Wl_Drag_Source)))) return NULL;
318
319 source->data_dev = _ecore_wl_data_dev;
320 source->hotspot_x = hotspot_x;
321 source->hotspot_y = hotspot_y;
322 source->offset_x = offset_x;
323 source->offset_y = offset_y;
324 source->mimetype = mimetype;
325 source->timestamp = timestamp;
326 source->data = data;
327
328 source->data_source =
329 wl_data_device_manager_create_data_source(_ecore_wl_data_manager);
330
331 wl_data_source_add_listener(source->data_source,
332 &_ecore_wl_source_listener, source);
333
334 wl_data_source_offer(source->data_source, source->mimetype);
335
336 /* NB: Do we add some default mimetypes here ?? */
337 /* text/plain, etc */
338
339 return source;
340} 292}
341 293
294/**
295 * Retrieves the size of the current screen.
296 *
297 * @param w where to return the width. May be NULL. Returns 0 on error.
298 * @param h where to return the height. May be NULL. Returns 0 on error.
299 *
300 * @ingroup Ecore_Wl_Display_Group
301 * @since 1.2
302 */
342EAPI void 303EAPI void
343ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer) 304ecore_wl_screen_size_get(int *w, int *h)
344{ 305{
345 source->buffer = buffer; 306 LOGFN(__FILE__, __LINE__, __FUNCTION__);
346 307
347 wl_data_device_start_drag(source->data_dev, source->data_source, 308 if (w) *w = _ecore_wl_disp->output->allocation.w;
348 surface, source->timestamp); 309 if (h) *h = _ecore_wl_disp->output->allocation.h;
349} 310}
350 311
312/* @since 1.2 */
351EAPI void 313EAPI void
352ecore_wl_drag_stop(void) 314ecore_wl_pointer_xy_get(int *x, int *y)
353{ 315{
316 LOGFN(__FILE__, __LINE__, __FUNCTION__);
354 317
318 _ecore_wl_input_pointer_xy_get(x, y);
355} 319}
356 320
357/* local functions */ 321/* local functions */
358static Eina_Bool 322static Eina_Bool
359_ecore_wl_shutdown(Eina_Bool close_display) 323_ecore_wl_shutdown(Eina_Bool close)
360{ 324{
361 LOGFN(__FILE__, __LINE__, __FUNCTION__); 325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
362 326
363 if (--_ecore_wl_init_count != 0) 327 if (--_ecore_wl_init_count != 0) return _ecore_wl_init_count;
364 return _ecore_wl_init_count;
365
366 if (!_ecore_wl_disp) return _ecore_wl_init_count; 328 if (!_ecore_wl_disp) return _ecore_wl_init_count;
367 329
368 if (_ecore_wl_xkb) free(_ecore_wl_xkb); 330 _ecore_wl_window_shutdown();
369 331
370 if (_ecore_wl_fd_hdl) ecore_main_fd_handler_del(_ecore_wl_fd_hdl); 332 if (_ecore_wl_disp->fd_hdl)
371 _ecore_wl_fd_hdl = NULL; 333 ecore_main_fd_handler_del(_ecore_wl_disp->fd_hdl);
372 334
373 if (close_display) 335 if (close)
374 { 336 {
375 if (_ecore_wl_data_dev) wl_data_device_destroy(_ecore_wl_data_dev); 337 Ecore_Wl_Output *out, *tout;
376 if (_ecore_wl_input_dev) wl_input_device_destroy(_ecore_wl_input_dev); 338 Ecore_Wl_Input *in, *tin;
377 if (_ecore_wl_data_manager) 339
378 wl_data_device_manager_destroy(_ecore_wl_data_manager); 340 wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link)
379 if (_ecore_wl_shell) wl_shell_destroy(_ecore_wl_shell); 341 _ecore_wl_output_del(out);
380 if (_ecore_wl_shm) wl_shm_destroy(_ecore_wl_shm); 342
381 if (_ecore_wl_comp) wl_compositor_destroy(_ecore_wl_comp); 343 wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link)
382 if (_ecore_wl_disp) 344 _ecore_wl_input_del(in);
345
346 _ecore_wl_xkb_shutdown(_ecore_wl_disp);
347 /* _ecore_wl_egl_shutdown(_ecore_wl_disp); */
348
349 if (_ecore_wl_disp->wl.shell)
350 wl_shell_destroy(_ecore_wl_disp->wl.shell);
351 if (_ecore_wl_disp->wl.shm) wl_shm_destroy(_ecore_wl_disp->wl.shm);
352 if (_ecore_wl_disp->wl.data_device_manager)
353 wl_data_device_manager_destroy(_ecore_wl_disp->wl.data_device_manager);
354 if (_ecore_wl_disp->wl.compositor)
355 wl_compositor_destroy(_ecore_wl_disp->wl.compositor);
356 if (_ecore_wl_disp->wl.display)
383 { 357 {
384 wl_display_flush(_ecore_wl_disp); 358 wl_display_flush(_ecore_wl_disp->wl.display);
385 wl_display_destroy(_ecore_wl_disp); 359 wl_display_disconnect(_ecore_wl_disp->wl.display);
386 } 360 }
387 _ecore_wl_disp = NULL; 361 free(_ecore_wl_disp);
388 } 362 }
389 363
390 eina_log_domain_unregister(_ecore_wl_log_dom);
391 _ecore_wl_log_dom = -1;
392
393 ecore_event_shutdown(); 364 ecore_event_shutdown();
394 ecore_shutdown(); 365 ecore_shutdown();
366
367 eina_log_domain_unregister(_ecore_wl_log_dom);
368 _ecore_wl_log_dom = -1;
395 eina_shutdown(); 369 eina_shutdown();
396 370
397 return _ecore_wl_init_count; 371 return _ecore_wl_init_count;
398} 372}
399 373
400static void
401_ecore_wl_cb_disp_handle_global(struct wl_display *disp, uint32_t id, const char *interface, uint32_t version __UNUSED__, void *data __UNUSED__)
402{
403// LOGFN(__FILE__, __LINE__, __FUNCTION__);
404
405 if (disp != _ecore_wl_disp) return;
406 if (!strcmp(interface, "wl_compositor"))
407 {
408 _ecore_wl_comp =
409 wl_display_bind(_ecore_wl_disp, id, &wl_compositor_interface);
410 }
411 else if (!strcmp(interface, "wl_shm"))
412 {
413 _ecore_wl_shm =
414 wl_display_bind(_ecore_wl_disp, id, &wl_shm_interface);
415 }
416 else if (!strcmp(interface, "wl_output"))
417 {
418 _ecore_wl_output =
419 wl_display_bind(_ecore_wl_disp, id, &wl_output_interface);
420 wl_output_add_listener(_ecore_wl_output,
421 &_ecore_wl_output_listener, NULL);
422 }
423 else if (!strcmp(interface, "wl_shell"))
424 {
425 _ecore_wl_shell =
426 wl_display_bind(_ecore_wl_disp, id, &wl_shell_interface);
427 }
428 else if (!strcmp(interface, "wl_input_device"))
429 {
430 _ecore_wl_input_dev =
431 wl_display_bind(_ecore_wl_disp, id, &wl_input_device_interface);
432 wl_input_device_add_listener(_ecore_wl_input_dev,
433 &_ecore_wl_input_listener, NULL);
434 }
435 else if (!strcmp(interface, "wl_data_device_manager"))
436 {
437 _ecore_wl_data_manager =
438 wl_display_bind(_ecore_wl_disp, id,
439 &wl_data_device_manager_interface);
440 }
441
442 if ((_ecore_wl_input_dev) && (_ecore_wl_data_manager) && (!_ecore_wl_data_dev))
443 {
444 _ecore_wl_data_dev =
445 wl_data_device_manager_get_data_device(_ecore_wl_data_manager,
446 _ecore_wl_input_dev);
447 wl_data_device_add_listener(_ecore_wl_data_dev,
448 &_ecore_wl_data_listener, NULL);
449 }
450}
451
452static int 374static int
453_ecore_wl_cb_disp_event_mask_update(uint32_t mask, void *data __UNUSED__) 375_ecore_wl_cb_event_mask_update(unsigned int mask, void *data)
454{ 376{
455// LOGFN(__FILE__, __LINE__, __FUNCTION__); 377 Ecore_Wl_Display *ewd;
456 378
457 _ecore_wl_disp_mask = mask; 379 LOGFN(__FILE__, __LINE__, __FUNCTION__);
458 380
381 ewd = data;
382 ewd->mask = mask;
459 return 0; 383 return 0;
460} 384}
461 385
462static void
463_ecore_wl_cb_disp_handle_geometry(void *data __UNUSED__, struct wl_output *output __UNUSED__, int x, int y, int pw __UNUSED__, int ph __UNUSED__, int subpixel __UNUSED__, const char *make __UNUSED__, const char *model __UNUSED__)
464{
465 _ecore_wl_screen.x = x;
466 _ecore_wl_screen.y = y;
467}
468
469static void
470_ecore_wl_cb_disp_handle_mode(void *data __UNUSED__, struct wl_output *output __UNUSED__, uint32_t flags, int w, int h, int refresh __UNUSED__)
471{
472 if (flags & WL_OUTPUT_MODE_CURRENT)
473 {
474 _ecore_wl_screen.w = w;
475 _ecore_wl_screen.h = h;
476 }
477}
478
479static Eina_Bool 386static Eina_Bool
480_ecore_wl_cb_fd_handle(void *data, Ecore_Fd_Handler *hdl __UNUSED__) 387_ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__)
481{ 388{
482 struct wl_display *disp; 389 Ecore_Wl_Display *ewd;
483
484// LOGFN(__FILE__, __LINE__, __FUNCTION__);
485
486 if (!(disp = data)) return ECORE_CALLBACK_RENEW;
487 if (disp != _ecore_wl_disp) return ECORE_CALLBACK_RENEW;
488 390
489 if (_ecore_wl_disp_mask & WL_DISPLAY_WRITABLE) 391 LOGFN(__FILE__, __LINE__, __FUNCTION__);
490 wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_WRITABLE);
491
492 if (_ecore_wl_disp_mask & WL_DISPLAY_READABLE)
493 wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE);
494 392
393 if (!(ewd = data)) return ECORE_CALLBACK_RENEW;
394 wl_display_iterate(ewd->wl.display, ewd->mask);
495 return ECORE_CALLBACK_RENEW; 395 return ECORE_CALLBACK_RENEW;
496} 396}
497 397
498static void 398static void
499_ecore_wl_cb_handle_motion(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, int32_t x, int32_t y, int32_t sx, int32_t sy) 399_ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data)
500{
501 if (dev != _ecore_wl_input_dev) return;
502
503 _ecore_wl_screen_x = x;
504 _ecore_wl_screen_y = y;
505 _ecore_wl_surface_x = sx;
506 _ecore_wl_surface_y = sy;
507
508 _ecore_wl_mouse_move_send(t);
509}
510
511static void
512_ecore_wl_cb_handle_button(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, uint32_t btn, uint32_t state)
513{
514 if (dev != _ecore_wl_input_dev) return;
515
516 if ((btn >= BTN_SIDE) && (btn <= BTN_BACK))
517 {
518 Ecore_Event_Mouse_Wheel *ev;
519
520 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
521
522 ev->timestamp = t;
523 ev->x = _ecore_wl_surface_x;
524 ev->y = _ecore_wl_surface_y;
525 ev->root.x = _ecore_wl_screen_x;
526 ev->root.y = _ecore_wl_screen_y;
527 ev->modifiers = _ecore_wl_input_modifiers;
528 ev->direction = 0;
529
530 if (_ecore_wl_input_surface)
531 {
532 unsigned int id = 0;
533
534 if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface)))
535 {
536 ev->window = id;
537 ev->event_window = id;
538 }
539 }
540
541 /* NB: (FIXME) Currently Wayland provides no measure of how much the
542 * wheel has scrolled (read: delta of movement). So for now, we will
543 * just assume that the amount scrolled is 1 */
544 if ((btn == BTN_EXTRA) || (btn == BTN_FORWARD)) // down
545 ev->z = 1;
546 else if ((btn == BTN_SIDE) || (btn == BTN_BACK)) // up
547 ev->z = -1;
548
549 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
550 }
551 else
552 {
553 if (state)
554 {
555 _ecore_wl_input_button = btn;
556 _ecore_wl_mouse_down_send(_ecore_wl_input_surface, btn, t);
557 /* NB: Ideally, this is not the place to check for drags.
558 * IMO, drags should be handled by the client. EG: we raise the
559 * mouse_down to the client, and the client can 'request' a
560 * drag_start from ecore_wl */
561 if ((_ecore_wl_input_surface) || (_ecore_wl_touch_surface))
562 {
563 /* record item which was grabbed.
564 * create drag source. start drag */
565 }
566 }
567 else
568 {
569 if ((_ecore_wl_input_surface) || (_ecore_wl_touch_surface))
570 {
571 /* release grabbed button and finish drag */
572 if ((_ecore_wl_input_button) &&
573 (_ecore_wl_input_button == btn))
574 {
575
576 }
577 }
578 _ecore_wl_input_button = 0;
579 _ecore_wl_mouse_up_send(_ecore_wl_input_surface, btn, t);
580 }
581 }
582}
583
584static void
585_ecore_wl_cb_handle_key(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, uint32_t key, uint32_t state)
586{ 400{
587 unsigned int keycode = 0; 401 Ecore_Wl_Display *ewd;
588 402
589 if (dev != _ecore_wl_input_dev) return; 403 LOGFN(__FILE__, __LINE__, __FUNCTION__);
590 404
591 keycode = key + _ecore_wl_xkb->min_key_code; 405 if ((!strcmp(interface, "wl_display")) ||
406 (!strcmp(interface, "wl_drm")) ||
407 (!strcmp(interface, "desktop_shell")))
408 return;
592 409
593 if (state) 410 ewd = data;
594 _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[keycode];
595 else
596 _ecore_wl_input_modifiers &= ~_ecore_wl_xkb->map->modmap[keycode];
597}
598 411
599static void 412 if (!strcmp(interface, "wl_compositor"))
600_ecore_wl_cb_handle_pointer_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, struct wl_surface *surface, int32_t x, int32_t y, int32_t sx, int32_t sy) 413 ewd->wl.compositor = wl_display_bind(disp, id, &wl_compositor_interface);
601{ 414 else if (!strcmp(interface, "wl_output"))
602 if (dev != _ecore_wl_input_dev) return; 415 _ecore_wl_output_add(ewd, id);
603 416 else if (!strcmp(interface, "wl_input_device"))
604 /* NB: Wayland pointer focus is weird. It's not pointer focus in the normal 417 _ecore_wl_input_add(ewd, id);
605 * sense...Wayland 'moving/resizing' (and maybe other stuff) has a habit 418 else if (!strcmp(interface, "wl_shell"))
606 * of stealing the pointer focus and thus this cannot be used to control 419 ewd->wl.shell = wl_display_bind(disp, id, &wl_shell_interface);
607 * normal pointer focus. On mouse down, the 'active' surface is stolen 420 else if (!strcmp(interface, "wl_shm"))
608 * by Wayland for the grab, so 'surface' here ends up being NULL. When a 421 ewd->wl.shm = wl_display_bind(disp, id, &wl_shm_interface);
609 * move or resize is finished, we get this event again, but this time 422 else if (!strcmp(interface, "wl_data_device_manager"))
610 * with an active surface */
611 _ecore_wl_screen_x = x;
612 _ecore_wl_screen_y = y;
613 _ecore_wl_surface_x = sx;
614 _ecore_wl_surface_y = sy;
615
616 if ((_ecore_wl_input_surface) && (_ecore_wl_input_surface != surface))
617 { 423 {
618 if (!_ecore_wl_input_button) 424 ewd->wl.data_device_manager =
619 _ecore_wl_mouse_out_send(_ecore_wl_input_surface, t); 425 wl_display_bind(disp, id, &wl_data_device_manager_interface);
620 } 426 }
621 427
622 if (surface) 428 if ((ewd->wl.compositor) && (ewd->wl.shm) && (ewd->wl.shell))
623 { 429 {
624 if (_ecore_wl_input_button) 430 Ecore_Wl_Event_Interfaces_Bound *ev;
625 {
626 _ecore_wl_mouse_up_send(surface, _ecore_wl_input_button, t);
627 _ecore_wl_input_button = 0;
628 }
629 else
630 _ecore_wl_mouse_in_send(surface, t);
631 }
632}
633
634static void
635_ecore_wl_cb_handle_keyboard_focus(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, struct wl_surface *surface, struct wl_array *keys)
636{
637 unsigned int *keyend = 0, *i = 0;
638
639 if (dev != _ecore_wl_input_dev) return;
640
641 /* NB: Remove old keyboard focus */
642 if ((_ecore_wl_input_surface) && (_ecore_wl_input_surface != surface))
643 _ecore_wl_focus_out_send(_ecore_wl_input_surface, t);
644 431
645 _ecore_wl_input_surface = NULL; 432 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Interfaces_Bound))))
433 return;
646 434
647 keyend = keys->data + keys->size; 435 ev->compositor = (ewd->wl.compositor != NULL);
648 _ecore_wl_input_modifiers = 0; 436 ev->shm = (ewd->wl.shm != NULL);
649 for (i = keys->data; i < keyend; i++) 437 ev->shell = (ewd->wl.shell != NULL);
650 _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[*i];
651 438
652 if (surface) 439 ecore_event_add(ECORE_WL_EVENT_INTERFACES_BOUND, ev, NULL, NULL);
653 {
654 /* set new input surface */
655 _ecore_wl_input_surface = surface;
656
657 /* send mouse in to new surface */
658 /* _ecore_wl_mouse_in_send(surface, t); */
659
660 /* send focus to new surface */
661 _ecore_wl_focus_in_send(surface, t);
662 } 440 }
663} 441}
664 442
665static void 443static Eina_Bool
666_ecore_wl_cb_handle_touch_down(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, struct wl_surface *surface, int32_t id, int32_t x, int32_t y) 444_ecore_wl_egl_init(Ecore_Wl_Display *ewd)
667{ 445{
668 Ecore_Event_Mouse_Button *ev; 446 EGLint major, minor, n;
669 447 static const EGLint context_attribs[] =
670 LOGFN(__FILE__, __LINE__, __FUNCTION__);
671
672 _ecore_wl_touch_surface = surface;
673 _ecore_wl_touch_x = x;
674 _ecore_wl_touch_y = y;
675
676 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
677
678 ev->timestamp = timestamp;
679
680 /* NB: Need to verify using x,y for these */
681 ev->x = x;
682 ev->y = y;
683 ev->root.x = x;
684 ev->root.y = y;
685 ev->modifiers = 0;
686 ev->buttons = 0;
687 ev->same_screen = 1;
688
689 /* FIXME: Need to get these from Wayland somehow */
690 ev->double_click = 0;
691 ev->triple_click = 0;
692
693 ev->multi.device = id;
694 ev->multi.radius = 1;
695 ev->multi.radius_x = 1;
696 ev->multi.radius_y = 1;
697 ev->multi.pressure = 1.0;
698 ev->multi.angle = 0.0;
699 /* NB: Need to verify using x,y for these */
700 ev->multi.x = x;
701 ev->multi.y = y;
702 ev->multi.root.x = x;
703 ev->multi.root.y = y;
704
705 { 448 {
706 unsigned int id = 0; 449 EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE
707 450 };
708 if ((id = (unsigned int)wl_surface_get_user_data(surface))) 451 static const EGLint argb_attribs[] =
709 { 452 {
710 ev->window = id; 453 EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
711 ev->event_window = id; 454 EGL_ALPHA_SIZE, 1, EGL_DEPTH_SIZE, 0, EGL_STENCIL_SIZE, 0,
712 } 455 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE,
713 } 456 EGL_WINDOW_BIT, EGL_NONE
714 457 };
715 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
716}
717
718static void
719_ecore_wl_cb_handle_touch_up(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id)
720{
721 Ecore_Event_Mouse_Button *ev;
722 458
723 LOGFN(__FILE__, __LINE__, __FUNCTION__); 459 LOGFN(__FILE__, __LINE__, __FUNCTION__);
724 460
725 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; 461 ewd->egl.display = eglGetDisplay(ewd->wl.display);
726 462 if (!eglInitialize(ewd->egl.display, &major, &minor))
727 ev->timestamp = timestamp;
728
729 /* TODO: Need to verify using x,y for these */
730 ev->x = _ecore_wl_touch_x;
731 ev->y = _ecore_wl_touch_y;
732 ev->root.x = _ecore_wl_touch_x;
733 ev->root.y = _ecore_wl_touch_y;
734 ev->modifiers = 0;
735 ev->buttons = 0;
736 ev->same_screen = 1;
737
738 /* FIXME: Need to get these from Wayland somehow */
739 ev->double_click = 0;
740 ev->triple_click = 0;
741
742 ev->multi.device = id;
743 ev->multi.radius = 1;
744 ev->multi.radius_x = 1;
745 ev->multi.radius_y = 1;
746 ev->multi.pressure = 1.0;
747 ev->multi.angle = 0.0;
748
749 /* TODO: Need to verify using x,y for these */
750 ev->multi.x = _ecore_wl_touch_x;
751 ev->multi.y = _ecore_wl_touch_y;
752 ev->multi.root.x = _ecore_wl_touch_x;
753 ev->multi.root.y = _ecore_wl_touch_y;
754
755 { 463 {
756 unsigned int id = 0; 464 ERR("Failed to initialize EGL display");
757 465 return EINA_FALSE;
758 if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface)))
759 {
760 ev->window = id;
761 ev->event_window = id;
762 }
763 } 466 }
764 467
765 _ecore_wl_touch_surface = NULL; 468 if (!eglBindAPI(EGL_OPENGL_ES_API))
766
767 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
768}
769
770static void
771_ecore_wl_cb_handle_touch_motion(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id, int32_t x, int32_t y)
772{
773 Ecore_Event_Mouse_Move *ev;
774
775 LOGFN(__FILE__, __LINE__, __FUNCTION__);
776
777 if (!_ecore_wl_touch_surface) return;
778
779 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
780
781 ev->timestamp = timestamp;
782 /* TODO: Need to verify using x,y for these */
783 ev->x = x;
784 ev->y = y;
785 ev->root.x = x;
786 ev->root.y = y;
787 ev->modifiers = 0; //_ecore_wl_input_modifiers;
788 ev->same_screen = 1;
789
790 ev->multi.device = id;
791 ev->multi.radius = 1;
792 ev->multi.radius_x = 1;
793 ev->multi.radius_y = 1;
794 ev->multi.pressure = 1.0;
795 ev->multi.angle = 0.0;
796
797 /* TODO: Need to verify using x,y for these */
798 ev->multi.x = x;
799 ev->multi.y = y;
800 ev->multi.root.x = x;
801 ev->multi.root.y = y;
802
803 { 469 {
804 unsigned int id = 0; 470 ERR("Failed to bind EGL Api");
805 471 return EINA_FALSE;
806 if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface)))
807 {
808 ev->window = id;
809 ev->event_window = id;
810 }
811 } 472 }
812 473
813 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); 474 if ((!eglChooseConfig(ewd->egl.display, argb_attribs, &ewd->egl.argb_config,
814} 475 1, &n)) || (n == 0))
815
816static void
817_ecore_wl_cb_handle_touch_frame(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__)
818{
819 LOGFN(__FILE__, __LINE__, __FUNCTION__);
820
821 /* FIXME: Need to get a device and actually test what happens here */
822}
823
824static void
825_ecore_wl_cb_handle_touch_cancel(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__)
826{
827 LOGFN(__FILE__, __LINE__, __FUNCTION__);
828
829 /* FIXME: Need to get a device and actually test what happens here */
830 _ecore_wl_touch_surface = NULL;
831}
832
833static void
834_ecore_wl_cb_source_target(void *data, struct wl_data_source *source __UNUSED__, const char *mime_type __UNUSED__)
835{
836 Ecore_Wl_Drag_Source *s;
837
838 LOGFN(__FILE__, __LINE__, __FUNCTION__);
839
840 printf("Ecore_Wl Source Target\n");
841 if (!(s = data)) return;
842 printf("\tHave Drag Source\n");
843
844 /* FIXME: buffer here should really be the mouse cursor buffer */
845 wl_data_device_attach(s->data_dev, s->timestamp, s->buffer,
846 s->hotspot_x, s->hotspot_y);
847}
848
849static void
850_ecore_wl_cb_source_send(void *data, struct wl_data_source *source, const char *mime_type, int32_t fd)
851{
852 Ecore_Wl_Drag_Source *s;
853
854 LOGFN(__FILE__, __LINE__, __FUNCTION__);
855
856 printf("Ecore_Wl Source Send\n");
857 if (!(s = data)) return;
858 printf("\tHave Drag Source\n");
859
860 /* FIXME: write message to fd */
861
862 /* NB: Wayland really sucks in this regard. Why should selection stuff
863 * require an 'fd' ?? */
864}
865
866static void
867_ecore_wl_cb_source_cancelled(void *data, struct wl_data_source *source __UNUSED__)
868{
869 Ecore_Wl_Drag_Source *s;
870
871 LOGFN(__FILE__, __LINE__, __FUNCTION__);
872
873 /* The cancelled event usually means source is no longer in use by
874 * the drag (or selection). */
875
876 printf("Ecore_Wl Source Cancel\n");
877 if (!(s = data)) return;
878 printf("\tHave Drag Source\n");
879
880 /* FIXME: raise this to ecore_evas so the surface/buffer
881 * of the drag can be destroyed */
882
883 if (s->data_source) wl_data_source_destroy(s->data_source);
884 s->data_source = NULL;
885
886 free(s);
887}
888
889static void
890_ecore_wl_cb_source_offer(void *data, struct wl_data_offer *offer __UNUSED__, const char *type)
891{
892 Ecore_Wl_Dnd_Source *s;
893
894 if (!(s = data)) return;
895 eina_array_push(s->types, strdup(type));
896}
897
898static void
899_ecore_wl_cb_data_offer(void *data, struct wl_data_device *data_dev, uint32_t id)
900{
901 Ecore_Wl_Dnd_Source *source;
902
903 /* create a new 'data offer' structure and setup a listener for it */
904 if (!(source = calloc(1, sizeof(Ecore_Wl_Dnd_Source)))) return;
905
906 source->types = eina_array_new(1);
907 source->data = data;
908 source->refs = 1;
909
910 /* FIXME: This will need to change when Wayland has typesafe wrappers for this */
911 source->offer = (struct wl_data_offer *)
912 wl_proxy_create_for_id((struct wl_proxy *)data_dev,
913 id, &wl_data_offer_interface);
914
915 wl_data_device_set_user_data(data_dev, source);
916 wl_data_offer_add_listener(source->offer, &_ecore_wl_offer_listener, source);
917}
918
919static void
920_ecore_wl_cb_data_enter(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, struct wl_surface *surface, int32_t x, int32_t y, struct wl_data_offer *offer)
921{
922 Ecore_Wl_Dnd_Source *source;
923
924 if (!(source = wl_data_device_get_user_data(data_dev))) return;
925
926 /* TODO: maybe set pointer focus here ?? */
927
928 source->timestamp = timestamp;
929}
930
931static void
932_ecore_wl_cb_data_leave(void *data __UNUSED__, struct wl_data_device *data_dev)
933{
934 Ecore_Wl_Dnd_Source *source;
935
936 if (!(source = wl_data_device_get_user_data(data_dev))) return;
937
938 /* destroy drag offer */
939 wl_data_offer_destroy(source->offer);
940
941 while (eina_array_count(source->types))
942 free(eina_array_pop(source->types));
943
944 eina_array_free(source->types);
945 free(source);
946
947 wl_data_device_set_user_data(data_dev, NULL);
948}
949
950static void
951_ecore_wl_cb_data_motion(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, int32_t x, int32_t y)
952{
953 Ecore_Wl_Dnd_Source *source;
954
955 if (!(source = wl_data_device_get_user_data(data_dev))) return;
956 /* TODO: Here we should raise motion events for dragging */
957}
958
959static void
960_ecore_wl_cb_data_drop(void *data __UNUSED__, struct wl_data_device *data_dev)
961{
962 Ecore_Wl_Dnd_Source *source;
963
964 if (!(source = wl_data_device_get_user_data(data_dev))) return;
965
966 /* TODO: Raise event for drop */
967
968 wl_data_offer_accept(source->offer, source->timestamp, NULL);
969// eina_array_data_get(source->types, 0));
970}
971
972static void
973_ecore_wl_cb_data_selection(void *data, struct wl_data_device *data_dev, struct wl_data_offer *offer)
974{
975 Ecore_Wl_Dnd_Source *source;
976
977 printf("Ecore_Wl Data Selection\n");
978 if ((source = wl_data_device_get_user_data(data_dev)))
979 { 476 {
980 /* destroy old source */ 477 ERR("Failed to choose ARGB config");
981 wl_data_offer_destroy(source->offer); 478 return EINA_FALSE;
982
983 while (eina_array_count(source->types))
984 free(eina_array_pop(source->types));
985
986 eina_array_free(source->types);
987 free(source);
988
989 wl_data_device_set_user_data(data_dev, NULL);
990 } 479 }
991}
992
993static void
994_ecore_wl_mouse_move_send(uint32_t timestamp)
995{
996 Ecore_Event_Mouse_Move *ev;
997
998// if (!_ecore_wl_input_surface) return;
999
1000 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
1001
1002 ev->timestamp = timestamp;
1003 ev->x = _ecore_wl_surface_x;
1004 ev->y = _ecore_wl_surface_y;
1005 ev->root.x = _ecore_wl_screen_x;
1006 ev->root.y = _ecore_wl_screen_y;
1007 ev->modifiers = _ecore_wl_input_modifiers;
1008
1009 ev->multi.device = 0;
1010 ev->multi.radius = 1;
1011 ev->multi.radius_x = 1;
1012 ev->multi.radius_y = 1;
1013 ev->multi.pressure = 1.0;
1014 ev->multi.angle = 0.0;
1015 ev->multi.x = _ecore_wl_surface_x;
1016 ev->multi.y = _ecore_wl_surface_y;
1017 ev->multi.root.x = _ecore_wl_screen_x;
1018 ev->multi.root.y = _ecore_wl_screen_y;
1019 480
481 ewd->egl.argb_context =
482 eglCreateContext(ewd->egl.display, ewd->egl.argb_config,
483 EGL_NO_CONTEXT, context_attribs);
484 if (!ewd->egl.argb_context)
1020 { 485 {
1021 unsigned int id = 0; 486 ERR("Failed to create ARGB context");
1022 487 return EINA_FALSE;
1023 if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface)))
1024 {
1025 ev->window = id;
1026 ev->event_window = id;
1027 }
1028 } 488 }
1029 489
1030 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); 490 if (!eglMakeCurrent(ewd->egl.display, EGL_NO_SURFACE,
1031} 491 EGL_NO_SURFACE, ewd->egl.argb_context))
1032
1033static void
1034_ecore_wl_mouse_out_send(struct wl_surface *surface, uint32_t timestamp)
1035{
1036 Ecore_Wl_Event_Mouse_Out *ev;
1037
1038 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_Out)))) return;
1039
1040 ev->x = _ecore_wl_surface_x;
1041 ev->y = _ecore_wl_surface_y;
1042 ev->root.x = _ecore_wl_screen_x;
1043 ev->root.y = _ecore_wl_screen_y;
1044 ev->modifiers = _ecore_wl_input_modifiers;
1045 ev->time = timestamp;
1046
1047 if (surface)
1048 { 492 {
1049 unsigned int id = 0; 493 ERR("Failed to make ARGB context current");
1050 494 return EINA_FALSE;
1051 if ((id = (unsigned int)wl_surface_get_user_data(surface)))
1052 ev->window = id;
1053 } 495 }
1054 496
1055 ecore_event_add(ECORE_WL_EVENT_MOUSE_OUT, ev, NULL, NULL); 497 return EINA_TRUE;
1056} 498}
1057 499
1058static void 500static Eina_Bool
1059_ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp) 501_ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd)
1060{ 502{
1061 Ecore_Wl_Event_Mouse_In *ev; 503 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1062
1063 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_In)))) return;
1064
1065 ev->x = _ecore_wl_surface_x;
1066 ev->y = _ecore_wl_surface_y;
1067 ev->root.x = _ecore_wl_screen_x;
1068 ev->root.y = _ecore_wl_screen_y;
1069 ev->modifiers = _ecore_wl_input_modifiers;
1070 ev->time = timestamp;
1071 504
1072 if (surface) 505 eglMakeCurrent(ewd->egl.display,
1073 { 506 EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
1074 unsigned int id = 0;
1075 507
1076 if ((id = (unsigned int)wl_surface_get_user_data(surface))) 508 eglDestroyContext(ewd->egl.display, ewd->egl.argb_context);
1077 ev->window = id;
1078 }
1079
1080 ecore_event_add(ECORE_WL_EVENT_MOUSE_IN, ev, NULL, NULL);
1081}
1082 509
1083static void 510 /* NB: This is hanging when we run elm apps as wayland clients
1084_ecore_wl_mouse_up_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp) 511 * inside the weston compositor */
1085{
1086 Ecore_Event_Mouse_Button *ev;
1087
1088 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
1089
1090 if (button == BTN_LEFT)
1091 ev->buttons = 1;
1092 else if (button == BTN_MIDDLE)
1093 ev->buttons = 2;
1094 else if (button == BTN_RIGHT)
1095 ev->buttons = 3;
1096
1097 ev->timestamp = timestamp;
1098 ev->x = _ecore_wl_surface_x;
1099 ev->y = _ecore_wl_surface_y;
1100 ev->root.x = _ecore_wl_screen_x;
1101 ev->root.y = _ecore_wl_screen_y;
1102 ev->modifiers = _ecore_wl_input_modifiers;
1103
1104 /* FIXME: Need to get these from Wayland somehow */
1105 ev->double_click = 0;
1106 ev->triple_click = 0;
1107
1108 ev->multi.device = 0;
1109 ev->multi.radius = 1;
1110 ev->multi.radius_x = 1;
1111 ev->multi.radius_y = 1;
1112 ev->multi.pressure = 1.0;
1113 ev->multi.angle = 0.0;
1114 ev->multi.x = _ecore_wl_surface_x;
1115 ev->multi.y = _ecore_wl_surface_y;
1116 ev->multi.root.x = _ecore_wl_screen_x;
1117 ev->multi.root.y = _ecore_wl_screen_y;
1118 512
1119 { 513 /* printf("Egl Terminate\n"); */
1120 unsigned int id = 0; 514 /* eglTerminate(ewd->egl.display); */
515 /* printf("Egl Terminate Done\n"); */
1121 516
1122 if ((id = (unsigned int)wl_surface_get_user_data(surface))) 517 eglReleaseThread();
1123 {
1124 ev->window = id;
1125 ev->event_window = id;
1126 }
1127 }
1128 518
1129 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); 519 return EINA_TRUE;
1130} 520}
1131 521
1132static void 522static Eina_Bool
1133_ecore_wl_mouse_down_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp) 523_ecore_wl_xkb_init(Ecore_Wl_Display *ewd)
1134{ 524{
1135 Ecore_Event_Mouse_Button *ev; 525 struct xkb_rule_names names;
1136
1137 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return;
1138
1139 if (button == BTN_LEFT)
1140 ev->buttons = 1;
1141 else if (button == BTN_MIDDLE)
1142 ev->buttons = 2;
1143 else if (button == BTN_RIGHT)
1144 ev->buttons = 3;
1145
1146 ev->timestamp = timestamp;
1147 ev->x = _ecore_wl_surface_x;
1148 ev->y = _ecore_wl_surface_y;
1149 ev->root.x = _ecore_wl_screen_x;
1150 ev->root.y = _ecore_wl_screen_y;
1151 ev->modifiers = _ecore_wl_input_modifiers;
1152
1153 /* FIXME: Need to get these from Wayland somehow */
1154 ev->double_click = 0;
1155 ev->triple_click = 0;
1156
1157 ev->multi.device = 0;
1158 ev->multi.radius = 1;
1159 ev->multi.radius_x = 1;
1160 ev->multi.radius_y = 1;
1161 ev->multi.pressure = 1.0;
1162 ev->multi.angle = 0.0;
1163 ev->multi.x = _ecore_wl_surface_x;
1164 ev->multi.y = _ecore_wl_surface_y;
1165 ev->multi.root.x = _ecore_wl_screen_x;
1166 ev->multi.root.y = _ecore_wl_screen_y;
1167 526
1168 { 527 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1169 unsigned int id = 0;
1170
1171 if ((id = (unsigned int)wl_surface_get_user_data(surface)))
1172 {
1173 ev->window = id;
1174 ev->event_window = id;
1175 }
1176 }
1177 528
1178 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); 529 names.rules = "evdev";
1179} 530 names.model = "evdev";
531 names.layout = "us";
532 names.variant = "";
533 names.options = "";
1180 534
1181static void 535 if (!(ewd->xkb = xkb_compile_keymap_from_rules(&names)))
1182_ecore_wl_focus_out_send(struct wl_surface *surface, uint32_t timestamp)
1183{
1184 Ecore_Wl_Event_Focus_Out *ev;
1185
1186 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_Out)))) return;
1187 ev->time = timestamp;
1188 if (surface)
1189 { 536 {
1190 unsigned int id = 0; 537 ERR("Failed to compile keymap");
1191 538 return EINA_FALSE;
1192 if ((id = (unsigned int)wl_surface_get_user_data(surface)))
1193 ev->window = id;
1194 } 539 }
1195 ecore_event_add(ECORE_WL_EVENT_FOCUS_OUT, ev, NULL, NULL); 540
541 return EINA_TRUE;
1196} 542}
1197 543
1198static void 544static Eina_Bool
1199_ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp) 545_ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd)
1200{ 546{
1201 Ecore_Wl_Event_Focus_In *ev; 547 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1202
1203 if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_In)))) return;
1204 ev->time = timestamp;
1205 if (surface)
1206 {
1207 unsigned int id = 0;
1208 548
1209 if ((id = (unsigned int)wl_surface_get_user_data(surface))) 549 if (ewd->xkb) xkb_free_keymap(ewd->xkb);
1210 ev->window = id; 550 return EINA_TRUE;
1211 }
1212 ecore_event_add(ECORE_WL_EVENT_FOCUS_IN, ev, NULL, NULL);
1213} 551}
diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h
index eec5ffe..31956a1 100644
--- a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h
@@ -2,6 +2,9 @@
2# define _ECORE_WAYLAND_PRIVATE_H 2# define _ECORE_WAYLAND_PRIVATE_H
3 3
4# include <limits.h> 4# include <limits.h>
5# include <xkbcommon/xkbcommon.h>
6
7# include "Ecore_Wayland.h"
5 8
6//# define LOGFNS 1 9//# define LOGFNS 1
7 10
@@ -13,6 +16,7 @@
13# endif 16# endif
14 17
15extern int _ecore_wl_log_dom; 18extern int _ecore_wl_log_dom;
19extern Ecore_Wl_Display *_ecore_wl_disp;
16 20
17# ifdef ECORE_WL_DEFAULT_LOG_COLOR 21# ifdef ECORE_WL_DEFAULT_LOG_COLOR
18# undef ECORE_WL_DEFAULT_LOG_COLOR 22# undef ECORE_WL_DEFAULT_LOG_COLOR
@@ -44,42 +48,40 @@ extern int _ecore_wl_log_dom;
44# endif 48# endif
45# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__) 49# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__)
46 50
47typedef struct _Ecore_Wl_Dnd_Source 51struct _Ecore_Wl_Dnd_Source
48{ 52{
49 struct wl_data_offer *offer; 53 struct wl_data_offer *offer;
50 int refs; 54 Ecore_Wl_Input *input;
51 55 struct wl_array types;
52 Eina_Array *types; 56 int refcount;
57 int fd;
58 int x, y;
53 59
54 uint32_t timestamp; 60 /* TODO: task & data_func */
55 void *data; 61 void *data;
56} Ecore_Wl_Dnd_Source; 62};
57 63
58typedef struct _Ecore_Wl_Dnd_Target 64struct _Ecore_Wl_Dnd_Target
59{ 65{
60 /* NB: These are not the real fields for this structure, 66 Ecore_Wl_Dnd_Source *source;
61 * and it is Bound to change....soon */ 67};
62 struct wl_data_offer *offer;
63 int refs;
64
65 Eina_Array *types;
66 68
67 uint32_t timestamp; 69void _ecore_wl_window_init(void);
68 void *data; 70void _ecore_wl_window_shutdown(void);
69} Ecore_Wl_Dnd_Target;
70 71
71struct _Ecore_Wl_Drag_Source 72void _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id);
72{ 73void _ecore_wl_output_del(Ecore_Wl_Output *output);
73 struct wl_data_device *data_dev;
74 struct wl_buffer *buffer;
75 74
76 int32_t hotspot_x, hotspot_y; 75void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id);
77 int32_t offset_x, offset_y; 76void _ecore_wl_input_del(Ecore_Wl_Input *input);
78 const char *mimetype; 77void _ecore_wl_input_pointer_xy_get(int *x, int *y);
79 uint32_t timestamp;
80 void *data;
81 78
82 struct wl_data_source *data_source; 79void _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, unsigned int id);
83}; 80void _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer);
81void _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device __UNUSED__);
82void _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y);
83void _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device __UNUSED__);
84void _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device __UNUSED__, struct wl_data_offer *offer);
85void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source);
84 86
85#endif 87#endif
diff --git a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h
index 95e3749..5df3346 100644
--- a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h
+++ b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h
@@ -460,7 +460,9 @@ EAPI void ecore_win32_window_lower(Ecore_Win32_Window *window);
460EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window, 460EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window,
461 const char *title); 461 const char *title);
462 462
463EAPI void ecore_win32_window_focus_set(Ecore_Win32_Window *window); 463EAPI void ecore_win32_window_focus(Ecore_Win32_Window *window);
464
465EAPI void *ecore_win32_window_focus_get(void);
464 466
465EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window, 467EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
466 Eina_Bool on); 468 Eina_Bool on);
@@ -471,11 +473,6 @@ EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
471EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, 473EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
472 Eina_Bool on); 474 Eina_Bool on);
473 475
474EINA_DEPRECATED EAPI void ecore_win32_window_shape_set(Ecore_Win32_Window *window,
475 unsigned short width,
476 unsigned short height,
477 unsigned char *mask);
478
479EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window, 476EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
480 Ecore_Win32_Cursor *cursor); 477 Ecore_Win32_Cursor *cursor);
481 478
diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.in b/libraries/ecore/src/lib/ecore_win32/Makefile.in
index 9994ee7..b512021 100644
--- a/libraries/ecore/src/lib/ecore_win32/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_win32/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -213,6 +212,8 @@ EVAS_LIBS = @EVAS_LIBS@
213EVIL_CFLAGS = @EVIL_CFLAGS@ 212EVIL_CFLAGS = @EVIL_CFLAGS@
214EVIL_LIBS = @EVIL_LIBS@ 213EVIL_LIBS = @EVIL_LIBS@
215EXEEXT = @EXEEXT@ 214EXEEXT = @EXEEXT@
215EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
216EXOTIC_LIBS = @EXOTIC_LIBS@
216FGREP = @FGREP@ 217FGREP = @FGREP@
217GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 218GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
218GLIB_CFLAGS = @GLIB_CFLAGS@ 219GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -268,6 +269,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
268PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 269PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
269PIXMAN_LIBS = @PIXMAN_LIBS@ 270PIXMAN_LIBS = @PIXMAN_LIBS@
270PKG_CONFIG = @PKG_CONFIG@ 271PKG_CONFIG = @PKG_CONFIG@
272PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
273PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
271POSUB = @POSUB@ 274POSUB = @POSUB@
272RANLIB = @RANLIB@ 275RANLIB = @RANLIB@
273SCIM_CFLAGS = @SCIM_CFLAGS@ 276SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -278,6 +281,7 @@ SDL_LIBS = @SDL_LIBS@
278SED = @SED@ 281SED = @SED@
279SET_MAKE = @SET_MAKE@ 282SET_MAKE = @SET_MAKE@
280SHELL = @SHELL@ 283SHELL = @SHELL@
284SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
281SSL_CFLAGS = @SSL_CFLAGS@ 285SSL_CFLAGS = @SSL_CFLAGS@
282SSL_LIBS = @SSL_LIBS@ 286SSL_LIBS = @SSL_LIBS@
283STRIP = @STRIP@ 287STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h
index ab54763..e3e4426 100644
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h
+++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h
@@ -71,8 +71,8 @@ struct _Ecore_Win32_Window
71 unsigned int min_height; 71 unsigned int min_height;
72 unsigned int max_width; 72 unsigned int max_width;
73 unsigned int max_height; 73 unsigned int max_height;
74 unsigned int base_width; 74 int base_width;
75 unsigned int base_height; 75 int base_height;
76 unsigned int step_width; 76 unsigned int step_width;
77 unsigned int step_height; 77 unsigned int step_height;
78 78
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c
index 459f051..058aef0 100644
--- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c
+++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c
@@ -107,8 +107,8 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
107 w->min_height = 0; 107 w->min_height = 0;
108 w->max_width = 32767; 108 w->max_width = 32767;
109 w->max_height = 32767; 109 w->max_height = 32767;
110 w->base_width = 0; 110 w->base_width = -1;
111 w->base_height = 0; 111 w->base_height = -1;
112 w->step_width = 1; 112 w->step_width = 1;
113 w->step_height = 1; 113 w->step_height = 1;
114 114
@@ -249,6 +249,8 @@ ecore_win32_window_free(Ecore_Win32_Window *window)
249 * 249 *
250 * This function returns the window HANDLE associated to @p window. If 250 * This function returns the window HANDLE associated to @p window. If
251 * @p window is @c NULL, this function returns @c NULL. 251 * @p window is @c NULL, this function returns @c NULL.
252 *
253 * @note The returned value is of type HWND.
252 */ 254 */
253EAPI void * 255EAPI void *
254ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) 256ecore_win32_window_hwnd_get(Ecore_Win32_Window *window)
@@ -755,140 +757,6 @@ ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
755 if (step_height) *step_height = window->step_height; 757 if (step_height) *step_height = window->step_height;
756} 758}
757 759
758EAPI void
759ecore_win32_window_shape_set(Ecore_Win32_Window *window,
760 unsigned short width,
761 unsigned short height,
762 unsigned char *mask)
763{
764 HRGN rgn;
765 int x;
766 int y;
767 OSVERSIONINFO version_info;
768
769 if (!window)
770 return;
771
772 if (!mask)
773 {
774 window->shape.enabled = 0;
775 if (window->shape.layered != 0)
776 {
777 window->shape.layered = 0;
778#if defined(WS_EX_LAYERED)
779 SetLastError(0);
780 if (!SetWindowLongPtr(window->window, GWL_EXSTYLE,
781 GetWindowLong(window->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) &&
782 (GetLastError() != 0))
783 {
784 ERR("SetWindowLongPtr() failed");
785 return;
786 }
787 if (!RedrawWindow(window->window, NULL, NULL,
788 RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN))
789 {
790 ERR("RedrawWindow() failed");
791 return;
792 }
793#endif
794 }
795 else
796 if (!SetWindowRgn(window->window, NULL, TRUE))
797 {
798 ERR("SetWindowRgn() failed");
799 }
800 return;
801 }
802
803 if (width == 0 || height == 0)
804 return;
805
806 window->shape.enabled = 1;
807
808 if (width != window->shape.width || height != window->shape.height)
809 {
810 window->shape.width = width;
811 window->shape.height = height;
812 if (window->shape.mask)
813 {
814 free(window->shape.mask);
815 window->shape.mask = NULL;
816 }
817 window->shape.mask = malloc(width * height);
818 }
819 memcpy(window->shape.mask, mask, width * height);
820
821 window->shape.layered = 0;
822
823#if defined(WS_EX_LAYERED)
824 version_info.dwOSVersionInfoSize = sizeof(version_info);
825 if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5)
826 {
827 SetLastError(0);
828 if (!SetWindowLongPtr(window->window, GWL_EXSTYLE,
829 GetWindowLong(window->window, GWL_EXSTYLE) | WS_EX_LAYERED) &&
830 (GetLastError() != 0))
831 {
832 ERR("SetWindowLongPtr() failed");
833 return;
834 }
835 window->shape.layered = 1;
836 return;
837 }
838#endif
839
840 if (!(rgn = CreateRectRgn(0, 0, 0, 0)))
841 {
842 ERR("CreateRectRgn() failed");
843 return;
844 }
845 for (y = 0; y < height; y++)
846 {
847 HRGN rgnLine;
848
849 if (!(rgnLine = CreateRectRgn(0, 0, 0, 0)))
850 {
851 ERR("CreateRectRgn() failed");
852 return;
853 }
854 for (x = 0; x < width; x++)
855 {
856 if (mask[y * width + x] > 0)
857 {
858 HRGN rgnDot;
859
860 if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1)))
861 {
862 ERR("CreateRectRgn() failed");
863 return;
864 }
865 if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR)
866 {
867 ERR("CombineRgn() has not created a new region");
868 }
869 if (!DeleteObject(rgnDot))
870 {
871 ERR("DeleteObject() failed");
872 return;
873 }
874 }
875 }
876 if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR)
877 {
878 ERR("CombineRgn() has not created a new region");
879 }
880 if (!DeleteObject(rgnLine))
881 {
882 ERR("DeleteObject() failed");
883 return;
884 }
885 }
886 if (!SetWindowRgn(window->window, rgn, TRUE))
887 {
888 ERR("SetWindowRgn() failed");
889 }
890}
891
892/** 760/**
893 * @brief Show the given window. 761 * @brief Show the given window.
894 * 762 *
@@ -1011,7 +879,7 @@ ecore_win32_window_title_set(Ecore_Win32_Window *window,
1011 * @c NULL, this function does nothing. 879 * @c NULL, this function does nothing.
1012 */ 880 */
1013EAPI void 881EAPI void
1014ecore_win32_window_focus_set(Ecore_Win32_Window *window) 882ecore_win32_window_focus(Ecore_Win32_Window *window)
1015{ 883{
1016 if (!window) return; 884 if (!window) return;
1017 885
@@ -1024,6 +892,37 @@ ecore_win32_window_focus_set(Ecore_Win32_Window *window)
1024} 892}
1025 893
1026/** 894/**
895 * @brief Get the current focused window.
896 *
897 * @return The window that has focus.
898 *
899 * This function returns the window that has focus. If the calling
900 * thread's message queue does not have an associated window with the
901 * keyboard focus, the return value is @c NULL.
902 *
903 * @note Even if the returned value is @c NULL, another thread's queue
904 * may be associated with a window that has the keyboard focus.
905 *
906 * @note The returned value is of type HWND.
907 */
908EAPI void *
909ecore_win32_window_focus_get(void)
910{
911 HWND focused;
912
913 INF("getting focused window");
914
915 focused = GetFocus();
916 if (!focused)
917 {
918 ERR("GetFocus() failed");
919 return NULL;
920 }
921
922 return focused;
923}
924
925/**
1027 * @brief Iconify or restore the given window. 926 * @brief Iconify or restore the given window.
1028 * 927 *
1029 * @param window The window. 928 * @param window The window.
diff --git a/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h b/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h
index 681b334..63e20d5 100644
--- a/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h
+++ b/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h
@@ -280,6 +280,10 @@ EAPI void ecore_wince_window_hide(Ecore_WinCE_Window *window);
280EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window, 280EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window,
281 const char *title); 281 const char *title);
282 282
283EAPI void ecore_wince_window_focus(Ecore_WinCE_Window *window);
284
285EAPI void *ecore_wince_window_focus_get(void);
286
283EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend); 287EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend);
284 288
285EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int)); 289EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int));
diff --git a/libraries/ecore/src/lib/ecore_wince/Makefile.in b/libraries/ecore/src/lib/ecore_wince/Makefile.in
index d23bf51..340416b 100644
--- a/libraries/ecore/src/lib/ecore_wince/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_wince/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -194,6 +193,8 @@ EVAS_LIBS = @EVAS_LIBS@
194EVIL_CFLAGS = @EVIL_CFLAGS@ 193EVIL_CFLAGS = @EVIL_CFLAGS@
195EVIL_LIBS = @EVIL_LIBS@ 194EVIL_LIBS = @EVIL_LIBS@
196EXEEXT = @EXEEXT@ 195EXEEXT = @EXEEXT@
196EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
197EXOTIC_LIBS = @EXOTIC_LIBS@
197FGREP = @FGREP@ 198FGREP = @FGREP@
198GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 199GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
199GLIB_CFLAGS = @GLIB_CFLAGS@ 200GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -249,6 +250,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
249PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 250PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
250PIXMAN_LIBS = @PIXMAN_LIBS@ 251PIXMAN_LIBS = @PIXMAN_LIBS@
251PKG_CONFIG = @PKG_CONFIG@ 252PKG_CONFIG = @PKG_CONFIG@
253PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
254PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
252POSUB = @POSUB@ 255POSUB = @POSUB@
253RANLIB = @RANLIB@ 256RANLIB = @RANLIB@
254SCIM_CFLAGS = @SCIM_CFLAGS@ 257SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -259,6 +262,7 @@ SDL_LIBS = @SDL_LIBS@
259SED = @SED@ 262SED = @SED@
260SET_MAKE = @SET_MAKE@ 263SET_MAKE = @SET_MAKE@
261SHELL = @SHELL@ 264SHELL = @SHELL@
265SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
262SSL_CFLAGS = @SSL_CFLAGS@ 266SSL_CFLAGS = @SSL_CFLAGS@
263SSL_LIBS = @SSL_LIBS@ 267SSL_LIBS = @SSL_LIBS@
264STRIP = @STRIP@ 268STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c b/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c
index 4e8b7b1..72353ce 100644
--- a/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c
+++ b/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c
@@ -447,6 +447,58 @@ ecore_wince_window_title_set(Ecore_WinCE_Window *window,
447} 447}
448 448
449/** 449/**
450 * @brief Set the focus to the given window.
451 *
452 * @param window The window to give focus to.
453 *
454 * This function gives the focus to @p window. If @p window is
455 * @c NULL, this function does nothing.
456 */
457EAPI void
458ecore_wince_window_focus(Ecore_WinCE_Window *window)
459{
460 if (!window) return;
461
462 INF("focusing window");
463
464 if (!SetFocus(window->window))
465 {
466 ERR("SetFocus() failed");
467 }
468}
469
470/**
471 * @brief Get the current focused window.
472 *
473 * @return The window that has focus.
474 *
475 * This function returns the window that has focus. If the calling
476 * thread's message queue does not have an associated window with the
477 * keyboard focus, the return value is @c NULL.
478 *
479 * @note Even if the returned value is @c NULL, another thread's queue
480 * may be associated with a window that has the keyboard focus.
481 *
482 * @note The returned value is of type HWND.
483 */
484EAPI void *
485ecore_wince_window_focus_get(void)
486{
487 HWND focused;
488
489 INF("getting focused window");
490
491 focused = GetFocus();
492 if (!focused)
493 {
494 ERR("GetFocus() failed");
495 return NULL;
496 }
497
498 return focused;
499}
500
501/**
450 * @brief Set the graphic backend used for the given window. 502 * @brief Set the graphic backend used for the given window.
451 * 503 *
452 * @param window The window. 504 * @param window The window.
diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X.h b/libraries/ecore/src/lib/ecore_x/Ecore_X.h
index b5d2c3f..336b656 100644
--- a/libraries/ecore/src/lib/ecore_x/Ecore_X.h
+++ b/libraries/ecore/src/lib/ecore_x/Ecore_X.h
@@ -1104,6 +1104,28 @@ typedef enum _Ecore_X_Illume_Quickpanel_State
1104 ECORE_X_ILLUME_QUICKPANEL_STATE_ON 1104 ECORE_X_ILLUME_QUICKPANEL_STATE_ON
1105} Ecore_X_Illume_Quickpanel_State; 1105} Ecore_X_Illume_Quickpanel_State;
1106 1106
1107typedef enum _Ecore_X_Illume_Indicator_State
1108{
1109 ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN = 0,
1110 ECORE_X_ILLUME_INDICATOR_STATE_OFF,
1111 ECORE_X_ILLUME_INDICATOR_STATE_ON
1112} Ecore_X_Illume_Indicator_State;
1113
1114typedef enum _Ecore_X_Illume_Clipboard_State
1115{
1116 ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN = 0,
1117 ECORE_X_ILLUME_CLIPBOARD_STATE_OFF,
1118 ECORE_X_ILLUME_CLIPBOARD_STATE_ON
1119} Ecore_X_Illume_Clipboard_State;
1120
1121typedef enum _Ecore_X_Illume_Indicator_Opacity_Mode
1122{
1123 ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN = 0,
1124 ECORE_X_ILLUME_INDICATOR_OPAQUE,
1125 ECORE_X_ILLUME_INDICATOR_TRANSLUCENT,
1126 ECORE_X_ILLUME_INDICATOR_TRANSPARENT
1127} Ecore_X_Illume_Indicator_Opacity_Mode;
1128
1107/* Window layer constants */ 1129/* Window layer constants */
1108#define ECORE_X_WINDOW_LAYER_BELOW 2 1130#define ECORE_X_WINDOW_LAYER_BELOW 2
1109#define ECORE_X_WINDOW_LAYER_NORMAL 4 1131#define ECORE_X_WINDOW_LAYER_NORMAL 4
@@ -2159,6 +2181,11 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
2159 int *bottom_start_x, 2181 int *bottom_start_x,
2160 int *bottom_end_x); 2182 int *bottom_end_x);
2161 2183
2184EAPI void
2185ecore_x_netwm_icons_set(Ecore_X_Window win,
2186 Ecore_X_Icon *icon,
2187 int num);
2188
2162EAPI Eina_Bool 2189EAPI Eina_Bool
2163ecore_x_netwm_icons_get(Ecore_X_Window win, 2190ecore_x_netwm_icons_get(Ecore_X_Window win,
2164 Ecore_X_Icon **icon, 2191 Ecore_X_Icon **icon,
@@ -2399,6 +2426,25 @@ EAPI void
2399 ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win); 2426 ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win);
2400 2427
2401EAPI void 2428EAPI void
2429ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
2430 Ecore_X_Illume_Clipboard_State state);
2431
2432EAPI Ecore_X_Illume_Clipboard_State
2433ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win);
2434
2435EAPI void
2436ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
2437 int x,
2438 int y,
2439 int w,
2440 int h);
2441EAPI Eina_Bool
2442ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
2443 int *x,
2444 int *y,
2445 int *w,
2446 int *h);
2447EAPI void
2402ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, 2448ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
2403 Ecore_X_Sync_Counter counter); 2449 Ecore_X_Sync_Counter counter);
2404EAPI Ecore_X_Sync_Counter 2450EAPI Ecore_X_Sync_Counter
@@ -2657,7 +2703,7 @@ ecore_x_xregion_rect_contain(Ecore_X_XRegion *region,
2657/* The usage of 'Ecore_X_Randr_None' or 'Ecore_X_Randr_Unset' 2703/* The usage of 'Ecore_X_Randr_None' or 'Ecore_X_Randr_Unset'
2658 * depends on the context. In most cases 'Ecore_X_Randr_Unset' 2704 * depends on the context. In most cases 'Ecore_X_Randr_Unset'
2659 * can be used, but in some cases -1 is a special value to 2705 * can be used, but in some cases -1 is a special value to
2660 * functions, thus 'Ecore_X_Randr_None' (=0) musst be used. 2706 * functions, thus 'Ecore_X_Randr_None' (=0) must be used.
2661 */ 2707 */
2662 2708
2663typedef short Ecore_X_Randr_Refresh_Rate; 2709typedef short Ecore_X_Randr_Refresh_Rate;
@@ -2749,6 +2795,11 @@ EAPI Eina_Bool
2749EAPI Ecore_X_Randr_Mode_Info ** 2795EAPI Ecore_X_Randr_Mode_Info **
2750ecore_x_randr_modes_info_get(Ecore_X_Window root, 2796ecore_x_randr_modes_info_get(Ecore_X_Window root,
2751 int *num); 2797 int *num);
2798EAPI Ecore_X_Randr_Mode
2799ecore_x_randr_mode_info_add(Ecore_X_Window root,
2800 Ecore_X_Randr_Mode_Info *mode_info);
2801EAPI void
2802ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode);
2752EAPI Ecore_X_Randr_Mode_Info * 2803EAPI Ecore_X_Randr_Mode_Info *
2753ecore_x_randr_mode_info_get(Ecore_X_Window root, 2804ecore_x_randr_mode_info_get(Ecore_X_Window root,
2754 Ecore_X_Randr_Mode mode); 2805 Ecore_X_Randr_Mode mode);
@@ -2762,10 +2813,13 @@ EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(Ecore_X_Window root,
2762EAPI Ecore_X_Randr_Output * 2813EAPI Ecore_X_Randr_Output *
2763ecore_x_randr_window_outputs_get(Ecore_X_Window window, 2814ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2764 int *num); 2815 int *num);
2765EINA_DEPRECATED EAPI Ecore_X_Randr_Output * 2816EAPI Ecore_X_Randr_Output *
2766ecore_x_randr_current_output_get(Ecore_X_Window window, 2817ecore_x_randr_current_output_get(Ecore_X_Window window,
2767 int *num); 2818 int *num);
2768EAPI Ecore_X_Randr_Crtc * 2819EAPI Ecore_X_Randr_Crtc *
2820ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
2821 int *num);
2822EAPI Ecore_X_Randr_Crtc *
2769ecore_x_randr_current_crtc_get(Ecore_X_Window window, 2823ecore_x_randr_current_crtc_get(Ecore_X_Window window,
2770 int *num); 2824 int *num);
2771EAPI Ecore_X_Randr_Output * 2825EAPI Ecore_X_Randr_Output *
@@ -2840,6 +2894,12 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
2840 Ecore_X_Randr_Crtc crtc_r2, 2894 Ecore_X_Randr_Crtc crtc_r2,
2841 Ecore_X_Randr_Output_Policy policy, 2895 Ecore_X_Randr_Output_Policy policy,
2842 Ecore_X_Randr_Relative_Alignment alignment); 2896 Ecore_X_Randr_Relative_Alignment alignment);
2897EAPI Eina_Bool
2898ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
2899 Ecore_X_Randr_Mode mode);
2900EAPI void
2901ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
2902 Ecore_X_Randr_Mode mode);
2843EAPI Ecore_X_Randr_Mode * 2903EAPI Ecore_X_Randr_Mode *
2844ecore_x_randr_output_modes_get(Ecore_X_Window root, 2904ecore_x_randr_output_modes_get(Ecore_X_Window root,
2845 Ecore_X_Randr_Output output, 2905 Ecore_X_Randr_Output output,
@@ -3408,6 +3468,13 @@ EAPI Eina_Bool
3408EAPI const char * 3468EAPI const char *
3409 ecore_x_keysym_string_get(int keysym); 3469 ecore_x_keysym_string_get(int keysym);
3410 3470
3471/**
3472 * Given a keyname, return the keycode representing that key
3473 *
3474 * @since 1.2.0
3475 */
3476EAPI int ecore_x_keysym_keycode_get(const char *keyname);
3477
3411typedef struct _Ecore_X_Image Ecore_X_Image; 3478typedef struct _Ecore_X_Image Ecore_X_Image;
3412 3479
3413EAPI Ecore_X_Image * 3480EAPI Ecore_X_Image *
@@ -3617,6 +3684,26 @@ ecore_x_gesture_event_ungrab(Ecore_X_Window win,
3617 Ecore_X_Gesture_Event_Type type, 3684 Ecore_X_Gesture_Event_Type type,
3618 int num_fingers); 3685 int num_fingers);
3619 3686
3687EAPI void
3688ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
3689 Ecore_X_Illume_Indicator_State state);
3690EAPI Ecore_X_Illume_Indicator_State
3691ecore_x_e_illume_indicator_state_get(Ecore_X_Window win);
3692EAPI void
3693ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
3694 Ecore_X_Illume_Indicator_State state);
3695
3696EAPI void
3697ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
3698 Ecore_X_Illume_Indicator_Opacity_Mode mode);
3699
3700EAPI Ecore_X_Illume_Indicator_Opacity_Mode
3701ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win);
3702
3703EAPI void
3704ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
3705 Ecore_X_Illume_Indicator_Opacity_Mode mode);
3706
3620#ifdef __cplusplus 3707#ifdef __cplusplus
3621} 3708}
3622#endif // ifdef __cplusplus 3709#endif // ifdef __cplusplus
diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h b/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h
index 6788a5e..1341716 100644
--- a/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h
+++ b/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h
@@ -238,6 +238,20 @@ EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR;
238EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR; 238EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR;
239EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE; 239EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE;
240EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE; 240EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE;
241EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE;
242EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
243EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
244EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE;
245EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
246EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
247EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
248EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE;
249EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE;
250EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE;
251EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE;
252EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
253EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
254EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY;
241 255
242EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER; 256EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER;
243EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; 257EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE;
diff --git a/libraries/ecore/src/lib/ecore_x/Makefile.in b/libraries/ecore/src/lib/ecore_x/Makefile.in
index 3b53cfe..fb446ef 100644
--- a/libraries/ecore/src/lib/ecore_x/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_x/Makefile.in
@@ -50,16 +50,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 50 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 51 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 52 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
53 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 53 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
54 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 54 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
55 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 55 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
56 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 56 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
57 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 57 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
58 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 58 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
59 $(top_srcdir)/configure.ac
60am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
61 $(ACLOCAL_M4) 60 $(ACLOCAL_M4)
62mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 61mkinstalldirs = $(install_sh) -d
63CONFIG_HEADER = $(top_builddir)/config.h 62CONFIG_HEADER = $(top_builddir)/config.h
64CONFIG_CLEAN_FILES = 63CONFIG_CLEAN_FILES =
65CONFIG_CLEAN_VPATH_FILES = 64CONFIG_CLEAN_VPATH_FILES =
@@ -224,6 +223,8 @@ EVAS_LIBS = @EVAS_LIBS@
224EVIL_CFLAGS = @EVIL_CFLAGS@ 223EVIL_CFLAGS = @EVIL_CFLAGS@
225EVIL_LIBS = @EVIL_LIBS@ 224EVIL_LIBS = @EVIL_LIBS@
226EXEEXT = @EXEEXT@ 225EXEEXT = @EXEEXT@
226EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
227EXOTIC_LIBS = @EXOTIC_LIBS@
227FGREP = @FGREP@ 228FGREP = @FGREP@
228GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 229GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
229GLIB_CFLAGS = @GLIB_CFLAGS@ 230GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -279,6 +280,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
279PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 280PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
280PIXMAN_LIBS = @PIXMAN_LIBS@ 281PIXMAN_LIBS = @PIXMAN_LIBS@
281PKG_CONFIG = @PKG_CONFIG@ 282PKG_CONFIG = @PKG_CONFIG@
283PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
284PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
282POSUB = @POSUB@ 285POSUB = @POSUB@
283RANLIB = @RANLIB@ 286RANLIB = @RANLIB@
284SCIM_CFLAGS = @SCIM_CFLAGS@ 287SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -289,6 +292,7 @@ SDL_LIBS = @SDL_LIBS@
289SED = @SED@ 292SED = @SED@
290SET_MAKE = @SET_MAKE@ 293SET_MAKE = @SET_MAKE@
291SHELL = @SHELL@ 294SHELL = @SHELL@
295SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
292SSL_CFLAGS = @SSL_CFLAGS@ 296SSL_CFLAGS = @SSL_CFLAGS@
293SSL_LIBS = @SSL_LIBS@ 297SSL_LIBS = @SSL_LIBS@
294STRIP = @STRIP@ 298STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h b/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h
index 3f22356..8952df3 100644
--- a/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h
+++ b/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h
@@ -264,6 +264,20 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR = 0;
264EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0; 264EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0;
265EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0; 265EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0;
266EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0; 266EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0;
267EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE = 0;
268EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_ON = 0;
269EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF = 0;
270EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE = 0;
271EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE= 0;
272EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT = 0;
273EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT = 0;
274EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE = 0;
275EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE = 0;
276EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE = 0;
277EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE = 0;
278EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY = 0;
279EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON = 0;
280EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF = 0;
267 281
268EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0; 282EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0;
269EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE = 0; 283EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE = 0;
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in
index 9108f23..ff2227c 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in
@@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4) 58 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 59mkinstalldirs = $(install_sh) -d
61CONFIG_HEADER = $(top_builddir)/config.h 60CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES = 61CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES = 62CONFIG_CLEAN_VPATH_FILES =
@@ -206,6 +205,8 @@ EVAS_LIBS = @EVAS_LIBS@
206EVIL_CFLAGS = @EVIL_CFLAGS@ 205EVIL_CFLAGS = @EVIL_CFLAGS@
207EVIL_LIBS = @EVIL_LIBS@ 206EVIL_LIBS = @EVIL_LIBS@
208EXEEXT = @EXEEXT@ 207EXEEXT = @EXEEXT@
208EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
209EXOTIC_LIBS = @EXOTIC_LIBS@
209FGREP = @FGREP@ 210FGREP = @FGREP@
210GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 211GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
211GLIB_CFLAGS = @GLIB_CFLAGS@ 212GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -261,6 +262,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
261PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 262PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
262PIXMAN_LIBS = @PIXMAN_LIBS@ 263PIXMAN_LIBS = @PIXMAN_LIBS@
263PKG_CONFIG = @PKG_CONFIG@ 264PKG_CONFIG = @PKG_CONFIG@
265PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
266PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
264POSUB = @POSUB@ 267POSUB = @POSUB@
265RANLIB = @RANLIB@ 268RANLIB = @RANLIB@
266SCIM_CFLAGS = @SCIM_CFLAGS@ 269SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -271,6 +274,7 @@ SDL_LIBS = @SDL_LIBS@
271SED = @SED@ 274SED = @SED@
272SET_MAKE = @SET_MAKE@ 275SET_MAKE = @SET_MAKE@
273SHELL = @SHELL@ 276SHELL = @SHELL@
277SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
274SSL_CFLAGS = @SSL_CFLAGS@ 278SSL_CFLAGS = @SSL_CFLAGS@
275SSL_LIBS = @SSL_LIBS@ 279SSL_LIBS = @SSL_LIBS@
276STRIP = @STRIP@ 280STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
index 769ffac..ec2daaf 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
+++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c
@@ -249,7 +249,20 @@ static Xcb_Atom atoms[] =
249 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, 249 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
250 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", 250 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
251 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, 251 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
252 252 { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
253 { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON },
254 { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF },
255 { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE },
256 { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE },
257 { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT },
258 { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT },
259 { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
260 { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
261 { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
262 { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE },
263 { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON },
264 { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF },
265 { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY },
253 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, 266 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
254 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, 267 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
255 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED }, 268 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED },
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c
index c868f5e..60bfc9c 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c
+++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c
@@ -7,6 +7,8 @@ static Ecore_X_Atom _ecore_xcb_e_quickpanel_atom_get(Ecore_X_
7static Ecore_X_Illume_Quickpanel_State _ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom); 7static Ecore_X_Illume_Quickpanel_State _ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom);
8static Ecore_X_Atom _ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode); 8static Ecore_X_Atom _ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode);
9static Ecore_X_Illume_Mode _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom); 9static Ecore_X_Illume_Mode _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom);
10static Ecore_X_Atom _ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state);
11static Ecore_X_Illume_Indicator_State _ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom);
10 12
11EAPI void 13EAPI void
12ecore_x_e_init(void) 14ecore_x_e_init(void)
@@ -719,6 +721,99 @@ ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win)
719 0, 0, 0, 0, 0); 721 0, 0, 0, 0, 0);
720} 722}
721 723
724static Ecore_X_Atom
725_ecore_xcb_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state)
726{
727 switch (state)
728 {
729 case ECORE_X_ILLUME_CLIPBOARD_STATE_ON:
730 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
731 case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF:
732 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
733 default:
734 break;
735 }
736 return 0;
737}
738
739static Ecore_X_Illume_Clipboard_State
740_ecore_xcb_e_clipboard_state_get(Ecore_X_Atom atom)
741{
742 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON)
743 return ECORE_X_ILLUME_CLIPBOARD_STATE_ON;
744
745 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF)
746 return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF;
747
748 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
749}
750
751EAPI void
752ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
753 Ecore_X_Illume_Clipboard_State state)
754{
755 Ecore_X_Atom atom = 0;
756
757 LOGFN(__FILE__, __LINE__, __FUNCTION__);
758 atom = _ecore_xcb_e_clipboard_atom_get(state);
759
760 ecore_x_window_prop_atom_set(win,
761 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
762 &atom, 1);
763}
764
765EAPI Ecore_X_Illume_Clipboard_State
766ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win)
767{
768 Ecore_X_Atom atom = 0;
769
770 LOGFN(__FILE__, __LINE__, __FUNCTION__);
771
772 if (!ecore_x_window_prop_atom_get(win,
773 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
774 &atom, 1))
775 return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN;
776 return _ecore_xcb_e_clipboard_state_get(atom);
777}
778
779EAPI void
780ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
781 int x, int y, int w, int h)
782{
783 unsigned int geom[4];
784
785 LOGFN(__FILE__, __LINE__, __FUNCTION__);
786 geom[0] = x;
787 geom[1] = y;
788 geom[2] = w;
789 geom[3] = h;
790 ecore_x_window_prop_card32_set(win,
791 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
792 geom, 4);
793}
794
795EAPI Eina_Bool
796ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
797 int *x, int *y, int *w, int *h)
798{
799 int ret = 0;
800 unsigned int geom[4];
801
802 LOGFN(__FILE__, __LINE__, __FUNCTION__);
803 ret =
804 ecore_x_window_prop_card32_get(win,
805 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
806 geom, 4);
807 if (ret != 4) return EINA_FALSE;
808
809 if (x) *x = geom[0];
810 if (y) *y = geom[1];
811 if (w) *w = geom[2];
812 if (h) *h = geom[3];
813
814 return EINA_TRUE;
815}
816
722EAPI void 817EAPI void
723ecore_x_e_illume_mode_set(Ecore_X_Window win, 818ecore_x_e_illume_mode_set(Ecore_X_Window win,
724 Ecore_X_Illume_Mode mode) 819 Ecore_X_Illume_Mode mode)
@@ -1069,3 +1164,144 @@ _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom)
1069 return ECORE_X_ILLUME_MODE_UNKNOWN; 1164 return ECORE_X_ILLUME_MODE_UNKNOWN;
1070} 1165}
1071 1166
1167static Ecore_X_Atom
1168_ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state)
1169{
1170 switch (state)
1171 {
1172 case ECORE_X_ILLUME_INDICATOR_STATE_ON:
1173 return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
1174
1175 case ECORE_X_ILLUME_INDICATOR_STATE_OFF:
1176 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
1177
1178 default:
1179 break;
1180 }
1181 return 0;
1182}
1183
1184static Ecore_X_Illume_Indicator_State
1185_ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom)
1186{
1187 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON)
1188 return ECORE_X_ILLUME_INDICATOR_STATE_ON;
1189 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF)
1190 return ECORE_X_ILLUME_INDICATOR_STATE_OFF;
1191
1192 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1193}
1194
1195EAPI void
1196ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
1197 Ecore_X_Illume_Indicator_State state)
1198{
1199 Ecore_X_Atom atom = 0;
1200
1201 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1202
1203 atom = _ecore_xcb_e_indicator_atom_get(state);
1204 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1205 &atom, 1);
1206}
1207
1208EAPI Ecore_X_Illume_Indicator_State
1209ecore_x_e_illume_indicator_state_get(Ecore_X_Window win)
1210{
1211 Ecore_X_Atom atom = 0;
1212
1213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1214
1215 if (!ecore_x_window_prop_atom_get(win,
1216 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1217 &atom, 1))
1218 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1219
1220 return _ecore_xcb_e_indicator_state_get(atom);
1221}
1222
1223EAPI void
1224ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
1225 Ecore_X_Illume_Indicator_State state)
1226{
1227 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1228 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1229 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1230 _ecore_xcb_e_indicator_atom_get(state),
1231 0, 0, 0, 0);
1232}
1233
1234static Ecore_X_Atom
1235_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode)
1236{
1237 switch (mode)
1238 {
1239 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1240 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
1241
1242 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1243 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
1244
1245 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1246 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
1247
1248 default:
1249 break;
1250 }
1251 return 0;
1252}
1253
1254static Ecore_X_Illume_Indicator_Opacity_Mode
1255_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom)
1256{
1257 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE)
1258 return ECORE_X_ILLUME_INDICATOR_OPAQUE;
1259
1260 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT)
1261 return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1262
1263 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT)
1264 return ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1265
1266 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1267}
1268
1269EAPI void
1270ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
1271 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1272{
1273 Ecore_X_Atom atom = 0;
1274
1275 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1276 atom = _ecore_x_e_indicator_opacity_atom_get(mode);
1277 ecore_x_window_prop_atom_set(win,
1278 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1279 &atom, 1);
1280}
1281
1282EAPI Ecore_X_Illume_Indicator_Opacity_Mode
1283ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win)
1284{
1285 Ecore_X_Atom atom;
1286
1287 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1288 if (!ecore_x_window_prop_atom_get(win,
1289 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1290 &atom, 1))
1291 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1292
1293 return _ecore_x_e_indicator_opacity_get(atom);
1294}
1295
1296EAPI void
1297ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
1298 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1299{
1300 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1301 ecore_x_client_message32_send(win,
1302 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1303 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1304 _ecore_x_e_indicator_opacity_atom_get(mode),
1305 0, 0, 0, 0);
1306}
1307
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c
index 40304df..b1c7528 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c
+++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c
@@ -279,6 +279,14 @@ ecore_x_keysym_string_get(int keysym)
279 return _ecore_xcb_keymap_keysym_to_string(keysym); 279 return _ecore_xcb_keymap_keysym_to_string(keysym);
280} 280}
281 281
282EAPI int
283ecore_x_keysym_keycode_get(const char *keyname)
284{
285 LOGFN(__FILE__, __LINE__, __FUNCTION__);
286
287 return _ecore_xcb_keymap_string_to_keycode(keyname);
288}
289
282/* local functions */ 290/* local functions */
283static int 291static int
284_ecore_xcb_keymap_mask_get(void *reply, 292_ecore_xcb_keymap_mask_get(void *reply,
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c
index 0a523b9..b1e0622 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c
+++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c
@@ -838,6 +838,56 @@ ecore_x_netwm_icon_name_set(Ecore_X_Window win,
838 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); 838 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name);
839} 839}
840 840
841EAPI void
842ecore_x_netwm_icons_set(Ecore_X_Window win,
843 Ecore_X_Icon *icon,
844 int num)
845{
846 unsigned int *data, *p, *p2;
847 unsigned int i, size, x, y;
848
849 LOGFN(__FILE__, __LINE__, __FUNCTION__);
850 size = 0;
851 for (i = 0; i < (unsigned int)num; i++)
852 {
853 size += 2 + (icon[i].width * icon[i].height);
854 }
855 data = malloc(size * sizeof(unsigned int));
856 if (!data) return;
857 p = data;
858 for (i = 0; i < (unsigned int)num; i++)
859 {
860 p[0] = icon[i].width;
861 p[1] = icon[i].height;
862 p += 2;
863 p2 = icon[i].data;
864 for (y = 0; y < icon[i].height; y++)
865 {
866 for (x = 0; x < icon[i].width; x++)
867 {
868 unsigned int r, g, b, a;
869
870 a = (*p2 >> 24) & 0xff;
871 r = (*p2 >> 16) & 0xff;
872 g = (*p2 >> 8 ) & 0xff;
873 b = (*p2 ) & 0xff;
874 if ((a > 0) && (a < 255))
875 {
876 r = (r * 255) / a;
877 g = (g * 255) / a;
878 b = (b * 255) / a;
879 }
880 *p = (a << 24) | (r << 16) | (g << 8) | b;
881 p++;
882 p2++;
883 }
884 }
885 }
886 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
887 data, size);
888 free(data);
889}
890
841EAPI Eina_Bool 891EAPI Eina_Bool
842ecore_x_netwm_icons_get(Ecore_X_Window win, 892ecore_x_netwm_icons_get(Ecore_X_Window win,
843 Ecore_X_Icon **icon, 893 Ecore_X_Icon **icon,
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c
index 62f7618..81a7c3f 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c
+++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c
@@ -1,7 +1,6 @@
1/* TODO: List of missing functions 1/* TODO: List of missing functions
2 * 2 *
3 * ecore_x_randr_crtc_clone_set 3 * ecore_x_randr_crtc_clone_set
4 * ecore_x_randr_output_size_mm_get
5 * ecore_x_randr_output_crtc_set 4 * ecore_x_randr_output_crtc_set
6 * ecore_x_randr_edid_version_get 5 * ecore_x_randr_edid_version_get
7 * ecore_x_randr_edid_info_has_valid_checksum 6 * ecore_x_randr_edid_info_has_valid_checksum
@@ -776,6 +775,24 @@ ecore_x_randr_output_modes_get(Ecore_X_Window root,
776 return modes; 775 return modes;
777} 776}
778 777
778EAPI Eina_Bool
779ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, Ecore_X_Randr_Mode mode)
780{
781 LOGFN(__FILE__, __LINE__, __FUNCTION__);
782 CHECK_XCB_CONN;
783
784#ifdef ECORE_XCB_RANDR
785 RANDR_CHECK_1_2_RET(EINA_FALSE);
786
787 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
788 return EINA_FALSE;
789
790 xcb_randr_add_output_mode(_ecore_xcb_conn, output, mode);
791 return EINA_TRUE;
792#endif
793 return EINA_FALSE;
794}
795
779/* 796/*
780 * @brief get detailed information for a given mode id 797 * @brief get detailed information for a given mode id
781 * @param root window which's screen's ressources are queried 798 * @param root window which's screen's ressources are queried
@@ -805,6 +822,63 @@ ecore_x_randr_mode_info_get(Ecore_X_Window root,
805} 822}
806 823
807/* 824/*
825 * @brief add a mode to a display
826 * @param root window to which's screen's ressources are added
827 * @param mode_info
828 * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode
829 * adding failed.
830 * @since 1.2.0
831 */
832EAPI Ecore_X_Randr_Mode
833ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info)
834{
835#ifdef ECORE_XCB_RANDR
836 Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
837 xcb_randr_create_mode_cookie_t cookie;
838 xcb_randr_create_mode_reply_t *reply;
839 xcb_randr_mode_info_t info;
840 int namelen = 0;
841#endif
842
843 LOGFN(__FILE__, __LINE__, __FUNCTION__);
844 CHECK_XCB_CONN;
845
846#ifdef ECORE_XCB_RANDR
847 RANDR_CHECK_1_2_RET(EINA_FALSE);
848
849 if (!mode_info) return Ecore_X_Randr_None;
850 if (!_ecore_xcb_randr_root_validate(root)) return Ecore_X_Randr_None;
851
852 namelen = strlen(mode_info->name);
853
854 memset(&info, 0, sizeof(info));
855 info.width = mode_info->width;
856 info.height = mode_info->height;
857 info.dot_clock = mode_info->dotClock;
858 info.hsync_start = mode_info->hSyncStart;
859 info.hsync_end = mode_info->hSyncEnd;
860 info.htotal = mode_info->hTotal;
861 info.hskew = mode_info->hSkew;
862 info.vsync_start = mode_info->vSyncStart;
863 info.vsync_end = mode_info->vSyncEnd;
864 info.vtotal = mode_info->vTotal;
865 info.mode_flags = mode_info->modeFlags;
866 info.name_len = namelen;
867
868 cookie =
869 xcb_randr_create_mode_unchecked(_ecore_xcb_conn, root, info,
870 namelen, mode_info->name);
871 reply = xcb_randr_create_mode_reply(_ecore_xcb_conn, cookie, NULL);
872 if (reply)
873 {
874 mode = mode_info->xid;
875 free(reply);
876 }
877#endif
878 return mode;
879}
880
881/*
808 * @brief get detailed information for all modes related to a root window's screen 882 * @brief get detailed information for all modes related to a root window's screen
809 * @param root window which's screen's ressources are queried 883 * @param root window which's screen's ressources are queried
810 * @param num number of modes returned 884 * @param num number of modes returned
@@ -1057,6 +1131,53 @@ ecore_x_randr_output_crtc_get(Ecore_X_Window root,
1057 return Ecore_X_Randr_None; 1131 return Ecore_X_Randr_None;
1058} 1132}
1059 1133
1134EAPI void
1135ecore_x_randr_output_size_mm_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *w_mm, int *h_mm)
1136{
1137#ifdef ECORE_XCB_RANDR
1138 xcb_randr_get_output_info_cookie_t ocookie;
1139 xcb_randr_get_output_info_reply_t *oreply;
1140 xcb_timestamp_t timestamp = 0;
1141#endif
1142
1143 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1144 CHECK_XCB_CONN;
1145
1146 if (w_mm) *w_mm = 0;
1147 if (h_mm) *h_mm = 0;
1148
1149#ifdef ECORE_XCB_RANDR
1150 RANDR_CHECK_1_2_RET();
1151
1152 if ((output != Ecore_X_Randr_None) && (_randr_version >= RANDR_1_3))
1153 {
1154 xcb_randr_get_screen_resources_current_reply_t *reply;
1155
1156 reply = _ecore_xcb_randr_13_get_resources(root);
1157 timestamp = reply->config_timestamp;
1158 free(reply);
1159 }
1160 else if ((output != Ecore_X_Randr_None) && (_randr_version == RANDR_1_2))
1161 {
1162 xcb_randr_get_screen_resources_reply_t *reply;
1163
1164 reply = _ecore_xcb_randr_12_get_resources(root);
1165 timestamp = reply->config_timestamp;
1166 free(reply);
1167 }
1168
1169 ocookie =
1170 xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, timestamp);
1171 oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL);
1172 if (oreply)
1173 {
1174 if (w_mm) *w_mm = oreply->mm_width;
1175 if (h_mm) *h_mm = oreply->mm_height;
1176 free(oreply);
1177 }
1178#endif
1179}
1180
1060/** 1181/**
1061 * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is 1182 * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is
1062 * auto enabled in it's preferred mode, when it was disabled before. 1183 * auto enabled in it's preferred mode, when it was disabled before.
@@ -1439,6 +1560,87 @@ ecore_x_randr_crtcs_get(Ecore_X_Window root,
1439} 1560}
1440 1561
1441/* 1562/*
1563 * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead.
1564 * @brief get the CRTCs, which display a certain window
1565 * @param window window the displaying CRTCs shall be found for
1566 * @param num the number of CRTCs displaying the window
1567 * @return array of CRTCs that display a certain window. NULL if no CRTCs
1568 * was found that displays the specified window.
1569 */
1570EAPI Ecore_X_Randr_Crtc *
1571ecore_x_randr_current_crtc_get(Ecore_X_Window window,
1572 int *num)
1573{
1574 return ecore_x_randr_window_crtcs_get(window, num);
1575}
1576
1577/*
1578 * @brief get the CRTCs, which display a certain window
1579 * @param window window the displaying crtcs shall be found for
1580 * @param num the number of crtcs displaying the window
1581 * @return array of crtcs that display a certain window. NULL if no crtcs
1582 * was found that displays the specified window.
1583 * @since 1.2.0
1584 */
1585EAPI Ecore_X_Randr_Crtc *
1586ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
1587 int *num)
1588{
1589#ifdef ECORE_XCB_RANDR
1590 Ecore_X_Window root;
1591 Eina_Rectangle w_geo, c_geo;
1592 Ecore_X_Randr_Crtc *crtcs, *ret = NULL;
1593 Ecore_X_Randr_Mode mode;
1594 int ncrtcs, i, nret = 0;
1595 xcb_translate_coordinates_cookie_t cookie;
1596 xcb_translate_coordinates_reply_t *trans;
1597#endif
1598
1599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1600 CHECK_XCB_CONN;
1601
1602#ifdef ECORE_XCB_RANDR
1603 RANDR_CHECK_1_2_RET(NULL);
1604
1605 ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h);
1606
1607 root = ecore_x_window_root_get(window);
1608 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
1609 if (!crtcs) return NULL;
1610
1611 /* now get window RELATIVE to root window - thats what matters. */
1612 cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
1613 trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
1614 w_geo.x = trans->dst_x;
1615 w_geo.y = trans->dst_y;
1616 free(trans);
1617
1618 for (i = 0, nret = 0; i < ncrtcs; i++)
1619 {
1620 /* if crtc is not enabled, don't bother about it any further */
1621 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
1622 if (mode == Ecore_X_Randr_None) continue;
1623
1624 ecore_x_randr_crtc_geometry_get(root, crtcs[i], &c_geo.x, &c_geo.y,
1625 &c_geo.w, &c_geo.h);
1626 if (eina_rectangles_intersect(&w_geo, &c_geo))
1627 {
1628 ret = realloc(ret, (++nret *
1629 sizeof(Ecore_X_Randr_Output)));
1630 ret[nret] = crtcs[i];
1631 }
1632 }
1633 free(crtcs);
1634
1635 if (num) *num = nret;
1636 return ret;
1637
1638#endif
1639 if (num) *num = 0;
1640 return NULL;
1641}
1642
1643/*
1442 * @brief get a CRTC's outputs. 1644 * @brief get a CRTC's outputs.
1443 * @param root the root window which's screen will be queried 1645 * @param root the root window which's screen will be queried
1444 * @param num number of outputs referenced by given CRTC 1646 * @param num number of outputs referenced by given CRTC
@@ -2172,6 +2374,22 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root,
2172} 2374}
2173 2375
2174/* 2376/*
2377 * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead.
2378 * @brief get the outputs, which display a certain window
2379 * @param window window the displaying outputs shall be found for
2380 * @param num the number of outputs displaying the window
2381 * @return array of outputs that display a certain window. NULL if no outputs
2382 * was found that displays the specified window.
2383 */
2384
2385Ecore_X_Randr_Output *
2386ecore_x_randr_current_output_get(Ecore_X_Window window,
2387 int *num)
2388{
2389 return ecore_x_randr_window_outputs_get(window, num);
2390}
2391
2392/*
2175 * @brief get the outputs, which display a certain window 2393 * @brief get the outputs, which display a certain window
2176 * @param window window the displaying outputs shall be found for 2394 * @param window window the displaying outputs shall be found for
2177 * @param num the number of outputs displaying the window 2395 * @param num the number of outputs displaying the window
@@ -2184,13 +2402,9 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2184{ 2402{
2185#ifdef ECORE_XCB_RANDR 2403#ifdef ECORE_XCB_RANDR
2186 Ecore_X_Window root; 2404 Ecore_X_Window root;
2187 Eina_Rectangle w_geo, c_geo;
2188 Ecore_X_Randr_Crtc *crtcs; 2405 Ecore_X_Randr_Crtc *crtcs;
2189 Ecore_X_Randr_Mode mode; 2406 Ecore_X_Randr_Output *outputs, *ret = NULL;
2190 Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
2191 int ncrtcs, noutputs, i, nret = 0; 2407 int ncrtcs, noutputs, i, nret = 0;
2192 xcb_translate_coordinates_cookie_t cookie;
2193 xcb_translate_coordinates_reply_t *trans;
2194#endif 2408#endif
2195 2409
2196 LOGFN(__FILE__, __LINE__, __FUNCTION__); 2410 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -2199,64 +2413,36 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2199 if (num) *num = 0; 2413 if (num) *num = 0;
2200 2414
2201#ifdef ECORE_XCB_RANDR 2415#ifdef ECORE_XCB_RANDR
2202 RANDR_CHECK_1_2_RET(NULL); 2416 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
2203
2204 ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h);
2205 2417
2206 root = ecore_x_window_root_get(window); 2418 root = ecore_x_window_root_get(window);
2207 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); 2419 if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
2208 if (!crtcs) return NULL; 2420 goto _ecore_x_randr_current_output_get_fail;
2209 2421
2210 /* now get window RELATIVE to root window - thats what matters. */ 2422 for (i = 0, nret = 0; i < ncrtcs; i++)
2211 cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
2212 trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL);
2213 w_geo.x = trans->dst_x;
2214 w_geo.y = trans->dst_y;
2215 free(trans);
2216
2217 for (i = 0; i < ncrtcs; i++)
2218 { 2423 {
2219 /* if crtc is not enabled, don't bother about it any further */
2220 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
2221 if (mode == Ecore_X_Randr_None) continue;
2222 2424
2223 ecore_x_randr_crtc_geometry_get(root, crtcs[i], &c_geo.x, &c_geo.y, 2425 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
2224 &c_geo.w, &c_geo.h); 2426 &noutputs);
2225 if (eina_rectangles_intersect(&w_geo, &c_geo)) 2427 if (!outputs)
2226 { 2428 goto _ecore_x_randr_current_output_get_fail_free;
2227 outputs = 2429 nret += noutputs;
2228 ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs); 2430 ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
2229 /* The case below should be impossible, but for safety reasons 2431 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2230 * remains */ 2432 free(outputs);
2231 if (!outputs)
2232 {
2233 if (num) *num = 0;
2234 free(ret);
2235 free(crtcs);
2236 return NULL;
2237 }
2238 tret = realloc(ret, ((nret + noutputs) *
2239 sizeof(Ecore_X_Randr_Output)));
2240 if (!tret)
2241 {
2242 if (num) *num = 0;
2243 free(outputs);
2244 free(ret);
2245 free(crtcs);
2246 return NULL;
2247 }
2248 ret = tret;
2249 memcpy(&ret[nret], outputs,
2250 (noutputs * sizeof(Ecore_X_Randr_Output)));
2251 nret += noutputs;
2252 free(outputs);
2253 }
2254 } 2433 }
2255 free(crtcs); 2434 free(crtcs);
2256 2435
2257 if (num) *num = nret; 2436 if (num)
2437 *num = nret;
2438
2258 return ret; 2439 return ret;
2259 2440
2441_ecore_x_randr_current_output_get_fail_free:
2442 free(outputs);
2443 free(crtcs);
2444 free(ret);
2445_ecore_x_randr_current_output_get_fail:
2260#endif 2446#endif
2261 if (num) *num = 0; 2447 if (num) *num = 0;
2262 return NULL; 2448 return NULL;
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c
index 27bceaf..3458729 100644
--- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c
+++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c
@@ -651,7 +651,7 @@ ecore_x_window_depth_get(Ecore_X_Window win)
651 * @c _NET_WM_PID. 651 * @c _NET_WM_PID.
652 * 652 *
653 * @param win The given window. 653 * @param win The given window.
654 * @ingroup Ecore_X_Window_Properties_Groups 654 * @ingroup Ecore_X_Window_Properties_Group
655 */ 655 */
656EAPI void 656EAPI void
657ecore_x_window_defaults_set(Ecore_X_Window win) 657ecore_x_window_defaults_set(Ecore_X_Window win)
@@ -1119,7 +1119,7 @@ ecore_x_window_save_set_del(Ecore_X_Window win)
1119} 1119}
1120 1120
1121/** 1121/**
1122 * gets the focus to the window @p win. 1122 * gets the window that has focus.
1123 * @return The window that has focus. 1123 * @return The window that has focus.
1124 * @ingroup Ecore_X_Window_Focus_Functions 1124 * @ingroup Ecore_X_Window_Focus_Functions
1125 */ 1125 */
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
index 27a2841..cada69a 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
+++ b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in
@@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4) 58 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 59mkinstalldirs = $(install_sh) -d
61CONFIG_HEADER = $(top_builddir)/config.h 60CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES = 61CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES = 62CONFIG_CLEAN_VPATH_FILES =
@@ -197,6 +196,8 @@ EVAS_LIBS = @EVAS_LIBS@
197EVIL_CFLAGS = @EVIL_CFLAGS@ 196EVIL_CFLAGS = @EVIL_CFLAGS@
198EVIL_LIBS = @EVIL_LIBS@ 197EVIL_LIBS = @EVIL_LIBS@
199EXEEXT = @EXEEXT@ 198EXEEXT = @EXEEXT@
199EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
200EXOTIC_LIBS = @EXOTIC_LIBS@
200FGREP = @FGREP@ 201FGREP = @FGREP@
201GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 202GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
202GLIB_CFLAGS = @GLIB_CFLAGS@ 203GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -252,6 +253,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
252PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 253PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
253PIXMAN_LIBS = @PIXMAN_LIBS@ 254PIXMAN_LIBS = @PIXMAN_LIBS@
254PKG_CONFIG = @PKG_CONFIG@ 255PKG_CONFIG = @PKG_CONFIG@
256PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
257PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
255POSUB = @POSUB@ 258POSUB = @POSUB@
256RANLIB = @RANLIB@ 259RANLIB = @RANLIB@
257SCIM_CFLAGS = @SCIM_CFLAGS@ 260SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -262,6 +265,7 @@ SDL_LIBS = @SDL_LIBS@
262SED = @SED@ 265SED = @SED@
263SET_MAKE = @SET_MAKE@ 266SET_MAKE = @SET_MAKE@
264SHELL = @SHELL@ 267SHELL = @SHELL@
268SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
265SSL_CFLAGS = @SSL_CFLAGS@ 269SSL_CFLAGS = @SSL_CFLAGS@
266SSL_LIBS = @SSL_LIBS@ 270SSL_LIBS = @SSL_LIBS@
267STRIP = @STRIP@ 271STRIP = @STRIP@
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
index ee981fe..7a8bffa 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c
@@ -270,7 +270,20 @@ _ecore_x_atoms_init(void)
270 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, 270 { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE },
271 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", 271 { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE",
272 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, 272 &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE },
273 273 { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE },
274 { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON },
275 { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF },
276 { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE },
277 { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE },
278 { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT },
279 { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT },
280 { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE },
281 { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE },
282 { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE },
283 { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE },
284 { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON },
285 { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF },
286 { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY },
274 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, 287 { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER },
275 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, 288 { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE },
276 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED }, 289 { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED },
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
index 5966bbd..4bd5218 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c
@@ -768,6 +768,99 @@ ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win)
768 1, 0, 0, 0, 0); 768 1, 0, 0, 0, 0);
769} 769}
770 770
771static Ecore_X_Atom
772_ecore_x_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state)
773{
774 switch (state)
775 {
776 case ECORE_X_ILLUME_CLIPBOARD_STATE_ON:
777 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON;
778 case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF:
779 return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF;
780 default:
781 break;
782 }
783 return 0;
784}
785
786static Ecore_X_Illume_Clipboard_State
787_ecore_x_e_clipboard_state_get(Ecore_X_Atom atom)
788{
789 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON)
790 return ECORE_X_ILLUME_CLIPBOARD_STATE_ON;
791
792 if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF)
793 return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF;
794
795 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
796}
797
798EAPI void
799ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win,
800 Ecore_X_Illume_Clipboard_State state)
801{
802 Ecore_X_Atom atom = 0;
803
804 LOGFN(__FILE__, __LINE__, __FUNCTION__);
805 atom = _ecore_x_e_clipboard_atom_get(state);
806
807 ecore_x_window_prop_atom_set(win,
808 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
809 &atom, 1);
810}
811
812EAPI Ecore_X_Illume_Clipboard_State
813ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win)
814{
815 Ecore_X_Atom atom = 0;
816
817 LOGFN(__FILE__, __LINE__, __FUNCTION__);
818
819 if (!ecore_x_window_prop_atom_get(win,
820 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE,
821 &atom, 1))
822 return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN;
823 return _ecore_x_e_clipboard_state_get(atom);
824}
825
826EAPI void
827ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win,
828 int x, int y, int w, int h)
829{
830 unsigned int geom[4];
831
832 LOGFN(__FILE__, __LINE__, __FUNCTION__);
833 geom[0] = x;
834 geom[1] = y;
835 geom[2] = w;
836 geom[3] = h;
837 ecore_x_window_prop_card32_set(win,
838 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
839 geom, 4);
840}
841
842EAPI Eina_Bool
843ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win,
844 int *x, int *y, int *w, int *h)
845{
846 int ret = 0;
847 unsigned int geom[4];
848
849 LOGFN(__FILE__, __LINE__, __FUNCTION__);
850 ret =
851 ecore_x_window_prop_card32_get(win,
852 ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY,
853 geom, 4);
854 if (ret != 4) return EINA_FALSE;
855
856 if (x) *x = geom[0];
857 if (y) *y = geom[1];
858 if (w) *w = geom[2];
859 if (h) *h = geom[3];
860
861 return EINA_TRUE;
862}
863
771EAPI void 864EAPI void
772ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, 865ecore_x_e_comp_sync_counter_set(Ecore_X_Window win,
773 Ecore_X_Sync_Counter counter) 866 Ecore_X_Sync_Counter counter)
@@ -1058,3 +1151,143 @@ ecore_x_e_comp_pixmap_get(Ecore_X_Window win)
1058 return pixmap; 1151 return pixmap;
1059} 1152}
1060 1153
1154static Ecore_X_Atom
1155_ecore_x_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state)
1156{
1157 switch (state)
1158 {
1159 case ECORE_X_ILLUME_INDICATOR_STATE_ON:
1160 return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON;
1161
1162 case ECORE_X_ILLUME_INDICATOR_STATE_OFF:
1163 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF;
1164
1165 default:
1166 break;
1167 }
1168 return 0;
1169}
1170
1171static Ecore_X_Illume_Indicator_State
1172_ecore_x_e_indicator_state_get(Ecore_X_Atom atom)
1173{
1174 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON)
1175 return ECORE_X_ILLUME_INDICATOR_STATE_ON;
1176
1177 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF)
1178 return ECORE_X_ILLUME_INDICATOR_STATE_OFF;
1179
1180 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1181}
1182
1183EAPI void
1184ecore_x_e_illume_indicator_state_set(Ecore_X_Window win,
1185 Ecore_X_Illume_Indicator_State state)
1186{
1187 Ecore_X_Atom atom = 0;
1188
1189 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1190 atom = _ecore_x_e_indicator_atom_get(state);
1191 ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1192 &atom, 1);
1193}
1194
1195EAPI Ecore_X_Illume_Indicator_State
1196ecore_x_e_illume_indicator_state_get(Ecore_X_Window win)
1197{
1198 Ecore_X_Atom atom;
1199
1200 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1201 if (!ecore_x_window_prop_atom_get(win,
1202 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1203 &atom, 1))
1204 return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN;
1205
1206 return _ecore_x_e_indicator_state_get(atom);
1207}
1208
1209EAPI void
1210ecore_x_e_illume_indicator_state_send(Ecore_X_Window win,
1211 Ecore_X_Illume_Indicator_State state)
1212{
1213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1214 ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE,
1215 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1216 _ecore_x_e_indicator_atom_get(state),
1217 0, 0, 0, 0);
1218}
1219
1220static Ecore_X_Atom
1221_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode)
1222{
1223 switch (mode)
1224 {
1225 case ECORE_X_ILLUME_INDICATOR_OPAQUE:
1226 return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE;
1227
1228 case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT:
1229 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT;
1230
1231 case ECORE_X_ILLUME_INDICATOR_TRANSPARENT:
1232 return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT;
1233
1234 default:
1235 break;
1236 }
1237 return 0;
1238}
1239
1240static Ecore_X_Illume_Indicator_Opacity_Mode
1241_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom)
1242{
1243 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE)
1244 return ECORE_X_ILLUME_INDICATOR_OPAQUE;
1245
1246 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT)
1247 return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT;
1248
1249 if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT)
1250 return ECORE_X_ILLUME_INDICATOR_TRANSPARENT;
1251
1252 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1253}
1254
1255EAPI void
1256ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win,
1257 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1258{
1259 Ecore_X_Atom atom = 0;
1260
1261 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1262 atom = _ecore_x_e_indicator_opacity_atom_get(mode);
1263 ecore_x_window_prop_atom_set(win,
1264 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1265 &atom, 1);
1266}
1267
1268EAPI Ecore_X_Illume_Indicator_Opacity_Mode
1269ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win)
1270{
1271 Ecore_X_Atom atom;
1272
1273 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1274 if (!ecore_x_window_prop_atom_get(win,
1275 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1276 &atom, 1))
1277 return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN;
1278
1279 return _ecore_x_e_indicator_opacity_get(atom);
1280}
1281
1282EAPI void
1283ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win,
1284 Ecore_X_Illume_Indicator_Opacity_Mode mode)
1285{
1286 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1287 ecore_x_client_message32_send(win,
1288 ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE,
1289 ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
1290 _ecore_x_e_indicator_opacity_atom_get(mode),
1291 0, 0, 0, 0);
1292}
1293
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
index 9fc428a..3076c3c 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c
@@ -661,6 +661,57 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win,
661 return EINA_TRUE; 661 return EINA_TRUE;
662} 662}
663 663
664EAPI void
665ecore_x_netwm_icons_set(Ecore_X_Window win,
666 Ecore_X_Icon *icon,
667 int num)
668{
669 unsigned int *data, *p, *p2;
670 unsigned int i, size, x, y;
671
672 LOGFN(__FILE__, __LINE__, __FUNCTION__);
673 size = 0;
674 for (i = 0; i < (unsigned int)num; i++)
675 {
676 size += 2 + (icon[i].width * icon[i].height);
677 }
678 data = malloc(size * sizeof(unsigned int));
679 if (!data) return;
680 p = data;
681 for (i = 0; i < (unsigned int)num; i++)
682 {
683 p[0] = icon[i].width;
684 p[1] = icon[i].height;
685 p += 2;
686 p2 = icon[i].data;
687 for (y = 0; y < icon[i].height; y++)
688 {
689 for (x = 0; x < icon[i].width; x++)
690 {
691 unsigned int r, g, b, a;
692
693 a = (*p2 >> 24) & 0xff;
694 r = (*p2 >> 16) & 0xff;
695 g = (*p2 >> 8 ) & 0xff;
696 b = (*p2 ) & 0xff;
697 if ((a > 0) && (a < 255))
698 {
699 // unpremul
700 r = (r * 255) / a;
701 g = (g * 255) / a;
702 b = (b * 255) / a;
703 }
704 *p = (a << 24) | (r << 16) | (g << 8) | b;
705 p++;
706 p2++;
707 }
708 }
709 }
710 ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON,
711 data, size);
712 free(data);
713}
714
664EAPI Eina_Bool 715EAPI Eina_Bool
665ecore_x_netwm_icons_get(Ecore_X_Window win, 716ecore_x_netwm_icons_get(Ecore_X_Window win,
666 Ecore_X_Icon **icon, 717 Ecore_X_Icon **icon,
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
index 38218a5..ec23b3c 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c
@@ -347,9 +347,9 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root,
347 ret[i]->vSyncStart = res->modes[i].vSyncStart; 347 ret[i]->vSyncStart = res->modes[i].vSyncStart;
348 ret[i]->vSyncEnd = res->modes[i].vSyncEnd; 348 ret[i]->vSyncEnd = res->modes[i].vSyncEnd;
349 ret[i]->vTotal = res->modes[i].vTotal; 349 ret[i]->vTotal = res->modes[i].vTotal;
350 if ((ret[i]->name = (malloc(res->modes[i].nameLength)))) 350 if ((ret[i]->name = (malloc(res->modes[i].nameLength + 1))))
351 strncpy(ret[i]->name, res->modes[i].name, 351 strncpy(ret[i]->name, res->modes[i].name,
352 res->modes[i].nameLength); 352 (res->modes[i].nameLength + 1));
353 else 353 else
354 ret[i]->name = NULL; 354 ret[i]->name = NULL;
355 355
@@ -380,6 +380,48 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root,
380} 380}
381 381
382/* 382/*
383 * @brief add a mode to a display
384 * @param root window to which's screen's ressources are added
385 * @param mode_info
386 * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode
387 * adding failed.
388 * @since 1.2.0
389 */
390EAPI Ecore_X_Randr_Mode
391ecore_x_randr_mode_info_add(Ecore_X_Window root,
392 Ecore_X_Randr_Mode_Info *mode_info)
393{
394#ifdef ECORE_XRANDR
395 RANDR_CHECK_1_2_RET(EINA_FALSE);
396 Ecore_X_Randr_Mode mode = Ecore_X_Randr_None;
397
398 if (_ecore_x_randr_root_validate(root) && mode_info)
399 mode = XRRCreateMode(_ecore_x_disp, root, (XRRModeInfo*)mode_info);
400
401 return mode;
402#else
403 return Ecore_X_Randr_None;
404#endif
405}
406
407/*
408 * @brief delete a mode from the display
409 * @param mode_info
410 * @since 1.2.0
411 */
412EAPI void
413ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode)
414{
415#ifdef ECORE_XRANDR
416 RANDR_CHECK_1_2_RET();
417
418 XRRDestroyMode(_ecore_x_disp, mode);
419#else
420 return;
421#endif
422}
423
424/*
383 * @brief get detailed information for a given mode id 425 * @brief get detailed information for a given mode id
384 * @param root window which's screen's ressources are queried 426 * @param root window which's screen's ressources are queried
385 * @param mode the XID which identifies the mode of interest 427 * @param mode the XID which identifies the mode of interest
@@ -491,6 +533,83 @@ ecore_x_randr_crtcs_get(Ecore_X_Window root,
491#endif 533#endif
492} 534}
493 535
536/*
537 * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead.
538 * @brief get the CRTCs, which display a certain window
539 * @param window window the displaying crtcs shall be found for
540 * @param num the number of crtcs displaying the window
541 * @return array of crtcs that display a certain window. NULL if no crtcs
542 * was found that displays the specified window.
543 */
544EAPI Ecore_X_Randr_Crtc *
545ecore_x_randr_current_crtc_get(Ecore_X_Window window,
546 int *num)
547{
548 return ecore_x_randr_window_crtcs_get(window, num);
549}
550
551/*
552 * @brief get the CRTCs, which display a certain window
553 * @param window window the displaying crtcs shall be found for
554 * @param num the number of crtcs displaying the window
555 * @return array of crtcs that display a certain window. NULL if no crtcs
556 * was found that displays the specified window.
557 * @since 1.2.0
558 */
559EAPI Ecore_X_Randr_Crtc *
560ecore_x_randr_window_crtcs_get(Ecore_X_Window window,
561 int *num)
562{
563#ifdef ECORE_XRANDR
564 Ecore_X_Window root;
565 Eina_Rectangle w_geo, c_geo;
566 Ecore_X_Randr_Crtc *crtcs;
567 Ecore_X_Randr_Mode mode;
568 Ecore_X_Randr_Output *ret = NULL;
569 Window tw;
570 int ncrtcs, i, nret = 0, rx = 0, ry = 0;
571
572 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_window_crtcs_get_fail;
573
574 ecore_x_window_geometry_get(window,
575 &w_geo.x, &w_geo.y,
576 &w_geo.w, &w_geo.h);
577
578 root = ecore_x_window_root_get(window);
579 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
580 if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail;
581
582 /* now get window RELATIVE to root window - thats what matters. */
583 XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw);
584 w_geo.x = rx;
585 w_geo.y = ry;
586
587 for (i = 0, nret = 0; i < ncrtcs; i++)
588 {
589 /* if crtc is not enabled, don't bother about it any further */
590 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
591 if (mode == Ecore_X_Randr_None) continue;
592
593 ecore_x_randr_crtc_geometry_get(root, crtcs[i],
594 &c_geo.x, &c_geo.y,
595 &c_geo.w, &c_geo.h);
596 if (eina_rectangles_intersect(&w_geo, &c_geo))
597 {
598 ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret));
599 ret[nret] = crtcs[i];
600 }
601 }
602 free(crtcs);
603
604 if (num) *num = nret;
605 return ret;
606
607_ecore_x_randr_window_crtcs_get_fail:
608#endif
609 if (num) *num = 0;
610 return NULL;
611}
612
494EAPI Ecore_X_Randr_Output * 613EAPI Ecore_X_Randr_Output *
495ecore_x_randr_outputs_get(Ecore_X_Window root, 614ecore_x_randr_outputs_get(Ecore_X_Window root,
496 int *num) 615 int *num)
@@ -1364,6 +1483,54 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root,
1364#endif 1483#endif
1365} 1484}
1366 1485
1486/*
1487 * @brief add given mode to given output
1488 * @param output the output the mode is added to
1489 * @param mode the mode added to the output
1490 * @return EINA_FALSE if output or mode equal Ecore_X_Randr_None, else EINA_TRUE
1491 * Additionally, if xcb backend is used, the success of the addition is reported
1492 * back directly.
1493 * @since 1.2.0
1494 */
1495EAPI Eina_Bool
1496ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output,
1497 Ecore_X_Randr_Mode mode)
1498{
1499#ifdef ECORE_XRANDR
1500 RANDR_CHECK_1_2_RET(EINA_FALSE);
1501
1502 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
1503 return EINA_FALSE;
1504
1505 XRRAddOutputMode(_ecore_x_disp, output, mode);
1506 return EINA_TRUE;
1507#else
1508 return EINA_FALSE;
1509#endif
1510}
1511
1512/*
1513 * @brief delete given mode from given output
1514 * @param output the output the mode is removed from
1515 * @param mode the mode removed from the output
1516 * @since 1.2.0
1517 */
1518EAPI void
1519ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output,
1520 Ecore_X_Randr_Mode mode)
1521{
1522#ifdef ECORE_XRANDR
1523 RANDR_CHECK_1_2_RET();
1524
1525 if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None))
1526 return;
1527
1528 XRRDeleteOutputMode(_ecore_x_disp, output, mode);
1529#else
1530 return;
1531#endif
1532}
1533
1367EAPI Ecore_X_Randr_Mode * 1534EAPI Ecore_X_Randr_Mode *
1368ecore_x_randr_output_modes_get(Ecore_X_Window root, 1535ecore_x_randr_output_modes_get(Ecore_X_Window root,
1369 Ecore_X_Randr_Output output, 1536 Ecore_X_Randr_Output output,
@@ -2136,70 +2303,39 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window,
2136{ 2303{
2137#ifdef ECORE_XRANDR 2304#ifdef ECORE_XRANDR
2138 Ecore_X_Window root; 2305 Ecore_X_Window root;
2139 Eina_Rectangle w_geo, c_geo;
2140 Ecore_X_Randr_Crtc *crtcs; 2306 Ecore_X_Randr_Crtc *crtcs;
2141 Ecore_X_Randr_Mode mode; 2307 Ecore_X_Randr_Output *outputs, *ret = NULL;
2142 Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; 2308 int ncrtcs, noutputs, i, nret = 0;
2143 Window tw;
2144 int ncrtcs, noutputs, i, nret = 0, rx = 0, ry = 0;
2145 2309
2146 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; 2310 if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
2147 2311
2148 ecore_x_window_geometry_get(window,
2149 &w_geo.x, &w_geo.y,
2150 &w_geo.w, &w_geo.h);
2151
2152 root = ecore_x_window_root_get(window); 2312 root = ecore_x_window_root_get(window);
2153 crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); 2313 if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
2154 if (!crtcs) goto _ecore_x_randr_current_output_get_fail; 2314 goto _ecore_x_randr_current_output_get_fail;
2155
2156 /* now get window RELATIVE to root window - thats what matters. */
2157 XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw);
2158 w_geo.x = rx;
2159 w_geo.y = ry;
2160 2315
2161 for (i = 0; i < ncrtcs; i++) 2316 for (i = 0, nret = 0; i < ncrtcs; i++)
2162 { 2317 {
2163 /* if crtc is not enabled, don't bother about it any further */
2164 mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]);
2165 if (mode == Ecore_X_Randr_None) continue;
2166 2318
2167 ecore_x_randr_crtc_geometry_get(root, crtcs[i], 2319 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
2168 &c_geo.x, &c_geo.y, 2320 &noutputs);
2169 &c_geo.w, &c_geo.h); 2321 if (!outputs)
2170 if (eina_rectangles_intersect(&w_geo, &c_geo)) 2322 goto _ecore_x_randr_current_output_get_fail_free;
2171 { 2323 nret += noutputs;
2172 outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], 2324 ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
2173 &noutputs); 2325 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2174 /* The case below should be impossible, but for safety reasons 2326 free(outputs);
2175 * remains */
2176 if (!outputs)
2177 {
2178 if (num) *num = 0;
2179 free(ret);
2180 free(crtcs);
2181 return NULL;
2182 }
2183 tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
2184 if (!tret)
2185 {
2186 if (num) *num = 0;
2187 free(outputs);
2188 free(ret);
2189 free(crtcs);
2190 return NULL;
2191 }
2192 ret = tret;
2193 memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
2194 nret += noutputs;
2195 free(outputs);
2196 }
2197 } 2327 }
2198 free(crtcs); 2328 free(crtcs);
2199 2329
2200 if (num) *num = nret; 2330 if (num)
2331 *num = nret;
2332
2201 return ret; 2333 return ret;
2202 2334
2335_ecore_x_randr_current_output_get_fail_free:
2336 free(outputs);
2337 free(crtcs);
2338 free(ret);
2203_ecore_x_randr_current_output_get_fail: 2339_ecore_x_randr_current_output_get_fail:
2204#endif 2340#endif
2205 if (num) *num = 0; 2341 if (num) *num = 0;
@@ -2207,7 +2343,7 @@ _ecore_x_randr_current_output_get_fail:
2207} 2343}
2208 2344
2209/* 2345/*
2210 * @depricated bad naming. Use ecore_x_randr_window_outputs_get instead. 2346 * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead.
2211 * @brief get the outputs, which display a certain window 2347 * @brief get the outputs, which display a certain window
2212 * @param window window the displaying outputs shall be found for 2348 * @param window window the displaying outputs shall be found for
2213 * @param num the number of outputs displaying the window 2349 * @param num the number of outputs displaying the window
@@ -2215,7 +2351,7 @@ _ecore_x_randr_current_output_get_fail:
2215 * was found that displays the specified window. 2351 * was found that displays the specified window.
2216 */ 2352 */
2217 2353
2218EINA_DEPRECATED EAPI Ecore_X_Randr_Output * 2354EAPI Ecore_X_Randr_Output *
2219ecore_x_randr_current_output_get(Ecore_X_Window window, 2355ecore_x_randr_current_output_get(Ecore_X_Window window,
2220 int *num) 2356 int *num)
2221{ 2357{
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
index c8c04e4..23eea10 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c
@@ -153,3 +153,15 @@ ecore_x_keysym_string_get(int keysym)
153 return XKeysymToString(keysym); 153 return XKeysymToString(keysym);
154} 154}
155 155
156EAPI int
157ecore_x_keysym_keycode_get(const char *keyname)
158{
159 int keycode = 0;
160
161 if (!strncmp(keyname, "Keycode-", 8))
162 keycode = atoi(keyname + 8);
163 else
164 keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname));
165
166 return keycode;
167}
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
index 1adb36b..90392bf 100644
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
+++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c
@@ -224,7 +224,7 @@ ecore_x_window_input_new(Ecore_X_Window parent,
224 * @c _NET_WM_PID. 224 * @c _NET_WM_PID.
225 * 225 *
226 * @param win The given window. 226 * @param win The given window.
227 * @ingroup Ecore_X_Window_Properties_Groups 227 * @ingroup Ecore_X_Window_Properties_Group
228 */ 228 */
229EAPI void 229EAPI void
230ecore_x_window_defaults_set(Ecore_X_Window win) 230ecore_x_window_defaults_set(Ecore_X_Window win)
@@ -597,7 +597,7 @@ ecore_x_window_focus_at_time(Ecore_X_Window win,
597} 597}
598 598
599/** 599/**
600 * gets the focus to the window @p win. 600 * gets the window that has focus.
601 * @return The window that has focus. 601 * @return The window that has focus.
602 * @ingroup Ecore_X_Window_Focus_Functions 602 * @ingroup Ecore_X_Window_Focus_Functions
603 */ 603 */
diff --git a/libraries/ecore/src/modules/Makefile.in b/libraries/ecore/src/modules/Makefile.in
index 4bb9420..e2cf44a 100644
--- a/libraries/ecore/src/modules/Makefile.in
+++ b/libraries/ecore/src/modules/Makefile.in
@@ -47,16 +47,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
47 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 47 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
48 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 48 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
49 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 49 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
50 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 50 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
51 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 51 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
52 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 52 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
53 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 53 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
54 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 54 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
55 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 55 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
56 $(top_srcdir)/configure.ac
57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 56am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
58 $(ACLOCAL_M4) 57 $(ACLOCAL_M4)
59mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 58mkinstalldirs = $(install_sh) -d
60CONFIG_HEADER = $(top_builddir)/config.h 59CONFIG_HEADER = $(top_builddir)/config.h
61CONFIG_CLEAN_FILES = 60CONFIG_CLEAN_FILES =
62CONFIG_CLEAN_VPATH_FILES = 61CONFIG_CLEAN_VPATH_FILES =
@@ -172,6 +171,8 @@ EVAS_LIBS = @EVAS_LIBS@
172EVIL_CFLAGS = @EVIL_CFLAGS@ 171EVIL_CFLAGS = @EVIL_CFLAGS@
173EVIL_LIBS = @EVIL_LIBS@ 172EVIL_LIBS = @EVIL_LIBS@
174EXEEXT = @EXEEXT@ 173EXEEXT = @EXEEXT@
174EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
175EXOTIC_LIBS = @EXOTIC_LIBS@
175FGREP = @FGREP@ 176FGREP = @FGREP@
176GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 177GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
177GLIB_CFLAGS = @GLIB_CFLAGS@ 178GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -227,6 +228,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
227PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 228PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
228PIXMAN_LIBS = @PIXMAN_LIBS@ 229PIXMAN_LIBS = @PIXMAN_LIBS@
229PKG_CONFIG = @PKG_CONFIG@ 230PKG_CONFIG = @PKG_CONFIG@
231PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
232PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
230POSUB = @POSUB@ 233POSUB = @POSUB@
231RANLIB = @RANLIB@ 234RANLIB = @RANLIB@
232SCIM_CFLAGS = @SCIM_CFLAGS@ 235SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -237,6 +240,7 @@ SDL_LIBS = @SDL_LIBS@
237SED = @SED@ 240SED = @SED@
238SET_MAKE = @SET_MAKE@ 241SET_MAKE = @SET_MAKE@
239SHELL = @SHELL@ 242SHELL = @SHELL@
243SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
240SSL_CFLAGS = @SSL_CFLAGS@ 244SSL_CFLAGS = @SSL_CFLAGS@
241SSL_LIBS = @SSL_LIBS@ 245SSL_LIBS = @SSL_LIBS@
242STRIP = @STRIP@ 246STRIP = @STRIP@
diff --git a/libraries/ecore/src/modules/immodules/Makefile.in b/libraries/ecore/src/modules/immodules/Makefile.in
index e65881c..5dacbed 100644
--- a/libraries/ecore/src/modules/immodules/Makefile.in
+++ b/libraries/ecore/src/modules/immodules/Makefile.in
@@ -49,16 +49,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
52 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 52 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
53 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 53 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
54 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 54 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
55 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 55 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
56 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 56 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
57 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 57 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
58 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4) 59 $(ACLOCAL_M4)
61mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 60mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h 61CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES = 62CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES = 63CONFIG_CLEAN_VPATH_FILES =
@@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@
174EVIL_CFLAGS = @EVIL_CFLAGS@ 173EVIL_CFLAGS = @EVIL_CFLAGS@
175EVIL_LIBS = @EVIL_LIBS@ 174EVIL_LIBS = @EVIL_LIBS@
176EXEEXT = @EXEEXT@ 175EXEEXT = @EXEEXT@
176EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
177EXOTIC_LIBS = @EXOTIC_LIBS@
177FGREP = @FGREP@ 178FGREP = @FGREP@
178GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 179GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
179GLIB_CFLAGS = @GLIB_CFLAGS@ 180GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
229PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 230PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
230PIXMAN_LIBS = @PIXMAN_LIBS@ 231PIXMAN_LIBS = @PIXMAN_LIBS@
231PKG_CONFIG = @PKG_CONFIG@ 232PKG_CONFIG = @PKG_CONFIG@
233PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
234PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
232POSUB = @POSUB@ 235POSUB = @POSUB@
233RANLIB = @RANLIB@ 236RANLIB = @RANLIB@
234SCIM_CFLAGS = @SCIM_CFLAGS@ 237SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@
239SED = @SED@ 242SED = @SED@
240SET_MAKE = @SET_MAKE@ 243SET_MAKE = @SET_MAKE@
241SHELL = @SHELL@ 244SHELL = @SHELL@
245SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
242SSL_CFLAGS = @SSL_CFLAGS@ 246SSL_CFLAGS = @SSL_CFLAGS@
243SSL_LIBS = @SSL_LIBS@ 247SSL_LIBS = @SSL_LIBS@
244STRIP = @STRIP@ 248STRIP = @STRIP@
diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.in b/libraries/ecore/src/modules/immodules/scim/Makefile.in
index 9fc3283..ae6fc7d 100644
--- a/libraries/ecore/src/modules/immodules/scim/Makefile.in
+++ b/libraries/ecore/src/modules/immodules/scim/Makefile.in
@@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4) 58 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 59mkinstalldirs = $(install_sh) -d
61CONFIG_HEADER = $(top_builddir)/config.h 60CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES = 61CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES = 62CONFIG_CLEAN_VPATH_FILES =
@@ -205,6 +204,8 @@ EVAS_LIBS = @EVAS_LIBS@
205EVIL_CFLAGS = @EVIL_CFLAGS@ 204EVIL_CFLAGS = @EVIL_CFLAGS@
206EVIL_LIBS = @EVIL_LIBS@ 205EVIL_LIBS = @EVIL_LIBS@
207EXEEXT = @EXEEXT@ 206EXEEXT = @EXEEXT@
207EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
208EXOTIC_LIBS = @EXOTIC_LIBS@
208FGREP = @FGREP@ 209FGREP = @FGREP@
209GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 210GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
210GLIB_CFLAGS = @GLIB_CFLAGS@ 211GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -260,6 +261,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
260PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 261PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
261PIXMAN_LIBS = @PIXMAN_LIBS@ 262PIXMAN_LIBS = @PIXMAN_LIBS@
262PKG_CONFIG = @PKG_CONFIG@ 263PKG_CONFIG = @PKG_CONFIG@
264PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
265PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
263POSUB = @POSUB@ 266POSUB = @POSUB@
264RANLIB = @RANLIB@ 267RANLIB = @RANLIB@
265SCIM_CFLAGS = @SCIM_CFLAGS@ 268SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -270,6 +273,7 @@ SDL_LIBS = @SDL_LIBS@
270SED = @SED@ 273SED = @SED@
271SET_MAKE = @SET_MAKE@ 274SET_MAKE = @SET_MAKE@
272SHELL = @SHELL@ 275SHELL = @SHELL@
276SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
273SSL_CFLAGS = @SSL_CFLAGS@ 277SSL_CFLAGS = @SSL_CFLAGS@
274SSL_LIBS = @SSL_LIBS@ 278SSL_LIBS = @SSL_LIBS@
275STRIP = @STRIP@ 279STRIP = @STRIP@
diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp
index 6cb72c2..eb9b5c9 100644
--- a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp
+++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp
@@ -223,18 +223,18 @@ static int __current_super_mask = 0;
223static int __current_hyper_mask = 0; 223static int __current_hyper_mask = 0;
224static int __current_numlock_mask = Mod2Mask; 224static int __current_numlock_mask = Mod2Mask;
225 225
226// A hack to shutdown the immodule cleanly even if im_module_exit () is not called when exiting. 226// A hack to shutdown the immodule cleanly even if im_module_exit() is not called when exiting.
227class FinalizeHandler 227class FinalizeHandler
228{ 228{
229public: 229public:
230 FinalizeHandler () 230 FinalizeHandler()
231 { 231 {
232 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler ()\n"; 232 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler()\n";
233 } 233 }
234 ~FinalizeHandler () 234 ~FinalizeHandler()
235 { 235 {
236 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler ()\n"; 236 SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler()\n";
237 isf_imf_context_shutdown (); 237 isf_imf_context_shutdown();
238 } 238 }
239}; 239};
240 240
@@ -254,12 +254,12 @@ utf8_offset_to_index(const char *str, int offset)
254} 254}
255 255
256static unsigned int 256static unsigned int
257get_time (void) 257get_time(void)
258{ 258{
259 unsigned int tint; 259 unsigned int tint;
260 struct timeval tv; 260 struct timeval tv;
261 struct timezone tz; /* is not used since ages */ 261 struct timezone tz; /* is not used since ages */
262 gettimeofday (&tv, &tz); 262 gettimeofday(&tv, &tz);
263 tint = tv.tv_sec * 1000; 263 tint = tv.tv_sec * 1000;
264 tint = tint / 1000 * 1000; 264 tint = tint / 1000 * 1000;
265 tint = tint + tv.tv_usec / 1000; 265 tint = tint + tv.tv_usec / 1000;
@@ -268,7 +268,7 @@ get_time (void)
268 268
269/* Function Implementations */ 269/* Function Implementations */
270static EcoreIMFContextISFImpl * 270static EcoreIMFContextISFImpl *
271new_ic_impl (EcoreIMFContextISF *parent) 271new_ic_impl(EcoreIMFContextISF *parent)
272{ 272{
273 EcoreIMFContextISFImpl *impl = NULL; 273 EcoreIMFContextISFImpl *impl = NULL;
274 274
@@ -295,7 +295,7 @@ new_ic_impl (EcoreIMFContextISF *parent)
295} 295}
296 296
297static void 297static void
298delete_ic_impl (EcoreIMFContextISFImpl *impl) 298delete_ic_impl(EcoreIMFContextISFImpl *impl)
299{ 299{
300 EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0; 300 EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0;
301 301
@@ -312,10 +312,10 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl)
312 _free_ic_impl_list = rec; 312 _free_ic_impl_list = rec;
313 313
314 rec->parent = 0; 314 rec->parent = 0;
315 rec->si.reset (); 315 rec->si.reset();
316 rec->client_window = 0; 316 rec->client_window = 0;
317 rec->preedit_string = WideString (); 317 rec->preedit_string = WideString();
318 rec->preedit_attrlist.clear (); 318 rec->preedit_attrlist.clear();
319 319
320 return; 320 return;
321 } 321 }
@@ -323,7 +323,7 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl)
323} 323}
324 324
325static void 325static void
326delete_all_ic_impl (void) 326delete_all_ic_impl(void)
327{ 327{
328 EcoreIMFContextISFImpl *it = _used_ic_impl_list; 328 EcoreIMFContextISFImpl *it = _used_ic_impl_list;
329 329
@@ -344,7 +344,7 @@ delete_all_ic_impl (void)
344} 344}
345 345
346static EcoreIMFContextISF * 346static EcoreIMFContextISF *
347find_ic (int id) 347find_ic(int id)
348{ 348{
349 EcoreIMFContextISFImpl *rec = _used_ic_impl_list; 349 EcoreIMFContextISFImpl *rec = _used_ic_impl_list;
350 350
@@ -363,17 +363,18 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
363{ 363{
364 char *plain_str = NULL; 364 char *plain_str = NULL;
365 char *markup_str = NULL; 365 char *markup_str = NULL;
366 const char *puncs[3] = {". ", "! ", "? "}; 366 const char *puncs[] = {". ", "! ", "? "};
367 Eina_Bool ret = EINA_FALSE; 367 Eina_Bool ret = EINA_FALSE;
368 int cursor_pos = 0; 368 int cursor_pos = 0;
369 int i = 0; 369 int i = 0;
370 Eina_Unicode *tail = NULL; 370 Eina_Unicode *tail = NULL;
371 Eina_Unicode *ustr = NULL; 371 Eina_Unicode *ustr = NULL;
372 Eina_Unicode *uni_puncs[3]; 372 const int punc_num = sizeof(puncs) / sizeof(puncs[0]);
373 Eina_Unicode *uni_puncs[punc_num];
373 EcoreIMFContextISF *context_scim; 374 EcoreIMFContextISF *context_scim;
374 375
375 if (!ctx) return EINA_FALSE; 376 if (!ctx) return EINA_FALSE;
376 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 377 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
377 if (!context_scim || !context_scim->impl) return EINA_FALSE; 378 if (!context_scim || !context_scim->impl) return EINA_FALSE;
378 379
379 switch (context_scim->impl->autocapital_type) 380 switch (context_scim->impl->autocapital_type)
@@ -386,7 +387,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
386 break; 387 break;
387 } 388 }
388 389
389 for (i=0; i<3; i++) 390 for (i = 0; i < punc_num; i++)
390 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL); 391 uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL);
391 392
392 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos); 393 ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos);
@@ -432,7 +433,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx)
432 433
433 if (tail) 434 if (tail)
434 { 435 {
435 for (i=0; i<3; i++) 436 for (i = 0; i < punc_num; i++)
436 { 437 {
437 if (!eina_unicode_strcmp(tail, uni_puncs[i])) 438 if (!eina_unicode_strcmp(tail, uni_puncs[i]))
438 { 439 {
@@ -450,7 +451,7 @@ done:
450 if (markup_str) free(markup_str); 451 if (markup_str) free(markup_str);
451 if (plain_str) free(plain_str); 452 if (plain_str) free(plain_str);
452 453
453 for (i=0; i<3; i++) 454 for (i = 0; i < punc_num; i++)
454 if (uni_puncs[i]) free(uni_puncs[i]); 455 if (uni_puncs[i]) free(uni_puncs[i]);
455 456
456 return ret; 457 return ret;
@@ -463,7 +464,7 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force)
463 EcoreIMFContextISF *context_scim; 464 EcoreIMFContextISF *context_scim;
464 465
465 if (!ctx) return; 466 if (!ctx) return;
466 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 467 context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
467 468
468 if (autocap_allow == EINA_FALSE) 469 if (autocap_allow == EINA_FALSE)
469 return; 470 return;
@@ -485,28 +486,52 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force)
485} 486}
486 487
487static void 488static void
488feed_key_event (Evas *evas, const char *str, Eina_Bool fake) 489feed_key_event(Evas *evas, const char *str, Eina_Bool fake)
489{ 490{
490 char key_string[128] = {0}; 491 char key_string[128] = {0};
491 unsigned int timestamp = 0; 492 unsigned int timestamp = 0;
492 493
493 if (!fake) 494 if (!fake)
494 timestamp = get_time (); 495 timestamp = get_time();
495 496
496 if (strncmp (str, "KeyRelease+", 11) == 0) 497 if (strncmp(str, "KeyRelease+", 11) == 0)
497 { 498 {
498 strncpy(key_string, str + 11, strlen(str)-11); 499 strncpy(key_string, str + 11, strlen(str)-11);
499 evas_event_feed_key_up (evas, key_string, key_string, NULL, NULL, timestamp, NULL); 500 evas_event_feed_key_up(evas, key_string, key_string, NULL, NULL, timestamp, NULL);
500 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up ()...\n"; 501 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up()...\n";
501 } 502 }
502 else 503 else
503 { 504 {
504 strncpy(key_string, str, strlen(str)); 505 strncpy(key_string, str, strlen(str));
505 evas_event_feed_key_down (evas, key_string, key_string, NULL, NULL, timestamp, NULL); 506 evas_event_feed_key_down(evas, key_string, key_string, NULL, NULL, timestamp, NULL);
506 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down ()...\n"; 507 SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down()...\n";
507 } 508 }
508} 509}
509 510
511static void
512window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y)
513{
514 Ecore_X_Window root_window, win;
515 int win_x, win_y;
516 int sum_x = 0, sum_y = 0;
517
518 root_window = ecore_x_window_root_get(client_win);
519 win = client_win;
520
521 while (root_window != win)
522 {
523 ecore_x_window_geometry_get(win, &win_x, &win_y, NULL, NULL);
524 sum_x += win_x;
525 sum_y += win_y;
526 win = ecore_x_window_parent_get(win);
527 }
528
529 if (x)
530 *x = sum_x;
531 if (y)
532 *y = sum_y;
533}
534
510/* Public functions */ 535/* Public functions */
511/** 536/**
512 * isf_imf_context_new 537 * isf_imf_context_new
@@ -517,18 +542,11 @@ feed_key_event (Evas *evas, const char *str, Eina_Bool fake)
517 * Return value: A pointer to the newly created EcoreIMFContextISF instance 542 * Return value: A pointer to the newly created EcoreIMFContextISF instance
518 */ 543 */
519EAPI EcoreIMFContextISF * 544EAPI EcoreIMFContextISF *
520isf_imf_context_new (void) 545isf_imf_context_new(void)
521{ 546{
522 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 547 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
523 char *env; 548 char *env;
524 549
525 Ecore_X_Display *display = ecore_x_display_get ();
526 if (!display)
527 {
528 std::cerr << "ecore_x_display_get () failed !!!";
529 return NULL;
530 }
531
532 EcoreIMFContextISF *context_scim = new EcoreIMFContextISF; 550 EcoreIMFContextISF *context_scim = new EcoreIMFContextISF;
533 if (context_scim == NULL) 551 if (context_scim == NULL)
534 { 552 {
@@ -540,7 +558,7 @@ isf_imf_context_new (void)
540 558
541 if (!_scim_initialized) 559 if (!_scim_initialized)
542 { 560 {
543 initialize (); 561 initialize();
544 _scim_initialized = true; 562 _scim_initialized = true;
545 } 563 }
546 564
@@ -558,61 +576,61 @@ isf_imf_context_new (void)
558 * cleanup job. 576 * cleanup job.
559 */ 577 */
560EAPI void 578EAPI void
561isf_imf_context_shutdown (void) 579isf_imf_context_shutdown(void)
562{ 580{
563 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 581 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
564 582
565 if (_scim_initialized) 583 if (_scim_initialized)
566 { 584 {
567 _scim_initialized = false; 585 _scim_initialized = false;
568 finalize (); 586 finalize();
569 } 587 }
570} 588}
571 589
572EAPI void 590EAPI void
573isf_imf_context_add (Ecore_IMF_Context *ctx) 591isf_imf_context_add(Ecore_IMF_Context *ctx)
574{ 592{
575 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 593 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
576 594
577 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 595 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
578 596
579 if (!context_scim) return; 597 if (!context_scim) return;
580 598
581 context_scim->impl = NULL; 599 context_scim->impl = NULL;
582 600
583 if (_backend.null ()) 601 if (_backend.null())
584 return; 602 return;
585 603
586 IMEngineInstancePointer si; 604 IMEngineInstancePointer si;
587 605
588 // Use the default instance if "shared input method" mode is enabled. 606 // Use the default instance if "shared input method" mode is enabled.
589 if (_shared_input_method && !_default_instance.null ()) 607 if (_shared_input_method && !_default_instance.null())
590 { 608 {
591 si = _default_instance; 609 si = _default_instance;
592 SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; 610 SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n";
593 } 611 }
594 612
595 // Not in "shared input method" mode, or no default instance, create an instance. 613 // Not in "shared input method" mode, or no default instance, create an instance.
596 if (si.null ()) 614 if (si.null())
597 { 615 {
598 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); 616 IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
599 if (factory.null ()) return; 617 if (factory.null()) return;
600 si = factory->create_instance ("UTF-8", _instance_count++); 618 si = factory->create_instance("UTF-8", _instance_count++);
601 if (si.null ()) return; 619 if (si.null()) return;
602 attach_instance (si); 620 attach_instance(si);
603 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; 621 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n";
604 } 622 }
605 623
606 // If "shared input method" mode is enabled, and there is no default instance, 624 // If "shared input method" mode is enabled, and there is no default instance,
607 // then store this instance as default one. 625 // then store this instance as default one.
608 if (_shared_input_method && _default_instance.null ()) 626 if (_shared_input_method && _default_instance.null())
609 { 627 {
610 SCIM_DEBUG_FRONTEND(2) << "update default instance.\n"; 628 SCIM_DEBUG_FRONTEND(2) << "update default instance.\n";
611 _default_instance = si; 629 _default_instance = si;
612 } 630 }
613 631
614 context_scim->ctx = ctx; 632 context_scim->ctx = ctx;
615 context_scim->impl = new_ic_impl (context_scim); 633 context_scim->impl = new_ic_impl(context_scim);
616 if (context_scim->impl == NULL) 634 if (context_scim->impl == NULL)
617 { 635 {
618 std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n"; 636 std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n";
@@ -640,24 +658,24 @@ isf_imf_context_add (Ecore_IMF_Context *ctx)
640 _ic_list = context_scim; 658 _ic_list = context_scim;
641 659
642 if (_shared_input_method) 660 if (_shared_input_method)
643 context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); 661 context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
644 662
645 _panel_client.prepare (context_scim->id); 663 _panel_client.prepare(context_scim->id);
646 _panel_client.register_input_context (context_scim->id, si->get_factory_uuid ()); 664 _panel_client.register_input_context(context_scim->id, si->get_factory_uuid());
647 set_ic_capabilities (context_scim); 665 set_ic_capabilities(context_scim);
648 _panel_client.send (); 666 _panel_client.send();
649 667
650 SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n"; 668 SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n";
651} 669}
652 670
653EAPI void 671EAPI void
654isf_imf_context_del (Ecore_IMF_Context *ctx) 672isf_imf_context_del(Ecore_IMF_Context *ctx)
655{ 673{
656 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 674 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
657 675
658 if (!_ic_list) return; 676 if (!_ic_list) return;
659 677
660 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 678 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
661 679
662 if (context_scim) 680 if (context_scim)
663 { 681 {
@@ -682,32 +700,32 @@ isf_imf_context_del (Ecore_IMF_Context *ctx)
682 700
683 if (context_scim && context_scim->impl) 701 if (context_scim && context_scim->impl)
684 { 702 {
685 _panel_client.prepare (context_scim->id); 703 _panel_client.prepare(context_scim->id);
686 704
687 if (context_scim == _focused_ic) 705 if (context_scim == _focused_ic)
688 context_scim->impl->si->focus_out (); 706 context_scim->impl->si->focus_out();
689 707
690 // Delete the instance. 708 // Delete the instance.
691 EcoreIMFContextISF *old_focused = _focused_ic; 709 EcoreIMFContextISF *old_focused = _focused_ic;
692 _focused_ic = context_scim; 710 _focused_ic = context_scim;
693 context_scim->impl->si.reset (); 711 context_scim->impl->si.reset();
694 _focused_ic = old_focused; 712 _focused_ic = old_focused;
695 713
696 if (context_scim == _focused_ic) 714 if (context_scim == _focused_ic)
697 { 715 {
698 _panel_client.turn_off (context_scim->id); 716 _panel_client.turn_off(context_scim->id);
699 _panel_client.focus_out (context_scim->id); 717 _panel_client.focus_out(context_scim->id);
700 } 718 }
701 719
702 _panel_client.remove_input_context (context_scim->id); 720 _panel_client.remove_input_context(context_scim->id);
703 _panel_client.send (); 721 _panel_client.send();
704 722
705 if (context_scim->impl->client_window) 723 if (context_scim->impl->client_window)
706 isf_imf_context_client_window_set (ctx, NULL); 724 isf_imf_context_client_window_set(ctx, NULL);
707 725
708 if (context_scim->impl) 726 if (context_scim->impl)
709 { 727 {
710 delete_ic_impl (context_scim->impl); 728 delete_ic_impl(context_scim->impl);
711 context_scim->impl = 0; 729 context_scim->impl = 0;
712 } 730 }
713 } 731 }
@@ -738,11 +756,11 @@ isf_imf_context_del (Ecore_IMF_Context *ctx)
738 * be used for purposes internal to the Input Method Context. 756 * be used for purposes internal to the Input Method Context.
739 */ 757 */
740EAPI void 758EAPI void
741isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas) 759isf_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas)
742{ 760{
743 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 761 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
744 762
745 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 763 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
746 764
747 if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas) 765 if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas)
748 context_scim->impl->client_canvas = (Evas*)canvas; 766 context_scim->impl->client_canvas = (Evas*)canvas;
@@ -762,11 +780,11 @@ isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas)
762 * and may also be used for purposes internal to the Input Method Context. 780 * and may also be used for purposes internal to the Input Method Context.
763 */ 781 */
764EAPI void 782EAPI void
765isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window) 783isf_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window)
766{ 784{
767 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 785 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
768 786
769 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 787 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
770 788
771 if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window)) 789 if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window))
772 { 790 {
@@ -789,29 +807,29 @@ isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window)
789 * to clear the preedit state. 807 * to clear the preedit state.
790 */ 808 */
791EAPI void 809EAPI void
792isf_imf_context_reset (Ecore_IMF_Context *ctx) 810isf_imf_context_reset(Ecore_IMF_Context *ctx)
793{ 811{
794 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 812 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
795 813
796 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 814 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
797 815
798 if (context_scim && context_scim->impl && context_scim == _focused_ic) 816 if (context_scim && context_scim->impl && context_scim == _focused_ic)
799 { 817 {
800 WideString wstr = context_scim->impl->preedit_string; 818 WideString wstr = context_scim->impl->preedit_string;
801 819
802 _panel_client.prepare (context_scim->id); 820 _panel_client.prepare(context_scim->id);
803 context_scim->impl->si->reset (); 821 context_scim->impl->si->reset();
804 _panel_client.send (); 822 _panel_client.send();
805 823
806 if (context_scim->impl->need_commit_preedit) 824 if (context_scim->impl->need_commit_preedit)
807 { 825 {
808 if (wstr.length ()) 826 if (wstr.length())
809 { 827 {
810 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); 828 ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str());
811 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); 829 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
812 } 830 }
813 _panel_client.prepare (context_scim->id); 831 _panel_client.prepare(context_scim->id);
814 _panel_client.send (); 832 _panel_client.send();
815 } 833 }
816 } 834 }
817} 835}
@@ -825,9 +843,9 @@ isf_imf_context_reset (Ecore_IMF_Context *ctx)
825 * Notify the Input Method Context that the widget to which its correspond has gained focus. 843 * Notify the Input Method Context that the widget to which its correspond has gained focus.
826 */ 844 */
827EAPI void 845EAPI void
828isf_imf_context_focus_in (Ecore_IMF_Context *ctx) 846isf_imf_context_focus_in(Ecore_IMF_Context *ctx)
829{ 847{
830 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 848 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
831 849
832 if (!context_scim) 850 if (!context_scim)
833 return; 851 return;
@@ -839,12 +857,11 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
839 if (_focused_ic == context_scim) 857 if (_focused_ic == context_scim)
840 { 858 {
841 SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n"; 859 SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n";
842 //isf_imf_context_cursor_position_set (ctx, 0);
843 return; 860 return;
844 } 861 }
845 SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n"; 862 SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n";
846 if (_focused_ic->ctx) 863 if (_focused_ic->ctx)
847 isf_imf_context_focus_out (_focused_ic->ctx); 864 isf_imf_context_focus_out(_focused_ic->ctx);
848 } 865 }
849 866
850 bool need_cap = false; 867 bool need_cap = false;
@@ -854,28 +871,28 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
854 if (context_scim && context_scim->impl) 871 if (context_scim && context_scim->impl)
855 { 872 {
856 _focused_ic = context_scim; 873 _focused_ic = context_scim;
857 _panel_client.prepare (context_scim->id); 874 _panel_client.prepare(context_scim->id);
858 875
859 // Handle the "Shared Input Method" mode. 876 // Handle the "Shared Input Method" mode.
860 if (_shared_input_method) 877 if (_shared_input_method)
861 { 878 {
862 SCIM_DEBUG_FRONTEND(2) << "shared input method.\n"; 879 SCIM_DEBUG_FRONTEND(2) << "shared input method.\n";
863 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); 880 IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
864 if (!factory.null ()) 881 if (!factory.null())
865 { 882 {
866 if (_default_instance.null () || _default_instance->get_factory_uuid () != factory->get_uuid ()) 883 if (_default_instance.null() || _default_instance->get_factory_uuid() != factory->get_uuid())
867 { 884 {
868 _default_instance = factory->create_instance ("UTF-8", _default_instance.null () ? _instance_count++ : _default_instance->get_id ()); 885 _default_instance = factory->create_instance("UTF-8", _default_instance.null() ? _instance_count++ : _default_instance->get_id());
869 attach_instance (_default_instance); 886 attach_instance(_default_instance);
870 SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n"; 887 SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id() << " " << _default_instance->get_factory_uuid() << "\n";
871 } 888 }
872 889
873 context_scim->impl->shared_si = true; 890 context_scim->impl->shared_si = true;
874 context_scim->impl->si = _default_instance; 891 context_scim->impl->si = _default_instance;
875 892
876 context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); 893 context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on);
877 context_scim->impl->preedit_string.clear (); 894 context_scim->impl->preedit_string.clear();
878 context_scim->impl->preedit_attrlist.clear (); 895 context_scim->impl->preedit_attrlist.clear();
879 context_scim->impl->preedit_caret = 0; 896 context_scim->impl->preedit_caret = 0;
880 context_scim->impl->preedit_started = false; 897 context_scim->impl->preedit_started = false;
881 need_cap = true; 898 need_cap = true;
@@ -886,47 +903,50 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
886 else if (context_scim->impl->shared_si) 903 else if (context_scim->impl->shared_si)
887 { 904 {
888 SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n"; 905 SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n";
889 IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); 906 IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8");
890 if (!factory.null ()) 907 if (!factory.null())
891 { 908 {
892 context_scim->impl->si = factory->create_instance ("UTF-8", _instance_count++); 909 context_scim->impl->si = factory->create_instance("UTF-8", _instance_count++);
893 context_scim->impl->preedit_string.clear (); 910 context_scim->impl->preedit_string.clear();
894 context_scim->impl->preedit_attrlist.clear (); 911 context_scim->impl->preedit_attrlist.clear();
895 context_scim->impl->preedit_caret = 0; 912 context_scim->impl->preedit_caret = 0;
896 context_scim->impl->preedit_started = false; 913 context_scim->impl->preedit_started = false;
897 attach_instance (context_scim->impl->si); 914 attach_instance(context_scim->impl->si);
898 need_cap = true; 915 need_cap = true;
899 need_reg = true; 916 need_reg = true;
900 context_scim->impl->shared_si = false; 917 context_scim->impl->shared_si = false;
901 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id () << " " << context_scim->impl->si->get_factory_uuid () << "\n"; 918 SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id() << " " << context_scim->impl->si->get_factory_uuid() << "\n";
902 } 919 }
903 } 920 }
904 921
905 context_scim->impl->si->set_frontend_data (static_cast <void*> (context_scim)); 922 context_scim->impl->si->set_frontend_data(static_cast <void*>(context_scim));
906 923
907 if (need_reg) _panel_client.register_input_context (context_scim->id, context_scim->impl->si->get_factory_uuid ()); 924 if (need_reg) _panel_client.register_input_context(context_scim->id, context_scim->impl->si->get_factory_uuid());
908 if (need_cap) set_ic_capabilities (context_scim); 925 if (need_cap) set_ic_capabilities(context_scim);
909 if (need_reset) context_scim->impl->si->reset (); 926 if (need_reset) context_scim->impl->si->reset();
910 927
911 panel_req_focus_in (context_scim); 928 panel_req_focus_in(context_scim);
912 panel_req_update_spot_location (context_scim); 929 panel_req_update_spot_location(context_scim);
913 panel_req_update_factory_info (context_scim); 930 panel_req_update_factory_info(context_scim);
914 931
915 if (context_scim->impl->is_on) 932 if (context_scim->impl->is_on)
916 { 933 {
917 _panel_client.turn_on (context_scim->id); 934 _panel_client.turn_on(context_scim->id);
918 _panel_client.hide_preedit_string (context_scim->id); 935 _panel_client.hide_preedit_string(context_scim->id);
919 _panel_client.hide_aux_string (context_scim->id); 936 _panel_client.hide_aux_string(context_scim->id);
920 _panel_client.hide_lookup_table (context_scim->id); 937 _panel_client.hide_lookup_table(context_scim->id);
921 context_scim->impl->si->focus_in (); 938 context_scim->impl->si->focus_in();
922 } 939 }
923 else 940 else
924 { 941 {
925 _panel_client.turn_off (context_scim->id); 942 _panel_client.turn_off(context_scim->id);
926 } 943 }
927 944
928 _panel_client.send (); 945 _panel_client.send();
929 } 946 }
947
948 if (ecore_imf_context_input_panel_enabled_get(ctx))
949 ecore_imf_context_input_panel_show(ctx);
930} 950}
931 951
932/** 952/**
@@ -938,9 +958,9 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx)
938 * Notify the Input Method Context that the widget to which its correspond has lost focus. 958 * Notify the Input Method Context that the widget to which its correspond has lost focus.
939 */ 959 */
940EAPI void 960EAPI void
941isf_imf_context_focus_out (Ecore_IMF_Context *ctx) 961isf_imf_context_focus_out(Ecore_IMF_Context *ctx)
942{ 962{
943 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 963 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
944 964
945 if (!context_scim) return; 965 if (!context_scim) return;
946 966
@@ -952,23 +972,26 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx)
952 972
953 if (context_scim->impl->need_commit_preedit) 973 if (context_scim->impl->need_commit_preedit)
954 { 974 {
955 if (wstr.length ()) 975 if (wstr.length())
956 { 976 {
957 ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); 977 ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str());
958 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); 978 ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
959 } 979 }
960 _panel_client.prepare (context_scim->id); 980 _panel_client.prepare(context_scim->id);
961 _panel_client.send (); 981 _panel_client.send();
962 } 982 }
963 983
964 _panel_client.prepare (context_scim->id); 984 _panel_client.prepare(context_scim->id);
965 context_scim->impl->si->focus_out (); 985 context_scim->impl->si->focus_out();
966 context_scim->impl->si->reset (); 986 context_scim->impl->si->reset();
967 _panel_client.turn_off (context_scim->id); 987 _panel_client.turn_off(context_scim->id);
968 _panel_client.focus_out (context_scim->id); 988 _panel_client.focus_out(context_scim->id);
969 _panel_client.send (); 989 _panel_client.send();
970 _focused_ic = 0; 990 _focused_ic = 0;
971 } 991 }
992
993 if (ecore_imf_context_input_panel_enabled_get(ctx))
994 ecore_imf_context_input_panel_hide(ctx);
972} 995}
973 996
974/** 997/**
@@ -984,11 +1007,11 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx)
984 * Notify the Input Method Context that a change in the cursor location has been made. 1007 * Notify the Input Method Context that a change in the cursor location has been made.
985 */ 1008 */
986EAPI void 1009EAPI void
987isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch) 1010isf_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch)
988{ 1011{
989 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1012 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
990 1013
991 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1014 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
992 Ecore_Evas *ee; 1015 Ecore_Evas *ee;
993 int canvas_x, canvas_y; 1016 int canvas_x, canvas_y;
994 1017
@@ -1001,21 +1024,28 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int
1001 if (context_scim->impl->preedit_updating) 1024 if (context_scim->impl->preedit_updating)
1002 return; 1025 return;
1003 1026
1004 if (!context_scim->impl->client_canvas) 1027 if (context_scim->impl->client_canvas)
1005 return; 1028 {
1006 1029 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
1007 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); 1030 if (!ee) return;
1008 if (!ee) return;
1009 1031
1010 ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL); 1032 ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL);
1033 }
1034 else
1035 {
1036 if (context_scim->impl->client_window)
1037 window_to_screen_geometry_get(context_scim->impl->client_window, &canvas_x, &canvas_y);
1038 else
1039 return;
1040 }
1011 1041
1012 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch) 1042 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch)
1013 { 1043 {
1014 context_scim->impl->cursor_x = canvas_x + cx; 1044 context_scim->impl->cursor_x = canvas_x + cx;
1015 context_scim->impl->cursor_y = canvas_y + cy + ch; 1045 context_scim->impl->cursor_y = canvas_y + cy + ch;
1016 _panel_client.prepare (context_scim->id); 1046 _panel_client.prepare(context_scim->id);
1017 panel_req_update_spot_location (context_scim); 1047 panel_req_update_spot_location(context_scim);
1018 _panel_client.send (); 1048 _panel_client.send();
1019 SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n"; 1049 SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n";
1020 } 1050 }
1021 } 1051 }
@@ -1033,11 +1063,11 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int
1033 * display feedback, such as displaying it in a child of the root window. 1063 * display feedback, such as displaying it in a child of the root window.
1034 */ 1064 */
1035EAPI void 1065EAPI void
1036isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit) 1066isf_imf_context_use_preedit_set(Ecore_IMF_Context* ctx, Eina_Bool use_preedit)
1037{ 1067{
1038 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n"; 1068 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n";
1039 1069
1040 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1070 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1041 1071
1042 if (!_on_the_spot) return; 1072 if (!_on_the_spot) return;
1043 1073
@@ -1047,36 +1077,36 @@ isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit)
1047 context_scim->impl->use_preedit = use_preedit; 1077 context_scim->impl->use_preedit = use_preedit;
1048 if (context_scim == _focused_ic) 1078 if (context_scim == _focused_ic)
1049 { 1079 {
1050 _panel_client.prepare (context_scim->id); 1080 _panel_client.prepare(context_scim->id);
1051 1081
1052 if (old != use_preedit) 1082 if (old != use_preedit)
1053 set_ic_capabilities (context_scim); 1083 set_ic_capabilities(context_scim);
1054 1084
1055 if (context_scim->impl->preedit_string.length ()) 1085 if (context_scim->impl->preedit_string.length())
1056 slot_show_preedit_string (context_scim->impl->si); 1086 slot_show_preedit_string(context_scim->impl->si);
1057 1087
1058 _panel_client.send (); 1088 _panel_client.send();
1059 } 1089 }
1060 } 1090 }
1061} 1091}
1062 1092
1063EAPI void 1093EAPI void
1064isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos) 1094isf_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos)
1065{ 1095{
1066 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1096 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1067 1097
1068 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1098 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1069 1099
1070 if (context_scim && context_scim->impl && context_scim->impl->is_on) 1100 if (context_scim && context_scim->impl && context_scim->impl->is_on)
1071 { 1101 {
1072 String mbs = utf8_wcstombs (context_scim->impl->preedit_string); 1102 String mbs = utf8_wcstombs(context_scim->impl->preedit_string);
1073 1103
1074 if (str) 1104 if (str)
1075 { 1105 {
1076 if (mbs.length ()) 1106 if (mbs.length())
1077 *str = strdup (mbs.c_str ()); 1107 *str = strdup(mbs.c_str());
1078 else 1108 else
1079 *str = strdup (""); 1109 *str = strdup("");
1080 } 1110 }
1081 1111
1082 if (cursor_pos) 1112 if (cursor_pos)
@@ -1086,28 +1116,28 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1086 1116
1087 if (attrs) 1117 if (attrs)
1088 { 1118 {
1089 if (mbs.length ()) 1119 if (mbs.length())
1090 { 1120 {
1091 int start_index, end_index; 1121 int start_index, end_index;
1092 int wlen = context_scim->impl->preedit_string.length (); 1122 int wlen = context_scim->impl->preedit_string.length();
1093 1123
1094 Ecore_IMF_Preedit_Attr *attr = NULL; 1124 Ecore_IMF_Preedit_Attr *attr = NULL;
1095 AttributeList::const_iterator i; 1125 AttributeList::const_iterator i;
1096 bool *attrs_flag = new bool [mbs.length ()]; 1126 bool *attrs_flag = new bool [mbs.length()];
1097 memset (attrs_flag, 0, mbs.length () *sizeof (bool)); 1127 memset(attrs_flag, 0, mbs.length() *sizeof(bool));
1098 1128
1099 for (i = context_scim->impl->preedit_attrlist.begin (); 1129 for (i = context_scim->impl->preedit_attrlist.begin();
1100 i != context_scim->impl->preedit_attrlist.end (); ++i) 1130 i != context_scim->impl->preedit_attrlist.end(); ++i)
1101 { 1131 {
1102 start_index = i->get_start (); 1132 start_index = i->get_start();
1103 end_index = i->get_end (); 1133 end_index = i->get_end();
1104 1134
1105 if (end_index <= wlen && start_index < end_index && i->get_type () != SCIM_ATTR_DECORATE_NONE) 1135 if (end_index <= wlen && start_index < end_index && i->get_type() != SCIM_ATTR_DECORATE_NONE)
1106 { 1136 {
1107 start_index = utf8_offset_to_index (mbs.c_str (), i->get_start ()); 1137 start_index = utf8_offset_to_index(mbs.c_str(), i->get_start());
1108 end_index = utf8_offset_to_index (mbs.c_str (), i->get_end ()); 1138 end_index = utf8_offset_to_index(mbs.c_str(), i->get_end());
1109 1139
1110 if (i->get_type () == SCIM_ATTR_DECORATE) 1140 if (i->get_type() == SCIM_ATTR_DECORATE)
1111 { 1141 {
1112 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); 1142 attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr));
1113 if (attr == NULL) 1143 if (attr == NULL)
@@ -1115,24 +1145,24 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1115 attr->start_index = start_index; 1145 attr->start_index = start_index;
1116 attr->end_index = end_index; 1146 attr->end_index = end_index;
1117 1147
1118 if (i->get_value () == SCIM_ATTR_DECORATE_UNDERLINE) 1148 if (i->get_value() == SCIM_ATTR_DECORATE_UNDERLINE)
1119 { 1149 {
1120 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1; 1150 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1;
1121 *attrs = eina_list_append(*attrs, (void *)attr); 1151 *attrs = eina_list_append(*attrs, (void *)attr);
1122 } 1152 }
1123 else if (i->get_value () == SCIM_ATTR_DECORATE_REVERSE) 1153 else if (i->get_value() == SCIM_ATTR_DECORATE_REVERSE)
1124 { 1154 {
1125 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; 1155 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
1126 *attrs = eina_list_append(*attrs, (void *)attr); 1156 *attrs = eina_list_append(*attrs, (void *)attr);
1127 } 1157 }
1128 else if (i->get_value () == SCIM_ATTR_DECORATE_HIGHLIGHT) 1158 else if (i->get_value() == SCIM_ATTR_DECORATE_HIGHLIGHT)
1129 { 1159 {
1130 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3; 1160 attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3;
1131 *attrs = eina_list_append(*attrs, (void *)attr); 1161 *attrs = eina_list_append(*attrs, (void *)attr);
1132 } 1162 }
1133 else 1163 else
1134 { 1164 {
1135 free (attr); 1165 free(attr);
1136 } 1166 }
1137 1167
1138 switch(i->get_value()) 1168 switch(i->get_value())
@@ -1148,11 +1178,11 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1148 break; 1178 break;
1149 } 1179 }
1150 } 1180 }
1151 else if (i->get_type () == SCIM_ATTR_FOREGROUND) 1181 else if (i->get_type() == SCIM_ATTR_FOREGROUND)
1152 { 1182 {
1153 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n"; 1183 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n";
1154 } 1184 }
1155 else if (i->get_type () == SCIM_ATTR_BACKGROUND) 1185 else if (i->get_type() == SCIM_ATTR_BACKGROUND)
1156 { 1186 {
1157 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n"; 1187 SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n";
1158 } 1188 }
@@ -1160,13 +1190,13 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1160 } 1190 }
1161 1191
1162 // Add underline for all characters which don't have attribute. 1192 // Add underline for all characters which don't have attribute.
1163 for (unsigned int pos = 0; pos < mbs.length (); ++pos) 1193 for (unsigned int pos = 0; pos < mbs.length(); ++pos)
1164 { 1194 {
1165 if (!attrs_flag [pos]) 1195 if (!attrs_flag [pos])
1166 { 1196 {
1167 int begin_pos = pos; 1197 int begin_pos = pos;
1168 1198
1169 while (pos < mbs.length () && !attrs_flag [pos]) 1199 while (pos < mbs.length() && !attrs_flag[pos])
1170 ++pos; 1200 ++pos;
1171 1201
1172 // use REVERSE style as default 1202 // use REVERSE style as default
@@ -1187,7 +1217,7 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1187 else 1217 else
1188 { 1218 {
1189 if (str) 1219 if (str)
1190 *str = strdup (""); 1220 *str = strdup("");
1191 1221
1192 if (cursor_pos) 1222 if (cursor_pos)
1193 *cursor_pos = 0; 1223 *cursor_pos = 0;
@@ -1208,22 +1238,22 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char
1208 * To get the preedit string of the input method. 1238 * To get the preedit string of the input method.
1209 */ 1239 */
1210EAPI void 1240EAPI void
1211isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos) 1241isf_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char** str, int *cursor_pos)
1212{ 1242{
1213 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1243 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1214 1244
1215 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1245 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1216 1246
1217 if (context_scim && context_scim->impl && context_scim->impl->is_on) 1247 if (context_scim && context_scim->impl && context_scim->impl->is_on)
1218 { 1248 {
1219 String mbs = utf8_wcstombs (context_scim->impl->preedit_string); 1249 String mbs = utf8_wcstombs(context_scim->impl->preedit_string);
1220 1250
1221 if (str) 1251 if (str)
1222 { 1252 {
1223 if (mbs.length ()) 1253 if (mbs.length())
1224 *str = strdup (mbs.c_str ()); 1254 *str = strdup(mbs.c_str());
1225 else 1255 else
1226 *str = strdup (""); 1256 *str = strdup("");
1227 } 1257 }
1228 1258
1229 if (cursor_pos) 1259 if (cursor_pos)
@@ -1232,7 +1262,7 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur
1232 else 1262 else
1233 { 1263 {
1234 if (str) 1264 if (str)
1235 *str = strdup (""); 1265 *str = strdup("");
1236 1266
1237 if (cursor_pos) 1267 if (cursor_pos)
1238 *cursor_pos = 0; 1268 *cursor_pos = 0;
@@ -1249,11 +1279,11 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur
1249 * Notify the Input Method Context that a change in the cursor position has been made. 1279 * Notify the Input Method Context that a change in the cursor position has been made.
1250 */ 1280 */
1251EAPI void 1281EAPI void
1252isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos) 1282isf_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos)
1253{ 1283{
1254 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1284 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1255 1285
1256 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1286 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
1257 1287
1258 if (context_scim && context_scim->impl && context_scim == _focused_ic) 1288 if (context_scim && context_scim->impl && context_scim == _focused_ic)
1259 { 1289 {
@@ -1280,11 +1310,11 @@ isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos)
1280 * is in Ecore_IMF.h. 1310 * is in Ecore_IMF.h.
1281 */ 1311 */
1282EAPI void 1312EAPI void
1283isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) 1313isf_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode)
1284{ 1314{
1285 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1315 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1286 1316
1287 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1317 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1288 if (context_scim && context_scim->impl) 1318 if (context_scim && context_scim->impl)
1289 context_scim->impl->input_mode = input_mode; 1319 context_scim->impl->input_mode = input_mode;
1290} 1320}
@@ -1299,22 +1329,22 @@ isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode inp
1299 * Set whether the IM context should use the prediction. 1329 * Set whether the IM context should use the prediction.
1300 */ 1330 */
1301EAPI void 1331EAPI void
1302isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction) 1332isf_imf_context_prediction_allow_set(Ecore_IMF_Context* ctx, Eina_Bool prediction)
1303{ 1333{
1304 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n"; 1334 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n";
1305 1335
1306 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1336 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
1307 1337
1308 if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction) 1338 if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction)
1309 context_scim->impl->prediction_allow = prediction; 1339 context_scim->impl->prediction_allow = prediction;
1310} 1340}
1311 1341
1312EAPI void 1342EAPI void
1313isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type) 1343isf_imf_context_autocapital_type_set(Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type)
1314{ 1344{
1315 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n"; 1345 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n";
1316 1346
1317 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); 1347 EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx);
1318 1348
1319 if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type) 1349 if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type)
1320 context_scim->impl->autocapital_type = autocapital_type; 1350 context_scim->impl->autocapital_type = autocapital_type;
@@ -1337,11 +1367,11 @@ isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapi
1337 */ 1367 */
1338 1368
1339EAPI Eina_Bool 1369EAPI Eina_Bool
1340isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) 1370isf_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
1341{ 1371{
1342 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1372 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1343 1373
1344 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); 1374 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1345 Eina_Bool ret = EINA_FALSE; 1375 Eina_Bool ret = EINA_FALSE;
1346 1376
1347 if (ic == NULL || ic->impl == NULL) 1377 if (ic == NULL || ic->impl == NULL)
@@ -1352,7 +1382,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type,
1352 if (type == ECORE_IMF_EVENT_KEY_DOWN) 1382 if (type == ECORE_IMF_EVENT_KEY_DOWN)
1353 { 1383 {
1354 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; 1384 Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
1355 scim_string_to_key (key, ev->key); 1385 scim_string_to_key(key, ev->key);
1356 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; 1386 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
1357 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; 1387 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
1358 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask; 1388 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
@@ -1362,7 +1392,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type,
1362 else if (type == ECORE_IMF_EVENT_KEY_UP) 1392 else if (type == ECORE_IMF_EVENT_KEY_UP)
1363 { 1393 {
1364 Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event; 1394 Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event;
1365 scim_string_to_key (key, ev->key); 1395 scim_string_to_key(key, ev->key);
1366 key.mask = SCIM_KEY_ReleaseMask; 1396 key.mask = SCIM_KEY_ReleaseMask;
1367 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; 1397 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
1368 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; 1398 if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
@@ -1377,264 +1407,290 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type,
1377 1407
1378 key.mask &= _valid_key_mask; 1408 key.mask &= _valid_key_mask;
1379 1409
1380 _panel_client.prepare (ic->id); 1410 _panel_client.prepare(ic->id);
1381 1411
1382 ret = EINA_TRUE; 1412 ret = EINA_TRUE;
1383 if (!filter_hotkeys (ic, key)) 1413 if (!filter_hotkeys(ic, key))
1384 { 1414 {
1385 if (!_focused_ic || !_focused_ic->impl->is_on || 1415 if (!_focused_ic || !_focused_ic->impl->is_on ||
1386 !_focused_ic->impl->si->process_key_event (key)) 1416 !_focused_ic->impl->si->process_key_event(key))
1387 ret = EINA_FALSE; 1417 ret = EINA_FALSE;
1388 } 1418 }
1389 1419
1390 _panel_client.send (); 1420 _panel_client.send();
1391 1421
1392 return ret; 1422 return ret;
1393} 1423}
1394 1424
1425EAPI void
1426isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx)
1427{
1428 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1429
1430 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1431 if (ic == NULL || ic->impl == NULL)
1432 return;
1433
1434 ecore_x_e_virtual_keyboard_state_set
1435 (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
1436}
1437
1438EAPI void
1439isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx)
1440{
1441 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1442
1443 EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx);
1444 if (ic == NULL || ic->impl == NULL)
1445 return;
1446
1447 ecore_x_e_virtual_keyboard_state_set
1448 (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
1449}
1450
1395/* Panel Slot functions */ 1451/* Panel Slot functions */
1396static void 1452static void
1397panel_slot_reload_config (int context __UNUSED__) 1453panel_slot_reload_config(int context __UNUSED__)
1398{ 1454{
1399 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1455 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1400 _config->reload (); 1456 _config->reload();
1401} 1457}
1402 1458
1403static void 1459static void
1404panel_slot_exit (int /* context */) 1460panel_slot_exit(int /* context */)
1405{ 1461{
1406 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1462 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1407 1463
1408 finalize (); 1464 finalize();
1409} 1465}
1410 1466
1411static void 1467static void
1412panel_slot_update_lookup_table_page_size (int context, int page_size) 1468panel_slot_update_lookup_table_page_size(int context, int page_size)
1413{ 1469{
1414 EcoreIMFContextISF *ic = find_ic (context); 1470 EcoreIMFContextISF *ic = find_ic(context);
1415 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n"; 1471 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n";
1416 if (ic && ic->impl) 1472 if (ic && ic->impl)
1417 { 1473 {
1418 _panel_client.prepare (ic->id); 1474 _panel_client.prepare(ic->id);
1419 ic->impl->si->update_lookup_table_page_size (page_size); 1475 ic->impl->si->update_lookup_table_page_size(page_size);
1420 _panel_client.send (); 1476 _panel_client.send();
1421 } 1477 }
1422} 1478}
1423 1479
1424static void 1480static void
1425panel_slot_lookup_table_page_up (int context) 1481panel_slot_lookup_table_page_up(int context)
1426{ 1482{
1427 EcoreIMFContextISF *ic = find_ic (context); 1483 EcoreIMFContextISF *ic = find_ic(context);
1428 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1484 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1429 if (ic && ic->impl) 1485 if (ic && ic->impl)
1430 { 1486 {
1431 _panel_client.prepare (ic->id); 1487 _panel_client.prepare(ic->id);
1432 ic->impl->si->lookup_table_page_up (); 1488 ic->impl->si->lookup_table_page_up();
1433 _panel_client.send (); 1489 _panel_client.send();
1434 } 1490 }
1435} 1491}
1436 1492
1437static void 1493static void
1438panel_slot_lookup_table_page_down (int context) 1494panel_slot_lookup_table_page_down(int context)
1439{ 1495{
1440 EcoreIMFContextISF *ic = find_ic (context); 1496 EcoreIMFContextISF *ic = find_ic(context);
1441 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1497 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1442 if (ic && ic->impl) 1498 if (ic && ic->impl)
1443 { 1499 {
1444 _panel_client.prepare (ic->id); 1500 _panel_client.prepare(ic->id);
1445 ic->impl->si->lookup_table_page_down (); 1501 ic->impl->si->lookup_table_page_down();
1446 _panel_client.send (); 1502 _panel_client.send();
1447 } 1503 }
1448} 1504}
1449 1505
1450static void 1506static void
1451panel_slot_trigger_property (int context, const String &property) 1507panel_slot_trigger_property(int context, const String &property)
1452{ 1508{
1453 EcoreIMFContextISF *ic = find_ic (context); 1509 EcoreIMFContextISF *ic = find_ic(context);
1454 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n"; 1510 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n";
1455 if (ic && ic->impl) 1511 if (ic && ic->impl)
1456 { 1512 {
1457 _panel_client.prepare (ic->id); 1513 _panel_client.prepare(ic->id);
1458 ic->impl->si->trigger_property (property); 1514 ic->impl->si->trigger_property(property);
1459 _panel_client.send (); 1515 _panel_client.send();
1460 } 1516 }
1461} 1517}
1462 1518
1463static void 1519static void
1464panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) 1520panel_slot_process_helper_event(int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans)
1465{ 1521{
1466 EcoreIMFContextISF *ic = find_ic (context); 1522 EcoreIMFContextISF *ic = find_ic(context);
1467 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid 1523 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid
1468 << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid=" 1524 << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid="
1469 << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid () : "" ) << "\n"; 1525 << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid() : "" ) << "\n";
1470 if (ic && ic->impl && ic->impl->si->get_factory_uuid () == target_uuid) 1526 if (ic && ic->impl && ic->impl->si->get_factory_uuid() == target_uuid)
1471 { 1527 {
1472 _panel_client.prepare (ic->id); 1528 _panel_client.prepare(ic->id);
1473 SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n"; 1529 SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n";
1474 ic->impl->si->process_helper_event (helper_uuid, trans); 1530 ic->impl->si->process_helper_event(helper_uuid, trans);
1475 _panel_client.send (); 1531 _panel_client.send();
1476 } 1532 }
1477} 1533}
1478 1534
1479static void 1535static void
1480panel_slot_move_preedit_caret (int context, int caret_pos) 1536panel_slot_move_preedit_caret(int context, int caret_pos)
1481{ 1537{
1482 EcoreIMFContextISF *ic = find_ic (context); 1538 EcoreIMFContextISF *ic = find_ic(context);
1483 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n"; 1539 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n";
1484 if (ic && ic->impl) 1540 if (ic && ic->impl)
1485 { 1541 {
1486 _panel_client.prepare (ic->id); 1542 _panel_client.prepare(ic->id);
1487 ic->impl->si->move_preedit_caret (caret_pos); 1543 ic->impl->si->move_preedit_caret(caret_pos);
1488 _panel_client.send (); 1544 _panel_client.send();
1489 } 1545 }
1490} 1546}
1491 1547
1492static void 1548static void
1493panel_slot_select_candidate (int context, int cand_index) 1549panel_slot_select_candidate(int context, int cand_index)
1494{ 1550{
1495 EcoreIMFContextISF *ic = find_ic (context); 1551 EcoreIMFContextISF *ic = find_ic(context);
1496 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n"; 1552 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n";
1497 if (ic && ic->impl) 1553 if (ic && ic->impl)
1498 { 1554 {
1499 _panel_client.prepare (ic->id); 1555 _panel_client.prepare(ic->id);
1500 ic->impl->si->select_candidate (cand_index); 1556 ic->impl->si->select_candidate(cand_index);
1501 _panel_client.send (); 1557 _panel_client.send();
1502 } 1558 }
1503} 1559}
1504 1560
1505static void 1561static void
1506panel_slot_process_key_event (int context, const KeyEvent &key) 1562panel_slot_process_key_event(int context, const KeyEvent &key)
1507{ 1563{
1508 EcoreIMFContextISF *ic = find_ic (context); 1564 EcoreIMFContextISF *ic = find_ic(context);
1509 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; 1565 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n";
1510 1566
1511 if (ic && ic->impl && ic->impl->client_canvas) 1567 if (key.is_key_press())
1512 feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE); 1568 ecore_x_test_fake_key_press(key.get_key_string().c_str());
1513} 1569}
1514 1570
1515static void 1571static void
1516panel_slot_commit_string (int context, const WideString &wstr) 1572panel_slot_commit_string(int context, const WideString &wstr)
1517{ 1573{
1518 EcoreIMFContextISF *ic = find_ic (context); 1574 EcoreIMFContextISF *ic = find_ic(context);
1519 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n"; 1575 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs(wstr) << " ic=" << ic << "\n";
1520 1576
1521 if (ic && ic->impl) 1577 if (ic && ic->impl)
1522 { 1578 {
1523 if (_focused_ic != ic) 1579 if (_focused_ic != ic)
1524 return; 1580 return;
1525 1581
1526 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (wstr).c_str ()); 1582 ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(wstr).c_str());
1527 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); 1583 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str());
1528 } 1584 }
1529} 1585}
1530 1586
1531static void 1587static void
1532panel_slot_forward_key_event (int context, const KeyEvent &key) 1588panel_slot_forward_key_event(int context, const KeyEvent &key)
1533{ 1589{
1534 EcoreIMFContextISF *ic = find_ic (context); 1590 EcoreIMFContextISF *ic = find_ic(context);
1535 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; 1591 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n";
1536 1592
1537 if (ic && ic->impl && ic->impl->client_canvas) 1593 if (ic && ic->impl && ic->impl->client_canvas)
1538 feed_key_event (ic->impl->client_canvas, key.get_key_string ().c_str (), EINA_TRUE); 1594 feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_TRUE);
1539} 1595}
1540 1596
1541static void 1597static void
1542panel_slot_request_help (int context) 1598panel_slot_request_help(int context)
1543{ 1599{
1544 EcoreIMFContextISF *ic = find_ic (context); 1600 EcoreIMFContextISF *ic = find_ic(context);
1545 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1601 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1546 1602
1547 if (ic && ic->impl) 1603 if (ic && ic->impl)
1548 { 1604 {
1549 _panel_client.prepare (ic->id); 1605 _panel_client.prepare(ic->id);
1550 panel_req_show_help (ic); 1606 panel_req_show_help(ic);
1551 _panel_client.send (); 1607 _panel_client.send();
1552 } 1608 }
1553} 1609}
1554 1610
1555static void 1611static void
1556panel_slot_request_factory_menu (int context) 1612panel_slot_request_factory_menu(int context)
1557{ 1613{
1558 EcoreIMFContextISF *ic = find_ic (context); 1614 EcoreIMFContextISF *ic = find_ic(context);
1559 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; 1615 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n";
1560 1616
1561 if (ic && ic->impl) 1617 if (ic && ic->impl)
1562 { 1618 {
1563 _panel_client.prepare (ic->id); 1619 _panel_client.prepare(ic->id);
1564 panel_req_show_factory_menu (ic); 1620 panel_req_show_factory_menu(ic);
1565 _panel_client.send (); 1621 _panel_client.send();
1566 } 1622 }
1567} 1623}
1568 1624
1569static void 1625static void
1570panel_slot_change_factory (int context, const String &uuid) 1626panel_slot_change_factory(int context, const String &uuid)
1571{ 1627{
1572 EcoreIMFContextISF *ic = find_ic (context); 1628 EcoreIMFContextISF *ic = find_ic(context);
1573 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n"; 1629 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n";
1574 1630
1575 if (ic && ic->impl) 1631 if (ic && ic->impl)
1576 { 1632 {
1577 ic->impl->si->reset (); 1633 ic->impl->si->reset();
1578 _panel_client.prepare (ic->id); 1634 _panel_client.prepare(ic->id);
1579 open_specific_factory (ic, uuid); 1635 open_specific_factory(ic, uuid);
1580 _panel_client.send (); 1636 _panel_client.send();
1581 } 1637 }
1582} 1638}
1583 1639
1584/* Panel Requestion functions. */ 1640/* Panel Requestion functions. */
1585static void 1641static void
1586panel_req_show_help (EcoreIMFContextISF *ic) 1642panel_req_show_help(EcoreIMFContextISF *ic)
1587{ 1643{
1588 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1644 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1589 1645
1590 String help; 1646 String help;
1591 1647
1592 help = String ("Smart Common Input Method platform ") + 1648 help = String("Smart Common Input Method platform ") +
1593 //String (SCIM_VERSION) + 1649 //String(SCIM_VERSION) +
1594 String ("\n(C) 2002-2005 James Su <suzhe@tsinghua.org.cn>\n\n"); 1650 String("\n(C) 2002-2005 James Su <suzhe@tsinghua.org.cn>\n\n");
1595 1651
1596 if (ic && ic->impl) 1652 if (ic && ic->impl)
1597 { 1653 {
1598 IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); 1654 IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid());
1599 if (sf) 1655 if (sf)
1600 { 1656 {
1601 help += utf8_wcstombs (sf->get_name ()); 1657 help += utf8_wcstombs(sf->get_name());
1602 help += String (":\n\n"); 1658 help += String(":\n\n");
1603 1659
1604 help += utf8_wcstombs (sf->get_help ()); 1660 help += utf8_wcstombs(sf->get_help());
1605 help += String ("\n\n"); 1661 help += String("\n\n");
1606 1662
1607 help += utf8_wcstombs (sf->get_credits ()); 1663 help += utf8_wcstombs(sf->get_credits());
1608 } 1664 }
1609 _panel_client.show_help (ic->id, help); 1665 _panel_client.show_help(ic->id, help);
1610 } 1666 }
1611} 1667}
1612 1668
1613static void 1669static void
1614panel_req_show_factory_menu (EcoreIMFContextISF *ic) 1670panel_req_show_factory_menu(EcoreIMFContextISF *ic)
1615{ 1671{
1616 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1672 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1617 1673
1618 std::vector<IMEngineFactoryPointer> factories; 1674 std::vector<IMEngineFactoryPointer> factories;
1619 std::vector <PanelFactoryInfo> menu; 1675 std::vector <PanelFactoryInfo> menu;
1620 1676
1621 _backend->get_factories_for_encoding (factories, "UTF-8"); 1677 _backend->get_factories_for_encoding(factories, "UTF-8");
1622 1678
1623 for (size_t i = 0; i < factories.size (); ++ i) 1679 for (size_t i = 0; i < factories.size(); ++ i)
1624 { 1680 {
1625 menu.push_back (PanelFactoryInfo ( 1681 menu.push_back(PanelFactoryInfo(
1626 factories [i]->get_uuid (), 1682 factories [i]->get_uuid(),
1627 utf8_wcstombs (factories [i]->get_name ()), 1683 utf8_wcstombs(factories [i]->get_name()),
1628 factories [i]->get_language (), 1684 factories [i]->get_language(),
1629 factories [i]->get_icon_file ())); 1685 factories [i]->get_icon_file()));
1630 } 1686 }
1631 1687
1632 if (menu.size ()) 1688 if (menu.size())
1633 _panel_client.show_factory_menu (ic->id, menu); 1689 _panel_client.show_factory_menu(ic->id, menu);
1634} 1690}
1635 1691
1636static void 1692static void
1637panel_req_update_factory_info (EcoreIMFContextISF *ic) 1693panel_req_update_factory_info(EcoreIMFContextISF *ic)
1638{ 1694{
1639 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1695 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1640 1696
@@ -1643,160 +1699,160 @@ panel_req_update_factory_info (EcoreIMFContextISF *ic)
1643 PanelFactoryInfo info; 1699 PanelFactoryInfo info;
1644 if (ic->impl->is_on) 1700 if (ic->impl->is_on)
1645 { 1701 {
1646 IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); 1702 IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid());
1647 if (sf) 1703 if (sf)
1648 info = PanelFactoryInfo (sf->get_uuid (), utf8_wcstombs (sf->get_name ()), sf->get_language (), sf->get_icon_file ()); 1704 info = PanelFactoryInfo(sf->get_uuid(), utf8_wcstombs(sf->get_name()), sf->get_language(), sf->get_icon_file());
1649 } 1705 }
1650 else 1706 else
1651 { 1707 {
1652 info = PanelFactoryInfo (String (""), String ("English/Keyboard"), String ("C"), ""); 1708 info = PanelFactoryInfo(String(""), String("English/Keyboard"), String("C"), "");
1653 } 1709 }
1654 _panel_client.update_factory_info (ic->id, info); 1710 _panel_client.update_factory_info(ic->id, info);
1655 } 1711 }
1656} 1712}
1657 1713
1658static void 1714static void
1659panel_req_focus_in (EcoreIMFContextISF *ic) 1715panel_req_focus_in(EcoreIMFContextISF *ic)
1660{ 1716{
1661 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1717 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1662 1718
1663 _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ()); 1719 _panel_client.focus_in(ic->id, ic->impl->si->get_factory_uuid());
1664} 1720}
1665 1721
1666static void 1722static void
1667panel_req_update_spot_location (EcoreIMFContextISF *ic) 1723panel_req_update_spot_location(EcoreIMFContextISF *ic)
1668{ 1724{
1669 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1725 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1670 1726
1671 _panel_client.update_spot_location (ic->id, ic->impl->cursor_x, ic->impl->cursor_y); 1727 _panel_client.update_spot_location(ic->id, ic->impl->cursor_x, ic->impl->cursor_y);
1672} 1728}
1673 1729
1674static bool 1730static bool
1675filter_hotkeys (EcoreIMFContextISF *ic, const KeyEvent &key) 1731filter_hotkeys(EcoreIMFContextISF *ic, const KeyEvent &key)
1676{ 1732{
1677 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1678 1734
1679 bool ret = false; 1735 bool ret = false;
1680 1736
1681 _frontend_hotkey_matcher.push_key_event (key); 1737 _frontend_hotkey_matcher.push_key_event(key);
1682 _imengine_hotkey_matcher.push_key_event (key); 1738 _imengine_hotkey_matcher.push_key_event(key);
1683 1739
1684 FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result (); 1740 FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result();
1685 1741
1686 if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER) 1742 if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER)
1687 { 1743 {
1688 if (!ic->impl->is_on) 1744 if (!ic->impl->is_on)
1689 turn_on_ic (ic); 1745 turn_on_ic(ic);
1690 else 1746 else
1691 turn_off_ic (ic); 1747 turn_off_ic(ic);
1692 ret = true; 1748 ret = true;
1693 } 1749 }
1694 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) 1750 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON)
1695 { 1751 {
1696 if (!ic->impl->is_on) 1752 if (!ic->impl->is_on)
1697 turn_on_ic (ic); 1753 turn_on_ic(ic);
1698 ret = true; 1754 ret = true;
1699 } 1755 }
1700 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF) 1756 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF)
1701 { 1757 {
1702 if (ic->impl->is_on) 1758 if (ic->impl->is_on)
1703 turn_off_ic (ic); 1759 turn_off_ic(ic);
1704 ret = true; 1760 ret = true;
1705 } 1761 }
1706 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY) 1762 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY)
1707 { 1763 {
1708 open_next_factory (ic); 1764 open_next_factory(ic);
1709 ret = true; 1765 ret = true;
1710 } 1766 }
1711 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY) 1767 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY)
1712 { 1768 {
1713 open_previous_factory (ic); 1769 open_previous_factory(ic);
1714 ret = true; 1770 ret = true;
1715 } 1771 }
1716 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU) 1772 else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU)
1717 { 1773 {
1718 panel_req_show_factory_menu (ic); 1774 panel_req_show_factory_menu(ic);
1719 ret = true; 1775 ret = true;
1720 } 1776 }
1721 else if (_imengine_hotkey_matcher.is_matched ()) 1777 else if (_imengine_hotkey_matcher.is_matched())
1722 { 1778 {
1723 String sfid = _imengine_hotkey_matcher.get_match_result (); 1779 String sfid = _imengine_hotkey_matcher.get_match_result();
1724 open_specific_factory (ic, sfid); 1780 open_specific_factory(ic, sfid);
1725 ret = true; 1781 ret = true;
1726 } 1782 }
1727 return ret; 1783 return ret;
1728} 1784}
1729 1785
1730static bool 1786static bool
1731panel_initialize (void) 1787panel_initialize(void)
1732{ 1788{
1733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1789 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1734 1790
1735 String display_name; 1791 String display_name;
1736 { 1792 {
1737 const char *p = getenv ("DISPLAY"); 1793 const char *p = getenv("DISPLAY");
1738 if (p) display_name = String (p); 1794 if (p) display_name = String(p);
1739 } 1795 }
1740 1796
1741 if (_panel_client.open_connection (_config->get_name (), display_name) >= 0) 1797 if (_panel_client.open_connection(_config->get_name(), display_name) >= 0)
1742 { 1798 {
1743 int fd = _panel_client.get_connection_number (); 1799 int fd = _panel_client.get_connection_number();
1744 1800
1745 _panel_iochannel_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL); 1801 _panel_iochannel_read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL);
1746 1802
1747 SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n"; 1803 SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n";
1748 1804
1749 return true; 1805 return true;
1750 } 1806 }
1751 std::cerr << "panel_initialize () failed!!!\n"; 1807 std::cerr << "panel_initialize() failed!!!\n";
1752 return false; 1808 return false;
1753} 1809}
1754 1810
1755static void 1811static void
1756panel_finalize (void) 1812panel_finalize(void)
1757{ 1813{
1758 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1814 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1759 1815
1760 _panel_client.close_connection (); 1816 _panel_client.close_connection();
1761 1817
1762 if (_panel_iochannel_read_handler) 1818 if (_panel_iochannel_read_handler)
1763 { 1819 {
1764 ecore_main_fd_handler_del (_panel_iochannel_read_handler); 1820 ecore_main_fd_handler_del(_panel_iochannel_read_handler);
1765 _panel_iochannel_read_handler = 0; 1821 _panel_iochannel_read_handler = 0;
1766 } 1822 }
1767 1823
1768 if (_panel_iochannel_err_handler) 1824 if (_panel_iochannel_err_handler)
1769 { 1825 {
1770 ecore_main_fd_handler_del (_panel_iochannel_err_handler); 1826 ecore_main_fd_handler_del(_panel_iochannel_err_handler);
1771 _panel_iochannel_err_handler = 0; 1827 _panel_iochannel_err_handler = 0;
1772 } 1828 }
1773} 1829}
1774 1830
1775static Eina_Bool 1831static Eina_Bool
1776panel_iochannel_handler (void *data __UNUSED__, Ecore_Fd_Handler *fd_handler) 1832panel_iochannel_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler)
1777{ 1833{
1778 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1834 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1779 1835
1780 if (fd_handler == _panel_iochannel_read_handler) 1836 if (fd_handler == _panel_iochannel_read_handler)
1781 { 1837 {
1782 if (!_panel_client.filter_event ()) 1838 if (!_panel_client.filter_event())
1783 { 1839 {
1784 panel_finalize (); 1840 panel_finalize();
1785 panel_initialize (); 1841 panel_initialize();
1786 return ECORE_CALLBACK_CANCEL; 1842 return ECORE_CALLBACK_CANCEL;
1787 } 1843 }
1788 } 1844 }
1789 else if (fd_handler == _panel_iochannel_err_handler) 1845 else if (fd_handler == _panel_iochannel_err_handler)
1790 { 1846 {
1791 panel_finalize (); 1847 panel_finalize();
1792 panel_initialize (); 1848 panel_initialize();
1793 return ECORE_CALLBACK_CANCEL; 1849 return ECORE_CALLBACK_CANCEL;
1794 } 1850 }
1795 return ECORE_CALLBACK_RENEW; 1851 return ECORE_CALLBACK_RENEW;
1796} 1852}
1797 1853
1798static void 1854static void
1799turn_on_ic (EcoreIMFContextISF *ic) 1855turn_on_ic(EcoreIMFContextISF *ic)
1800{ 1856{
1801 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1857 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1802 1858
@@ -1806,25 +1862,25 @@ turn_on_ic (EcoreIMFContextISF *ic)
1806 1862
1807 if (ic == _focused_ic) 1863 if (ic == _focused_ic)
1808 { 1864 {
1809 panel_req_focus_in (ic); 1865 panel_req_focus_in(ic);
1810 panel_req_update_spot_location (ic); 1866 panel_req_update_spot_location(ic);
1811 panel_req_update_factory_info (ic); 1867 panel_req_update_factory_info(ic);
1812 _panel_client.turn_on (ic->id); 1868 _panel_client.turn_on(ic->id);
1813 _panel_client.hide_preedit_string (ic->id); 1869 _panel_client.hide_preedit_string(ic->id);
1814 _panel_client.hide_aux_string (ic->id); 1870 _panel_client.hide_aux_string(ic->id);
1815 _panel_client.hide_lookup_table (ic->id); 1871 _panel_client.hide_lookup_table(ic->id);
1816 ic->impl->si->focus_in (); 1872 ic->impl->si->focus_in();
1817 } 1873 }
1818 1874
1819 //Record the IC on/off status 1875 //Record the IC on/off status
1820 if (_shared_input_method) 1876 if (_shared_input_method)
1821 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); 1877 _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true);
1822 1878
1823 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 1879 if (ic->impl->use_preedit && ic->impl->preedit_string.length())
1824 { 1880 {
1825 ecore_imf_context_preedit_start_event_add (ic->ctx); 1881 ecore_imf_context_preedit_start_event_add(ic->ctx);
1826 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 1882 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
1827 ecore_imf_context_preedit_changed_event_add (ic->ctx); 1883 ecore_imf_context_preedit_changed_event_add(ic->ctx);
1828 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 1884 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1829 ic->impl->preedit_started = true; 1885 ic->impl->preedit_started = true;
1830 } 1886 }
@@ -1832,7 +1888,7 @@ turn_on_ic (EcoreIMFContextISF *ic)
1832} 1888}
1833 1889
1834static void 1890static void
1835turn_off_ic (EcoreIMFContextISF *ic) 1891turn_off_ic(EcoreIMFContextISF *ic)
1836{ 1892{
1837 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1893 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1838 1894
@@ -1842,21 +1898,21 @@ turn_off_ic (EcoreIMFContextISF *ic)
1842 1898
1843 if (ic == _focused_ic) 1899 if (ic == _focused_ic)
1844 { 1900 {
1845 ic->impl->si->focus_out (); 1901 ic->impl->si->focus_out();
1846 1902
1847 panel_req_update_factory_info (ic); 1903 panel_req_update_factory_info(ic);
1848 _panel_client.turn_off (ic->id); 1904 _panel_client.turn_off(ic->id);
1849 } 1905 }
1850 1906
1851 //Record the IC on/off status 1907 //Record the IC on/off status
1852 if (_shared_input_method) 1908 if (_shared_input_method)
1853 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); 1909 _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
1854 1910
1855 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 1911 if (ic->impl->use_preedit && ic->impl->preedit_string.length())
1856 { 1912 {
1857 ecore_imf_context_preedit_changed_event_add (ic->ctx); 1913 ecore_imf_context_preedit_changed_event_add(ic->ctx);
1858 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 1914 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
1859 ecore_imf_context_preedit_end_event_add (ic->ctx); 1915 ecore_imf_context_preedit_end_event_add(ic->ctx);
1860 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); 1916 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
1861 ic->impl->preedit_started = false; 1917 ic->impl->preedit_started = false;
1862 } 1918 }
@@ -1864,7 +1920,7 @@ turn_off_ic (EcoreIMFContextISF *ic)
1864} 1920}
1865 1921
1866static void 1922static void
1867set_ic_capabilities (EcoreIMFContextISF *ic) 1923set_ic_capabilities(EcoreIMFContextISF *ic)
1868{ 1924{
1869 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1925 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1870 1926
@@ -1875,12 +1931,12 @@ set_ic_capabilities (EcoreIMFContextISF *ic)
1875 if (!_on_the_spot || !ic->impl->use_preedit) 1931 if (!_on_the_spot || !ic->impl->use_preedit)
1876 cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT; 1932 cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT;
1877 1933
1878 ic->impl->si->update_client_capabilities (cap); 1934 ic->impl->si->update_client_capabilities(cap);
1879 } 1935 }
1880} 1936}
1881 1937
1882static bool 1938static bool
1883check_socket_frontend (void) 1939check_socket_frontend(void)
1884{ 1940{
1885 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 1941 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
1886 1942
@@ -1889,23 +1945,23 @@ check_socket_frontend (void)
1889 1945
1890 uint32 magic; 1946 uint32 magic;
1891 1947
1892 address.set_address (scim_get_default_socket_frontend_address ()); 1948 address.set_address(scim_get_default_socket_frontend_address());
1893 1949
1894 if (!client.connect (address)) 1950 if (!client.connect(address))
1895 return false; 1951 return false;
1896 1952
1897 if (!scim_socket_open_connection (magic, 1953 if (!scim_socket_open_connection(magic,
1898 String ("ConnectionTester"), 1954 String("ConnectionTester"),
1899 String ("SocketFrontEnd"), 1955 String("SocketFrontEnd"),
1900 client, 1956 client,
1901 1000)) 1957 1000))
1902 return false; 1958 return false;
1903 1959
1904 return true; 1960 return true;
1905} 1961}
1906 1962
1907void 1963void
1908initialize (void) 1964initialize(void)
1909{ 1965{
1910 std::vector<String> config_list; 1966 std::vector<String> config_list;
1911 std::vector<String> engine_list; 1967 std::vector<String> engine_list;
@@ -1924,31 +1980,31 @@ initialize (void)
1924 SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n"; 1980 SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n";
1925 1981
1926 // Get system language. 1982 // Get system language.
1927 _language = scim_get_locale_language (scim_get_current_locale ()); 1983 _language = scim_get_locale_language(scim_get_current_locale());
1928 1984
1929 if (socket) 1985 if (socket)
1930 { 1986 {
1931 // If no Socket FrontEnd is running, then launch one. 1987 // If no Socket FrontEnd is running, then launch one.
1932 // And set manual to false. 1988 // And set manual to false.
1933 bool check_result = check_socket_frontend (); 1989 bool check_result = check_socket_frontend();
1934 if (!check_result) 1990 if (!check_result)
1935 { 1991 {
1936 std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n"; 1992 std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n";
1937 //get modules list 1993 //get modules list
1938 scim_get_imengine_module_list (engine_list); 1994 scim_get_imengine_module_list(engine_list);
1939 1995
1940 for (it = engine_list.begin (); it != engine_list.end (); it++) 1996 for (it = engine_list.begin(); it != engine_list.end(); it++)
1941 { 1997 {
1942 if (*it != "socket") 1998 if (*it != "socket")
1943 load_engine_list.push_back (*it); 1999 load_engine_list.push_back(*it);
1944 } 2000 }
1945 2001
1946 const char *new_argv [] = { "--no-stay", 0 }; 2002 const char *new_argv [] = { "--no-stay", 0 };
1947 scim_launch (true, 2003 scim_launch(true,
1948 config_module_name, 2004 config_module_name,
1949 (load_engine_list.size () ? scim_combine_string_list (load_engine_list, ',') : "none"), 2005 (load_engine_list.size() ? scim_combine_string_list(load_engine_list, ',') : "none"),
1950 "socket", 2006 "socket",
1951 (char **)new_argv); 2007 (char **)new_argv);
1952 manual = false; 2008 manual = false;
1953 } 2009 }
1954 2010
@@ -1961,12 +2017,12 @@ initialize (void)
1961 if (check_result) 2017 if (check_result)
1962 { 2018 {
1963 config_module_name = "socket"; 2019 config_module_name = "socket";
1964 load_engine_list.clear (); 2020 load_engine_list.clear();
1965 load_engine_list.push_back ("socket"); 2021 load_engine_list.push_back("socket");
1966 break; 2022 break;
1967 } 2023 }
1968 scim_usleep (50000); 2024 scim_usleep(50000);
1969 check_result = check_socket_frontend (); 2025 check_result = check_socket_frontend();
1970 } 2026 }
1971 } 2027 }
1972 } 2028 }
@@ -1975,69 +2031,69 @@ initialize (void)
1975 { 2031 {
1976 //load config module 2032 //load config module
1977 SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n"; 2033 SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n";
1978 _config_module = new ConfigModule (config_module_name); 2034 _config_module = new ConfigModule(config_module_name);
1979 2035
1980 //create config instance 2036 //create config instance
1981 if (_config_module != NULL && _config_module->valid ()) 2037 if (_config_module != NULL && _config_module->valid())
1982 _config = _config_module->create_config (); 2038 _config = _config_module->create_config();
1983 } 2039 }
1984 2040
1985 if (_config.null ()) 2041 if (_config.null())
1986 { 2042 {
1987 SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n"; 2043 SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n";
1988 2044
1989 if (_config_module) delete _config_module; 2045 if (_config_module) delete _config_module;
1990 _config_module = NULL; 2046 _config_module = NULL;
1991 2047
1992 _config = new DummyConfig (); 2048 _config = new DummyConfig();
1993 config_module_name = "dummy"; 2049 config_module_name = "dummy";
1994 } 2050 }
1995 2051
1996 reload_config_callback (_config); 2052 reload_config_callback(_config);
1997 _config->signal_connect_reload (slot (reload_config_callback)); 2053 _config->signal_connect_reload(slot(reload_config_callback));
1998 2054
1999 // create backend 2055 // create backend
2000 _backend = new CommonBackEnd (_config, load_engine_list.size () ? load_engine_list : engine_list); 2056 _backend = new CommonBackEnd(_config, load_engine_list.size() ? load_engine_list : engine_list);
2001 2057
2002 if (_backend.null ()) 2058 if (_backend.null())
2003 std::cerr << "Cannot create BackEnd Object!\n"; 2059 std::cerr << "Cannot create BackEnd Object!\n";
2004 else 2060 else
2005 _fallback_factory = _backend->get_factory (SCIM_COMPOSE_KEY_FACTORY_UUID); 2061 _fallback_factory = _backend->get_factory(SCIM_COMPOSE_KEY_FACTORY_UUID);
2006 2062
2007 if (_fallback_factory.null ()) 2063 if (_fallback_factory.null())
2008 _fallback_factory = new DummyIMEngineFactory (); 2064 _fallback_factory = new DummyIMEngineFactory();
2009 2065
2010 _fallback_instance = _fallback_factory->create_instance (String ("UTF-8"), 0); 2066 _fallback_instance = _fallback_factory->create_instance(String("UTF-8"), 0);
2011 _fallback_instance->signal_connect_commit_string (slot (fallback_commit_string_cb)); 2067 _fallback_instance->signal_connect_commit_string(slot(fallback_commit_string_cb));
2012 2068
2013 // Attach Panel Client signal. 2069 // Attach Panel Client signal.
2014 _panel_client.signal_connect_reload_config (slot (panel_slot_reload_config)); 2070 _panel_client.signal_connect_reload_config (slot(panel_slot_reload_config));
2015 _panel_client.signal_connect_exit (slot (panel_slot_exit)); 2071 _panel_client.signal_connect_exit (slot(panel_slot_exit));
2016 _panel_client.signal_connect_update_lookup_table_page_size (slot (panel_slot_update_lookup_table_page_size)); 2072 _panel_client.signal_connect_update_lookup_table_page_size(slot(panel_slot_update_lookup_table_page_size));
2017 _panel_client.signal_connect_lookup_table_page_up (slot (panel_slot_lookup_table_page_up)); 2073 _panel_client.signal_connect_lookup_table_page_up (slot(panel_slot_lookup_table_page_up));
2018 _panel_client.signal_connect_lookup_table_page_down (slot (panel_slot_lookup_table_page_down)); 2074 _panel_client.signal_connect_lookup_table_page_down (slot(panel_slot_lookup_table_page_down));
2019 _panel_client.signal_connect_trigger_property (slot (panel_slot_trigger_property)); 2075 _panel_client.signal_connect_trigger_property (slot(panel_slot_trigger_property));
2020 _panel_client.signal_connect_process_helper_event (slot (panel_slot_process_helper_event)); 2076 _panel_client.signal_connect_process_helper_event (slot(panel_slot_process_helper_event));
2021 _panel_client.signal_connect_move_preedit_caret (slot (panel_slot_move_preedit_caret)); 2077 _panel_client.signal_connect_move_preedit_caret (slot(panel_slot_move_preedit_caret));
2022 _panel_client.signal_connect_select_candidate (slot (panel_slot_select_candidate)); 2078 _panel_client.signal_connect_select_candidate (slot(panel_slot_select_candidate));
2023 _panel_client.signal_connect_process_key_event (slot (panel_slot_process_key_event)); 2079 _panel_client.signal_connect_process_key_event (slot(panel_slot_process_key_event));
2024 _panel_client.signal_connect_commit_string (slot (panel_slot_commit_string)); 2080 _panel_client.signal_connect_commit_string (slot(panel_slot_commit_string));
2025 _panel_client.signal_connect_forward_key_event (slot (panel_slot_forward_key_event)); 2081 _panel_client.signal_connect_forward_key_event (slot(panel_slot_forward_key_event));
2026 _panel_client.signal_connect_request_help (slot (panel_slot_request_help)); 2082 _panel_client.signal_connect_request_help (slot(panel_slot_request_help));
2027 _panel_client.signal_connect_request_factory_menu (slot (panel_slot_request_factory_menu)); 2083 _panel_client.signal_connect_request_factory_menu (slot(panel_slot_request_factory_menu));
2028 _panel_client.signal_connect_change_factory (slot (panel_slot_change_factory)); 2084 _panel_client.signal_connect_change_factory (slot(panel_slot_change_factory));
2029 2085
2030 if (!panel_initialize ()) 2086 if (!panel_initialize())
2031 std::cerr << "Ecore IM Module: Cannot connect to Panel!\n"; 2087 std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
2032} 2088}
2033 2089
2034static void 2090static void
2035finalize (void) 2091finalize(void)
2036{ 2092{
2037 SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n"; 2093 SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n";
2038 2094
2039 // Reset this first so that the shared instance could be released correctly afterwards. 2095 // Reset this first so that the shared instance could be released correctly afterwards.
2040 _default_instance.reset (); 2096 _default_instance.reset();
2041 2097
2042 SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n"; 2098 SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n";
2043 while (_used_ic_impl_list) 2099 while (_used_ic_impl_list)
@@ -2045,20 +2101,20 @@ finalize (void)
2045 // In case in "shared input method" mode, 2101 // In case in "shared input method" mode,
2046 // all contexts share only one instance, 2102 // all contexts share only one instance,
2047 // so we need point the reference pointer correctly before finalizing. 2103 // so we need point the reference pointer correctly before finalizing.
2048 _used_ic_impl_list->si->set_frontend_data (static_cast <void*> (_used_ic_impl_list->parent)); 2104 _used_ic_impl_list->si->set_frontend_data(static_cast <void*>(_used_ic_impl_list->parent));
2049 isf_imf_context_del (_used_ic_impl_list->parent->ctx); 2105 isf_imf_context_del(_used_ic_impl_list->parent->ctx);
2050 } 2106 }
2051 2107
2052 delete_all_ic_impl (); 2108 delete_all_ic_impl();
2053 2109
2054 _fallback_instance.reset (); 2110 _fallback_instance.reset();
2055 _fallback_factory.reset (); 2111 _fallback_factory.reset();
2056 2112
2057 SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n"; 2113 SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n";
2058 _backend.reset (); 2114 _backend.reset();
2059 2115
2060 SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n"; 2116 SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n";
2061 _config.reset (); 2117 _config.reset();
2062 2118
2063 if (_config_module) 2119 if (_config_module)
2064 { 2120 {
@@ -2072,27 +2128,27 @@ finalize (void)
2072 2128
2073 _scim_initialized = false; 2129 _scim_initialized = false;
2074 2130
2075 panel_finalize (); 2131 panel_finalize();
2076} 2132}
2077 2133
2078static void 2134static void
2079open_next_factory (EcoreIMFContextISF *ic) 2135open_next_factory(EcoreIMFContextISF *ic)
2080{ 2136{
2081 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; 2137 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2082 IMEngineFactoryPointer sf = _backend->get_next_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); 2138 IMEngineFactoryPointer sf = _backend->get_next_factory("", "UTF-8", ic->impl->si->get_factory_uuid());
2083 2139
2084 if (!sf.null ()) 2140 if (!sf.null())
2085 { 2141 {
2086 turn_off_ic (ic); 2142 turn_off_ic(ic);
2087 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); 2143 ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
2088 ic->impl->si->set_frontend_data (static_cast <void*> (ic)); 2144 ic->impl->si->set_frontend_data(static_cast <void*>(ic));
2089 ic->impl->preedit_string = WideString (); 2145 ic->impl->preedit_string = WideString();
2090 ic->impl->preedit_caret = 0; 2146 ic->impl->preedit_caret = 0;
2091 attach_instance (ic->impl->si); 2147 attach_instance(ic->impl->si);
2092 _backend->set_default_factory (_language, sf->get_uuid ()); 2148 _backend->set_default_factory(_language, sf->get_uuid());
2093 _panel_client.register_input_context (ic->id, sf->get_uuid ()); 2149 _panel_client.register_input_context(ic->id, sf->get_uuid());
2094 set_ic_capabilities (ic); 2150 set_ic_capabilities(ic);
2095 turn_on_ic (ic); 2151 turn_on_ic(ic);
2096 2152
2097 if (_shared_input_method) 2153 if (_shared_input_method)
2098 { 2154 {
@@ -2103,26 +2159,26 @@ open_next_factory (EcoreIMFContextISF *ic)
2103} 2159}
2104 2160
2105static void 2161static void
2106open_previous_factory (EcoreIMFContextISF *ic) 2162open_previous_factory(EcoreIMFContextISF *ic)
2107{ 2163{
2108 if (ic == NULL) 2164 if (ic == NULL)
2109 return; 2165 return;
2110 2166
2111 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; 2167 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2112 IMEngineFactoryPointer sf = _backend->get_previous_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); 2168 IMEngineFactoryPointer sf = _backend->get_previous_factory("", "UTF-8", ic->impl->si->get_factory_uuid());
2113 2169
2114 if (!sf.null ()) 2170 if (!sf.null())
2115 { 2171 {
2116 turn_off_ic (ic); 2172 turn_off_ic(ic);
2117 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); 2173 ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
2118 ic->impl->si->set_frontend_data (static_cast <void*> (ic)); 2174 ic->impl->si->set_frontend_data(static_cast <void*>(ic));
2119 ic->impl->preedit_string = WideString (); 2175 ic->impl->preedit_string = WideString();
2120 ic->impl->preedit_caret = 0; 2176 ic->impl->preedit_caret = 0;
2121 attach_instance (ic->impl->si); 2177 attach_instance(ic->impl->si);
2122 _backend->set_default_factory (_language, sf->get_uuid ()); 2178 _backend->set_default_factory(_language, sf->get_uuid());
2123 _panel_client.register_input_context (ic->id, sf->get_uuid ()); 2179 _panel_client.register_input_context(ic->id, sf->get_uuid());
2124 set_ic_capabilities (ic); 2180 set_ic_capabilities(ic);
2125 turn_on_ic (ic); 2181 turn_on_ic(ic);
2126 2182
2127 if (_shared_input_method) 2183 if (_shared_input_method)
2128 { 2184 {
@@ -2133,7 +2189,7 @@ open_previous_factory (EcoreIMFContextISF *ic)
2133} 2189}
2134 2190
2135static void 2191static void
2136open_specific_factory (EcoreIMFContextISF *ic, 2192open_specific_factory(EcoreIMFContextISF *ic,
2137 const String &uuid) 2193 const String &uuid)
2138{ 2194{
2139 if (ic == NULL) 2195 if (ic == NULL)
@@ -2142,26 +2198,26 @@ open_specific_factory (EcoreIMFContextISF *ic,
2142 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; 2198 SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n";
2143 2199
2144 // The same input method is selected, just turn on the IC. 2200 // The same input method is selected, just turn on the IC.
2145 if (ic->impl->si->get_factory_uuid () == uuid) 2201 if (ic->impl->si->get_factory_uuid() == uuid)
2146 { 2202 {
2147 turn_on_ic (ic); 2203 turn_on_ic(ic);
2148 return; 2204 return;
2149 } 2205 }
2150 2206
2151 IMEngineFactoryPointer sf = _backend->get_factory (uuid); 2207 IMEngineFactoryPointer sf = _backend->get_factory(uuid);
2152 2208
2153 if (uuid.length () && !sf.null ()) 2209 if (uuid.length() && !sf.null())
2154 { 2210 {
2155 turn_off_ic (ic); 2211 turn_off_ic(ic);
2156 ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); 2212 ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id());
2157 ic->impl->si->set_frontend_data (static_cast <void*> (ic)); 2213 ic->impl->si->set_frontend_data(static_cast <void*>(ic));
2158 ic->impl->preedit_string = WideString (); 2214 ic->impl->preedit_string = WideString();
2159 ic->impl->preedit_caret = 0; 2215 ic->impl->preedit_caret = 0;
2160 attach_instance (ic->impl->si); 2216 attach_instance(ic->impl->si);
2161 _backend->set_default_factory (_language, sf->get_uuid ()); 2217 _backend->set_default_factory(_language, sf->get_uuid());
2162 _panel_client.register_input_context (ic->id, sf->get_uuid ()); 2218 _panel_client.register_input_context(ic->id, sf->get_uuid());
2163 set_ic_capabilities (ic); 2219 set_ic_capabilities(ic);
2164 turn_on_ic (ic); 2220 turn_on_ic(ic);
2165 2221
2166 if (_shared_input_method) 2222 if (_shared_input_method)
2167 { 2223 {
@@ -2171,29 +2227,29 @@ open_specific_factory (EcoreIMFContextISF *ic,
2171 } 2227 }
2172 else 2228 else
2173 { 2229 {
2174 // turn_off_ic comment out panel_req_update_factory_info () 2230 // turn_off_ic comment out panel_req_update_factory_info()
2175 turn_off_ic (ic); 2231 turn_off_ic(ic);
2176 if (ic && ic->impl->is_on) 2232 if (ic && ic->impl->is_on)
2177 { 2233 {
2178 ic->impl->is_on = false; 2234 ic->impl->is_on = false;
2179 2235
2180 if (ic == _focused_ic) 2236 if (ic == _focused_ic)
2181 { 2237 {
2182 ic->impl->si->focus_out (); 2238 ic->impl->si->focus_out();
2183 2239
2184 panel_req_update_factory_info (ic); 2240 panel_req_update_factory_info(ic);
2185 _panel_client.turn_off (ic->id); 2241 _panel_client.turn_off(ic->id);
2186 } 2242 }
2187 2243
2188 //Record the IC on/off status 2244 //Record the IC on/off status
2189 if (_shared_input_method) 2245 if (_shared_input_method)
2190 _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); 2246 _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false);
2191 2247
2192 if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) 2248 if (ic->impl->use_preedit && ic->impl->preedit_string.length())
2193 { 2249 {
2194 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2250 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2195 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2251 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2196 ecore_imf_context_preedit_end_event_add (ic->ctx); 2252 ecore_imf_context_preedit_end_event_add(ic->ctx);
2197 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); 2253 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2198 ic->impl->preedit_started = false; 2254 ic->impl->preedit_started = false;
2199 } 2255 }
@@ -2201,7 +2257,7 @@ open_specific_factory (EcoreIMFContextISF *ic,
2201 } 2257 }
2202} 2258}
2203 2259
2204static void initialize_modifier_bits (Display *display) 2260static void initialize_modifier_bits(Display *display)
2205{ 2261{
2206 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2262 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2207 2263
@@ -2222,21 +2278,21 @@ static void initialize_modifier_bits (Display *display)
2222 2278
2223 XModifierKeymap *mods = NULL; 2279 XModifierKeymap *mods = NULL;
2224 2280
2225 ::KeyCode ctrl_l = XKeysymToKeycode (display, XK_Control_L); 2281 ::KeyCode ctrl_l = XKeysymToKeycode(display, XK_Control_L);
2226 ::KeyCode ctrl_r = XKeysymToKeycode (display, XK_Control_R); 2282 ::KeyCode ctrl_r = XKeysymToKeycode(display, XK_Control_R);
2227 ::KeyCode meta_l = XKeysymToKeycode (display, XK_Meta_L); 2283 ::KeyCode meta_l = XKeysymToKeycode(display, XK_Meta_L);
2228 ::KeyCode meta_r = XKeysymToKeycode (display, XK_Meta_R); 2284 ::KeyCode meta_r = XKeysymToKeycode(display, XK_Meta_R);
2229 ::KeyCode alt_l = XKeysymToKeycode (display, XK_Alt_L); 2285 ::KeyCode alt_l = XKeysymToKeycode(display, XK_Alt_L);
2230 ::KeyCode alt_r = XKeysymToKeycode (display, XK_Alt_R); 2286 ::KeyCode alt_r = XKeysymToKeycode(display, XK_Alt_R);
2231 ::KeyCode super_l = XKeysymToKeycode (display, XK_Super_L); 2287 ::KeyCode super_l = XKeysymToKeycode(display, XK_Super_L);
2232 ::KeyCode super_r = XKeysymToKeycode (display, XK_Super_R); 2288 ::KeyCode super_r = XKeysymToKeycode(display, XK_Super_R);
2233 ::KeyCode hyper_l = XKeysymToKeycode (display, XK_Hyper_L); 2289 ::KeyCode hyper_l = XKeysymToKeycode(display, XK_Hyper_L);
2234 ::KeyCode hyper_r = XKeysymToKeycode (display, XK_Hyper_R); 2290 ::KeyCode hyper_r = XKeysymToKeycode(display, XK_Hyper_R);
2235 ::KeyCode numlock = XKeysymToKeycode (display, XK_Num_Lock); 2291 ::KeyCode numlock = XKeysymToKeycode(display, XK_Num_Lock);
2236 2292
2237 int i, j; 2293 int i, j;
2238 2294
2239 mods = XGetModifierMapping (display); 2295 mods = XGetModifierMapping(display);
2240 if (mods == NULL) 2296 if (mods == NULL)
2241 return; 2297 return;
2242 2298
@@ -2283,13 +2339,13 @@ static void initialize_modifier_bits (Display *display)
2283 xkey.same_screen = False; 2339 xkey.same_screen = False;
2284 xkey.subwindow = None; 2340 xkey.subwindow = None;
2285 xkey.window = None; 2341 xkey.window = None;
2286 xkey.root = DefaultRootWindow (display); 2342 xkey.root = DefaultRootWindow(display);
2287 xkey.state = ShiftMask; 2343 xkey.state = ShiftMask;
2288 2344
2289 xkey.keycode = meta_l; 2345 xkey.keycode = meta_l;
2290 XLookupString (&xkey, buf, 32, &keysym_l, 0); 2346 XLookupString(&xkey, buf, 32, &keysym_l, 0);
2291 xkey.keycode = meta_r; 2347 xkey.keycode = meta_r;
2292 XLookupString (&xkey, buf, 32, &keysym_r, 0); 2348 XLookupString(&xkey, buf, 32, &keysym_r, 0);
2293 2349
2294 if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R)) 2350 if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R))
2295 __current_meta_mask = ShiftMask + __current_alt_mask; 2351 __current_meta_mask = ShiftMask + __current_alt_mask;
@@ -2297,16 +2353,16 @@ static void initialize_modifier_bits (Display *display)
2297 __current_meta_mask = ShiftMask + ControlMask; 2353 __current_meta_mask = ShiftMask + ControlMask;
2298 } 2354 }
2299 2355
2300 XFreeModifiermap (mods); 2356 XFreeModifiermap(mods);
2301} 2357}
2302 2358
2303static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask) 2359static unsigned int scim_x11_keymask_scim_to_x11(Display *display, uint16 scimkeymask)
2304{ 2360{
2305 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2361 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2306 2362
2307 unsigned int state = 0; 2363 unsigned int state = 0;
2308 2364
2309 initialize_modifier_bits (display); 2365 initialize_modifier_bits(display);
2310 2366
2311 if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask; 2367 if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask;
2312 if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask; 2368 if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask;
@@ -2320,9 +2376,9 @@ static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimk
2320 return state; 2376 return state;
2321} 2377}
2322 2378
2323static XKeyEvent createKeyEvent (Display *display, Window &win, 2379static XKeyEvent createKeyEvent(Display *display, Window &win,
2324 Window &winRoot, bool press, 2380 Window &winRoot, bool press,
2325 int keycode, int modifiers) 2381 int keycode, int modifiers)
2326{ 2382{
2327 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2383 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2328 2384
@@ -2339,7 +2395,7 @@ static XKeyEvent createKeyEvent (Display *display, Window &win,
2339 event.y_root = 1; 2395 event.y_root = 1;
2340 event.same_screen = EINA_TRUE; 2396 event.same_screen = EINA_TRUE;
2341 event.state = modifiers; 2397 event.state = modifiers;
2342 event.keycode = XKeysymToKeycode (display, keycode); 2398 event.keycode = XKeysymToKeycode(display, keycode);
2343 if (press) 2399 if (press)
2344 event.type = KeyPress; 2400 event.type = KeyPress;
2345 else 2401 else
@@ -2350,12 +2406,12 @@ static XKeyEvent createKeyEvent (Display *display, Window &win,
2350 return event; 2406 return event;
2351} 2407}
2352 2408
2353static void _x_send_key_event (const KeyEvent &key) 2409static void _x_send_key_event(const KeyEvent &key)
2354{ 2410{
2355 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2411 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2356 2412
2357 // Obtain the X11 display. 2413 // Obtain the X11 display.
2358 Display *display = XOpenDisplay (NULL); 2414 Display *display = XOpenDisplay(NULL);
2359 if (display == NULL) 2415 if (display == NULL)
2360 { 2416 {
2361 std::cerr << "XOpenDisplay failed\n"; 2417 std::cerr << "XOpenDisplay failed\n";
@@ -2363,98 +2419,98 @@ static void _x_send_key_event (const KeyEvent &key)
2363 } 2419 }
2364 2420
2365 // Get the root window for the current display. 2421 // Get the root window for the current display.
2366 Window winRoot = 0;// = XRootWindow (display, 1); 2422 Window winRoot = 0;
2367 2423
2368 // Find the window which has the current keyboard focus. 2424 // Find the window which has the current keyboard focus.
2369 Window winFocus = 0; 2425 Window winFocus = 0;
2370 int revert = RevertToParent; 2426 int revert = RevertToParent;
2371 2427
2372 XGetInputFocus (display, &winFocus, &revert); 2428 XGetInputFocus(display, &winFocus, &revert);
2373 2429
2374 // Send a fake key press event to the window. 2430 // Send a fake key press event to the window.
2375 XSelectInput (display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); 2431 XSelectInput(display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask);
2376 XMapWindow (display, winFocus); 2432 XMapWindow(display, winFocus);
2377 2433
2378 unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask); 2434 unsigned int modifier = scim_x11_keymask_scim_to_x11(display, key.mask);
2379 XKeyEvent event; 2435 XKeyEvent event;
2380 if (key.is_key_press ()) 2436 if (key.is_key_press())
2381 { 2437 {
2382 event = createKeyEvent (display, winFocus, winRoot, true, key.code, modifier); 2438 event = createKeyEvent(display, winFocus, winRoot, true, key.code, modifier);
2383 XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event); 2439 XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event);
2384 } 2440 }
2385 else 2441 else
2386 { 2442 {
2387 event = createKeyEvent (display, winFocus, winRoot, false, key.code, modifier); 2443 event = createKeyEvent(display, winFocus, winRoot, false, key.code, modifier);
2388 XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event); 2444 XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
2389 } 2445 }
2390 2446
2391 XCloseDisplay (display); 2447 XCloseDisplay(display);
2392} 2448}
2393 2449
2394static void 2450static void
2395attach_instance (const IMEngineInstancePointer &si) 2451attach_instance(const IMEngineInstancePointer &si)
2396{ 2452{
2397 si->signal_connect_show_preedit_string ( 2453 si->signal_connect_show_preedit_string(
2398 slot (slot_show_preedit_string)); 2454 slot(slot_show_preedit_string));
2399 si->signal_connect_show_aux_string ( 2455 si->signal_connect_show_aux_string(
2400 slot (slot_show_aux_string)); 2456 slot(slot_show_aux_string));
2401 si->signal_connect_show_lookup_table ( 2457 si->signal_connect_show_lookup_table(
2402 slot (slot_show_lookup_table)); 2458 slot(slot_show_lookup_table));
2403 2459
2404 si->signal_connect_hide_preedit_string ( 2460 si->signal_connect_hide_preedit_string(
2405 slot (slot_hide_preedit_string)); 2461 slot(slot_hide_preedit_string));
2406 si->signal_connect_hide_aux_string ( 2462 si->signal_connect_hide_aux_string(
2407 slot (slot_hide_aux_string)); 2463 slot(slot_hide_aux_string));
2408 si->signal_connect_hide_lookup_table ( 2464 si->signal_connect_hide_lookup_table(
2409 slot (slot_hide_lookup_table)); 2465 slot(slot_hide_lookup_table));
2410 2466
2411 si->signal_connect_update_preedit_caret ( 2467 si->signal_connect_update_preedit_caret(
2412 slot (slot_update_preedit_caret)); 2468 slot(slot_update_preedit_caret));
2413 si->signal_connect_update_preedit_string ( 2469 si->signal_connect_update_preedit_string(
2414 slot (slot_update_preedit_string)); 2470 slot(slot_update_preedit_string));
2415 si->signal_connect_update_aux_string ( 2471 si->signal_connect_update_aux_string(
2416 slot (slot_update_aux_string)); 2472 slot(slot_update_aux_string));
2417 si->signal_connect_update_lookup_table ( 2473 si->signal_connect_update_lookup_table(
2418 slot (slot_update_lookup_table)); 2474 slot(slot_update_lookup_table));
2419 2475
2420 si->signal_connect_commit_string ( 2476 si->signal_connect_commit_string(
2421 slot (slot_commit_string)); 2477 slot(slot_commit_string));
2422 2478
2423 si->signal_connect_forward_key_event ( 2479 si->signal_connect_forward_key_event(
2424 slot (slot_forward_key_event)); 2480 slot(slot_forward_key_event));
2425 2481
2426 si->signal_connect_register_properties ( 2482 si->signal_connect_register_properties(
2427 slot (slot_register_properties)); 2483 slot(slot_register_properties));
2428 2484
2429 si->signal_connect_update_property ( 2485 si->signal_connect_update_property(
2430 slot (slot_update_property)); 2486 slot(slot_update_property));
2431 2487
2432 si->signal_connect_beep ( 2488 si->signal_connect_beep(
2433 slot (slot_beep)); 2489 slot(slot_beep));
2434 2490
2435 si->signal_connect_start_helper ( 2491 si->signal_connect_start_helper(
2436 slot (slot_start_helper)); 2492 slot(slot_start_helper));
2437 2493
2438 si->signal_connect_stop_helper ( 2494 si->signal_connect_stop_helper(
2439 slot (slot_stop_helper)); 2495 slot(slot_stop_helper));
2440 2496
2441 si->signal_connect_send_helper_event ( 2497 si->signal_connect_send_helper_event(
2442 slot (slot_send_helper_event)); 2498 slot(slot_send_helper_event));
2443 2499
2444 si->signal_connect_get_surrounding_text ( 2500 si->signal_connect_get_surrounding_text(
2445 slot (slot_get_surrounding_text)); 2501 slot(slot_get_surrounding_text));
2446 2502
2447 si->signal_connect_delete_surrounding_text ( 2503 si->signal_connect_delete_surrounding_text(
2448 slot (slot_delete_surrounding_text)); 2504 slot(slot_delete_surrounding_text));
2449} 2505}
2450 2506
2451// Implementation of slot functions 2507// Implementation of slot functions
2452static void 2508static void
2453slot_show_preedit_string (IMEngineInstanceBase *si) 2509slot_show_preedit_string(IMEngineInstanceBase *si)
2454{ 2510{
2455 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2511 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2456 2512
2457 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2513 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2458 2514
2459 if (ic && ic->impl && _focused_ic == ic) 2515 if (ic && ic->impl && _focused_ic == ic)
2460 { 2516 {
@@ -2462,102 +2518,102 @@ slot_show_preedit_string (IMEngineInstanceBase *si)
2462 { 2518 {
2463 if (!ic->impl->preedit_started) 2519 if (!ic->impl->preedit_started)
2464 { 2520 {
2465 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); 2521 ecore_imf_context_preedit_start_event_add(_focused_ic->ctx);
2466 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 2522 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2467 ic->impl->preedit_started = true; 2523 ic->impl->preedit_started = true;
2468 } 2524 }
2469 } 2525 }
2470 else 2526 else
2471 _panel_client.show_preedit_string (ic->id); 2527 _panel_client.show_preedit_string(ic->id);
2472 } 2528 }
2473} 2529}
2474 2530
2475static void 2531static void
2476slot_show_aux_string (IMEngineInstanceBase *si) 2532slot_show_aux_string(IMEngineInstanceBase *si)
2477{ 2533{
2478 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2534 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2479 2535
2480 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2536 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2481 2537
2482 if (ic && ic->impl && _focused_ic == ic) 2538 if (ic && ic->impl && _focused_ic == ic)
2483 _panel_client.show_aux_string (ic->id); 2539 _panel_client.show_aux_string(ic->id);
2484} 2540}
2485 2541
2486static void 2542static void
2487slot_show_lookup_table (IMEngineInstanceBase *si) 2543slot_show_lookup_table(IMEngineInstanceBase *si)
2488{ 2544{
2489 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2545 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2490 2546
2491 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2547 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2492 2548
2493 if (ic && ic->impl && _focused_ic == ic) 2549 if (ic && ic->impl && _focused_ic == ic)
2494 _panel_client.show_lookup_table (ic->id); 2550 _panel_client.show_lookup_table(ic->id);
2495} 2551}
2496 2552
2497static void 2553static void
2498slot_hide_preedit_string (IMEngineInstanceBase *si) 2554slot_hide_preedit_string(IMEngineInstanceBase *si)
2499{ 2555{
2500 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2556 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2501 2557
2502 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2558 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2503 2559
2504 if (ic && ic->impl && _focused_ic == ic) 2560 if (ic && ic->impl && _focused_ic == ic)
2505 { 2561 {
2506 bool emit = false; 2562 bool emit = false;
2507 if (ic->impl->preedit_string.length ()) 2563 if (ic->impl->preedit_string.length())
2508 { 2564 {
2509 ic->impl->preedit_string = WideString (); 2565 ic->impl->preedit_string = WideString();
2510 ic->impl->preedit_caret = 0; 2566 ic->impl->preedit_caret = 0;
2511 ic->impl->preedit_attrlist.clear (); 2567 ic->impl->preedit_attrlist.clear();
2512 emit = true; 2568 emit = true;
2513 } 2569 }
2514 if (ic->impl->use_preedit) 2570 if (ic->impl->use_preedit)
2515 { 2571 {
2516 if (emit) 2572 if (emit)
2517 { 2573 {
2518 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2574 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2519 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2575 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2520 } 2576 }
2521 if (ic->impl->preedit_started) 2577 if (ic->impl->preedit_started)
2522 { 2578 {
2523 ecore_imf_context_preedit_end_event_add (ic->ctx); 2579 ecore_imf_context_preedit_end_event_add(ic->ctx);
2524 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); 2580 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL);
2525 ic->impl->preedit_started = false; 2581 ic->impl->preedit_started = false;
2526 } 2582 }
2527 } 2583 }
2528 else 2584 else
2529 _panel_client.hide_preedit_string (ic->id); 2585 _panel_client.hide_preedit_string(ic->id);
2530 } 2586 }
2531} 2587}
2532 2588
2533static void 2589static void
2534slot_hide_aux_string (IMEngineInstanceBase *si) 2590slot_hide_aux_string(IMEngineInstanceBase *si)
2535{ 2591{
2536 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2592 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2537 2593
2538 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2594 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2539 2595
2540 if (ic && ic->impl && _focused_ic == ic) 2596 if (ic && ic->impl && _focused_ic == ic)
2541 _panel_client.hide_aux_string (ic->id); 2597 _panel_client.hide_aux_string(ic->id);
2542} 2598}
2543 2599
2544static void 2600static void
2545slot_hide_lookup_table (IMEngineInstanceBase *si) 2601slot_hide_lookup_table(IMEngineInstanceBase *si)
2546{ 2602{
2547 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2603 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2548 2604
2549 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2605 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2550 2606
2551 if (ic && ic->impl && _focused_ic == ic) 2607 if (ic && ic->impl && _focused_ic == ic)
2552 _panel_client.hide_lookup_table (ic->id); 2608 _panel_client.hide_lookup_table(ic->id);
2553} 2609}
2554 2610
2555static void 2611static void
2556slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) 2612slot_update_preedit_caret(IMEngineInstanceBase *si, int caret)
2557{ 2613{
2558 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2614 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2559 2615
2560 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2616 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2561 2617
2562 if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) 2618 if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret)
2563 { 2619 {
@@ -2566,28 +2622,28 @@ slot_update_preedit_caret (IMEngineInstanceBase *si, int caret)
2566 { 2622 {
2567 if (!ic->impl->preedit_started) 2623 if (!ic->impl->preedit_started)
2568 { 2624 {
2569 ecore_imf_context_preedit_start_event_add (ic->ctx); 2625 ecore_imf_context_preedit_start_event_add(ic->ctx);
2570 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 2626 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2571 ic->impl->preedit_started = true; 2627 ic->impl->preedit_started = true;
2572 } 2628 }
2573 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2629 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2574 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2630 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2575 } 2631 }
2576 else 2632 else
2577 _panel_client.update_preedit_caret (ic->id, caret); 2633 _panel_client.update_preedit_caret(ic->id, caret);
2578 } 2634 }
2579} 2635}
2580 2636
2581static void 2637static void
2582slot_update_preedit_string (IMEngineInstanceBase *si, 2638slot_update_preedit_string(IMEngineInstanceBase *si,
2583 const WideString & str, 2639 const WideString & str,
2584 const AttributeList & attrs) 2640 const AttributeList & attrs)
2585{ 2641{
2586 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2642 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2587 2643
2588 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2644 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2589 2645
2590 if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ())) 2646 if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length()))
2591 { 2647 {
2592 ic->impl->preedit_string = str; 2648 ic->impl->preedit_string = str;
2593 ic->impl->preedit_attrlist = attrs; 2649 ic->impl->preedit_attrlist = attrs;
@@ -2595,178 +2651,178 @@ slot_update_preedit_string (IMEngineInstanceBase *si,
2595 { 2651 {
2596 if (!ic->impl->preedit_started) 2652 if (!ic->impl->preedit_started)
2597 { 2653 {
2598 ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); 2654 ecore_imf_context_preedit_start_event_add(_focused_ic->ctx);
2599 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); 2655 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL);
2600 ic->impl->preedit_started = true; 2656 ic->impl->preedit_started = true;
2601 } 2657 }
2602 ic->impl->preedit_caret = str.length (); 2658 ic->impl->preedit_caret = str.length();
2603 ic->impl->preedit_updating = true; 2659 ic->impl->preedit_updating = true;
2604 ecore_imf_context_preedit_changed_event_add (ic->ctx); 2660 ecore_imf_context_preedit_changed_event_add(ic->ctx);
2605 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); 2661 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL);
2606 ic->impl->preedit_updating = false; 2662 ic->impl->preedit_updating = false;
2607 } 2663 }
2608 else 2664 else
2609 { 2665 {
2610 _panel_client.update_preedit_string (ic->id, str, attrs); 2666 _panel_client.update_preedit_string(ic->id, str, attrs);
2611 } 2667 }
2612 } 2668 }
2613} 2669}
2614 2670
2615static void 2671static void
2616slot_update_aux_string (IMEngineInstanceBase *si, 2672slot_update_aux_string(IMEngineInstanceBase *si,
2617 const WideString & str, 2673 const WideString & str,
2618 const AttributeList & attrs) 2674 const AttributeList & attrs)
2619{ 2675{
2620 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2676 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2621 2677
2622 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2678 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2623 2679
2624 if (ic && ic->impl && _focused_ic == ic) 2680 if (ic && ic->impl && _focused_ic == ic)
2625 _panel_client.update_aux_string (ic->id, str, attrs); 2681 _panel_client.update_aux_string(ic->id, str, attrs);
2626} 2682}
2627 2683
2628static void 2684static void
2629slot_commit_string (IMEngineInstanceBase *si, 2685slot_commit_string(IMEngineInstanceBase *si,
2630 const WideString & str) 2686 const WideString & str)
2631{ 2687{
2632 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2688 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2633 2689
2634 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2690 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2635 2691
2636 if (ic && ic->ctx) 2692 if (ic && ic->ctx)
2637 { 2693 {
2638 ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (str).c_str ()); 2694 ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(str).c_str());
2639 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); 2695 ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
2640 } 2696 }
2641} 2697}
2642 2698
2643static void 2699static void
2644slot_forward_key_event (IMEngineInstanceBase *si, 2700slot_forward_key_event(IMEngineInstanceBase *si,
2645 const KeyEvent & key) 2701 const KeyEvent & key)
2646{ 2702{
2647 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2703 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2648 2704
2649 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2705 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2650 2706
2651 if (ic && _focused_ic == ic) 2707 if (ic && _focused_ic == ic)
2652 { 2708 {
2653 if (!_fallback_instance->process_key_event (key)) 2709 if (!_fallback_instance->process_key_event(key))
2654 _x_send_key_event(key); 2710 _x_send_key_event(key);
2655 } 2711 }
2656} 2712}
2657 2713
2658static void 2714static void
2659slot_update_lookup_table (IMEngineInstanceBase *si, 2715slot_update_lookup_table(IMEngineInstanceBase *si,
2660 const LookupTable & table) 2716 const LookupTable & table)
2661{ 2717{
2662 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2718 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2663 2719
2664 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2720 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2665 2721
2666 if (ic && ic->impl && _focused_ic == ic) 2722 if (ic && ic->impl && _focused_ic == ic)
2667 _panel_client.update_lookup_table (ic->id, table); 2723 _panel_client.update_lookup_table(ic->id, table);
2668} 2724}
2669 2725
2670static void 2726static void
2671slot_register_properties (IMEngineInstanceBase *si, 2727slot_register_properties(IMEngineInstanceBase *si,
2672 const PropertyList & properties) 2728 const PropertyList & properties)
2673{ 2729{
2674 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2730 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2675 2731
2676 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2732 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2677 2733
2678 if (ic && ic->impl && _focused_ic == ic) 2734 if (ic && ic->impl && _focused_ic == ic)
2679 _panel_client.register_properties (ic->id, properties); 2735 _panel_client.register_properties(ic->id, properties);
2680} 2736}
2681 2737
2682static void 2738static void
2683slot_update_property (IMEngineInstanceBase *si, 2739slot_update_property(IMEngineInstanceBase *si,
2684 const Property & property) 2740 const Property & property)
2685{ 2741{
2686 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2742 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2687 2743
2688 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2744 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2689 2745
2690 if (ic && ic->impl && _focused_ic == ic) 2746 if (ic && ic->impl && _focused_ic == ic)
2691 _panel_client.update_property (ic->id, property); 2747 _panel_client.update_property(ic->id, property);
2692} 2748}
2693 2749
2694static void 2750static void
2695slot_beep (IMEngineInstanceBase *si __UNUSED__) 2751slot_beep(IMEngineInstanceBase *si __UNUSED__)
2696{ 2752{
2697 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2753 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2698} 2754}
2699 2755
2700static void 2756static void
2701slot_start_helper (IMEngineInstanceBase *si, 2757slot_start_helper(IMEngineInstanceBase *si,
2702 const String &helper_uuid) 2758 const String &helper_uuid)
2703{ 2759{
2704 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2760 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2705 2761
2706 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" 2762 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
2707 << (ic ? ic->id : -1) << " ic=" << ic 2763 << (ic ? ic->id : -1) << " ic=" << ic
2708 << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; 2764 << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid() : "") << "...\n";
2709 2765
2710 if (ic && ic->impl) 2766 if (ic && ic->impl)
2711 _panel_client.start_helper (ic->id, helper_uuid); 2767 _panel_client.start_helper(ic->id, helper_uuid);
2712} 2768}
2713 2769
2714static void 2770static void
2715slot_stop_helper (IMEngineInstanceBase *si, 2771slot_stop_helper(IMEngineInstanceBase *si,
2716 const String &helper_uuid) 2772 const String &helper_uuid)
2717{ 2773{
2718 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2774 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2719 2775
2720 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n"; 2776 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n";
2721 2777
2722 if (ic && ic->impl) 2778 if (ic && ic->impl)
2723 _panel_client.stop_helper (ic->id, helper_uuid); 2779 _panel_client.stop_helper(ic->id, helper_uuid);
2724} 2780}
2725 2781
2726static void 2782static void
2727slot_send_helper_event (IMEngineInstanceBase *si, 2783slot_send_helper_event(IMEngineInstanceBase *si,
2728 const String &helper_uuid, 2784 const String &helper_uuid,
2729 const Transaction &trans) 2785 const Transaction &trans)
2730{ 2786{
2731 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2787 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2732 2788
2733 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" 2789 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context="
2734 << (ic ? ic->id : -1) << " ic=" << ic 2790 << (ic ? ic->id : -1) << " ic=" << ic
2735 << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; 2791 << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid() : "") << "...\n";
2736 2792
2737 if (ic && ic->impl) 2793 if (ic && ic->impl)
2738 _panel_client.send_helper_event (ic->id, helper_uuid, trans); 2794 _panel_client.send_helper_event(ic->id, helper_uuid, trans);
2739} 2795}
2740 2796
2741static bool 2797static bool
2742slot_get_surrounding_text (IMEngineInstanceBase *si, 2798slot_get_surrounding_text(IMEngineInstanceBase *si,
2743 WideString &text, 2799 WideString &text,
2744 int &cursor, 2800 int &cursor,
2745 int maxlen_before, 2801 int maxlen_before,
2746 int maxlen_after) 2802 int maxlen_after)
2747{ 2803{
2748 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2804 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2749 2805
2750 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2806 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2751 2807
2752 if (ic && ic->impl && _focused_ic == ic) 2808 if (ic && ic->impl && _focused_ic == ic)
2753 { 2809 {
2754 char *surrounding = NULL; 2810 char *surrounding = NULL;
2755 int cursor_index; 2811 int cursor_index;
2756 if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index)) 2812 if (ecore_imf_context_surrounding_get(_focused_ic->ctx, &surrounding, &cursor_index))
2757 { 2813 {
2758 SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n"; 2814 SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n";
2759 SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n"; 2815 SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n";
2760 WideString before (utf8_mbstowcs (String (surrounding, surrounding + cursor_index))); 2816 WideString before(utf8_mbstowcs(String(surrounding, surrounding + cursor_index)));
2761 WideString after (utf8_mbstowcs (String (surrounding + cursor_index))); 2817 WideString after(utf8_mbstowcs(String(surrounding + cursor_index)));
2762 if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length ()) 2818 if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length())
2763 before = WideString (before.begin () + (before.length () - maxlen_before), before.end ()); 2819 before = WideString(before.begin() + (before.length() - maxlen_before), before.end());
2764 else if (maxlen_before == 0) before = WideString (); 2820 else if (maxlen_before == 0) before = WideString();
2765 if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length ()) 2821 if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length())
2766 after = WideString (after.begin (), after.begin () + maxlen_after); 2822 after = WideString(after.begin(), after.begin() + maxlen_after);
2767 else if (maxlen_after == 0) after = WideString (); 2823 else if (maxlen_after == 0) after = WideString();
2768 text = before + after; 2824 text = before + after;
2769 cursor = before.length (); 2825 cursor = before.length();
2770 return true; 2826 return true;
2771 } 2827 }
2772 } 2828 }
@@ -2774,13 +2830,13 @@ slot_get_surrounding_text (IMEngineInstanceBase *si,
2774} 2830}
2775 2831
2776static bool 2832static bool
2777slot_delete_surrounding_text (IMEngineInstanceBase *si, 2833slot_delete_surrounding_text(IMEngineInstanceBase *si,
2778 int offset, 2834 int offset,
2779 int len) 2835 int len)
2780{ 2836{
2781 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2837 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2782 2838
2783 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *> (si->get_frontend_data ()); 2839 EcoreIMFContextISF *ic = static_cast<EcoreIMFContextISF *>(si->get_frontend_data());
2784 2840
2785 if (ic && ic->impl && _focused_ic == ic) 2841 if (ic && ic->impl && _focused_ic == ic)
2786 { 2842 {
@@ -2788,7 +2844,7 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si,
2788 ev.ctx = _focused_ic->ctx; 2844 ev.ctx = _focused_ic->ctx;
2789 ev.n_chars = len; 2845 ev.n_chars = len;
2790 ev.offset = offset; 2846 ev.offset = offset;
2791 ecore_imf_context_delete_surrounding_event_add (_focused_ic->ctx, offset, len); 2847 ecore_imf_context_delete_surrounding_event_add(_focused_ic->ctx, offset, len);
2792 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev); 2848 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev);
2793 return true; 2849 return true;
2794 } 2850 }
@@ -2796,43 +2852,43 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si,
2796} 2852}
2797 2853
2798static void 2854static void
2799reload_config_callback (const ConfigPointer &config) 2855reload_config_callback(const ConfigPointer &config)
2800{ 2856{
2801 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2857 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2802 2858
2803 _frontend_hotkey_matcher.load_hotkeys (config); 2859 _frontend_hotkey_matcher.load_hotkeys(config);
2804 _imengine_hotkey_matcher.load_hotkeys (config); 2860 _imengine_hotkey_matcher.load_hotkeys(config);
2805 2861
2806 KeyEvent key; 2862 KeyEvent key;
2807 2863
2808 scim_string_to_key (key, 2864 scim_string_to_key(key,
2809 config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK), 2865 config->read(String(SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK),
2810 String ("Shift+Control+Alt+Lock"))); 2866 String("Shift+Control+Alt+Lock")));
2811 2867
2812 _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF; 2868 _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF;
2813 _valid_key_mask |= SCIM_KEY_ReleaseMask; 2869 _valid_key_mask |= SCIM_KEY_ReleaseMask;
2814 // Special treatment for two backslash keys on jp106 keyboard. 2870 // Special treatment for two backslash keys on jp106 keyboard.
2815 _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask; 2871 _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask;
2816 2872
2817 _on_the_spot = config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); 2873 _on_the_spot = config->read(String(SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot);
2818 _shared_input_method = config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); 2874 _shared_input_method = config->read(String(SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method);
2819 2875
2820 // Get keyboard layout setting 2876 // Get keyboard layout setting
2821 // Flush the global config first, in order to load the new configs from disk. 2877 // Flush the global config first, in order to load the new configs from disk.
2822 scim_global_config_flush (); 2878 scim_global_config_flush();
2823 2879
2824 _keyboard_layout = scim_get_default_keyboard_layout (); 2880 _keyboard_layout = scim_get_default_keyboard_layout();
2825} 2881}
2826 2882
2827static void 2883static void
2828fallback_commit_string_cb (IMEngineInstanceBase *si __UNUSED__, 2884fallback_commit_string_cb(IMEngineInstanceBase *si __UNUSED__,
2829 const WideString &str) 2885 const WideString &str)
2830{ 2886{
2831 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; 2887 SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
2832 2888
2833 if (_focused_ic && _focused_ic->impl) 2889 if (_focused_ic && _focused_ic->impl)
2834 { 2890 {
2835 ecore_imf_context_commit_event_add (_focused_ic->ctx, utf8_wcstombs (str).c_str ()); 2891 ecore_imf_context_commit_event_add(_focused_ic->ctx, utf8_wcstombs(str).c_str());
2836 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); 2892 ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str());
2837 } 2893 }
2838} 2894}
diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h
index 84f1a2f..72533e2 100644
--- a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h
+++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h
@@ -32,6 +32,8 @@ Eina_Bool isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event
32void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction); 32void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction);
33void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type); 33void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type);
34void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout); 34void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout);
35void isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx);
36void isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx);
35 37
36EcoreIMFContextISF* isf_imf_context_new (void); 38EcoreIMFContextISF* isf_imf_context_new (void);
37void isf_imf_context_shutdown (void); 39void isf_imf_context_shutdown (void);
diff --git a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp
index eff6381..d17e37a 100644
--- a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp
+++ b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp
@@ -19,8 +19,8 @@ extern "C"
19 isf_imf_context_del, /* del */ 19 isf_imf_context_del, /* del */
20 isf_imf_context_client_window_set, /* client_window_set */ 20 isf_imf_context_client_window_set, /* client_window_set */
21 isf_imf_context_client_canvas_set, /* client_canvas_set */ 21 isf_imf_context_client_canvas_set, /* client_canvas_set */
22 NULL, /* isf_imf_context_input_panel_show, - show */ 22 isf_imf_context_input_panel_show, /* input_panel_show, - show */
23 NULL, /* isf_imf_context_input_panel_hide, - hide */ 23 isf_imf_context_input_panel_hide, /* input_panel_hide, - hide */
24 isf_imf_context_preedit_string_get, /* get_preedit_string */ 24 isf_imf_context_preedit_string_get, /* get_preedit_string */
25 isf_imf_context_focus_in, /* focus_in */ 25 isf_imf_context_focus_in, /* focus_in */
26 isf_imf_context_focus_out, /* focus_out */ 26 isf_imf_context_focus_out, /* focus_out */
@@ -38,7 +38,12 @@ extern "C"
38 NULL, /* isf_imf_context_input_panel_layout_get, */ 38 NULL, /* isf_imf_context_input_panel_layout_get, */
39 NULL, /* isf_imf_context_input_panel_language_set, */ 39 NULL, /* isf_imf_context_input_panel_language_set, */
40 NULL, /* isf_imf_context_input_panel_language_get, */ 40 NULL, /* isf_imf_context_input_panel_language_get, */
41 isf_imf_context_cursor_location_set /* cursor_location_set */ 41 isf_imf_context_cursor_location_set, /* cursor_location_set */
42 NULL, /* input_panel_imdata_set */
43 NULL, /* input_panel_imdata_get */
44 NULL, /* input_panel_return_key_type_set */
45 NULL, /* input_panel_return_key_disabled_set */
46 NULL /* input_panel_caps_lock_mode_set */
42 }; 47 };
43 48
44 static Ecore_IMF_Context *imf_module_create (void); 49 static Ecore_IMF_Context *imf_module_create (void);
diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.in b/libraries/ecore/src/modules/immodules/xim/Makefile.in
index 5b78946..775b574 100644
--- a/libraries/ecore/src/modules/immodules/xim/Makefile.in
+++ b/libraries/ecore/src/modules/immodules/xim/Makefile.in
@@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 49 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 50 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
51 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 51 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
52 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 52 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
53 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 53 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
54 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 54 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
55 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 55 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
56 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 56 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
57 $(top_srcdir)/configure.ac
58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 57am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
59 $(ACLOCAL_M4) 58 $(ACLOCAL_M4)
60mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 59mkinstalldirs = $(install_sh) -d
61CONFIG_HEADER = $(top_builddir)/config.h 60CONFIG_HEADER = $(top_builddir)/config.h
62CONFIG_CLEAN_FILES = 61CONFIG_CLEAN_FILES =
63CONFIG_CLEAN_VPATH_FILES = 62CONFIG_CLEAN_VPATH_FILES =
@@ -189,6 +188,8 @@ EVAS_LIBS = @EVAS_LIBS@
189EVIL_CFLAGS = @EVIL_CFLAGS@ 188EVIL_CFLAGS = @EVIL_CFLAGS@
190EVIL_LIBS = @EVIL_LIBS@ 189EVIL_LIBS = @EVIL_LIBS@
191EXEEXT = @EXEEXT@ 190EXEEXT = @EXEEXT@
191EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
192EXOTIC_LIBS = @EXOTIC_LIBS@
192FGREP = @FGREP@ 193FGREP = @FGREP@
193GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 194GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
194GLIB_CFLAGS = @GLIB_CFLAGS@ 195GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -244,6 +245,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
244PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 245PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
245PIXMAN_LIBS = @PIXMAN_LIBS@ 246PIXMAN_LIBS = @PIXMAN_LIBS@
246PKG_CONFIG = @PKG_CONFIG@ 247PKG_CONFIG = @PKG_CONFIG@
248PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
249PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
247POSUB = @POSUB@ 250POSUB = @POSUB@
248RANLIB = @RANLIB@ 251RANLIB = @RANLIB@
249SCIM_CFLAGS = @SCIM_CFLAGS@ 252SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -254,6 +257,7 @@ SDL_LIBS = @SDL_LIBS@
254SED = @SED@ 257SED = @SED@
255SET_MAKE = @SET_MAKE@ 258SET_MAKE = @SET_MAKE@
256SHELL = @SHELL@ 259SHELL = @SHELL@
260SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
257SSL_CFLAGS = @SSL_CFLAGS@ 261SSL_CFLAGS = @SSL_CFLAGS@
258SSL_LIBS = @SSL_LIBS@ 262SSL_LIBS = @SSL_LIBS@
259STRIP = @STRIP@ 263STRIP = @STRIP@
diff --git a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c
index ea7ee7f..01a3576 100644
--- a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c
+++ b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c
@@ -294,6 +294,10 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx)
294 imf_context_data = ecore_imf_context_data_get(ctx); 294 imf_context_data = ecore_imf_context_data_get(ctx);
295 ic = imf_context_data->ic; 295 ic = imf_context_data->ic;
296 imf_context_data->has_focus = EINA_TRUE; 296 imf_context_data->has_focus = EINA_TRUE;
297
298 if (ecore_imf_context_input_panel_enabled_get(ctx))
299 ecore_imf_context_input_panel_show(ctx);
300
297 if (ic) 301 if (ic)
298 { 302 {
299 char *str; 303 char *str;
@@ -326,6 +330,9 @@ _ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx)
326 ic = imf_context_data->ic; 330 ic = imf_context_data->ic;
327 if (ic) 331 if (ic)
328 XUnsetICFocus(ic); 332 XUnsetICFocus(ic);
333
334 if (ecore_imf_context_input_panel_enabled_get(ctx))
335 ecore_imf_context_input_panel_hide(ctx);
329 } 336 }
330#else 337#else
331 (void)ctx; 338 (void)ctx;
@@ -501,6 +508,38 @@ _ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx,
501 (void)(w); // yes w is unused, but only a bi-product of the algorithm 508 (void)(w); // yes w is unused, but only a bi-product of the algorithm
502} 509}
503 510
511static void
512_ecore_imf_context_xim_input_panel_show(Ecore_IMF_Context *ctx)
513{
514 EINA_LOG_DBG("%s in", __FUNCTION__);
515
516#ifdef ENABLE_XIM
517 Ecore_IMF_Context_Data *imf_context_data;
518 imf_context_data = ecore_imf_context_data_get(ctx);
519
520 ecore_x_e_virtual_keyboard_state_set
521 (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON);
522#else
523 (void)ctx;
524#endif
525}
526
527static void
528_ecore_imf_context_xim_input_panel_hide(Ecore_IMF_Context *ctx)
529{
530 EINA_LOG_DBG("%s in", __FUNCTION__);
531
532#ifdef ENABLE_XIM
533 Ecore_IMF_Context_Data *imf_context_data;
534 imf_context_data = ecore_imf_context_data_get(ctx);
535
536 ecore_x_e_virtual_keyboard_state_set
537 (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF);
538#else
539 (void)ctx;
540#endif
541}
542
504#ifdef ENABLE_XIM 543#ifdef ENABLE_XIM
505static unsigned int 544static unsigned int
506_ecore_x_event_reverse_modifiers(unsigned int state) 545_ecore_x_event_reverse_modifiers(unsigned int state)
@@ -739,8 +778,8 @@ static Ecore_IMF_Context_Class xim_class = {
739 .del = _ecore_imf_context_xim_del, 778 .del = _ecore_imf_context_xim_del,
740 .client_window_set = _ecore_imf_context_xim_client_window_set, 779 .client_window_set = _ecore_imf_context_xim_client_window_set,
741 .client_canvas_set = NULL, 780 .client_canvas_set = NULL,
742 .show = NULL, 781 .show = _ecore_imf_context_xim_input_panel_show,
743 .hide = NULL, 782 .hide = _ecore_imf_context_xim_input_panel_hide,
744 .preedit_string_get = _ecore_imf_context_xim_preedit_string_get, 783 .preedit_string_get = _ecore_imf_context_xim_preedit_string_get,
745 .focus_in = _ecore_imf_context_xim_focus_in, 784 .focus_in = _ecore_imf_context_xim_focus_in,
746 .focus_out = _ecore_imf_context_xim_focus_out, 785 .focus_out = _ecore_imf_context_xim_focus_out,
@@ -759,6 +798,11 @@ static Ecore_IMF_Context_Class xim_class = {
759 .input_panel_language_set = NULL, 798 .input_panel_language_set = NULL,
760 .input_panel_language_get = NULL, 799 .input_panel_language_get = NULL,
761 .cursor_location_set = _ecore_imf_context_xim_cursor_location_set, 800 .cursor_location_set = _ecore_imf_context_xim_cursor_location_set,
801 .input_panel_imdata_set = NULL,
802 .input_panel_imdata_get = NULL,
803 .input_panel_return_key_type_set = NULL,
804 .input_panel_return_key_disabled_set = NULL,
805 .input_panel_caps_lock_mode_set = NULL
762}; 806};
763 807
764static Ecore_IMF_Context * 808static Ecore_IMF_Context *
diff --git a/libraries/ecore/src/tests/Makefile.in b/libraries/ecore/src/tests/Makefile.in
index bd7726a..aa799d9 100644
--- a/libraries/ecore/src/tests/Makefile.in
+++ b/libraries/ecore/src/tests/Makefile.in
@@ -53,16 +53,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
53 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 53 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
54 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 54 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
55 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 55 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
56 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 56 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
57 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 57 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
58 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 58 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
59 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 59 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
60 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 60 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
61 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 61 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
62 $(top_srcdir)/configure.ac
63am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 62am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 $(ACLOCAL_M4) 63 $(ACLOCAL_M4)
65mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 64mkinstalldirs = $(install_sh) -d
66CONFIG_HEADER = $(top_builddir)/config.h 65CONFIG_HEADER = $(top_builddir)/config.h
67CONFIG_CLEAN_FILES = 66CONFIG_CLEAN_FILES =
68CONFIG_CLEAN_VPATH_FILES = 67CONFIG_CLEAN_VPATH_FILES =
@@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@
174EVIL_CFLAGS = @EVIL_CFLAGS@ 173EVIL_CFLAGS = @EVIL_CFLAGS@
175EVIL_LIBS = @EVIL_LIBS@ 174EVIL_LIBS = @EVIL_LIBS@
176EXEEXT = @EXEEXT@ 175EXEEXT = @EXEEXT@
176EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
177EXOTIC_LIBS = @EXOTIC_LIBS@
177FGREP = @FGREP@ 178FGREP = @FGREP@
178GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 179GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
179GLIB_CFLAGS = @GLIB_CFLAGS@ 180GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
229PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 230PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
230PIXMAN_LIBS = @PIXMAN_LIBS@ 231PIXMAN_LIBS = @PIXMAN_LIBS@
231PKG_CONFIG = @PKG_CONFIG@ 232PKG_CONFIG = @PKG_CONFIG@
233PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
234PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
232POSUB = @POSUB@ 235POSUB = @POSUB@
233RANLIB = @RANLIB@ 236RANLIB = @RANLIB@
234SCIM_CFLAGS = @SCIM_CFLAGS@ 237SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@
239SED = @SED@ 242SED = @SED@
240SET_MAKE = @SET_MAKE@ 243SET_MAKE = @SET_MAKE@
241SHELL = @SHELL@ 244SHELL = @SHELL@
245SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
242SSL_CFLAGS = @SSL_CFLAGS@ 246SSL_CFLAGS = @SSL_CFLAGS@
243SSL_LIBS = @SSL_LIBS@ 247SSL_LIBS = @SSL_LIBS@
244STRIP = @STRIP@ 248STRIP = @STRIP@
diff --git a/libraries/ecore/src/tests/ecore_test_ecore_x.c b/libraries/ecore/src/tests/ecore_test_ecore_x.c
index 4b9e126..2d14ff1 100644
--- a/libraries/ecore/src/tests/ecore_test_ecore_x.c
+++ b/libraries/ecore/src/tests/ecore_test_ecore_x.c
@@ -6,6 +6,10 @@
6 6
7#include "ecore_suite.h" 7#include "ecore_suite.h"
8 8
9/* FIXME: Currently disable these tests. They are useless ATM and they just
10 * make buildbot complain. Once we add useful tests here we'll also bother
11 * with getting X on the server. */
12#undef HAVE_ECORE_X_XLIB
9 13
10/* TODO: change to HAVE_ECORE_X when xcb implementation is done */ 14/* TODO: change to HAVE_ECORE_X when xcb implementation is done */
11#ifdef HAVE_ECORE_X_XLIB 15#ifdef HAVE_ECORE_X_XLIB
diff --git a/libraries/ecore/src/util/Makefile.in b/libraries/ecore/src/util/Makefile.in
index 96cb48a..423c6e0 100644
--- a/libraries/ecore/src/util/Makefile.in
+++ b/libraries/ecore/src/util/Makefile.in
@@ -49,16 +49,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ 49 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ 50 $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \
51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ 51 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
52 $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ 52 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
53 $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ 53 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
54 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ 54 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
55 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ 55 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
56 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ 56 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
57 $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ 57 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
58 $(top_srcdir)/configure.ac
59am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 58am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
60 $(ACLOCAL_M4) 59 $(ACLOCAL_M4)
61mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 60mkinstalldirs = $(install_sh) -d
62CONFIG_HEADER = $(top_builddir)/config.h 61CONFIG_HEADER = $(top_builddir)/config.h
63CONFIG_CLEAN_FILES = 62CONFIG_CLEAN_FILES =
64CONFIG_CLEAN_VPATH_FILES = 63CONFIG_CLEAN_VPATH_FILES =
@@ -163,6 +162,8 @@ EVAS_LIBS = @EVAS_LIBS@
163EVIL_CFLAGS = @EVIL_CFLAGS@ 162EVIL_CFLAGS = @EVIL_CFLAGS@
164EVIL_LIBS = @EVIL_LIBS@ 163EVIL_LIBS = @EVIL_LIBS@
165EXEEXT = @EXEEXT@ 164EXEEXT = @EXEEXT@
165EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
166EXOTIC_LIBS = @EXOTIC_LIBS@
166FGREP = @FGREP@ 167FGREP = @FGREP@
167GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ 168GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
168GLIB_CFLAGS = @GLIB_CFLAGS@ 169GLIB_CFLAGS = @GLIB_CFLAGS@
@@ -218,6 +219,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
218PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 219PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
219PIXMAN_LIBS = @PIXMAN_LIBS@ 220PIXMAN_LIBS = @PIXMAN_LIBS@
220PKG_CONFIG = @PKG_CONFIG@ 221PKG_CONFIG = @PKG_CONFIG@
222PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
223PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
221POSUB = @POSUB@ 224POSUB = @POSUB@
222RANLIB = @RANLIB@ 225RANLIB = @RANLIB@
223SCIM_CFLAGS = @SCIM_CFLAGS@ 226SCIM_CFLAGS = @SCIM_CFLAGS@
@@ -228,6 +231,7 @@ SDL_LIBS = @SDL_LIBS@
228SED = @SED@ 231SED = @SED@
229SET_MAKE = @SET_MAKE@ 232SET_MAKE = @SET_MAKE@
230SHELL = @SHELL@ 233SHELL = @SHELL@
234SHM_OPEN_LIBS = @SHM_OPEN_LIBS@
231SSL_CFLAGS = @SSL_CFLAGS@ 235SSL_CFLAGS = @SSL_CFLAGS@
232SSL_LIBS = @SSL_LIBS@ 236SSL_LIBS = @SSL_LIBS@
233STRIP = @STRIP@ 237STRIP = @STRIP@