From c963d75dfdeec11f82e79e727062fbf89afa2c04 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 22 Apr 2012 09:19:23 +1000 Subject: Update EFL to latest beta. --- libraries/ecore/src/Makefile.in | 20 +- libraries/ecore/src/bin/Makefile.in | 20 +- libraries/ecore/src/examples/Makefile.in | 20 +- .../ecore/src/examples/ecore_evas_basics_example.c | 5 +- libraries/ecore/src/lib/Makefile.in | 20 +- libraries/ecore/src/lib/ecore/Ecore.h | 896 +++++++++---- libraries/ecore/src/lib/ecore/Makefile.am | 8 + libraries/ecore/src/lib/ecore/Makefile.in | 33 +- libraries/ecore/src/lib/ecore/ecore.c | 6 +- libraries/ecore/src/lib/ecore/ecore_anim.c | 4 +- libraries/ecore/src/lib/ecore/ecore_events.c | 158 +-- libraries/ecore/src/lib/ecore/ecore_exe.c | 10 +- libraries/ecore/src/lib/ecore/ecore_getopt.c | 4 + libraries/ecore/src/lib/ecore/ecore_main.c | 185 +-- libraries/ecore/src/lib/ecore/ecore_pipe.c | 17 +- libraries/ecore/src/lib/ecore/ecore_poll.c | 94 -- libraries/ecore/src/lib/ecore/ecore_private.h | 6 +- libraries/ecore/src/lib/ecore/ecore_thread.c | 756 ++++++----- libraries/ecore/src/lib/ecore/ecore_time.c | 6 +- libraries/ecore/src/lib/ecore/ecore_timer.c | 19 +- libraries/ecore/src/lib/ecore_cocoa/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_con/Ecore_Con.h | 81 +- libraries/ecore/src/lib/ecore_con/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_con/ecore_con.c | 23 +- .../ecore/src/lib/ecore_con/ecore_con_private.h | 47 +- .../ecore/src/lib/ecore_con/ecore_con_socks.c | 762 ++++++++--- libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c | 3 + libraries/ecore/src/lib/ecore_con/ecore_con_url.c | 671 +++++----- libraries/ecore/src/lib/ecore_config/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_directfb/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h | 256 +++- libraries/ecore/src/lib/ecore_evas/Makefile.am | 1 + libraries/ecore/src/lib/ecore_evas/Makefile.in | 21 +- libraries/ecore/src/lib/ecore_evas/ecore_evas.c | 252 +++- .../ecore/src/lib/ecore_evas/ecore_evas_buffer.c | 7 + .../ecore/src/lib/ecore_evas/ecore_evas_cocoa.c | 10 +- .../ecore/src/lib/ecore_evas/ecore_evas_directfb.c | 7 + .../ecore/src/lib/ecore_evas/ecore_evas_ews.c | 8 + .../ecore/src/lib/ecore_evas/ecore_evas_extn.c | 69 +- libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c | 7 + .../ecore/src/lib/ecore_evas/ecore_evas_private.h | 57 +- .../ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c | 9 +- .../ecore/src/lib/ecore_evas/ecore_evas_sdl.c | 189 ++- .../src/lib/ecore_evas/ecore_evas_wayland_egl.c | 694 +++++----- .../src/lib/ecore_evas/ecore_evas_wayland_shm.c | 769 +++++------ .../ecore/src/lib/ecore_evas/ecore_evas_win32.c | 19 +- .../ecore/src/lib/ecore_evas/ecore_evas_wince.c | 21 +- libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | 455 ++++--- libraries/ecore/src/lib/ecore_fb/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_fb/ecore_fb.c | 23 +- libraries/ecore/src/lib/ecore_file/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_file/ecore_file.c | 2 + .../ecore/src/lib/ecore_file/ecore_file_download.c | 40 +- libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h | 143 ++- libraries/ecore/src/lib/ecore_imf/Makefile.in | 20 +- .../ecore/src/lib/ecore_imf/ecore_imf_context.c | 402 +++++- .../ecore/src/lib/ecore_imf/ecore_imf_private.h | 3 + libraries/ecore/src/lib/ecore_imf_evas/Makefile.in | 20 +- .../ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c | 44 + libraries/ecore/src/lib/ecore_input/Makefile.in | 20 +- .../ecore/src/lib/ecore_input_evas/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_ipc/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c | 5 +- libraries/ecore/src/lib/ecore_psl1ght/Makefile.in | 20 +- libraries/ecore/src/lib/ecore_sdl/Makefile.in | 20 +- .../ecore/src/lib/ecore_wayland/Ecore_Wayland.h | 271 +++- libraries/ecore/src/lib/ecore_wayland/Makefile.am | 8 +- libraries/ecore/src/lib/ecore_wayland/Makefile.in | 33 +- libraries/ecore/src/lib/ecore_wayland/ecore_wl.c | 1322 +++++-------------- .../ecore/src/lib/ecore_wayland/ecore_wl_private.h | 56 +- libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h | 9 +- libraries/ecore/src/lib/ecore_win32/Makefile.in | 20 +- .../src/lib/ecore_win32/ecore_win32_private.h | 4 +- .../ecore/src/lib/ecore_win32/ecore_win32_window.c | 173 +-- libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h | 4 + libraries/ecore/src/lib/ecore_wince/Makefile.in | 20 +- .../ecore/src/lib/ecore_wince/ecore_wince_window.c | 52 + libraries/ecore/src/lib/ecore_x/Ecore_X.h | 91 +- libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h | 14 + libraries/ecore/src/lib/ecore_x/Makefile.in | 20 +- .../ecore/src/lib/ecore_x/ecore_x_atoms_decl.h | 14 + libraries/ecore/src/lib/ecore_x/xcb/Makefile.in | 20 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c | 15 +- libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c | 236 ++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c | 8 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c | 50 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c | 294 ++++- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c | 4 +- libraries/ecore/src/lib/ecore_x/xlib/Makefile.in | 20 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c | 15 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c | 233 ++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c | 51 + .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c | 246 +++- .../ecore/src/lib/ecore_x/xlib/ecore_x_test.c | 12 + .../ecore/src/lib/ecore_x/xlib/ecore_x_window.c | 4 +- libraries/ecore/src/modules/Makefile.in | 20 +- libraries/ecore/src/modules/immodules/Makefile.in | 20 +- .../ecore/src/modules/immodules/scim/Makefile.in | 20 +- .../src/modules/immodules/scim/scim_imcontext.cpp | 1348 ++++++++++---------- .../src/modules/immodules/scim/scim_imcontext.h | 2 + .../src/modules/immodules/scim/scim_module.cpp | 11 +- .../ecore/src/modules/immodules/xim/Makefile.in | 20 +- .../src/modules/immodules/xim/ecore_imf_xim.c | 48 +- libraries/ecore/src/tests/Makefile.in | 20 +- libraries/ecore/src/tests/ecore_test_ecore_x.c | 4 + libraries/ecore/src/util/Makefile.in | 20 +- 106 files changed, 7342 insertions(+), 5157 deletions(-) (limited to 'libraries/ecore/src') 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -168,6 +167,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -223,6 +224,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -233,6 +236,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -408,6 +407,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -463,6 +464,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -473,6 +476,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) evas_object_show(bg); ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); - ecore_main_fd_handler_add(STDIN_FILENO, - ECORE_FD_READ | ECORE_FD_ERROR, - _stdin_cb, - NULL, NULL, NULL); + ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _stdin_cb, NULL, NULL, NULL); ecore_main_loop_begin(); 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 @@ @mainpage Ecore @version 1.1 - @date 2000-2011 + @date 2000-2012 Please see the @ref authors page for contact details. @@ -22,7 +22,7 @@ @li @ref Ecore_Main_Loop_Group @li @ref Ecore_File_Group @li @ref Ecore_Con_Group - @li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink + @li @ref Ecore_Evas_Group @li @ref Ecore_FB_Group @li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink @li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink @@ -35,21 +35,31 @@ pkgconfig (.pc) files are installed for every ecore module. Thus, to compile using any of them, you can use something like the following: - @verbatim - gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs) - @endverbatim +@verbatim +gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs) +@endverbatim @section install How is it installed? - Suggested configure options for evas for a Linux desktop X display: + Suggested configure options for ecore for a Linux desktop X display + with OpenGL and Software support, communication (networking) and + IPC (inter process communication): - @verbatim - ./configure \ - make - su - - ... - make install - @endverbatim +@verbatim +./configure \ + --enable-ecore-con \ + --enable-ecore-ipc \ + --enable-ecore-file \ + --enable-ecore-input \ + --enable-ecore-input-evas \ + --enable-ecore-x \ + --enable-ecore-evas \ + --enable-ecore-evas-software-buffer \ + --enable-ecore-evas-software-x11 \ + --enable-ecore-evas-opengl-x11 +make +sudo make install +@endverbatim */ @@ -112,140 +122,175 @@ */ /** - @page Ecore_Main_Loop_Page The Ecore Main Loop - - @section intro What is Ecore? - - Ecore is a clean and tiny event loop library with many modules to do lots of - convenient things for a programmer, to save time and effort. - - It's small and lean, designed to work on embedded systems all the way to - large and powerful multi-cpu workstations. It serialises all system signals, - events etc. into a single event queue, that is easily processed without - needing to worry about concurrency. A properly written, event-driven program - using this kind of programming doesn't need threads, nor has to worry about - concurrency. It turns a program into a state machine, and makes it very - robust and easy to follow. - - Ecore gives you other handy primitives, such as timers to tick over for you - and call specified functions at particular times so the programmer can use - this to do things, like animate, or time out on connections or tasks that take - too long etc. - - Idle handlers are provided too, as well as calls on entering an idle state - (often a very good time to update the state of the program). All events that - enter the system are passed to specific callback functions that the program - sets up to handle those events. Handling them is simple and other Ecore - modules produce more events on the queue, coming from other sources such as - file descriptors etc. - - Ecore also lets you have functions called when file descriptors become active - for reading or writing, allowing for streamlined, non-blocking IO. - - Here is an example of a simple program and its basic event loop flow: - - @image html prog_flow.png - @image latex prog_flow.eps width=\textwidth - - - - @section work How does Ecore work? - - Ecore is very easy to learn and use. All the function calls are designed to - be easy to remember, explicit in describing what they do, and heavily - name-spaced. Ecore programs can start and be very simple. - - For example: - - @code - #include - - int - main(int argc, const char **argv) - { - ecore_init(); - ecore_app_args_set(argc, argv); - ecore_main_loop_begin(); - ecore_shutdown(); - return 0; - } - @endcode - - This program is very simple and doesn't check for errors, but it does start up - and begin a main loop waiting for events or timers to tick off. This program - doesn't set up any, but now we can expand on this simple program a little - more by adding some event handlers and timers. - - @code - #include - - Ecore_Timer *timer1 = NULL; - Ecore_Event_Handler *handler1 = NULL; - double start_time = 0.0; - - int - timer_func(void *data) - { - printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); - return 1; - } - - int - exit_func(void *data, int ev_type, void *ev) - { - Ecore_Event_Signal_Exit *e; - - e = (Ecore_Event_Signal_Exit *)ev; - if (e->interrupt) printf("Exit: interrupt\n"); - else if (e->quit) printf("Exit: quit\n"); - else if (e->terminate) printf("Exit: terminate\n"); - ecore_main_loop_quit(); - return 1; - } - - int - main(int argc, const char **argv) - { - ecore_init(); - ecore_app_args_set(argc, argv); - start_time = ecore_time_get(); - handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); - timer1 = ecore_timer_add(0.5, timer_func, NULL); - ecore_main_loop_begin(); - ecore_shutdown(); - return 0; - } - @endcode - - In the previous example, we initialize our application and get the time at - which our program has started so we can calculate an offset. We set - up a timer to tick off in 0.5 seconds, and since it returns 1, will - keep ticking off every 0.5 seconds until it returns 0, or is deleted - by hand. An event handler is set up to call a function - - exit_func(), - whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C - on the command line will cause such an event to happen). If this event - occurs it tells you what kind of exit signal was received, and asks - the main loop to quit when it is finished by calling - ecore_main_loop_quit(). - - The handles returned by ecore_timer_add() and - ecore_event_handler_add() are - only stored here as an example. If you don't need to address the timer or - event handler again you don't need to store the result, so just call the - function, and don't assign the result to any variable. - - This program looks slightly more complex than needed to do these simple - things, but in principle, programs don't get any more complex. You add more - event handlers, for more events, will have more timers and such, BUT it all - follows the same principles as shown in this example. - + * @page Ecore_Main_Loop_Page The Ecore Main Loop + * + * @section intro What is Ecore? + * + * Ecore is a clean and tiny event loop library with many modules to do lots of + * convenient things for a programmer, to save time and effort. It's small and + * lean, designed to work from embedded systems all the way up to large and + * powerful multi-cpu workstations. The main loop has a number of primitives to + * be used with its main loop. It serializes all the primitives and allows for + * great responsiveness without the need for threads(or any other concurrency). + * + * @subsection timers Timers + * + * Timers serve two main purposes: doing something at a specified time and + * repeatedly doing something with a set interval. + * @see Ecore_Timer_Group + * + * @subsection poolers Poolers + * + * Poolers allow for pooling to be centralized into a single place therefore + * alleviating the need for different parts of the program to wake up at + * different times to do pooling, thereby making the code simpler and more + * efficient. + * @see Ecore_Poller_Group + * + * @subsection idler Idlers + * + * There are three types of idlers, enterers, idlers(proper) and exiters, they + * are called, respectively, when the program is about to enter an idle state, + * when the program is idle and when the program is leaving an idle state. Idler + * enterers are usually a good place to update the program state. Proper idlers + * are the appropriate place to do heavy computational tasks thereby using what + * would otherwise be wasted CPU cycles. Exiters are the perfect place to do + * anything your program should do just before processing events(also timers, + * poolers, file descriptor handlers and animators) + * @see Ecore_Idle_Group + * + * @subsection fd_handler File descriptor handlers + * + * File descriptor handlers allow you to monitor when there is data available to + * read on file descriptors, when writing will not block or if there was an + * error. Any valid file descriptor can be used with this API, regardless of if + * was gotten with an OS specific API or from ecore. + * @see Ecore_FD_Handler_Group + * + * @subsection animators Animators + * + * Ecore provides a facility called animators, so named since the intended use + * was in animations, that facilitates knowing what percentage of a given + * interval has elapsed. This is perfect for performing animations, but is not + * limited to that use, it can, for example, also be used to create a progress + * bar. + * @see Ecore_Animator_Group + * + * @subsection ev_handlers Event handlers + * + * Event handlers are, arguably, the most important feature of the ecore main + * loop, they are what allows the programmer to easily handle user interaction. + * Events however are not only things the user does, events can represent + * anything for which a type is created. + * @see Ecore_Event_Group + * + * All of these primitives are discussed in more detail in their respective + * pages linked above. + * + * Here is a diagram of the main loop flow of a simple program: + * + * @image html prog_flow.png + * @image latex prog_flow.eps width=\textwidth + * + * + * + * @section work How does Ecore work? + * + * Ecore is very easy to learn and use. All the function calls are designed to + * be easy to remember, explicit in describing what they do, and heavily + * name-spaced. Ecore programs can start and be very simple. + * + * For example: + * + * @code + * #include + * + * int + * main(int argc, const char **argv) + * { + * ecore_init(); + * ecore_app_args_set(argc, argv); + * ecore_main_loop_begin(); + * ecore_shutdown(); + * return 0; + * } + * @endcode + * + * This program is very simple and doesn't check for errors, but it does start up + * and begin a main loop waiting for events or timers to tick off. This program + * doesn't set up any, but now we can expand on this simple program a little + * more by adding some event handlers and timers. + * + * @code + * #include + * + * Ecore_Timer *timer1 = NULL; + * Ecore_Event_Handler *handler1 = NULL; + * double start_time = 0.0; + * + * int + * timer_func(void *data) + * { + * printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); + * return 1; + * } + * + * int + * exit_func(void *data, int ev_type, void *ev) + * { + * Ecore_Event_Signal_Exit *e; + * + * e = (Ecore_Event_Signal_Exit *)ev; + * if (e->interrupt) printf("Exit: interrupt\n"); + * else if (e->quit) printf("Exit: quit\n"); + * else if (e->terminate) printf("Exit: terminate\n"); + * ecore_main_loop_quit(); + * return 1; + * } + * + * int + * main(int argc, const char **argv) + * { + * ecore_init(); + * ecore_app_args_set(argc, argv); + * start_time = ecore_time_get(); + * handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); + * timer1 = ecore_timer_add(0.5, timer_func, NULL); + * ecore_main_loop_begin(); + * ecore_shutdown(); + * return 0; + * } + * @endcode + * + * In the previous example, we initialize our application and get the time at + * which our program has started so we can calculate an offset. We set + * up a timer to tick off in 0.5 seconds, and since it returns 1, will + * keep ticking off every 0.5 seconds until it returns 0, or is deleted + * by hand. An event handler is set up to call a function - + * exit_func(), + * whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C + * on the command line will cause such an event to happen). If this event + * occurs it tells you what kind of exit signal was received, and asks + * the main loop to quit when it is finished by calling + * ecore_main_loop_quit(). + * + * The handles returned by ecore_timer_add() and + * ecore_event_handler_add() are + * only stored here as an example. If you don't need to address the timer or + * event handler again you don't need to store the result, so just call the + * function, and don't assign the result to any variable. + * + * This program looks slightly more complex than needed to do these simple + * things, but in principle, programs don't get any more complex. You add more + * event handlers, for more events, will have more timers and such, BUT it all + * follows the same principles as shown in this example. + * */ /* @page Ecore_Config_Page The Enlightened Property Library - The Enlightened Property Library (Ecore_Config) is an adbstraction + The Enlightened Property Library (Ecore_Config) is an abstraction from the complexities of writing your own configuration. It provides many features using the Enlightenment 17 development libraries. @@ -310,7 +355,9 @@ # include #else # include -# include +# if !defined (EXOTIC_NO_SIGNAL) +# include +# endif #endif #include @@ -333,47 +380,21 @@ EAPI int ecore_shutdown(void); */ /** + * @defgroup Ecore_Main_Loop_Group Ecore main loop * - * @defgroup Ecore_Main_Loop_Group Ecore main loop functions - * - * These are functions acting on Ecore's main loop itself or on - * events and infrastructure directly linked to it. This loop is - * designed to work on embedded systems all the way to large and - * powerful multi-cpu workstations. + * This group discusses functions that are acting on Ecore's main loop itself or + * on events and infrastructure directly linked to it. Most programs only need + * to start and end the main loop, the rest of the function discussed here are + * meant to be used in special situations, and with great care. * - * It serialises all system signals and events into a single event - * queue, that can be easily processed without needing to worry - * about concurrency. A properly written, event-driven program - * using this kind of programming does not need threads. It makes - * the program very robust and easy to follow. - * - * For example, for the main loop to be of any use, you need to be - * able to add @b events and event handlers on it. Events for file - * descriptor events are covered in @ref Ecore_FD_Handler_Group. - * - * Timer functions are covered in @ref Ecore_Time_Group. - * - * There is also provision for callbacks for when the loop enters or - * exits an @b idle state. See @ref Ecore_Idle_Group for more - * information on it. - * - * Functions are also provided for spawning child processes using - * @c fork(). See @ref Ecore_Exe_Group for more details on it. - * - * Here is an example of simple program and its basic event loop - * flow: - * - * @image html prog_flow.png - * @image latex prog_flow.eps width=\textwidth - * - * For examples of setting up and using a main loop, see - * @ref Ecore_Main_Loop_Page. + * For details on the usage of ecore's main loop and how it interacts with other + * ecore facilities see: @ref Ecore_Main_Loop_Page. * * @{ */ #define ECORE_VERSION_MAJOR 1 -#define ECORE_VERSION_MINOR 0 +#define ECORE_VERSION_MINOR 2 typedef struct _Ecore_Version { @@ -469,7 +490,7 @@ EAPI void *ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, void *d * in this thread, if the main loop was suspended correctly. If not, it return @c -1. * * This function suspend the main loop in a know state, this let you - * use any EFL call you want after it return. Be carefull, the main loop + * use any EFL call you want after it return. Be carefully, the main loop * is blocked until you call ecore_thread_main_loop_end(). This is * the only sane way to achieve pseudo thread safety. * @@ -489,7 +510,7 @@ EAPI int ecore_thread_main_loop_begin(void); * the main loop is unlocked again. @c -1 will be returned if you are trying to unlock * when there wasn't enough call to ecore_thread_main_loop_begin(). * - * After a call to ecore_thread_main_loop_begin(), you need to absolutly + * After a call to ecore_thread_main_loop_begin(), you need to absolutely * call ecore_thread_main_loop_end(), or you application will stay frozen. */ EAPI int ecore_thread_main_loop_end(void); @@ -501,34 +522,51 @@ EAPI int ecore_thread_main_loop_end(void); /** * @defgroup Ecore_Event_Group Ecore Event functions * - * Ecore events are used to wake up the Ecore main loop to warn - * about state changes, tasks completed, data available for reading - * or writing, etc. They are the base of the event oriented - * programming. - * - * The idea is to write many functions (callbacks) that will be - * registered to specific events, and called when these events - * happen. This way, when the system state changes (a mouse click is - * detected, a key is pressed, or the content of a file changes, for - * example), the respective callbacks will be called with some - * information about that event. Usually the function/callback will - * have a data pointer to the event info (the position in the screen - * where the mouse was clicked, the name of the key that was - * pressed, or the name of the file that has changed). - * - * The basic usage, when one needs to watch for an existing event, - * is to register a callback to it using ecore_event_add(). Of - * course it's necessary to know beforehand what are the types of - * events that the system/library will emmit. This should be - * available with the documentation from that system/library. - * - * When writing a library or group of functions that need to inform - * about something, and you already are running on top of a main - * loop, it is usually a good approach to use events. This way you - * allow others to register as many callbacks as necessary to this - * event, and don't have to care about who is registering to it. The - * functions ecore_event_type_new() and ecore_event_add() are - * available for this purpose. + * Ecore events provide two main features that are of use to those using ecore: + * creating events and being notified of events. Those two will usually be used + * in different contexts, creating events is mainly done by libraries wrapping + * some system functionality while being notified of events is mainly a + * necessity of applications. + * + * For a program to be notified of events it's interested in it needs to have a + * function to process the event and to register that function as the callback + * to the event, that's all: + * @code + * ecore_event_handler_add(EVENT_TYPE, _my_event_handler, some_data); + * ... + * static Eina_Bool + * _my_event_handler(void *data, int type, void *event) + * { + * //data is some_data + * //event is provided by whoever created the event + * //Do really cool stuff with event + * } + * @endcode + * + * One very important thing to note here is the @c EVENT_TYPE, to register a + * handler for an event you must know it's type before hand. This information + * can be found on the documentation of the library emitting the signal, so, + * for example, for events related to windowing one would look in @ref + * Ecore_Evas_Group. + * + * Examples of libraries that integrate into ecore's main loop by providing + * events are @ref Ecore_Con_Group, @ref Ecore_Evas_Group and @ref + * Ecore_Exe_Group amongst others. This usage can be divided into two parts, + * setup and adding events. The setup is very simple, all that needs doing is + * getting a type id for the event: + * @code + * int MY_EV_TYPE = ecore_event_type_new(); + * @endcode + * @note This variable should be declared in the header since it'll be needed by + * anyone wishing to register a handler to your event. + * + * The complexity of adding of an event to the queue depends on whether that + * event sends uses @c event, if it doesn't it a one-liner: + * @code + * ecore_event_add(MY_EV_TYPE, NULL, NULL, NULL); + * @endcode + * The usage when an @c event is needed is not that much more complex and can be + * seen in @ref ecore_event_add. * * Example that deals with events: * @@ -582,7 +620,7 @@ struct _Ecore_Event_Signal_User /** User signal event */ int number; /**< The signal number. Either 1 or 2 */ void *ext_data; /**< Extension data - not used */ -#if !defined (_WIN32) && !defined (__lv2ppu__) +#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL) siginfo_t data; /**< Signal info */ #endif }; @@ -591,7 +629,7 @@ struct _Ecore_Event_Signal_Hup /** Hup signal event */ { void *ext_data; /**< Extension data - not used */ -#if !defined (_WIN32) && !defined (__lv2ppu__) +#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL) siginfo_t data; /**< Signal info */ #endif }; @@ -600,10 +638,10 @@ struct _Ecore_Event_Signal_Exit /** Exit request event */ { Eina_Bool interrupt : 1; /**< Set if the exit request was an interrupt signal*/ Eina_Bool quit : 1; /**< set if the exit request was a quit signal */ - Eina_Bool terminate : 1; /**< Set if the exit request was a terminate singal */ + Eina_Bool terminate : 1; /**< Set if the exit request was a terminate signal */ void *ext_data; /**< Extension data - not used */ -#if !defined (_WIN32) && !defined (__lv2ppu__) +#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL) siginfo_t data; /**< Signal info */ #endif }; @@ -612,7 +650,7 @@ struct _Ecore_Event_Signal_Power /** Power event */ { void *ext_data; /**< Extension data - not used */ -#if !defined (_WIN32) && !defined (__lv2ppu__) +#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL) siginfo_t data; /**< Signal info */ #endif }; @@ -621,21 +659,161 @@ struct _Ecore_Event_Signal_Realtime /** Realtime event */ { int num; /**< The realtime signal's number */ -#if !defined (_WIN32) && !defined (__lv2ppu__) +#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL) siginfo_t data; /**< Signal info */ #endif }; +/** + * @brief Add an event handler. + * @param type The type of the event this handler will get called for + * @param func The function to call when the event is found in the queue + * @param data A data pointer to pass to the called function @p func + * @return A new Event handler, or NULL on failure + * + * Add an event handler to the list of handlers. This will, on success, return + * a handle to the event handler object that was created, that can be used + * later to remove the handler using ecore_event_handler_del(). The @p type + * parameter is the integer of the event type that will trigger this callback + * to be called. The callback @p func is called when this event is processed + * and will be passed the event type, a pointer to the private event + * structure that is specific to that event type, and a data pointer that is + * provided in this call as the @p data parameter. + * + * When the callback @p func is called, it must return 1 or 0. If it returns + * 1 (or ECORE_CALLBACK_PASS_ON), It will keep being called as per normal, for + * each handler set up for that event type. If it returns 0 (or + * ECORE_CALLBACK_DONE), it will cease processing handlers for that particular + * event, so all handler set to handle that event type that have not already + * been called, will not be. + */ EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data); +/** + * @brief Delete an event handler. + * @param event_handler Event handler handle to delete + * @return Data passed to handler + * + * Delete a specified event handler from the handler list. On success this will + * delete the event handler and return the pointer passed as @p data when the + * handler was added by ecore_event_handler_add(). On failure NULL will be + * returned. Once a handler is deleted it will no longer be called. + */ EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler); +/** + * @brief Add an event to the event queue. + * @param type The event type to add to the end of the event queue + * @param ev The data structure passed as @c event to event handlers + * @param func_free The function to be called to free @a ev + * @param data The data pointer to be passed to the free function + * @return A Handle for that event on success, otherwise NULL + * + * If it succeeds, an event of type @a type will be added to the queue for + * processing by event handlers added by ecore_event_handler_add(). The @a ev + * parameter will be passed as the @c event parameter of the handler. When the + * event is no longer needed, @a func_free will be called and passed @a ev for + * cleaning up. If @p func_free is NULL, free() will be called with the private + * structure pointer. + */ EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data); +/** + * @brief Delete an event from the queue. + * @param event The event handle to delete + * @return The data pointer originally set for the event free function + * + * This deletes the event @p event from the event queue, and returns the + * @p data parameter originally set when adding it with ecore_event_add(). This + * does not immediately call the free function, and it may be called later on + * cleanup, and so if the free function depends on the data pointer to work, + * you should defer cleaning of this till the free function is called later. + */ EAPI void *ecore_event_del(Ecore_Event *event); +/** + * @brief Get the data associated with an #Ecore_Event_Handler + * @param eh The event handler + * @return The data + * + * This function returns the data previously associated with @p eh by + * ecore_event_handler_add(). + */ EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh); +/** + * @brief Set the data associated with an #Ecore_Event_Handler + * @param eh The event handler + * @param data The data to associate + * @return The previous data + * + * This function sets @p data to @p eh and returns the old data pointer + * which was previously associated with @p eh by ecore_event_handler_add(). + */ EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data); +/** + * @brief Allocate a new event type id sensibly and return the new id. + * @return A new event type id. + * + * This function allocates a new event type id and returns it. Once an event + * type has been allocated it can never be de-allocated during the life of + * the program. There is no guarantee of the contents of this event ID, or how + * it is calculated, except that the ID will be unique to the current instance + * of the process. + */ EAPI int ecore_event_type_new(void); +/** + * @brief Add a filter the current event queue. + * + * @param func_start Function to call just before filtering and return data + * @param func_filter Function to call on each event + * @param func_end Function to call after the queue has been filtered + * @param data Data to pass to the filter functions + * @return A filter handle on success, NULL otherwise + * + * Adds a callback to filter events from the event queue. Filters are called on + * the queue just before Event handler processing to try and remove redundant + * events. Just as processing is about to start @a func_start is called and + * passed the @a data pointer, the return value of this functions is passed to + * @a func_filter as loop_data. @a func_filter is also passed @a data and the + * event type and event structure. If this @a func_filter returns #EINA_FALSE, + * the event is removed from the queue, if it returns #EINA_TRUE, the event is + * kept. When processing is finished @p func_end is called and is passed the + * loop_data(returned by @c func_start) and @p data pointer to clean up. + */ EAPI 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); +/** + * @brief Delete an event filter. + * @param ef The event filter handle + * @return The data set for the filter on success, NULL otherwise + * + * Delete a filter that has been added by its @p ef handle. + */ EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef); +/** + * @brief Return the current event type being handled. + * @return The current event type being handled if inside a handler callback, + * ECORE_EVENT_NONE otherwise + * + * If the program is currently inside an Ecore event handler callback this + * will return the type of the current event being processed. + * + * This is useful when certain Ecore modules such as Ecore_Evas "swallow" + * events and not all the original information is passed on. In special cases + * this extra information may be useful or needed and using this call can let + * the program know if the event type being handled is one it wants to get more + * information about. + */ EAPI int ecore_event_current_type_get(void); +/** + * @brief Return the current event type pointer handled. + * @return The current event pointer being handled if inside a handler callback, + * NULL otherwise + * + * If the program is currently inside an Ecore event handler callback this + * will return the pointer of the current event being processed. + * + * This is useful when certain Ecore modules such as Ecore_Evas "swallow" + * events and not all the original information is passed on. In special cases + * this extra information may be useful or needed and using this call can let + * the program access the event data if the type of the event is handled by + * the program. + */ EAPI void *ecore_event_current_event_get(void); /** @@ -652,7 +830,8 @@ EAPI void *ecore_event_current_event_get(void); * @{ */ - #define ECORE_EXE_PRIORITY_INHERIT 9999 +/** Inherit priority from parent process */ +#define ECORE_EXE_PRIORITY_INHERIT 9999 EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */ EAPI 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 */ Eina_Bool exited : 1; /** < set to 1 if the process exited of its own accord */ Eina_Bool signalled : 1; /** < set to 1 id the process exited due to uncaught signal */ void *ext_data; /**< Extension data - not used */ -#if !defined (_WIN32) && !defined (__lv2ppu__) +#if !defined (_WIN32) && !defined (__lv2ppu__) && !defined (EXOTIC_NO_SIGNAL) siginfo_t data; /**< Signal info */ #endif }; @@ -768,24 +947,30 @@ EAPI void ecore_exe_hup(Ecore_Exe *exe); /** * @defgroup Ecore_FD_Handler_Group File Event Handling Functions * - * Functions that deal with file descriptor handlers. + * @brief Functions that deal with file descriptor handlers. + * + * File descriptor handlers facilitate reading, writing and checking for errors + * without blocking the program or doing expensive pooling. This can be used to + * monitor a socket, pipe, or other stream for which an FD can be had. * - * The @ref Ecore_Fd_Handler can be used to watch a file descriptor - * for data available for reading, for the availability to write - * without blocking, and for errors on the file descriptor. + * @warning This function @b can't be used for monitoring to regular files! * - *ecore_main_fd_handler_add() is used to setup a handler for a - * given file descriptor. This file descriptor can be the standard - * input, a network socket, a stream received through some driver - * of a hardware decoder, etc. Thus it can contain errors, like a - * disconnection, a broken pipe, and so, and that's why it's - * possible to check for these errors with the @ref ECORE_FD_ERROR - * flag. + * One common FD to be monitored is the standard input(stdin), monitoring it for + * reading requires a single call: + * @code + * static Eina_Bool + * _my_cb_func(void *data, Ecore_Fd_Handler *handler) + * { + * char c; + * scanf("%c", &c); //Guaranteed not to block + * ... do stuff with c ... + * } + * ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _my_cb_func, NULL, NULL, NULL); + * @endcode * - * An @ref Ecore_Fd_Handler can be used to watch on a file - * descriptor without blocking, still being able to receive events, - * expire timers, and other watch for other things that happen in - * the Ecore main loop. + * When using a socket, pipe or other stream it's important to remember that + * errors may occur and as such to monitor not only for reading/writing but also + * for errors using the @ref ECORE_FD_ERROR flag. * * Example of use of a file descriptor handler: * @li @ref ecore_fd_handler_example_c @@ -823,11 +1008,93 @@ typedef void (*Ecore_Fd_Prep_Cb)(void *data, Ecore_Fd_Handler *fd_handler); */ typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh); +/** + * @brief Adds a callback for activity on the given file descriptor. + * + * @param fd The file descriptor to watch. + * @param flags To monitor it for reading use @c ECORE_FD_READ, for writing @c + * ECORE_FD_WRITE, and for error @c ECORE_FD_ERROR. Values bay |(ored). + * @param func The callback function. + * @param data The data to pass to the callback. + * @param buf_func The function to call to check if any data has been buffered + * and already read from the fd. May be @c NULL. + * @param buf_data The data to pass to the @p buf_func function. + * @return A fd handler handle on success, @c NULL otherwise. + * + * @a func will be called during the execution of @ref Ecore_Main_Loop_Page + * when the file descriptor is available for reading, writing, or there has been + * an error(depending on the given @a flags). + * + * When @a func returns ECORE_CALLBACK_CANCEL, it indicates that the + * handler should be marked for deletion (identical to calling @ref + * ecore_main_fd_handler_del). + * + * @warning @a buf_func is meant for @b internal use only and should be @b + * avoided. + * + * The return value of @a buf_func has a different meaning, when it returns + * ECORE_CALLBACK_CANCEL, it indicates that @a func @b shouldn't be called, and + * when it returns ECORE_CALLBACK_RENEW it indicates @a func should be called. + * The return value of @a buf_func will not cause the FD handler to be deleted. + * + * @a buf_func is called during event loop handling to check if data that has + * been read from the file descriptor is in a buffer and is available to read. + * Some systems, notably xlib, handle their own buffering, and would otherwise + * not work with select(). These systems should use a @a buf_func. This is a + * most annoying hack, only ecore_x uses it, so refer to that for an example. + */ EAPI 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); +/** + * @brief Set the prepare callback with data for a given #Ecore_Fd_Handler + * + * @param fd_handler The fd handler + * @param func The prep function + * @param data The data to pass to the prep function + * + * This function will be called prior to any fd handler's callback function + * (even the other fd handlers), before entering the main loop select function. + * + * @note Once a prepare callback is set for a fd handler, it cannot be changed. + * You need to delete the fd handler and create a new one, to set another + * callback. + * @note You probably don't need this function. It is only necessary for very + * uncommon cases that need special behavior. + */ EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data); +/** + * @brief Marks an FD handler for deletion. + * @param fd_handler The FD handler. + * @return The data pointer set using @ref ecore_main_fd_handler_add, for @a + * fd_handler on success, @c NULL otherwise. + * This function marks an fd handler to be deleted during an iteration of the + * main loop. It does NOT close the associated fd! + * + * @warning If the underlying fd is already closed ecore may complain if the + * main loop is using epoll internally, and also in some rare cases this may + * cause crashes and instability. Remember to delete your fd handlers before the + * fds they listen to are closed. + */ EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); +/** + * @brief Retrieves the file descriptor that the given handler is handling. + * @param fd_handler The given FD handler. + * @return The file descriptor the handler is watching. + */ EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler); +/** + * @brief Gets which flags are active on an FD handler. + * @param fd_handler The given FD handler. + * @param flags The flags, @c ECORE_FD_READ, @c ECORE_FD_WRITE or @c + * ECORE_FD_ERROR to query. + * @return #EINA_TRUE if any of the given flags are active, #EINA_FALSE + * otherwise. + */ EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); +/** + * @brief Set what active streams the given FD handler should be monitoring. + * @param fd_handler The given FD handler. + * @param flags The flags to be watching. + */ EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); EAPI 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); /** * @defgroup Ecore_Poller_Group Ecore Poll functions * - * These functions are for the need to poll information, but provide - * a shared abstracted API to pool such polling to minimise wakeup - * and ensure all the polling happens in as few spots as possible - * areound a core poll interval. For now only 1 core poller type is - * supprted: ECORE_POLLER_CORE + * Ecore poller provides infrastructure for the creation of pollers. Pollers + * are, in essence, callbacks that share a single timer per type. Because not + * all pollers need to be called at the same frequency the user may specify the + * frequency in ticks(each expiration of the shared timer is called a tick, in + * ecore poller parlance) for each added poller. Ecore pollers should only be + * used when the poller doesn't have specific requirements on the exact times + * to poll. * - * Example of @ref Ecore_Poller : + * This architecture means that the main loop is only woken up once to handle + * all pollers of that type, this will save power as the CPU has more of a + * chance to go into a low power state the longer it is asleep for, so this + * should be used in situations where power usage is a concern. + * + * For now only 1 core poller type is supported: ECORE_POLLER_CORE, the default + * interval for ECORE_POLLER_CORE is 0.125(or 1/8th) second. + * + * The creation of a poller is extremely simple and only required one line: + * @code + * ecore_poller_add(ECORE_POLLER_CORE, 1, my_poller_function, NULL); + * @endcode + * This sample creates a poller to call @c my_poller_function at every tick with + * @c NULL as data. + * + * Example: * @li @ref ecore_poller_example_c * * @ingroup Ecore_Main_Loop_Group @@ -862,11 +1146,76 @@ typedef enum _Ecore_Poller_Type Ecore_Poller_Type; typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */ +/** + * @brief Sets the time(in seconds) between ticks for the given poller type. + * @param type The poller type to adjust. + * @param poll_time The time(in seconds) between ticks of the timer. + * + * This will adjust the time between ticks of the given timer type defined by + * @p type to the time period defined by @p poll_time. + */ EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time); +/** + * @brief Gets the time(in seconds) between ticks for the given poller type. + * @param type The poller type to query. + * @return The time in seconds between ticks of the poller timer. + * + * This will get the time between ticks of the specified poller timer. + */ EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type); +/** + * @brief Changes the polling interval rate of @p poller. + * @param poller The Ecore_Poller to change the interval of. + * @param interval The tick interval to set; must be a power of 2 and <= 32768. + * @return Returns true on success, false on failure. + * + * This allows the changing of a poller's polling interval. It is useful when + * you want to alter a poll rate without deleting and re-creating a poller. + */ EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval); +/** + * @brief Gets the polling interval rate of @p poller. + * @param poller The Ecore_Poller to change the interval of. + * @return Returns the interval, in ticks, that @p poller polls at. + * + * This returns a poller's polling interval, or 0 on error. + */ EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller); +/** + * @brief Creates a poller to call the given function at a particular tick interval. + * @param type The ticker type to attach the poller to. Must be ECORE_POLLER_CORE. + * @param interval The poll interval. + * @param func The poller function. + * @param data Data to pass to @a func when it is called. + * @return A poller object on success, @c NULL otherwise. + * + * This function adds @a func as a poller callback that will be called every @a + * interval ticks together with other pollers of type @a type. @a func will be + * passed the @p data pointer as a parameter. + * + * The @p interval must be between 1 and 32768 inclusive, and must be a power of + * 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768). The exact tick in which @a func + * will be called is undefined, as only the interval between calls can be + * defined. Ecore will endeavor to keep pollers synchronized and to call as + * many in 1 wakeup event as possible. If @a interval is not a power of two, the + * closest power of 2 greater than @a interval will be used. + * + * When the poller @p func is called, it must return a value of either + * ECORE_CALLBACK_RENEW(or 1) or ECORE_CALLBACK_CANCEL(or 0). If it + * returns 1, it will be called again at the next tick, or if it returns + * 0 it will be deleted automatically making any references/handles for it + * invalid. + */ EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data); +/** + * @brief Delete the specified poller from the timer list. + * @param poller The poller to delete. + * @return The data pointer set for the timer when @ref ecore_poller_add was + * called on success, @c NULL otherwise. + * + * @note @a poller must be a valid handle. If the poller function has already + * returned 0, the handle is no longer valid (and does not need to be deleted). + */ EAPI void *ecore_poller_del(Ecore_Poller *poller); /** @@ -941,7 +1290,7 @@ typedef enum _Ecore_Animator_Source Ecore_Animator_Source; typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos); /** - * @brief Add an animator to call @p func at every animaton tick during main + * @brief Add an animator to call @p func at every animation tick during main * loop execution. * * @param func The function to call when it ticks off @@ -1011,7 +1360,7 @@ EAPI void *ecore_animator_del(Ecore_Animator *animator); * * @param animator The animator to delete * - * The specified @p animator will be temporarly removed from the set of + * The specified @p animator will be temporarily removed from the set of * animators that are executed during main loop. * * @warning Freezing an animator doesn't freeze accounting of how long that @@ -1069,7 +1418,7 @@ EAPI double ecore_animator_frametime_get(void); * has "overshot" the mark) using some interpolation (mapping) algorithm. * * This function useful to create non-linear animations. It offers a variety - * of possible animaton curves to be used: + * of possible animation curves to be used: * @li ECORE_POS_MAP_LINEAR - Linear, returns @p pos * @li ECORE_POS_MAP_ACCELERATE - Start slow then speed up * @li ECORE_POS_MAP_DECELERATE - Start fast then slow down @@ -1107,7 +1456,7 @@ EAPI double ecore_animator_frametime_get(void); * y = (y1 * out) + (y2 * (1.0 - out)); * move_my_object_to(myobject, x, y); * @endcode - * This will make an animaton that bounces 7 each times diminishing by a + * This will make an animation that bounces 7 each times diminishing by a * factor of 1.8. * * @see _Ecore_Pos_Map @@ -1205,16 +1554,39 @@ EAPI void ecore_animator_custom_tick(void); */ /** - * @defgroup Ecore_Time_Group Ecore Time functions - * - * Functions that deal with time. These functions include those - * that simply retrieve it in a given format, and those that create - * events based on it. + * @defgroup Ecore_Time_Group Ecore time functions * - * The timer allows callbacks to be called at specific intervals. + * These are function to retrieve time in a given format. * - * Examples with functions that deal with time: + * Examples: * @li @ref ecore_time_functions_example_c + * @{ + */ +EAPI double ecore_time_get(void); +EAPI double ecore_time_unix_get(void); +EAPI double ecore_loop_time_get(void); + +/** + * @} + */ + +/** + * @defgroup Ecore_Timer_Group Ecore Timer functions + * + * Ecore provides very flexible timer functionality. The basic usage of timers, + * to call a certain function at a certain interval can be achieved with a + * single line: + * @code + * Eina_Bool my_func(void *data) { + * do_funky_stuff_with_data(data); + * return EINA_TRUE; + * } + * ecore_timer_add(interval_in_seconds, my_func, data_given_to_function); + * @endcode + * @note If the function was to be executed only once simply return EINA_FALSE + * instead. + * + * An example that shows the usage of a lot of these: * @li @ref ecore_timer_example_c * * @ingroup Ecore_Main_Loop_Group @@ -1224,10 +1596,6 @@ EAPI void ecore_animator_custom_tick(void); typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */ -EAPI double ecore_time_get(void); -EAPI double ecore_time_unix_get(void); -EAPI double ecore_loop_time_get(void); - EAPI Ecore_Timer *ecore_timer_add(double in, Ecore_Task_Cb func, const void *data); EAPI Ecore_Timer *ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data); EAPI void *ecore_timer_del(Ecore_Timer *timer); @@ -1249,14 +1617,15 @@ EAPI char *ecore_timer_dump(void); /** * @defgroup Ecore_Idle_Group Ecore Idle functions * - * Callbacks that are called when the program enters or exits an - * idle state. + * The idler functionality in Ecore allows for callbacks to be called when the + * program isn't handling @ref Ecore_Event_Group "events", @ref Ecore_Timer_Group + * "timers" or @ref Ecore_FD_Handler_Group "fd handlers". * - * The ecore main loop enters an idle state when it is waiting for - * timers to time out, data to come in on a file descriptor or any - * other event to occur. You can set callbacks to be called when - * the main loop enters an idle state, during an idle state or just - * after the program wakes up. + * There are three types of idlers: Enterers, Idlers(proper) and Exiters. They + * are called, respectively, when the program is about to enter an idle state, + * when the program is in an idle state and when the program has just left an + * idle state and will begin processing @ref Ecore_Event_Group "events", @ref + * Ecore_Timer_Group "timers" or @ref Ecore_FD_Handler_Group "fd handlers". * * Enterer callbacks are good for updating your program's state, if * it has a state engine. Once all of the enterer handlers are @@ -1266,14 +1635,13 @@ EAPI char *ecore_timer_dump(void); * enterer handlers. They are useful for interfaces that require * polling and timers would be too slow to use. * + * Exiter callbacks are called when the main loop wakes up from an idle state. + * * If no idler callbacks are specified, then the process literally * goes to sleep. Otherwise, the idler callbacks are called * continuously while the loop is "idle", using as much CPU as is * available to the process. * - * Exiter callbacks are called when the main loop wakes up from an - * idle state. - * * @note Idle state doesn't mean that the @b program is idle, but * that the main loop is idle. It doesn't have any timers, * 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); * thread, the one running the main loop. This problem can be solved * by running a thread that sends messages to the main one using an * @ref Ecore_Pipe_Group "Ecore_Pipe", but when you need to handle other - * things like cancelling the thread, your code grows in coplexity and gets + * things like cancelling the thread, your code grows in complexity and gets * much harder to maintain. * * 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_ * with ecore_thread_feedback(). * * Like with ecore_thread_run(), a new thread will be launched to run - * @p func_heavy unless the maximum number of simultaneous threadas has been + * @p func_heavy unless the maximum number of simultaneous threads has been * reached, in which case the function will be scheduled to run whenever a * running task ends and a thread becomes free. But if @p try_no_queue is * 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); * also will be executed in the order in which they were added. * * A good use for them is when you don't want to execute an action - * immeditately, but want to give the control back to the main loop + * immediately, but want to give the control back to the main loop * so that it will call your job callback when jobs start being * processed (and if there are other jobs added before yours, they * 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 else +if ECORE_HAVE_EXOTIC + +libecore_la_SOURCES += + +else + libecore_la_SOURCES += ecore_signal.c ecore_exe.c endif @@ -55,6 +61,8 @@ endif endif +endif + libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ 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@ @ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_exe_win32.c @ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__append_2 = ecore_exe_wince.c @ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_3 = ecore_exe_ps3.c -@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_4 = ecore_signal.c ecore_exe.c +@ECORE_HAVE_EXOTIC_TRUE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_4 = +@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 subdir = src/lib/ecore DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in @@ -54,16 +55,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -100,15 +100,16 @@ am__libecore_la_SOURCES_DIST = ecore.c ecore_alloc.c ecore_anim.c \ @ECORE_HAVE_WIN32_TRUE@am__objects_1 = ecore_exe_win32.lo @ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__objects_2 = ecore_exe_wince.lo @ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_3 = ecore_exe_ps3.lo -@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_4 = ecore_signal.lo \ -@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@ ecore_exe.lo +am__objects_4 = +@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_5 = ecore_signal.lo \ +@ECORE_HAVE_EXOTIC_FALSE@@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@ ecore_exe.lo am_libecore_la_OBJECTS = ecore.lo ecore_alloc.lo ecore_anim.lo \ ecore_app.lo ecore_events.lo ecore_getopt.lo \ ecore_idle_enterer.lo ecore_idle_exiter.lo ecore_idler.lo \ ecore_job.lo ecore_main.lo ecore_pipe.lo ecore_poll.lo \ ecore_time.lo ecore_timer.lo ecore_thread.lo ecore_glib.lo \ ecore_throttle.lo $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) $(am__objects_4) + $(am__objects_3) $(am__objects_4) $(am__objects_5) libecore_la_OBJECTS = $(am_libecore_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -211,6 +212,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -266,6 +269,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -276,6 +281,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ @@ -503,7 +509,8 @@ libecore_la_SOURCES = ecore.c ecore_alloc.c ecore_anim.c ecore_app.c \ ecore_idle_exiter.c ecore_idler.c ecore_job.c ecore_main.c \ ecore_pipe.c ecore_poll.c ecore_time.c ecore_timer.c \ ecore_thread.c ecore_glib.c ecore_throttle.c $(am__append_1) \ - $(am__append_2) $(am__append_3) $(am__append_4) + $(am__append_2) $(am__append_3) $(am__append_4) \ + $(am__append_5) libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ EXTRA_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) if (!ecore_mempool_init()) goto shutdown_mempool; _ecore_main_loop_init(); _ecore_signal_init(); - _ecore_thread_init(); +#ifndef HAVE_EXOTIC _ecore_exe_init(); +#endif + _ecore_thread_init(); _ecore_glib_init(); _ecore_job_init(); _ecore_time_init(); @@ -252,7 +254,9 @@ ecore_shutdown(void) _ecore_glib_shutdown(); _ecore_job_shutdown(); _ecore_thread_shutdown(); +#ifndef HAVE_EXOTIC _ecore_exe_shutdown(); +#endif _ecore_idle_enterer_shutdown(); _ecore_idle_exiter_shutdown(); _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, return pos; case ECORE_POS_MAP_ACCELERATE: - pos = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0)); + pos = 1.0 - _pos_map_sin(M_PI_2 + pos * M_PI_2); return pos; case ECORE_POS_MAP_DECELERATE: - pos = _pos_map_sin((pos * M_PI) / 2.0); + pos = _pos_map_sin(pos * M_PI_2); return pos; 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; static void _ecore_event_purge_deleted(void); static void *_ecore_event_del(Ecore_Event *event); -/** - * @addtogroup Ecore_Event_Group - * - * @{ - */ - -/** - * Add an event handler. - * @param type The type of the event this handler will get called for - * @param func The function to call when the event is found in the queue - * @param data A data pointer to pass to the called function @p func - * @return A new Event handler, or NULL on failure - * - * Add an event handler to the list of handlers. This will, on success, return - * a handle to the event handler object that was created, that can be used - * later to remove the handler using ecore_event_handler_del(). The @p type - * parameter is the integer of the event type that will trigger this callback - * to be called. The callback @p func is called when this event is processed - * and will be passed the event type, a pointer to the private event - * structure that is specific to that event type, and a data pointer that is - * provided in this call as the @p data parameter. - * - * When the callback @p func is called, it must return 1 or 0. If it returns - * 1 (or ECORE_CALLBACK_PASS_ON), It will keep being called as per normal, for - * each handler set up for that event type. If it returns 0 (or - * ECORE_CALLBACK_DONE), it will cease processing handlers for that particular - * event, so all handler set to handle that event type that have not already - * been called, will not be. - */ EAPI Ecore_Event_Handler * ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, @@ -151,16 +122,6 @@ unlock: return eh; } -/** - * Delete an event handler. - * @param event_handler Event handler handle to delete - * @return Data passed to handler - * - * Delete a specified event handler from the handler list. On success this will - * delete the event handler and return the pointer passed as @p data when the - * handler was added by ecore_event_handler_add(). On failure NULL will be - * returned. Once a handler is deleted it will no longer be called. - */ EAPI void * ecore_event_handler_del(Ecore_Event_Handler *event_handler) { @@ -180,14 +141,6 @@ unlock: return data; } -/** - * @brief Get the data associated with an #Ecore_Event_Handler - * @param eh The event handler - * @return The data - * - * This function returns the data previously associated with @p eh by - * ecore_event_handler_add(). - */ EAPI void * ecore_event_handler_data_get(Ecore_Event_Handler *eh) { @@ -205,15 +158,6 @@ unlock: return data; } -/** - * @brief Set the data associated with an #Ecore_Event_Handler - * @param eh The event handler - * @param data The data to associate - * @return The previous data - * - * This function sets @p data to @p eh and returns the old data pointer - * which was previously associated with @p eh by ecore_event_handler_add(). - */ EAPI void * ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data) @@ -238,27 +182,9 @@ static void _ecore_event_generic_free(void *data __UNUSED__, void *event) { /* DO NOT MEMPOOL FREE THIS */ - free (event); + free(event); } -/** - * Add an event to the event queue. - * @param type The event type to add to the end of the event queue - * @param ev The private data structure for this event type - * @param func_free The function to be called to free this private structure - * @param data The data pointer to be passed to the free function - * @return A Handle for that event - * - * On success this function returns a handle to an event on the event queue, or - * NULL if it fails. If it succeeds, an event of type @p type will be added - * to the queue for processing by event handlers added by - * ecore_event_handler_add(). The @p ev parameter will be a pointer to the event - * private data that is specific to that event type. When the event is no - * longer needed, @p func_free will be called and passed the private structure - * pointer for cleaning up. If @p func_free is NULL, free() will be called - * with the private structure pointer. - * func_free is passed @p data as its data parameter. - */ EAPI Ecore_Event * ecore_event_add(int type, void *ev, @@ -279,17 +205,6 @@ unlock: return event; } -/** - * Delete an event from the queue. - * @param event The event handle to delete - * @return The data pointer originally set for the event free function - * - * This deletes the event @p event from the event queue, and returns the - * @p data parameer originally set when adding it with ecore_event_add(). This - * does not immediately call the free function, and it may be called later on - * cleanup, and so if the free function depends on the data pointer to work, - * you should defer cleaning of this till the free function is called later. - */ EAPI void * ecore_event_del(Ecore_Event *event) { @@ -309,16 +224,6 @@ unlock: return data; } -/** - * Allocate a new event type id sensibly and return the new id. - * @return A new event type id. - * - * This function allocates a new event type id and returns it. Once an event - * type has been allocated it can never be de-allocated during the life of - * the program. There is no guarantee of the contents of this event ID, or how - * it is calculated, except that the ID will be unique to the current instance - * of the process. - */ EAPI int ecore_event_type_new(void) { @@ -331,26 +236,6 @@ ecore_event_type_new(void) return id; } -/** - * Add a filter the current event queue. - * @param func_start Function to call just before filtering and return data - * @param func_filter Function to call on each event - * @param func_end Function to call after the queu has been filtered - * @param data Data to pass to the filter functions - * @return A filter handle - * - * This adds a filter to call callbacks to loop through the event queue and - * filter events out of the queue. On failure NULL is returned. On success a - * Filter handle is returned. Filters are called on the queue just before - * Event handler processing to try and remove redundant events. Just as - * processing starts @p func_start is called and passed the @p data pointer. - * This function returns a pointer that is used as loop_data that is now passed to - * @p func_filter as loop_data. @p func_filter is also passed @p data and the - * event type and private event structure. If this callback returns 0, the - * event is removed from the queue. If it returns 1, the event is kept. When - * processing is finished @p func_end is called and is passed the loop_data - * and @p data pointer to clean up. - */ EAPI Ecore_Event_Filter * ecore_event_filter_add(Ecore_Data_Cb func_start, Ecore_Filter_Cb func_filter, @@ -374,15 +259,6 @@ unlock: return ef; } -/** - * Delete an event filter. - * @param ef The event filter handle - * @return The data set for the filter - * - * Delete a filter that has been added by its @p ef handle. On success this - * will return the data pointer set when this filter was added. On failure - * NULL is returned. - */ EAPI void * ecore_event_filter_del(Ecore_Event_Filter *ef) { @@ -404,50 +280,18 @@ unlock: return data; } -/** - * Return the current event type being handled. - * @return The current event type being handled if inside a handler callback - * - * If the program is currently inside an Ecore event handler callback this - * will return the type of the current event being processed. If Ecore is - * not inside an event handler, ECORE_EVENT_NONE is returned. - * - * This is useful when certain Ecore modules such as Ecore_Evas "swallow" - * events and not all the original information is passed on. In special cases - * this extra information may be useful or needed and using this call can let - * the program know if the event type being handled is one it wants to get more - * information about. - */ EAPI int ecore_event_current_type_get(void) { return ecore_raw_event_type; } -/** - * Return the current event type pointer handled. - * @return The current event pointer being handled if inside a handler callback - * - * If the program is currently inside an Ecore event handler callback this - * will return the pointer of the current event being processed. If Ecore is - * not inside an event handler, NULL will be returned. - * - * This is useful when certain Ecore modules such as Ecore_Evas "swallow" - * events and not all the original information is passed on. In special cases - * this extra information may be useful or needed and using this call can let - * the program access the event data if the type of the event is handled by - * the program. - */ EAPI void * ecore_event_current_event_get(void) { return ecore_raw_event_event; } -/** - * @} - */ - EAPI void * _ecore_event_handler_del(Ecore_Event_Handler *event_handler) { 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; * This sets the priority of processes run by ecore_exe_run() and * ecore_exe_pipe_run(). * @li On Windows, the child process is created by default with the - * #ECORE_EXE_WIN32_PRIORITY_NORMAL priority, unless the calling - * process is in #ECORE_EXE_WIN32_PRIORITY_IDLE or - * #ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL priority. In that case, the + * @ref ECORE_EXE_WIN32_PRIORITY_NORMAL priority, unless the calling + * process is in @ref ECORE_EXE_WIN32_PRIORITY_IDLE or + * @ref ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL priority. In that case, the * child process inherits this priority. - * @li On other platforms, if set to #ECORE_EXE_PRIORITY_INHERIT child + * @li On other platforms, if set to @ref ECORE_EXE_PRIORITY_INHERIT child * processes inherits the priority of their parent. This is the default. * * @param pri value a Ecore_Exe_Win32_Priority value on Windows, -20 - * to 19 or ECORE_EXE_PRIORITY_INHERIT on other OS. + * to 19 or @ref ECORE_EXE_PRIORITY_INHERIT on other OS. */ EAPI void ecore_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); # include #endif +#ifdef HAVE_EXOTIC +# include +#endif + #include "Ecore.h" #include "Ecore_Getopt.h" 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; #ifdef _WIN32 Ecore_Select_Function main_loop_select = _ecore_main_win32_select; #else -# ifdef HAVE_SYS_SELECT_H -# include -# endif +# if !defined EXOTIC_NO_SELECT +# ifdef HAVE_SYS_SELECT_H +# include +# endif Ecore_Select_Function main_loop_select = select; +# else +Ecore_Select_Function main_loop_select = NULL; +# endif #endif #ifndef USE_G_MAIN_LOOP @@ -848,6 +852,21 @@ _ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) * DO NOT use this function unless you are the person God comes to ask for * advice when He has trouble managing the Universe. */ + +EAPI int +ecore_main_loop_iterate_may_block(int may_block) +{ +#ifndef USE_G_MAIN_LOOP + _ecore_lock(); +in_main_loop++; + _ecore_main_loop_iterate_internal(!may_block); +in_main_loop--; + _ecore_unlock(); + return _ecore_event_exist(); +#else + return g_main_context_iteration(NULL, may_block); +#endif +} EAPI void ecore_main_loop_iterate(void) { @@ -945,39 +964,6 @@ ecore_main_loop_select_func_get(void) return main_loop_select; } -/** - * Adds a callback for activity on the given file descriptor. - * - * @p func will be called during the execution of @ref ecore_main_loop_begin - * when the file descriptor is available for reading, or writing, or both. - * - * Normally when @p func returns ECORE_CALLBACK_CANCEL, it indicates that the - * handler should be marked for deletion (identical to calling @ref ecore_main_fd_handler_del). - * However, if the @p buf_func is supplied, then the return value from the @p func indicates that - * @p func should be called repeatedly until it returns ECORE_CALLBACK_CANCEL. - * - * @p buf_func is called during event loop handling to check if data that has - * been read from the file descriptor is in a buffer and is available to - * read. Some systems (notably xlib) handle their own buffering, and would - * otherwise not work with select(). These systems should use a @p buf_func. - * This is a most annoying hack, only ecore_x uses it, so refer to that for - * an example. NOTE - @p func should probably return ECORE_CALLBACK_RENEW always if - * @p buf_func is used, to avoid confusion with the other return value - * semantics. - * - * @param fd The file descriptor to watch. - * @param flags To watch it for read (@c ECORE_FD_READ) and/or - * (@c ECORE_FD_WRITE) write ability. @c ECORE_FD_ERROR - * - * @param func The callback function. - * @param data The data to pass to the callback. - * @param buf_func The function to call to check if any data has been - * buffered and already read from the fd. Can be @c NULL. - * @param buf_data The data to pass to the @p buf_func function. - * @return A fd handler handle if successful. @c NULL otherwise. - * @note This function CANNOT be used for reading/writing to regular files! - * @ingroup Ecore_FD_Handler_Group - */ EAPI Ecore_Fd_Handler * ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, @@ -1059,20 +1045,6 @@ ecore_main_win32_handler_add(void *h __UNUSED__, #endif -/** - * Marks an FD handler for deletion. - * @param fd_handler The FD handler. - * @return The data pointer set using @ref ecore_main_fd_handler_add, - * for @p fd_handler on success. @c NULL otherwise. - * @ingroup Ecore_FD_Handler_Group - * This function marks an fd handler to be deleted during an iteration of the main loop. - * It does NOT close the associated fd! - * - * @note If the underlying fd is already closed ecore may complain if the main loop - * is using epoll internally, and also in some rare cases this may cause - * crashes and instability. Remember to delete your fd handlers before the - * fds they listen to are closed. - */ EAPI void * ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) { @@ -1116,24 +1088,6 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__) #endif -/** - * @brief Set the prepare callback with data for a given #Ecore_Fd_Handler - * - * @param fd_handler The fd handler - * @param func The prep function - * @param data The data to pass to the prep function - * - * This function will be called prior to any fd handler's callback function - * (even the other fd handlers), before entering the main loop select function. - * - * @note Once a prepare callback is set for a fd handler, it cannot be changed. - * You need to delete the fd handler and create a new one, to set another - * callback. - * @note You probably don't need this function. It is only necessary for very - * uncommon cases that need special behavior. - * - * @ingroup Ecore_FD_Handler_Group - */ EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, @@ -1157,12 +1111,6 @@ unlock: _ecore_unlock(); } -/** - * Retrieves the file descriptor that the given handler is handling. - * @param fd_handler The given FD handler. - * @return The file descriptor the handler is watching. - * @ingroup Ecore_FD_Handler_Group - */ EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler) { @@ -1182,15 +1130,6 @@ unlock: return fd; } -/** - * Return if read, write or error, or a combination thereof, is active on the - * file descriptor of the given FD handler. - * @param fd_handler The given FD handler. - * @param flags The flags, @c ECORE_FD_READ, @c ECORE_FD_WRITE or - * @c ECORE_FD_ERROR to query. - * @return #EINA_TRUE if any of the given flags are active. #EINA_FALSE otherwise. - * @ingroup Ecore_FD_Handler_Group - */ EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) @@ -1213,12 +1152,6 @@ unlock: return ret; } -/** - * Set what active streams the given FD handler should be monitoring. - * @param fd_handler The given FD handler. - * @param flags The flags to be watching. - * @ingroup Ecore_FD_Handler_Group - */ EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) @@ -1742,14 +1675,14 @@ _ecore_main_loop_iterate_internal(int once_only) if (_ecore_event_exist()) { /* but first conceptually enter an idle state */ - _ecore_idle_enterer_call(); - _ecore_throttle(); - /* now quickly poll to see which input fd's are active */ - _ecore_main_select(0.0); - /* allow newly queued timers to expire from now on */ - _ecore_timer_enable_new(); - /* go straight to processing the events we had queued */ - goto process_all; + _ecore_idle_enterer_call(); + _ecore_throttle(); + /* now quickly poll to see which input fd's are active */ + _ecore_main_select(0.0); + /* allow newly queued timers to expire from now on */ + _ecore_timer_enable_new(); + /* go straight to processing the events we had queued */ + goto process_all; } if (once_only) @@ -1758,17 +1691,17 @@ _ecore_main_loop_iterate_internal(int once_only) * if we got any events or signals, allow new timers to process. * use bitwise or to force both conditions to be tested and * merged together */ - if (_ecore_main_select(0.0) | _ecore_signal_count_get()) - { - _ecore_timer_enable_new(); - goto process_all; - } + if (_ecore_main_select(0.0) | _ecore_signal_count_get()) + { + _ecore_timer_enable_new(); + goto process_all; + } } else { /* call idle enterers ... */ - _ecore_idle_enterer_call(); - _ecore_throttle(); + _ecore_idle_enterer_call(); + _ecore_throttle(); } /* if these calls caused any buffered events to appear - deal with them */ @@ -1787,10 +1720,10 @@ _ecore_main_loop_iterate_internal(int once_only) if (once_only) { /* in once_only mode enter idle here instead and then return */ - _ecore_idle_enterer_call(); - _ecore_throttle(); - _ecore_timer_enable_new(); - goto done; + _ecore_idle_enterer_call(); + _ecore_throttle(); + _ecore_timer_enable_new(); + goto done; } _ecore_fps_marker_1(); @@ -1808,23 +1741,23 @@ start_loop: /***************************************************************/ if (!_ecore_event_exist()) { /* init flags */ - next_time = _ecore_timer_next_get(); - /* no idlers */ - if (!_ecore_idler_exist()) - { - /* sleep until timeout or forever (-1.0) waiting for on fds */ - _ecore_main_select(next_time); - } - else - { - int action = LOOP_CONTINUE; + next_time = _ecore_timer_next_get(); + /* no idlers */ + if (!_ecore_idler_exist()) + { + /* sleep until timeout or forever (-1.0) waiting for on fds */ + _ecore_main_select(next_time); + } + else + { + int action = LOOP_CONTINUE; - /* no timers - spin */ - if (next_time < 0) action = _ecore_main_loop_spin_no_timers(); - /* timers - spin */ - else action = _ecore_main_loop_spin_timers(); - if (action == SPIN_RESTART) goto start_loop; - } + /* no timers - spin */ + if (next_time < 0) action = _ecore_main_loop_spin_no_timers(); + /* timers - spin */ + else action = _ecore_main_loop_spin_timers(); + if (action == SPIN_RESTART) goto start_loop; + } } _ecore_fps_marker_2(); @@ -1847,8 +1780,8 @@ process_all: /***********************************************************/ if (once_only) { /* if in once_only mode handle idle exiting */ - _ecore_idle_enterer_call(); - _ecore_throttle(); + _ecore_idle_enterer_call(); + _ecore_throttle(); } done: /*******************************************************************/ 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 @@ # include #endif +#ifdef HAVE_EXOTIC +# include +#endif + #include "Ecore.h" #include "ecore_private.h" -#ifdef _WIN32 -# define FMT_SSIZE_T "%Id" -#else -# define FMT_SSIZE_T "%zd" -#endif - /* How of then we should retry to write to the pipe */ #define ECORE_PIPE_WRITE_RETRY 6 @@ -80,6 +78,9 @@ #endif /* ! _WIN32 */ +#include +#include "ecore_private.h" + struct _Ecore_Pipe { ECORE_MAGIC; @@ -414,7 +415,7 @@ ecore_pipe_write(Ecore_Pipe *p, ; else { - ERR("An unhandled error (ret: " FMT_SSIZE_T " errno: %d)" + ERR("An unhandled error (ret: %zd errno: %d)" "occurred while writing to the pipe the length", ret, errno); } @@ -448,7 +449,7 @@ ecore_pipe_write(Ecore_Pipe *p, ; else { - ERR("An unhandled error (ret: " FMT_SSIZE_T " errno: %d)" + ERR("An unhandled error (ret: %zd errno: %d)" "occurred while writing to the pipe the length", ret, errno); } 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__) return ECORE_CALLBACK_RENEW; } -/** - * @addtogroup Ecore_Poller_Group - * - * @{ - */ - -/** - * Sets the time between ticks (in seconds) for the given ticker clock. - * @param type The ticker type to adjust - * @param poll_time The time (in seconds) between ticks of the clock - * - * This will adjust the time between ticks of the given ticker type defined - * by @p type to the time period defined by @p poll_time. - */ EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__, double poll_time) @@ -211,65 +197,12 @@ ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__, _ecore_poller_next_tick_eval(); } -/** - * Gets the time between ticks (in seconds) for the given ticker clock. - * @param type The ticker type to query - * @return The time in seconds between ticks of the ticker clock - * - * This will get the time between ticks of the specified ticker clock. - */ EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__) { return poll_interval; } -/** - * Creates a poller to call the given function at a particular tick interval. - * @param type The ticker type to attach the poller to - * @param interval The poll interval - * @param func The given function. If @p func returns 1, the poller is - * rescheduled for the next tick interval. - * @param data Data to pass to @p func when it is called. - * @return A poller object on success. @c NULL on failure. - * - * This function adds a poller callback that is to be called regularly - * along with all other poller callbacks so the pollers are synchronized with - * all other pollers running off the same poller type and at the same tick - * interval. This should be used for polling things when polling is desired - * or required, and you do not have specific requirements on the exact times - * to poll and want to avoid extra process wakeups for polling. This will - * save power as the CPU has more of a chance to go into a low power state - * the longer it is asleep for, so this should be used if you are at all - * power conscious. - * - * The @p type parameter defines the poller tick type (there is a virtual - * clock ticking all the time - though ecore avoids making it tick when - * there will not be any work to do at that tick point). There is only one - * ticker at the moment - that is ECORE_POLLER_CORE. This is here for future - * expansion if multiple clocks with different frequencies are really required. - * The default time between ticks for the ECORE_POLLER_CORE ticker is 0.125 - * seconds. - * - * The @p interval is the number of ticker ticks that will pass by in between - * invocations of the @p func callback. This must be between 1 and 32768 - * inclusive, and must be a power of 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768). - * If it is 1, then the function will be called every tick. if it is 2, then it - * will be called every 2nd tick, if it is 8, then every 8th tick etc. Exactly - * which tick is undefined, as only the interval between calls can be defined. - * Ecore will endeavour to keep pollers synchronised and to call as many in - * 1 wakeup event as possible. - * - * This function adds a poller and returns its handle on success and NULL on - * failure. The function @p func will be called at tick intervals described - * above. The function will be passed the @p data pointer as its parameter. - * - * When the poller @p func is called, it must return a value of either - * 1 (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). If it - * returns 1, it will be called again at the next tick, or if it returns - * 0 it will be deleted automatically making any references/handles for it - * invalid. - */ EAPI Ecore_Poller * ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, @@ -307,16 +240,6 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__, return poller; } -/** - * Changes the polling interval rate of @p poller. - * - * @param poller The Ecore_Poller to change the interval of - * @param interval The tick interval to set; must be a power of 2 but <= 32768 - * @return Returns true on success, false on failure - * - * This allows the changing of a poller's polling interval. It is useful when you want to alter - * a poll rate without deleting and re-creating a poller. - */ EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval) @@ -353,14 +276,6 @@ ecore_poller_poller_interval_set(Ecore_Poller *poller, return EINA_TRUE; } -/** - * Gets the polling interval rate of @p poller. - * - * @param poller The Ecore_Poller to change the interval of - * @return Returns the interval, in ticks, that @p poller polls at - * - * This returns a poller's polling interval, or 0 on error. - */ EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller) { @@ -382,15 +297,6 @@ ecore_poller_poller_interval_get(Ecore_Poller *poller) return interval; } -/** - * Delete the specified poller from the timer list. - * @param poller The poller to delete. - * @return The data pointer set for the timer when @ref ecore_poller_add was - * called. @c NULL is returned if the function is unsuccessful. - * - * Note: @p poller must be a valid handle. If the poller function has already - * returned 0, the handle is no longer valid (and does not need to be delete). - */ EAPI void * ecore_poller_del(Ecore_Poller *poller) { 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); void _ecore_main_shutdown(void); -#if defined (_WIN32) || defined (__lv2ppu__) +#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC) static inline void _ecore_signal_shutdown(void) { } static inline void _ecore_signal_init(void) { } @@ -237,14 +237,14 @@ _ecore_lock(void) EINA_MAIN_LOOP_CHECK_RETURN; #endif _ecore_main_lock_count++; - assert(_ecore_main_lock_count == 1); + /* assert(_ecore_main_lock_count == 1); */ } static inline void _ecore_unlock(void) { _ecore_main_lock_count--; - assert(_ecore_main_lock_count == 0); + /* assert(_ecore_main_lock_count == 0); */ #ifdef HAVE_THREAD_SAFETY eina_lock_release(&_ecore_main_loop_lock); #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 @@ #ifdef EFL_HAVE_THREADS +# define LK(x) Eina_Lock x +# define LKI(x) eina_lock_new(&(x)) +# define LKD(x) eina_lock_free(&(x)) +# define LKL(x) eina_lock_take(&(x)) +# define LKU(x) eina_lock_release(&(x)) + +# define CD(x) Eina_Condition x +# define CDI(x, m) eina_condition_new(&(x), &(m)) +# define CDD(x) eina_condition_free(&(x)) +# define CDB(x) eina_condition_broadcast(&(x)) +# define CDW(x, t) eina_condition_timedwait(&(x), t) + +# define LRWK(x) Eina_RWLock x +# define LRWKI(x) eina_rwlock_new(&(x)); +# define LRWKD(x) eina_rwlock_free(&(x)); +# define LRWKWL(x) eina_rwlock_take_write(&(x)); +# define LRWKRL(x) eina_rwlock_take_read(&(x)); +# define LRWKU(x) eina_rwlock_release(&(x)); + # ifdef EFL_HAVE_POSIX_THREADS # include # ifdef __linux__ @@ -31,28 +50,9 @@ # define PHE(x, y) pthread_equal(x, y) # define PHS() pthread_self() # define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d) -# define PHJ(x, p) pthread_join(x, (void **)(&(p))) +# define PHJ(x) pthread_join(x, NULL) # define PHA(x) pthread_cancel(x) -# define CD(x) pthread_cond_t x -# define CDI(x) pthread_cond_init(&(x), NULL); -# define CDD(x) pthread_cond_destroy(&(x)); -# define CDB(x) pthread_cond_broadcast(&(x)); -# define CDW(x, y, t) pthread_cond_timedwait(&(x), &(y), t); - -# define LK(x) pthread_mutex_t x -# define LKI(x) pthread_mutex_init(&(x), NULL); -# define LKD(x) pthread_mutex_destroy(&(x)); -# define LKL(x) pthread_mutex_lock(&(x)); -# define LKU(x) pthread_mutex_unlock(&(x)); - -# define LRWK(x) pthread_rwlock_t x -# define LRWKI(x) pthread_rwlock_init(&(x), NULL); -# define LRWKD(x) pthread_rwlock_destroy(&(x)); -# define LRWKWL(x) pthread_rwlock_wrlock(&(x)); -# define LRWKRL(x) pthread_rwlock_rdlock(&(x)); -# define LRWKU(x) pthread_rwlock_unlock(&(x)); - # else /* EFL_HAVE_WIN32_THREADS */ # define WIN32_LEAN_AND_MEAN @@ -108,209 +108,9 @@ _ecore_thread_win32_join(win32_thread *x, return 0; } -# define PHJ(x, p) _ecore_thread_win32_join(x, (void **)(&(p))) +# define PHJ(x) _ecore_thread_win32_join(x, NULL) # define PHA(x) TerminateThread(x->thread, 0) -# define LK(x) HANDLE x -# define LKI(x) x = CreateMutex(NULL, FALSE, NULL) -# define LKD(x) CloseHandle(x) -# define LKL(x) WaitForSingleObject(x, INFINITE) -# define LKU(x) ReleaseMutex(x) - -typedef struct -{ - HANDLE semaphore; - LONG threads_count; - CRITICAL_SECTION threads_count_lock; -} win32_cond; - -# define CD(x) win32_cond * x - -# define CDI(x) \ - do { \ - x = (win32_cond *)calloc(1, sizeof(win32_cond)); \ - if (x) \ - { \ - x->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); \ - if (x->semaphore) \ - InitializeCriticalSection(&x->threads_count_lock); \ - else \ - { \ - free(x); \ - x = NULL; \ - } \ - } \ - } while (0) - -# define CDD(x) \ - do { \ - CloseHandle(x->semaphore); \ - free(x); \ - x = NULL; \ - } while (0) - -# define CDB(x) \ - do { \ - EnterCriticalSection(&x->threads_count_lock); \ - if (x->threads_count > 0) \ - ReleaseSemaphore(x->semaphore, x->threads_count, NULL); \ - LeaveCriticalSection (&x->threads_count_lock); \ - } while (0) - -int -_ecore_thread_win32_cond_timedwait(win32_cond *c, - HANDLE *external_mutex, - struct timeval *t) -{ - DWORD res; - DWORD val = t->tv_sec * 1000 + (t->tv_usec / 1000); - LKL(external_mutex); - EnterCriticalSection (&c->threads_count_lock); - c->threads_count++; - LeaveCriticalSection (&c->threads_count_lock); - LKU(external_mutex); - res = WaitForSingleObject(c->semaphore, val); - if (res == WAIT_OBJECT_0) - return 0; - else - return -1; -} - -# define CDW(x, y, t) _ecore_thread_win32_cond_timedwait(x, y, t) - -typedef struct -{ - LONG readers_count; - LONG writers_count; - int readers; - int writers; - LK(mutex); - CD(cond_read); - CD(cond_write); -} win32_rwl; - -# define LRWK(x) win32_rwl * x -# define LRWKI(x) \ - do { \ - x = (win32_rwl *)calloc(1, sizeof(win32_rwl)); \ - if (x) \ - { \ - LKI(x->mutex); \ - if (x->mutex) \ - { \ - CDI(x->cond_read); \ - if (x->cond_read) \ - { \ - CDI(x->cond_write); \ - if (!x->cond_write) \ - { \ - CDD(x->cond_read); \ - LKD(x->mutex); \ - free(x); \ - x = NULL; \ - } \ - } \ - else \ - { \ - LKD(x->mutex); \ - free(x); \ - x = NULL; \ - } \ - } \ - else \ - { \ - free(x); \ - x = NULL; \ - } \ - } \ - } while (0) - -# define LRWKD(x) \ - do { \ - LKU(x->mutex); \ - LKD(x->mutex); \ - CDD(x->cond_write); \ - CDD(x->cond_read); \ - free(x); \ - } while (0) -# define LRWKWL(x) \ - do { \ - DWORD res; \ - LKU(x->mutex); \ - if (x->writers || x->readers > 0) \ - { \ - x->writers_count++; \ - while (x->writers || x->readers > 0) \ - { \ - EnterCriticalSection(&x->cond_write->threads_count_lock); \ - x->cond_read->threads_count++; \ - LeaveCriticalSection(&x->cond_write->threads_count_lock); \ - res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \ - if (res != WAIT_OBJECT_0) break; \ - } \ - x->writers_count--; \ - } \ - if (res == 0) x->writers_count = 1; \ - LKU(x->mutex); \ - } while (0) -# define LRWKRL(x) \ - do { \ - DWORD res; \ - LKL(x->mutex); \ - if (x->writers) \ - { \ - x->readers_count++; \ - while (x->writers) \ - { \ - EnterCriticalSection(&x->cond_write->threads_count_lock); \ - x->cond_read->threads_count++; \ - LeaveCriticalSection(&x->cond_write->threads_count_lock); \ - res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \ - if (res != WAIT_OBJECT_0) break; \ - } \ - x->readers_count--; \ - } \ - if (res == 0) \ - x->readers++; \ - LKU(x->mutex); \ - } while (0) -# define LRWKU(x) \ - do { \ - LKL(x->mutex); \ - if (x->writers) \ - { \ - x->writers = 0; \ - if (x->readers_count == 1) \ - { \ - EnterCriticalSection(&x->cond_read->threads_count_lock); \ - if (x->cond_read->threads_count > 0) \ - ReleaseSemaphore(x->cond_read->semaphore, 1, 0); \ - LeaveCriticalSection(&x->cond_read->threads_count_lock); \ - } \ - else if (x->readers_count > 0) \ - CDB(x->cond_read); \ - else if (x->writers_count > 0) \ - { \ - EnterCriticalSection (&x->cond_write->threads_count_lock); \ - if (x->cond_write->threads_count > 0) \ - ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \ - LeaveCriticalSection (&x->cond_write->threads_count_lock); \ - } \ - } \ - else if (x->readers > 0) \ - { \ - x->readers--; \ - if (x->readers == 0 && x->writers_count > 0) \ - { \ - EnterCriticalSection (&x->cond_write->threads_count_lock); \ - if (x->cond_write->threads_count > 0) \ - ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \ - LeaveCriticalSection (&x->cond_write->threads_count_lock); \ - } \ - } \ - LKU(x->mutex); \ - } while (0) - # endif #endif @@ -336,14 +136,24 @@ struct _Ecore_Pthread_Worker { Ecore_Thread_Cb func_heavy; Ecore_Thread_Notify_Cb func_notify; - Ecore_Pipe *notify; - Ecore_Pipe *direct_pipe; Ecore_Pthread_Worker *direct_worker; int send; int received; } feedback_run; + struct { + Ecore_Thread_Cb func_main; + Ecore_Thread_Notify_Cb func_notify; + + Ecore_Pipe *send; + Ecore_Pthread_Worker *direct_worker; + + struct { + int send; + int received; + } from, to; + } message_run; } u; Ecore_Thread_Cb func_cancel; @@ -357,47 +167,63 @@ struct _Ecore_Pthread_Worker const void *data; - Eina_Bool cancel : 1; - Eina_Bool feedback_run : 1; - Eina_Bool kill : 1; - Eina_Bool reschedule : 1; - Eina_Bool no_queue : 1; + volatile int cancel; + +#ifdef EFL_HAVE_THREADS + LK(cancel_mutex); +#endif + + Eina_Bool message_run : 1; + Eina_Bool feedback_run : 1; + Eina_Bool kill : 1; + Eina_Bool reschedule : 1; + Eina_Bool no_queue : 1; }; #ifdef EFL_HAVE_THREADS typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data; - struct _Ecore_Pthread_Data { Ecore_Pthread_Worker *death_job; - Ecore_Pipe *p; void *data; PH(thread); }; + +typedef struct _Ecore_Pthread_Notify Ecore_Pthread_Notify; +struct _Ecore_Pthread_Notify +{ + Ecore_Pthread_Worker *work; + const void *user_data; +}; + +typedef void *(*Ecore_Thread_Sync_Cb)(void* data, Ecore_Thread *thread); + +typedef struct _Ecore_Pthread_Message Ecore_Pthread_Message; +struct _Ecore_Pthread_Message +{ + union { + Ecore_Thread_Cb async; + Ecore_Thread_Sync_Cb sync; + } u; + + const void *data; + + int code; + + Eina_Bool callback : 1; + Eina_Bool sync : 1; +}; + #endif static int _ecore_thread_count_max = 0; -static int ECORE_THREAD_PIPE_DEL = 0; -static Eina_Array *_ecore_thread_pipe = NULL; #ifdef EFL_HAVE_THREADS -static void _ecore_thread_handler(void *data __UNUSED__, - void *buffer, - unsigned int nbyte); - -static Ecore_Pipe * -_ecore_thread_pipe_get(void) -{ - if (eina_array_count(_ecore_thread_pipe) > 0) - return eina_array_pop(_ecore_thread_pipe); - - return ecore_pipe_add(_ecore_thread_handler, NULL); -} +static void _ecore_thread_handler(void *data); static int _ecore_thread_count = 0; -static Ecore_Event_Handler *del_handler = NULL; static Eina_List *_ecore_active_job_threads = NULL; static Eina_List *_ecore_pending_job_threads = NULL; static Eina_List *_ecore_pending_job_threads_feedback = NULL; @@ -435,6 +261,10 @@ static PH(get_main_loop_thread) (void) static void _ecore_thread_worker_free(Ecore_Pthread_Worker *worker) { + LKD(worker->cancel_mutex); + CDD(worker->cond); + LKD(worker->mutex); + if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16) { free(worker); @@ -454,38 +284,15 @@ _ecore_thread_data_free(void *data) } static void -_ecore_thread_pipe_free(void *data __UNUSED__, - void *event) -{ - Ecore_Pipe *p = event; - - if (eina_array_count(_ecore_thread_pipe) < 50) - eina_array_push(_ecore_thread_pipe, p); - else - ecore_pipe_del(p); - eina_threads_shutdown(); -} - -static Eina_Bool -_ecore_thread_pipe_del(void *data __UNUSED__, - int type __UNUSED__, - void *event __UNUSED__) -{ - /* This is a hack to delay pipe destruction until we are out of its internal loop. */ - return ECORE_CALLBACK_CANCEL; -} - -static void _ecore_thread_end(Ecore_Pthread_Data *pth, Ecore_Thread *work) { Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work; - Ecore_Pipe *p; - if (!worker->feedback_run || (worker->feedback_run && !worker->no_queue)) + if (!worker->message_run || !worker->feedback_run || (worker->feedback_run && !worker->no_queue)) _ecore_thread_count--; - if (PHJ(pth->thread, p) != 0) + if (PHJ(pth->thread) != 0) return; if (eina_list_count(_ecore_pending_job_threads) > 0 @@ -496,7 +303,7 @@ _ecore_thread_end(Ecore_Pthread_Data *pth, INF("spawning threads because of still pending jobs."); pth->death_job = _ecore_thread_worker_new(); - if (!pth->p || !pth->death_job) goto end; + if (!pth->death_job) goto end; eina_threads_init(); @@ -514,7 +321,6 @@ end: _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth); - ecore_event_add(ECORE_THREAD_PIPE_DEL, pth->p, _ecore_thread_pipe_free, NULL); free(pth); } @@ -534,30 +340,18 @@ _ecore_thread_kill(Ecore_Pthread_Worker *work) if (work->feedback_run) { - ecore_pipe_del(work->u.feedback_run.notify); - - if (work->u.feedback_run.direct_pipe) - eina_array_push(_ecore_thread_pipe, work->u.feedback_run.direct_pipe); if (work->u.feedback_run.direct_worker) _ecore_thread_worker_free(work->u.feedback_run.direct_worker); } - CDD(work->cond); - LKD(work->mutex); if (work->hash) eina_hash_free(work->hash); _ecore_thread_worker_free(work); } static void -_ecore_thread_handler(void *data __UNUSED__, - void *buffer, - unsigned int nbyte) +_ecore_thread_handler(void *data) { - Ecore_Pthread_Worker *work; - - if (nbyte != sizeof (Ecore_Pthread_Worker *)) return; - - work = *(Ecore_Pthread_Worker **)buffer; + Ecore_Pthread_Worker *work = data; if (work->feedback_run) { @@ -571,17 +365,20 @@ _ecore_thread_handler(void *data __UNUSED__, _ecore_thread_kill(work); } +#if 0 static void -_ecore_notify_handler(void *data, - void *buffer, - unsigned int nbyte) +_ecore_nothing_handler(void *data __UNUSED__, void *buffer __UNUSED__, unsigned int nbyte __UNUSED__) { - Ecore_Pthread_Worker *work = data; - void *user_data; +} +#endif - if (nbyte != sizeof (Ecore_Pthread_Worker *)) return; +static void +_ecore_notify_handler(void *data) +{ + Ecore_Pthread_Notify *notify = data; + Ecore_Pthread_Worker *work = notify->work; + void *user_data = (void*) notify->user_data; - user_data = *(void **)buffer; work->u.feedback_run.received++; if (work->u.feedback_run.func_notify) @@ -592,16 +389,64 @@ _ecore_notify_handler(void *data, { _ecore_thread_kill(work); } + + free(notify); +} + +static void +_ecore_message_notify_handler(void *data) +{ + Ecore_Pthread_Notify *notify = data; + Ecore_Pthread_Worker *work = notify->work; + Ecore_Pthread_Message *user_data = (void *) notify->user_data; + Eina_Bool delete = EINA_TRUE; + + work->u.message_run.from.received++; + + if (!user_data->callback) + { + if (work->u.message_run.func_notify) + work->u.message_run.func_notify((void *) work->data, (Ecore_Thread *) work, (void *) user_data->data); + } + else + { + if (user_data->sync) + { + user_data->data = user_data->u.sync((void*) user_data->data, (Ecore_Thread *) work); + user_data->callback = EINA_FALSE; + user_data->code = INT_MAX; + ecore_pipe_write(work->u.message_run.send, &user_data, sizeof (Ecore_Pthread_Message *)); + + delete = EINA_FALSE; + } + else + { + user_data->u.async((void*) user_data->data, (Ecore_Thread *) work); + } + } + + if (delete) + { + free(user_data); + } + + /* Force reading all notify event before killing the thread */ + if (work->kill && work->u.message_run.from.send == work->u.message_run.from.received) + { + _ecore_thread_kill(work); + } + free(notify); } static void -_ecore_short_job(Ecore_Pipe *end_pipe, - PH(thread)) +_ecore_short_job(PH(thread)) { Ecore_Pthread_Worker *work; while (_ecore_pending_job_threads) { + int cancel; + LKL(_ecore_pending_job_threads_mutex); if (!_ecore_pending_job_threads) @@ -616,9 +461,12 @@ _ecore_short_job(Ecore_Pipe *end_pipe, LKU(_ecore_pending_job_threads_mutex); + LKL(work->cancel_mutex); + cancel = work->cancel; + LKU(work->cancel_mutex); work->self = thread; - if (!work->cancel) - work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work); + if (!cancel) + work->u.short_run.func_blocking((void *) work->data, (Ecore_Thread*) work); if (work->reschedule) { @@ -630,19 +478,20 @@ _ecore_short_job(Ecore_Pipe *end_pipe, } else { - ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *)); + ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work); } } } static void -_ecore_feedback_job(Ecore_Pipe *end_pipe, - PH(thread)) +_ecore_feedback_job(PH(thread)) { Ecore_Pthread_Worker *work; while (_ecore_pending_job_threads_feedback) { + int cancel; + LKL(_ecore_pending_job_threads_mutex); if (!_ecore_pending_job_threads_feedback) @@ -657,9 +506,12 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe, LKU(_ecore_pending_job_threads_mutex); + LKL(work->cancel_mutex); + cancel = work->cancel; + LKU(work->cancel_mutex); work->self = thread; - if (!work->cancel) - work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work); + if (!cancel) + work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work); if (work->reschedule) { @@ -671,7 +523,7 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe, } else { - ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *)); + ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work); } } } @@ -679,6 +531,7 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe, static void * _ecore_direct_worker(Ecore_Pthread_Worker *work) { + Ecore_Pthread_Worker *end; Ecore_Pthread_Data *pth; #ifdef EFL_POSIX_THREADS @@ -691,40 +544,49 @@ _ecore_direct_worker(Ecore_Pthread_Worker *work) pth = malloc(sizeof (Ecore_Pthread_Data)); if (!pth) return NULL; - pth->p = work->u.feedback_run.direct_pipe; - if (!pth->p) - { - free(pth); - return NULL; - } pth->thread = PHS(); work->self = pth->thread; - work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work); + if (work->message_run) + work->u.message_run.func_main((void *) work->data, (Ecore_Thread *) work); + else + work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work); - ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); + if (work->message_run) + { + end = work->u.message_run.direct_worker; + work->u.message_run.direct_worker = NULL; + } + else + { + end = work->u.feedback_run.direct_worker; + work->u.feedback_run.direct_worker = NULL; + } - work = work->u.feedback_run.direct_worker; - if (!work) + ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work); + + if (!end) { free(pth); return NULL; } - work->data = pth; - work->u.short_run.func_blocking = NULL; - work->func_end = (void *)_ecore_thread_end; - work->func_cancel = NULL; - work->cancel = EINA_FALSE; - work->feedback_run = EINA_FALSE; - work->kill = EINA_FALSE; - work->hash = NULL; - CDI(work->cond); - LKI(work->mutex); - - ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); + end->data = pth; + end->u.short_run.func_blocking = NULL; + end->func_end = (void *)_ecore_thread_end; + end->func_cancel = NULL; + end->cancel = EINA_FALSE; + end->feedback_run = EINA_FALSE; + end->message_run = EINA_FALSE; + end->no_queue = EINA_FALSE; + end->kill = EINA_FALSE; + end->hash = NULL; + LKI(end->mutex); + CDI(end->cond, end->mutex); + + ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, end); - return pth->p; + return NULL; } static void * @@ -740,8 +602,8 @@ _ecore_thread_worker(Ecore_Pthread_Data *pth) eina_sched_prio_drop(); restart: - if (_ecore_pending_job_threads) _ecore_short_job(pth->p, pth->thread); - if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->p, pth->thread); + if (_ecore_pending_job_threads) _ecore_short_job(pth->thread); + if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->thread); /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */ @@ -777,14 +639,14 @@ restart: work->func_cancel = NULL; work->cancel = EINA_FALSE; work->feedback_run = EINA_FALSE; + work->message_run = EINA_FALSE; work->kill = EINA_FALSE; + work->no_queue = EINA_FALSE; work->hash = NULL; - CDI(work->cond); - LKI(work->mutex); - ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); + ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work); - return pth->p; + return NULL; } #endif @@ -800,6 +662,10 @@ _ecore_thread_worker_new(void) if (!result) result = malloc(sizeof (Ecore_Pthread_Worker)); else _ecore_thread_worker_count--; + LKI(result->cancel_mutex); + LKI(result->mutex); + CDI(result->cond, result->mutex); + return result; #else return malloc(sizeof (Ecore_Pthread_Worker)); @@ -813,16 +679,11 @@ _ecore_thread_init(void) if (_ecore_thread_count_max <= 0) _ecore_thread_count_max = 1; - ECORE_THREAD_PIPE_DEL = ecore_event_type_new(); - _ecore_thread_pipe = eina_array_new(8); - #ifdef EFL_HAVE_THREADS - del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL); - LKI(_ecore_pending_job_threads_mutex); LRWKI(_ecore_thread_global_hash_lock); LKI(_ecore_thread_global_hash_mutex); - CDI(_ecore_thread_global_hash_cond); + CDI(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex); #endif } @@ -830,10 +691,6 @@ void _ecore_thread_shutdown(void) { /* FIXME: If function are still running in the background, should we kill them ? */ - Ecore_Pipe *p; - Eina_Array_Iterator it; - unsigned int i; - #ifdef EFL_HAVE_THREADS Ecore_Pthread_Worker *work; Ecore_Pthread_Data *pth; @@ -843,46 +700,39 @@ _ecore_thread_shutdown(void) EINA_LIST_FREE(_ecore_pending_job_threads, work) { if (work->func_cancel) - work->func_cancel((void *)work->data, (Ecore_Thread *)work); + work->func_cancel((void *)work->data, (Ecore_Thread *) work); free(work); } EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work) { if (work->func_cancel) - work->func_cancel((void *)work->data, (Ecore_Thread *)work); + work->func_cancel((void *)work->data, (Ecore_Thread *) work); free(work); } LKU(_ecore_pending_job_threads_mutex); - /* Improve emergency shutdown */ + /* FIXME: Improve emergency shutdown, now that we use async call, we can do something */ EINA_LIST_FREE(_ecore_active_job_threads, pth) { - Ecore_Pipe *ep; - PHA(pth->thread); - PHJ(pth->thread, ep); - - ecore_pipe_del(pth->p); + PHJ(pth->thread); } if (_ecore_thread_global_hash) eina_hash_free(_ecore_thread_global_hash); - _ecore_event_handler_del(del_handler); have_main_loop_thread = 0; - del_handler = NULL; + + while ((work = eina_trash_pop(&_ecore_thread_worker_trash))) + { + free(work); + } LKD(_ecore_pending_job_threads_mutex); LRWKD(_ecore_thread_global_hash_lock); LKD(_ecore_thread_global_hash_mutex); CDD(_ecore_thread_global_hash_cond); #endif - - EINA_ARRAY_ITER_NEXT(_ecore_thread_pipe, i, p, it) - ecore_pipe_del(p); - - eina_array_free(_ecore_thread_pipe); - _ecore_thread_pipe = NULL; } void @@ -927,15 +777,15 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking, work->func_cancel = func_cancel; work->cancel = EINA_FALSE; work->feedback_run = EINA_FALSE; + work->message_run = EINA_FALSE; work->kill = EINA_FALSE; work->reschedule = EINA_FALSE; + work->no_queue = EINA_FALSE; work->data = data; #ifdef EFL_HAVE_THREADS work->self = 0; work->hash = NULL; - CDI(work->cond); - LKI(work->mutex); LKL(_ecore_pending_job_threads_mutex); _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work); @@ -952,9 +802,8 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking, pth = malloc(sizeof (Ecore_Pthread_Data)); if (!pth) goto on_error; - pth->p = _ecore_thread_pipe_get(); pth->death_job = _ecore_thread_worker_new(); - if (!pth->p || !pth->death_job) goto on_error; + if (!pth->death_job) goto on_error; eina_threads_init(); @@ -969,7 +818,6 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking, on_error: if (pth) { - if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p); if (pth->death_job) _ecore_thread_worker_free(pth->death_job); free(pth); } @@ -981,7 +829,11 @@ on_error: LKU(_ecore_pending_job_threads_mutex); if (work->func_cancel) - work->func_cancel((void *)work->data, (Ecore_Thread *)work); + work->func_cancel((void *) work->data, (Ecore_Thread *) work); + + CDD(work->cond); + LKD(work->mutex); + LKD(work->cancel_mutex); free(work); work = NULL; } @@ -1013,12 +865,16 @@ EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread) { #ifdef EFL_HAVE_THREADS - Ecore_Pthread_Worker *work = (Ecore_Pthread_Worker *)thread; + Ecore_Pthread_Worker *volatile work = (Ecore_Pthread_Worker *)thread; Eina_List *l; + int cancel; if (!work) return EINA_TRUE; - if (work->cancel) + LKL(work->cancel_mutex); + cancel = work->cancel; + LKU(work->cancel_mutex); + if (cancel) return EINA_FALSE; if (work->feedback_run) @@ -1070,9 +926,14 @@ ecore_thread_cancel(Ecore_Thread *thread) LKU(_ecore_pending_job_threads_mutex); + work = (Ecore_Pthread_Worker *)thread; + /* Delay the destruction */ -on_exit: - ((Ecore_Pthread_Worker *)thread)->cancel = EINA_TRUE; + on_exit: + LKL(work->cancel_mutex); + work->cancel = EINA_TRUE; + LKU(work->cancel_mutex); + return EINA_FALSE; #else (void) thread; @@ -1083,10 +944,23 @@ on_exit: EAPI Eina_Bool ecore_thread_check(Ecore_Thread *thread) { - Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + Ecore_Pthread_Worker *volatile worker = (Ecore_Pthread_Worker *) thread; + int cancel; if (!worker) return EINA_TRUE; - return worker->cancel; +#ifdef EFL_HAVE_THREADS + LKL(worker->cancel_mutex); +#endif + cancel = worker->cancel; + /* FIXME: there is an insane bug driving me nuts here. I don't know if + it's a race condition, some cache issue or some alien attack on our software. + But ecore_thread_check will only work correctly with a printf, all the volatile, + lock and even usleep don't help here... */ + /* fprintf(stderr, "wc: %i\n", cancel); */ +#ifdef EFL_HAVE_THREADS + LKU(worker->cancel_mutex); +#endif + return cancel; } EAPI Ecore_Thread * @@ -1109,12 +983,11 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, worker->u.feedback_run.func_heavy = func_heavy; worker->u.feedback_run.func_notify = func_notify; worker->hash = NULL; - CDI(worker->cond); - LKI(worker->mutex); worker->func_cancel = func_cancel; worker->func_end = func_end; worker->data = data; worker->cancel = EINA_FALSE; + worker->message_run = EINA_FALSE; worker->feedback_run = EINA_TRUE; worker->kill = EINA_FALSE; worker->reschedule = EINA_FALSE; @@ -1123,15 +996,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, worker->u.feedback_run.send = 0; worker->u.feedback_run.received = 0; - worker->u.feedback_run.notify = ecore_pipe_add(_ecore_notify_handler, worker); - worker->u.feedback_run.direct_pipe = NULL; worker->u.feedback_run.direct_worker = NULL; - if (!try_no_queue) + if (try_no_queue) { PH(t); - worker->u.feedback_run.direct_pipe = _ecore_thread_pipe_get(); worker->u.feedback_run.direct_worker = _ecore_thread_worker_new(); worker->no_queue = EINA_TRUE; @@ -1140,6 +1010,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, if (PHC(t, _ecore_direct_worker, worker) == 0) return (Ecore_Thread *)worker; + if (worker->u.feedback_run.direct_worker) + { + _ecore_thread_worker_free(worker->u.feedback_run.direct_worker); + worker->u.feedback_run.direct_worker = NULL; + } + eina_threads_shutdown(); } @@ -1160,9 +1036,8 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, pth = malloc(sizeof (Ecore_Pthread_Data)); if (!pth) goto on_error; - pth->p = _ecore_thread_pipe_get(); pth->death_job = _ecore_thread_worker_new(); - if (!pth->p || !pth->death_job) goto on_error; + if (!pth->death_job) goto on_error; eina_threads_init(); @@ -1177,7 +1052,6 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, on_error: if (pth) { - if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p); if (pth->death_job) _ecore_thread_worker_free(pth->death_job); free(pth); } @@ -1193,7 +1067,8 @@ on_error: if (worker) { - ecore_pipe_del(worker->u.feedback_run.notify); + CDD(worker->cond); + LKD(worker->mutex); free(worker); worker = NULL; } @@ -1211,7 +1086,6 @@ on_error: */ worker.u.feedback_run.func_heavy = func_heavy; worker.u.feedback_run.func_notify = func_notify; - worker.u.feedback_run.notify = NULL; worker.u.feedback_run.send = 0; worker.u.feedback_run.received = 0; worker.func_cancel = func_cancel; @@ -1219,6 +1093,7 @@ on_error: worker.data = data; worker.cancel = EINA_FALSE; worker.feedback_run = EINA_TRUE; + worker.message_run = EINA_FALSE; worker.kill = EINA_FALSE; do { @@ -1241,13 +1116,48 @@ ecore_thread_feedback(Ecore_Thread *thread, Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; if (!worker) return EINA_FALSE; - if (!worker->feedback_run) return EINA_FALSE; #ifdef EFL_HAVE_THREADS if (!PHE(worker->self, PHS())) return EINA_FALSE; - worker->u.feedback_run.send++; - ecore_pipe_write(worker->u.feedback_run.notify, &data, sizeof (void *)); + if (worker->feedback_run) + { + Ecore_Pthread_Notify *notify; + + notify = malloc(sizeof (Ecore_Pthread_Notify)); + if (!notify) return EINA_FALSE; + + notify->user_data = data; + notify->work = worker; + worker->u.feedback_run.send++; + + ecore_main_loop_thread_safe_call_async(_ecore_notify_handler, notify); + } + else if (worker->message_run) + { + Ecore_Pthread_Message *msg; + Ecore_Pthread_Notify *notify; + + msg = malloc(sizeof (Ecore_Pthread_Message*)); + if (!msg) return EINA_FALSE; + msg->data = data; + msg->callback = EINA_FALSE; + msg->sync = EINA_FALSE; + + notify = malloc(sizeof (Ecore_Pthread_Notify)); + if (!notify) + { + free(msg); + return EINA_FALSE; + } + notify->work = worker; + notify->user_data = msg; + + worker->u.message_run.from.send++; + ecore_main_loop_thread_safe_call_async(_ecore_message_notify_handler, notify); + } + else + return EINA_FALSE; return EINA_TRUE; #else @@ -1257,6 +1167,71 @@ ecore_thread_feedback(Ecore_Thread *thread, #endif } +#if 0 +EAPI Ecore_Thread * +ecore_thread_message_run(Ecore_Thread_Cb func_main, + Ecore_Thread_Notify_Cb func_notify, + Ecore_Thread_Cb func_end, + Ecore_Thread_Cb func_cancel, + const void *data) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *worker; + PH(t); + + if (!func_main) return NULL; + + worker = _ecore_thread_worker_new(); + if (!worker) return NULL; + + worker->u.message_run.func_main = func_main; + worker->u.message_run.func_notify = func_notify; + worker->u.message_run.direct_worker = _ecore_thread_worker_new(); + worker->u.message_run.send = ecore_pipe_add(_ecore_nothing_handler, worker); + worker->u.message_run.from.send = 0; + worker->u.message_run.from.received = 0; + worker->u.message_run.to.send = 0; + worker->u.message_run.to.received = 0; + + ecore_pipe_freeze(worker->u.message_run.send); + + worker->func_cancel = func_cancel; + worker->func_end = func_end; + worker->hash = NULL; + worker->data = data; + + worker->cancel = EINA_FALSE; + worker->message_run = EINA_TRUE; + worker->feedback_run = EINA_FALSE; + worker->kill = EINA_FALSE; + worker->reschedule = EINA_FALSE; + worker->no_queue = EINA_FALSE; + worker->self = 0; + + eina_threads_init(); + + if (PHC(t, _ecore_direct_worker, worker) == 0) + return (Ecore_Thread*) worker; + + eina_threads_shutdown(); + + if (worker->u.message_run.direct_worker) _ecore_thread_worker_free(worker->u.message_run.direct_worker); + if (worker->u.message_run.send) ecore_pipe_del(worker->u.message_run.send); + + CDD(worker->cond); + LKD(worker->mutex); +#else + /* Note: This type of thread can't and never will work without thread support */ + WRN("ecore_thread_message_run called, but threads disable in Ecore, things will go wrong. Starting now !"); +# warning "You disabled threads support in ecore, I hope you know what you are doing !" +#endif + + func_cancel((void *) data, NULL); + + return NULL; +} +#endif + EAPI Eina_Bool ecore_thread_reschedule(Ecore_Thread *thread) { @@ -1641,24 +1616,13 @@ ecore_thread_global_data_wait(const char *key, while (1) { -#ifndef _WIN32 - struct timespec t = { 0, 0 }; - - t.tv_sec = (long int)tm; - t.tv_nsec = (long int)((tm - (double)t.tv_sec) * 1000000000); -#else - struct timeval t = { 0, 0 }; - - t.tv_sec = (long int)tm; - t.tv_usec = (long int)((tm - (double)t.tv_sec) * 1000000); -#endif LRWKRL(_ecore_thread_global_hash_lock); ret = eina_hash_find(_ecore_thread_global_hash, key); LRWKU(_ecore_thread_global_hash_lock); if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get()))) break; LKL(_ecore_thread_global_hash_mutex); - CDW(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex, &t); + CDW(_ecore_thread_global_hash_cond, tm); LKU(_ecore_thread_global_hash_mutex); } 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 @@ #include -#ifdef HAVE_CLOCK_GETTIME +#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME) static clockid_t _ecore_time_clock_id = -1; #elif defined(__APPLE__) && defined(__MACH__) static double _ecore_time_clock_conversion = 1e-9; @@ -52,7 +52,7 @@ double _ecore_time_loop_time = -1.0; EAPI double ecore_time_get(void) { -#ifdef HAVE_CLOCK_GETTIME +#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME) struct timespec t; if (EINA_UNLIKELY(_ecore_time_clock_id < 0)) @@ -136,7 +136,7 @@ ecore_loop_time_get(void) void _ecore_time_init(void) { -#ifdef HAVE_CLOCK_GETTIME +#if defined (HAVE_CLOCK_GETTIME) || defined (EXOTIC_PROVIDE_CLOCK_GETTIME) struct timespec t; 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; static double precision = 10.0 / 1000000.0; /** - * @addtogroup Ecore_Time_Group + * @addtogroup Ecore_Timer_Group * * @{ */ @@ -73,12 +73,15 @@ ecore_timer_precision_get(void) } /** - * Sets the precision to be used by timer infrastructure. + * @brief Sets the precision to be used by timer infrastructure. * - * When system calculates time to expire the next timer we'll be able - * to delay the timer by the given amount so more timers will fit in - * the same dispatch, waking up the system less often and thus being - * able to save power. + * @param value allowed introduced timeout delay, in seconds. + * + * This sets the precision for @b all timers. The precision determines how much + * of an difference from the requested interval is acceptable. One common reason + * to use this function is to @b increase the allowed timeout and thus @b + * decrease precision of the timers, this is because less precise the timers + * result in the system waking up less often and thus consuming less resources. * * Be aware that kernel may delay delivery even further, these delays * are always possible due other tasks having higher priorities or @@ -93,8 +96,6 @@ ecore_timer_precision_get(void) * @note Ecore is smart enough to see if there are timers in the * precision range, if it does not, in our example if no second timer * in (T + precision) existed, then it would use the minimum timeout. - * - * @param value allowed introduced timeout delay, in seconds. */ EAPI void ecore_timer_precision_set(double value) @@ -322,7 +323,7 @@ ecore_timer_reset(Ecore_Timer *timer) * Get the pending time regarding a timer. * * @param timer The timer to learn from. - * @ingroup Ecore_Time_Group + * @ingroup Ecore_Timer_Group */ EAPI double ecore_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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -192,6 +191,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -247,6 +248,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -257,6 +260,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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_ */ EAPI Ecore_Con_Socks *ecore_con_socks4_remote_add(const char *ip, int port, const char *username); -EAPI void ecore_con_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable); -EAPI Eina_Bool ecore_con_socks4_lookup_get(Ecore_Con_Socks *ecs); EAPI Eina_Bool ecore_con_socks4_remote_exists(const char *ip, int port, const char *username); EAPI void ecore_con_socks4_remote_del(const char *ip, int port, const char *username); +EAPI Ecore_Con_Socks *ecore_con_socks5_remote_add(const char *ip, int port, const char *username, const char *password); +EAPI Eina_Bool ecore_con_socks5_remote_exists(const char *ip, int port, const char *username, const char *password); +EAPI void ecore_con_socks5_remote_del(const char *ip, int port, const char *username, const char *password); +EAPI void ecore_con_socks_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable); +EAPI Eina_Bool ecore_con_socks_lookup_get(Ecore_Con_Socks *ecs); EAPI void ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind); EAPI Eina_Bool ecore_con_socks_bind_get(Ecore_Con_Socks *ecs); EAPI 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); * * Setting up a server is very simple: you just need to start it with * ecore_con_server_add() and setup some callbacks to the events - * #ECORE_CON_EVENT_CLIENT_ADD, #ECORE_CON_EVENT_CLIENT_DEL and - * #ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is + * @ref ECORE_CON_EVENT_CLIENT_ADD, @ref ECORE_CON_EVENT_CLIENT_DEL and + * @ref ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is * communicating with the server: * * @code @@ -867,8 +870,8 @@ EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type, * * However, even if this call returns a valid @ref Ecore_Con_Server, the * connection will only be successfully completed if an event of type - * #ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an - * #ECORE_CON_EVENT_SERVER_DEL will be received. + * @ref ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an + * @ref ECORE_CON_EVENT_SERVER_DEL will be received. * * The @p data parameter can be fetched later using ecore_con_server_data_get() * or changed with ecore_con_server_data_set(). @@ -1335,6 +1338,35 @@ typedef enum _Ecore_Con_Url_Time } Ecore_Con_Url_Time; /** + * @typedef Ecore_Con_Url_Http_Version + * @enum _Ecore_Con_Url_Http_Version + * The http version to use + * @since 1.2 + */ +typedef enum _Ecore_Con_Url_Http_Version +{ + /** + * HTTP version 1.0 + * @since 1.2 + */ + ECORE_CON_URL_HTTP_VERSION_1_0, + /** + * HTTP version 1.1 (default) + * @since 1.2 + */ + ECORE_CON_URL_HTTP_VERSION_1_1 +} Ecore_Con_Url_Http_Version; + +/** + * Change the HTTP version used for the request + * @param version The version to be used + * @return EINA_TRUE on success, EINA_FALSE on failure to change version + * @since 1.2 + * @see ecore_con_url_pipeline_get() + */ +EAPI Eina_Bool ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version); + +/** * Initialises the Ecore_Con_Url library. * @return Number of times the library has been initialised without being * shut down. @@ -1554,33 +1586,6 @@ EAPI Eina_Bool ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *password, Eina_Bool safe); /** - * Sends a request. - * - * @param url_con Connection object to perform a request on, previously created - * with ecore_con_url_new() or ecore_con_url_custom_new(). - * @param data Payload (data sent on the request) - * @param length Payload length. If @c -1, rely on automatic length - * calculation via @c strlen() on @p data. - * @param content_type Content type of the payload (e.g. text/xml) - * - * @return #EINA_TRUE on success, #EINA_FALSE on error. - * - * @see ecore_con_url_custom_new() - * @see ecore_con_url_additional_headers_clear() - * @see ecore_con_url_additional_header_add() - * @see ecore_con_url_data_set() - * @see ecore_con_url_data_get() - * @see ecore_con_url_response_headers_get() - * @see ecore_con_url_time() - * @see ecore_con_url_get() - * @see ecore_con_url_post() - * - * @deprecated Use ecore_con_url_post() instead of this. - */ -EINA_DEPRECATED EAPI Eina_Bool ecore_con_url_send(Ecore_Con_Url *url_con, - const void *data, long length, - const char *content_type); -/** * Sends a get request. * * @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 EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout); /** + * Get the returned HTTP STATUS code + * + * This is used to, at any time, try to return the status code for a transmission. + * @param url_con Connection object + * @return A valid HTTP STATUS code, or 0 on failure + * + * @since 1.2 + */ +EAPI int ecore_con_url_status_code_get(Ecore_Con_Url *url_con); +/** * @} */ 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -210,6 +209,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -265,6 +266,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -275,6 +278,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) if (cl->delete_me) DBG("Multi kill request for client %p", cl); else - ecore_con_event_client_del(cl); + { + ecore_con_event_client_del(cl); + if (cl->buf) return; + } INF("Lost client %s", (cl->ip) ? cl->ip : ""); if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler); @@ -461,7 +464,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, (!ecore_con_lookup(svr->name, (Ecore_Con_Dns_Cb)ecore_con_socks_dns_cb, svr))) goto error; if (svr->ecs->lookup) - svr->ecs_state = ECORE_CON_SOCKS_STATE_RESOLVED; + svr->ecs_state = ECORE_CON_PROXY_STATE_RESOLVED; } } 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) e->server = svr; if (svr->ecs) { - svr->ecs_state = svr->ecs->lookup ? ECORE_CON_SOCKS_STATE_RESOLVED : ECORE_CON_SOCKS_STATE_DONE; + svr->ecs_state = svr->ecs->lookup ? ECORE_CON_PROXY_STATE_RESOLVED : ECORE_CON_PROXY_STATE_DONE; eina_stringshare_replace(&svr->proxyip, NULL); svr->proxyport = 0; } @@ -1320,7 +1323,7 @@ _ecore_con_client_free(Ecore_Con_Client *cl) if (cl->event_count) return; ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE); - free(cl->buf); + if (cl->buf) eina_binbuf_free(cl->buf); if (cl->host_server->type & ECORE_CON_SSL) ecore_con_ssl_client_shutdown(cl); @@ -1736,7 +1739,7 @@ svr_try_connect_plain(Ecore_Con_Server *svr) if (so_err) { /* we lost our server! */ - ecore_con_event_server_error(svr, strerror(errno)); + ecore_con_event_server_error(svr, strerror(so_err)); ERR("Connection lost: %s", strerror(so_err)); _ecore_con_server_kill(svr); return ECORE_CON_DISCONNECTED; @@ -1971,9 +1974,9 @@ _ecore_con_cl_handler(void *data, ecore_con_event_server_add(svr); return ECORE_CALLBACK_RENEW; } - if (svr->ecs && svr->ecs_state && (svr->ecs_state < ECORE_CON_SOCKS_STATE_READ) && (!svr->ecs_buf)) + if (svr->ecs && svr->ecs_state && (svr->ecs_state < ECORE_CON_PROXY_STATE_READ) && (!svr->ecs_buf)) { - if (svr->ecs_state < ECORE_CON_SOCKS_STATE_INIT) + if (svr->ecs_state < ECORE_CON_PROXY_STATE_INIT) { INF("PROXY STATE++"); svr->ecs_state++; @@ -2271,7 +2274,7 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) static void _ecore_con_client_flush(Ecore_Con_Client *cl) { - int num, count = 0; + int num = 0, count = 0; #ifdef _WIN32 if (ecore_con_local_win32_client_flush(cl)) @@ -2314,7 +2317,7 @@ _ecore_con_client_flush(Ecore_Con_Client *cl) } if (count) ecore_con_event_client_write(cl, count); - cl->buf_offset += count; + cl->buf_offset += count, num -= count; if (cl->buf_offset >= eina_binbuf_length_get(cl->buf)) { cl->buf_offset = 0; @@ -2332,7 +2335,7 @@ _ecore_con_client_flush(Ecore_Con_Client *cl) if (cl->fd_handler) ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); } - else if ((count < num) && cl->fd_handler) + else if (cl->fd_handler && (num >= 0)) ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); } 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; typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup; typedef struct _Ecore_Con_Info Ecore_Con_Info; -typedef struct Ecore_Con_Socks_v4 Ecore_Con_Socks_v4; +typedef struct Ecore_Con_Socks Ecore_Con_Socks_v4; typedef struct Ecore_Con_Socks_v5 Ecore_Con_Socks_v5; typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos); @@ -83,13 +83,18 @@ typedef enum _Ecore_Con_Ssl_Handshake ECORE_CON_SSL_STATE_INIT } Ecore_Con_Ssl_State; -typedef enum Ecore_Con_Socks_State -{ - ECORE_CON_SOCKS_STATE_DONE = 0, - ECORE_CON_SOCKS_STATE_RESOLVED, - ECORE_CON_SOCKS_STATE_INIT, - ECORE_CON_SOCKS_STATE_READ -} Ecore_Con_Socks_State; +typedef enum Ecore_Con_Proxy_State +{ /* named PROXY instead of SOCKS in case some handsome and enterprising + * developer decides to add HTTP CONNECT support + */ + ECORE_CON_PROXY_STATE_DONE = 0, + ECORE_CON_PROXY_STATE_RESOLVED, + ECORE_CON_PROXY_STATE_INIT, + ECORE_CON_PROXY_STATE_READ, + ECORE_CON_PROXY_STATE_AUTH, + ECORE_CON_PROXY_STATE_REQUEST, + ECORE_CON_PROXY_STATE_CONFIRM, +} Ecore_Con_Proxy_State; struct _Ecore_Con_Client { @@ -140,7 +145,7 @@ struct _Ecore_Con_Server pid_t ppid; /* socks */ Ecore_Con_Socks *ecs; - Ecore_Con_Socks_State ecs_state; + Ecore_Con_Proxy_State ecs_state; int ecs_addrlen; unsigned char ecs_addr[16]; unsigned int ecs_buf_offset; @@ -202,6 +207,7 @@ struct _Ecore_Con_Url Eina_List *response_headers; const char *url; long proxy_type; + int status; Ecore_Timer *timer; @@ -213,6 +219,10 @@ struct _Ecore_Con_Url int received; int write_fd; + + unsigned int event_count; + Eina_Bool dead : 1; + Eina_Bool multi : 1; }; #endif @@ -239,24 +249,14 @@ struct _Ecore_Con_Lookup v5 = (Ecore_Con_Socks_v5*)(X); \ else -struct Ecore_Con_Socks -{ - unsigned char version; - - const char *ip; - int port; - const char *username; - Eina_Bool lookup : 1; - Eina_Bool bind : 1; -}; - -struct Ecore_Con_Socks_v4 +struct Ecore_Con_Socks /* v4 */ { unsigned char version; const char *ip; int port; const char *username; + unsigned int ulen; Eina_Bool lookup : 1; Eina_Bool bind : 1; }; @@ -268,8 +268,13 @@ struct Ecore_Con_Socks_v5 const char *ip; int port; const char *username; + unsigned int ulen; Eina_Bool lookup : 1; Eina_Bool bind : 1; + /* v5 only */ + unsigned char method; + const char *password; + unsigned int plen; }; extern 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 @@ #include #include +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + #ifdef HAVE_NETINET_TCP_H # include #endif @@ -36,10 +40,6 @@ # include #endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif - #ifdef HAVE_SYS_UN_H # include #endif @@ -57,6 +57,27 @@ #include "Ecore_Con.h" #include "ecore_con_private.h" +/* http://tools.ietf.org/html/rfc1928 + o X'00' NO AUTHENTICATION REQUIRED + o X'01' GSSAPI + o X'02' USERNAME/PASSWORD + o X'03' to X'7F' IANA ASSIGNED + o X'80' to X'FE' RESERVED FOR PRIVATE METHODS + o X'FF' NO ACCEPTABLE METHODS +*/ +#define ECORE_CON_SOCKS_V5_METHOD_NONE 0 +#define ECORE_CON_SOCKS_V5_METHOD_GSSAPI 1 +#define ECORE_CON_SOCKS_V5_METHOD_USERPASS 2 + +static int ECORE_CON_SOCKS_V5_METHODS[] = +{ + ECORE_CON_SOCKS_V5_METHOD_NONE, +// ECORE_CON_SOCKS_V5_METHOD_GSSAPI, TODO + ECORE_CON_SOCKS_V5_METHOD_USERPASS +}; + +#define ECORE_CON_SOCKS_V5_TOTAL_METHODS sizeof(ECORE_CON_SOCKS_V5_METHODS) + #define _ecore_con_server_kill(svr) do { \ DBG("KILL %p", (svr)); \ _ecore_con_server_kill((svr)); \ @@ -65,10 +86,10 @@ Eina_List *ecore_con_socks_proxies = NULL; static Ecore_Con_Socks * -_ecore_con_socks_find(unsigned char version, const char *ip, int port, const char *username) +_ecore_con_socks_find(unsigned char version, const char *ip, int port, const char *username, size_t ulen, const char *password, size_t plen) { Eina_List *l; - Ecore_Con_Socks *ecs; + Ecore_Con_Socks_v5 *ecs; if (!ecore_con_socks_proxies) return NULL; @@ -77,8 +98,14 @@ _ecore_con_socks_find(unsigned char version, const char *ip, int port, const cha if (ecs->version != version) continue; if (strcmp(ecs->ip, ip)) continue; if ((port != -1) && (port != ecs->port)) continue; + if (ulen != ecs->ulen) continue; if (username && strcmp(ecs->username, username)) continue; - return ecs; + if (version == 5) + { + if (plen != ecs->plen) continue; + if (password && strcmp(ecs->password, password)) continue; + } + return (Ecore_Con_Socks*)ecs; } return NULL; } @@ -94,146 +121,424 @@ _ecore_con_socks_free(Ecore_Con_Socks *ecs) eina_stringshare_del(ecs->username); free(ecs); } -///////////////////////////////////////////////////////////////////////////////////// -void -ecore_con_socks_shutdown(void) + +static Eina_Bool +_ecore_con_socks_svr_init_v4(Ecore_Con_Server *svr, Ecore_Con_Socks_v4 *v4) { - Ecore_Con_Socks *ecs; - EINA_LIST_FREE(ecore_con_socks_proxies, ecs) - _ecore_con_socks_free(ecs); - _ecore_con_proxy_once = NULL; - _ecore_con_proxy_global = NULL; + size_t addrlen, buflen, ulen = 1; + unsigned char *sbuf; + + addrlen = v4->lookup ? strlen(svr->name) + 1 : 0; + if (v4->username) ulen += v4->ulen; + buflen = sizeof(char) * (8 + ulen + addrlen); + sbuf = malloc(buflen); + if (!sbuf) + { + ecore_con_event_server_error(svr, "Memory allocation failure!"); + _ecore_con_server_kill(svr); + return EINA_FALSE; + } + /* http://en.wikipedia.org/wiki/SOCKS */ + sbuf[0] = 4; + sbuf[1] = v4->bind ? 2 : 1; + sbuf[2] = svr->port >> 8; + sbuf[3] = svr->port & 0xff; + if (addrlen) + { + sbuf[4] = sbuf[5] = sbuf[6] = 0; + sbuf[7] = 1; + } + else + /* SOCKSv4 only handles IPV4, so addrlen is always 4 */ + memcpy(sbuf + 4, svr->ecs_addr, 4); + if (v4->username) + memcpy(sbuf + 8, v4->username, ulen); + else + sbuf[8] = 0; + if (addrlen) memcpy(sbuf + 8 + ulen, svr->name, addrlen); + + svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen); + return EINA_TRUE; } -void -ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num) +static Eina_Bool +_ecore_con_socks_svr_init_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5) +{ + size_t buflen; + unsigned int x; + unsigned char *sbuf; + + if (v5->username) + buflen = sizeof(char) * (2 + ECORE_CON_SOCKS_V5_TOTAL_METHODS); + else + buflen = 3; + sbuf = malloc(buflen); + if (!sbuf) + { + ecore_con_event_server_error(svr, "Memory allocation failure!"); + _ecore_con_server_kill(svr); + return EINA_FALSE; + } + /* http://en.wikipedia.org/wiki/SOCKS + * http://tools.ietf.org/html/rfc1928 + */ + sbuf[0] = 5; + if (v5->username) + { + sbuf[1] = ECORE_CON_SOCKS_V5_TOTAL_METHODS; + for (x = 2; x < 2 + ECORE_CON_SOCKS_V5_TOTAL_METHODS; x++) + sbuf[x] = ECORE_CON_SOCKS_V5_METHODS[x - 2]; + } + else + { + sbuf[1] = 1; + sbuf[2] = ECORE_CON_SOCKS_V5_METHOD_NONE; + } + + svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen); + return EINA_TRUE; +} + +#define ECORE_CON_SOCKS_READ(EXACT) \ + if (num < EXACT) \ + { \ + if (!svr->ecs_recvbuf) svr->ecs_recvbuf = eina_binbuf_new(); \ + if (!svr->ecs_recvbuf) goto error; \ + eina_binbuf_append_length(svr->ecs_recvbuf, buf, num); \ + /* the slowest connection on earth */ \ + if (eina_binbuf_length_get(svr->ecs_recvbuf) != EXACT) return; \ + data = eina_binbuf_string_get(svr->ecs_recvbuf); \ + } \ + else if (num > EXACT) goto error; \ + else \ + data = buf + +static void +_ecore_con_socks_read_v4(Ecore_Con_Server *svr, Ecore_Con_Socks_v4 *v4 __UNUSED__, const unsigned char *buf, unsigned int num) { const unsigned char *data; - ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return; + DBG("SOCKS: %d bytes", num); + ECORE_CON_SOCKS_READ(8); - if (svr->ecs_state != ECORE_CON_SOCKS_STATE_READ) return; +/* http://ufasoft.com/doc/socks4_protocol.htm */ + if (data[0]) goto error; + switch (data[1]) + { + case 90: + /* success! */ + break; + case 91: + ecore_con_event_server_error(svr, "proxy request rejected or failed"); + goto error; + case 92: + ecore_con_event_server_error(svr, "proxying SOCKS server could not perform authentication"); + goto error; + case 93: + ecore_con_event_server_error(svr, "proxy request authentication rejected"); + goto error; + default: + ecore_con_event_server_error(svr, "garbage data from proxy"); + goto error; + } + if (svr->ecs->bind) + { + unsigned int nport; + char naddr[IF_NAMESIZE]; - if (v4) + memcpy(&nport, &data[2], 2); + svr->proxyport = ntohl(nport); + + if (!inet_ntop(AF_INET, &data[4], naddr, sizeof(naddr))) goto error; + svr->proxyip = eina_stringshare_add(naddr); + ecore_con_event_proxy_bind(svr); + } + svr->ecs_state = ECORE_CON_PROXY_STATE_DONE; + INF("PROXY CONNECTED"); + if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf); + svr->ecs_recvbuf = NULL; + svr->ecs_buf_offset = svr->ecs_addrlen = 0; + memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr)); + if (!svr->ssl_state) + ecore_con_event_server_add(svr); + if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf))) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE); + return; +error: + _ecore_con_server_kill(svr); +} + +static Eina_Bool +_ecore_con_socks_auth_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5) +{ + size_t size; + unsigned char *data; + switch (v5->method) + { + case ECORE_CON_SOCKS_V5_METHOD_NONE: + svr->ecs_state = ECORE_CON_PROXY_STATE_REQUEST; + return EINA_TRUE; + case ECORE_CON_SOCKS_V5_METHOD_GSSAPI: + return EINA_TRUE; + case ECORE_CON_SOCKS_V5_METHOD_USERPASS: + if (!v5->username) return EINA_FALSE; + if (!v5->password) v5->plen = 1; + /* http://tools.ietf.org/html/rfc1929 */ + size = sizeof(char) * (3 + v5->ulen + v5->plen); + data = malloc(size); + if (!data) break; + data[0] = 1; + data[1] = v5->ulen; + memcpy(&data[2], v5->username, v5->ulen); + data[1 + v5->ulen] = v5->plen; + if (v5->password) + memcpy(&data[2 + v5->ulen], v5->password, v5->plen); + else + data[2 + v5->ulen] = 0; + svr->ecs_buf = eina_binbuf_manage_new_length(data, size); + return EINA_TRUE; + default: + break; + } + return EINA_FALSE; +} + +static void +_ecore_con_socks_read_v5(Ecore_Con_Server *svr, Ecore_Con_Socks_v5 *v5, const unsigned char *buf, unsigned int num) +{ + const unsigned char *data; + + DBG("SOCKS: %d bytes", num); + switch (svr->ecs_state) { - DBG("SOCKS: %d bytes", num); - if (num < 8) - { - if (!svr->ecs_recvbuf) svr->ecs_recvbuf = eina_binbuf_new(); - if (!svr->ecs_recvbuf) goto error; - eina_binbuf_append_length(svr->ecs_recvbuf, buf, num); - /* the slowest connection on earth */ - if (eina_binbuf_length_get(svr->ecs_recvbuf) != 8) return; - data = eina_binbuf_string_get(svr->ecs_recvbuf); - } - else if (num > 8) goto error; - else - data = buf; - /* http://ufasoft.com/doc/socks4_protocol.htm */ - if (data[0]) goto error; - switch (data[1]) + case ECORE_CON_PROXY_STATE_READ: + ECORE_CON_SOCKS_READ(2); + /* http://en.wikipedia.org/wiki/SOCKS */ + if (data[0] != 5) goto error; + if (data[1] == 0xFF) + { + ecore_con_event_server_error(svr, "proxy authentication methods rejected"); + goto error; + } + v5->method = data[1]; + if (!_ecore_con_socks_auth_v5(svr, v5)) goto error; + if (svr->ecs_state == ECORE_CON_PROXY_STATE_REQUEST) + { + /* run again to skip auth reading */ + _ecore_con_socks_read_v5(svr, v5, NULL, 0); + return; + } + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); + svr->ecs_state = ECORE_CON_PROXY_STATE_AUTH; + break; + case ECORE_CON_PROXY_STATE_AUTH: + ECORE_CON_SOCKS_READ(2); + switch (v5->method) + { + case ECORE_CON_SOCKS_V5_METHOD_NONE: + CRIT("HOW DID THIS HAPPEN?????????"); + goto error; + case ECORE_CON_SOCKS_V5_METHOD_GSSAPI: + /* TODO: this */ + break; + case ECORE_CON_SOCKS_V5_METHOD_USERPASS: + if (data[0] != 1) + { + ecore_con_event_server_error(svr, "protocol error"); + goto error; /* wrong version */ + } + if (data[1]) + { + ecore_con_event_server_error(svr, "proxy request authentication rejected"); + goto error; + } + default: + break; + } + case ECORE_CON_PROXY_STATE_REQUEST: { - case 90: - /* success! */ - break; - case 91: - ecore_con_event_server_error(svr, "proxy request rejected or failed"); - goto error; - case 92: - ecore_con_event_server_error(svr, "proxying SOCKS server could not perform authentication"); - goto error; - case 93: - ecore_con_event_server_error(svr, "proxy request authentication rejected"); - goto error; - default: - ecore_con_event_server_error(svr, "garbage data from proxy"); - goto error; + size_t addrlen, buflen; + unsigned char *sbuf; + addrlen = v5->lookup ? strlen(svr->name) + 1 : (unsigned int)svr->ecs_addrlen; + buflen = sizeof(char) * (6 + addrlen); + sbuf = malloc(buflen); + if (!sbuf) + { + ecore_con_event_server_error(svr, "Memory allocation failure!"); + goto error; + } + sbuf[0] = 5; + sbuf[1] = v5->bind ? 2 : 1; /* TODO: 0x03 for UDP port association */ + sbuf[2] = 0; + if (v5->lookup) /* domain name */ + { + sbuf[3] = 3; + sbuf[4] = addrlen - 1; + memcpy(sbuf + 5, svr->name, addrlen - 1); + } + else + { + sbuf[3] = (svr->ecs_addrlen == 4) ? 1 : 4; + memcpy(sbuf + 4, svr->ecs_addr, addrlen); + } + sbuf[addrlen + 4] = svr->port >> 8; + sbuf[addrlen + 5] = svr->port & 0xff; + + svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen); + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); + break; } - if (svr->ecs->bind) + case ECORE_CON_PROXY_STATE_CONFIRM: { - unsigned int nport; - char naddr[IF_NAMESIZE]; - - memcpy(&nport, &data[2], 2); - svr->proxyport = ntohl(nport); - - if (!inet_ntop(AF_INET, &data[4], naddr, sizeof(naddr))) goto error; - svr->proxyip = eina_stringshare_add(naddr); - ecore_con_event_proxy_bind(svr); + /* this is ugly because we have to read an exact number of bytes, + * but we don't know what that number is until we've already read + * at least 5 bytes to determine the length of the unknown stream. + * yep. + */ + size_t to_read, len = svr->ecs_recvbuf ? eina_binbuf_length_get(svr->ecs_recvbuf) : 0; + if (num + len < 5) + { + /* guarantees we get called again */ + ECORE_CON_SOCKS_READ(5); + } + if (len >= 5) + { + data = eina_binbuf_string_get(svr->ecs_recvbuf); + data += 3; + } + else + data = buf + 3 - len; + switch (data[0]) + { + case 1: + to_read = 4; + break; + case 3: + to_read = data[1] + 1; + break; + case 4: + to_read = 16; + /* lazy debugging stub comment */ + break; + default: + ecore_con_event_server_error(svr, "protocol error"); + goto error; + } + /* at this point, we finally know exactly how much we need to read */ + ECORE_CON_SOCKS_READ(6 + to_read); + + if (data[0] != 5) + { + ecore_con_event_server_error(svr, "protocol error"); + goto error; /* wrong version */ + } + switch (data[1]) + { + case 0: + break; + case 1: + ecore_con_event_server_error(svr, "general proxy failure"); + goto error; + case 2: + ecore_con_event_server_error(svr, "connection not allowed by ruleset"); + goto error; + case 3: + ecore_con_event_server_error(svr, "network unreachable"); + goto error; + case 4: + ecore_con_event_server_error(svr, "host unreachable"); + goto error; + case 5: + ecore_con_event_server_error(svr, "connection refused by destination host"); + goto error; + case 6: + ecore_con_event_server_error(svr, "TTL expired"); + goto error; + case 7: + ecore_con_event_server_error(svr, "command not supported / protocol error"); + goto error; + case 8: + ecore_con_event_server_error(svr, "address type not supported"); + default: + goto error; + } + if (data[2]) + { + ecore_con_event_server_error(svr, "protocol error"); + goto error; + } + memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr)); + if (!svr->ssl_state) + ecore_con_event_server_add(svr); + if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf))) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE); + svr->ecs_buf_offset = svr->ecs_addrlen = 0; + svr->ecs_state = ECORE_CON_PROXY_STATE_DONE; + INF("PROXY CONNECTED"); + break; } - svr->ecs_state = ECORE_CON_SOCKS_STATE_DONE; - INF("PROXY CONNECTED"); - if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf); - svr->ecs_recvbuf = NULL; - svr->ecs_buf_offset = svr->ecs_addrlen = 0; - memset(svr->ecs_addr, 0, sizeof(svr->ecs_addr)); - if (!svr->ssl_state) - ecore_con_event_server_add(svr); - if (svr->ssl_state || (svr->buf && eina_binbuf_length_get(svr->buf))) - ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE); + default: + break; } + if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf); + svr->ecs_recvbuf = NULL; + return; error: _ecore_con_server_kill(svr); } +///////////////////////////////////////////////////////////////////////////////////// +void +ecore_con_socks_shutdown(void) +{ + Ecore_Con_Socks *ecs; + EINA_LIST_FREE(ecore_con_socks_proxies, ecs) + _ecore_con_socks_free(ecs); + _ecore_con_proxy_once = NULL; + _ecore_con_proxy_global = NULL; +} + +void +ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num) +{ + ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return; + + if (svr->ecs_state < ECORE_CON_PROXY_STATE_READ) return; + + if (v4) _ecore_con_socks_read_v4(svr, v4, buf, (unsigned int)num); + else _ecore_con_socks_read_v5(svr, v5, buf, (unsigned int)num); +} + Eina_Bool ecore_con_socks_svr_init(Ecore_Con_Server *svr) { - unsigned char *sbuf; ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return EINA_FALSE; if (!svr->ip) return EINA_FALSE; if (svr->ecs_buf) return EINA_FALSE; - if (svr->ecs_state != ECORE_CON_SOCKS_STATE_INIT) return EINA_FALSE; + if (svr->ecs_state != ECORE_CON_PROXY_STATE_INIT) return EINA_FALSE; ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); - if (v4) - { - size_t addrlen, buflen, ulen = 1; - addrlen = svr->ecs->lookup ? strlen(svr->name) + 1: 0; - if (svr->ecs->username) ulen += strlen(svr->ecs->username); - buflen = sizeof(char) * (8 + ulen + addrlen); - sbuf = malloc(buflen); - if (!sbuf) - { - ecore_con_event_server_error(svr, "Memory allocation failure!"); - _ecore_con_server_kill(svr); - return EINA_FALSE; - } - /* http://en.wikipedia.org/wiki/SOCKS */ - sbuf[0] = 4; - sbuf[1] = v4->bind ? 2 : 1; - sbuf[2] = svr->port >> 8; - sbuf[3] = svr->port & 0xff; - if (addrlen) - { - sbuf[4] = sbuf[5] = sbuf[6] = 0; - sbuf[7] = 1; - } - else - memcpy(sbuf + 4, svr->ecs_addr, 4); - if (svr->ecs->username) - memcpy(sbuf + 8, svr->ecs->username, ulen); - else - sbuf[8] = 0; - if (addrlen) memcpy(sbuf + 8 + ulen, svr->name, addrlen); - - svr->ecs_buf = eina_binbuf_manage_new_length(sbuf, buflen); - } - return EINA_TRUE; + if (v4) return _ecore_con_socks_svr_init_v4(svr, v4); + return _ecore_con_socks_svr_init_v5(svr, v5); } void -ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr) +ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen __UNUSED__, Ecore_Con_Server *svr) { svr->ip = eina_stringshare_add(ip); - svr->ecs_addrlen = addrlen; svr->ecs_state++; if (addr->sa_family == AF_INET) - memcpy(svr->ecs_addr, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4); + { + memcpy(svr->ecs_addr, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4); + svr->ecs_addrlen = 4; + } #ifdef HAVE_IPV6 else - memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, addrlen); + { + memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, 16); + svr->ecs_addrlen = 16; + } #endif ecore_con_socks_svr_init(svr); } @@ -242,36 +547,57 @@ void ecore_con_socks_init(void) { const char *socks; - char *u, *h, *p, *l; - char buf[64]; + char *h, *p, *l, *u = NULL; + char buf[512]; int port, lookup = 0; + Eina_Bool v5 = EINA_FALSE; Ecore_Con_Socks *ecs; unsigned char addr[sizeof(struct in_addr)]; +#ifdef HAVE_IPV6 + unsigned char addr6[sizeof(struct in6_addr)]; +#endif - /* ECORE_CON_SOCKS_V4=user@host:port:[1|0] */ + /* ECORE_CON_SOCKS_V4=[user@]host:port-[1|0] */ socks = getenv("ECORE_CON_SOCKS_V4"); - if ((!socks) || (!socks[0]) || (strlen(socks) > 64)) return; + if (!socks) + { + /* ECORE_CON_SOCKS_V5=[user@]host-port:[1|0] */ + socks = getenv("ECORE_CON_SOCKS_V5"); + v5 = EINA_TRUE; + } + if ((!socks) || (!socks[0]) || (strlen(socks) > 512)) return; strncpy(buf, socks, sizeof(buf)); h = strchr(buf, '@'); - u = NULL; /* username */ if (h && (h - buf > 0)) *h++ = 0, u = buf; else h = buf; /* host ip; I ain't resolvin shit here */ - p = strchr(h, ':'); + p = strchr(h, '-'); if (!p) return; *p++ = 0; - if (!inet_pton(AF_INET, h, addr)) return; + if (!inet_pton(AF_INET, h, addr)) +#ifdef HAVE_IPV6 + { + if (!v5) return; + if (!inet_pton(AF_INET6, h, addr6)) + return; + } +#else + return; +#endif errno = 0; port = strtol(p, &l, 10); if (errno || (port < 0) || (port > 65535)) return; if (l && (l[0] == ':')) lookup = (l[1] == '1'); - ecs = ecore_con_socks4_remote_add(h, port, u); + if (v5) + ecs = ecore_con_socks5_remote_add(h, port, u, NULL); + else + ecs = ecore_con_socks4_remote_add(h, port, u); if (!ecs) return; - ecore_con_socks4_lookup_set(ecs, lookup); + ecore_con_socks_lookup_set(ecs, lookup); ecore_con_socks_apply_always(ecs); INF("Added global proxy server %s%s%s:%d - DNS lookup %s", u ?: "", u ? "@" : "", h, port, lookup ? "ENABLED" : "DISABLED"); @@ -300,10 +626,17 @@ EAPI Ecore_Con_Socks * ecore_con_socks4_remote_add(const char *ip, int port, const char *username) { Ecore_Con_Socks *ecs; + size_t ulen = 0; if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL; - ecs = _ecore_con_socks_find(4, ip, port, username); + if (username) + { + ulen = strlen(username); + /* max length for protocol */ + if ((!ulen) || (ulen > 255)) return NULL; + } + ecs = _ecore_con_socks_find(4, ip, port, username, ulen, NULL, 0); if (ecs) return ecs; 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) ecs->ip = eina_stringshare_add(ip); ecs->port = port; ecs->username = eina_stringshare_add(username); + ecs->ulen = ulen; ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs); return ecs; } /** - * Set DNS lookup mode on an existing SOCKS v4 proxy + * Find a SOCKS v4 proxy in the proxy list * - * According to RFC, SOCKS v4 does not require that a proxy perform - * its own DNS lookups for addresses. SOCKS v4a specifies the protocol - * for this. If you want to enable remote DNS lookup and are sure that your - * proxy supports it, use this function. - * @param ecs The proxy object - * @param enable If true, the proxy will perform the dns lookup - * @note By default, this setting is DISABLED. + * Use this to determine if a SOCKS proxy was previously added by checking + * the proxy list against the parameters given. + * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) + * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip + * @param username The username used for the proxy (OPTIONAL) + * @return true only if a proxy exists matching the given params + * @note This function matches slightly more loosely than ecore_con_socks4_remote_add(), and + * ecore_con_socks4_remote_add() should be used to return the actual object. * @since 1.2 */ -EAPI void -ecore_con_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable) +EAPI Eina_Bool +ecore_con_socks4_remote_exists(const char *ip, int port, const char *username) { - ECORE_CON_SOCKS_CAST_ELSE(ecs) return; - if (v4) v4->lookup = !!enable; + if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) + return EINA_FALSE; + return !!_ecore_con_socks_find(4, ip, port, username, username ? strlen(username) : 0, NULL, 0); } /** - * Get DNS lookup mode on an existing SOCKS v4 proxy + * Remove a SOCKS v4 proxy from the proxy list and delete it * - * According to RFC, SOCKS v4 does not require that a proxy perform - * its own DNS lookups for addresses. SOCKS v4a specifies the protocol - * for this. This function returns whether lookups are enabled on a proxy object. - * @param ecs The proxy object - * @return If true, the proxy will perform the dns lookup - * @note By default, this setting is DISABLED. + * Use this to remove a SOCKS proxy from the proxy list by checking + * the list against the parameters given. The proxy will then be deleted. + * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) + * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip + * @param username The username used for the proxy (OPTIONAL) + * @note This function matches in the same way as ecore_con_socks4_remote_exists(). + * @warning Be aware that deleting a proxy which is being used WILL ruin your life. * @since 1.2 */ -EAPI Eina_Bool -ecore_con_socks4_lookup_get(Ecore_Con_Socks *ecs) +EAPI void +ecore_con_socks4_remote_del(const char *ip, int port, const char *username) { - ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE; - return v4 ? v4->lookup : EINA_FALSE; + Ecore_Con_Socks_v4 *v4; + + if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) return; + if (!ecore_con_socks_proxies) return; + + v4 = (Ecore_Con_Socks_v4*)_ecore_con_socks_find(4, ip, port, username, username ? strlen(username) : 0, NULL, 0); + if (!v4) return; + ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4); + _ecore_con_socks_free((Ecore_Con_Socks*)v4); +} +/** + * Add a SOCKS v5 proxy to the proxy list + * + * Use this to create (or return, if previously added) a SOCKS proxy + * object which can be used by any ecore_con servers. + * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) + * @param port The port to connect to on the proxy + * @param username The username to use for the proxy (OPTIONAL) + * @param password The password to use for the proxy (OPTIONAL) + * @return An allocated proxy object, or NULL on failure + * @note This object NEVER needs to be explicitly freed. + * @since 1.2 + */ +EAPI Ecore_Con_Socks * +ecore_con_socks5_remote_add(const char *ip, int port, const char *username, const char *password) +{ + Ecore_Con_Socks_v5 *ecs5; + size_t ulen = 0, plen = 0; + + if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL; + + if (username) + { + ulen = strlen(username); + /* max length for protocol */ + if ((!ulen) || (ulen > 255)) return NULL; + } + if (password) + { + plen = strlen(password); + /* max length for protocol */ + if ((!plen) || (plen > 255)) return NULL; + } + ecs5 = (Ecore_Con_Socks_v5*)_ecore_con_socks_find(5, ip, port, username, ulen, password, plen); + if (ecs5) return (Ecore_Con_Socks*)ecs5; + + ecs5 = calloc(1, sizeof(Ecore_Con_Socks_v5)); + if (!ecs5) return NULL; + + ecs5->version = 5; + ecs5->ip = eina_stringshare_add(ip); + ecs5->port = port; + ecs5->username = eina_stringshare_add(username); + ecs5->ulen = ulen; + ecs5->password = eina_stringshare_add(password); + ecs5->plen = plen; + ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs5); + return (Ecore_Con_Socks*)ecs5; } /** - * Find a SOCKS v4 proxy in the proxy list + * Find a SOCKS v5 proxy in the proxy list * * Use this to determine if a SOCKS proxy was previously added by checking * the proxy list against the parameters given. * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip * @param username The username used for the proxy (OPTIONAL) + * @param password The password used for the proxy (OPTIONAL) * @return true only if a proxy exists matching the given params - * @note This function matches slightly more loosely than ecore_con_socks4_remote_add(), and - * ecore_con_socks4_remote_add() should be used to return the actual object. + * @note This function matches slightly more loosely than ecore_con_socks5_remote_add(), and + * ecore_con_socks5_remote_add() should be used to return the actual object. * @since 1.2 */ EAPI Eina_Bool -ecore_con_socks4_remote_exists(const char *ip, int port, const char *username) +ecore_con_socks5_remote_exists(const char *ip, int port, const char *username, const char *password) { - if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) + if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])) || (password && (!password[0]))) return EINA_FALSE; - return !!_ecore_con_socks_find(4, ip, port, username); + return !!_ecore_con_socks_find(5, ip, port, username, username ? strlen(username) : 0, password, password ? strlen(password) : 0); } /** - * Remove a SOCKS v4 proxy from the proxy list and delete it + * Remove a SOCKS v5 proxy from the proxy list and delete it * * Use this to remove a SOCKS proxy from the proxy list by checking * the list against the parameters given. The proxy will then be deleted. * @param ip The ip address of the proxy (NOT DOMAIN NAME. IP ADDRESS.) * @param port The port to connect to on the proxy, or -1 to match the first proxy with @p ip * @param username The username used for the proxy (OPTIONAL) + * @param password The password used for the proxy (OPTIONAL) * @note This function matches in the same way as ecore_con_socks4_remote_exists(). * @warning Be aware that deleting a proxy which is being used WILL ruin your life. * @since 1.2 */ EAPI void -ecore_con_socks4_remote_del(const char *ip, int port, const char *username) +ecore_con_socks5_remote_del(const char *ip, int port, const char *username, const char *password) { - Ecore_Con_Socks_v4 *v4; + Ecore_Con_Socks_v5 *v5; - if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) return; + if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0])) || (password && (!password[0]))) + return; if (!ecore_con_socks_proxies) return; - v4 = (Ecore_Con_Socks_v4*)_ecore_con_socks_find(4, ip, port, username); - if (!v4) return; - ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4); - _ecore_con_socks_free((Ecore_Con_Socks*)v4); + v5 = (Ecore_Con_Socks_v5*)_ecore_con_socks_find(5, ip, port, username, username ? strlen(username) : 0, password, password ? strlen(password) : 0); + if (!v5) return; + ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v5); + _ecore_con_socks_free((Ecore_Con_Socks*)v5); +} + +/** + * Set DNS lookup mode on an existing SOCKS proxy + * + * According to RFC, SOCKS v4 does not require that a proxy perform + * its own DNS lookups for addresses. SOCKS v4a specifies the protocol + * for this. SOCKS v5 allows DNS lookups. + * If you want to enable remote DNS lookup and are sure that your + * proxy supports it, use this function. + * @param ecs The proxy object + * @param enable If true, the proxy will perform the dns lookup + * @note By default, this setting is DISABLED. + * @since 1.2 + */ +EAPI void +ecore_con_socks_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable) +{ + ECORE_CON_SOCKS_CAST_ELSE(ecs) return; + ecs->lookup = !!enable; +} + +/** + * Get DNS lookup mode on an existing SOCKS proxy + * + * According to RFC, SOCKS v4 does not require that a proxy perform + * its own DNS lookups for addresses. SOCKS v4a specifies the protocol + * for this. SOCKS v5 allows DNS lookups. + * This function returns whether lookups are enabled on a proxy object. + * @param ecs The proxy object + * @return If true, the proxy will perform the dns lookup + * @note By default, this setting is DISABLED. + * @since 1.2 + */ +EAPI Eina_Bool +ecore_con_socks_lookup_get(Ecore_Con_Socks *ecs) +{ + ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE; + return ecs->lookup; } /** @@ -434,6 +869,14 @@ ecore_con_socks_bind_get(Ecore_Con_Socks *ecs) return ecs->bind; } +/** + * Return SOCKS version of a SOCKS proxy + * + * Use this function to return the SOCKS protocol version of a proxy + * @param ecs The proxy object + * @return 0 on error, else 4/5 + * @since 1.2 + */ EAPI unsigned int ecore_con_socks_version_get(Ecore_Con_Socks *ecs) { @@ -482,7 +925,8 @@ ecore_con_socks_apply_once(Ecore_Con_Socks *ecs) * @see ecore_con_socks_apply_once() * @since 1.2 * @note ecore-con supports setting this through environment variables like so: - * ECORE_CON_SOCKS_V4=[user@]server:port:lookup + * ECORE_CON_SOCKS_V4=[user@]server-port:lookup + * ECORE_CON_SOCKS_V5=[user@]server-port:lookup * user is the OPTIONAL string that would be passed to the proxy as the username * server is the IP_ADDRESS of the proxy server * 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) * Use this function to add a SSL PEM certificate. * Simply specify the cert here to use it in the server object for connecting or listening. * If there is an error loading the certificate, an error will automatically be logged. + * @param svr The server object * @param cert The path to the certificate. * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE. */ @@ -683,6 +684,7 @@ ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr, * Use this function to add a SSL PEM CA file. * Simply specify the file here to use it in the server object for connecting or listening. * If there is an error loading the CAs, an error will automatically be logged. + * @param svr The server object * @param ca_file The path to the CA file. * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE. * @note since 1.2, this function can load directores @@ -747,6 +749,7 @@ ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr, * Use this function to add a SSL PEM CRL file * Simply specify the CRL file here to use it in the server object for connecting or listening. * If there is an error loading the CRL, an error will automatically be logged. + * @param svr The server object * @param crl_file The path to the CRL file. * @return EINA_FALSE if the file cannot be loaded, * 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 @@ #include "Ecore_Con.h" #include "ecore_con_private.h" +#define CURL_MIN_TIMEOUT 100 + int ECORE_CON_EVENT_URL_DATA = 0; int ECORE_CON_EVENT_URL_COMPLETE = 0; int ECORE_CON_EVENT_URL_PROGRESS = 0; #ifdef HAVE_CURL +static void _ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg); +static void _ecore_con_url_multi_remove(Ecore_Con_Url *url_con); static Eina_Bool _ecore_con_url_perform(Ecore_Con_Url *url_con); -static size_t _ecore_con_url_header_cb(void *ptr, - size_t size, - size_t nitems, - void *stream); -static size_t _ecore_con_url_data_cb(void *buffer, - size_t size, - size_t nitems, - void *userp); -static int _ecore_con_url_progress_cb(void *clientp, - double dltotal, - double dlnow, - double ultotal, - double ulnow); -static size_t _ecore_con_url_read_cb(void *ptr, - size_t size, - size_t nitems, - void *stream); -static void _ecore_con_event_url_free(void *data __UNUSED__, - void *ev); -static Eina_Bool _ecore_con_url_idler_handler(void *data); -static Eina_Bool _ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__); +static size_t _ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream); +static size_t _ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp); +static int _ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); +static size_t _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream); +static void _ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev); +static Eina_Bool _ecore_con_url_timer(void *data); +static Eina_Bool _ecore_con_url_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); static Eina_Bool _ecore_con_url_timeout_cb(void *data); +static void _ecore_con_url_status_get(Ecore_Con_Url *url_con); static Eina_List *_url_con_list = NULL; static Eina_List *_fd_hd_list = NULL; static CURLM *_curlm = NULL; -static fd_set _current_fd_set; static int _init_count = 0; -static Ecore_Timer *_curl_timeout = NULL; +static Ecore_Timer *_curl_timer = NULL; static Eina_Bool pipelining = EINA_FALSE; #endif @@ -79,28 +69,28 @@ EAPI int ecore_con_url_init(void) { #ifdef HAVE_CURL + long ms; if (++_init_count > 1) return _init_count; - if (!ECORE_CON_EVENT_URL_DATA) ECORE_CON_EVENT_URL_DATA = ecore_event_type_new(); - if (!ECORE_CON_EVENT_URL_COMPLETE) ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new(); - if (!ECORE_CON_EVENT_URL_PROGRESS) ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new(); + ECORE_CON_EVENT_URL_DATA = ecore_event_type_new(); + ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new(); + ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new(); + + // curl_global_init() is not thread safe! + if (curl_global_init(CURL_GLOBAL_ALL)) return --_init_count; + _curlm = curl_multi_init(); if (!_curlm) { - long ms; - - // curl_global_init() is not thread safe! - if (curl_global_init(CURL_GLOBAL_ALL)) return --_init_count; - - _curlm = curl_multi_init(); - if (!_curlm) return --_init_count; + curl_global_cleanup(); + return --_init_count; + } - curl_multi_timeout(_curlm, &ms); - if (ms <= 0) ms = 100; + curl_multi_timeout(_curlm, &ms); + if (ms >= CURL_MIN_TIMEOUT || ms <= 0) ms = CURL_MIN_TIMEOUT; - _curl_timeout = ecore_timer_add((double)ms / 1000, _ecore_con_url_idler_handler, (void *)0xACE); - ecore_timer_freeze(_curl_timeout); - } + _curl_timer = ecore_timer_add((double)ms / 1000, _ecore_con_url_timer, NULL); + ecore_timer_freeze(_curl_timer); return _init_count; #else @@ -112,31 +102,30 @@ EAPI int ecore_con_url_shutdown(void) { #ifdef HAVE_CURL + Ecore_Con_Url *url_con; + Ecore_Fd_Handler *fd_handler; if (_init_count == 0) return 0; + --_init_count; + if (_init_count) return _init_count; - if (--_init_count == 0) + if (_curl_timer) { - Ecore_Con_Url *con_url; - Ecore_Fd_Handler *fd_handler; - - if (_curl_timeout) - { - ecore_timer_del(_curl_timeout); - _curl_timeout = NULL; - } + ecore_timer_del(_curl_timer); + _curl_timer = NULL; + } - FD_ZERO(&_current_fd_set); - EINA_LIST_FREE(_url_con_list, con_url) ecore_con_url_free(con_url); - EINA_LIST_FREE(_fd_hd_list, fd_handler) ecore_main_fd_handler_del(fd_handler); + EINA_LIST_FREE(_url_con_list, url_con) + ecore_con_url_free(url_con); + EINA_LIST_FREE(_fd_hd_list, fd_handler) + ecore_main_fd_handler_del(fd_handler); - if (_curlm) - { - curl_multi_cleanup(_curlm); - _curlm = NULL; - } - curl_global_cleanup(); - } - return _init_count; + if (_curlm) + { + curl_multi_cleanup(_curlm); + _curlm = NULL; + } + curl_global_cleanup(); + return 0; #endif return 1; } @@ -145,14 +134,12 @@ EAPI void ecore_con_url_pipeline_set(Eina_Bool enable) { #ifdef HAVE_CURL - if (enable) - curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 1); - else - curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 0); - pipelining = enable; + if (enable == pipelining) return; + curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, !!enable); + pipelining = enable; #else - return; - (void)enable; + return; + (void)enable; #endif } @@ -160,11 +147,13 @@ EAPI Eina_Bool ecore_con_url_pipeline_get(void) { #ifdef HAVE_CURL - return pipelining; + return pipelining; #endif - return EINA_FALSE; + return EINA_FALSE; } +extern Ecore_Con_Socks *_ecore_con_proxy_global; + EAPI Ecore_Con_Url * ecore_con_url_new(const char *url) { @@ -196,22 +185,41 @@ ecore_con_url_new(const char *url) return NULL; } + // Read socks proxy url_con->proxy_type = -1; - if (_ecore_con_proxy_global) + if (_ecore_con_proxy_global && _ecore_con_proxy_global->ip && + (_ecore_con_proxy_global->version == 4 || + _ecore_con_proxy_global->version == 5)) { - if (_ecore_con_proxy_global->ip) + char proxy[256]; + char host[256]; + + if (_ecore_con_proxy_global->version == 5) { - char host[128]; - if (_ecore_con_proxy_global->port > 0 && - _ecore_con_proxy_global->port <= 65535) - snprintf(host, sizeof(host), "socks4://%s:%d", - _ecore_con_proxy_global->ip, - _ecore_con_proxy_global->port); - else - snprintf(host, sizeof(host), "socks4://%s", + if (_ecore_con_proxy_global->lookup) + snprintf(host, sizeof(host), "socks5h://%s", + _ecore_con_proxy_global->ip); + else snprintf(host, sizeof(host), "socks5://%s", + _ecore_con_proxy_global->ip); + } + else if (_ecore_con_proxy_global->version == 4) + { + if (_ecore_con_proxy_global->lookup) + snprintf(host, sizeof(host), "socks4a://%s", _ecore_con_proxy_global->ip); - ecore_con_url_proxy_set(url_con, host); + else snprintf(host, sizeof(host), "socks4://%s", + _ecore_con_proxy_global->ip); } + + if (_ecore_con_proxy_global->port > 0 && + _ecore_con_proxy_global->port <= 65535) + snprintf(proxy, sizeof(proxy), "%s:%d", host, + _ecore_con_proxy_global->port); + else snprintf(proxy, sizeof(proxy), "%s", host); + + ecore_con_url_proxy_set(url_con, proxy); + ecore_con_url_proxy_username_set(url_con, + _ecore_con_proxy_global->username); } 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) { #ifdef HAVE_CURL char *s; - CURLMcode ret; - if (!url_con) - return; + if (!url_con) return; if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { @@ -302,17 +308,16 @@ ecore_con_url_free(Ecore_Con_Url *url_con) return; } - ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE); - if (url_con->curl_easy) { + // FIXME : How can we delete curl_easy's fds ?? (Curl do not give this info.) + // This cause "Failed to delete epoll fd xx!" error messages curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL); curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_TRUE); - if (eina_list_data_find(_url_con_list, url_con)) + if (url_con->multi) { - ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); - if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret)); + _ecore_con_url_multi_remove(url_con); _url_con_list = eina_list_remove(_url_con_list, url_con); } @@ -320,6 +325,12 @@ ecore_con_url_free(Ecore_Con_Url *url_con) } if (url_con->timer) ecore_timer_del(url_con->timer); + url_con->curl_easy = NULL; + url_con->timer = NULL; + url_con->dead = EINA_TRUE; + if (url_con->event_count) return; + ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE); + curl_slist_free_all(url_con->headers); EINA_LIST_FREE(url_con->additional_headers, s) free(s); @@ -350,9 +361,27 @@ ecore_con_url_url_get(Ecore_Con_Url *url_con) #endif } +EAPI int +ecore_con_url_status_code_get(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__); + return 0; + } + + if (url_con->status) return url_con->status; + _ecore_con_url_status_get(url_con); + return url_con->status; +#else + return -1; + (void)url_con; +#endif +} + EAPI Eina_Bool -ecore_con_url_url_set(Ecore_Con_Url *url_con, - const char *url) +ecore_con_url_url_set(Ecore_Con_Url *url_con, const char *url) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) @@ -361,8 +390,7 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con, return EINA_FALSE; } - if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; - + if (url_con->dead) return EINA_FALSE; eina_stringshare_replace(&url_con->url, url); if (url_con->url) @@ -380,8 +408,7 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con, } EAPI void -ecore_con_url_data_set(Ecore_Con_Url *url_con, - void *data) +ecore_con_url_data_set(Ecore_Con_Url *url_con, void *data) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) @@ -399,13 +426,12 @@ ecore_con_url_data_set(Ecore_Con_Url *url_con, } EAPI void -ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, - const char *key, - const char *value) +ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, const char *key, const char *value) { #ifdef HAVE_CURL char *tmp; + if (url_con->dead) return; if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, @@ -413,6 +439,7 @@ ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, return; } + if (url_con->dead) return; tmp = malloc(strlen(key) + strlen(value) + 3); if (!tmp) return; @@ -467,9 +494,7 @@ ecore_con_url_data_get(Ecore_Con_Url *url_con) } EAPI void -ecore_con_url_time(Ecore_Con_Url *url_con, - Ecore_Con_Url_Time condition, - double timestamp) +ecore_con_url_time(Ecore_Con_Url *url_con, Ecore_Con_Url_Time condition, double timestamp) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) @@ -478,6 +503,7 @@ ecore_con_url_time(Ecore_Con_Url *url_con, return; } + if (url_con->dead) return; url_con->time_condition = condition; url_con->timestamp = timestamp; #else @@ -489,8 +515,7 @@ ecore_con_url_time(Ecore_Con_Url *url_con, } EAPI void -ecore_con_url_fd_set(Ecore_Con_Url *url_con, - int fd) +ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) @@ -499,6 +524,7 @@ ecore_con_url_fd_set(Ecore_Con_Url *url_con, return; } + if (url_con->dead) return; url_con->write_fd = fd; #else return; @@ -537,10 +563,7 @@ ecore_con_url_response_headers_get(Ecore_Con_Url *url_con) } EAPI Eina_Bool -ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, - const char *username, - const char *password, - Eina_Bool safe) +ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, const char *username, const char *password, Eina_Bool safe) { #ifdef HAVE_CURL CURLcode ret; @@ -552,6 +575,7 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, return EINA_FALSE; } + if (url_con->dead) return EINA_FALSE; # if LIBCURL_VERSION_NUM >= 0x071301 if ((username) && (password)) { @@ -596,11 +620,7 @@ ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, #define MODE_POST 2 static Eina_Bool -_ecore_con_url_send(Ecore_Con_Url *url_con, - int mode, - const void *data, - long length, - const char *content_type) +_ecore_con_url_send(Ecore_Con_Url *url_con, int mode, const void *data, long length, const char *content_type) { #ifdef HAVE_CURL Eina_List *l; @@ -613,15 +633,14 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, return EINA_FALSE; } - if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; - - if (!url_con->url) - return EINA_FALSE; + if (!url_con->url) return EINA_FALSE; + if (url_con->dead) return EINA_FALSE; /* Free response headers from previous send() calls */ EINA_LIST_FREE(url_con->response_headers, s) free((char *)s); url_con->response_headers = NULL; + url_con->status = 0; curl_slist_free_all(url_con->headers); url_con->headers = NULL; @@ -693,15 +712,6 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, #endif } -EINA_DEPRECATED EAPI Eina_Bool -ecore_con_url_send(Ecore_Con_Url *url_con, - const void *data, - long length, - const char *content_type) -{ - return _ecore_con_url_send(url_con, MODE_AUTO, data, length, content_type); -} - EAPI Eina_Bool ecore_con_url_get(Ecore_Con_Url *url_con) { @@ -709,20 +719,13 @@ ecore_con_url_get(Ecore_Con_Url *url_con) } EAPI Eina_Bool -ecore_con_url_post(Ecore_Con_Url *url_con, - const void *data, - long length, - const char *content_type) +ecore_con_url_post(Ecore_Con_Url *url_con, const void *data, long length, const char *content_type) { return _ecore_con_url_send(url_con, MODE_POST, data, length, content_type); } EAPI Eina_Bool -ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, - const char *filename, - const char *user, - const char *pass, - const char *upload_dir) +ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, const char *filename, const char *user, const char *pass, const char *upload_dir) { #ifdef HAVE_CURL char url[4096]; @@ -739,54 +742,50 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, return EINA_FALSE; } - if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; + if (url_con->dead) return EINA_FALSE; + if (!url_con->url) return EINA_FALSE; + if ((!filename) || (!filename[0])) return EINA_FALSE; - if (!url_con->url) + if (stat(filename, &file_info)) return EINA_FALSE; - if (filename) + snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass); + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd); + if (ret != CURLE_OK) { - if (stat(filename, &file_info)) - return EINA_FALSE; - - snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass); - ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd); - if (ret != CURLE_OK) - { - ERR("Could not set username and password for FTP upload: %s", - curl_easy_strerror(ret)); - return EINA_FALSE; - } + ERR("Could not set username and password for FTP upload: %s", + curl_easy_strerror(ret)); + return EINA_FALSE; + } - char tmp[PATH_MAX]; - snprintf(tmp, PATH_MAX, "%s", filename); + char tmp[PATH_MAX]; + snprintf(tmp, PATH_MAX, "%s", filename); - if (upload_dir) - snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url, - upload_dir, basename(tmp)); - else - snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url, - basename(tmp)); + if (upload_dir) + snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url, + upload_dir, basename(tmp)); + else + snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url, + basename(tmp)); - if (!ecore_con_url_url_set(url_con, url)) - return EINA_FALSE; + if (!ecore_con_url_url_set(url_con, url)) + return EINA_FALSE; - curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE, - (curl_off_t)file_info.st_size); - curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1); - curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION, - _ecore_con_url_read_cb); + curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1); + curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION, + _ecore_con_url_read_cb); - fd = fopen(filename, "rb"); - if (!fd) - { - ERR("Could not open \"%s\" for FTP upload", filename); - return EINA_FALSE; - } - curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd); - - return _ecore_con_url_perform(url_con); + fd = fopen(filename, "rb"); + if (!fd) + { + ERR("Could not open \"%s\" for FTP upload", filename); + return EINA_FALSE; } + curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd); + + return _ecore_con_url_perform(url_con); #else return EINA_FALSE; (void)url_con; @@ -795,8 +794,6 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, (void)pass; (void)upload_dir; #endif - - return EINA_FALSE; } EAPI void @@ -813,6 +810,7 @@ ecore_con_url_cookies_init(Ecore_Con_Url *url_con) return; } + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, ""); #else return; @@ -834,6 +832,7 @@ ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con, Eina_Bool i return; } + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore); #else return; @@ -856,6 +855,7 @@ ecore_con_url_cookies_clear(Ecore_Con_Url *url_con) return; } + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL"); #else return; @@ -877,6 +877,7 @@ ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con) return; } + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS"); #else return; @@ -885,7 +886,7 @@ ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con) } EAPI void -ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_name) +ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char *const file_name) { #ifdef HAVE_CURL if (!url_con) @@ -898,6 +899,7 @@ ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_n return; } + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name); #else return; @@ -907,7 +909,7 @@ ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_n } EAPI Eina_Bool -ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char * const cookiejar_file) +ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char *const cookiejar_file) { #ifdef HAVE_CURL CURLcode ret; @@ -922,6 +924,7 @@ ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char * const co return EINA_FALSE; } + if (url_con->dead) return EINA_FALSE; ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR, cookiejar_file); if (ret != CURLE_OK) @@ -953,6 +956,7 @@ ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con) return; } + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH"); #else return; @@ -961,8 +965,7 @@ ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con) } EAPI void -ecore_con_url_verbose_set(Ecore_Con_Url *url_con, - Eina_Bool verbose) +ecore_con_url_verbose_set(Ecore_Con_Url *url_con, Eina_Bool verbose) { #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) @@ -972,11 +975,10 @@ ecore_con_url_verbose_set(Ecore_Con_Url *url_con, return; } - if (eina_list_data_find(_url_con_list, url_con)) return; - if (!url_con->url) return; + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose); #else return; @@ -986,8 +988,7 @@ ecore_con_url_verbose_set(Ecore_Con_Url *url_con, } EAPI void -ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, - Eina_Bool use_epsv) +ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, Eina_Bool use_epsv) { #ifdef HAVE_CURL 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, return; } - if (eina_list_data_find(_url_con_list, url_con)) return; - if (!url_con->url) return; + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, (int)use_epsv); #else return; @@ -1023,8 +1023,7 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, * @since 1.1.0 */ EAPI void -ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, - Eina_Bool verify) +ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, Eina_Bool verify) { #ifdef HAVE_CURL 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, return; } - if (eina_list_data_find(_url_con_list, url_con)) return; - if (!url_con->url) return; + if (url_con->dead) return; curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, (int)verify); #else return; @@ -1073,19 +1071,19 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path) #ifdef HAVE_CURL if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { - ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ssl_ca_set"); - return -1; + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ssl_ca_set"); + return -1; } - if (eina_list_data_find(_url_con_list, url_con)) return -1; if (!url_con->url) return -1; + if (url_con->dead) return -1; if (ca_path == NULL) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 0); else { - res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 1); - if (!res) - res = curl_easy_setopt(url_con->curl_easy, CURLOPT_CAINFO, ca_path); + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 1); + if (!res) + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_CAINFO, ca_path); } #else return -1; @@ -1097,6 +1095,47 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path) } EAPI Eina_Bool +ecore_con_url_http_version_set(Ecore_Con_Url *url_con, Ecore_Con_Url_Http_Version version) +{ +#ifdef HAVE_CURL + int res = -1; + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_http_version_set"); + return EINA_FALSE; + } + if (url_con->dead) return EINA_FALSE; + switch (version) + { + case ECORE_CON_URL_HTTP_VERSION_1_0: + res = curl_easy_setopt(url_con->curl_easy, + CURLOPT_HTTP_VERSION, + CURL_HTTP_VERSION_1_0); + break; + + case ECORE_CON_URL_HTTP_VERSION_1_1: + res = curl_easy_setopt(url_con->curl_easy, + CURLOPT_HTTP_VERSION, + CURL_HTTP_VERSION_1_1); + break; + + default: + break; + } + if (res != CURLE_OK) + { + ERR("curl http version setting failed: %s", curl_easy_strerror(res)); + return EINA_FALSE; + } + return EINA_TRUE; +#else + (void)url_con; + (void)version; + return EINA_FALSE; +#endif +} + +EAPI Eina_Bool ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy) { #ifdef HAVE_CURL @@ -1109,8 +1148,8 @@ ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy) return EINA_FALSE; } - if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; if (!url_con->url) return EINA_FALSE; + if (url_con->dead) return EINA_FALSE; if (!proxy) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, ""); else @@ -1121,14 +1160,20 @@ ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy) if (vers->version_num < 0x71507) { url_con->proxy_type = CURLPROXY_HTTP; - if (strstr(proxy, "socks4")) url_con->proxy_type = CURLPROXY_SOCKS4; - else if (strstr(proxy, "socks4a")) url_con->proxy_type = CURLPROXY_SOCKS4A; - else if (strstr(proxy, "socks5")) url_con->proxy_type = CURLPROXY_SOCKS5; - else if (strstr(proxy, "socks5h")) url_con->proxy_type = CURLPROXY_SOCKS5_HOSTNAME; - res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXYTYPE, url_con->proxy_type); + if (strstr(proxy, "socks4a")) + url_con->proxy_type = CURLPROXY_SOCKS4A; + else if (strstr(proxy, "socks4")) + url_con->proxy_type = CURLPROXY_SOCKS4; + else if (strstr(proxy, "socks5h")) + url_con->proxy_type = CURLPROXY_SOCKS5_HOSTNAME; + else if (strstr(proxy, "socks5")) + url_con->proxy_type = CURLPROXY_SOCKS5; + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXYTYPE, + url_con->proxy_type); if (res != CURLE_OK) { - ERR("curl proxy type setting failed: %s", curl_easy_strerror(res)); + ERR("curl proxy type setting failed: %s", + curl_easy_strerror(res)); url_con->proxy_type = -1; return EINA_FALSE; } @@ -1159,7 +1204,7 @@ ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout) return; } - if (eina_list_data_find(_url_con_list, url_con)) return; + if (url_con->dead) return; if (!url_con->url || timeout < 0) return; if (url_con->timer) ecore_timer_del(url_con->timer); 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) return EINA_FALSE; } - if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; + if (url_con->dead) return EINA_FALSE; if (!url_con->url) return EINA_FALSE; - if (!username) return EINA_FALSE; + if ((!username) || (!username[0])) return EINA_FALSE; if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A) { 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) ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_password_set"); return EINA_FALSE; } - if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; if (!url_con->url) return EINA_FALSE; + if (url_con->dead) return EINA_FALSE; if (!password) return EINA_FALSE; if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A) { @@ -1242,19 +1287,61 @@ ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password) */ #ifdef HAVE_CURL +static void +_ecore_con_url_status_get(Ecore_Con_Url *url_con) +{ + long status = 0; + + if (!url_con->curl_easy) return; + if (!curl_easy_getinfo(url_con->curl_easy, CURLINFO_RESPONSE_CODE, &status)) + url_con->status = status; + else + url_con->status = 0; +} + +static void +_ecore_con_url_event_url_complete(Ecore_Con_Url *url_con, CURLMsg *curlmsg) +{ + Ecore_Con_Event_Url_Complete *e; + + e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); + if (!e) return; + + if (curlmsg && (curlmsg->data.result == CURLE_OK)) + { + if (!url_con->status) + _ecore_con_url_status_get(url_con); + } + else if (curlmsg) + ERR("Curl message have errors: %d", curlmsg->data.result); + else + CRIT("THIS IS BAD."); + + e->status = url_con->status; + e->url_con = url_con; + url_con->event_count++; + ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con); +} + +static void +_ecore_con_url_multi_remove(Ecore_Con_Url *url_con) +{ + CURLMcode ret; + + ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); + url_con->multi = EINA_FALSE; + if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret)); +} + static Eina_Bool _ecore_con_url_timeout_cb(void *data) { Ecore_Con_Url *url_con = data; - CURLMcode ret; - Ecore_Con_Event_Url_Complete *e; if (!url_con) return ECORE_CALLBACK_CANCEL; if (!url_con->curl_easy) return ECORE_CALLBACK_CANCEL; - if (!eina_list_data_find(_url_con_list, url_con)) return ECORE_CALLBACK_CANCEL; - ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); - if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret)); + _ecore_con_url_multi_remove(url_con); _url_con_list = eina_list_remove(_url_con_list, url_con); curl_slist_free_all(url_con->headers); @@ -1262,21 +1349,12 @@ _ecore_con_url_timeout_cb(void *data) url_con->timer = NULL; - e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); - if (e) - { - e->url_con = url_con; - e->status = 0; - ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL); - } + _ecore_con_url_event_url_complete(url_con, NULL); return ECORE_CALLBACK_CANCEL; } static size_t -_ecore_con_url_data_cb(void *buffer, - size_t size, - size_t nitems, - void *userp) +_ecore_con_url_data_cb(void *buffer, size_t size, size_t nitems, void *userp) { Ecore_Con_Url *url_con; Ecore_Con_Event_Url_Data *e; @@ -1295,6 +1373,7 @@ _ecore_con_url_data_cb(void *buffer, url_con->received += real_size; + INF("reading from %s", url_con->url); if (url_con->write_fd < 0) { e = @@ -1305,7 +1384,8 @@ _ecore_con_url_data_cb(void *buffer, e->url_con = url_con; e->size = real_size; memcpy(e->data, buffer, real_size); - ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, _ecore_con_event_url_free, NULL); + url_con->event_count++; + ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con); } } else @@ -1336,10 +1416,7 @@ _ecore_con_url_data_cb(void *buffer, } static size_t -_ecore_con_url_header_cb(void *ptr, - size_t size, - size_t nitems, - void *stream) +_ecore_con_url_header_cb(void *ptr, size_t size, size_t nitems, void *stream) { size_t real_size = size * nitems; Ecore_Con_Url *url_con = stream; @@ -1358,11 +1435,7 @@ _ecore_con_url_header_cb(void *ptr, } static int -_ecore_con_url_progress_cb(void *clientp, - double dltotal, - double dlnow, - double ultotal, - double ulnow) +_ecore_con_url_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { Ecore_Con_Event_Url_Progress *e; Ecore_Con_Url *url_con; @@ -1377,17 +1450,15 @@ _ecore_con_url_progress_cb(void *clientp, e->down.now = dlnow; e->up.total = ultotal; e->up.now = ulnow; - ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, _ecore_con_event_url_free, NULL); + url_con->event_count++; + ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, (Ecore_End_Cb)_ecore_con_event_url_free, url_con); } return 0; } static size_t -_ecore_con_url_read_cb(void *ptr, - size_t size, - size_t nitems, - void *stream) +_ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream) { size_t retcode = fread(ptr, size, nitems, stream); @@ -1418,96 +1489,38 @@ _ecore_con_url_info_read(void) while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining))) { + Eina_List *l, *ll; + Ecore_Con_Url *url_con = NULL; + DBG("Curl message: %d", curlmsg->msg); + if (curlmsg->msg == CURLMSG_DONE) { - Eina_List *l, *ll; - Ecore_Con_Url *url_con; - EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_con) { if (curlmsg->easy_handle == url_con->curl_easy) - { - CURLMcode ret; - Ecore_Con_Event_Url_Complete *e; - - e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); - if (e) - { - e->url_con = url_con; - e->status = 0; - if (curlmsg->data.result == CURLE_OK) - { - long status; /* curl API uses long, not int */ - status = 0; - curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &status); - e->status = status; - } - ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL); - } - - ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); - if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret)); - _url_con_list = eina_list_remove(_url_con_list, url_con); - break; - } + _ecore_con_url_event_url_complete(url_con, curlmsg); } - } + } } } static void _ecore_con_url_curl_clear(void) { + Ecore_Fd_Handler *fdh; Ecore_Con_Url *url_con; - FD_ZERO(&_current_fd_set); - if (_fd_hd_list) - { - Ecore_Fd_Handler *fd_handler; - EINA_LIST_FREE(_fd_hd_list, fd_handler) - { - int fd = ecore_main_fd_handler_fd_get(fd_handler); - FD_CLR(fd, &_current_fd_set); - // FIXME: ecore_main_fd_handler_del() sometimes give errors - // because curl do not make fd itself controlled by users, but it can be ignored. - ecore_main_fd_handler_del(fd_handler); - } - } - - EINA_LIST_FREE(_url_con_list, url_con) - { - CURLMcode ret; - Ecore_Con_Event_Url_Complete *e; - - e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); - if (e) - { - e->url_con = url_con; - e->status = 0; - ecore_event_add(ECORE_CON_EVENT_URL_COMPLETE, e, _ecore_con_event_url_free, NULL); - } - ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); - if (ret != CURLM_OK) ERR("curl_multi_remove_handle failed: %s", curl_multi_strerror(ret)); - } + EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh); + EINA_LIST_FREE(_url_con_list, url_con) _ecore_con_url_multi_remove(url_con); } static Eina_Bool _ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) { - if (_fd_hd_list) - { - Ecore_Fd_Handler *fd_handler; - EINA_LIST_FREE(_fd_hd_list, fd_handler) - { - int fd = ecore_main_fd_handler_fd_get(fd_handler); - FD_CLR(fd, &_current_fd_set); - // FIXME: ecore_main_fd_handler_del() sometimes give errors - // because curl do not make fd itself controlled by users, but it can be ignored. - ecore_main_fd_handler_del(fd_handler); - } - } - ecore_timer_thaw(_curl_timeout); - return ECORE_CALLBACK_RENEW; + Ecore_Fd_Handler *fdh; + EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh); + ecore_timer_interval_set(_curl_timer, 0.1); + return ECORE_CALLBACK_CANCEL; } static void @@ -1516,7 +1529,6 @@ _ecore_con_url_fdset(void) CURLMcode ret; fd_set read_set, write_set, exc_set; int fd, fd_max; - Ecore_Fd_Handler *fd_handler; FD_ZERO(&read_set); FD_ZERO(&write_set); @@ -1532,53 +1544,61 @@ _ecore_con_url_fdset(void) for (fd = 0; fd <= fd_max; fd++) { int flags = 0; - if (FD_ISSET(fd, &read_set)) flags |= ECORE_FD_READ; + if (FD_ISSET(fd, &read_set)) flags |= ECORE_FD_READ; if (FD_ISSET(fd, &write_set)) flags |= ECORE_FD_WRITE; - if (FD_ISSET(fd, &exc_set)) flags |= ECORE_FD_ERROR; + if (FD_ISSET(fd, &exc_set)) flags |= ECORE_FD_ERROR; if (flags) { - if (!FD_ISSET(fd, &_current_fd_set)) - { - FD_SET(fd, &_current_fd_set); - fd_handler = ecore_main_fd_handler_add(fd, flags, _ecore_con_url_fd_handler, NULL, NULL, NULL); - if (fd_handler) _fd_hd_list = eina_list_append(_fd_hd_list, fd_handler); - ecore_timer_freeze(_curl_timeout); - } + // FIXME: Who is owner (easy_handle) of this fd?? (Curl do not give this info.) + // This cause "Failed to delete epoll fd xx!" error messages + Ecore_Fd_Handler *fd_handler; + fd_handler = ecore_main_fd_handler_add(fd, flags, + _ecore_con_url_fd_handler, + NULL, NULL, NULL); + if (fd_handler) + _fd_hd_list = eina_list_append(_fd_hd_list, fd_handler); } } } static Eina_Bool -_ecore_con_url_idler_handler(void *data __UNUSED__) +_ecore_con_url_timer(void *data __UNUSED__) { + Ecore_Fd_Handler *fdh; int still_running; CURLMcode ret; + EINA_LIST_FREE(_fd_hd_list, fdh) ecore_main_fd_handler_del(fdh); + _ecore_con_url_info_read(); + ret = curl_multi_perform(_curlm, &still_running); if (ret == CURLM_CALL_MULTI_PERFORM) { - DBG("Call multiperform again"); + DBG("curl_multi_perform() again immediately"); return ECORE_CALLBACK_RENEW; } else if (ret != CURLM_OK) { ERR("curl_multi_perform() failed: %s", curl_multi_strerror(ret)); _ecore_con_url_curl_clear(); - ecore_timer_freeze(_curl_timeout); - return ECORE_CALLBACK_RENEW; + ecore_timer_freeze(_curl_timer); } - _ecore_con_url_info_read(); if (still_running) { - DBG("multiperform is still_running"); + long ms; _ecore_con_url_fdset(); + curl_multi_timeout(_curlm, &ms); + DBG("multiperform is still running: %d, timeout: %ld", still_running, ms); + if (ms >= CURL_MIN_TIMEOUT || ms <= 0) ms = CURL_MIN_TIMEOUT; + ecore_timer_interval_set(_curl_timer, (double)ms / 1000); } else { DBG("multiperform ended"); + _ecore_con_url_info_read(); _ecore_con_url_curl_clear(); - ecore_timer_freeze(_curl_timeout); + ecore_timer_freeze(_curl_timer); } return ECORE_CALLBACK_RENEW; @@ -1596,17 +1616,20 @@ _ecore_con_url_perform(Ecore_Con_Url *url_con) return EINA_FALSE; } + url_con->multi = EINA_TRUE; _url_con_list = eina_list_append(_url_con_list, url_con); - ecore_timer_thaw(_curl_timeout); + ecore_timer_thaw(_curl_timer); return EINA_TRUE; } static void -_ecore_con_event_url_free(void *data __UNUSED__, - void *ev) +_ecore_con_event_url_free(Ecore_Con_Url *url_con, void *ev) { free(ev); + url_con->event_count--; + if (url_con->dead && (!url_con->event_count)) + ecore_con_url_free(url_con); } #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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -205,6 +204,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -260,6 +261,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -270,6 +273,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -190,6 +189,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -245,6 +246,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -255,6 +258,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 @@ * @li @ref ecore_evas_callbacks_example_c * @li @ref ecore_evas_object_example_c * @li @ref ecore_evas_basics_example_c + * @li @ref Ecore_Evas_Window_Sizes_Example_c + * @li @ref Ecore_Evas_Buffer_Example_01_c + * @li @ref Ecore_Evas_Buffer_Example_02_c */ /* FIXME: @@ -60,10 +63,26 @@ extern "C" { /** * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions * + * Ecore evas is a set of functions that makes it easy to tie together ecore's + * main loop and input handling to evas. As such it's a natural base for EFL + * applications. While this combination makes it easy to create the basic + * aspects all applications need, for normal applications(ones with buttons, + * checkboxes and layouts) one should consider using Elementary. + * + * Ecore evas is extremely well suited for applications that are not based on + * widgets. It has a main loop that delivers events, does basic window handling + * and leaves all of the drawing up to the user. This works very well if used + * in conjunction with Edje or if doing custom drawing as, for example, is done + * in games. + * * This is a list of examples of these functions: - * - @ref Ecore_Evas_Window_Sizes_Example_c - * - @ref Ecore_Evas_Buffer_Example_01_c - * - @ref Ecore_Evas_Buffer_Example_02_c + * @li @ref ecore_evas_basics_example_c + * @li @ref ecore_evas_object_example_c + * @li @ref ecore_evas_callbacks_example_c + * @li @ref Ecore_Evas_Window_Sizes_Example_c + * @li @ref Ecore_Evas_Buffer_Example_01_c + * @li @ref Ecore_Evas_Buffer_Example_02_c + * * @{ */ @@ -151,6 +170,12 @@ typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; #ifndef _ECORE_EVAS_PRIVATE_H /* basic data types */ typedef struct _Ecore_Evas Ecore_Evas; +typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */ +#endif + +#ifndef _ECORE_WAYLAND_H_ +#define _ECORE_WAYLAND_WINDOW_PREDEF +typedef struct _Ecore_Wl_Window Ecore_Wl_Window; #endif /* 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 * This function allows you to make an Ecore_Evas translucent using an * alpha channel. See ecore_evas_shaped_set() for details. The difference * between a shaped window and a window with an alpha channel is that an - * alpha channel supports multiple levels of transpararency, as opposed to + * alpha channel supports multiple levels of transparency, as opposed to * the 1 bit transparency of a shaped window (a pixel is either opaque, or * it's transparent). * @@ -300,7 +325,7 @@ EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, i * This function takes four pointers to (already allocated) ints, and places * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you * may pass NULL on them. - * This function can represent recently requested geomety. + * This function can represent recently requested geometry. * ecore_evas_geometry_get function returns the value is updated after engine finished request. * By comparison, ecore_evas_request_geometry_get returns recently requested value. * @@ -342,7 +367,7 @@ EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee); * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if * @p on is EINA_FALSE. * - * @note Iconify and minize are synonims. + * @note Iconify and minimize are synonyms. * * @warning Support for this depends on the underlying windowing system. */ @@ -353,7 +378,7 @@ EAPI void ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on); * @param ee The Ecore_Evas to set * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not. * - * @note Iconify and minize are synonims. + * @note Iconify and minimize are synonyms. * * @see ecore_evas_iconified_set() */ @@ -401,6 +426,161 @@ EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on); */ EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee); /** + * @brief Set another window that this window is a group member of + * + * @param ee The Ecore_Evas + * @param ee_group The other group member + * + * If @p ee_group is NULL, @p ee is removed from the group, otherwise it is + * added. Note that if you free the @p ee_group canvas before @p ee, then + * getting the group canvas with ecore_evas_window_group_get() will return + * an invalid handle. + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.2 + */ +EAPI void ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group); +/** + * @brief Get the canvas group set. + * + * This returns the handle set by ecore_evas_window_group_set(). + * + * @param ee The Ecore_Evas to set + * @return The Canvas group handle + * + * @see ecore_evas_window_group_set() + * @since 1.2 + */ +EAPI const Ecore_Evas *ecore_evas_window_group_get(const Ecore_Evas *ee); +/** + * @brief Set the aspect ratio of a canvas window + * + * @param ee The Ecore_Evas + * @param aspect The aspect ratio (width divided by height), or 0 to disable + * + * This sets the desired aspect ratio of a canvas window + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.2 + */ +EAPI void ecore_evas_aspect_set(Ecore_Evas *ee, double aspect); +/** + * @brief Get the aspect ratio of a canvas window + * + * This returns the value set by ecore_evas_aspect_set(). + * + * @param ee The Ecore_Evas to set + * @return The aspect ratio + * + * @see ecore_evas_aspect_set() + * @since 1.2 + */ +EAPI double ecore_evas_aspect_get(const Ecore_Evas *ee); +/** + * @brief Set The urgent hint flag + * + * @param ee The Ecore_Evas + * @param urgent The urgent state flag + * + * This sets the "urgent" state hint on a window so the desktop environment + * can highlight it somehow. + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.2 + */ +EAPI void ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent); +/** + * @brief Get the urgent state on the cavas window + * + * This returns the value set by ecore_evas_urgent_set() + * + * @param ee The Ecore_Evas to set + * @return The urgent state set + * + * @see ecore_evas_urgent_set() + * @since 1.2 + */ +EAPI Eina_Bool ecore_evas_urgent_get(const Ecore_Evas *ee); +/** + * @brief Set the modal state flag on the canvas window + * + * @param ee The Ecore_Evas + * @param modal The modal hint flag + * + * This hints if the window should be modal (eg if it is also transient + * for another window, the other window will maybe be denied focus by + * the desktop window manager). + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.2 + */ +EAPI void ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal); +/** + * @brief Get The modal flag + * + * This returns the value set by ecore_evas_modal_set(). + * + * @param ee The Ecore_Evas to set + * @return The modal flag + * + * @see ecore_evas_modal_set() + * @since 1.2 + */ +EAPI Eina_Bool ecore_evas_modal_get(const Ecore_Evas *ee); +/** + * @brief Set the "i demand attention" flag on a canvas window + * + * @param ee The Ecore_Evas + * @param demand_attention The flag state to set + * + * A window may demand attention now (eg you must enter a password before + * continuing), and so it may flag a window with this. + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.2 + */ +EAPI void ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand); +/** + * @brief Get the "i demand attention" flag + * + * This returns the value set by ecore_evas_demand_attention_set(). + * + * @param ee The Ecore_Evas to set + * @return The "i demand attention" flag. + * + * @see ecore_evas_demand_attention_set() + * @since 1.2 + */ +EAPI Eina_Bool ecore_evas_demand_attention_get(const Ecore_Evas *ee); +/** + * @brief Set the "focus skip" flag + * + * @param ee The Ecore_Evas + * @param skip The "focus skip" state to set. + * + * A window may not want to accept focus, be in the taskbar, pager etc. + * sometimes (example for a small notification window that hovers around + * a taskbar or panel, or hovers around a window until some activity + * dismisses it). + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.2 + */ +EAPI void ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip); +/** + * @brief Get the "focus skip" flag + * + * This returns the value set by ecore_evas_focus_skip_set(). + * + * @param ee The Ecore_Evas to set + * @return The "focus skip" flag. + * + * @see ecore_evas_focus_skip_set() + * @since 1.2 + */ +EAPI Eina_Bool ecore_evas_focus_skip_get(const Ecore_Evas *ee); + +/** * @brief Set if this evas should ignore @b all events. * * @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 EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); -EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame); -EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame); + +EAPI 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); +EAPI 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); EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location); -EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); +/* EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); */ +/* EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); */ +/* EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); */ /** * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas move events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas show events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas hide events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas delete request events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas destroy events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas focus in events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas focus out events. * @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) ( * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas sticky events. * @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) * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas un-sticky events. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas mouse in events. * @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) ( * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas mouse out events. * @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) ( * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas pre render events. * @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) * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas mouse post render events. * @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) * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); /** * Set a callback for Ecore_Evas pre-free event. * @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 * @warning If and when this function is called depends on the underlying * windowing system. */ -EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); +/** + * Set a callback for Ecore_Evas state changes. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee changes state. + * + * @since 1.2 + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + EAPI Evas *ecore_evas_get(const Ecore_Evas *ee); EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y); EAPI 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); /** * Return the internal backing store in use. * - * @note this will foced it to be created, making future calls to + * @note this will forced it to be created, making future calls to * ecore_evas_ews_engine_set() void. * * @see ecore_evas_ews_evas_get() @@ -1583,7 +1780,7 @@ EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void); /** * Return the internal backing store in use. * - * @note this will foced it to be created, making future calls to + * @note this will forced it to be created, making future calls to * ecore_evas_ews_engine_set() void. * * @see ecore_evas_ews_ecore_evas_get() @@ -1762,6 +1959,7 @@ EAPI Ecore_Evas *ecore_evas_extn_socket_new(int w, int h); /** * @brief Create a socket to provide the service for external ecore evas socket. * + * @param ee The Ecore_Evas * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail. * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name. * @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 * image data so the external plug process will not render to it or alter it. * * You should only hold the lock for just as long as you need to read out the - * image data or otherwise deal with it, and then unlokc it with + * image data or otherwise deal with it, and then unlock it with * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than * 1 iteration of the main ecore loop will be problematic, so avoid it. Also * 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); * in the canvas of the plug process in place of the image object. The image * object by default is created to be filled (equivalent of * evas_object_image_filled_add() on creation) so image content will scale - * toi fill the image unless otherwise reconfigured. The Ecore_Evas size + * to fill the image unless otherwise reconfigured. The Ecore_Evas size * of the plug is the master size and determines size in pixels of the * plug canvas. You can change the size with something like: * 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 \ @EVAS_LIBS@ \ @EINA_LIBS@ \ @EVIL_LIBS@ \ +@SHM_OPEN_LIBS@ \ @WAYLAND_EGL_LIBS@ libecore_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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -216,6 +215,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -271,6 +272,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -281,6 +284,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ @@ -605,6 +609,7 @@ $(top_builddir)/src/lib/ecore/libecore.la \ @EVAS_LIBS@ \ @EINA_LIBS@ \ @EVIL_LIBS@ \ +@SHM_OPEN_LIBS@ \ @WAYLAND_EGL_LIBS@ libecore_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 return ee; } - -static Ecore_Evas * -_ecore_evas_constructor_sdl16(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) -{ - Ecore_Evas *ee; - unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; - char *name = NULL; - - _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); - _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); - _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); - _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); - - ee = ecore_evas_sdl16_new(name, w, h, fullscreen, hwsurface, noframe, alpha); - free(name); - - return ee; -} #endif #ifdef BUILD_ECORE_EVAS_OPENGL_SDL @@ -606,12 +588,13 @@ static Ecore_Evas * _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options) { char *disp_name = NULL; - unsigned int frame = 0; + unsigned int frame = 0, parent = 0; Ecore_Evas *ee; _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); - ee = ecore_evas_wayland_shm_new(disp_name, x, y, w, h, frame); + _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent); + ee = ecore_evas_wayland_shm_new(disp_name, parent, x, y, w, h, frame); free(disp_name); return ee; @@ -623,12 +606,13 @@ static Ecore_Evas * _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options) { char *disp_name = NULL; - unsigned int frame = 0; + unsigned int frame = 0, parent = 0; Ecore_Evas *ee; _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); - ee = ecore_evas_wayland_egl_new(disp_name, x, y, w, h, frame); + _ecore_evas_parse_extra_options_uint(extra_options, "parent=", &parent); + ee = ecore_evas_wayland_egl_new(disp_name, parent, x, y, w, h, frame); free(disp_name); return ee; @@ -788,7 +772,6 @@ static const struct ecore_evas_engine _engines[] = { #ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL {"sdl", _ecore_evas_constructor_sdl}, - {"software_16_sdl", _ecore_evas_constructor_sdl16}, #endif /* independent */ @@ -944,7 +927,7 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data) #define IFE return;} EAPI void -ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -958,7 +941,7 @@ ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -972,7 +955,7 @@ ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -986,7 +969,7 @@ ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1000,7 +983,7 @@ ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1014,7 +997,7 @@ ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas } EAPI void -ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1028,7 +1011,7 @@ ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1042,7 +1025,7 @@ ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1056,7 +1039,7 @@ ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1070,7 +1053,7 @@ ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1084,7 +1067,7 @@ ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1098,7 +1081,7 @@ ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1112,7 +1095,7 @@ ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) } EAPI void -ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1126,7 +1109,7 @@ ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee) } EAPI void -ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1140,7 +1123,7 @@ ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee } EAPI void -ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { @@ -1151,6 +1134,18 @@ ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) ee->func.fn_pre_free = func; } +EAPI void +ecore_evas_callback_state_change_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_state_change_set"); + return; + } + ee->func.fn_state_change = func; +} + /** * Get an Ecore_Evas's Evas * @param ee The Ecore_Evas whose Evas you wish to get @@ -2120,6 +2115,162 @@ ecore_evas_sticky_get(const Ecore_Evas *ee) } EAPI void +ecore_evas_window_group_set(Ecore_Evas *ee, const Ecore_Evas *ee_group) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return; + } + + IFC(ee, fn_window_group_set) (ee, ee_group); + IFE; +} + +EAPI const Ecore_Evas * +ecore_evas_window_group_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return EINA_FALSE; + } + return ee->prop.group_ee; +} + +EAPI void +ecore_evas_aspect_set(Ecore_Evas *ee, double aspect) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return; + } + + IFC(ee, fn_aspect_set) (ee, aspect); + IFE; +} + +EAPI double +ecore_evas_aspect_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return EINA_FALSE; + } + return ee->prop.aspect; +} + +EAPI void +ecore_evas_urgent_set(Ecore_Evas *ee, Eina_Bool urgent) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return; + } + + IFC(ee, fn_urgent_set) (ee, urgent); + IFE; +} + +EAPI Eina_Bool +ecore_evas_urgent_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return EINA_FALSE; + } + return ee->prop.urgent ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_modal_set(Ecore_Evas *ee, Eina_Bool modal) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return; + } + + IFC(ee, fn_modal_set) (ee, modal); + IFE; +} + +EAPI Eina_Bool +ecore_evas_modal_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return EINA_FALSE; + } + return ee->prop.modal ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_demand_attention_set(Ecore_Evas *ee, Eina_Bool demand) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return; + } + + IFC(ee, fn_demands_attention_set) (ee, demand); + IFE; +} + +EAPI Eina_Bool +ecore_evas_demand_attention_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return EINA_FALSE; + } + return ee->prop.demand_attention ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_focus_skip_set(Ecore_Evas *ee, Eina_Bool skip) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return; + } + + IFC(ee, fn_focus_skip_set) (ee, skip); + IFE; +} + +EAPI Eina_Bool +ecore_evas_focus_skip_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "XXX"); + return EINA_FALSE; + } + return ee->prop.focus_skip ? EINA_TRUE : EINA_FALSE; +} + +EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) @@ -2695,35 +2846,10 @@ ecore_evas_wayland_resize(Ecore_Evas *ee, int location) } } -EAPI void -ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source) -{ - if ((!ee) || (!source)) return; - if (!ee->engine.wl.surface) return; - - if (!strcmp(ee->driver, "wayland_shm")) - { -#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM - _ecore_evas_wayland_shm_drag_start(ee, drag_ee, source); -#endif - } - else if (!strcmp(ee->driver, "wayland_egl")) - { -#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL - _ecore_evas_wayland_egl_drag_start(ee, drag_ee, source); -#endif - } -} #else EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__) { } - -EAPI void -ecore_evas_wayland_drag_start(Ecore_Evas *ee __UNUSED__, Ecore_Evas *drag_ee __UNUSED__, void *source __UNUSED__) -{ - -} #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 = _ecore_evas_buffer_alpha_set, NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_buffer_render, NULL // screen_geometry_get }; 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 @@ #ifdef BUILD_ECORE_EVAS_OPENGL_COCOA #include -#include +#include #endif #include "ecore_evas_private.h" @@ -463,6 +463,14 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = NULL, NULL, NULL, //transparent + + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL }; 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 = NULL, /* alpha */ NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL // screen_geometry_get }; 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 = _ecore_evas_ews_ignore_events_set, _ecore_evas_ews_alpha_set, _ecore_evas_ews_transparent_set, + + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_ews_render, _ecore_evas_ews_screen_geometry_get }; 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 @@ # include #endif +#include #include +#include +#include +#include +#include +#ifdef HAVE_SYS_MMAN_H +# include +#endif +#include +#include +#include +#include #include #include #include "ecore_private.h" #include -#ifdef BUILD_ECORE_IPC -# ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER -# define EXTN_ENABLED 1 -# endif +#ifdef BUILD_ECORE_EVAS_EXTN + +#include + #endif #include "ecore_evas_private.h" #include "Ecore_Evas.h" -#ifdef EXTN_ENABLED -#include "Ecore_Ipc.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#ifdef BUILD_ECORE_EVAS_EXTN + typedef struct _Shmfile Shmfile; @@ -1102,6 +1104,13 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = NULL, NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL // screen_geometry_get }; @@ -1286,12 +1295,13 @@ void _ecore_evas_extn_shutdown(void) { } -#endif + +#endif /* BUILD_ECORE_EVAS_EXTN */ EAPI Evas_Object * ecore_evas_extn_plug_new(Ecore_Evas *ee_target) { -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN Evas_Object *o; Ecore_Evas *ee; int w = 1, h = 1; @@ -1408,7 +1418,7 @@ ecore_evas_extn_plug_new(Ecore_Evas *ee_target) EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) { -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN Extn *extn; Ecore_Evas *ee = NULL; @@ -1459,7 +1469,7 @@ ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, EAPI void ecore_evas_extn_plug_object_data_lock(Evas_Object *obj) { -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN Ecore_Evas *ee; ee = ecore_evas_object_ecore_evas_get(obj); @@ -1471,7 +1481,7 @@ ecore_evas_extn_plug_object_data_lock(Evas_Object *obj) EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj) { -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN Ecore_Evas *ee; ee = ecore_evas_object_ecore_evas_get(obj); @@ -1480,7 +1490,7 @@ ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj) #endif } -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN static void _ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h) { @@ -1830,7 +1840,7 @@ _ipc_client_data(void *data, int type __UNUSED__, void *event) #define STRGET(val) \ do { \ - if ((ipc->val) && (ipc->val < (char *)(e->size - 1))) \ + if ((ipc->val) && (ipc->val < (char *)(long)(e->size - 1))) \ ipc->val = ((char *)ipc) + (long)ipc->val; \ else \ ipc->val = NULL; \ @@ -1978,6 +1988,13 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = _ecore_evas_extn_socket_alpha_set, NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_extn_socket_render, // render NULL // screen_geometry_get }; @@ -1987,7 +2004,7 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = EAPI Ecore_Evas * ecore_evas_extn_socket_new(int w, int h) { -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN Evas_Engine_Info_Buffer *einfo; Ecore_Evas *ee; int rmethod; @@ -2077,7 +2094,7 @@ ecore_evas_extn_socket_new(int w, int h) EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys) { -#ifdef EXTN_ENABLED +#ifdef BUILD_ECORE_EVAS_EXTN Extn *extn; 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 = NULL, NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL // screen_geometry_get }; 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; #define IDLE_FLUSH_TIME 0.5 #ifndef _ECORE_EVAS_H typedef struct _Ecore_Evas Ecore_Evas; +typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); #endif typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; @@ -131,20 +132,20 @@ typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func; struct _Ecore_Evas_Engine_Func { void (*fn_free) (Ecore_Evas *ee); - void (*fn_callback_resize_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_move_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_show_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_hide_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_delete_request_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_destroy_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_focus_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_focus_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_sticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_unsticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_pre_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); - void (*fn_callback_post_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_resize_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_move_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_show_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_hide_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_delete_request_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_destroy_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_focus_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_focus_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_sticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_unsticky_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_pre_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); + void (*fn_callback_post_render_set) (Ecore_Evas *ee, Ecore_Evas_Event_Cb func); void (*fn_move) (Ecore_Evas *ee, int x, int y); void (*fn_managed_move) (Ecore_Evas *ee, int x, int y); void (*fn_resize) (Ecore_Evas *ee, int w, int h); @@ -177,6 +178,13 @@ struct _Ecore_Evas_Engine_Func void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); + void (*fn_window_group_set) (Ecore_Evas *ee, const Ecore_Evas *ee_group); + void (*fn_aspect_set) (Ecore_Evas *ee, double aspect); + void (*fn_urgent_set) (Ecore_Evas *ee, int urgent); + void (*fn_modal_set) (Ecore_Evas *ee, int modal); + void (*fn_demands_attention_set) (Ecore_Evas *ee, int demand); + void (*fn_focus_skip_set) (Ecore_Evas *ee, int skip); + int (*fn_render) (Ecore_Evas *ee); void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); }; @@ -271,11 +279,13 @@ struct _Ecore_Evas_Engine #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL) struct { + Ecore_Wl_Window *parent, *win; Evas_Object *frame; - struct wl_shell_surface *shell_surface; - struct wl_surface *surface; +# if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) struct wl_buffer *buffer; +# endif + } wl; #endif @@ -333,6 +343,9 @@ struct _Ecore_Evas int layer; Ecore_Window window; unsigned char avoid_damage; + Ecore_Evas *group_ee; + Ecore_Window group_ee_win; + double aspect; char focused : 1; char iconified : 1; char borderless : 1; @@ -343,7 +356,12 @@ struct _Ecore_Evas char sticky : 1; char request_pos : 1; char draw_frame : 1; - } prop; + char hwsurface : 1; + char urgent : 1; + char modal : 1; + char demand_attention : 1; + char focus_skip : 1; + } prop; struct { void (*fn_resize) (Ecore_Evas *ee); @@ -361,6 +379,7 @@ struct _Ecore_Evas void (*fn_pre_render) (Ecore_Evas *ee); void (*fn_post_render) (Ecore_Evas *ee); void (*fn_pre_free) (Ecore_Evas *ee); + void (*fn_state_change) (Ecore_Evas *ee); } func; Ecore_Evas_Engine engine; @@ -406,11 +425,15 @@ int _ecore_evas_ews_shutdown(void); #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location); void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); +void _ecore_evas_wayland_shm_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); +void _ecore_evas_wayland_shm_type_set(Ecore_Evas *ee, int type); #endif #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location); void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); +void _ecore_evas_wayland_egl_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); +void _ecore_evas_wayland_egl_type_set(Ecore_Evas *ee, int type); #endif void _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) } static void -_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { ee->func.fn_delete_request = func; } @@ -396,6 +396,13 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = NULL, NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render _ecore_evas_screen_geometry_get // screen_geometry_get }; 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 @@ #include #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) # include -# ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL -# include -# endif # ifdef BUILD_ECORE_EVAS_OPENGL_SDL # include # endif @@ -18,10 +15,17 @@ #include #include +#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) +#include +#endif + #include "ecore_evas_private.h" #include "Ecore_Evas.h" -// fixme: 1 sdl window only at a time? seems wrong +/** + ** SDL only handle one window at a time. That's by definition, there is nothing wrong here. + ** + **/ #if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) @@ -45,6 +49,13 @@ _ecore_evas_sdl_match(void) return sdl_ee; } +static void * +_ecore_evas_sdl_switch_buffer(void *data, void *dest __UNUSED__) +{ + SDL_Flip(data); + return ((SDL_Surface*)data)->pixels; +} + static Eina_Bool _ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) { @@ -80,12 +91,54 @@ _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, v { Ecore_Sdl_Event_Video_Resize *e; Ecore_Evas *ee; + int rmethod; e = event; ee = _ecore_evas_sdl_match(); if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + + rmethod = evas_output_method_get(ee->evas); + if (rmethod == evas_render_method_lookup("buffer")) + { + Evas_Engine_Info_Buffer *einfo; + + einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + einfo->info.switch_data = SDL_SetVideoMode(e->w, e->h, 32, + (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE) + | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0) + | (ee->alpha ? SDL_SRCALPHA : 0) + | SDL_DOUBLEBUF); + if (!einfo->info.switch_data) + { + return EINA_FALSE; + } + + SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); + SDL_FillRect(einfo->info.switch_data, NULL, 0); + + einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; + einfo->info.dest_buffer_row_bytes = e->w * sizeof (int); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo)) + { + return EINA_FALSE; + } + } + } + + ee->w = e->w; + ee->h = e->h; + evas_output_size_set(ee->evas, e->w, e->h); + evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h); return ECORE_CALLBACK_PASS_ON; } @@ -191,7 +244,7 @@ _ecore_evas_sdl_shutdown(void) _ecore_evas_init_count--; if (_ecore_evas_init_count == 0) { - int i; + unsigned int i; for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) ecore_event_handler_del(ecore_evas_event_handlers[i]); @@ -219,10 +272,48 @@ _ecore_evas_sdl_free(Ecore_Evas *ee) static void _ecore_evas_resize(Ecore_Evas *ee, int w, int h) { + int rmethod; + if ((w == ee->w) && (h == ee->h)) return; ee->w = w; ee->h = h; + rmethod = evas_output_method_get(ee->evas); + if (rmethod == evas_render_method_lookup("buffer")) + { + Evas_Engine_Info_Buffer *einfo; + + einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + einfo->info.switch_data = SDL_SetVideoMode(w, h, 32, + (ee->prop.hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE) + | (ee->prop.fullscreen ? SDL_FULLSCREEN : 0) + | (ee->alpha ? SDL_SRCALPHA : 0) + | SDL_DOUBLEBUF); + if (!einfo->info.switch_data) + { + return ; + } + + SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); + SDL_FillRect(einfo->info.switch_data, NULL, 0); + + einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; + einfo->info.dest_buffer_row_bytes = w * sizeof (int); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo)) + { + return ; + } + } + } + evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 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 = NULL, NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL // screen_geometry_get }; @@ -349,7 +447,6 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = static Ecore_Evas* _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) { - void *einfo; Ecore_Evas *ee; if (!name) @@ -382,6 +479,8 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu ee->prop.withdrawn = 0; ee->prop.sticky = 0; ee->prop.window = 0; + ee->alpha = alpha; + ee->prop.hwsurface = hwsurface; /* init evas here */ ee->evas = evas_new(); @@ -391,19 +490,47 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu evas_output_size_set(ee->evas, w, h); evas_output_viewport_set(ee->evas, 0, 0, w, h); - if (rmethod == evas_render_method_lookup("software_sdl") || - rmethod == evas_render_method_lookup("software_16_sdl") ) + if (rmethod == evas_render_method_lookup("buffer")) { -#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL - einfo = evas_engine_info_get(ee->evas); + Evas_Engine_Info_Buffer *einfo; + + einfo = (Evas_Engine_Info_Buffer *) evas_engine_info_get(ee->evas); if (einfo) { - ((Evas_Engine_Info_SDL *)einfo)->info.rotation = 0; - ((Evas_Engine_Info_SDL *)einfo)->info.fullscreen = fullscreen; - ((Evas_Engine_Info_SDL *)einfo)->info.hwsurface = hwsurface; - ((Evas_Engine_Info_SDL *)einfo)->info.noframe = noframe; - ((Evas_Engine_Info_SDL *)einfo)->info.alpha = alpha; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + SDL_Init(SDL_INIT_NOPARACHUTE); + + if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) + { + ERR("SDL_Init failed with %s", SDL_GetError()); + SDL_Quit(); + return NULL; + } + + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + einfo->info.switch_data = SDL_SetVideoMode(w, h, 32, + (hwsurface ? SDL_HWSURFACE : SDL_SWSURFACE) + | (fullscreen ? SDL_FULLSCREEN : 0) + | (noframe ? SDL_NOFRAME : 0) + | (alpha ? SDL_SRCALPHA : 0) + | SDL_DOUBLEBUF); + if (!einfo->info.switch_data) + { + ERR("SDL_SetVideoMode failed !"); + ecore_evas_free(ee); + return NULL; + } + + SDL_SetAlpha(einfo->info.switch_data, SDL_SRCALPHA, 0); + SDL_FillRect(einfo->info.switch_data, NULL, 0); + + einfo->info.dest_buffer = ((SDL_Surface*)einfo->info.switch_data)->pixels; + einfo->info.dest_buffer_row_bytes = w * sizeof (int); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + einfo->info.func.switch_buffer = _ecore_evas_sdl_switch_buffer; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *) einfo)) { ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); ecore_evas_free(ee); @@ -416,16 +543,17 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu ecore_evas_free(ee); return NULL; } -#endif } else if (rmethod == evas_render_method_lookup("gl_sdl")) { #ifdef BUILD_ECORE_EVAS_OPENGL_SDL - einfo = evas_engine_info_get(ee->evas); + Evas_Engine_Info_GL_SDL *einfo; + + einfo = (Evas_Engine_Info_GL_SDL *) evas_engine_info_get(ee->evas); if (einfo) { - ((Evas_Engine_Info_GL_SDL *)einfo)->flags.fullscreen = fullscreen; - ((Evas_Engine_Info_GL_SDL *)einfo)->flags.noframe = noframe; + einfo->flags.fullscreen = fullscreen; + einfo->flags.noframe = noframe; if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { 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 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); - SDL_ShowCursor(SDL_DISABLE); + SDL_ShowCursor(SDL_ENABLE); ee->engine.func->fn_render = _ecore_evas_sdl_render; _ecore_evas_register(ee); @@ -481,11 +609,10 @@ ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface Ecore_Evas *ee; int rmethod; - rmethod = evas_render_method_lookup("software_sdl"); + rmethod = evas_render_method_lookup("buffer"); if (!rmethod) return NULL; ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); - ee->driver = "sdl"; return ee; } #else @@ -497,28 +624,12 @@ ecore_evas_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED } #endif -#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL -EAPI Ecore_Evas* -ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) -{ - Ecore_Evas *ee; - int rmethod; - - rmethod = evas_render_method_lookup("software_16_sdl"); - if (!rmethod) return NULL; - - ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); - ee->driver = "software_16_sdl"; - return ee; -} -#else EAPI Ecore_Evas* ecore_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__) { ERR("OUTCH !"); return NULL; } -#endif #ifdef BUILD_ECORE_EVAS_OPENGL_SDL EAPI 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 @@ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif -#define LOGFNS 1 +//#define LOGFNS 1 #ifdef LOGFNS # include @@ -28,15 +28,15 @@ #include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL -# include # include # include /* local structures */ typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; -struct _EE_Wl_Smart_Data +struct _EE_Wl_Smart_Data { - Evas_Object *frame, *text; + Evas_Object *frame; + Evas_Object *text; Evas_Coord x, y, w, h; }; @@ -51,40 +51,33 @@ static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*fu static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_show(Ecore_Evas *ee); static void _ecore_evas_wl_hide(Ecore_Evas *ee); static void _ecore_evas_wl_raise(Ecore_Evas *ee); -static void _ecore_evas_wl_lower(Ecore_Evas *ee); -static void _ecore_evas_wl_activate(Ecore_Evas *ee); -static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t); +static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title); static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); -static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); -static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__); static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); -static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__); static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); -static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__); +static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full); +static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore); +static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha); +static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent); static int _ecore_evas_wl_render(Ecore_Evas *ee); static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); -static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); - -static 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); -static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__); +static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); /* SMART stuff for frame */ static Evas_Smart *_ecore_evas_wl_smart = NULL; @@ -100,94 +93,94 @@ static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas); /* local variables */ static int _ecore_evas_wl_init_count = 0; -static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8]; -static uint32_t _ecore_evas_wl_btn_timestamp; -static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener = -{ - _ecore_evas_wl_handle_configure, - _ecore_evas_wl_handle_popup_done -}; +static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5]; static Ecore_Evas_Engine_Func _ecore_wl_engine_func = { - _ecore_evas_wl_free, - _ecore_evas_wl_callback_resize_set, - _ecore_evas_wl_callback_move_set, - NULL, // callback show set - NULL, // callback hide set - _ecore_evas_wl_callback_delete_request_set, - NULL, // callback destroy set - _ecore_evas_wl_callback_focus_in_set, - _ecore_evas_wl_callback_focus_out_set, - _ecore_evas_wl_callback_mouse_in_set, - NULL, // callback mouse out set - NULL, // callback sticky set - NULL, // callback unsticky set - NULL, // callback pre render set - NULL, // callback post render set - _ecore_evas_wl_move, - NULL, // func managed move - _ecore_evas_wl_resize, - NULL, // _ecore_evas_wl_move_resize, - NULL, // func rotation set - NULL, // func shaped set - _ecore_evas_wl_show, - _ecore_evas_wl_hide, - _ecore_evas_wl_raise, - _ecore_evas_wl_lower, - _ecore_evas_wl_activate, - _ecore_evas_wl_title_set, - _ecore_evas_wl_name_class_set, - _ecore_evas_wl_size_min_set, - _ecore_evas_wl_size_max_set, - _ecore_evas_wl_size_base_set, - _ecore_evas_wl_size_step_set, - _ecore_evas_wl_object_cursor_set, - _ecore_evas_wl_layer_set, - _ecore_evas_wl_focus_set, - _ecore_evas_wl_iconified_set, - NULL, // func borderless set - NULL, // func override set - _ecore_evas_wl_maximized_set, + _ecore_evas_wl_free, + _ecore_evas_wl_callback_resize_set, + _ecore_evas_wl_callback_move_set, + NULL, + NULL, + _ecore_evas_wl_callback_delete_request_set, + NULL, + _ecore_evas_wl_callback_focus_in_set, + _ecore_evas_wl_callback_focus_out_set, + _ecore_evas_wl_callback_mouse_in_set, + _ecore_evas_wl_callback_mouse_out_set, + NULL, // sticky_set + NULL, // unsticky_set + NULL, // pre_render_set + NULL, // post_render_set + _ecore_evas_wl_move, + NULL, // managed_move + _ecore_evas_wl_resize, + NULL, // move_resize + NULL, // rotation_set + NULL, // shaped_set + _ecore_evas_wl_show, + _ecore_evas_wl_hide, + _ecore_evas_wl_raise, + NULL, // lower + NULL, // activate + _ecore_evas_wl_title_set, + _ecore_evas_wl_name_class_set, + _ecore_evas_wl_size_min_set, + _ecore_evas_wl_size_max_set, + _ecore_evas_wl_size_base_set, + _ecore_evas_wl_size_step_set, + NULL, // object_cursor_set + _ecore_evas_wl_layer_set, + NULL, // focus set + _ecore_evas_wl_iconified_set, + NULL, // borderless set + NULL, // override set + _ecore_evas_wl_maximized_set, _ecore_evas_wl_fullscreen_set, - NULL, // _ecore_evas_wl_avoid_damage_set, + NULL, // func avoid_damage set NULL, // func withdrawn set NULL, // func sticky set - NULL, // func ignore events set - NULL, // func alpha set - NULL, // func transparent set + _ecore_evas_wl_ignore_events_set, + _ecore_evas_wl_alpha_set, + _ecore_evas_wl_transparent_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, _ecore_evas_wl_render, _ecore_evas_wl_screen_geometry_get }; -#endif +/* external variables */ -#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL +/* external functions */ EAPI Ecore_Evas * -ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame) +ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) { + Ecore_Wl_Window *p = NULL; Evas_Engine_Info_Wayland_Egl *einfo; Ecore_Evas *ee; int method = 0; - static int _win_id = 1; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(method = evas_render_method_lookup("wayland_egl"))) + if (!(method = evas_render_method_lookup("wayland_egl"))) { - printf("Render method lookup failed for Wayland Egl"); + ERR("Render method lookup failed for Wayland_Egl"); return NULL; } - if (!ecore_wl_init(disp_name)) + if (!ecore_wl_init(disp_name)) { - printf("Failed to initialize Ecore Wayland"); + ERR("Failed to initialize Ecore_Wayland"); return NULL; } - if (!(ee = calloc(1, sizeof(Ecore_Evas)))) + if (!(ee = calloc(1, sizeof(Ecore_Evas)))) { - printf("Failed to allocate Ecore_Evas."); + ERR("Failed to allocate Ecore_Evas"); ecore_wl_shutdown(); return NULL; } @@ -204,17 +197,22 @@ ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, in if (w < 1) w = 1; if (h < 1) h = 1; - ee->req.x = ee->x = x; - ee->req.y = ee->y = y; - ee->req.w = ee->w = w; - ee->req.h = ee->h = h; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; ee->rotation = 0; - ee->prop.max.w = ee->prop.max.h = 32767; + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; ee->prop.layer = 4; ee->prop.request_pos = 0; ee->prop.sticky = 0; ee->prop.draw_frame = frame; - ee->prop.window = _win_id++; + ee->alpha = EINA_FALSE; ee->evas = evas_new(); 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 evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - if (ee->prop.draw_frame) + /* FIXME: This needs to be set based on theme & scale */ + if (ee->prop.draw_frame) evas_output_framespace_set(ee->evas, 4, 18, 8, 22); - if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) + if (parent) + p = ecore_wl_window_find(parent); + + /* FIXME: Get if parent is alpha, and set */ + + ee->engine.wl.parent = p; + ee->engine.wl.win = + ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW); + ee->prop.window = ee->engine.wl.win->id; + + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) { einfo->info.display = ecore_wl_display_get(); + einfo->info.destination_alpha = EINA_FALSE; einfo->info.rotation = ee->rotation; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { - printf("Failed to set Evas Engine Info for '%s'.", ee->driver); + ERR("Failed to set Evas Engine Info for '%s'", ee->driver); ecore_evas_free(ee); + _ecore_evas_wl_shutdown(); + ecore_wl_shutdown(); return NULL; } } else { - printf("Failed to get Evas Engine Info for '%s'.", ee->driver); + ERR("Failed to get Evas Engine Info for '%s'", ee->driver); ecore_evas_free(ee); + _ecore_evas_wl_shutdown(); + ecore_wl_shutdown(); return NULL; } - /* NB: we need to be notified before 'free' so we can munmap the evas - * engine destination */ ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); 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 /* local functions */ static int -_ecore_evas_wl_init(void) +_ecore_evas_wl_init(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (++_ecore_evas_wl_init_count != 1) return _ecore_evas_wl_init_count; - _ecore_evas_wl_event_handlers[0] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, - _ecore_evas_wl_event_mouse_down, NULL); - _ecore_evas_wl_event_handlers[1] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _ecore_evas_wl_event_mouse_up, NULL); - _ecore_evas_wl_event_handlers[2] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, - _ecore_evas_wl_event_mouse_move, NULL); - _ecore_evas_wl_event_handlers[3] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, - _ecore_evas_wl_event_mouse_wheel, NULL); - _ecore_evas_wl_event_handlers[4] = + _ecore_evas_wl_event_hdls[0] = ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, - _ecore_evas_wl_event_mouse_in, NULL); - _ecore_evas_wl_event_handlers[5] = + _ecore_evas_wl_cb_mouse_in, NULL); + _ecore_evas_wl_event_hdls[1] = ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, - _ecore_evas_wl_event_mouse_out, NULL); - _ecore_evas_wl_event_handlers[6] = + _ecore_evas_wl_cb_mouse_out, NULL); + _ecore_evas_wl_event_hdls[2] = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, - _ecore_evas_wl_event_focus_in, NULL); - _ecore_evas_wl_event_handlers[7] = + _ecore_evas_wl_cb_focus_in, NULL); + _ecore_evas_wl_event_hdls[3] = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, - _ecore_evas_wl_event_focus_out, NULL); + _ecore_evas_wl_cb_focus_out, NULL); + _ecore_evas_wl_event_hdls[4] = + ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, + _ecore_evas_wl_cb_window_configure, NULL); ecore_event_evas_init(); @@ -308,7 +311,7 @@ _ecore_evas_wl_init(void) } static int -_ecore_evas_wl_shutdown(void) +_ecore_evas_wl_shutdown(void) { unsigned int i = 0; @@ -317,10 +320,10 @@ _ecore_evas_wl_shutdown(void) if (--_ecore_evas_wl_init_count != 0) return _ecore_evas_wl_init_count; - for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++) + for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++) { - if (_ecore_evas_wl_event_handlers[i]) - ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); + if (_ecore_evas_wl_event_hdls[i]) + ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]); } ecore_event_evas_shutdown(); @@ -338,24 +341,16 @@ _ecore_evas_wl_pre_free(Ecore_Evas *ee) } static void -_ecore_evas_wl_free(Ecore_Evas *ee) +_ecore_evas_wl_free(Ecore_Evas *ee) { LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (ee) - { - /* destroy shell surface */ - if (ee->engine.wl.shell_surface) - wl_shell_surface_destroy(ee->engine.wl.shell_surface); - ee->engine.wl.shell_surface = NULL; + if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win); + ee->engine.wl.win = NULL; - /* destroy surface */ - if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); - ee->engine.wl.surface = NULL; + ecore_event_window_unregister(ee->prop.window); + ecore_evas_input_event_unregister(ee); - ecore_event_window_unregister(ee->prop.window); - ecore_evas_input_event_unregister(ee); - } _ecore_evas_wl_shutdown(); ecore_wl_shutdown(); } @@ -415,138 +410,131 @@ _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee } static void -_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) +_ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_mouse_out = func; +} + +static void +_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; -// if ((ee->x == x) && (ee->y == y)) return; ee->req.x = x; ee->req.y = y; - ee->x = x; ee->y = y; - if (ee->engine.wl.shell_surface) - { - wl_shell_surface_move(ee->engine.wl.shell_surface, - ecore_wl_input_device_get(), - _ecore_evas_wl_btn_timestamp); - } + if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y); if (ee->func.fn_move) ee->func.fn_move(ee); } static void -_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) +_ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; if (w < 1) w = 1; if (h < 1) h = 1; - if ((ee->w == w) && (ee->h == h)) return; +// if ((ee->w == w) && (ee->h == h)) return; + + if (ee->prop.min.w > w) w = ee->prop.min.w; + else if (w > ee->prop.max.w) w = ee->prop.max.w; + if (ee->prop.min.h > h) h = ee->prop.min.h; + else if (h > ee->prop.max.h) h = ee->prop.max.h; ee->req.w = w; ee->req.h = h; - /* if (ee->visible) */ - /* { */ - /* damage old surface, if it exists */ - - /* NB: This removes any lingering screen artifacts in the compositor. - * This may be a 'HACK' if the issue is actually in the wayland - * compositor, but for now lets implement this so we don't have screen - * artifacts laying around during a resize */ - /* if (ee->engine.wl.surface) */ - /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ - /* } */ +// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); ee->w = w; ee->h = h; -// ecore_wl_flush(); - + /* change evas output & viewport sizes */ evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); if (ee->engine.wl.frame) evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); - /* if ((ee->visible) && (ee->engine.wl.surface)) */ - /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ + /* set new engine destination */ + /* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ + + /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */ + ecore_wl_flush(); + + ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h); if (ee->func.fn_resize) ee->func.fn_resize(ee); } static void -_ecore_evas_wl_show(Ecore_Evas *ee) +_ecore_evas_wl_show(Ecore_Evas *ee) { Evas_Engine_Info_Wayland_Egl *einfo; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ee) return; - if (ee->visible) return; - - einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); + if ((!ee) || (ee->visible)) return; - /* create new surface */ - ee->engine.wl.surface = - wl_compositor_create_surface(ecore_wl_compositor_get()); - wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window); + if (ee->engine.wl.win) + { + ecore_wl_window_show(ee->engine.wl.win); + ecore_wl_flush(); + } - /* create new shell surface */ - ee->engine.wl.shell_surface = - wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); + einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); + if (!einfo) + { + ERR("Failed to get Evas Engine Info for '%s'", ee->driver); + return; + } - /* set the engine surface here. This should trigger an egl window create */ - einfo->info.surface = ee->engine.wl.surface; + einfo->info.surface = ecore_wl_window_surface_get(ee->engine.wl.win); evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - /* add listener for configure events (happen on shell surface resize) */ - wl_shell_surface_add_listener(ee->engine.wl.shell_surface, - &_ecore_evas_wl_shell_surface_listener, ee); - - /* Raise this surface to the top */ - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); - if (ee->engine.wl.frame) { evas_object_show(ee->engine.wl.frame); evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); } - ecore_wl_flush(); + /* ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); */ ee->visible = 1; if (ee->func.fn_show) ee->func.fn_show(ee); } static void -_ecore_evas_wl_hide(Ecore_Evas *ee) +_ecore_evas_wl_hide(Ecore_Evas *ee) { Evas_Engine_Info_Wayland_Egl *einfo; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ee) return; - if (!ee->visible) return; - - /* get engine info */ - einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); - einfo->info.surface = NULL; - evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + if ((!ee) || (!ee->visible)) return; - /* destroy shell surface */ - if (ee->engine.wl.shell_surface) - wl_shell_surface_destroy(ee->engine.wl.shell_surface); - ee->engine.wl.shell_surface = NULL; + if (ee->engine.wl.win) + { + ecore_wl_window_hide(ee->engine.wl.win); + ecore_wl_flush(); + } - /* destroy surface */ - if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); - ee->engine.wl.surface = NULL; + einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.surface = NULL; + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + } ee->visible = 0; ee->should_be_visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); } @@ -556,39 +544,18 @@ _ecore_evas_wl_raise(Ecore_Evas *ee) LOGFN(__FILE__, __LINE__, __FUNCTION__); if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); -} - -static void -_ecore_evas_wl_lower(Ecore_Evas *ee) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->visible)) return; - /* FIXME: Need a way to tell Wayland to lower */ -} - -static void -_ecore_evas_wl_activate(Ecore_Evas *ee) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); + ecore_wl_window_raise(ee->engine.wl.win); } static void -_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) +_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; if (ee->prop.title) free(ee->prop.title); ee->prop.title = NULL; - if (t) ee->prop.title = strdup(t); - + if (title) ee->prop.title = strdup(title); if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) { EE_Wl_Smart_Data *sd; @@ -666,106 +633,101 @@ _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) } static void -_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) { - int x = 0, y = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - ee->prop.cursor.object = NULL; - - if (!obj) - { - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - return; - } - - ee->prop.cursor.object = obj; - ee->prop.cursor.layer = layer; - ee->prop.cursor.hot.x = hot_x; - ee->prop.cursor.hot.y = hot_y; - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); - evas_object_move(ee->prop.cursor.object, - x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _ecore_evas_wl_object_cursor_del, ee); + if (ee->prop.layer == layer) return; + if (layer < 1) layer = 1; + else if (layer > 255) layer = 255; + ee->prop.layer = layer; } static void -_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) { - Ecore_Evas *ee; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(ee = data)) return; - ee->prop.cursor.object = NULL; + if (!ee) return; + if (ee->prop.iconified == iconify) return; + ee->prop.iconified = iconify; + /* FIXME: Implement this in Wayland someshow */ } static void -_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) +_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.layer == layer) return; - if (layer < 1) layer = 1; - else if (layer > 255) layer = 255; - ee->prop.layer = layer; + if (ee->prop.maximized == max) return; + ee->prop.maximized = max; + ecore_wl_window_maximized_set(ee->engine.wl.win, max); } static void -_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) +_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); + if (ee->prop.fullscreen == full) return; + ee->prop.fullscreen = full; + ecore_wl_window_fullscreen_set(ee->engine.wl.win, full); } static void -_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) +_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.iconified == iconify) return; - ee->prop.iconified = iconify; - /* FIXME: Implement this in Wayland someshow */ + ee->ignore_events = ignore; + /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */ } static void -_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) +_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) { + Evas_Engine_Info_Wayland_Egl *einfo; + LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.maximized == max) return; - ee->prop.maximized = max; - /* FIXME: Implement this in Wayland someshow */ + if ((ee->alpha == alpha)) return; + ee->alpha = alpha; + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) + { + einfo->info.destination_alpha = alpha; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } } static void -_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) +_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent) { + Evas_Engine_Info_Wayland_Egl *einfo; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface); + if (!ee) return; + if ((ee->transparent == transparent)) return; + ee->transparent = transparent; + if (!ee->visible) return; + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) + { + einfo->info.destination_alpha = transparent; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } } static int -_ecore_evas_wl_render(Ecore_Evas *ee) +_ecore_evas_wl_render(Ecore_Evas *ee) { int rend = 0; @@ -789,26 +751,24 @@ _ecore_evas_wl_render(Ecore_Evas *ee) if ((updates = evas_render_updates(ee->evas))) { - /* if (ee->engine.wl.surface) */ - /* { */ - /* Eina_List *l = NULL; */ - /* Eina_Rectangle *r; */ + Eina_List *l = NULL; + Eina_Rectangle *r; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* EINA_LIST_FOREACH(updates, l, r) */ - /* wl_surface_damage(ee->engine.wl.surface, */ - /* r->x, r->y, r->w, r->h); */ - /* } */ + EINA_LIST_FOREACH(updates, l, r) + ecore_wl_window_damage(ee->engine.wl.win, + r->x, r->y, r->w, r->h); + + ecore_wl_flush(); evas_render_updates_free(updates); _ecore_evas_idle_timeout_update(ee); rend = 1; - - ecore_wl_flush(); } if (ee->func.fn_post_render) ee->func.fn_post_render(ee); } - return rend; } @@ -822,77 +782,18 @@ _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int ecore_wl_screen_size_get(w, h); } -static Eina_Bool -_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Event_Mouse_Button *ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ev = event; - _ecore_evas_wl_btn_timestamp = ev->timestamp; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers, - ev->timestamp, NULL); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Event_Mouse_Button *ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - ev = event; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers, - ev->timestamp, NULL); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Event_Mouse_Move *ev; - - ev = event; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - ee->mouse.x = ev->x; - ee->mouse.y = ev->y; - evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool -_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +void +_ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location) { - Ecore_Evas *ee; - Ecore_Event_Mouse_Wheel *ev; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ev = event; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, - ev->timestamp, NULL); - return ECORE_CALLBACK_PASS_ON; + if (!ee) return; + if (ee->engine.wl.win) + ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location); } static Eina_Bool -_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; Ecore_Wl_Event_Mouse_In *ev; @@ -900,18 +801,18 @@ _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void * LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); - evas_event_feed_mouse_in(ee->evas, ev->time, NULL); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); + evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); + _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; Ecore_Wl_Event_Mouse_Out *ev; @@ -919,19 +820,19 @@ _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); - evas_event_feed_mouse_out(ee->evas, ev->time, NULL); + _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); + evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -_ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; Ecore_Wl_Event_Focus_In *ev; @@ -939,9 +840,9 @@ _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void * LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; ee->prop.focused = 1; evas_focus_in(ee->evas); 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 * } static Eina_Bool -_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; - Ecore_Wl_Event_Focus_Out *ev; + Ecore_Wl_Event_Focus_In *ev; LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; evas_focus_out(ee->evas); ee->prop.focused = 0; if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); return ECORE_CALLBACK_PASS_ON; } -static void -_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) +static Eina_Bool +_ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; + Ecore_Wl_Event_Window_Configure *ev; - /* NB: Trap to prevent compositor from crashing */ - if ((width <= 0) || (height <= 0)) return; - - if (!(ee = data)) return; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - printf("EGL Handle Configure Message\n"); - if ((shell_surface) && (ee->engine.wl.shell_surface)) + ev = event; + ee = ecore_event_window_match(ev->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if ((ee->x != ev->x) || (ee->y != ev->y)) { - if (ee->engine.wl.shell_surface != shell_surface) return; - ecore_evas_resize(ee, width, height); + ee->x = ev->x; + ee->y = ev->y; + ee->req.x = ee->x; + ee->req.y = ee->y; + if (ee->func.fn_move) ee->func.fn_move(ee); + } + if ((ee->req.w != ev->w) || (ee->req.h != ev->h)) + { + ee->req.w = ev->w; + ee->req.h = ev->h; + if (ee->func.fn_resize) ee->func.fn_resize(ee); } -} - -static void -_ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__) -{ + return ECORE_CALLBACK_PASS_ON; } static void @@ -1101,30 +1008,9 @@ _ecore_evas_wl_frame_add(Evas *evas) return evas_object_smart_add(evas, _ecore_evas_wl_smart); } -void -_ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->engine.wl.shell_surface)) return; - wl_shell_surface_resize(ee->engine.wl.shell_surface, - ecore_wl_input_device_get(), - _ecore_evas_wl_btn_timestamp, location); -} - -void -_ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->engine.wl.surface)) return; - if ((!source) || (!drag_ee)) return; - ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer); -} - #else EAPI Ecore_Evas * -ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__) +ecore_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__) { return NULL; } 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 @@ # include "config.h" #endif -//#define LOGFNS 1 +#define LOGFNS 1 #ifdef LOGFNS # include @@ -20,12 +20,12 @@ # include #endif -# include -# include -# include +#include +#include +#include -# include "ecore_evas_private.h" -# include "Ecore_Evas.h" +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM # include @@ -51,41 +51,34 @@ static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*fu static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +static void _ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_show(Ecore_Evas *ee); static void _ecore_evas_wl_hide(Ecore_Evas *ee); static void _ecore_evas_wl_raise(Ecore_Evas *ee); -static void _ecore_evas_wl_lower(Ecore_Evas *ee); -static void _ecore_evas_wl_activate(Ecore_Evas *ee); -static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t); +static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title); static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); -static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); -static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__); static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); -static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__); static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); -static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__); +static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full); +static void _ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore); +static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha); +static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent); static int _ecore_evas_wl_render(Ecore_Evas *ee); static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest); -static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); -static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); - -static 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); -static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__); +static Eina_Bool _ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); +static Eina_Bool _ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); /* SMART stuff for frame */ static Evas_Smart *_ecore_evas_wl_smart = NULL; @@ -101,95 +94,94 @@ static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas); /* local variables */ static int _ecore_evas_wl_init_count = 0; -static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8]; -static uint32_t _ecore_evas_wl_btn_timestamp; -static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener = -{ - _ecore_evas_wl_handle_configure, - _ecore_evas_wl_handle_popup_done -}; +static Ecore_Event_Handler *_ecore_evas_wl_event_hdls[5]; static Ecore_Evas_Engine_Func _ecore_wl_engine_func = { - _ecore_evas_wl_free, - _ecore_evas_wl_callback_resize_set, - _ecore_evas_wl_callback_move_set, - NULL, // callback show set - NULL, // callback hide set - _ecore_evas_wl_callback_delete_request_set, - NULL, // callback destroy set - _ecore_evas_wl_callback_focus_in_set, - _ecore_evas_wl_callback_focus_out_set, - _ecore_evas_wl_callback_mouse_in_set, - NULL, // callback mouse out set - NULL, // callback sticky set - NULL, // callback unsticky set - NULL, // callback pre render set - NULL, // callback post render set - _ecore_evas_wl_move, - NULL, // func managed move - _ecore_evas_wl_resize, - NULL, // func move_resize - NULL, // func rotation set - NULL, // func shaped set - _ecore_evas_wl_show, - _ecore_evas_wl_hide, - _ecore_evas_wl_raise, - _ecore_evas_wl_lower, - _ecore_evas_wl_activate, - _ecore_evas_wl_title_set, - _ecore_evas_wl_name_class_set, - _ecore_evas_wl_size_min_set, - _ecore_evas_wl_size_max_set, - _ecore_evas_wl_size_base_set, - _ecore_evas_wl_size_step_set, - _ecore_evas_wl_object_cursor_set, - _ecore_evas_wl_layer_set, - _ecore_evas_wl_focus_set, - _ecore_evas_wl_iconified_set, - NULL, // func borderless set - NULL, // func override set - _ecore_evas_wl_maximized_set, - _ecore_evas_wl_fullscreen_set, + _ecore_evas_wl_free, + _ecore_evas_wl_callback_resize_set, + _ecore_evas_wl_callback_move_set, + NULL, + NULL, + _ecore_evas_wl_callback_delete_request_set, + NULL, + _ecore_evas_wl_callback_focus_in_set, + _ecore_evas_wl_callback_focus_out_set, + _ecore_evas_wl_callback_mouse_in_set, + _ecore_evas_wl_callback_mouse_out_set, + NULL, // sticky_set + NULL, // unsticky_set + NULL, // pre_render_set + NULL, // post_render_set + _ecore_evas_wl_move, + NULL, // managed_move + _ecore_evas_wl_resize, + NULL, // move_resize + NULL, // rotation_set + NULL, // shaped_set + _ecore_evas_wl_show, + _ecore_evas_wl_hide, + _ecore_evas_wl_raise, + NULL, // lower + NULL, // activate + _ecore_evas_wl_title_set, + _ecore_evas_wl_name_class_set, + _ecore_evas_wl_size_min_set, + _ecore_evas_wl_size_max_set, + _ecore_evas_wl_size_base_set, + _ecore_evas_wl_size_step_set, + NULL, // object_cursor_set + _ecore_evas_wl_layer_set, + NULL, // focus set + _ecore_evas_wl_iconified_set, + NULL, // borderless set + NULL, // override set + _ecore_evas_wl_maximized_set, + _ecore_evas_wl_fullscreen_set, NULL, // func avoid_damage set NULL, // func withdrawn set NULL, // func sticky set - NULL, // func ignore_events set - NULL, // func alpha set - NULL, // func transparent set + _ecore_evas_wl_ignore_events_set, + _ecore_evas_wl_alpha_set, + _ecore_evas_wl_transparent_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, _ecore_evas_wl_render, _ecore_evas_wl_screen_geometry_get }; /* external variables */ -#endif -#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM +/* external functions */ EAPI Ecore_Evas * -ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame) +ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame) { + Ecore_Wl_Window *p = NULL; Evas_Engine_Info_Wayland_Shm *einfo; Ecore_Evas *ee; int method = 0; - static int _win_id = 1; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(method = evas_render_method_lookup("wayland_shm"))) + if (!(method = evas_render_method_lookup("wayland_shm"))) { - ERR("Render method lookup failed."); + ERR("Render method lookup failed for Wayland_Shm"); return NULL; } - if (!(ecore_wl_init(disp_name))) + if (!ecore_wl_init(disp_name)) { - ERR("Failed to initialize Ecore Wayland."); + ERR("Failed to initialize Ecore_Wayland"); return NULL; } - if (!(ee = calloc(1, sizeof(Ecore_Evas)))) + if (!(ee = calloc(1, sizeof(Ecore_Evas)))) { - ERR("Failed to allocate Ecore_Evas."); + ERR("Failed to allocate Ecore_Evas"); ecore_wl_shutdown(); return NULL; } @@ -206,17 +198,21 @@ ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, in if (w < 1) w = 1; if (h < 1) h = 1; - ee->req.x = ee->x = x; - ee->req.y = ee->y = y; - ee->req.w = ee->w = w; - ee->req.h = ee->h = h; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; ee->rotation = 0; - ee->prop.max.w = ee->prop.max.h = 32767; + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; ee->prop.layer = 4; ee->prop.request_pos = 0; ee->prop.sticky = 0; ee->prop.draw_frame = frame; - ee->prop.window = _win_id++; ee->evas = evas_new(); 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 evas_output_size_set(ee->evas, ee->w, ee->h); evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - if (ee->prop.draw_frame) + /* FIXME: This needs to be set based on theme & scale */ + if (ee->prop.draw_frame) evas_output_framespace_set(ee->evas, 4, 18, 8, 22); - if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) + if (parent) + p = ecore_wl_window_find(parent); + + /* FIXME: Get if parent is alpha, and set */ + + ee->engine.wl.parent = p; + ee->engine.wl.win = + ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_SHM); + ee->prop.window = ee->engine.wl.win->id; + + if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) { einfo->info.rotation = ee->rotation; einfo->info.debug = EINA_FALSE; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { - ERR("Failed to set Evas Engine Info for '%s'.", ee->driver); + ERR("Failed to set Evas Engine Info for '%s'", ee->driver); ecore_evas_free(ee); + _ecore_evas_wl_shutdown(); + ecore_wl_shutdown(); return NULL; } } else { - ERR("Failed to get Evas Engine Info for '%s'.", ee->driver); + ERR("Failed to get Evas Engine Info for '%s'", ee->driver); ecore_evas_free(ee); + _ecore_evas_wl_shutdown(); + ecore_wl_shutdown(); return NULL; } - /* NB: we need to be notified before 'free' so we can munmap the evas - * engine destination */ ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); if (ee->prop.draw_frame) @@ -279,30 +288,21 @@ _ecore_evas_wl_init(void) if (++_ecore_evas_wl_init_count != 1) return _ecore_evas_wl_init_count; - _ecore_evas_wl_event_handlers[0] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, - _ecore_evas_wl_event_mouse_down, NULL); - _ecore_evas_wl_event_handlers[1] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, - _ecore_evas_wl_event_mouse_up, NULL); - _ecore_evas_wl_event_handlers[2] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, - _ecore_evas_wl_event_mouse_move, NULL); - _ecore_evas_wl_event_handlers[3] = - ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, - _ecore_evas_wl_event_mouse_wheel, NULL); - _ecore_evas_wl_event_handlers[4] = + _ecore_evas_wl_event_hdls[0] = ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, - _ecore_evas_wl_event_mouse_in, NULL); - _ecore_evas_wl_event_handlers[5] = + _ecore_evas_wl_cb_mouse_in, NULL); + _ecore_evas_wl_event_hdls[1] = ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, - _ecore_evas_wl_event_mouse_out, NULL); - _ecore_evas_wl_event_handlers[6] = + _ecore_evas_wl_cb_mouse_out, NULL); + _ecore_evas_wl_event_hdls[2] = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, - _ecore_evas_wl_event_focus_in, NULL); - _ecore_evas_wl_event_handlers[7] = + _ecore_evas_wl_cb_focus_in, NULL); + _ecore_evas_wl_event_hdls[3] = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, - _ecore_evas_wl_event_focus_out, NULL); + _ecore_evas_wl_cb_focus_out, NULL); + _ecore_evas_wl_event_hdls[4] = + ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, + _ecore_evas_wl_cb_window_configure, NULL); ecore_event_evas_init(); @@ -319,10 +319,10 @@ _ecore_evas_wl_shutdown(void) if (--_ecore_evas_wl_init_count != 0) return _ecore_evas_wl_init_count; - for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++) + for (i = 0; i < sizeof(_ecore_evas_wl_event_hdls) / sizeof(Ecore_Event_Handler *); i++) { - if (_ecore_evas_wl_event_handlers[i]) - ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); + if (_ecore_evas_wl_event_hdls[i]) + ecore_event_handler_del(_ecore_evas_wl_event_hdls[i]); } ecore_event_evas_shutdown(); @@ -337,17 +337,15 @@ _ecore_evas_wl_pre_free(Ecore_Evas *ee) LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* destroy frame */ if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); - /* get engine info */ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); if ((einfo) && (einfo->info.dest)) { int ret = 0; - /* munmap previous engine destination */ ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); + if (!ret) ERR("Failed to unmap engine destination: %m"); } } @@ -356,18 +354,11 @@ _ecore_evas_wl_free(Ecore_Evas *ee) { LOGFN(__FILE__, __LINE__, __FUNCTION__); - /* destroy buffer */ if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); ee->engine.wl.buffer = NULL; - /* destroy shell surface */ - if (ee->engine.wl.shell_surface) - wl_shell_surface_destroy(ee->engine.wl.shell_surface); - ee->engine.wl.shell_surface = NULL; - - /* destroy surface */ - if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); - ee->engine.wl.surface = NULL; + if (ee->engine.wl.win) ecore_wl_window_free(ee->engine.wl.win); + ee->engine.wl.win = NULL; ecore_event_window_unregister(ee->prop.window); 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 } static void -_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) +_ecore_evas_wl_callback_mouse_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_mouse_out = func; +} + +static void +_ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; -// if ((ee->x == x) && (ee->y == y)) return; ee->req.x = x; ee->req.y = y; - ee->x = x; ee->y = y; - - if (ee->engine.wl.shell_surface) - { - wl_shell_surface_move(ee->engine.wl.shell_surface, - ecore_wl_input_device_get(), - _ecore_evas_wl_btn_timestamp); - } - + if (ee->engine.wl.win) ecore_wl_window_move(ee->engine.wl.win, x, y); if (ee->func.fn_move) ee->func.fn_move(ee); } @@ -458,49 +449,44 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) { Evas_Engine_Info_Wayland_Shm *einfo; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ee) return; if (w < 1) w = 1; if (h < 1) h = 1; - if ((ee->w == w) && (ee->h == h)) return; +// if ((ee->w == w) && (ee->h == h)) return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (ee->prop.min.w > w) w = ee->prop.min.w; + else if (w > ee->prop.max.w) w = ee->prop.max.w; + if (ee->prop.min.h > h) h = ee->prop.min.h; + else if (h > ee->prop.max.h) h = ee->prop.max.h; ee->req.w = w; ee->req.h = h; - if (ee->visible) - { - /* damage old surface, if it exists */ - - /* NB: This removes any lingering screen artifacts in the compositor. - * This may be a 'HACK' if the issue is actually in the wayland - * compositor, but for now lets implement this so we don't have screen - * artifacts laying around during a resize */ - if (ee->engine.wl.surface) - wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); - } +// ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); - /* get engine info */ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); - if (einfo->info.dest) + if ((einfo) && (einfo->info.dest)) { int ret = 0; - /* munmap previous engine destination */ ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); + if (!ret) ERR("Failed to unmap engine destination: %m"); + } + else if (!einfo) + { + ERR("Failed to get Evas Engine Info for '%s'", ee->driver); + return; } - /* free old buffer */ if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); ee->engine.wl.buffer = NULL; ee->w = w; ee->h = h; - /* create buffer @ new size (also mmaps the new destination) */ _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); - - /* flush new buffer fd */ ecore_wl_flush(); /* change evas output & viewport sizes */ @@ -514,16 +500,13 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); /* damage buffer */ - wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h); +// wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h); - if (ee->visible) - { - /* damage surface */ - wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); + ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); + /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */ + /* ecore_wl_flush(); */ - /* if visible, attach to surface */ - wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0); - } + ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h); if (ee->func.fn_resize) ee->func.fn_resize(ee); } @@ -535,93 +518,64 @@ _ecore_evas_wl_show(Ecore_Evas *ee) LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ee) return; - if (ee->visible) return; + if ((!ee) || (ee->visible)) return; - /* get engine info */ - einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); - - /* create new surface */ - ee->engine.wl.surface = - wl_compositor_create_surface(ecore_wl_compositor_get()); - wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window); + if (ee->engine.wl.win) + ecore_wl_window_show(ee->engine.wl.win); - /* get new shell surface */ - ee->engine.wl.shell_surface = - wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); - - /* set toplevel */ - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); + einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); + if (!einfo) + { + ERR("Failed to get Evas Engine Info for '%s'", ee->driver); + return; + } - /* create buffer @ new size (also mmaps the new destination) */ _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - if (ee->engine.wl.frame) + if (ee->engine.wl.frame) { evas_object_show(ee->engine.wl.frame); evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); } - /* set new engine destination */ - evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - - /* add configure listener for wayland resize events */ - wl_shell_surface_add_listener(ee->engine.wl.shell_surface, - &_ecore_evas_wl_shell_surface_listener, ee); - - /* flush new buffer fd */ ecore_wl_flush(); - /* attach buffer to surface */ - wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0); - - /* NB: No need to do a damage here. If we do, we end up w/ screen - * artifacts in the compositor */ - /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ + if (ee->engine.wl.win) + ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); ee->visible = 1; if (ee->func.fn_show) ee->func.fn_show(ee); } static void -_ecore_evas_wl_hide(Ecore_Evas *ee) +_ecore_evas_wl_hide(Ecore_Evas *ee) { Evas_Engine_Info_Wayland_Shm *einfo; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!ee) return; - if (!ee->visible) return; + if ((!ee) || (!ee->visible)) return; - /* get engine info */ einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); - if (einfo->info.dest) + if ((einfo) && (einfo->info.dest)) { int ret = 0; - /* munmap previous engine destination */ ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); - einfo->info.dest = NULL; + if (!ret) ERR("Failed to unmap engine destination: %m"); } - /* free old buffer */ if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); ee->engine.wl.buffer = NULL; - /* set new engine destination */ evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); - /* destroy shell surface */ - if (ee->engine.wl.shell_surface) - wl_shell_surface_destroy(ee->engine.wl.shell_surface); - ee->engine.wl.shell_surface = NULL; - - /* destroy surface */ - if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); - ee->engine.wl.surface = NULL; + ecore_wl_window_hide(ee->engine.wl.win); ee->visible = 0; ee->should_be_visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); } @@ -631,39 +585,18 @@ _ecore_evas_wl_raise(Ecore_Evas *ee) LOGFN(__FILE__, __LINE__, __FUNCTION__); if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); + ecore_wl_window_raise(ee->engine.wl.win); } static void -_ecore_evas_wl_lower(Ecore_Evas *ee) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->visible)) return; - /* FIXME: Need a way to tell Wayland to lower */ -} - -static void -_ecore_evas_wl_activate(Ecore_Evas *ee) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); -} - -static void -_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) +_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *title) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; if (ee->prop.title) free(ee->prop.title); ee->prop.title = NULL; - if (t) ee->prop.title = strdup(t); - + if (title) ee->prop.title = strdup(title); if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) { EE_Wl_Smart_Data *sd; @@ -741,102 +674,96 @@ _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) } static void -_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) { - int x = 0, y = 0; - LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - ee->prop.cursor.object = NULL; - - if (!obj) - { - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - return; - } - - ee->prop.cursor.object = obj; - ee->prop.cursor.layer = layer; - ee->prop.cursor.hot.x = hot_x; - ee->prop.cursor.hot.y = hot_y; - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); - evas_object_move(ee->prop.cursor.object, - x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, - _ecore_evas_wl_object_cursor_del, ee); + if (ee->prop.layer == layer) return; + if (layer < 1) layer = 1; + else if (layer > 255) layer = 255; + ee->prop.layer = layer; } static void -_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) { - Ecore_Evas *ee; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(ee = data)) return; - ee->prop.cursor.object = NULL; + if (!ee) return; + if (ee->prop.iconified == iconify) return; + ee->prop.iconified = iconify; + /* FIXME: Implement this in Wayland someshow */ } static void -_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) +_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.layer == layer) return; - if (layer < 1) layer = 1; - else if (layer > 255) layer = 255; - ee->prop.layer = layer; + if (ee->prop.maximized == max) return; + ee->prop.maximized = max; + ecore_wl_window_maximized_set(ee->engine.wl.win, max); } static void -_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) +_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); + if (ee->prop.fullscreen == full) return; + ee->prop.fullscreen = full; + ecore_wl_window_fullscreen_set(ee->engine.wl.win, full); } static void -_ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) +_ecore_evas_wl_ignore_events_set(Ecore_Evas *ee, int ignore) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.iconified == iconify) return; - ee->prop.iconified = iconify; - /* FIXME: Implement this in Wayland someshow */ + ee->ignore_events = ignore; + /* NB: Hmmm, may need to pass this to ecore_wl_window in the future */ } static void -_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) +_ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) { + Evas_Engine_Info_Wayland_Shm *einfo; + LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ee) return; - if (ee->prop.maximized == max) return; - ee->prop.maximized = max; - /* FIXME: Implement this in Wayland someshow */ + if ((ee->alpha == alpha)) return; + ee->alpha = alpha; + if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) + { + einfo->info.destination_alpha = alpha; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } } static void -_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) +_ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent) { + Evas_Engine_Info_Wayland_Shm *einfo; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - if ((!ee) || (!ee->visible)) return; - if (!ee->engine.wl.shell_surface) return; - wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface); + if (!ee) return; + if ((ee->transparent == transparent)) return; + ee->transparent = transparent; + if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) + { + einfo->info.destination_alpha = transparent; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } } static int @@ -845,9 +772,9 @@ _ecore_evas_wl_render(Ecore_Evas *ee) int rend = 0; if (!ee) return 0; - if (!ee->visible) + if (!ee->visible) evas_norender(ee->evas); - else + else { Eina_List *ll = NULL, *updates = NULL; Ecore_Evas *ee2 = NULL; @@ -867,27 +794,27 @@ _ecore_evas_wl_render(Ecore_Evas *ee) Eina_List *l = NULL; Eina_Rectangle *r; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + EINA_LIST_FOREACH(updates, l, r) { if (ee->engine.wl.buffer) wl_buffer_damage(ee->engine.wl.buffer, r->x, r->y, r->w, r->h); - if (ee->engine.wl.surface) - wl_surface_damage(ee->engine.wl.surface, - r->x, r->y, r->w, r->h); + ecore_wl_window_damage(ee->engine.wl.win, + r->x, r->y, r->w, r->h); } + ecore_wl_flush(); + evas_render_updates_free(updates); _ecore_evas_idle_timeout_update(ee); rend = 1; - - ecore_wl_flush(); } if (ee->func.fn_post_render) ee->func.fn_post_render(ee); } - return rend; } @@ -901,77 +828,67 @@ _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int ecore_wl_screen_size_get(w, h); } -static Eina_Bool -_ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) +static void +_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest) { - Ecore_Evas *ee; - Ecore_Event_Mouse_Button *ev; + struct wl_shm *shm; + static unsigned int format; + char tmp[PATH_MAX]; + int fd = -1, stride = 0, size = 0; + void *ret; LOGFN(__FILE__, __LINE__, __FUNCTION__); - ev = event; - _ecore_evas_wl_btn_timestamp = ev->timestamp; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers, - ev->timestamp, NULL); - return ECORE_CALLBACK_PASS_ON; -} + if (dest) *dest = NULL; + if (!(shm = ecore_wl_shm_get())) return; + if (!format) format = WL_SHM_FORMAT_ARGB8888; //ecore_wl_format_get(); -static Eina_Bool -_ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Event_Mouse_Button *ev; + strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX"); + if ((fd = mkstemp(tmp)) < 0) + { + ERR("Could not create temporary file."); + return; + } - LOGFN(__FILE__, __LINE__, __FUNCTION__); + stride = (ee->w * sizeof(int)); + size = (stride * ee->h); + if (ftruncate(fd, size) < 0) + { + ERR("Could not truncate temporary file."); + close(fd); + return; + } - ev = event; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers, - ev->timestamp, NULL); - return ECORE_CALLBACK_PASS_ON; -} + ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); + unlink(tmp); -static Eina_Bool -_ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - Ecore_Event_Mouse_Move *ev; + if (ret == MAP_FAILED) + { + ERR("mmap of temporary file failed."); + close(fd); + return; + } - ev = event; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - ee->mouse.x = ev->x; - ee->mouse.y = ev->y; - evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); - return ECORE_CALLBACK_PASS_ON; + if (dest) *dest = ret; + + ee->engine.wl.buffer = + wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format); + + close(fd); } -static Eina_Bool -_ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +void +_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location) { - Ecore_Evas *ee; - Ecore_Event_Mouse_Wheel *ev; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - ev = event; - ee = ecore_event_window_match(ev->window); - if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, - ev->timestamp, NULL); - return ECORE_CALLBACK_PASS_ON; + if (!ee) return; + if (ee->engine.wl.win) + ecore_wl_window_resize(ee->engine.wl.win, ee->w, ee->h, location); } static Eina_Bool -_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; Ecore_Wl_Event_Mouse_In *ev; @@ -979,18 +896,18 @@ _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void * LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); - evas_event_feed_mouse_in(ee->evas, ev->time, NULL); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); + evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); + _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; Ecore_Wl_Event_Mouse_Out *ev; @@ -998,19 +915,19 @@ _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); - _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); - evas_event_feed_mouse_out(ee->evas, ev->time, NULL); + _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); + evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); return ECORE_CALLBACK_PASS_ON; } static Eina_Bool -_ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; Ecore_Wl_Event_Focus_In *ev; @@ -1018,9 +935,9 @@ _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void * LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; ee->prop.focused = 1; evas_focus_in(ee->evas); 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 * } static Eina_Bool -_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +_ecore_evas_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; - Ecore_Wl_Event_Focus_Out *ev; + Ecore_Wl_Event_Focus_In *ev; LOGFN(__FILE__, __LINE__, __FUNCTION__); ev = event; - ee = ecore_event_window_match(ev->window); + ee = ecore_event_window_match(ev->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; - if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; evas_focus_out(ee->evas); ee->prop.focused = 0; if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); return ECORE_CALLBACK_PASS_ON; } -static void -_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) +static Eina_Bool +_ecore_evas_wl_cb_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) { Ecore_Evas *ee; - - /* NB: Trap to prevent compositor from crashing */ - if ((width <= 0) || (height <= 0)) return; - - if (!(ee = data)) return; - - if ((shell_surface) && (ee->engine.wl.shell_surface)) - { - if (ee->engine.wl.shell_surface != shell_surface) return; - ecore_evas_resize(ee, width, height); - } -} - -static void -_ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__) -{ - -} - -static void -_ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest) -{ - static unsigned int format; - char tmp[PATH_MAX]; - int fd = -1, stride = 0, size = 0; - void *ret; + Ecore_Wl_Event_Window_Configure *ev; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (dest) *dest = NULL; - - if (!format) format = ecore_wl_format_get(); - - strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX"); - if ((fd = mkstemp(tmp)) < 0) - { - ERR("Could not create temporary file."); - return; - } - - stride = (ee->w * sizeof(int)); - size = (stride * ee->h); - if (ftruncate(fd, size) < 0) + ev = event; + ee = ecore_event_window_match(ev->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; + if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if ((ee->x != ev->x) || (ee->y != ev->y)) { - ERR("Could not truncate temporary file."); - close(fd); - return; + ee->x = ev->x; + ee->y = ev->y; + ee->req.x = ee->x; + ee->req.y = ee->y; + if (ee->func.fn_move) ee->func.fn_move(ee); } - - ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); - unlink(tmp); - - if (ret == MAP_FAILED) + if ((ee->req.w != ev->w) || (ee->req.h != ev->h)) { - ERR("mmap of temporary file failed."); - close(fd); - return; + /* ee->w = ev->w; */ + /* ee->h = ev->h; */ + ee->req.w = ev->w; + ee->req.h = ev->h; + if (ee->func.fn_resize) ee->func.fn_resize(ee); } - if (dest) *dest = ret; - - ee->engine.wl.buffer = - wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format); - - close(fd); + return ECORE_CALLBACK_PASS_ON; } static void @@ -1227,30 +1105,9 @@ _ecore_evas_wl_frame_add(Evas *evas) return evas_object_smart_add(evas, _ecore_evas_wl_smart); } -void -_ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->engine.wl.shell_surface)) return; - wl_shell_surface_resize(ee->engine.wl.shell_surface, - ecore_wl_input_device_get(), - _ecore_evas_wl_btn_timestamp, location); -} - -void -_ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((!ee) || (!ee->engine.wl.surface)) return; - if ((!source) || (!drag_ee)) return; - ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer); -} - #else EAPI Ecore_Evas * -ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__) +ecore_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__) { return NULL; } 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) static void _ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee, - void (*func) (Ecore_Evas *ee)) + Ecore_Evas_Event_Cb func) { ee->func.fn_delete_request = func; } @@ -717,7 +717,7 @@ _ecore_evas_win32_activate(Ecore_Evas *ee) { INF("ecore evas activate"); - ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); + ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window); } static void @@ -819,7 +819,7 @@ _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho static void _ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__) { - ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); + ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window); } static void @@ -879,18 +879,12 @@ _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) if (on != 0) { - ecore_win32_window_shape_set((struct _Ecore_Win32_Window *)ee->prop.window, - 0, 0, NULL); ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, on); } else { ecore_win32_window_fullscreen_set(window, on); - ecore_win32_window_shape_set(window, - window->shape.width, - window->shape.height, - window->shape.mask); } /* 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 = NULL, /* _ecore_evas_x_alpha_set */ NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL //screen_geometry_get }; 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) static void _ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee, - void (*func) (Ecore_Evas *ee)) + Ecore_Evas_Event_Cb func) { ee->func.fn_delete_request = func; } @@ -641,11 +641,11 @@ _ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int ho #endif } -/* static void */ -/* _ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__) */ -/* { */ -/* ecore_wince_window_focus_set(ee->prop.window); */ -/* } */ +static void +_ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__) +{ + ecore_wince_window_focus(ee->prop.window); +} /* static void */ /* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */ @@ -760,7 +760,7 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func = NULL, //_ecore_evas_wince_size_step_set, _ecore_evas_wince_cursor_set, NULL, /* _ecore_evas_x_layer_set */ - NULL, //_ecore_evas_wince_focus_set, + _ecore_evas_wince_focus_set, NULL, //_ecore_evas_wince_iconified_set, NULL, //_ecore_evas_wince_borderless_set, NULL, /* _ecore_evas_x_override_set */ @@ -773,6 +773,13 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func = NULL, /* _ecore_evas_x_alpha_set */ NULL, //transparent + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, // render NULL // screen_geometry_get }; 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; static Ecore_X_Window leader_win = 0; static void +_ecore_evas_x_hints_update(Ecore_Evas *ee) +{ + ecore_x_icccm_hints_set + (ee->prop.window, + !ee->prop.focus_skip /* accepts_focus */, + ee->prop.iconified ? ECORE_X_WINDOW_STATE_HINT_ICONIC : + ee->prop.withdrawn ? ECORE_X_WINDOW_STATE_HINT_WITHDRAWN : + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + ee->prop.group_ee_win /* window_group */, + ee->prop.urgent /* is_urgent */); +} + +static void _ecore_evas_x_group_leader_set(Ecore_Evas *ee) { leader_ref++; @@ -537,6 +553,7 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, { Ecore_Evas *ee; Ecore_X_Event_Window_Property *e; + int state_change = 0; e = event; ee = ecore_event_window_match(e->win); @@ -546,20 +563,62 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, { unsigned int i, num; Ecore_X_Window_State *state; - int sticky = 0; - - /* TODO: we need to move those to the end, with if statements */ - ee->engine.x.state.modal = 0; - ee->engine.x.state.maximized_v = 0; - ee->engine.x.state.maximized_h = 0; - ee->engine.x.state.shaded = 0; + struct { + struct { + unsigned char modal : 1; + unsigned char sticky : 1; + unsigned char maximized_v : 1; + unsigned char maximized_h : 1; + unsigned char shaded : 1; + unsigned char skip_taskbar : 1; + unsigned char skip_pager : 1; + unsigned char fullscreen : 1; + unsigned char above : 1; + unsigned char below : 1; + } x; + struct { + char modal : 1; + char maximized : 1; + char sticky : 1; + char fullscreen : 1; + char focus_skip : 1; + } prop; + } prev; + + prev.x.modal = ee->engine.x.state.modal; + prev.x.sticky = ee->engine.x.state.sticky; + prev.x.maximized_v = ee->engine.x.state.maximized_v; + prev.x.maximized_h = ee->engine.x.state.maximized_h; + prev.x.shaded = ee->engine.x.state.shaded; + prev.x.skip_taskbar = ee->engine.x.state.skip_taskbar; + prev.x.skip_pager = ee->engine.x.state.skip_pager; + prev.x.fullscreen = ee->engine.x.state.fullscreen; + prev.x.above = ee->engine.x.state.above; + prev.x.below = ee->engine.x.state.below; + + prev.prop.modal = ee->prop.modal; + prev.prop.maximized = ee->prop.maximized; + prev.prop.sticky = ee->prop.sticky; + prev.prop.fullscreen = ee->prop.fullscreen; + prev.prop.focus_skip = ee->prop.focus_skip; + + ee->engine.x.state.modal = 0; + ee->engine.x.state.sticky = 0; + ee->engine.x.state.maximized_v = 0; + ee->engine.x.state.maximized_h = 0; + ee->engine.x.state.shaded = 0; ee->engine.x.state.skip_taskbar = 0; - ee->engine.x.state.skip_pager = 0; + ee->engine.x.state.skip_pager = 0; + ee->engine.x.state.fullscreen = 0; + ee->engine.x.state.above = 0; + ee->engine.x.state.below = 0; + + ee->prop.modal = 0; + ee->prop.maximized = 0; + ee->prop.sticky = 0; ee->prop.fullscreen = 0; - ee->engine.x.state.fullscreen = 0; - ee->engine.x.state.above = 0; - ee->engine.x.state.below = 0; - + ee->prop.focus_skip = 0; + ecore_x_netwm_window_state_get(e->win, &state, &num); if (state) { @@ -568,56 +627,106 @@ _ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, switch (state[i]) { case ECORE_X_WINDOW_STATE_MODAL: - ee->engine.x.state.modal = 1; - break; + ee->engine.x.state.modal = 1; + ee->prop.modal = 1; + break; case ECORE_X_WINDOW_STATE_STICKY: - if (ee->prop.sticky && ee->engine.x.state.sticky) - break; - - sticky = 1; - ee->prop.sticky = 1; - ee->engine.x.state.sticky = 1; - if (ee->func.fn_sticky) ee->func.fn_sticky(ee); - break; + ee->prop.sticky = 1; + ee->engine.x.state.sticky = 1; + break; case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: - ee->engine.x.state.maximized_v = 1; - break; + ee->engine.x.state.maximized_v = 1; + ee->prop.maximized = 1; + break; case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: - ee->engine.x.state.maximized_h = 1; - break; + ee->engine.x.state.maximized_h = 1; + ee->prop.maximized = 1; + break; case ECORE_X_WINDOW_STATE_SHADED: - ee->engine.x.state.shaded = 1; - break; + ee->engine.x.state.shaded = 1; + break; case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: - ee->engine.x.state.skip_taskbar = 1; - break; + ee->engine.x.state.skip_taskbar = 1; + ee->prop.focus_skip = 1; + break; case ECORE_X_WINDOW_STATE_SKIP_PAGER: - ee->engine.x.state.skip_pager = 1; - break; + ee->engine.x.state.skip_pager = 1; + ee->prop.focus_skip = 1; + break; case ECORE_X_WINDOW_STATE_FULLSCREEN: - ee->prop.fullscreen = 1; - ee->engine.x.state.fullscreen = 1; - break; + ee->prop.fullscreen = 1; + ee->engine.x.state.fullscreen = 1; + break; case ECORE_X_WINDOW_STATE_ABOVE: - ee->engine.x.state.above = 1; - break; + ee->engine.x.state.above = 1; + break; case ECORE_X_WINDOW_STATE_BELOW: - ee->engine.x.state.below = 1; - break; + ee->engine.x.state.below = 1; + break; default: break; } } free(state); } - - if ((ee->prop.sticky) && (!sticky)) + if ( +// (prev.x.modal != ee->engine.x.state.modal) || + (prev.x.sticky != ee->engine.x.state.sticky) || + (prev.x.maximized_v != ee->engine.x.state.maximized_v) || + (prev.x.maximized_h != ee->engine.x.state.maximized_h) || +// (prev.x.shaded != ee->engine.x.state.shaded) || +// (prev.x.skip_taskbar != ee->engine.x.state.skip_taskbar) || +// (prev.x.skip_pager != ee->engine.x.state.skip_pager) || + (prev.x.fullscreen != ee->engine.x.state.fullscreen) || +// (prev.x.above != ee->engine.x.state.above) || +// (prev.x.below != ee->engine.x.state.below) || +// (prev.prop.modal != ee->prop.modal) || + (prev.prop.maximized != ee->prop.maximized) || + (prev.prop.sticky != ee->prop.sticky) || + (prev.prop.fullscreen != ee->prop.fullscreen) || + (prev.prop.focus_skip != ee->prop.focus_skip)) + state_change = 1; + } + else if (e->atom == ECORE_X_ATOM_WM_STATE) + { + Ecore_X_Window_State_Hint state; + + // handle WM_STATE changes + state = ecore_x_icccm_state_get(e->win); + switch (state) { - ee->prop.sticky = 0; - ee->engine.x.state.sticky = 0; - if (ee->func.fn_unsticky) ee->func.fn_unsticky(ee); + case ECORE_X_WINDOW_STATE_HINT_WITHDRAWN: + if ((!ee->prop.withdrawn) || (ee->prop.iconified)) + { + state_change = 1; + ee->prop.withdrawn = 1; + ee->prop.iconified = 0; + } + break; + case ECORE_X_WINDOW_STATE_HINT_ICONIC: + if ((!ee->prop.iconified) || (ee->prop.withdrawn)) + { + state_change = 1; + ee->prop.iconified = 1; + ee->prop.withdrawn = 0; + } + break; + case ECORE_X_WINDOW_STATE_HINT_NORMAL: + if ((ee->prop.iconified) || (ee->prop.withdrawn)) + { + state_change = 1; + ee->prop.iconified = 0; + ee->prop.withdrawn = 0; + } + break; + default: + break; } } + if (state_change) + { + if (ee->func.fn_state_change) ee->func.fn_state_change(ee); + } return ECORE_CALLBACK_PASS_ON; } @@ -826,7 +935,8 @@ _ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, ee = ecore_event_window_match(e->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; +//xx// filtering with these doesnt help +//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; ee->prop.focused = 1; evas_focus_in(ee->evas); 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__, ee = ecore_event_window_match(e->win); if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; +//xx// filtering with these doesnt help +//xx// if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; + // if (ee->prop.fullscreen) // ecore_x_window_focus(ee->prop.window); evas_focus_out(ee->evas); @@ -1078,8 +1190,8 @@ _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) ee->prop.base.h /* base_h */, ee->prop.step.w /* step_x */, ee->prop.step.h /* step_y */, - 0 /* min_aspect */, - 0 /* max_aspect */); + ee->prop.aspect /* min_aspect */, + ee->prop.aspect /* max_aspect */); } /* FIXME, should be in idler */ @@ -1089,32 +1201,30 @@ _ecore_evas_x_state_update(Ecore_Evas *ee) Ecore_X_Window_State state[10]; int num = 0; - /* - if (bd->client.netwm.state.modal) + if (ee->prop.modal) state[num++] = ECORE_X_WINDOW_STATE_MODAL; - */ - if (ee->engine.x.state.sticky) + if (ee->prop.sticky) state[num++] = ECORE_X_WINDOW_STATE_STICKY; - /* - if (bd->client.netwm.state.maximized_v) + if (ee->prop.maximized) state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; - if (bd->client.netwm.state.maximized_h) + if (ee->prop.maximized) state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; - if (bd->client.netwm.state.shaded) - state[num++] = ECORE_X_WINDOW_STATE_SHADED; - if (bd->client.netwm.state.skip_taskbar) +// if (bd->client.netwm.state.shaded) +// state[num++] = ECORE_X_WINDOW_STATE_SHADED; + if (ee->prop.focus_skip) state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; - if (bd->client.netwm.state.skip_pager) + if (ee->prop.focus_skip) state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER; - if (bd->client.netwm.state.hidden) - state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; - */ +// if (bd->client.netwm.state.hidden) +// state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; if (ee->engine.x.state.fullscreen) state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN; if (ee->engine.x.state.above) state[num++] = ECORE_X_WINDOW_STATE_ABOVE; if (ee->engine.x.state.below) state[num++] = ECORE_X_WINDOW_STATE_BELOW; + if (ee->prop.demand_attention) + state[num++] = ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; ecore_x_netwm_window_state_set(ee->prop.window, state, num); } @@ -1292,7 +1402,7 @@ _ecore_evas_x_free(Ecore_Evas *ee) } static void -_ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +_ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) { ee->func.fn_delete_request = func; _ecore_evas_x_protocols_set(ee); @@ -1578,6 +1688,10 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, static void _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) { + int angles[2]; + angles[0] = rotation; + angles[1] = ee->rotation; + if (ee->rotation == rotation) return; if (!strcmp(ee->driver, "opengl_x11")) { @@ -1589,6 +1703,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); + ecore_x_window_prop_property_set(ee->prop.window, + ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, + ECORE_X_ATOM_CARDINAL, 32, &angles, 2); #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ } else if (!strcmp(ee->driver, "software_x11")) @@ -1601,6 +1718,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); + ecore_x_window_prop_property_set(ee->prop.window, + ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, + ECORE_X_ATOM_CARDINAL, 32, &angles, 2); #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ } else if (!strcmp(ee->driver, "software_16_x11")) @@ -1613,6 +1733,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); + ecore_x_window_prop_property_set(ee->prop.window, + ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, + ECORE_X_ATOM_CARDINAL, 32, &angles, 2); #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ } else if (!strcmp(ee->driver, "software_8_x11")) @@ -1625,6 +1748,9 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); + ecore_x_window_prop_property_set(ee->prop.window, + ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, + ECORE_X_ATOM_CARDINAL, 32, &angles, 2); #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ } } @@ -1839,14 +1965,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -1962,14 +2081,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -2048,14 +2160,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -2134,14 +2239,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -2182,6 +2280,88 @@ _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) #endif } } + +static void +_ecore_evas_x_window_group_set(Ecore_Evas *ee, const Ecore_Evas *group_ee) +{ + if (ee->prop.group_ee == group_ee) return; + + ee->prop.group_ee = (Ecore_Evas *)group_ee; + if (ee->prop.group_ee) + ee->prop.group_ee_win = group_ee->prop.window; + else + ee->prop.group_ee_win = 0; + _ecore_evas_x_hints_update(ee); +} + +static void +_ecore_evas_x_aspect_set(Ecore_Evas *ee, double aspect) +{ + if (ee->prop.aspect == aspect) return; + + ee->prop.aspect = aspect; + _ecore_evas_x_size_pos_hints_update(ee); +// netwm state +// if (ee->should_be_visible) +// ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, +// ECORE_X_WINDOW_STATE_STICKY, -1, sticky); +// else +// _ecore_evas_x_state_update(ee); +} + +static void +_ecore_evas_x_urgent_set(Ecore_Evas *ee, int urgent) +{ + if (ee->prop.urgent == urgent) return; + + ee->prop.urgent = urgent; + _ecore_evas_x_hints_update(ee); +} + +static void +_ecore_evas_x_modal_set(Ecore_Evas *ee, int modal) +{ + if (ee->prop.modal == modal) return; + + ee->prop.modal = modal; + if (ee->should_be_visible) + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_MODAL, -1, modal); + else + _ecore_evas_x_state_update(ee); +} + +static void +_ecore_evas_x_demand_attention_set(Ecore_Evas *ee, int demand) +{ + if (ee->prop.demand_attention == demand) return; + + ee->prop.demand_attention = demand; + if (ee->should_be_visible) + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION, -1, demand); + else + _ecore_evas_x_state_update(ee); +} + +static void +_ecore_evas_x_focus_skip_set(Ecore_Evas *ee, int skip) +{ + if (ee->prop.focus_skip == skip) return; + + ee->prop.focus_skip = skip; + if (ee->should_be_visible) + { + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_SKIP_TASKBAR, -1, skip); + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_SKIP_PAGER, -1, skip); + } + else + _ecore_evas_x_state_update(ee); + _ecore_evas_x_hints_update(ee); +} + #endif /* BUILD_ECORE_EVAS_X11 */ #ifdef BUILD_ECORE_EVAS_X11 @@ -2369,30 +2549,11 @@ _ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) { if (ee->prop.iconified == on) return; ee->prop.iconified = on; + _ecore_evas_x_hints_update(ee); if (on) - { - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); - ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); - } + ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); else - { - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); - ecore_evas_show(ee); - } + ecore_evas_show(ee); } static void @@ -2408,24 +2569,9 @@ _ecore_evas_x_borderless_set(Ecore_Evas *ee, int on) static void _ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) { - Ecore_X_Window_State_Hint hint; - if (ee->prop.withdrawn == withdrawn) return; - ee->prop.withdrawn = withdrawn; - if (withdrawn) - hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; - else - hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; - - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - hint /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); } static void @@ -2762,6 +2908,13 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func = _ecore_evas_x_ignore_events_set, _ecore_evas_x_alpha_set, _ecore_evas_x_transparent_set, + + _ecore_evas_x_window_group_set, + _ecore_evas_x_aspect_set, + _ecore_evas_x_urgent_set, + _ecore_evas_x_modal_set, + _ecore_evas_x_demand_attention_set, + _ecore_evas_x_focus_skip_set, NULL, // render _ecore_evas_x_screen_geometry_get @@ -3003,14 +3156,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, } } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -3240,14 +3386,7 @@ ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, // putenv((char*)"DESKTOP_STARTUP_ID="); } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -3571,14 +3710,7 @@ ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, return NULL; } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); @@ -3895,14 +4027,7 @@ ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, return NULL; } - ecore_x_icccm_hints_set(ee->prop.window, - 1 /* accepts_focus */, - ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, - 0 /* icon_pixmap */, - 0 /* icon_mask */, - 0 /* icon_window */, - 0 /* window_group */, - 0 /* is_urgent */); + _ecore_evas_x_hints_update(ee); _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -194,6 +193,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -249,6 +250,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -259,6 +262,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) fb = open("/dev/fb0", O_RDWR); if (fb < 0) - { - if (w) *w = 0; - if (h) *h = 0; - return; - } + goto exit; + if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1) - { - if (w) *w = 0; - if (h) *h = 0; - close(fb); - return; - } + goto err_ioctl; + + *w = fb_var.xres; + *h = fb_var.yres; + +err_ioctl: close(fb); - if (w) *w = fb_var.xres; - if (h) *h = fb_var.yres; +exit: + return; } /** 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -195,6 +194,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -250,6 +251,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -260,6 +263,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) Eina_List *list = NULL; ls = eina_file_direct_ls(dir); + if (!ls) return NULL; + EINA_ITERATOR_FOREACH(ls, info) { 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; static Ecore_Event_Handler *_url_progress_download = NULL; static Eina_List *_job_list; +static int download_init = 0; + #endif /* BUILD_ECORE_CON */ int ecore_file_download_init(void) { #ifdef BUILD_ECORE_CON - if (!ecore_con_url_init()) - return 0; - + download_init++; + if (download_init > 1) return 1; + if (!ecore_con_init()) return 0; + if (!ecore_con_url_init()) + { + ecore_con_shutdown(); + return 0; + } # ifdef HAVE_CURL - _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); - _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); + _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); + _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); # endif - #endif /* BUILD_ECORE_CON */ - return 1; } @@ -68,15 +73,17 @@ void ecore_file_download_shutdown(void) { #ifdef BUILD_ECORE_CON - if (_url_complete_handler) - ecore_event_handler_del(_url_complete_handler); - if (_url_progress_download) - ecore_event_handler_del(_url_progress_download); - _url_complete_handler = NULL; - _url_progress_download = NULL; - ecore_file_download_abort_all(); - - ecore_con_url_shutdown(); + download_init--; + if (download_init > 0) return; + if (_url_complete_handler) + ecore_event_handler_del(_url_complete_handler); + if (_url_progress_download) + ecore_event_handler_del(_url_progress_download); + _url_complete_handler = NULL; + _url_progress_download = NULL; + ecore_file_download_abort_all(); + ecore_con_url_shutdown(); + ecore_con_shutdown(); #endif /* BUILD_ECORE_CON */ } @@ -362,7 +369,6 @@ _ecore_file_download_curl(const char *url, const char *dst, } if (headers) eina_hash_foreach(headers, _ecore_file_download_headers_foreach_cb, job); - ecore_con_url_timeout_set(job->url_con, ECORE_FILE_DOWNLOAD_TIMEOUT); ecore_con_url_fd_set(job->url_con, fileno(job->file)); ecore_con_url_data_set(job->url_con, data); 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 @@ extern "C" { #endif +/** + * @addtogroup Ecore_IMF_Context_Group + * + * @{ + */ + /* Events sent by the Input Method */ typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start; typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End; @@ -66,25 +72,41 @@ EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING; typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info); +/** + * @enum _Ecore_IMF_Callback_Type + * @typedef Ecore_IMF_Callback_Type + * + * Ecore IMF Event callback types. + * + * @see ecore_imf_context_event_callback_add() + */ typedef enum { - ECORE_IMF_CALLBACK_PREEDIT_START, - ECORE_IMF_CALLBACK_PREEDIT_END, - ECORE_IMF_CALLBACK_PREEDIT_CHANGED, - ECORE_IMF_CALLBACK_COMMIT, - ECORE_IMF_CALLBACK_DELETE_SURROUNDING + ECORE_IMF_CALLBACK_PREEDIT_START, /**< "PREEDIT_START" is called when a new preediting sequence starts. */ + ECORE_IMF_CALLBACK_PREEDIT_END, /**< "PREEDIT_END" is called when a preediting sequence has been completed or canceled. */ + ECORE_IMF_CALLBACK_PREEDIT_CHANGED, /**< "PREEDIT_CHANGED" is called whenever the preedit sequence currently being entered has changed. */ + ECORE_IMF_CALLBACK_COMMIT, /**< "COMMIT" is called when a complete input sequence has been entered by the user */ + 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 */ } Ecore_IMF_Callback_Type; +/** + * @enum _Ecore_IMF_Event_Type + * @typedef Ecore_IMF_Event_Type + * + * Ecore IMF event types. + * + * @see ecore_imf_context_filter_event() + */ typedef enum { - ECORE_IMF_EVENT_MOUSE_DOWN, - ECORE_IMF_EVENT_MOUSE_UP, - ECORE_IMF_EVENT_MOUSE_IN, - ECORE_IMF_EVENT_MOUSE_OUT, - ECORE_IMF_EVENT_MOUSE_MOVE, - ECORE_IMF_EVENT_MOUSE_WHEEL, - ECORE_IMF_EVENT_KEY_DOWN, - ECORE_IMF_EVENT_KEY_UP + ECORE_IMF_EVENT_MOUSE_DOWN, /**< Mouse Down event */ + ECORE_IMF_EVENT_MOUSE_UP, /**< Mouse Up event */ + ECORE_IMF_EVENT_MOUSE_IN, /**< Mouse In event */ + ECORE_IMF_EVENT_MOUSE_OUT, /**< Mouse Out event */ + ECORE_IMF_EVENT_MOUSE_MOVE, /**< Mouse Move event */ + ECORE_IMF_EVENT_MOUSE_WHEEL, /**< Mouse Wheel event */ + ECORE_IMF_EVENT_KEY_DOWN, /**< Key Down event */ + ECORE_IMF_EVENT_KEY_UP /**< Key Up event */ } Ecore_IMF_Event_Type; typedef enum @@ -123,22 +145,46 @@ typedef enum ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30 } Ecore_IMF_Input_Mode; +/** + * @enum _Ecore_IMF_Preedit_Type + * @typedef Ecore_IMF_Preedit_Type + * + * Ecore IMF Preedit style types + * + * @see ecore_imf_context_preedit_string_with_attributes_get() + */ typedef enum { - ECORE_IMF_PREEDIT_TYPE_NONE, - ECORE_IMF_PREEDIT_TYPE_SUB1, - ECORE_IMF_PREEDIT_TYPE_SUB2, - ECORE_IMF_PREEDIT_TYPE_SUB3 + ECORE_IMF_PREEDIT_TYPE_NONE, /**< None style */ + ECORE_IMF_PREEDIT_TYPE_SUB1, /**< Substring style 1 */ + ECORE_IMF_PREEDIT_TYPE_SUB2, /**< Substring style 2 */ + ECORE_IMF_PREEDIT_TYPE_SUB3 /**< Substring style 3 */ } Ecore_IMF_Preedit_Type; +/** + * @enum _Ecore_IMF_Autocapital_Type + * @typedef Ecore_IMF_Autocapital_Type + * + * Autocapitalization Types. + * + * @see ecore_imf_context_autocapital_type_set() + */ typedef enum { - ECORE_IMF_AUTOCAPITAL_TYPE_NONE, - ECORE_IMF_AUTOCAPITAL_TYPE_WORD, - ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, - ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER + ECORE_IMF_AUTOCAPITAL_TYPE_NONE, /**< No auto-capitalization when typing */ + ECORE_IMF_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed */ + ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence */ + ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER, /**< Autocapitalize all letters */ } Ecore_IMF_Autocapital_Type; +/** + * @enum _Ecore_IMF_Input_Panel_Layout + * @typedef Ecore_IMF_Input_Panel_Layout + * + * Input panel (virtual keyboard) layout types. + * + * @see ecore_imf_context_input_panel_layout_set() + */ typedef enum { ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */ @@ -155,12 +201,40 @@ typedef enum ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */ } Ecore_IMF_Input_Panel_Layout; +/** + * @enum _Ecore_IMF_Input_Panel_Lang + * @typedef Ecore_IMF_Input_Panel_Lang + * + * Input panel (virtual keyboard) language modes. + * + * @see ecore_imf_context_input_panel_language_set() + */ typedef enum { - ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ - ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ + ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic @since 1.2 */ + ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet @since 1.2 */ } Ecore_IMF_Input_Panel_Lang; +/** + * @enum _Ecore_IMF_Input_Panel_Return_Key_Type + * @typedef Ecore_IMF_Input_Panel_Return_Key_Type + * + * "Return" Key types on the input panel (virtual keyboard). + * + * @see ecore_imf_context_input_panel_return_key_type_set() + */ +typedef enum +{ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, /**< Default @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE, /**< Done @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO, /**< Go @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, /**< Join @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, /**< Login @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, /**< Next @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, /**< Search or magnifier icon @since 1.2 */ + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND /**< Send @since 1.2 */ +} Ecore_IMF_Input_Panel_Return_Key_Type; + struct _Ecore_IMF_Event_Preedit_Start { Ecore_IMF_Context *ctx; @@ -314,9 +388,9 @@ union _Ecore_IMF_Event struct _Ecore_IMF_Preedit_Attr { - Ecore_IMF_Preedit_Type preedit_type; - unsigned int start_index; - unsigned int end_index; + Ecore_IMF_Preedit_Type preedit_type; /**< preedit style type */ + unsigned int start_index; /**< start index of the range (in bytes) */ + unsigned int end_index; /**< end index of the range (in bytes) */ }; struct _Ecore_IMF_Context_Class @@ -345,6 +419,11 @@ struct _Ecore_IMF_Context_Class void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx); void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h); + void (*input_panel_imdata_set)(Ecore_IMF_Context *ctx, const void* data, int len); + void (*input_panel_imdata_get)(Ecore_IMF_Context *ctx, void* data, int *len); + void (*input_panel_return_key_type_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type); + void (*input_panel_return_key_disabled_set) (Ecore_IMF_Context *ctx, Eina_Bool disabled); + void (*input_panel_caps_lock_mode_set) (Ecore_IMF_Context *ctx, Eina_Bool mode); }; struct _Ecore_IMF_Context_Info @@ -418,6 +497,14 @@ EAPI void ecore_imf_context_input_panel_language_set(Ec EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable); EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len); +EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len); +EAPI void ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type); +EAPI Ecore_IMF_Input_Panel_Return_Key_Type ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled); +EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode); +EAPI Eina_Bool ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx); /* The following entry points must be exported by each input method module */ @@ -433,3 +520,7 @@ EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Eco #endif #endif + +/** + * @} + */ 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id; * on failure it returns NULL. * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * + * const char *ctx_id; + * const Ecore_IMF_Context_Info *ctx_info; + * Ecore_IMF_Context *imf_context; + * ctx_id = ecore_imf_context_default_id_get(); + * if (ctx_id) + * { + * ctx_info = ecore_imf_context_info_by_id_get(ctx_id); + * if (!ctx_info->canvas_type || + * strcmp(ctx_info->canvas_type, "evas") == 0) + * { + * imf_context = ecore_imf_context_add(ctx_id); + * } + * else + * { + * ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); + * if (ctx_id) + * { + * imf_context = ecore_imf_context_add(ctx_id); + * } + * } + * } + * @endcode */ EAPI const Ecore_IMF_Context_Info * ecore_imf_context_info_by_id_get(const char *id) @@ -188,6 +214,10 @@ ecore_imf_context_add(const char *id) * set on the immodule */ ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE); + /* default input panel layout type is NORMAL type, so let's make sure it's + * set on the immodule */ + ecore_imf_context_input_panel_layout_set(ctx, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL); + /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's * set on the immodule */ 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 } /** - * Retrieve the current preedit string, atrributes and + * Retrieve the current preedit string, attributes and * cursor position for the Input Method Context. * * @param ctx An #Ecore_IMF_Context. @@ -413,6 +443,49 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu * @param cursor_pos Location to store position of cursor (in characters) * within the preedit string. * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * char *preedit_string; + * int cursor_pos; + * Eina_List *attrs = NULL, *l = NULL; + * Ecore_IMF_Preedit_Attr *attr; + * + * ecore_imf_context_preedit_string_with_attributes_get(imf_context, + * &preedit_string, + * &attrs, &cursor_pos); + * if (!preedit_string) return; + * + * if (strlen(preedit_string) > 0) + * { + * if (attrs) + * { + * EINA_LIST_FOREACH(attrs, l, attr) + * { + * if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) + * { + * // Something to do + * } + * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2) + * { + * // Something to do + * } + * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3) + * { + * // Something to do + * } + * } + * } + * } + * + * // delete attribute list + * if (attrs) + * { + * EINA_LIST_FREE(attrs, attr) free(attr); + * } + * + * free(preedit_string); + * @endcode * @since 1.1.0 */ EAPI void @@ -440,6 +513,18 @@ ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, cha * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source) + * { + * ecore_imf_context_reset(imf_context); + * ecore_imf_context_focus_in(imf_context); + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _focus_in_cb, ed); + * @endcode */ EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) @@ -459,6 +544,18 @@ ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source) + * { + * ecore_imf_context_reset(imf_context); + * ecore_imf_context_focus_out(imf_context); + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed); + * @endcode */ EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) @@ -479,6 +576,18 @@ ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source) + * { + * ecore_imf_context_reset(imf_context); + * ecore_imf_context_focus_out(imf_context); + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed); + * @endcode */ EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx) @@ -515,10 +624,12 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) /** * Notify the Input Method Context that a change in the cursor * location has been made. The location is relative to the canvas. + * The cursor location can be used to determine the position of + * candidate word window in the immodule. * * @param ctx An #Ecore_IMF_Context. * @param x cursor x position. - * @param x cursor y position. + * @param y cursor y position. * @param w cursor width. * @param h cursor height. * @ingroup Ecore_IMF_Context_Group @@ -605,7 +716,7 @@ ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx) } /** - * Set the autocapitalization type on the immodule. + * Set the autocapitalization type on the immodule. * * @param ctx An #Ecore_IMF_Context. * @param autocapital_type the autocapitalization type. @@ -732,6 +843,28 @@ ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx) * @param event The event itself. * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE. * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) + * { + * Evas_Event_Key_Down *ev = event_info; + * if (!ev->keyname) return; + * + * if (imf_context) + * { + * Ecore_IMF_Event_Key_Down ecore_ev; + * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); + * if (ecore_imf_context_filter_event(imf_context, + * ECORE_IMF_EVENT_KEY_DOWN, + * (Ecore_IMF_Event *)&ecore_ev)) + * return; + * } + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data); + * @endcode */ EAPI Eina_Bool ecore_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) * If the function returns EINA_TRUE, then you must free * the result stored in this location with free(). * @param cursor_pos Location to store the position in characters of - * the insertion cursor within @text. + * the insertion cursor within @p text. * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE. * @ingroup Ecore_IMF_Context_Module_Group */ @@ -877,6 +1010,8 @@ _ecore_imf_event_free_preedit(void *data __UNUSED__, void *event) * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue. * * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts. + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_Module_Group @@ -903,6 +1038,8 @@ ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx) * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue. * * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled. + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_Module_Group @@ -928,6 +1065,9 @@ ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx) /** * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue. * + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_Module_Group */ @@ -962,6 +1102,9 @@ _ecore_imf_event_free_commit(void *data __UNUSED__, void *event) /** * Adds ECORE_IMF_EVENT_COMMIT to the event queue. * + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * * @param ctx An #Ecore_IMF_Context. * @param str The committed string. * @ingroup Ecore_IMF_Context_Module_Group @@ -999,6 +1142,9 @@ _ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event) * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. * Note that offset and n_chars are in characters not in bytes. * + * It's asynchronous method to put ECORE_IMF_EVENT_DELETE_SURROUNDING event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * * @param ctx An #Ecore_IMF_Context. * @param offset The start offset of surrounding to be deleted. * @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 * @param func The (callback) function to be called when the event is * triggered * @param data The data pointer to be passed to @p func - * @ingroup Ecore_IMF_Context_Module_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.2.0 + * + * Example + * @code + * static void + * _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info) + * { + * char *commit_str = event_info; + * // something to do + * } + * + * ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data); + * @endcode */ EAPI void ecore_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_ * @see ecore_imf_context_event_callback_add() for more details * * @param ctx Ecore_IMF_Context to remove a callback from. - * @param type The type of event that was trigerring the callback + * @param type The type of event that was triggering the callback * @param func The (callback) function that was to be called when the event was triggered * @return the data pointer - * @ingroup Ecore_IMF_Context_Module_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.2.0 */ EAPI void * @@ -1096,7 +1254,7 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_ { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, "ecore_imf_context_event_callback_del"); - return; + return NULL; } if (!func) return NULL; @@ -1106,7 +1264,7 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_ { if ((fn) && (fn->func == func) && (fn->type == type)) { - void *tmp = fn->data; + void *tmp = (void *)fn->data; free(fn); ctx->callbacks = eina_list_remove_list(ctx->callbacks, l); return tmp; @@ -1156,11 +1314,11 @@ ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback * Ask the Input Method Context to show the control panel of using Input Method. * * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI void -ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx) +ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1176,11 +1334,11 @@ ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx) * Ask the Input Method Context to hide the control panel of using Input Method. * * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI void -ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx) +ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1196,7 +1354,7 @@ ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx) * Ask the Input Method Context to show the input panel (virtual keyboard). * * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI void @@ -1216,7 +1374,7 @@ ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx) * Ask the Input Method Context to hide the input panel. * * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI void @@ -1236,12 +1394,12 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) * Set the layout of the input panel. * * @param ctx An #Ecore_IMF_Context. - * @param layout see #ECORE_IMF_INPUT_PANEL_LAYOUT - * @ingroup Ecore_IMF_Context_IMControl_Group + * @param layout see #Ecore_IMF_Input_Panel_Layout + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI void -ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout) +ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1261,11 +1419,11 @@ ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Inpu * * @param ctx An #Ecore_IMF_Context. * @return layout see #Ecore_IMF_Input_Panel_Layout - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI Ecore_IMF_Input_Panel_Layout -ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx) +ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1275,9 +1433,7 @@ ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx) } if (ctx->klass->input_panel_layout_get) - { - return ctx->input_panel_layout; - } + return ctx->input_panel_layout; else return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; } @@ -1288,11 +1444,11 @@ ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx) * * @param ctx An #Ecore_IMF_Context. * @param lang the language to be set to the input panel. - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI void -ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang) +ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1312,11 +1468,11 @@ ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_In * * @param ctx An #Ecore_IMF_Context. * @return Ecore_IMF_Input_Panel_Lang - * @ingroup Ecore_IMF_Context_IMControl_Group + * @ingroup Ecore_IMF_Context_Group * @since 1.1.0 */ EAPI Ecore_IMF_Input_Panel_Lang -ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx) +ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1338,7 +1494,7 @@ ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx) * @since 1.1.0 */ EAPI void -ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx, +ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enabled) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) @@ -1360,7 +1516,7 @@ ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx, * @since 1.1.0 */ EAPI Eina_Bool -ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx) +ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { @@ -1372,3 +1528,191 @@ ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx) return ctx->input_panel_enabled; } +/** + * Set the input panel-specific data to deliver to the input panel. + * This API is used by applications to deliver specific data to the input panel. + * The data format MUST be negotiated by both application and the input panel. + * The size and format of data are defined by the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param data The specific data to be set to the input panel. + * @param len the length of data, in bytes, to send to the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_imdata_set"); + return; + } + + if (!data) return; + + if (ctx->klass->input_panel_imdata_set) + ctx->klass->input_panel_imdata_set(ctx, data, len); +} + +/** + * Get the specific data of the current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param data The specific data to be got from the input panel + * @param len The length of data + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_imdata_get"); + return; + } + + if (!data) return; + + if (ctx->klass->input_panel_imdata_get) + ctx->klass->input_panel_imdata_get(ctx, data, len); +} + +/** + * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel. + * + * An input panel displays the string or icon associated with this type + * + * @param ctx An #Ecore_IMF_Context. + * @param return_key_type The type of "return" key on the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_return_key_type_set"); + return; + } + + ctx->input_panel_return_key_type = return_key_type; + if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type); +} + +/** + * Get the "return" key type. + * + * @see ecore_imf_context_input_panel_return_key_type_set() for more details + * + * @param ctx An #Ecore_IMF_Context. + * @return The type of "return" key on the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI Ecore_IMF_Input_Panel_Return_Key_Type +ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_return_key_type_get"); + return EINA_FALSE; + } + + return ctx->input_panel_return_key_type; +} + +/** + * Set the return key on the input panel to be disabled. + * + * @param ctx An #Ecore_IMF_Context. + * @param disabled The state + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_return_key_disabled_set"); + return; + } + + ctx->input_panel_return_key_disabled = disabled; + if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled); +} + +/** + * Get whether the return key on the input panel should be disabled or not. + * + * @param ctx An #Ecore_IMF_Context. + * @return EINA_TRUE if it should be disabled + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI Eina_Bool +ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_return_key_disabled_get"); + return EINA_FALSE; + } + + return ctx->input_panel_return_key_disabled; +} + +/** + * Set the caps lock mode on the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param mode Turn on caps lock on the input panel if EINA_TRUE + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_caps_lock_mode_set"); + return; + } + + if (ctx->klass->input_panel_caps_lock_mode_set) + ctx->klass->input_panel_caps_lock_mode_set(ctx, mode); + + ctx->input_panel_caps_lock_mode = mode; +} + +/** + * Get the caps lock mode on the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @return EINA_TRUE if the caps lock is turned on. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ +EAPI Eina_Bool +ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_caps_lock_mode_get"); + return EINA_FALSE; + } + + return ctx->input_panel_caps_lock_mode; +} + 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 Ecore_IMF_Autocapital_Type autocapital_type; Ecore_IMF_Input_Panel_Layout input_panel_layout; Ecore_IMF_Input_Panel_Lang input_panel_lang; + Ecore_IMF_Input_Panel_Return_Key_Type input_panel_return_key_type; Eina_Bool allow_prediction : 1; Eina_Bool input_panel_enabled : 1; + Eina_Bool input_panel_return_key_disabled : 1; + Eina_Bool input_panel_caps_lock_mode : 1; }; struct _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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -192,6 +191,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -247,6 +248,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -257,6 +260,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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, * @param evas_event The received Evas event. * @param imf_event The location to store the converted Ecore_IMF event. * @ingroup Ecore_IMF_Evas_Group + * + * Example + * @code + * static void + * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) + * { + * Evas_Event_Key_Down *ev = event_info; + * if (!ev->keyname) return; + * + * if (imf_context) + * { + * Ecore_IMF_Event_Key_Down ecore_ev; + * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); + * if (ecore_imf_context_filter_event(imf_context, + * ECORE_IMF_EVENT_KEY_DOWN, + * (Ecore_IMF_Event *)&ecore_ev)) + * return; + * } + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data); + * @endcode */ EAPI void ecore_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, * @param evas_event The received Evas event. * @param imf_event The location to store the converted Ecore_IMF event. * @ingroup Ecore_IMF_Evas_Group + * + * Example + * @code + * static void + * _key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) + * { + * Evas_Event_Key_Up *ev = event_info; + * if (!ev->keyname) return; + * + * if (imf_context) + * { + * Ecore_IMF_Event_Key_Up ecore_ev; + * ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev); + * if (ecore_imf_context_filter_event(imf_context, + * ECORE_IMF_EVENT_KEY_UP, + * (Ecore_IMF_Event *)&ecore_ev)) + * return; + * } + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, _key_up_cb, data); + * @endcode */ EAPI void ecore_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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -192,6 +191,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -247,6 +248,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -257,6 +260,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) if (--_ecore_ipc_init_count != 0) return _ecore_ipc_init_count; - while (servers) ecore_ipc_server_del(eina_list_data_get(servers)); + Eina_List *l, *l2; + Ecore_Ipc_Server *svr; + EINA_LIST_FOREACH_SAFE(servers, l, l2, svr) + ecore_ipc_server_del(svr); for (i = 0; i < 6; i++) 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -194,6 +193,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -249,6 +250,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -259,6 +262,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -193,6 +192,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -248,6 +249,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -258,6 +261,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 @@ #ifndef _ECORE_WAYLAND_H_ # define _ECORE_WAYLAND_H_ +# define GL_GLEXT_PROTOTYPES + # include # include +# include // NB: already includes wayland-client.h +# include +# include # ifdef EAPI # undef EAPI @@ -18,71 +23,233 @@ # define EAPI # endif +typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type; +typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type; + +typedef struct _Ecore_Wl_Display Ecore_Wl_Display; +typedef struct _Ecore_Wl_Output Ecore_Wl_Output; +typedef struct _Ecore_Wl_Input Ecore_Wl_Input; +# ifndef _ECORE_WAYLAND_WINDOW_PREDEF +typedef struct _Ecore_Wl_Window Ecore_Wl_Window; +# endif +typedef struct _Ecore_Wl_Dnd_Source Ecore_Wl_Dnd_Source; +typedef struct _Ecore_Wl_Dnd_Target Ecore_Wl_Dnd_Target; + typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In; typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out; typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In; typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out; +typedef struct _Ecore_Wl_Event_Window_Configure Ecore_Wl_Event_Window_Configure; +typedef struct _Ecore_Wl_Event_Dnd_Enter Ecore_Wl_Event_Dnd_Enter; +typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position; +typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave; +typedef struct _Ecore_Wl_Event_Dnd_Drop Ecore_Wl_Event_Dnd_Drop; +typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound; -typedef struct _Ecore_Wl_Drag_Source Ecore_Wl_Drag_Source; +enum _Ecore_Wl_Window_Type +{ + ECORE_WL_WINDOW_TYPE_TOPLEVEL, + ECORE_WL_WINDOW_TYPE_FULLSCREEN, + ECORE_WL_WINDOW_TYPE_MAXIMIZED, + ECORE_WL_WINDOW_TYPE_TRANSIENT, + ECORE_WL_WINDOW_TYPE_MENU, + ECORE_WL_WINDOW_TYPE_CUSTOM +}; -typedef struct _Ecore_Wl_Event_Drag_Start Ecore_Wl_Event_Drag_Start; -typedef struct _Ecore_Wl_Event_Drag_Stop Ecore_Wl_Event_Drag_Stop; +enum _Ecore_Wl_Window_Buffer_Type +{ + ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW, + ECORE_WL_WINDOW_BUFFER_TYPE_EGL_IMAGE, + ECORE_WL_WINDOW_BUFFER_TYPE_SHM +}; -struct _Ecore_Wl_Event_Mouse_In +struct _Ecore_Wl_Display { - int modifiers; - int x, y; + struct + { + struct wl_display *display; + struct wl_compositor *compositor; + struct wl_shell *shell; + struct wl_shm *shm; + struct wl_data_device_manager *data_device_manager; + } wl; struct { - int x, y; - } root; + EGLDisplay display; + EGLConfig rgb_config; + EGLConfig argb_config; + EGLContext rgb_context; + EGLContext argb_context; + } egl; + + int fd; + unsigned int mask; + Ecore_Fd_Handler *fd_hdl; + + struct wl_list inputs; + struct wl_list outputs; + + struct xkb_desc *xkb; + + Ecore_Wl_Output *output; + + PFNEGLCREATEIMAGEKHRPROC create_image; + PFNEGLDESTROYIMAGEKHRPROC destroy_image; + + void (*output_configure)(Ecore_Wl_Output *output, void *data); + void *data; +}; + +struct _Ecore_Wl_Output +{ + Ecore_Wl_Display *display; + struct wl_output *output; + Eina_Rectangle allocation; + struct wl_list link; + + void (*destroy) (Ecore_Wl_Output *output, void *data); + void *data; +}; + +struct _Ecore_Wl_Input +{ + Ecore_Wl_Display *display; + struct wl_input_device *input_device; + struct wl_data_device *data_device; + + Ecore_Wl_Window *pointer_focus; + Ecore_Wl_Window *keyboard_focus; + + unsigned int button; + unsigned int timestamp; + unsigned int modifiers; + int sx, sy; + + struct wl_list link; + + /* TODO: grab */ + unsigned int grab_button; + + Ecore_Wl_Dnd_Source *drag_source; + Ecore_Wl_Dnd_Source *selection_source; +}; - unsigned int window; +struct _Ecore_Wl_Window +{ + Ecore_Wl_Display *display; + Ecore_Wl_Window *parent; + + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + + int id; + int x, y; + int edges; + + Eina_Rectangle allocation, pending_allocation; + Eina_Rectangle saved_allocation, server_allocation; - unsigned int time; + /* Eina_Bool redraw_scheduled : 1; */ + /* Eina_Bool resize_scheduled : 1; */ + Eina_Bool transparent : 1; + + Ecore_Wl_Window_Type type; + Ecore_Wl_Window_Buffer_Type buffer_type; + + Ecore_Wl_Input *pointer_device; + Ecore_Wl_Input *keyboard_device; + + void *data; }; -struct _Ecore_Wl_Event_Mouse_Out +struct _Ecore_Wl_Event_Mouse_In { int modifiers; int x, y; + struct + { + int x, y; + } root; + unsigned int win; + unsigned int event_win; + unsigned int root_win; + unsigned int timestamp; +}; +struct _Ecore_Wl_Event_Mouse_Out +{ + int modifiers; + int x, y; struct { int x, y; } root; + unsigned int win; + unsigned int event_win; + unsigned int root_win; + unsigned int timestamp; +}; - unsigned int window; +struct _Ecore_Wl_Event_Focus_In +{ + unsigned int win; + unsigned int timestamp; +}; - unsigned int time; +struct _Ecore_Wl_Event_Focus_Out +{ + unsigned int win; + unsigned int timestamp; }; -struct _Ecore_Wl_Event_Focus_In +struct _Ecore_Wl_Event_Window_Configure { - unsigned int window; - /* TODO: mode & detail */ - unsigned int time; + unsigned int win; + unsigned int event_win; + int x, y, w, h; + unsigned int timestamp; }; -struct _Ecore_Wl_Event_Focus_Out +struct _Ecore_Wl_Event_Dnd_Enter { - unsigned int window; - /* TODO: mode & detail */ - unsigned int time; + unsigned int win, source; + char **types; + int num_types; + struct + { + int x, y; + } position; }; -struct _Ecore_Wl_Event_Drag_Start +struct _Ecore_Wl_Event_Dnd_Position { - struct wl_data_device *device; - struct wl_surface *surface; - const char *mime_type; - uint32_t timestamp; + unsigned int win, source; + struct + { + int x, y; + } position; }; -struct _Ecore_Wl_Event_Drag_Stop +struct _Ecore_Wl_Event_Dnd_Leave { + unsigned int win, source; +}; +struct _Ecore_Wl_Event_Dnd_Drop +{ + unsigned int win, source; + struct + { + int x, y; + } position; +}; + +struct _Ecore_Wl_Event_Interfaces_Bound +{ + Eina_Bool compositor : 1; + Eina_Bool shm : 1; + Eina_Bool shell : 1; }; /** @@ -92,32 +259,46 @@ struct _Ecore_Wl_Event_Drag_Stop * Ecore_Wl provides a wrapper and convenience functions for using the * Wayland window system. Function groups for this part of the library * include the following: + * * @li @ref Ecore_Wl_Init_Group + * @li @ref Ecore_Wl_Display_Group + * @li @ref Ecore_Wl_Flush_Group + * @li @ref Ecore_Wl_Window_Group */ +EAPI extern int ECORE_WL_EVENT_MOUSE_IN; +EAPI extern int ECORE_WL_EVENT_MOUSE_OUT; +EAPI extern int ECORE_WL_EVENT_FOCUS_IN; +EAPI extern int ECORE_WL_EVENT_FOCUS_OUT; +EAPI extern int ECORE_WL_EVENT_WINDOW_CONFIGURE; +EAPI extern int ECORE_WL_EVENT_DND_ENTER; +EAPI extern int ECORE_WL_EVENT_DND_POSITION; +EAPI extern int ECORE_WL_EVENT_DND_LEAVE; +EAPI extern int ECORE_WL_EVENT_DND_DROP; +EAPI extern int ECORE_WL_EVENT_INTERFACES_BOUND; + EAPI int ecore_wl_init(const char *name); EAPI int ecore_wl_shutdown(void); - -EAPI struct wl_display *ecore_wl_display_get(void); -EAPI struct wl_shm *ecore_wl_shm_get(void); -EAPI struct wl_compositor *ecore_wl_compositor_get(void); -EAPI struct wl_shell *ecore_wl_shell_get(void); -EAPI struct wl_input_device *ecore_wl_input_device_get(void); -EAPI void ecore_wl_screen_size_get(int *w, int *h); -EAPI unsigned int ecore_wl_format_get(void); EAPI void ecore_wl_flush(void); EAPI void ecore_wl_sync(void); +EAPI struct wl_shm *ecore_wl_shm_get(void); +EAPI struct wl_display *ecore_wl_display_get(void); +EAPI void ecore_wl_screen_size_get(int *w, int *h); EAPI void ecore_wl_pointer_xy_get(int *x, int *y); -EAPI 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); -EAPI void ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer); -EAPI void ecore_wl_drag_stop(void); - -EAPI extern int ECORE_WL_EVENT_MOUSE_IN; -EAPI extern int ECORE_WL_EVENT_MOUSE_OUT; -EAPI extern int ECORE_WL_EVENT_FOCUS_IN; -EAPI extern int ECORE_WL_EVENT_FOCUS_OUT; -EAPI extern int ECORE_WL_EVENT_DRAG_START; -EAPI extern int ECORE_WL_EVENT_DRAG_STOP; +EAPI Ecore_Wl_Window *ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type); +EAPI void ecore_wl_window_free(Ecore_Wl_Window *win); +EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y); +EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location); +EAPI void ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h); +EAPI void ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y); +EAPI void ecore_wl_window_show(Ecore_Wl_Window *win); +EAPI void ecore_wl_window_hide(Ecore_Wl_Window *win); +EAPI void ecore_wl_window_raise(Ecore_Wl_Window *win); +EAPI void ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized); +EAPI void ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen); +EAPI void ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h); +EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win); +EAPI Ecore_Wl_Window *ecore_wl_window_find(unsigned int id); #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 includesdir = $(includedir)/ecore-@VMAJ@ libecore_wayland_la_SOURCES = \ -ecore_wl.c - -## ecore_wl_window.c +ecore_wl.c \ +ecore_wl_output.c \ +ecore_wl_input.c \ +ecore_wl_window.c \ +ecore_wl_dnd.c libecore_wayland_la_LIBADD = \ $(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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -86,7 +85,8 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" LTLIBRARIES = $(lib_LTLIBRARIES) -am_libecore_wayland_la_OBJECTS = ecore_wl.lo +am_libecore_wayland_la_OBJECTS = ecore_wl.lo ecore_wl_output.lo \ + ecore_wl_input.lo ecore_wl_window.lo ecore_wl_dnd.lo libecore_wayland_la_OBJECTS = $(am_libecore_wayland_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -190,6 +190,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -245,6 +247,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -255,6 +259,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ @@ -482,7 +487,11 @@ lib_LTLIBRARIES = libecore_wayland.la includes_HEADERS = Ecore_Wayland.h includesdir = $(includedir)/ecore-@VMAJ@ libecore_wayland_la_SOURCES = \ -ecore_wl.c +ecore_wl.c \ +ecore_wl_output.c \ +ecore_wl_input.c \ +ecore_wl_window.c \ +ecore_wl_dnd.c libecore_wayland_la_LIBADD = \ $(top_builddir)/src/lib/ecore/libecore.la \ @@ -569,6 +578,10 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_dnd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_input.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_output.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl_window.Plo@am__quote@ .c.o: @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 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +# include #endif -#include "Ecore.h" -#include "ecore_private.h" -#include "Ecore_Input.h" -#include "ecore_wl_private.h" -#include "Ecore_Wayland.h" +#include /* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ... * What about other OSs ?? */ -#include #ifdef __linux__ # include #else @@ -23,150 +18,86 @@ # define BTN_BACK 0x116 #endif -#include +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Input.h" +#include "ecore_wl_private.h" +#include "Ecore_Wayland.h" /* local function prototypes */ -static Eina_Bool _ecore_wl_shutdown(Eina_Bool close_display); -static void _ecore_wl_cb_disp_handle_global(struct wl_display *disp, uint32_t id, const char *interface, uint32_t version __UNUSED__, void *data __UNUSED__); -static int _ecore_wl_cb_disp_event_mask_update(uint32_t mask, void *data __UNUSED__); -static 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__); -static 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__); -static Eina_Bool _ecore_wl_cb_fd_handle(void *data, Ecore_Fd_Handler *hdl __UNUSED__); -static 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); -static void _ecore_wl_cb_handle_button(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, uint32_t btn, uint32_t state); -static void _ecore_wl_cb_handle_key(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, uint32_t key, uint32_t state); -static 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); -static 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); -static 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); -static void _ecore_wl_cb_handle_touch_up(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id); -static 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); -static void _ecore_wl_cb_handle_touch_frame(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__); -static void _ecore_wl_cb_handle_touch_cancel(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__); -static void _ecore_wl_cb_source_target(void *data, struct wl_data_source *source __UNUSED__, const char *mime_type __UNUSED__); -static void _ecore_wl_cb_source_send(void *data, struct wl_data_source *source, const char *mime_type, int32_t fd); -static void _ecore_wl_cb_source_cancelled(void *data, struct wl_data_source *source __UNUSED__); -static void _ecore_wl_cb_source_offer(void *data, struct wl_data_offer *offer __UNUSED__, const char *type); -static void _ecore_wl_cb_data_offer(void *data, struct wl_data_device *data_dev, uint32_t id); -static 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); -static void _ecore_wl_cb_data_leave(void *data __UNUSED__, struct wl_data_device *data_dev); -static void _ecore_wl_cb_data_motion(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, int32_t x, int32_t y); -static void _ecore_wl_cb_data_drop(void *data __UNUSED__, struct wl_data_device *data_dev); -static void _ecore_wl_cb_data_selection(void *data, struct wl_data_device *data_dev, struct wl_data_offer *offer); - -static void _ecore_wl_mouse_move_send(uint32_t timestamp); -static void _ecore_wl_mouse_out_send(struct wl_surface *surface, uint32_t timestamp); -static void _ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp); -static void _ecore_wl_mouse_up_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp); -static void _ecore_wl_mouse_down_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp); -static void _ecore_wl_focus_out_send(struct wl_surface *surface, uint32_t timestamp); -static void _ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp); +static Eina_Bool _ecore_wl_shutdown(Eina_Bool close); +static int _ecore_wl_cb_event_mask_update(unsigned int mask, void *data); +static Eina_Bool _ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__); +static void _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data); +static Eina_Bool _ecore_wl_egl_init(Ecore_Wl_Display *ewd); +static Eina_Bool _ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd); +static Eina_Bool _ecore_wl_xkb_init(Ecore_Wl_Display *ewd); +static Eina_Bool _ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd); /* local variables */ static int _ecore_wl_init_count = 0; -static struct wl_display *_ecore_wl_disp = NULL; -static uint32_t _ecore_wl_disp_mask = 0; -static uint32_t _ecore_wl_disp_format = WL_SHM_FORMAT_ARGB8888; -static Eina_Rectangle _ecore_wl_screen; -static Ecore_Fd_Handler *_ecore_wl_fd_hdl = NULL; -static int _ecore_wl_screen_x = 0; -static int _ecore_wl_screen_y = 0; -static int _ecore_wl_surface_x = 0; -static int _ecore_wl_surface_y = 0; -static int _ecore_wl_touch_x = 0; -static int _ecore_wl_touch_y = 0; -static int _ecore_wl_input_modifiers = 0; -static struct xkb_desc *_ecore_wl_xkb; -static uint32_t _ecore_wl_input_button = 0; - -static struct wl_compositor *_ecore_wl_comp; -static struct wl_shm *_ecore_wl_shm; -static struct wl_shell *_ecore_wl_shell; -static struct wl_output *_ecore_wl_output; -static struct wl_input_device *_ecore_wl_input_dev; -static struct wl_surface *_ecore_wl_input_surface; -static struct wl_surface *_ecore_wl_touch_surface; -static struct wl_data_device_manager *_ecore_wl_data_manager; -static struct wl_data_device *_ecore_wl_data_dev; - -static const struct wl_output_listener _ecore_wl_output_listener = -{ - _ecore_wl_cb_disp_handle_geometry, - _ecore_wl_cb_disp_handle_mode -}; -static const struct wl_input_device_listener _ecore_wl_input_listener = -{ - _ecore_wl_cb_handle_motion, - _ecore_wl_cb_handle_button, - _ecore_wl_cb_handle_key, - _ecore_wl_cb_handle_pointer_focus, - _ecore_wl_cb_handle_keyboard_focus, - _ecore_wl_cb_handle_touch_down, - _ecore_wl_cb_handle_touch_up, - _ecore_wl_cb_handle_touch_motion, - _ecore_wl_cb_handle_touch_frame, - _ecore_wl_cb_handle_touch_cancel, -}; -static const struct wl_data_source_listener _ecore_wl_source_listener = -{ - _ecore_wl_cb_source_target, - _ecore_wl_cb_source_send, - _ecore_wl_cb_source_cancelled -}; -static const struct wl_data_device_listener _ecore_wl_data_listener = -{ - _ecore_wl_cb_data_offer, - _ecore_wl_cb_data_enter, - _ecore_wl_cb_data_leave, - _ecore_wl_cb_data_motion, - _ecore_wl_cb_data_drop, - _ecore_wl_cb_data_selection -}; -static const struct wl_data_offer_listener _ecore_wl_offer_listener = -{ - _ecore_wl_cb_source_offer, -}; /* external variables */ int _ecore_wl_log_dom = -1; +Ecore_Wl_Display *_ecore_wl_disp = NULL; + EAPI int ECORE_WL_EVENT_MOUSE_IN = 0; EAPI int ECORE_WL_EVENT_MOUSE_OUT = 0; EAPI int ECORE_WL_EVENT_FOCUS_IN = 0; EAPI int ECORE_WL_EVENT_FOCUS_OUT = 0; -EAPI int ECORE_WL_EVENT_DRAG_START = 0; -EAPI int ECORE_WL_EVENT_DRAG_STOP = 0; - +EAPI int ECORE_WL_EVENT_WINDOW_CONFIGURE = 0; +EAPI int ECORE_WL_EVENT_DND_ENTER = 0; +EAPI int ECORE_WL_EVENT_DND_POSITION = 0; +EAPI int ECORE_WL_EVENT_DND_LEAVE = 0; +EAPI int ECORE_WL_EVENT_DND_DROP = 0; +EAPI int ECORE_WL_EVENT_INTERFACES_BOUND = 0; + +/** + * @defgroup Ecore_Wl_Init_Group Wayland Library Init and Shutdown Functions + * + * Functions that start and shutdown the Ecore Wayland Library. + */ + +/** + * Initialize the Wayland display connection to the given display. + * + * @param name Display target name. if @c NULL, the default display is + * assumed. + * @return The number of times the library has been initialized without being + * shut down. 0 is returned if an error occurs. + * + * @ingroup Ecore_Wl_Init_Group + */ EAPI int -ecore_wl_init(const char *name) +ecore_wl_init(const char *name) { - struct xkb_rule_names xkb_names; - int fd = 0; - - if (++_ecore_wl_init_count != 1) - return _ecore_wl_init_count; - LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (++_ecore_wl_init_count != 1) return _ecore_wl_init_count; + if (!eina_init()) return --_ecore_wl_init_count; _ecore_wl_log_dom = eina_log_domain_register("ecore_wl", ECORE_WL_DEFAULT_LOG_COLOR); - if (_ecore_wl_log_dom < 0) + if (_ecore_wl_log_dom < 0) { - EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland."); + EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland"); eina_shutdown(); return --_ecore_wl_init_count; } - if (!ecore_init()) + if (!ecore_init()) { + ERR("Could not initialize ecore"); eina_log_domain_unregister(_ecore_wl_log_dom); _ecore_wl_log_dom = -1; eina_shutdown(); return --_ecore_wl_init_count; } - if (!ecore_event_init()) + if (!ecore_event_init()) { + ERR("Could not initialize ecore_event"); eina_log_domain_unregister(_ecore_wl_log_dom); _ecore_wl_log_dom = -1; ecore_shutdown(); @@ -174,26 +105,23 @@ ecore_wl_init(const char *name) return --_ecore_wl_init_count; } - if (!ECORE_WL_EVENT_MOUSE_IN) + if (!ECORE_WL_EVENT_MOUSE_IN) { ECORE_WL_EVENT_MOUSE_IN = ecore_event_type_new(); ECORE_WL_EVENT_MOUSE_OUT = ecore_event_type_new(); ECORE_WL_EVENT_FOCUS_IN = ecore_event_type_new(); ECORE_WL_EVENT_FOCUS_OUT = ecore_event_type_new(); - ECORE_WL_EVENT_DRAG_START = ecore_event_type_new(); - ECORE_WL_EVENT_DRAG_STOP = ecore_event_type_new(); + ECORE_WL_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); + ECORE_WL_EVENT_DND_ENTER = ecore_event_type_new(); + ECORE_WL_EVENT_DND_POSITION = ecore_event_type_new(); + ECORE_WL_EVENT_DND_LEAVE = ecore_event_type_new(); + ECORE_WL_EVENT_DND_DROP = ecore_event_type_new(); + ECORE_WL_EVENT_INTERFACES_BOUND = ecore_event_type_new(); } - /* init xkb */ - /* FIXME: Somehow make this portable to other languages/countries */ - xkb_names.rules = "evdev"; - xkb_names.model = "evdev"; - xkb_names.layout = "us"; - xkb_names.variant = ""; - xkb_names.options = ""; - if (!(_ecore_wl_xkb = xkb_compile_keymap_from_rules(&xkb_names))) + if (!(_ecore_wl_disp = malloc(sizeof(Ecore_Wl_Display)))) { - ERR("Could not compile keymap"); + ERR("Could not allocate memory for Ecore_Wl_Display structure"); eina_log_domain_unregister(_ecore_wl_log_dom); _ecore_wl_log_dom = -1; ecore_event_shutdown(); @@ -202,9 +130,11 @@ ecore_wl_init(const char *name) return --_ecore_wl_init_count; } - /* connect to the wayland display */ - if (!(_ecore_wl_disp = wl_display_connect(name))) + memset(_ecore_wl_disp, 0, sizeof(Ecore_Wl_Display)); + + if (!(_ecore_wl_disp->wl.display = wl_display_connect(name))) { + ERR("Could not connect to Wayland display"); eina_log_domain_unregister(_ecore_wl_log_dom); _ecore_wl_log_dom = -1; ecore_event_shutdown(); @@ -213,23 +143,48 @@ ecore_wl_init(const char *name) return --_ecore_wl_init_count; } - /* setup handler for wayland interfaces */ - wl_display_add_global_listener(_ecore_wl_disp, - _ecore_wl_cb_disp_handle_global, NULL); + _ecore_wl_disp->fd = + wl_display_get_fd(_ecore_wl_disp->wl.display, + _ecore_wl_cb_event_mask_update, _ecore_wl_disp); + + _ecore_wl_disp->fd_hdl = + ecore_main_fd_handler_add(_ecore_wl_disp->fd, ECORE_FD_READ, + _ecore_wl_cb_handle_data, _ecore_wl_disp, + NULL, NULL); + + wl_list_init(&_ecore_wl_disp->inputs); + wl_list_init(&_ecore_wl_disp->outputs); + + wl_display_add_global_listener(_ecore_wl_disp->wl.display, + _ecore_wl_cb_handle_global, _ecore_wl_disp); + + /* FIXME: Process connection events ?? */ + wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE); + + /* if (!_ecore_wl_egl_init(_ecore_wl_disp)) */ + /* { */ + /* ERR("Could not initialize EGL"); */ + /* free(_ecore_wl_disp); */ + /* eina_log_domain_unregister(_ecore_wl_log_dom); */ + /* _ecore_wl_log_dom = -1; */ + /* ecore_event_shutdown(); */ + /* ecore_shutdown(); */ + /* eina_shutdown(); */ + /* return --_ecore_wl_init_count; */ + /* } */ - /* process connection events */ - wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); + /* _ecore_wl_disp->create_image = */ + /* (void *)eglGetProcAddress("eglCreateImageKHR"); */ + /* _ecore_wl_disp->destroy_image = */ + /* (void *)eglGetProcAddress("eglDestroyImageKHR"); */ - fd = wl_display_get_fd(_ecore_wl_disp, - _ecore_wl_cb_disp_event_mask_update, NULL); + /* TODO: create pointer surfaces */ - _ecore_wl_fd_hdl = - ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_wl_cb_fd_handle, - _ecore_wl_disp, NULL, NULL); - if (!_ecore_wl_fd_hdl) + if (!_ecore_wl_xkb_init(_ecore_wl_disp)) { - wl_display_destroy(_ecore_wl_disp); - _ecore_wl_disp = NULL; + ERR("Could not initialize XKB"); + _ecore_wl_egl_shutdown(_ecore_wl_disp); + free(_ecore_wl_disp); eina_log_domain_unregister(_ecore_wl_log_dom); _ecore_wl_log_dom = -1; ecore_event_shutdown(); @@ -238,976 +193,359 @@ ecore_wl_init(const char *name) return --_ecore_wl_init_count; } + _ecore_wl_window_init(); + return _ecore_wl_init_count; } +/** + * Shuts down the Ecore Wayland Library + * + * In shutting down the library, the Wayland display connection is terminated + * and any event handlers for it are removed. + * + * @return The number of times the library has been initialized without + * being shut down. + * + * @ingroup Ecore_Wl_Init_Group + */ EAPI int -ecore_wl_shutdown(void) +ecore_wl_shutdown(void) { - return _ecore_wl_shutdown(EINA_TRUE); -} - -EAPI struct wl_display * -ecore_wl_display_get(void) -{ - return _ecore_wl_disp; -} - -EAPI struct wl_shm * -ecore_wl_shm_get(void) -{ - return _ecore_wl_shm; -} - -EAPI struct wl_compositor * -ecore_wl_compositor_get(void) -{ - return _ecore_wl_comp; -} + LOGFN(__FILE__, __LINE__, __FUNCTION__); -EAPI struct wl_shell * -ecore_wl_shell_get(void) -{ - return _ecore_wl_shell; + return _ecore_wl_shutdown(EINA_TRUE); } -EAPI struct wl_input_device * -ecore_wl_input_device_get(void) -{ - return _ecore_wl_input_dev; -} +/** + * @defgroup Ecore_Wl_Flush_Group Wayland Synchronization Functions + * + * Functions that ensure that all commands which have been issued by the + * Ecore Wayland library have been sent to the server. + */ +/** + * Sends all Wayland commands to the Wayland Display. + * + * @ingroup Ecore_Wl_Flush_Group + * @since 1.2 + */ EAPI void -ecore_wl_screen_size_get(int *w, int *h) +ecore_wl_flush(void) { - if (w) *w = _ecore_wl_screen.w; - if (h) *h = _ecore_wl_screen.h; -} - -EAPI unsigned int -ecore_wl_format_get(void) -{ - return _ecore_wl_disp_format; -} + LOGFN(__FILE__, __LINE__, __FUNCTION__); -EAPI void -ecore_wl_flush(void) -{ - wl_display_flush(_ecore_wl_disp); + while (_ecore_wl_disp->mask & WL_DISPLAY_WRITABLE) + wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_WRITABLE); +// wl_display_flush(_ecore_wl_disp->wl.display); // old flush code } +/** + * Flushes the command buffer and waits until all requests have been + * processed by the server. + * + * @ingroup Ecore_Wl_Flush_Group + * @since 1.2 + */ EAPI void -ecore_wl_sync(void) +ecore_wl_sync(void) { - wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); -} + LOGFN(__FILE__, __LINE__, __FUNCTION__); -EAPI void -ecore_wl_pointer_xy_get(int *x, int *y) + wl_display_roundtrip(_ecore_wl_disp->wl.display); + // old sync code +// wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE); +} + +/** + * @defgroup Ecore_Wl_Display_Group Wayland Display Functions + * + * Functions that set and retrieve various information about the Wayland Display. + */ + +/** + * Retrieves the Wayland Shm Interface used for the current Wayland connection. + * + * @return The current wayland shm interface + * + * @ingroup Ecore_Wl_Display_Group + * @since 1.2 + */ +EAPI struct wl_shm * +ecore_wl_shm_get(void) { - if (x) *x = _ecore_wl_screen_x; - if (y) *y = _ecore_wl_screen_y; + return _ecore_wl_disp->wl.shm; } -EAPI 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) +/** + * Retrieves the Wayland Display Interface used for the current Wayland connection. + * + * @return The current wayland display interface + * + * @ingroup Ecore_Wl_Display_Group + * @since 1.2 + */ +EAPI struct wl_display * +ecore_wl_display_get(void) { - Ecore_Wl_Drag_Source *source; - - if (!(source = calloc(1, sizeof(Ecore_Wl_Drag_Source)))) return NULL; - - source->data_dev = _ecore_wl_data_dev; - source->hotspot_x = hotspot_x; - source->hotspot_y = hotspot_y; - source->offset_x = offset_x; - source->offset_y = offset_y; - source->mimetype = mimetype; - source->timestamp = timestamp; - source->data = data; - - source->data_source = - wl_data_device_manager_create_data_source(_ecore_wl_data_manager); - - wl_data_source_add_listener(source->data_source, - &_ecore_wl_source_listener, source); - - wl_data_source_offer(source->data_source, source->mimetype); - - /* NB: Do we add some default mimetypes here ?? */ - /* text/plain, etc */ - - return source; + return _ecore_wl_disp->wl.display; } +/** + * Retrieves the size of the current screen. + * + * @param w where to return the width. May be NULL. Returns 0 on error. + * @param h where to return the height. May be NULL. Returns 0 on error. + * + * @ingroup Ecore_Wl_Display_Group + * @since 1.2 + */ EAPI void -ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer) +ecore_wl_screen_size_get(int *w, int *h) { - source->buffer = buffer; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - wl_data_device_start_drag(source->data_dev, source->data_source, - surface, source->timestamp); + if (w) *w = _ecore_wl_disp->output->allocation.w; + if (h) *h = _ecore_wl_disp->output->allocation.h; } +/* @since 1.2 */ EAPI void -ecore_wl_drag_stop(void) +ecore_wl_pointer_xy_get(int *x, int *y) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_wl_input_pointer_xy_get(x, y); } /* local functions */ static Eina_Bool -_ecore_wl_shutdown(Eina_Bool close_display) +_ecore_wl_shutdown(Eina_Bool close) { LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (--_ecore_wl_init_count != 0) - return _ecore_wl_init_count; - + if (--_ecore_wl_init_count != 0) return _ecore_wl_init_count; if (!_ecore_wl_disp) return _ecore_wl_init_count; - if (_ecore_wl_xkb) free(_ecore_wl_xkb); + _ecore_wl_window_shutdown(); - if (_ecore_wl_fd_hdl) ecore_main_fd_handler_del(_ecore_wl_fd_hdl); - _ecore_wl_fd_hdl = NULL; + if (_ecore_wl_disp->fd_hdl) + ecore_main_fd_handler_del(_ecore_wl_disp->fd_hdl); - if (close_display) + if (close) { - if (_ecore_wl_data_dev) wl_data_device_destroy(_ecore_wl_data_dev); - if (_ecore_wl_input_dev) wl_input_device_destroy(_ecore_wl_input_dev); - if (_ecore_wl_data_manager) - wl_data_device_manager_destroy(_ecore_wl_data_manager); - if (_ecore_wl_shell) wl_shell_destroy(_ecore_wl_shell); - if (_ecore_wl_shm) wl_shm_destroy(_ecore_wl_shm); - if (_ecore_wl_comp) wl_compositor_destroy(_ecore_wl_comp); - if (_ecore_wl_disp) + Ecore_Wl_Output *out, *tout; + Ecore_Wl_Input *in, *tin; + + wl_list_for_each_safe(out, tout, &_ecore_wl_disp->outputs, link) + _ecore_wl_output_del(out); + + wl_list_for_each_safe(in, tin, &_ecore_wl_disp->inputs, link) + _ecore_wl_input_del(in); + + _ecore_wl_xkb_shutdown(_ecore_wl_disp); + /* _ecore_wl_egl_shutdown(_ecore_wl_disp); */ + + if (_ecore_wl_disp->wl.shell) + wl_shell_destroy(_ecore_wl_disp->wl.shell); + if (_ecore_wl_disp->wl.shm) wl_shm_destroy(_ecore_wl_disp->wl.shm); + if (_ecore_wl_disp->wl.data_device_manager) + wl_data_device_manager_destroy(_ecore_wl_disp->wl.data_device_manager); + if (_ecore_wl_disp->wl.compositor) + wl_compositor_destroy(_ecore_wl_disp->wl.compositor); + if (_ecore_wl_disp->wl.display) { - wl_display_flush(_ecore_wl_disp); - wl_display_destroy(_ecore_wl_disp); + wl_display_flush(_ecore_wl_disp->wl.display); + wl_display_disconnect(_ecore_wl_disp->wl.display); } - _ecore_wl_disp = NULL; + free(_ecore_wl_disp); } - eina_log_domain_unregister(_ecore_wl_log_dom); - _ecore_wl_log_dom = -1; - ecore_event_shutdown(); ecore_shutdown(); + + eina_log_domain_unregister(_ecore_wl_log_dom); + _ecore_wl_log_dom = -1; eina_shutdown(); return _ecore_wl_init_count; } -static void -_ecore_wl_cb_disp_handle_global(struct wl_display *disp, uint32_t id, const char *interface, uint32_t version __UNUSED__, void *data __UNUSED__) -{ -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (disp != _ecore_wl_disp) return; - if (!strcmp(interface, "wl_compositor")) - { - _ecore_wl_comp = - wl_display_bind(_ecore_wl_disp, id, &wl_compositor_interface); - } - else if (!strcmp(interface, "wl_shm")) - { - _ecore_wl_shm = - wl_display_bind(_ecore_wl_disp, id, &wl_shm_interface); - } - else if (!strcmp(interface, "wl_output")) - { - _ecore_wl_output = - wl_display_bind(_ecore_wl_disp, id, &wl_output_interface); - wl_output_add_listener(_ecore_wl_output, - &_ecore_wl_output_listener, NULL); - } - else if (!strcmp(interface, "wl_shell")) - { - _ecore_wl_shell = - wl_display_bind(_ecore_wl_disp, id, &wl_shell_interface); - } - else if (!strcmp(interface, "wl_input_device")) - { - _ecore_wl_input_dev = - wl_display_bind(_ecore_wl_disp, id, &wl_input_device_interface); - wl_input_device_add_listener(_ecore_wl_input_dev, - &_ecore_wl_input_listener, NULL); - } - else if (!strcmp(interface, "wl_data_device_manager")) - { - _ecore_wl_data_manager = - wl_display_bind(_ecore_wl_disp, id, - &wl_data_device_manager_interface); - } - - if ((_ecore_wl_input_dev) && (_ecore_wl_data_manager) && (!_ecore_wl_data_dev)) - { - _ecore_wl_data_dev = - wl_data_device_manager_get_data_device(_ecore_wl_data_manager, - _ecore_wl_input_dev); - wl_data_device_add_listener(_ecore_wl_data_dev, - &_ecore_wl_data_listener, NULL); - } -} - static int -_ecore_wl_cb_disp_event_mask_update(uint32_t mask, void *data __UNUSED__) +_ecore_wl_cb_event_mask_update(unsigned int mask, void *data) { -// LOGFN(__FILE__, __LINE__, __FUNCTION__); + Ecore_Wl_Display *ewd; - _ecore_wl_disp_mask = mask; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ewd = data; + ewd->mask = mask; return 0; } -static 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__) -{ - _ecore_wl_screen.x = x; - _ecore_wl_screen.y = y; -} - -static 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__) -{ - if (flags & WL_OUTPUT_MODE_CURRENT) - { - _ecore_wl_screen.w = w; - _ecore_wl_screen.h = h; - } -} - static Eina_Bool -_ecore_wl_cb_fd_handle(void *data, Ecore_Fd_Handler *hdl __UNUSED__) +_ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__) { - struct wl_display *disp; - -// LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(disp = data)) return ECORE_CALLBACK_RENEW; - if (disp != _ecore_wl_disp) return ECORE_CALLBACK_RENEW; + Ecore_Wl_Display *ewd; - if (_ecore_wl_disp_mask & WL_DISPLAY_WRITABLE) - wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_WRITABLE); - - if (_ecore_wl_disp_mask & WL_DISPLAY_READABLE) - wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(ewd = data)) return ECORE_CALLBACK_RENEW; + wl_display_iterate(ewd->wl.display, ewd->mask); return ECORE_CALLBACK_RENEW; } static 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) -{ - if (dev != _ecore_wl_input_dev) return; - - _ecore_wl_screen_x = x; - _ecore_wl_screen_y = y; - _ecore_wl_surface_x = sx; - _ecore_wl_surface_y = sy; - - _ecore_wl_mouse_move_send(t); -} - -static void -_ecore_wl_cb_handle_button(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t, uint32_t btn, uint32_t state) -{ - if (dev != _ecore_wl_input_dev) return; - - if ((btn >= BTN_SIDE) && (btn <= BTN_BACK)) - { - Ecore_Event_Mouse_Wheel *ev; - - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return; - - ev->timestamp = t; - ev->x = _ecore_wl_surface_x; - ev->y = _ecore_wl_surface_y; - ev->root.x = _ecore_wl_screen_x; - ev->root.y = _ecore_wl_screen_y; - ev->modifiers = _ecore_wl_input_modifiers; - ev->direction = 0; - - if (_ecore_wl_input_surface) - { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface))) - { - ev->window = id; - ev->event_window = id; - } - } - - /* NB: (FIXME) Currently Wayland provides no measure of how much the - * wheel has scrolled (read: delta of movement). So for now, we will - * just assume that the amount scrolled is 1 */ - if ((btn == BTN_EXTRA) || (btn == BTN_FORWARD)) // down - ev->z = 1; - else if ((btn == BTN_SIDE) || (btn == BTN_BACK)) // up - ev->z = -1; - - ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); - } - else - { - if (state) - { - _ecore_wl_input_button = btn; - _ecore_wl_mouse_down_send(_ecore_wl_input_surface, btn, t); - /* NB: Ideally, this is not the place to check for drags. - * IMO, drags should be handled by the client. EG: we raise the - * mouse_down to the client, and the client can 'request' a - * drag_start from ecore_wl */ - if ((_ecore_wl_input_surface) || (_ecore_wl_touch_surface)) - { - /* record item which was grabbed. - * create drag source. start drag */ - } - } - else - { - if ((_ecore_wl_input_surface) || (_ecore_wl_touch_surface)) - { - /* release grabbed button and finish drag */ - if ((_ecore_wl_input_button) && - (_ecore_wl_input_button == btn)) - { - - } - } - _ecore_wl_input_button = 0; - _ecore_wl_mouse_up_send(_ecore_wl_input_surface, btn, t); - } - } -} - -static void -_ecore_wl_cb_handle_key(void *data __UNUSED__, struct wl_input_device *dev, uint32_t t __UNUSED__, uint32_t key, uint32_t state) +_ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data) { - unsigned int keycode = 0; + Ecore_Wl_Display *ewd; - if (dev != _ecore_wl_input_dev) return; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - keycode = key + _ecore_wl_xkb->min_key_code; + if ((!strcmp(interface, "wl_display")) || + (!strcmp(interface, "wl_drm")) || + (!strcmp(interface, "desktop_shell"))) + return; - if (state) - _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[keycode]; - else - _ecore_wl_input_modifiers &= ~_ecore_wl_xkb->map->modmap[keycode]; -} + ewd = data; -static 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) -{ - if (dev != _ecore_wl_input_dev) return; - - /* NB: Wayland pointer focus is weird. It's not pointer focus in the normal - * sense...Wayland 'moving/resizing' (and maybe other stuff) has a habit - * of stealing the pointer focus and thus this cannot be used to control - * normal pointer focus. On mouse down, the 'active' surface is stolen - * by Wayland for the grab, so 'surface' here ends up being NULL. When a - * move or resize is finished, we get this event again, but this time - * with an active surface */ - _ecore_wl_screen_x = x; - _ecore_wl_screen_y = y; - _ecore_wl_surface_x = sx; - _ecore_wl_surface_y = sy; - - if ((_ecore_wl_input_surface) && (_ecore_wl_input_surface != surface)) + if (!strcmp(interface, "wl_compositor")) + ewd->wl.compositor = wl_display_bind(disp, id, &wl_compositor_interface); + else if (!strcmp(interface, "wl_output")) + _ecore_wl_output_add(ewd, id); + else if (!strcmp(interface, "wl_input_device")) + _ecore_wl_input_add(ewd, id); + else if (!strcmp(interface, "wl_shell")) + ewd->wl.shell = wl_display_bind(disp, id, &wl_shell_interface); + else if (!strcmp(interface, "wl_shm")) + ewd->wl.shm = wl_display_bind(disp, id, &wl_shm_interface); + else if (!strcmp(interface, "wl_data_device_manager")) { - if (!_ecore_wl_input_button) - _ecore_wl_mouse_out_send(_ecore_wl_input_surface, t); + ewd->wl.data_device_manager = + wl_display_bind(disp, id, &wl_data_device_manager_interface); } - if (surface) + if ((ewd->wl.compositor) && (ewd->wl.shm) && (ewd->wl.shell)) { - if (_ecore_wl_input_button) - { - _ecore_wl_mouse_up_send(surface, _ecore_wl_input_button, t); - _ecore_wl_input_button = 0; - } - else - _ecore_wl_mouse_in_send(surface, t); - } -} - -static void -_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) -{ - unsigned int *keyend = 0, *i = 0; - - if (dev != _ecore_wl_input_dev) return; - - /* NB: Remove old keyboard focus */ - if ((_ecore_wl_input_surface) && (_ecore_wl_input_surface != surface)) - _ecore_wl_focus_out_send(_ecore_wl_input_surface, t); + Ecore_Wl_Event_Interfaces_Bound *ev; - _ecore_wl_input_surface = NULL; + if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Interfaces_Bound)))) + return; - keyend = keys->data + keys->size; - _ecore_wl_input_modifiers = 0; - for (i = keys->data; i < keyend; i++) - _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[*i]; + ev->compositor = (ewd->wl.compositor != NULL); + ev->shm = (ewd->wl.shm != NULL); + ev->shell = (ewd->wl.shell != NULL); - if (surface) - { - /* set new input surface */ - _ecore_wl_input_surface = surface; - - /* send mouse in to new surface */ - /* _ecore_wl_mouse_in_send(surface, t); */ - - /* send focus to new surface */ - _ecore_wl_focus_in_send(surface, t); + ecore_event_add(ECORE_WL_EVENT_INTERFACES_BOUND, ev, NULL, NULL); } } -static 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) +static Eina_Bool +_ecore_wl_egl_init(Ecore_Wl_Display *ewd) { - Ecore_Event_Mouse_Button *ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - _ecore_wl_touch_surface = surface; - _ecore_wl_touch_x = x; - _ecore_wl_touch_y = y; - - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; - - ev->timestamp = timestamp; - - /* NB: Need to verify using x,y for these */ - ev->x = x; - ev->y = y; - ev->root.x = x; - ev->root.y = y; - ev->modifiers = 0; - ev->buttons = 0; - ev->same_screen = 1; - - /* FIXME: Need to get these from Wayland somehow */ - ev->double_click = 0; - ev->triple_click = 0; - - ev->multi.device = id; - ev->multi.radius = 1; - ev->multi.radius_x = 1; - ev->multi.radius_y = 1; - ev->multi.pressure = 1.0; - ev->multi.angle = 0.0; - /* NB: Need to verify using x,y for these */ - ev->multi.x = x; - ev->multi.y = y; - ev->multi.root.x = x; - ev->multi.root.y = y; - + EGLint major, minor, n; + static const EGLint context_attribs[] = { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - { - ev->window = id; - ev->event_window = id; - } - } - - ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); -} - -static void -_ecore_wl_cb_handle_touch_up(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__, uint32_t timestamp, int32_t id) -{ - Ecore_Event_Mouse_Button *ev; + EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE + }; + static const EGLint argb_attribs[] = + { + EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 1, EGL_DEPTH_SIZE, 0, EGL_STENCIL_SIZE, 0, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE, + EGL_WINDOW_BIT, EGL_NONE + }; LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; - - ev->timestamp = timestamp; - - /* TODO: Need to verify using x,y for these */ - ev->x = _ecore_wl_touch_x; - ev->y = _ecore_wl_touch_y; - ev->root.x = _ecore_wl_touch_x; - ev->root.y = _ecore_wl_touch_y; - ev->modifiers = 0; - ev->buttons = 0; - ev->same_screen = 1; - - /* FIXME: Need to get these from Wayland somehow */ - ev->double_click = 0; - ev->triple_click = 0; - - ev->multi.device = id; - ev->multi.radius = 1; - ev->multi.radius_x = 1; - ev->multi.radius_y = 1; - ev->multi.pressure = 1.0; - ev->multi.angle = 0.0; - - /* TODO: Need to verify using x,y for these */ - ev->multi.x = _ecore_wl_touch_x; - ev->multi.y = _ecore_wl_touch_y; - ev->multi.root.x = _ecore_wl_touch_x; - ev->multi.root.y = _ecore_wl_touch_y; - + ewd->egl.display = eglGetDisplay(ewd->wl.display); + if (!eglInitialize(ewd->egl.display, &major, &minor)) { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface))) - { - ev->window = id; - ev->event_window = id; - } + ERR("Failed to initialize EGL display"); + return EINA_FALSE; } - _ecore_wl_touch_surface = NULL; - - ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); -} - -static 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) -{ - Ecore_Event_Mouse_Move *ev; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!_ecore_wl_touch_surface) return; - - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return; - - ev->timestamp = timestamp; - /* TODO: Need to verify using x,y for these */ - ev->x = x; - ev->y = y; - ev->root.x = x; - ev->root.y = y; - ev->modifiers = 0; //_ecore_wl_input_modifiers; - ev->same_screen = 1; - - ev->multi.device = id; - ev->multi.radius = 1; - ev->multi.radius_x = 1; - ev->multi.radius_y = 1; - ev->multi.pressure = 1.0; - ev->multi.angle = 0.0; - - /* TODO: Need to verify using x,y for these */ - ev->multi.x = x; - ev->multi.y = y; - ev->multi.root.x = x; - ev->multi.root.y = y; - + if (!eglBindAPI(EGL_OPENGL_ES_API)) { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface))) - { - ev->window = id; - ev->event_window = id; - } + ERR("Failed to bind EGL Api"); + return EINA_FALSE; } - ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); -} - -static void -_ecore_wl_cb_handle_touch_frame(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - /* FIXME: Need to get a device and actually test what happens here */ -} - -static void -_ecore_wl_cb_handle_touch_cancel(void *data __UNUSED__, struct wl_input_device *dev __UNUSED__) -{ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - /* FIXME: Need to get a device and actually test what happens here */ - _ecore_wl_touch_surface = NULL; -} - -static void -_ecore_wl_cb_source_target(void *data, struct wl_data_source *source __UNUSED__, const char *mime_type __UNUSED__) -{ - Ecore_Wl_Drag_Source *s; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - printf("Ecore_Wl Source Target\n"); - if (!(s = data)) return; - printf("\tHave Drag Source\n"); - - /* FIXME: buffer here should really be the mouse cursor buffer */ - wl_data_device_attach(s->data_dev, s->timestamp, s->buffer, - s->hotspot_x, s->hotspot_y); -} - -static void -_ecore_wl_cb_source_send(void *data, struct wl_data_source *source, const char *mime_type, int32_t fd) -{ - Ecore_Wl_Drag_Source *s; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - printf("Ecore_Wl Source Send\n"); - if (!(s = data)) return; - printf("\tHave Drag Source\n"); - - /* FIXME: write message to fd */ - - /* NB: Wayland really sucks in this regard. Why should selection stuff - * require an 'fd' ?? */ -} - -static void -_ecore_wl_cb_source_cancelled(void *data, struct wl_data_source *source __UNUSED__) -{ - Ecore_Wl_Drag_Source *s; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - - /* The cancelled event usually means source is no longer in use by - * the drag (or selection). */ - - printf("Ecore_Wl Source Cancel\n"); - if (!(s = data)) return; - printf("\tHave Drag Source\n"); - - /* FIXME: raise this to ecore_evas so the surface/buffer - * of the drag can be destroyed */ - - if (s->data_source) wl_data_source_destroy(s->data_source); - s->data_source = NULL; - - free(s); -} - -static void -_ecore_wl_cb_source_offer(void *data, struct wl_data_offer *offer __UNUSED__, const char *type) -{ - Ecore_Wl_Dnd_Source *s; - - if (!(s = data)) return; - eina_array_push(s->types, strdup(type)); -} - -static void -_ecore_wl_cb_data_offer(void *data, struct wl_data_device *data_dev, uint32_t id) -{ - Ecore_Wl_Dnd_Source *source; - - /* create a new 'data offer' structure and setup a listener for it */ - if (!(source = calloc(1, sizeof(Ecore_Wl_Dnd_Source)))) return; - - source->types = eina_array_new(1); - source->data = data; - source->refs = 1; - - /* FIXME: This will need to change when Wayland has typesafe wrappers for this */ - source->offer = (struct wl_data_offer *) - wl_proxy_create_for_id((struct wl_proxy *)data_dev, - id, &wl_data_offer_interface); - - wl_data_device_set_user_data(data_dev, source); - wl_data_offer_add_listener(source->offer, &_ecore_wl_offer_listener, source); -} - -static 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) -{ - Ecore_Wl_Dnd_Source *source; - - if (!(source = wl_data_device_get_user_data(data_dev))) return; - - /* TODO: maybe set pointer focus here ?? */ - - source->timestamp = timestamp; -} - -static void -_ecore_wl_cb_data_leave(void *data __UNUSED__, struct wl_data_device *data_dev) -{ - Ecore_Wl_Dnd_Source *source; - - if (!(source = wl_data_device_get_user_data(data_dev))) return; - - /* destroy drag offer */ - wl_data_offer_destroy(source->offer); - - while (eina_array_count(source->types)) - free(eina_array_pop(source->types)); - - eina_array_free(source->types); - free(source); - - wl_data_device_set_user_data(data_dev, NULL); -} - -static void -_ecore_wl_cb_data_motion(void *data __UNUSED__, struct wl_data_device *data_dev, uint32_t timestamp, int32_t x, int32_t y) -{ - Ecore_Wl_Dnd_Source *source; - - if (!(source = wl_data_device_get_user_data(data_dev))) return; - /* TODO: Here we should raise motion events for dragging */ -} - -static void -_ecore_wl_cb_data_drop(void *data __UNUSED__, struct wl_data_device *data_dev) -{ - Ecore_Wl_Dnd_Source *source; - - if (!(source = wl_data_device_get_user_data(data_dev))) return; - - /* TODO: Raise event for drop */ - - wl_data_offer_accept(source->offer, source->timestamp, NULL); -// eina_array_data_get(source->types, 0)); -} - -static void -_ecore_wl_cb_data_selection(void *data, struct wl_data_device *data_dev, struct wl_data_offer *offer) -{ - Ecore_Wl_Dnd_Source *source; - - printf("Ecore_Wl Data Selection\n"); - if ((source = wl_data_device_get_user_data(data_dev))) + if ((!eglChooseConfig(ewd->egl.display, argb_attribs, &ewd->egl.argb_config, + 1, &n)) || (n == 0)) { - /* destroy old source */ - wl_data_offer_destroy(source->offer); - - while (eina_array_count(source->types)) - free(eina_array_pop(source->types)); - - eina_array_free(source->types); - free(source); - - wl_data_device_set_user_data(data_dev, NULL); + ERR("Failed to choose ARGB config"); + return EINA_FALSE; } -} - -static void -_ecore_wl_mouse_move_send(uint32_t timestamp) -{ - Ecore_Event_Mouse_Move *ev; - -// if (!_ecore_wl_input_surface) return; - - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Move)))) return; - - ev->timestamp = timestamp; - ev->x = _ecore_wl_surface_x; - ev->y = _ecore_wl_surface_y; - ev->root.x = _ecore_wl_screen_x; - ev->root.y = _ecore_wl_screen_y; - ev->modifiers = _ecore_wl_input_modifiers; - - ev->multi.device = 0; - ev->multi.radius = 1; - ev->multi.radius_x = 1; - ev->multi.radius_y = 1; - ev->multi.pressure = 1.0; - ev->multi.angle = 0.0; - ev->multi.x = _ecore_wl_surface_x; - ev->multi.y = _ecore_wl_surface_y; - ev->multi.root.x = _ecore_wl_screen_x; - ev->multi.root.y = _ecore_wl_screen_y; + ewd->egl.argb_context = + eglCreateContext(ewd->egl.display, ewd->egl.argb_config, + EGL_NO_CONTEXT, context_attribs); + if (!ewd->egl.argb_context) { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface))) - { - ev->window = id; - ev->event_window = id; - } + ERR("Failed to create ARGB context"); + return EINA_FALSE; } - ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); -} - -static void -_ecore_wl_mouse_out_send(struct wl_surface *surface, uint32_t timestamp) -{ - Ecore_Wl_Event_Mouse_Out *ev; - - if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_Out)))) return; - - ev->x = _ecore_wl_surface_x; - ev->y = _ecore_wl_surface_y; - ev->root.x = _ecore_wl_screen_x; - ev->root.y = _ecore_wl_screen_y; - ev->modifiers = _ecore_wl_input_modifiers; - ev->time = timestamp; - - if (surface) + if (!eglMakeCurrent(ewd->egl.display, EGL_NO_SURFACE, + EGL_NO_SURFACE, ewd->egl.argb_context)) { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - ev->window = id; + ERR("Failed to make ARGB context current"); + return EINA_FALSE; } - ecore_event_add(ECORE_WL_EVENT_MOUSE_OUT, ev, NULL, NULL); + return EINA_TRUE; } -static void -_ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp) +static Eina_Bool +_ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd) { - Ecore_Wl_Event_Mouse_In *ev; - - if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Mouse_In)))) return; - - ev->x = _ecore_wl_surface_x; - ev->y = _ecore_wl_surface_y; - ev->root.x = _ecore_wl_screen_x; - ev->root.y = _ecore_wl_screen_y; - ev->modifiers = _ecore_wl_input_modifiers; - ev->time = timestamp; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (surface) - { - unsigned int id = 0; + eglMakeCurrent(ewd->egl.display, + EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - ev->window = id; - } - - ecore_event_add(ECORE_WL_EVENT_MOUSE_IN, ev, NULL, NULL); -} + eglDestroyContext(ewd->egl.display, ewd->egl.argb_context); -static void -_ecore_wl_mouse_up_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp) -{ - Ecore_Event_Mouse_Button *ev; - - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; - - if (button == BTN_LEFT) - ev->buttons = 1; - else if (button == BTN_MIDDLE) - ev->buttons = 2; - else if (button == BTN_RIGHT) - ev->buttons = 3; - - ev->timestamp = timestamp; - ev->x = _ecore_wl_surface_x; - ev->y = _ecore_wl_surface_y; - ev->root.x = _ecore_wl_screen_x; - ev->root.y = _ecore_wl_screen_y; - ev->modifiers = _ecore_wl_input_modifiers; - - /* FIXME: Need to get these from Wayland somehow */ - ev->double_click = 0; - ev->triple_click = 0; - - ev->multi.device = 0; - ev->multi.radius = 1; - ev->multi.radius_x = 1; - ev->multi.radius_y = 1; - ev->multi.pressure = 1.0; - ev->multi.angle = 0.0; - ev->multi.x = _ecore_wl_surface_x; - ev->multi.y = _ecore_wl_surface_y; - ev->multi.root.x = _ecore_wl_screen_x; - ev->multi.root.y = _ecore_wl_screen_y; + /* NB: This is hanging when we run elm apps as wayland clients + * inside the weston compositor */ - { - unsigned int id = 0; + /* printf("Egl Terminate\n"); */ + /* eglTerminate(ewd->egl.display); */ + /* printf("Egl Terminate Done\n"); */ - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - { - ev->window = id; - ev->event_window = id; - } - } + eglReleaseThread(); - ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); + return EINA_TRUE; } -static void -_ecore_wl_mouse_down_send(struct wl_surface *surface, uint32_t button, uint32_t timestamp) +static Eina_Bool +_ecore_wl_xkb_init(Ecore_Wl_Display *ewd) { - Ecore_Event_Mouse_Button *ev; - - if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Button)))) return; - - if (button == BTN_LEFT) - ev->buttons = 1; - else if (button == BTN_MIDDLE) - ev->buttons = 2; - else if (button == BTN_RIGHT) - ev->buttons = 3; - - ev->timestamp = timestamp; - ev->x = _ecore_wl_surface_x; - ev->y = _ecore_wl_surface_y; - ev->root.x = _ecore_wl_screen_x; - ev->root.y = _ecore_wl_screen_y; - ev->modifiers = _ecore_wl_input_modifiers; - - /* FIXME: Need to get these from Wayland somehow */ - ev->double_click = 0; - ev->triple_click = 0; - - ev->multi.device = 0; - ev->multi.radius = 1; - ev->multi.radius_x = 1; - ev->multi.radius_y = 1; - ev->multi.pressure = 1.0; - ev->multi.angle = 0.0; - ev->multi.x = _ecore_wl_surface_x; - ev->multi.y = _ecore_wl_surface_y; - ev->multi.root.x = _ecore_wl_screen_x; - ev->multi.root.y = _ecore_wl_screen_y; + struct xkb_rule_names names; - { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - { - ev->window = id; - ev->event_window = id; - } - } + LOGFN(__FILE__, __LINE__, __FUNCTION__); - ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); -} + names.rules = "evdev"; + names.model = "evdev"; + names.layout = "us"; + names.variant = ""; + names.options = ""; -static void -_ecore_wl_focus_out_send(struct wl_surface *surface, uint32_t timestamp) -{ - Ecore_Wl_Event_Focus_Out *ev; - - if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_Out)))) return; - ev->time = timestamp; - if (surface) + if (!(ewd->xkb = xkb_compile_keymap_from_rules(&names))) { - unsigned int id = 0; - - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - ev->window = id; + ERR("Failed to compile keymap"); + return EINA_FALSE; } - ecore_event_add(ECORE_WL_EVENT_FOCUS_OUT, ev, NULL, NULL); + + return EINA_TRUE; } -static void -_ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp) +static Eina_Bool +_ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd) { - Ecore_Wl_Event_Focus_In *ev; - - if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Focus_In)))) return; - ev->time = timestamp; - if (surface) - { - unsigned int id = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); - if ((id = (unsigned int)wl_surface_get_user_data(surface))) - ev->window = id; - } - ecore_event_add(ECORE_WL_EVENT_FOCUS_IN, ev, NULL, NULL); + if (ewd->xkb) xkb_free_keymap(ewd->xkb); + return EINA_TRUE; } 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 @@ # define _ECORE_WAYLAND_PRIVATE_H # include +# include + +# include "Ecore_Wayland.h" //# define LOGFNS 1 @@ -13,6 +16,7 @@ # endif extern int _ecore_wl_log_dom; +extern Ecore_Wl_Display *_ecore_wl_disp; # ifdef ECORE_WL_DEFAULT_LOG_COLOR # undef ECORE_WL_DEFAULT_LOG_COLOR @@ -44,42 +48,40 @@ extern int _ecore_wl_log_dom; # endif # define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__) -typedef struct _Ecore_Wl_Dnd_Source +struct _Ecore_Wl_Dnd_Source { struct wl_data_offer *offer; - int refs; - - Eina_Array *types; + Ecore_Wl_Input *input; + struct wl_array types; + int refcount; + int fd; + int x, y; - uint32_t timestamp; + /* TODO: task & data_func */ void *data; -} Ecore_Wl_Dnd_Source; +}; -typedef struct _Ecore_Wl_Dnd_Target +struct _Ecore_Wl_Dnd_Target { - /* NB: These are not the real fields for this structure, - * and it is Bound to change....soon */ - struct wl_data_offer *offer; - int refs; - - Eina_Array *types; + Ecore_Wl_Dnd_Source *source; +}; - uint32_t timestamp; - void *data; -} Ecore_Wl_Dnd_Target; +void _ecore_wl_window_init(void); +void _ecore_wl_window_shutdown(void); -struct _Ecore_Wl_Drag_Source -{ - struct wl_data_device *data_dev; - struct wl_buffer *buffer; +void _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id); +void _ecore_wl_output_del(Ecore_Wl_Output *output); - int32_t hotspot_x, hotspot_y; - int32_t offset_x, offset_y; - const char *mimetype; - uint32_t timestamp; - void *data; +void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id); +void _ecore_wl_input_del(Ecore_Wl_Input *input); +void _ecore_wl_input_pointer_xy_get(int *x, int *y); - struct wl_data_source *data_source; -}; +void _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, unsigned int id); +void _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); +void _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device __UNUSED__); +void _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y); +void _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device __UNUSED__); +void _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device __UNUSED__, struct wl_data_offer *offer); +void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source); #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); EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window, const char *title); -EAPI void ecore_win32_window_focus_set(Ecore_Win32_Window *window); +EAPI void ecore_win32_window_focus(Ecore_Win32_Window *window); + +EAPI void *ecore_win32_window_focus_get(void); EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window, Eina_Bool on); @@ -471,11 +473,6 @@ EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window, EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, Eina_Bool on); -EINA_DEPRECATED EAPI void ecore_win32_window_shape_set(Ecore_Win32_Window *window, - unsigned short width, - unsigned short height, - unsigned char *mask); - EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window, Ecore_Win32_Cursor *cursor); 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -213,6 +212,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -268,6 +269,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -278,6 +281,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 unsigned int min_height; unsigned int max_width; unsigned int max_height; - unsigned int base_width; - unsigned int base_height; + int base_width; + int base_height; unsigned int step_width; unsigned int step_height; 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, w->min_height = 0; w->max_width = 32767; w->max_height = 32767; - w->base_width = 0; - w->base_height = 0; + w->base_width = -1; + w->base_height = -1; w->step_width = 1; w->step_height = 1; @@ -249,6 +249,8 @@ ecore_win32_window_free(Ecore_Win32_Window *window) * * This function returns the window HANDLE associated to @p window. If * @p window is @c NULL, this function returns @c NULL. + * + * @note The returned value is of type HWND. */ EAPI void * ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) @@ -755,140 +757,6 @@ ecore_win32_window_size_step_get(Ecore_Win32_Window *window, if (step_height) *step_height = window->step_height; } -EAPI void -ecore_win32_window_shape_set(Ecore_Win32_Window *window, - unsigned short width, - unsigned short height, - unsigned char *mask) -{ - HRGN rgn; - int x; - int y; - OSVERSIONINFO version_info; - - if (!window) - return; - - if (!mask) - { - window->shape.enabled = 0; - if (window->shape.layered != 0) - { - window->shape.layered = 0; -#if defined(WS_EX_LAYERED) - SetLastError(0); - if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, - GetWindowLong(window->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && - (GetLastError() != 0)) - { - ERR("SetWindowLongPtr() failed"); - return; - } - if (!RedrawWindow(window->window, NULL, NULL, - RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN)) - { - ERR("RedrawWindow() failed"); - return; - } -#endif - } - else - if (!SetWindowRgn(window->window, NULL, TRUE)) - { - ERR("SetWindowRgn() failed"); - } - return; - } - - if (width == 0 || height == 0) - return; - - window->shape.enabled = 1; - - if (width != window->shape.width || height != window->shape.height) - { - window->shape.width = width; - window->shape.height = height; - if (window->shape.mask) - { - free(window->shape.mask); - window->shape.mask = NULL; - } - window->shape.mask = malloc(width * height); - } - memcpy(window->shape.mask, mask, width * height); - - window->shape.layered = 0; - -#if defined(WS_EX_LAYERED) - version_info.dwOSVersionInfoSize = sizeof(version_info); - if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5) - { - SetLastError(0); - if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, - GetWindowLong(window->window, GWL_EXSTYLE) | WS_EX_LAYERED) && - (GetLastError() != 0)) - { - ERR("SetWindowLongPtr() failed"); - return; - } - window->shape.layered = 1; - return; - } -#endif - - if (!(rgn = CreateRectRgn(0, 0, 0, 0))) - { - ERR("CreateRectRgn() failed"); - return; - } - for (y = 0; y < height; y++) - { - HRGN rgnLine; - - if (!(rgnLine = CreateRectRgn(0, 0, 0, 0))) - { - ERR("CreateRectRgn() failed"); - return; - } - for (x = 0; x < width; x++) - { - if (mask[y * width + x] > 0) - { - HRGN rgnDot; - - if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1))) - { - ERR("CreateRectRgn() failed"); - return; - } - if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR) - { - ERR("CombineRgn() has not created a new region"); - } - if (!DeleteObject(rgnDot)) - { - ERR("DeleteObject() failed"); - return; - } - } - } - if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR) - { - ERR("CombineRgn() has not created a new region"); - } - if (!DeleteObject(rgnLine)) - { - ERR("DeleteObject() failed"); - return; - } - } - if (!SetWindowRgn(window->window, rgn, TRUE)) - { - ERR("SetWindowRgn() failed"); - } -} - /** * @brief Show the given window. * @@ -1011,7 +879,7 @@ ecore_win32_window_title_set(Ecore_Win32_Window *window, * @c NULL, this function does nothing. */ EAPI void -ecore_win32_window_focus_set(Ecore_Win32_Window *window) +ecore_win32_window_focus(Ecore_Win32_Window *window) { if (!window) return; @@ -1024,6 +892,37 @@ ecore_win32_window_focus_set(Ecore_Win32_Window *window) } /** + * @brief Get the current focused window. + * + * @return The window that has focus. + * + * This function returns the window that has focus. If the calling + * thread's message queue does not have an associated window with the + * keyboard focus, the return value is @c NULL. + * + * @note Even if the returned value is @c NULL, another thread's queue + * may be associated with a window that has the keyboard focus. + * + * @note The returned value is of type HWND. + */ +EAPI void * +ecore_win32_window_focus_get(void) +{ + HWND focused; + + INF("getting focused window"); + + focused = GetFocus(); + if (!focused) + { + ERR("GetFocus() failed"); + return NULL; + } + + return focused; +} + +/** * @brief Iconify or restore the given window. * * @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); EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window, const char *title); +EAPI void ecore_wince_window_focus(Ecore_WinCE_Window *window); + +EAPI void *ecore_wince_window_focus_get(void); + EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend); EAPI 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -194,6 +193,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -249,6 +250,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -259,6 +262,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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, } /** + * @brief Set the focus to the given window. + * + * @param window The window to give focus to. + * + * This function gives the focus to @p window. If @p window is + * @c NULL, this function does nothing. + */ +EAPI void +ecore_wince_window_focus(Ecore_WinCE_Window *window) +{ + if (!window) return; + + INF("focusing window"); + + if (!SetFocus(window->window)) + { + ERR("SetFocus() failed"); + } +} + +/** + * @brief Get the current focused window. + * + * @return The window that has focus. + * + * This function returns the window that has focus. If the calling + * thread's message queue does not have an associated window with the + * keyboard focus, the return value is @c NULL. + * + * @note Even if the returned value is @c NULL, another thread's queue + * may be associated with a window that has the keyboard focus. + * + * @note The returned value is of type HWND. + */ +EAPI void * +ecore_wince_window_focus_get(void) +{ + HWND focused; + + INF("getting focused window"); + + focused = GetFocus(); + if (!focused) + { + ERR("GetFocus() failed"); + return NULL; + } + + return focused; +} + +/** * @brief Set the graphic backend used for the given window. * * @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 ECORE_X_ILLUME_QUICKPANEL_STATE_ON } Ecore_X_Illume_Quickpanel_State; +typedef enum _Ecore_X_Illume_Indicator_State +{ + ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN = 0, + ECORE_X_ILLUME_INDICATOR_STATE_OFF, + ECORE_X_ILLUME_INDICATOR_STATE_ON +} Ecore_X_Illume_Indicator_State; + +typedef enum _Ecore_X_Illume_Clipboard_State +{ + ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN = 0, + ECORE_X_ILLUME_CLIPBOARD_STATE_OFF, + ECORE_X_ILLUME_CLIPBOARD_STATE_ON +} Ecore_X_Illume_Clipboard_State; + +typedef enum _Ecore_X_Illume_Indicator_Opacity_Mode +{ + ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN = 0, + ECORE_X_ILLUME_INDICATOR_OPAQUE, + ECORE_X_ILLUME_INDICATOR_TRANSLUCENT, + ECORE_X_ILLUME_INDICATOR_TRANSPARENT +} Ecore_X_Illume_Indicator_Opacity_Mode; + /* Window layer constants */ #define ECORE_X_WINDOW_LAYER_BELOW 2 #define ECORE_X_WINDOW_LAYER_NORMAL 4 @@ -2159,6 +2181,11 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *bottom_start_x, int *bottom_end_x); +EAPI void +ecore_x_netwm_icons_set(Ecore_X_Window win, + Ecore_X_Icon *icon, + int num); + EAPI Eina_Bool ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, @@ -2399,6 +2426,25 @@ EAPI void ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win); EAPI void +ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win, + Ecore_X_Illume_Clipboard_State state); + +EAPI Ecore_X_Illume_Clipboard_State +ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win); + +EAPI void +ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI Eina_Bool +ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h); +EAPI void ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter); EAPI Ecore_X_Sync_Counter @@ -2657,7 +2703,7 @@ ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, /* The usage of 'Ecore_X_Randr_None' or 'Ecore_X_Randr_Unset' * depends on the context. In most cases 'Ecore_X_Randr_Unset' * can be used, but in some cases -1 is a special value to - * functions, thus 'Ecore_X_Randr_None' (=0) musst be used. + * functions, thus 'Ecore_X_Randr_None' (=0) must be used. */ typedef short Ecore_X_Randr_Refresh_Rate; @@ -2749,6 +2795,11 @@ EAPI Eina_Bool EAPI Ecore_X_Randr_Mode_Info ** ecore_x_randr_modes_info_get(Ecore_X_Window root, int *num); +EAPI Ecore_X_Randr_Mode +ecore_x_randr_mode_info_add(Ecore_X_Window root, + Ecore_X_Randr_Mode_Info *mode_info); +EAPI void +ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode); EAPI Ecore_X_Randr_Mode_Info * ecore_x_randr_mode_info_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode); @@ -2762,10 +2813,13 @@ EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(Ecore_X_Window root, EAPI Ecore_X_Randr_Output * ecore_x_randr_window_outputs_get(Ecore_X_Window window, int *num); -EINA_DEPRECATED EAPI Ecore_X_Randr_Output * +EAPI Ecore_X_Randr_Output * ecore_x_randr_current_output_get(Ecore_X_Window window, int *num); EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_window_crtcs_get(Ecore_X_Window window, + int *num); +EAPI Ecore_X_Randr_Crtc * ecore_x_randr_current_crtc_get(Ecore_X_Window window, int *num); EAPI Ecore_X_Randr_Output * @@ -2840,6 +2894,12 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc_r2, Ecore_X_Randr_Output_Policy policy, Ecore_X_Randr_Relative_Alignment alignment); +EAPI Eina_Bool +ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, + Ecore_X_Randr_Mode mode); +EAPI void +ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output, + Ecore_X_Randr_Mode mode); EAPI Ecore_X_Randr_Mode * ecore_x_randr_output_modes_get(Ecore_X_Window root, Ecore_X_Randr_Output output, @@ -3408,6 +3468,13 @@ EAPI Eina_Bool EAPI const char * ecore_x_keysym_string_get(int keysym); +/** + * Given a keyname, return the keycode representing that key + * + * @since 1.2.0 + */ +EAPI int ecore_x_keysym_keycode_get(const char *keyname); + typedef struct _Ecore_X_Image Ecore_X_Image; EAPI Ecore_X_Image * @@ -3617,6 +3684,26 @@ ecore_x_gesture_event_ungrab(Ecore_X_Window win, Ecore_X_Gesture_Event_Type type, int num_fingers); +EAPI void +ecore_x_e_illume_indicator_state_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_State state); +EAPI Ecore_X_Illume_Indicator_State +ecore_x_e_illume_indicator_state_get(Ecore_X_Window win); +EAPI void +ecore_x_e_illume_indicator_state_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_State state); + +EAPI void +ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Opacity_Mode mode); + +EAPI Ecore_X_Illume_Indicator_Opacity_Mode +ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win); + +EAPI void +ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Opacity_Mode mode); + #ifdef __cplusplus } #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; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_ON; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER; EAPI 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -224,6 +223,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -279,6 +280,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -289,6 +292,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_ON = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE= 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0; EAPI 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -206,6 +205,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -261,6 +262,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -271,6 +274,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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[] = { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, - + { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE }, + { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON }, + { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF }, + { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE }, + { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE }, + { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT }, + { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT }, + { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE }, + { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE }, + { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE }, + { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE }, + { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON }, + { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF }, + { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY }, { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, { "_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_ static Ecore_X_Illume_Quickpanel_State _ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom); static Ecore_X_Atom _ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode); static Ecore_X_Illume_Mode _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom); +static Ecore_X_Atom _ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state); +static Ecore_X_Illume_Indicator_State _ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom); EAPI void ecore_x_e_init(void) @@ -719,6 +721,99 @@ ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) 0, 0, 0, 0, 0); } +static Ecore_X_Atom +_ecore_xcb_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state) +{ + switch (state) + { + case ECORE_X_ILLUME_CLIPBOARD_STATE_ON: + return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON; + case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF: + return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF; + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Clipboard_State +_ecore_xcb_e_clipboard_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON) + return ECORE_X_ILLUME_CLIPBOARD_STATE_ON; + + if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF) + return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF; + + return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win, + Ecore_X_Illume_Clipboard_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_xcb_e_clipboard_atom_get(state); + + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Clipboard_State +ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE, + &atom, 1)) + return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN; + return _ecore_xcb_e_clipboard_state_get(atom); +} + +EAPI void +ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win, + int x, int y, int w, int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, + geom, 4); +} + +EAPI Eina_Bool +ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win, + int *x, int *y, int *w, int *h) +{ + int ret = 0; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, + geom, 4); + if (ret != 4) return EINA_FALSE; + + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + EAPI void ecore_x_e_illume_mode_set(Ecore_X_Window win, Ecore_X_Illume_Mode mode) @@ -1069,3 +1164,144 @@ _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom) return ECORE_X_ILLUME_MODE_UNKNOWN; } +static Ecore_X_Atom +_ecore_xcb_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state) +{ + switch (state) + { + case ECORE_X_ILLUME_INDICATOR_STATE_ON: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON; + + case ECORE_X_ILLUME_INDICATOR_STATE_OFF: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Indicator_State +_ecore_xcb_e_indicator_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON) + return ECORE_X_ILLUME_INDICATOR_STATE_ON; + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF) + return ECORE_X_ILLUME_INDICATOR_STATE_OFF; + + return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_indicator_state_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + atom = _ecore_xcb_e_indicator_atom_get(state); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Indicator_State +ecore_x_e_illume_indicator_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, + &atom, 1)) + return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; + + return _ecore_xcb_e_indicator_state_get(atom); +} + +EAPI void +ecore_x_e_illume_indicator_state_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_State state) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_xcb_e_indicator_atom_get(state), + 0, 0, 0, 0); +} + +static Ecore_X_Atom +_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode) +{ + switch (mode) + { + case ECORE_X_ILLUME_INDICATOR_OPAQUE: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE; + + case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT; + + case ECORE_X_ILLUME_INDICATOR_TRANSPARENT: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Indicator_Opacity_Mode +_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE) + return ECORE_X_ILLUME_INDICATOR_OPAQUE; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT) + return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT) + return ECORE_X_ILLUME_INDICATOR_TRANSPARENT; + + return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Opacity_Mode mode) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_indicator_opacity_atom_get(mode); + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Indicator_Opacity_Mode +ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, + &atom, 1)) + return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN; + + return _ecore_x_e_indicator_opacity_get(atom); +} + +EAPI void +ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Opacity_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_indicator_opacity_atom_get(mode), + 0, 0, 0, 0); +} + 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) return _ecore_xcb_keymap_keysym_to_string(keysym); } +EAPI int +ecore_x_keysym_keycode_get(const char *keyname) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_keymap_string_to_keycode(keyname); +} + /* local functions */ static int _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, ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); } +EAPI void +ecore_x_netwm_icons_set(Ecore_X_Window win, + Ecore_X_Icon *icon, + int num) +{ + unsigned int *data, *p, *p2; + unsigned int i, size, x, y; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + size = 0; + for (i = 0; i < (unsigned int)num; i++) + { + size += 2 + (icon[i].width * icon[i].height); + } + data = malloc(size * sizeof(unsigned int)); + if (!data) return; + p = data; + for (i = 0; i < (unsigned int)num; i++) + { + p[0] = icon[i].width; + p[1] = icon[i].height; + p += 2; + p2 = icon[i].data; + for (y = 0; y < icon[i].height; y++) + { + for (x = 0; x < icon[i].width; x++) + { + unsigned int r, g, b, a; + + a = (*p2 >> 24) & 0xff; + r = (*p2 >> 16) & 0xff; + g = (*p2 >> 8 ) & 0xff; + b = (*p2 ) & 0xff; + if ((a > 0) && (a < 255)) + { + r = (r * 255) / a; + g = (g * 255) / a; + b = (b * 255) / a; + } + *p = (a << 24) | (r << 16) | (g << 8) | b; + p++; + p2++; + } + } + } + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON, + data, size); + free(data); +} + EAPI Eina_Bool ecore_x_netwm_icons_get(Ecore_X_Window win, 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 @@ /* TODO: List of missing functions * * ecore_x_randr_crtc_clone_set - * ecore_x_randr_output_size_mm_get * ecore_x_randr_output_crtc_set * ecore_x_randr_edid_version_get * ecore_x_randr_edid_info_has_valid_checksum @@ -776,6 +775,24 @@ ecore_x_randr_output_modes_get(Ecore_X_Window root, return modes; } +EAPI Eina_Bool +ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, Ecore_X_Randr_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None)) + return EINA_FALSE; + + xcb_randr_add_output_mode(_ecore_xcb_conn, output, mode); + return EINA_TRUE; +#endif + return EINA_FALSE; +} + /* * @brief get detailed information for a given mode id * @param root window which's screen's ressources are queried @@ -805,6 +822,63 @@ ecore_x_randr_mode_info_get(Ecore_X_Window root, } /* + * @brief add a mode to a display + * @param root window to which's screen's ressources are added + * @param mode_info + * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode + * adding failed. + * @since 1.2.0 + */ +EAPI Ecore_X_Randr_Mode +ecore_x_randr_mode_info_add(Ecore_X_Window root, Ecore_X_Randr_Mode_Info *mode_info) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Randr_Mode mode = Ecore_X_Randr_None; + xcb_randr_create_mode_cookie_t cookie; + xcb_randr_create_mode_reply_t *reply; + xcb_randr_mode_info_t info; + int namelen = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (!mode_info) return Ecore_X_Randr_None; + if (!_ecore_xcb_randr_root_validate(root)) return Ecore_X_Randr_None; + + namelen = strlen(mode_info->name); + + memset(&info, 0, sizeof(info)); + info.width = mode_info->width; + info.height = mode_info->height; + info.dot_clock = mode_info->dotClock; + info.hsync_start = mode_info->hSyncStart; + info.hsync_end = mode_info->hSyncEnd; + info.htotal = mode_info->hTotal; + info.hskew = mode_info->hSkew; + info.vsync_start = mode_info->vSyncStart; + info.vsync_end = mode_info->vSyncEnd; + info.vtotal = mode_info->vTotal; + info.mode_flags = mode_info->modeFlags; + info.name_len = namelen; + + cookie = + xcb_randr_create_mode_unchecked(_ecore_xcb_conn, root, info, + namelen, mode_info->name); + reply = xcb_randr_create_mode_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + mode = mode_info->xid; + free(reply); + } +#endif + return mode; +} + +/* * @brief get detailed information for all modes related to a root window's screen * @param root window which's screen's ressources are queried * @param num number of modes returned @@ -1057,6 +1131,53 @@ ecore_x_randr_output_crtc_get(Ecore_X_Window root, return Ecore_X_Randr_None; } +EAPI void +ecore_x_randr_output_size_mm_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *w_mm, int *h_mm) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + xcb_timestamp_t timestamp = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (w_mm) *w_mm = 0; + if (h_mm) *h_mm = 0; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + + if ((output != Ecore_X_Randr_None) && (_randr_version >= RANDR_1_3)) + { + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + timestamp = reply->config_timestamp; + free(reply); + } + else if ((output != Ecore_X_Randr_None) && (_randr_version == RANDR_1_2)) + { + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + timestamp = reply->config_timestamp; + free(reply); + } + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + if (w_mm) *w_mm = oreply->mm_width; + if (h_mm) *h_mm = oreply->mm_height; + free(oreply); + } +#endif +} + /** * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is * 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, } /* + * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead. + * @brief get the CRTCs, which display a certain window + * @param window window the displaying CRTCs shall be found for + * @param num the number of CRTCs displaying the window + * @return array of CRTCs that display a certain window. NULL if no CRTCs + * was found that displays the specified window. + */ +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_current_crtc_get(Ecore_X_Window window, + int *num) +{ + return ecore_x_randr_window_crtcs_get(window, num); +} + +/* + * @brief get the CRTCs, which display a certain window + * @param window window the displaying crtcs shall be found for + * @param num the number of crtcs displaying the window + * @return array of crtcs that display a certain window. NULL if no crtcs + * was found that displays the specified window. + * @since 1.2.0 + */ +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_window_crtcs_get(Ecore_X_Window window, + int *num) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Window root; + Eina_Rectangle w_geo, c_geo; + Ecore_X_Randr_Crtc *crtcs, *ret = NULL; + Ecore_X_Randr_Mode mode; + int ncrtcs, i, nret = 0; + xcb_translate_coordinates_cookie_t cookie; + xcb_translate_coordinates_reply_t *trans; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h); + + root = ecore_x_window_root_get(window); + crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); + if (!crtcs) return NULL; + + /* now get window RELATIVE to root window - thats what matters. */ + cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0); + trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); + w_geo.x = trans->dst_x; + w_geo.y = trans->dst_y; + free(trans); + + for (i = 0, nret = 0; i < ncrtcs; i++) + { + /* if crtc is not enabled, don't bother about it any further */ + mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]); + if (mode == Ecore_X_Randr_None) continue; + + ecore_x_randr_crtc_geometry_get(root, crtcs[i], &c_geo.x, &c_geo.y, + &c_geo.w, &c_geo.h); + if (eina_rectangles_intersect(&w_geo, &c_geo)) + { + ret = realloc(ret, (++nret * + sizeof(Ecore_X_Randr_Output))); + ret[nret] = crtcs[i]; + } + } + free(crtcs); + + if (num) *num = nret; + return ret; + +#endif + if (num) *num = 0; + return NULL; +} + +/* * @brief get a CRTC's outputs. * @param root the root window which's screen will be queried * @param num number of outputs referenced by given CRTC @@ -2172,6 +2374,22 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root, } /* + * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead. + * @brief get the outputs, which display a certain window + * @param window window the displaying outputs shall be found for + * @param num the number of outputs displaying the window + * @return array of outputs that display a certain window. NULL if no outputs + * was found that displays the specified window. + */ + +Ecore_X_Randr_Output * +ecore_x_randr_current_output_get(Ecore_X_Window window, + int *num) +{ + return ecore_x_randr_window_outputs_get(window, num); +} + +/* * @brief get the outputs, which display a certain window * @param window window the displaying outputs shall be found for * @param num the number of outputs displaying the window @@ -2184,13 +2402,9 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, { #ifdef ECORE_XCB_RANDR Ecore_X_Window root; - Eina_Rectangle w_geo, c_geo; Ecore_X_Randr_Crtc *crtcs; - Ecore_X_Randr_Mode mode; - Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; + Ecore_X_Randr_Output *outputs, *ret = NULL; int ncrtcs, noutputs, i, nret = 0; - xcb_translate_coordinates_cookie_t cookie; - xcb_translate_coordinates_reply_t *trans; #endif LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -2199,64 +2413,36 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, if (num) *num = 0; #ifdef ECORE_XCB_RANDR - RANDR_CHECK_1_2_RET(NULL); - - ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h); + if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; root = ecore_x_window_root_get(window); - crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); - if (!crtcs) return NULL; + if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs))) + goto _ecore_x_randr_current_output_get_fail; - /* now get window RELATIVE to root window - thats what matters. */ - cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0); - trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); - w_geo.x = trans->dst_x; - w_geo.y = trans->dst_y; - free(trans); - - for (i = 0; i < ncrtcs; i++) + for (i = 0, nret = 0; i < ncrtcs; i++) { - /* if crtc is not enabled, don't bother about it any further */ - mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]); - if (mode == Ecore_X_Randr_None) continue; - ecore_x_randr_crtc_geometry_get(root, crtcs[i], &c_geo.x, &c_geo.y, - &c_geo.w, &c_geo.h); - if (eina_rectangles_intersect(&w_geo, &c_geo)) - { - outputs = - ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs); - /* The case below should be impossible, but for safety reasons - * remains */ - if (!outputs) - { - if (num) *num = 0; - free(ret); - free(crtcs); - return NULL; - } - tret = realloc(ret, ((nret + noutputs) * - sizeof(Ecore_X_Randr_Output))); - if (!tret) - { - if (num) *num = 0; - free(outputs); - free(ret); - free(crtcs); - return NULL; - } - ret = tret; - memcpy(&ret[nret], outputs, - (noutputs * sizeof(Ecore_X_Randr_Output))); - nret += noutputs; - free(outputs); - } + outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], + &noutputs); + if (!outputs) + goto _ecore_x_randr_current_output_get_fail_free; + nret += noutputs; + ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output))); + memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output))); + free(outputs); } free(crtcs); - if (num) *num = nret; + if (num) + *num = nret; + return ret; +_ecore_x_randr_current_output_get_fail_free: + free(outputs); + free(crtcs); + free(ret); +_ecore_x_randr_current_output_get_fail: #endif if (num) *num = 0; 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) * @c _NET_WM_PID. * * @param win The given window. - * @ingroup Ecore_X_Window_Properties_Groups + * @ingroup Ecore_X_Window_Properties_Group */ EAPI void ecore_x_window_defaults_set(Ecore_X_Window win) @@ -1119,7 +1119,7 @@ ecore_x_window_save_set_del(Ecore_X_Window win) } /** - * gets the focus to the window @p win. + * gets the window that has focus. * @return The window that has focus. * @ingroup Ecore_X_Window_Focus_Functions */ 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -197,6 +196,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -252,6 +253,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -262,6 +265,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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) { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, - + { "_E_ILLUME_INDICATOR_STATE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE }, + { "_E_ILLUME_INDICATOR_ON", &ECORE_X_ATOM_E_ILLUME_INDICATOR_ON }, + { "_E_ILLUME_INDICATOR_OFF", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF }, + { "_E_ILLUME_INDICATOR_OPACITY_MODE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE }, + { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE }, + { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT }, + { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT }, + { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE }, + { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE }, + { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE }, + { "_E_ILLUME_CLIPBOARD_STATE", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE }, + { "_E_ILLUME_CLIPBOARD_ON", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON }, + { "_E_ILLUME_CLIPBOARD_OFF", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF }, + { "_E_ILLUME_CLIPBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY }, { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, { "_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) 1, 0, 0, 0, 0); } +static Ecore_X_Atom +_ecore_x_e_clipboard_atom_get(Ecore_X_Illume_Clipboard_State state) +{ + switch (state) + { + case ECORE_X_ILLUME_CLIPBOARD_STATE_ON: + return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON; + case ECORE_X_ILLUME_CLIPBOARD_STATE_OFF: + return ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF; + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Clipboard_State +_ecore_x_e_clipboard_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_ON) + return ECORE_X_ILLUME_CLIPBOARD_STATE_ON; + + if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF) + return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF; + + return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_clipboard_state_set(Ecore_X_Window win, + Ecore_X_Illume_Clipboard_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_clipboard_atom_get(state); + + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Clipboard_State +ecore_x_e_illume_clipboard_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE, + &atom, 1)) + return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN; + return _ecore_x_e_clipboard_state_get(atom); +} + +EAPI void +ecore_x_e_illume_clipboard_geometry_set(Ecore_X_Window win, + int x, int y, int w, int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, + geom, 4); +} + +EAPI Eina_Bool +ecore_x_e_illume_clipboard_geometry_get(Ecore_X_Window win, + int *x, int *y, int *w, int *h) +{ + int ret = 0; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY, + geom, 4); + if (ret != 4) return EINA_FALSE; + + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + EAPI void ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter) @@ -1058,3 +1151,143 @@ ecore_x_e_comp_pixmap_get(Ecore_X_Window win) return pixmap; } +static Ecore_X_Atom +_ecore_x_e_indicator_atom_get(Ecore_X_Illume_Indicator_State state) +{ + switch (state) + { + case ECORE_X_ILLUME_INDICATOR_STATE_ON: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_ON; + + case ECORE_X_ILLUME_INDICATOR_STATE_OFF: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Indicator_State +_ecore_x_e_indicator_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_ON) + return ECORE_X_ILLUME_INDICATOR_STATE_ON; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OFF) + return ECORE_X_ILLUME_INDICATOR_STATE_OFF; + + return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_indicator_state_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_indicator_atom_get(state); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Indicator_State +ecore_x_e_illume_indicator_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, + &atom, 1)) + return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; + + return _ecore_x_e_indicator_state_get(atom); +} + +EAPI void +ecore_x_e_illume_indicator_state_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_State state) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_indicator_atom_get(state), + 0, 0, 0, 0); +} + +static Ecore_X_Atom +_ecore_x_e_indicator_opacity_atom_get(Ecore_X_Illume_Indicator_Opacity_Mode mode) +{ + switch (mode) + { + case ECORE_X_ILLUME_INDICATOR_OPAQUE: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE; + + case ECORE_X_ILLUME_INDICATOR_TRANSLUCENT: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT; + + case ECORE_X_ILLUME_INDICATOR_TRANSPARENT: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Indicator_Opacity_Mode +_ecore_x_e_indicator_opacity_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE) + return ECORE_X_ILLUME_INDICATOR_OPAQUE; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT) + return ECORE_X_ILLUME_INDICATOR_TRANSLUCENT; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT) + return ECORE_X_ILLUME_INDICATOR_TRANSPARENT; + + return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Opacity_Mode mode) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_indicator_opacity_atom_get(mode); + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Indicator_Opacity_Mode +ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, + &atom, 1)) + return ECORE_X_ILLUME_INDICATOR_OPACITY_UNKNOWN; + + return _ecore_x_e_indicator_opacity_get(atom); +} + +EAPI void +ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Opacity_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_indicator_opacity_atom_get(mode), + 0, 0, 0, 0); +} + 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, return EINA_TRUE; } +EAPI void +ecore_x_netwm_icons_set(Ecore_X_Window win, + Ecore_X_Icon *icon, + int num) +{ + unsigned int *data, *p, *p2; + unsigned int i, size, x, y; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + size = 0; + for (i = 0; i < (unsigned int)num; i++) + { + size += 2 + (icon[i].width * icon[i].height); + } + data = malloc(size * sizeof(unsigned int)); + if (!data) return; + p = data; + for (i = 0; i < (unsigned int)num; i++) + { + p[0] = icon[i].width; + p[1] = icon[i].height; + p += 2; + p2 = icon[i].data; + for (y = 0; y < icon[i].height; y++) + { + for (x = 0; x < icon[i].width; x++) + { + unsigned int r, g, b, a; + + a = (*p2 >> 24) & 0xff; + r = (*p2 >> 16) & 0xff; + g = (*p2 >> 8 ) & 0xff; + b = (*p2 ) & 0xff; + if ((a > 0) && (a < 255)) + { + // unpremul + r = (r * 255) / a; + g = (g * 255) / a; + b = (b * 255) / a; + } + *p = (a << 24) | (r << 16) | (g << 8) | b; + p++; + p2++; + } + } + } + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON, + data, size); + free(data); +} + EAPI Eina_Bool ecore_x_netwm_icons_get(Ecore_X_Window win, 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, ret[i]->vSyncStart = res->modes[i].vSyncStart; ret[i]->vSyncEnd = res->modes[i].vSyncEnd; ret[i]->vTotal = res->modes[i].vTotal; - if ((ret[i]->name = (malloc(res->modes[i].nameLength)))) + if ((ret[i]->name = (malloc(res->modes[i].nameLength + 1)))) strncpy(ret[i]->name, res->modes[i].name, - res->modes[i].nameLength); + (res->modes[i].nameLength + 1)); else ret[i]->name = NULL; @@ -380,6 +380,48 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root, } /* + * @brief add a mode to a display + * @param root window to which's screen's ressources are added + * @param mode_info + * @return Ecore_X_Randr_Mode of the added mode. Ecore_X_Randr_None if mode + * adding failed. + * @since 1.2.0 + */ +EAPI Ecore_X_Randr_Mode +ecore_x_randr_mode_info_add(Ecore_X_Window root, + Ecore_X_Randr_Mode_Info *mode_info) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + Ecore_X_Randr_Mode mode = Ecore_X_Randr_None; + + if (_ecore_x_randr_root_validate(root) && mode_info) + mode = XRRCreateMode(_ecore_x_disp, root, (XRRModeInfo*)mode_info); + + return mode; +#else + return Ecore_X_Randr_None; +#endif +} + +/* + * @brief delete a mode from the display + * @param mode_info + * @since 1.2.0 + */ +EAPI void +ecore_x_randr_mode_del(Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + + XRRDestroyMode(_ecore_x_disp, mode); +#else + return; +#endif +} + +/* * @brief get detailed information for a given mode id * @param root window which's screen's ressources are queried * @param mode the XID which identifies the mode of interest @@ -491,6 +533,83 @@ ecore_x_randr_crtcs_get(Ecore_X_Window root, #endif } +/* + * @deprecated bad naming. Use ecore_x_randr_window_crtcs_get instead. + * @brief get the CRTCs, which display a certain window + * @param window window the displaying crtcs shall be found for + * @param num the number of crtcs displaying the window + * @return array of crtcs that display a certain window. NULL if no crtcs + * was found that displays the specified window. + */ +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_current_crtc_get(Ecore_X_Window window, + int *num) +{ + return ecore_x_randr_window_crtcs_get(window, num); +} + +/* + * @brief get the CRTCs, which display a certain window + * @param window window the displaying crtcs shall be found for + * @param num the number of crtcs displaying the window + * @return array of crtcs that display a certain window. NULL if no crtcs + * was found that displays the specified window. + * @since 1.2.0 + */ +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_window_crtcs_get(Ecore_X_Window window, + int *num) +{ +#ifdef ECORE_XRANDR + Ecore_X_Window root; + Eina_Rectangle w_geo, c_geo; + Ecore_X_Randr_Crtc *crtcs; + Ecore_X_Randr_Mode mode; + Ecore_X_Randr_Output *ret = NULL; + Window tw; + int ncrtcs, i, nret = 0, rx = 0, ry = 0; + + if (_randr_version < RANDR_1_2) goto _ecore_x_randr_window_crtcs_get_fail; + + ecore_x_window_geometry_get(window, + &w_geo.x, &w_geo.y, + &w_geo.w, &w_geo.h); + + root = ecore_x_window_root_get(window); + crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); + if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail; + + /* now get window RELATIVE to root window - thats what matters. */ + XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw); + w_geo.x = rx; + w_geo.y = ry; + + for (i = 0, nret = 0; i < ncrtcs; i++) + { + /* if crtc is not enabled, don't bother about it any further */ + mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]); + if (mode == Ecore_X_Randr_None) continue; + + ecore_x_randr_crtc_geometry_get(root, crtcs[i], + &c_geo.x, &c_geo.y, + &c_geo.w, &c_geo.h); + if (eina_rectangles_intersect(&w_geo, &c_geo)) + { + ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret)); + ret[nret] = crtcs[i]; + } + } + free(crtcs); + + if (num) *num = nret; + return ret; + +_ecore_x_randr_window_crtcs_get_fail: +#endif + if (num) *num = 0; + return NULL; +} + EAPI Ecore_X_Randr_Output * ecore_x_randr_outputs_get(Ecore_X_Window root, int *num) @@ -1364,6 +1483,54 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, #endif } +/* + * @brief add given mode to given output + * @param output the output the mode is added to + * @param mode the mode added to the output + * @return EINA_FALSE if output or mode equal Ecore_X_Randr_None, else EINA_TRUE + * Additionally, if xcb backend is used, the success of the addition is reported + * back directly. + * @since 1.2.0 + */ +EAPI Eina_Bool +ecore_x_randr_output_mode_add(Ecore_X_Randr_Output output, + Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None)) + return EINA_FALSE; + + XRRAddOutputMode(_ecore_x_disp, output, mode); + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +/* + * @brief delete given mode from given output + * @param output the output the mode is removed from + * @param mode the mode removed from the output + * @since 1.2.0 + */ +EAPI void +ecore_x_randr_output_mode_del(Ecore_X_Randr_Output output, + Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + + if ((output == Ecore_X_Randr_None) || (mode == Ecore_X_Randr_None)) + return; + + XRRDeleteOutputMode(_ecore_x_disp, output, mode); +#else + return; +#endif +} + EAPI Ecore_X_Randr_Mode * ecore_x_randr_output_modes_get(Ecore_X_Window root, Ecore_X_Randr_Output output, @@ -2136,70 +2303,39 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, { #ifdef ECORE_XRANDR Ecore_X_Window root; - Eina_Rectangle w_geo, c_geo; Ecore_X_Randr_Crtc *crtcs; - Ecore_X_Randr_Mode mode; - Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; - Window tw; - int ncrtcs, noutputs, i, nret = 0, rx = 0, ry = 0; + Ecore_X_Randr_Output *outputs, *ret = NULL; + int ncrtcs, noutputs, i, nret = 0; if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; - ecore_x_window_geometry_get(window, - &w_geo.x, &w_geo.y, - &w_geo.w, &w_geo.h); - root = ecore_x_window_root_get(window); - crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); - if (!crtcs) goto _ecore_x_randr_current_output_get_fail; - - /* now get window RELATIVE to root window - thats what matters. */ - XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw); - w_geo.x = rx; - w_geo.y = ry; + if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs))) + goto _ecore_x_randr_current_output_get_fail; - for (i = 0; i < ncrtcs; i++) + for (i = 0, nret = 0; i < ncrtcs; i++) { - /* if crtc is not enabled, don't bother about it any further */ - mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]); - if (mode == Ecore_X_Randr_None) continue; - ecore_x_randr_crtc_geometry_get(root, crtcs[i], - &c_geo.x, &c_geo.y, - &c_geo.w, &c_geo.h); - if (eina_rectangles_intersect(&w_geo, &c_geo)) - { - outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], - &noutputs); - /* The case below should be impossible, but for safety reasons - * remains */ - if (!outputs) - { - if (num) *num = 0; - free(ret); - free(crtcs); - return NULL; - } - tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output))); - if (!tret) - { - if (num) *num = 0; - free(outputs); - free(ret); - free(crtcs); - return NULL; - } - ret = tret; - memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output))); - nret += noutputs; - free(outputs); - } + outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], + &noutputs); + if (!outputs) + goto _ecore_x_randr_current_output_get_fail_free; + nret += noutputs; + ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output))); + memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output))); + free(outputs); } free(crtcs); - if (num) *num = nret; + if (num) + *num = nret; + return ret; +_ecore_x_randr_current_output_get_fail_free: + free(outputs); + free(crtcs); + free(ret); _ecore_x_randr_current_output_get_fail: #endif if (num) *num = 0; @@ -2207,7 +2343,7 @@ _ecore_x_randr_current_output_get_fail: } /* - * @depricated bad naming. Use ecore_x_randr_window_outputs_get instead. + * @deprecated bad naming. Use ecore_x_randr_window_outputs_get instead. * @brief get the outputs, which display a certain window * @param window window the displaying outputs shall be found for * @param num the number of outputs displaying the window @@ -2215,7 +2351,7 @@ _ecore_x_randr_current_output_get_fail: * was found that displays the specified window. */ -EINA_DEPRECATED EAPI Ecore_X_Randr_Output * +EAPI Ecore_X_Randr_Output * ecore_x_randr_current_output_get(Ecore_X_Window window, int *num) { 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) return XKeysymToString(keysym); } +EAPI int +ecore_x_keysym_keycode_get(const char *keyname) +{ + int keycode = 0; + + if (!strncmp(keyname, "Keycode-", 8)) + keycode = atoi(keyname + 8); + else + keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname)); + + return keycode; +} 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, * @c _NET_WM_PID. * * @param win The given window. - * @ingroup Ecore_X_Window_Properties_Groups + * @ingroup Ecore_X_Window_Properties_Group */ EAPI void ecore_x_window_defaults_set(Ecore_X_Window win) @@ -597,7 +597,7 @@ ecore_x_window_focus_at_time(Ecore_X_Window win, } /** - * gets the focus to the window @p win. + * gets the window that has focus. * @return The window that has focus. * @ingroup Ecore_X_Window_Focus_Functions */ diff --git a/libraries/ecore/src/modules/Makefile.in b/libraries/ecore/src/modules/Makefile.in index 4bb9420..e2cf44a 100644 --- a/libraries/ecore/src/modules/Makefile.in +++ b/libraries/ecore/src/modules/Makefile.in @@ -47,16 +47,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -172,6 +171,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -227,6 +228,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -237,6 +240,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/Makefile.in b/libraries/ecore/src/modules/immodules/Makefile.in index e65881c..5dacbed 100644 --- a/libraries/ecore/src/modules/immodules/Makefile.in +++ b/libraries/ecore/src/modules/immodules/Makefile.in @@ -49,16 +49,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.in b/libraries/ecore/src/modules/immodules/scim/Makefile.in index 9fc3283..ae6fc7d 100644 --- a/libraries/ecore/src/modules/immodules/scim/Makefile.in +++ b/libraries/ecore/src/modules/immodules/scim/Makefile.in @@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -205,6 +204,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -260,6 +261,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -270,6 +273,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp index 6cb72c2..eb9b5c9 100644 --- a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp +++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp @@ -223,18 +223,18 @@ static int __current_super_mask = 0; static int __current_hyper_mask = 0; static int __current_numlock_mask = Mod2Mask; -// A hack to shutdown the immodule cleanly even if im_module_exit () is not called when exiting. +// A hack to shutdown the immodule cleanly even if im_module_exit() is not called when exiting. class FinalizeHandler { public: - FinalizeHandler () + FinalizeHandler() { - SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler ()\n"; + SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler()\n"; } - ~FinalizeHandler () + ~FinalizeHandler() { - SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler ()\n"; - isf_imf_context_shutdown (); + SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler()\n"; + isf_imf_context_shutdown(); } }; @@ -254,12 +254,12 @@ utf8_offset_to_index(const char *str, int offset) } static unsigned int -get_time (void) +get_time(void) { unsigned int tint; struct timeval tv; struct timezone tz; /* is not used since ages */ - gettimeofday (&tv, &tz); + gettimeofday(&tv, &tz); tint = tv.tv_sec * 1000; tint = tint / 1000 * 1000; tint = tint + tv.tv_usec / 1000; @@ -268,7 +268,7 @@ get_time (void) /* Function Implementations */ static EcoreIMFContextISFImpl * -new_ic_impl (EcoreIMFContextISF *parent) +new_ic_impl(EcoreIMFContextISF *parent) { EcoreIMFContextISFImpl *impl = NULL; @@ -295,7 +295,7 @@ new_ic_impl (EcoreIMFContextISF *parent) } static void -delete_ic_impl (EcoreIMFContextISFImpl *impl) +delete_ic_impl(EcoreIMFContextISFImpl *impl) { EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0; @@ -312,10 +312,10 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl) _free_ic_impl_list = rec; rec->parent = 0; - rec->si.reset (); + rec->si.reset(); rec->client_window = 0; - rec->preedit_string = WideString (); - rec->preedit_attrlist.clear (); + rec->preedit_string = WideString(); + rec->preedit_attrlist.clear(); return; } @@ -323,7 +323,7 @@ delete_ic_impl (EcoreIMFContextISFImpl *impl) } static void -delete_all_ic_impl (void) +delete_all_ic_impl(void) { EcoreIMFContextISFImpl *it = _used_ic_impl_list; @@ -344,7 +344,7 @@ delete_all_ic_impl (void) } static EcoreIMFContextISF * -find_ic (int id) +find_ic(int id) { EcoreIMFContextISFImpl *rec = _used_ic_impl_list; @@ -363,17 +363,18 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx) { char *plain_str = NULL; char *markup_str = NULL; - const char *puncs[3] = {". ", "! ", "? "}; + const char *puncs[] = {". ", "! ", "? "}; Eina_Bool ret = EINA_FALSE; int cursor_pos = 0; int i = 0; Eina_Unicode *tail = NULL; Eina_Unicode *ustr = NULL; - Eina_Unicode *uni_puncs[3]; + const int punc_num = sizeof(puncs) / sizeof(puncs[0]); + Eina_Unicode *uni_puncs[punc_num]; EcoreIMFContextISF *context_scim; if (!ctx) return EINA_FALSE; - context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (!context_scim || !context_scim->impl) return EINA_FALSE; switch (context_scim->impl->autocapital_type) @@ -386,7 +387,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx) break; } - for (i=0; i<3; i++) + for (i = 0; i < punc_num; i++) uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL); ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos); @@ -432,7 +433,7 @@ analyze_surrounding_text(Ecore_IMF_Context *ctx) if (tail) { - for (i=0; i<3; i++) + for (i = 0; i < punc_num; i++) { if (!eina_unicode_strcmp(tail, uni_puncs[i])) { @@ -450,7 +451,7 @@ done: if (markup_str) free(markup_str); if (plain_str) free(plain_str); - for (i=0; i<3; i++) + for (i = 0; i < punc_num; i++) if (uni_puncs[i]) free(uni_puncs[i]); return ret; @@ -463,7 +464,7 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force) EcoreIMFContextISF *context_scim; if (!ctx) return; - context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (autocap_allow == EINA_FALSE) return; @@ -485,28 +486,52 @@ caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force) } static void -feed_key_event (Evas *evas, const char *str, Eina_Bool fake) +feed_key_event(Evas *evas, const char *str, Eina_Bool fake) { char key_string[128] = {0}; unsigned int timestamp = 0; if (!fake) - timestamp = get_time (); + timestamp = get_time(); - if (strncmp (str, "KeyRelease+", 11) == 0) + if (strncmp(str, "KeyRelease+", 11) == 0) { strncpy(key_string, str + 11, strlen(str)-11); - evas_event_feed_key_up (evas, key_string, key_string, NULL, NULL, timestamp, NULL); - SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up ()...\n"; + evas_event_feed_key_up(evas, key_string, key_string, NULL, NULL, timestamp, NULL); + SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up()...\n"; } else { strncpy(key_string, str, strlen(str)); - evas_event_feed_key_down (evas, key_string, key_string, NULL, NULL, timestamp, NULL); - SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down ()...\n"; + evas_event_feed_key_down(evas, key_string, key_string, NULL, NULL, timestamp, NULL); + SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down()...\n"; } } +static void +window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y) +{ + Ecore_X_Window root_window, win; + int win_x, win_y; + int sum_x = 0, sum_y = 0; + + root_window = ecore_x_window_root_get(client_win); + win = client_win; + + while (root_window != win) + { + ecore_x_window_geometry_get(win, &win_x, &win_y, NULL, NULL); + sum_x += win_x; + sum_y += win_y; + win = ecore_x_window_parent_get(win); + } + + if (x) + *x = sum_x; + if (y) + *y = sum_y; +} + /* Public functions */ /** * isf_imf_context_new @@ -517,18 +542,11 @@ feed_key_event (Evas *evas, const char *str, Eina_Bool fake) * Return value: A pointer to the newly created EcoreIMFContextISF instance */ EAPI EcoreIMFContextISF * -isf_imf_context_new (void) +isf_imf_context_new(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; char *env; - Ecore_X_Display *display = ecore_x_display_get (); - if (!display) - { - std::cerr << "ecore_x_display_get () failed !!!"; - return NULL; - } - EcoreIMFContextISF *context_scim = new EcoreIMFContextISF; if (context_scim == NULL) { @@ -540,7 +558,7 @@ isf_imf_context_new (void) if (!_scim_initialized) { - initialize (); + initialize(); _scim_initialized = true; } @@ -558,61 +576,61 @@ isf_imf_context_new (void) * cleanup job. */ EAPI void -isf_imf_context_shutdown (void) +isf_imf_context_shutdown(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (_scim_initialized) { _scim_initialized = false; - finalize (); + finalize(); } } EAPI void -isf_imf_context_add (Ecore_IMF_Context *ctx) +isf_imf_context_add(Ecore_IMF_Context *ctx) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (!context_scim) return; context_scim->impl = NULL; - if (_backend.null ()) + if (_backend.null()) return; IMEngineInstancePointer si; // Use the default instance if "shared input method" mode is enabled. - if (_shared_input_method && !_default_instance.null ()) + if (_shared_input_method && !_default_instance.null()) { si = _default_instance; - SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; + SCIM_DEBUG_FRONTEND(2) << "use default instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n"; } // Not in "shared input method" mode, or no default instance, create an instance. - if (si.null ()) + if (si.null()) { - IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); - if (factory.null ()) return; - si = factory->create_instance ("UTF-8", _instance_count++); - if (si.null ()) return; - attach_instance (si); - SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id () << " " << si->get_factory_uuid () << "\n"; + IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8"); + if (factory.null()) return; + si = factory->create_instance("UTF-8", _instance_count++); + if (si.null()) return; + attach_instance(si); + SCIM_DEBUG_FRONTEND(2) << "create new instance: " << si->get_id() << " " << si->get_factory_uuid() << "\n"; } // If "shared input method" mode is enabled, and there is no default instance, // then store this instance as default one. - if (_shared_input_method && _default_instance.null ()) + if (_shared_input_method && _default_instance.null()) { SCIM_DEBUG_FRONTEND(2) << "update default instance.\n"; _default_instance = si; } context_scim->ctx = ctx; - context_scim->impl = new_ic_impl (context_scim); + context_scim->impl = new_ic_impl(context_scim); if (context_scim->impl == NULL) { std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n"; @@ -640,24 +658,24 @@ isf_imf_context_add (Ecore_IMF_Context *ctx) _ic_list = context_scim; if (_shared_input_method) - context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); + context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); - _panel_client.prepare (context_scim->id); - _panel_client.register_input_context (context_scim->id, si->get_factory_uuid ()); - set_ic_capabilities (context_scim); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + _panel_client.register_input_context(context_scim->id, si->get_factory_uuid()); + set_ic_capabilities(context_scim); + _panel_client.send(); SCIM_DEBUG_FRONTEND(2) << "input context created: id = " << context_scim->id << "\n"; } EAPI void -isf_imf_context_del (Ecore_IMF_Context *ctx) +isf_imf_context_del(Ecore_IMF_Context *ctx) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (!_ic_list) return; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim) { @@ -682,32 +700,32 @@ isf_imf_context_del (Ecore_IMF_Context *ctx) if (context_scim && context_scim->impl) { - _panel_client.prepare (context_scim->id); + _panel_client.prepare(context_scim->id); if (context_scim == _focused_ic) - context_scim->impl->si->focus_out (); + context_scim->impl->si->focus_out(); // Delete the instance. EcoreIMFContextISF *old_focused = _focused_ic; _focused_ic = context_scim; - context_scim->impl->si.reset (); + context_scim->impl->si.reset(); _focused_ic = old_focused; if (context_scim == _focused_ic) { - _panel_client.turn_off (context_scim->id); - _panel_client.focus_out (context_scim->id); + _panel_client.turn_off(context_scim->id); + _panel_client.focus_out(context_scim->id); } - _panel_client.remove_input_context (context_scim->id); - _panel_client.send (); + _panel_client.remove_input_context(context_scim->id); + _panel_client.send(); if (context_scim->impl->client_window) - isf_imf_context_client_window_set (ctx, NULL); + isf_imf_context_client_window_set(ctx, NULL); if (context_scim->impl) { - delete_ic_impl (context_scim->impl); + delete_ic_impl(context_scim->impl); context_scim->impl = 0; } } @@ -738,11 +756,11 @@ isf_imf_context_del (Ecore_IMF_Context *ctx) * be used for purposes internal to the Input Method Context. */ EAPI void -isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas) +isf_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas) context_scim->impl->client_canvas = (Evas*)canvas; @@ -762,11 +780,11 @@ isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *canvas) * and may also be used for purposes internal to the Input Method Context. */ EAPI void -isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window) +isf_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->client_window != (Ecore_X_Window)((Ecore_Window)window)) { @@ -789,29 +807,29 @@ isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window) * to clear the preedit state. */ EAPI void -isf_imf_context_reset (Ecore_IMF_Context *ctx) +isf_imf_context_reset(Ecore_IMF_Context *ctx) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim == _focused_ic) { WideString wstr = context_scim->impl->preedit_string; - _panel_client.prepare (context_scim->id); - context_scim->impl->si->reset (); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + context_scim->impl->si->reset(); + _panel_client.send(); if (context_scim->impl->need_commit_preedit) { - if (wstr.length ()) + if (wstr.length()) { - ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); + ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str()); ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); } - _panel_client.prepare (context_scim->id); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + _panel_client.send(); } } } @@ -825,9 +843,9 @@ isf_imf_context_reset (Ecore_IMF_Context *ctx) * Notify the Input Method Context that the widget to which its correspond has gained focus. */ EAPI void -isf_imf_context_focus_in (Ecore_IMF_Context *ctx) +isf_imf_context_focus_in(Ecore_IMF_Context *ctx) { - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (!context_scim) return; @@ -839,12 +857,11 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) if (_focused_ic == context_scim) { SCIM_DEBUG_FRONTEND(1) << "It's already focused.\n"; - //isf_imf_context_cursor_position_set (ctx, 0); return; } SCIM_DEBUG_FRONTEND(1) << "Focus out previous IC first: " << _focused_ic->id << "\n"; if (_focused_ic->ctx) - isf_imf_context_focus_out (_focused_ic->ctx); + isf_imf_context_focus_out(_focused_ic->ctx); } bool need_cap = false; @@ -854,28 +871,28 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) if (context_scim && context_scim->impl) { _focused_ic = context_scim; - _panel_client.prepare (context_scim->id); + _panel_client.prepare(context_scim->id); // Handle the "Shared Input Method" mode. if (_shared_input_method) { SCIM_DEBUG_FRONTEND(2) << "shared input method.\n"; - IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); - if (!factory.null ()) + IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8"); + if (!factory.null()) { - if (_default_instance.null () || _default_instance->get_factory_uuid () != factory->get_uuid ()) + if (_default_instance.null() || _default_instance->get_factory_uuid() != factory->get_uuid()) { - _default_instance = factory->create_instance ("UTF-8", _default_instance.null () ? _instance_count++ : _default_instance->get_id ()); - attach_instance (_default_instance); - SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id () << " " << _default_instance->get_factory_uuid () << "\n"; + _default_instance = factory->create_instance("UTF-8", _default_instance.null() ? _instance_count++ : _default_instance->get_id()); + attach_instance(_default_instance); + SCIM_DEBUG_FRONTEND(2) << "create new default instance: " << _default_instance->get_id() << " " << _default_instance->get_factory_uuid() << "\n"; } context_scim->impl->shared_si = true; context_scim->impl->si = _default_instance; - context_scim->impl->is_on = _config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); - context_scim->impl->preedit_string.clear (); - context_scim->impl->preedit_attrlist.clear (); + context_scim->impl->is_on = _config->read(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), context_scim->impl->is_on); + context_scim->impl->preedit_string.clear(); + context_scim->impl->preedit_attrlist.clear(); context_scim->impl->preedit_caret = 0; context_scim->impl->preedit_started = false; need_cap = true; @@ -886,47 +903,50 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) else if (context_scim->impl->shared_si) { SCIM_DEBUG_FRONTEND(2) << "exit shared input method.\n"; - IMEngineFactoryPointer factory = _backend->get_default_factory (_language, "UTF-8"); - if (!factory.null ()) + IMEngineFactoryPointer factory = _backend->get_default_factory(_language, "UTF-8"); + if (!factory.null()) { - context_scim->impl->si = factory->create_instance ("UTF-8", _instance_count++); - context_scim->impl->preedit_string.clear (); - context_scim->impl->preedit_attrlist.clear (); + context_scim->impl->si = factory->create_instance("UTF-8", _instance_count++); + context_scim->impl->preedit_string.clear(); + context_scim->impl->preedit_attrlist.clear(); context_scim->impl->preedit_caret = 0; context_scim->impl->preedit_started = false; - attach_instance (context_scim->impl->si); + attach_instance(context_scim->impl->si); need_cap = true; need_reg = true; context_scim->impl->shared_si = false; - SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id () << " " << context_scim->impl->si->get_factory_uuid () << "\n"; + SCIM_DEBUG_FRONTEND(2) << "create new instance: " << context_scim->impl->si->get_id() << " " << context_scim->impl->si->get_factory_uuid() << "\n"; } } - context_scim->impl->si->set_frontend_data (static_cast (context_scim)); + context_scim->impl->si->set_frontend_data(static_cast (context_scim)); - if (need_reg) _panel_client.register_input_context (context_scim->id, context_scim->impl->si->get_factory_uuid ()); - if (need_cap) set_ic_capabilities (context_scim); - if (need_reset) context_scim->impl->si->reset (); + if (need_reg) _panel_client.register_input_context(context_scim->id, context_scim->impl->si->get_factory_uuid()); + if (need_cap) set_ic_capabilities(context_scim); + if (need_reset) context_scim->impl->si->reset(); - panel_req_focus_in (context_scim); - panel_req_update_spot_location (context_scim); - panel_req_update_factory_info (context_scim); + panel_req_focus_in(context_scim); + panel_req_update_spot_location(context_scim); + panel_req_update_factory_info(context_scim); if (context_scim->impl->is_on) { - _panel_client.turn_on (context_scim->id); - _panel_client.hide_preedit_string (context_scim->id); - _panel_client.hide_aux_string (context_scim->id); - _panel_client.hide_lookup_table (context_scim->id); - context_scim->impl->si->focus_in (); + _panel_client.turn_on(context_scim->id); + _panel_client.hide_preedit_string(context_scim->id); + _panel_client.hide_aux_string(context_scim->id); + _panel_client.hide_lookup_table(context_scim->id); + context_scim->impl->si->focus_in(); } else { - _panel_client.turn_off (context_scim->id); + _panel_client.turn_off(context_scim->id); } - _panel_client.send (); + _panel_client.send(); } + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_show(ctx); } /** @@ -938,9 +958,9 @@ isf_imf_context_focus_in (Ecore_IMF_Context *ctx) * Notify the Input Method Context that the widget to which its correspond has lost focus. */ EAPI void -isf_imf_context_focus_out (Ecore_IMF_Context *ctx) +isf_imf_context_focus_out(Ecore_IMF_Context *ctx) { - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (!context_scim) return; @@ -952,23 +972,26 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx) if (context_scim->impl->need_commit_preedit) { - if (wstr.length ()) + if (wstr.length()) { - ecore_imf_context_commit_event_add (context_scim->ctx, utf8_wcstombs (wstr).c_str ()); + ecore_imf_context_commit_event_add(context_scim->ctx, utf8_wcstombs(wstr).c_str()); ecore_imf_context_event_callback_call(context_scim->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); } - _panel_client.prepare (context_scim->id); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + _panel_client.send(); } - _panel_client.prepare (context_scim->id); - context_scim->impl->si->focus_out (); - context_scim->impl->si->reset (); - _panel_client.turn_off (context_scim->id); - _panel_client.focus_out (context_scim->id); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + context_scim->impl->si->focus_out(); + context_scim->impl->si->reset(); + _panel_client.turn_off(context_scim->id); + _panel_client.focus_out(context_scim->id); + _panel_client.send(); _focused_ic = 0; } + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_hide(ctx); } /** @@ -984,11 +1007,11 @@ isf_imf_context_focus_out (Ecore_IMF_Context *ctx) * Notify the Input Method Context that a change in the cursor location has been made. */ EAPI void -isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch) +isf_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int cx, int cy, int cw, int ch) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); Ecore_Evas *ee; int canvas_x, canvas_y; @@ -1001,21 +1024,28 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int if (context_scim->impl->preedit_updating) return; - if (!context_scim->impl->client_canvas) - return; - - ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); - if (!ee) return; + if (context_scim->impl->client_canvas) + { + ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); + if (!ee) return; - ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL); + ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL); + } + else + { + if (context_scim->impl->client_window) + window_to_screen_geometry_get(context_scim->impl->client_window, &canvas_x, &canvas_y); + else + return; + } if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch) { context_scim->impl->cursor_x = canvas_x + cx; context_scim->impl->cursor_y = canvas_y + cy + ch; - _panel_client.prepare (context_scim->id); - panel_req_update_spot_location (context_scim); - _panel_client.send (); + _panel_client.prepare(context_scim->id); + panel_req_update_spot_location(context_scim); + _panel_client.send(); SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n"; } } @@ -1033,11 +1063,11 @@ isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int cx, int cy, int * display feedback, such as displaying it in a child of the root window. */ EAPI void -isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit) +isf_imf_context_use_preedit_set(Ecore_IMF_Context* ctx, Eina_Bool use_preedit) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (!_on_the_spot) return; @@ -1047,36 +1077,36 @@ isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit) context_scim->impl->use_preedit = use_preedit; if (context_scim == _focused_ic) { - _panel_client.prepare (context_scim->id); + _panel_client.prepare(context_scim->id); if (old != use_preedit) - set_ic_capabilities (context_scim); + set_ic_capabilities(context_scim); - if (context_scim->impl->preedit_string.length ()) - slot_show_preedit_string (context_scim->impl->si); + if (context_scim->impl->preedit_string.length()) + slot_show_preedit_string(context_scim->impl->si); - _panel_client.send (); + _panel_client.send(); } } } EAPI void -isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos) +isf_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->is_on) { - String mbs = utf8_wcstombs (context_scim->impl->preedit_string); + String mbs = utf8_wcstombs(context_scim->impl->preedit_string); if (str) { - if (mbs.length ()) - *str = strdup (mbs.c_str ()); + if (mbs.length()) + *str = strdup(mbs.c_str()); else - *str = strdup (""); + *str = strdup(""); } if (cursor_pos) @@ -1086,28 +1116,28 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char if (attrs) { - if (mbs.length ()) + if (mbs.length()) { int start_index, end_index; - int wlen = context_scim->impl->preedit_string.length (); + int wlen = context_scim->impl->preedit_string.length(); Ecore_IMF_Preedit_Attr *attr = NULL; AttributeList::const_iterator i; - bool *attrs_flag = new bool [mbs.length ()]; - memset (attrs_flag, 0, mbs.length () *sizeof (bool)); + bool *attrs_flag = new bool [mbs.length()]; + memset(attrs_flag, 0, mbs.length() *sizeof(bool)); - for (i = context_scim->impl->preedit_attrlist.begin (); - i != context_scim->impl->preedit_attrlist.end (); ++i) + for (i = context_scim->impl->preedit_attrlist.begin(); + i != context_scim->impl->preedit_attrlist.end(); ++i) { - start_index = i->get_start (); - end_index = i->get_end (); + start_index = i->get_start(); + end_index = i->get_end(); - if (end_index <= wlen && start_index < end_index && i->get_type () != SCIM_ATTR_DECORATE_NONE) + if (end_index <= wlen && start_index < end_index && i->get_type() != SCIM_ATTR_DECORATE_NONE) { - start_index = utf8_offset_to_index (mbs.c_str (), i->get_start ()); - end_index = utf8_offset_to_index (mbs.c_str (), i->get_end ()); + start_index = utf8_offset_to_index(mbs.c_str(), i->get_start()); + end_index = utf8_offset_to_index(mbs.c_str(), i->get_end()); - if (i->get_type () == SCIM_ATTR_DECORATE) + if (i->get_type() == SCIM_ATTR_DECORATE) { attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); if (attr == NULL) @@ -1115,24 +1145,24 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char attr->start_index = start_index; attr->end_index = end_index; - if (i->get_value () == SCIM_ATTR_DECORATE_UNDERLINE) + if (i->get_value() == SCIM_ATTR_DECORATE_UNDERLINE) { attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1; *attrs = eina_list_append(*attrs, (void *)attr); } - else if (i->get_value () == SCIM_ATTR_DECORATE_REVERSE) + else if (i->get_value() == SCIM_ATTR_DECORATE_REVERSE) { attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; *attrs = eina_list_append(*attrs, (void *)attr); } - else if (i->get_value () == SCIM_ATTR_DECORATE_HIGHLIGHT) + else if (i->get_value() == SCIM_ATTR_DECORATE_HIGHLIGHT) { attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3; *attrs = eina_list_append(*attrs, (void *)attr); } else { - free (attr); + free(attr); } switch(i->get_value()) @@ -1148,11 +1178,11 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char break; } } - else if (i->get_type () == SCIM_ATTR_FOREGROUND) + else if (i->get_type() == SCIM_ATTR_FOREGROUND) { SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n"; } - else if (i->get_type () == SCIM_ATTR_BACKGROUND) + else if (i->get_type() == SCIM_ATTR_BACKGROUND) { SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n"; } @@ -1160,13 +1190,13 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char } // Add underline for all characters which don't have attribute. - for (unsigned int pos = 0; pos < mbs.length (); ++pos) + for (unsigned int pos = 0; pos < mbs.length(); ++pos) { if (!attrs_flag [pos]) { int begin_pos = pos; - while (pos < mbs.length () && !attrs_flag [pos]) + while (pos < mbs.length() && !attrs_flag[pos]) ++pos; // use REVERSE style as default @@ -1187,7 +1217,7 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char else { if (str) - *str = strdup (""); + *str = strdup(""); if (cursor_pos) *cursor_pos = 0; @@ -1208,22 +1238,22 @@ isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char * To get the preedit string of the input method. */ EAPI void -isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos) +isf_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char** str, int *cursor_pos) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->is_on) { - String mbs = utf8_wcstombs (context_scim->impl->preedit_string); + String mbs = utf8_wcstombs(context_scim->impl->preedit_string); if (str) { - if (mbs.length ()) - *str = strdup (mbs.c_str ()); + if (mbs.length()) + *str = strdup(mbs.c_str()); else - *str = strdup (""); + *str = strdup(""); } if (cursor_pos) @@ -1232,7 +1262,7 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur else { if (str) - *str = strdup (""); + *str = strdup(""); if (cursor_pos) *cursor_pos = 0; @@ -1249,11 +1279,11 @@ isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cur * Notify the Input Method Context that a change in the cursor position has been made. */ EAPI void -isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos) +isf_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim == _focused_ic) { @@ -1280,11 +1310,11 @@ isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos) * is in Ecore_IMF.h. */ EAPI void -isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) +isf_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl) context_scim->impl->input_mode = input_mode; } @@ -1299,22 +1329,22 @@ isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode inp * Set whether the IM context should use the prediction. */ EAPI void -isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction) +isf_imf_context_prediction_allow_set(Ecore_IMF_Context* ctx, Eina_Bool prediction) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (prediction ? "true" : "false") << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->prediction_allow != prediction) context_scim->impl->prediction_allow = prediction; } EAPI void -isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type) +isf_imf_context_autocapital_type_set(Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n"; - EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get(ctx); if (context_scim && context_scim->impl && context_scim->impl->autocapital_type != autocapital_type) context_scim->impl->autocapital_type = autocapital_type; @@ -1337,11 +1367,11 @@ isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapi */ EAPI Eina_Bool -isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) +isf_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); Eina_Bool ret = EINA_FALSE; if (ic == NULL || ic->impl == NULL) @@ -1352,7 +1382,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, if (type == ECORE_IMF_EVENT_KEY_DOWN) { Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; - scim_string_to_key (key, ev->key); + scim_string_to_key(key, ev->key); if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask; @@ -1362,7 +1392,7 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, else if (type == ECORE_IMF_EVENT_KEY_UP) { Ecore_IMF_Event_Key_Up *ev = (Ecore_IMF_Event_Key_Up *)event; - scim_string_to_key (key, ev->key); + scim_string_to_key(key, ev->key); key.mask = SCIM_KEY_ReleaseMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask; if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask; @@ -1377,264 +1407,290 @@ isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, key.mask &= _valid_key_mask; - _panel_client.prepare (ic->id); + _panel_client.prepare(ic->id); ret = EINA_TRUE; - if (!filter_hotkeys (ic, key)) + if (!filter_hotkeys(ic, key)) { if (!_focused_ic || !_focused_ic->impl->is_on || - !_focused_ic->impl->si->process_key_event (key)) + !_focused_ic->impl->si->process_key_event(key)) ret = EINA_FALSE; } - _panel_client.send (); + _panel_client.send(); return ret; } +EAPI void +isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); + if (ic == NULL || ic->impl == NULL) + return; + + ecore_x_e_virtual_keyboard_state_set + (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); +} + +EAPI void +isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = (EcoreIMFContextISF*)ecore_imf_context_data_get(ctx); + if (ic == NULL || ic->impl == NULL) + return; + + ecore_x_e_virtual_keyboard_state_set + (ic->impl->client_window, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); +} + /* Panel Slot functions */ static void -panel_slot_reload_config (int context __UNUSED__) +panel_slot_reload_config(int context __UNUSED__) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _config->reload (); + _config->reload(); } static void -panel_slot_exit (int /* context */) +panel_slot_exit(int /* context */) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - finalize (); + finalize(); } static void -panel_slot_update_lookup_table_page_size (int context, int page_size) +panel_slot_update_lookup_table_page_size(int context, int page_size) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " page_size=" << page_size << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->update_lookup_table_page_size (page_size); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->update_lookup_table_page_size(page_size); + _panel_client.send(); } } static void -panel_slot_lookup_table_page_up (int context) +panel_slot_lookup_table_page_up(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->lookup_table_page_up (); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->lookup_table_page_up(); + _panel_client.send(); } } static void -panel_slot_lookup_table_page_down (int context) +panel_slot_lookup_table_page_down(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->lookup_table_page_down (); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->lookup_table_page_down(); + _panel_client.send(); } } static void -panel_slot_trigger_property (int context, const String &property) +panel_slot_trigger_property(int context, const String &property) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " property=" << property << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->trigger_property (property); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->trigger_property(property); + _panel_client.send(); } } static void -panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) +panel_slot_process_helper_event(int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " target=" << target_uuid << " helper=" << helper_uuid << " ic=" << ic << " ic->impl=" << (ic ? ic->impl : 0) << " ic-uuid=" - << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid () : "" ) << "\n"; - if (ic && ic->impl && ic->impl->si->get_factory_uuid () == target_uuid) + << ((ic && ic->impl) ? ic->impl->si->get_factory_uuid() : "" ) << "\n"; + if (ic && ic->impl && ic->impl->si->get_factory_uuid() == target_uuid) { - _panel_client.prepare (ic->id); + _panel_client.prepare(ic->id); SCIM_DEBUG_FRONTEND(2) << "call process_helper_event\n"; - ic->impl->si->process_helper_event (helper_uuid, trans); - _panel_client.send (); + ic->impl->si->process_helper_event(helper_uuid, trans); + _panel_client.send(); } } static void -panel_slot_move_preedit_caret (int context, int caret_pos) +panel_slot_move_preedit_caret(int context, int caret_pos) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " caret=" << caret_pos << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->move_preedit_caret (caret_pos); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->move_preedit_caret(caret_pos); + _panel_client.send(); } } static void -panel_slot_select_candidate (int context, int cand_index) +panel_slot_select_candidate(int context, int cand_index) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " candidate=" << cand_index << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - ic->impl->si->select_candidate (cand_index); - _panel_client.send (); + _panel_client.prepare(ic->id); + ic->impl->si->select_candidate(cand_index); + _panel_client.send(); } } static void -panel_slot_process_key_event (int context, const KeyEvent &key) +panel_slot_process_key_event(int context, const KeyEvent &key) { - EcoreIMFContextISF *ic = find_ic (context); - SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; + EcoreIMFContextISF *ic = find_ic(context); + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n"; - if (ic && ic->impl && ic->impl->client_canvas) - feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE); + if (key.is_key_press()) + ecore_x_test_fake_key_press(key.get_key_string().c_str()); } static void -panel_slot_commit_string (int context, const WideString &wstr) +panel_slot_commit_string(int context, const WideString &wstr) { - EcoreIMFContextISF *ic = find_ic (context); - SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs (wstr) << " ic=" << ic << "\n"; + EcoreIMFContextISF *ic = find_ic(context); + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " str=" << utf8_wcstombs(wstr) << " ic=" << ic << "\n"; if (ic && ic->impl) { if (_focused_ic != ic) return; - ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (wstr).c_str ()); + ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(wstr).c_str()); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(wstr).c_str()); } } static void -panel_slot_forward_key_event (int context, const KeyEvent &key) +panel_slot_forward_key_event(int context, const KeyEvent &key) { - EcoreIMFContextISF *ic = find_ic (context); - SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n"; + EcoreIMFContextISF *ic = find_ic(context); + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string() << " ic=" << ic << "\n"; if (ic && ic->impl && ic->impl->client_canvas) - feed_key_event (ic->impl->client_canvas, key.get_key_string ().c_str (), EINA_TRUE); + feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_TRUE); } static void -panel_slot_request_help (int context) +panel_slot_request_help(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - panel_req_show_help (ic); - _panel_client.send (); + _panel_client.prepare(ic->id); + panel_req_show_help(ic); + _panel_client.send(); } } static void -panel_slot_request_factory_menu (int context) +panel_slot_request_factory_menu(int context) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " ic=" << ic << "\n"; if (ic && ic->impl) { - _panel_client.prepare (ic->id); - panel_req_show_factory_menu (ic); - _panel_client.send (); + _panel_client.prepare(ic->id); + panel_req_show_factory_menu(ic); + _panel_client.send(); } } static void -panel_slot_change_factory (int context, const String &uuid) +panel_slot_change_factory(int context, const String &uuid) { - EcoreIMFContextISF *ic = find_ic (context); + EcoreIMFContextISF *ic = find_ic(context); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " factory=" << uuid << " ic=" << ic << "\n"; if (ic && ic->impl) { - ic->impl->si->reset (); - _panel_client.prepare (ic->id); - open_specific_factory (ic, uuid); - _panel_client.send (); + ic->impl->si->reset(); + _panel_client.prepare(ic->id); + open_specific_factory(ic, uuid); + _panel_client.send(); } } /* Panel Requestion functions. */ static void -panel_req_show_help (EcoreIMFContextISF *ic) +panel_req_show_help(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; String help; - help = String ("Smart Common Input Method platform ") + - //String (SCIM_VERSION) + - String ("\n(C) 2002-2005 James Su \n\n"); + help = String("Smart Common Input Method platform ") + + //String(SCIM_VERSION) + + String("\n(C) 2002-2005 James Su \n\n"); if (ic && ic->impl) { - IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid()); if (sf) { - help += utf8_wcstombs (sf->get_name ()); - help += String (":\n\n"); + help += utf8_wcstombs(sf->get_name()); + help += String(":\n\n"); - help += utf8_wcstombs (sf->get_help ()); - help += String ("\n\n"); + help += utf8_wcstombs(sf->get_help()); + help += String("\n\n"); - help += utf8_wcstombs (sf->get_credits ()); + help += utf8_wcstombs(sf->get_credits()); } - _panel_client.show_help (ic->id, help); + _panel_client.show_help(ic->id, help); } } static void -panel_req_show_factory_menu (EcoreIMFContextISF *ic) +panel_req_show_factory_menu(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; std::vector factories; std::vector menu; - _backend->get_factories_for_encoding (factories, "UTF-8"); + _backend->get_factories_for_encoding(factories, "UTF-8"); - for (size_t i = 0; i < factories.size (); ++ i) + for (size_t i = 0; i < factories.size(); ++ i) { - menu.push_back (PanelFactoryInfo ( - factories [i]->get_uuid (), - utf8_wcstombs (factories [i]->get_name ()), - factories [i]->get_language (), - factories [i]->get_icon_file ())); + menu.push_back(PanelFactoryInfo( + factories [i]->get_uuid(), + utf8_wcstombs(factories [i]->get_name()), + factories [i]->get_language(), + factories [i]->get_icon_file())); } - if (menu.size ()) - _panel_client.show_factory_menu (ic->id, menu); + if (menu.size()) + _panel_client.show_factory_menu(ic->id, menu); } static void -panel_req_update_factory_info (EcoreIMFContextISF *ic) +panel_req_update_factory_info(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1643,160 +1699,160 @@ panel_req_update_factory_info (EcoreIMFContextISF *ic) PanelFactoryInfo info; if (ic->impl->is_on) { - IMEngineFactoryPointer sf = _backend->get_factory (ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_factory(ic->impl->si->get_factory_uuid()); if (sf) - info = PanelFactoryInfo (sf->get_uuid (), utf8_wcstombs (sf->get_name ()), sf->get_language (), sf->get_icon_file ()); + info = PanelFactoryInfo(sf->get_uuid(), utf8_wcstombs(sf->get_name()), sf->get_language(), sf->get_icon_file()); } else { - info = PanelFactoryInfo (String (""), String ("English/Keyboard"), String ("C"), ""); + info = PanelFactoryInfo(String(""), String("English/Keyboard"), String("C"), ""); } - _panel_client.update_factory_info (ic->id, info); + _panel_client.update_factory_info(ic->id, info); } } static void -panel_req_focus_in (EcoreIMFContextISF *ic) +panel_req_focus_in(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ()); + _panel_client.focus_in(ic->id, ic->impl->si->get_factory_uuid()); } static void -panel_req_update_spot_location (EcoreIMFContextISF *ic) +panel_req_update_spot_location(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _panel_client.update_spot_location (ic->id, ic->impl->cursor_x, ic->impl->cursor_y); + _panel_client.update_spot_location(ic->id, ic->impl->cursor_x, ic->impl->cursor_y); } static bool -filter_hotkeys (EcoreIMFContextISF *ic, const KeyEvent &key) +filter_hotkeys(EcoreIMFContextISF *ic, const KeyEvent &key) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; bool ret = false; - _frontend_hotkey_matcher.push_key_event (key); - _imengine_hotkey_matcher.push_key_event (key); + _frontend_hotkey_matcher.push_key_event(key); + _imengine_hotkey_matcher.push_key_event(key); - FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result (); + FrontEndHotkeyAction hotkey_action = _frontend_hotkey_matcher.get_match_result(); if (hotkey_action == SCIM_FRONTEND_HOTKEY_TRIGGER) { if (!ic->impl->is_on) - turn_on_ic (ic); + turn_on_ic(ic); else - turn_off_ic (ic); + turn_off_ic(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) { if (!ic->impl->is_on) - turn_on_ic (ic); + turn_on_ic(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF) { if (ic->impl->is_on) - turn_off_ic (ic); + turn_off_ic(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY) { - open_next_factory (ic); + open_next_factory(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY) { - open_previous_factory (ic); + open_previous_factory(ic); ret = true; } else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU) { - panel_req_show_factory_menu (ic); + panel_req_show_factory_menu(ic); ret = true; } - else if (_imengine_hotkey_matcher.is_matched ()) + else if (_imengine_hotkey_matcher.is_matched()) { - String sfid = _imengine_hotkey_matcher.get_match_result (); - open_specific_factory (ic, sfid); + String sfid = _imengine_hotkey_matcher.get_match_result(); + open_specific_factory(ic, sfid); ret = true; } return ret; } static bool -panel_initialize (void) +panel_initialize(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; String display_name; { - const char *p = getenv ("DISPLAY"); - if (p) display_name = String (p); + const char *p = getenv("DISPLAY"); + if (p) display_name = String(p); } - if (_panel_client.open_connection (_config->get_name (), display_name) >= 0) + if (_panel_client.open_connection(_config->get_name(), display_name) >= 0) { - int fd = _panel_client.get_connection_number (); + int fd = _panel_client.get_connection_number(); - _panel_iochannel_read_handler = ecore_main_fd_handler_add (fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL); + _panel_iochannel_read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, panel_iochannel_handler, NULL, NULL, NULL); SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n"; return true; } - std::cerr << "panel_initialize () failed!!!\n"; + std::cerr << "panel_initialize() failed!!!\n"; return false; } static void -panel_finalize (void) +panel_finalize(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _panel_client.close_connection (); + _panel_client.close_connection(); if (_panel_iochannel_read_handler) { - ecore_main_fd_handler_del (_panel_iochannel_read_handler); + ecore_main_fd_handler_del(_panel_iochannel_read_handler); _panel_iochannel_read_handler = 0; } if (_panel_iochannel_err_handler) { - ecore_main_fd_handler_del (_panel_iochannel_err_handler); + ecore_main_fd_handler_del(_panel_iochannel_err_handler); _panel_iochannel_err_handler = 0; } } static Eina_Bool -panel_iochannel_handler (void *data __UNUSED__, Ecore_Fd_Handler *fd_handler) +panel_iochannel_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (fd_handler == _panel_iochannel_read_handler) { - if (!_panel_client.filter_event ()) + if (!_panel_client.filter_event()) { - panel_finalize (); - panel_initialize (); + panel_finalize(); + panel_initialize(); return ECORE_CALLBACK_CANCEL; } } else if (fd_handler == _panel_iochannel_err_handler) { - panel_finalize (); - panel_initialize (); + panel_finalize(); + panel_initialize(); return ECORE_CALLBACK_CANCEL; } return ECORE_CALLBACK_RENEW; } static void -turn_on_ic (EcoreIMFContextISF *ic) +turn_on_ic(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1806,25 +1862,25 @@ turn_on_ic (EcoreIMFContextISF *ic) if (ic == _focused_ic) { - panel_req_focus_in (ic); - panel_req_update_spot_location (ic); - panel_req_update_factory_info (ic); - _panel_client.turn_on (ic->id); - _panel_client.hide_preedit_string (ic->id); - _panel_client.hide_aux_string (ic->id); - _panel_client.hide_lookup_table (ic->id); - ic->impl->si->focus_in (); + panel_req_focus_in(ic); + panel_req_update_spot_location(ic); + panel_req_update_factory_info(ic); + _panel_client.turn_on(ic->id); + _panel_client.hide_preedit_string(ic->id); + _panel_client.hide_aux_string(ic->id); + _panel_client.hide_lookup_table(ic->id); + ic->impl->si->focus_in(); } //Record the IC on/off status if (_shared_input_method) - _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); + _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); - if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + if (ic->impl->use_preedit && ic->impl->preedit_string.length()) { - ecore_imf_context_preedit_start_event_add (ic->ctx); + ecore_imf_context_preedit_start_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); ic->impl->preedit_started = true; } @@ -1832,7 +1888,7 @@ turn_on_ic (EcoreIMFContextISF *ic) } static void -turn_off_ic (EcoreIMFContextISF *ic) +turn_off_ic(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1842,21 +1898,21 @@ turn_off_ic (EcoreIMFContextISF *ic) if (ic == _focused_ic) { - ic->impl->si->focus_out (); + ic->impl->si->focus_out(); - panel_req_update_factory_info (ic); - _panel_client.turn_off (ic->id); + panel_req_update_factory_info(ic); + _panel_client.turn_off(ic->id); } //Record the IC on/off status if (_shared_input_method) - _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); + _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); - if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + if (ic->impl->use_preedit && ic->impl->preedit_string.length()) { - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); - ecore_imf_context_preedit_end_event_add (ic->ctx); + ecore_imf_context_preedit_end_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); ic->impl->preedit_started = false; } @@ -1864,7 +1920,7 @@ turn_off_ic (EcoreIMFContextISF *ic) } static void -set_ic_capabilities (EcoreIMFContextISF *ic) +set_ic_capabilities(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1875,12 +1931,12 @@ set_ic_capabilities (EcoreIMFContextISF *ic) if (!_on_the_spot || !ic->impl->use_preedit) cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT; - ic->impl->si->update_client_capabilities (cap); + ic->impl->si->update_client_capabilities(cap); } } static bool -check_socket_frontend (void) +check_socket_frontend(void) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -1889,23 +1945,23 @@ check_socket_frontend (void) uint32 magic; - address.set_address (scim_get_default_socket_frontend_address ()); + address.set_address(scim_get_default_socket_frontend_address()); - if (!client.connect (address)) + if (!client.connect(address)) return false; - if (!scim_socket_open_connection (magic, - String ("ConnectionTester"), - String ("SocketFrontEnd"), - client, - 1000)) + if (!scim_socket_open_connection(magic, + String("ConnectionTester"), + String("SocketFrontEnd"), + client, + 1000)) return false; return true; } void -initialize (void) +initialize(void) { std::vector config_list; std::vector engine_list; @@ -1924,31 +1980,31 @@ initialize (void) SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n"; // Get system language. - _language = scim_get_locale_language (scim_get_current_locale ()); + _language = scim_get_locale_language(scim_get_current_locale()); if (socket) { // If no Socket FrontEnd is running, then launch one. // And set manual to false. - bool check_result = check_socket_frontend (); + bool check_result = check_socket_frontend(); if (!check_result) { std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n"; //get modules list - scim_get_imengine_module_list (engine_list); + scim_get_imengine_module_list(engine_list); - for (it = engine_list.begin (); it != engine_list.end (); it++) + for (it = engine_list.begin(); it != engine_list.end(); it++) { if (*it != "socket") - load_engine_list.push_back (*it); + load_engine_list.push_back(*it); } const char *new_argv [] = { "--no-stay", 0 }; - scim_launch (true, - config_module_name, - (load_engine_list.size () ? scim_combine_string_list (load_engine_list, ',') : "none"), - "socket", - (char **)new_argv); + scim_launch(true, + config_module_name, + (load_engine_list.size() ? scim_combine_string_list(load_engine_list, ',') : "none"), + "socket", + (char **)new_argv); manual = false; } @@ -1961,12 +2017,12 @@ initialize (void) if (check_result) { config_module_name = "socket"; - load_engine_list.clear (); - load_engine_list.push_back ("socket"); + load_engine_list.clear(); + load_engine_list.push_back("socket"); break; } - scim_usleep (50000); - check_result = check_socket_frontend (); + scim_usleep(50000); + check_result = check_socket_frontend(); } } } @@ -1975,69 +2031,69 @@ initialize (void) { //load config module SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n"; - _config_module = new ConfigModule (config_module_name); + _config_module = new ConfigModule(config_module_name); //create config instance - if (_config_module != NULL && _config_module->valid ()) - _config = _config_module->create_config (); + if (_config_module != NULL && _config_module->valid()) + _config = _config_module->create_config(); } - if (_config.null ()) + if (_config.null()) { SCIM_DEBUG_FRONTEND(1) << "Config module cannot be loaded, using dummy Config.\n"; if (_config_module) delete _config_module; _config_module = NULL; - _config = new DummyConfig (); + _config = new DummyConfig(); config_module_name = "dummy"; } - reload_config_callback (_config); - _config->signal_connect_reload (slot (reload_config_callback)); + reload_config_callback(_config); + _config->signal_connect_reload(slot(reload_config_callback)); // create backend - _backend = new CommonBackEnd (_config, load_engine_list.size () ? load_engine_list : engine_list); + _backend = new CommonBackEnd(_config, load_engine_list.size() ? load_engine_list : engine_list); - if (_backend.null ()) + if (_backend.null()) std::cerr << "Cannot create BackEnd Object!\n"; else - _fallback_factory = _backend->get_factory (SCIM_COMPOSE_KEY_FACTORY_UUID); + _fallback_factory = _backend->get_factory(SCIM_COMPOSE_KEY_FACTORY_UUID); - if (_fallback_factory.null ()) - _fallback_factory = new DummyIMEngineFactory (); + if (_fallback_factory.null()) + _fallback_factory = new DummyIMEngineFactory(); - _fallback_instance = _fallback_factory->create_instance (String ("UTF-8"), 0); - _fallback_instance->signal_connect_commit_string (slot (fallback_commit_string_cb)); + _fallback_instance = _fallback_factory->create_instance(String("UTF-8"), 0); + _fallback_instance->signal_connect_commit_string(slot(fallback_commit_string_cb)); // Attach Panel Client signal. - _panel_client.signal_connect_reload_config (slot (panel_slot_reload_config)); - _panel_client.signal_connect_exit (slot (panel_slot_exit)); - _panel_client.signal_connect_update_lookup_table_page_size (slot (panel_slot_update_lookup_table_page_size)); - _panel_client.signal_connect_lookup_table_page_up (slot (panel_slot_lookup_table_page_up)); - _panel_client.signal_connect_lookup_table_page_down (slot (panel_slot_lookup_table_page_down)); - _panel_client.signal_connect_trigger_property (slot (panel_slot_trigger_property)); - _panel_client.signal_connect_process_helper_event (slot (panel_slot_process_helper_event)); - _panel_client.signal_connect_move_preedit_caret (slot (panel_slot_move_preedit_caret)); - _panel_client.signal_connect_select_candidate (slot (panel_slot_select_candidate)); - _panel_client.signal_connect_process_key_event (slot (panel_slot_process_key_event)); - _panel_client.signal_connect_commit_string (slot (panel_slot_commit_string)); - _panel_client.signal_connect_forward_key_event (slot (panel_slot_forward_key_event)); - _panel_client.signal_connect_request_help (slot (panel_slot_request_help)); - _panel_client.signal_connect_request_factory_menu (slot (panel_slot_request_factory_menu)); - _panel_client.signal_connect_change_factory (slot (panel_slot_change_factory)); - - if (!panel_initialize ()) + _panel_client.signal_connect_reload_config (slot(panel_slot_reload_config)); + _panel_client.signal_connect_exit (slot(panel_slot_exit)); + _panel_client.signal_connect_update_lookup_table_page_size(slot(panel_slot_update_lookup_table_page_size)); + _panel_client.signal_connect_lookup_table_page_up (slot(panel_slot_lookup_table_page_up)); + _panel_client.signal_connect_lookup_table_page_down (slot(panel_slot_lookup_table_page_down)); + _panel_client.signal_connect_trigger_property (slot(panel_slot_trigger_property)); + _panel_client.signal_connect_process_helper_event (slot(panel_slot_process_helper_event)); + _panel_client.signal_connect_move_preedit_caret (slot(panel_slot_move_preedit_caret)); + _panel_client.signal_connect_select_candidate (slot(panel_slot_select_candidate)); + _panel_client.signal_connect_process_key_event (slot(panel_slot_process_key_event)); + _panel_client.signal_connect_commit_string (slot(panel_slot_commit_string)); + _panel_client.signal_connect_forward_key_event (slot(panel_slot_forward_key_event)); + _panel_client.signal_connect_request_help (slot(panel_slot_request_help)); + _panel_client.signal_connect_request_factory_menu (slot(panel_slot_request_factory_menu)); + _panel_client.signal_connect_change_factory (slot(panel_slot_change_factory)); + + if (!panel_initialize()) std::cerr << "Ecore IM Module: Cannot connect to Panel!\n"; } static void -finalize (void) +finalize(void) { SCIM_DEBUG_FRONTEND(1) << "Finalizing Ecore ISF IMModule...\n"; // Reset this first so that the shared instance could be released correctly afterwards. - _default_instance.reset (); + _default_instance.reset(); SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n"; while (_used_ic_impl_list) @@ -2045,20 +2101,20 @@ finalize (void) // In case in "shared input method" mode, // all contexts share only one instance, // so we need point the reference pointer correctly before finalizing. - _used_ic_impl_list->si->set_frontend_data (static_cast (_used_ic_impl_list->parent)); - isf_imf_context_del (_used_ic_impl_list->parent->ctx); + _used_ic_impl_list->si->set_frontend_data(static_cast (_used_ic_impl_list->parent)); + isf_imf_context_del(_used_ic_impl_list->parent->ctx); } - delete_all_ic_impl (); + delete_all_ic_impl(); - _fallback_instance.reset (); - _fallback_factory.reset (); + _fallback_instance.reset(); + _fallback_factory.reset(); SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n"; - _backend.reset (); + _backend.reset(); SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n"; - _config.reset (); + _config.reset(); if (_config_module) { @@ -2072,27 +2128,27 @@ finalize (void) _scim_initialized = false; - panel_finalize (); + panel_finalize(); } static void -open_next_factory (EcoreIMFContextISF *ic) +open_next_factory(EcoreIMFContextISF *ic) { SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; - IMEngineFactoryPointer sf = _backend->get_next_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_next_factory("", "UTF-8", ic->impl->si->get_factory_uuid()); - if (!sf.null ()) + if (!sf.null()) { - turn_off_ic (ic); - ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); - ic->impl->si->set_frontend_data (static_cast (ic)); - ic->impl->preedit_string = WideString (); + turn_off_ic(ic); + ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id()); + ic->impl->si->set_frontend_data(static_cast (ic)); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - attach_instance (ic->impl->si); - _backend->set_default_factory (_language, sf->get_uuid ()); - _panel_client.register_input_context (ic->id, sf->get_uuid ()); - set_ic_capabilities (ic); - turn_on_ic (ic); + attach_instance(ic->impl->si); + _backend->set_default_factory(_language, sf->get_uuid()); + _panel_client.register_input_context(ic->id, sf->get_uuid()); + set_ic_capabilities(ic); + turn_on_ic(ic); if (_shared_input_method) { @@ -2103,26 +2159,26 @@ open_next_factory (EcoreIMFContextISF *ic) } static void -open_previous_factory (EcoreIMFContextISF *ic) +open_previous_factory(EcoreIMFContextISF *ic) { if (ic == NULL) return; SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; - IMEngineFactoryPointer sf = _backend->get_previous_factory ("", "UTF-8", ic->impl->si->get_factory_uuid ()); + IMEngineFactoryPointer sf = _backend->get_previous_factory("", "UTF-8", ic->impl->si->get_factory_uuid()); - if (!sf.null ()) + if (!sf.null()) { - turn_off_ic (ic); - ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); - ic->impl->si->set_frontend_data (static_cast (ic)); - ic->impl->preedit_string = WideString (); + turn_off_ic(ic); + ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id()); + ic->impl->si->set_frontend_data(static_cast (ic)); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - attach_instance (ic->impl->si); - _backend->set_default_factory (_language, sf->get_uuid ()); - _panel_client.register_input_context (ic->id, sf->get_uuid ()); - set_ic_capabilities (ic); - turn_on_ic (ic); + attach_instance(ic->impl->si); + _backend->set_default_factory(_language, sf->get_uuid()); + _panel_client.register_input_context(ic->id, sf->get_uuid()); + set_ic_capabilities(ic); + turn_on_ic(ic); if (_shared_input_method) { @@ -2133,7 +2189,7 @@ open_previous_factory (EcoreIMFContextISF *ic) } static void -open_specific_factory (EcoreIMFContextISF *ic, +open_specific_factory(EcoreIMFContextISF *ic, const String &uuid) { if (ic == NULL) @@ -2142,26 +2198,26 @@ open_specific_factory (EcoreIMFContextISF *ic, SCIM_DEBUG_FRONTEND(2) << __FUNCTION__ << " context=" << ic->id << "\n"; // The same input method is selected, just turn on the IC. - if (ic->impl->si->get_factory_uuid () == uuid) + if (ic->impl->si->get_factory_uuid() == uuid) { - turn_on_ic (ic); + turn_on_ic(ic); return; } - IMEngineFactoryPointer sf = _backend->get_factory (uuid); + IMEngineFactoryPointer sf = _backend->get_factory(uuid); - if (uuid.length () && !sf.null ()) + if (uuid.length() && !sf.null()) { - turn_off_ic (ic); - ic->impl->si = sf->create_instance ("UTF-8", ic->impl->si->get_id ()); - ic->impl->si->set_frontend_data (static_cast (ic)); - ic->impl->preedit_string = WideString (); + turn_off_ic(ic); + ic->impl->si = sf->create_instance("UTF-8", ic->impl->si->get_id()); + ic->impl->si->set_frontend_data(static_cast (ic)); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - attach_instance (ic->impl->si); - _backend->set_default_factory (_language, sf->get_uuid ()); - _panel_client.register_input_context (ic->id, sf->get_uuid ()); - set_ic_capabilities (ic); - turn_on_ic (ic); + attach_instance(ic->impl->si); + _backend->set_default_factory(_language, sf->get_uuid()); + _panel_client.register_input_context(ic->id, sf->get_uuid()); + set_ic_capabilities(ic); + turn_on_ic(ic); if (_shared_input_method) { @@ -2171,29 +2227,29 @@ open_specific_factory (EcoreIMFContextISF *ic, } else { - // turn_off_ic comment out panel_req_update_factory_info () - turn_off_ic (ic); + // turn_off_ic comment out panel_req_update_factory_info() + turn_off_ic(ic); if (ic && ic->impl->is_on) { ic->impl->is_on = false; if (ic == _focused_ic) { - ic->impl->si->focus_out (); + ic->impl->si->focus_out(); - panel_req_update_factory_info (ic); - _panel_client.turn_off (ic->id); + panel_req_update_factory_info(ic); + _panel_client.turn_off(ic->id); } //Record the IC on/off status if (_shared_input_method) - _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); + _config->write(String(SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), false); - if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + if (ic->impl->use_preedit && ic->impl->preedit_string.length()) { - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); - ecore_imf_context_preedit_end_event_add (ic->ctx); + ecore_imf_context_preedit_end_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); ic->impl->preedit_started = false; } @@ -2201,7 +2257,7 @@ open_specific_factory (EcoreIMFContextISF *ic, } } -static void initialize_modifier_bits (Display *display) +static void initialize_modifier_bits(Display *display) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -2222,21 +2278,21 @@ static void initialize_modifier_bits (Display *display) XModifierKeymap *mods = NULL; - ::KeyCode ctrl_l = XKeysymToKeycode (display, XK_Control_L); - ::KeyCode ctrl_r = XKeysymToKeycode (display, XK_Control_R); - ::KeyCode meta_l = XKeysymToKeycode (display, XK_Meta_L); - ::KeyCode meta_r = XKeysymToKeycode (display, XK_Meta_R); - ::KeyCode alt_l = XKeysymToKeycode (display, XK_Alt_L); - ::KeyCode alt_r = XKeysymToKeycode (display, XK_Alt_R); - ::KeyCode super_l = XKeysymToKeycode (display, XK_Super_L); - ::KeyCode super_r = XKeysymToKeycode (display, XK_Super_R); - ::KeyCode hyper_l = XKeysymToKeycode (display, XK_Hyper_L); - ::KeyCode hyper_r = XKeysymToKeycode (display, XK_Hyper_R); - ::KeyCode numlock = XKeysymToKeycode (display, XK_Num_Lock); + ::KeyCode ctrl_l = XKeysymToKeycode(display, XK_Control_L); + ::KeyCode ctrl_r = XKeysymToKeycode(display, XK_Control_R); + ::KeyCode meta_l = XKeysymToKeycode(display, XK_Meta_L); + ::KeyCode meta_r = XKeysymToKeycode(display, XK_Meta_R); + ::KeyCode alt_l = XKeysymToKeycode(display, XK_Alt_L); + ::KeyCode alt_r = XKeysymToKeycode(display, XK_Alt_R); + ::KeyCode super_l = XKeysymToKeycode(display, XK_Super_L); + ::KeyCode super_r = XKeysymToKeycode(display, XK_Super_R); + ::KeyCode hyper_l = XKeysymToKeycode(display, XK_Hyper_L); + ::KeyCode hyper_r = XKeysymToKeycode(display, XK_Hyper_R); + ::KeyCode numlock = XKeysymToKeycode(display, XK_Num_Lock); int i, j; - mods = XGetModifierMapping (display); + mods = XGetModifierMapping(display); if (mods == NULL) return; @@ -2283,13 +2339,13 @@ static void initialize_modifier_bits (Display *display) xkey.same_screen = False; xkey.subwindow = None; xkey.window = None; - xkey.root = DefaultRootWindow (display); + xkey.root = DefaultRootWindow(display); xkey.state = ShiftMask; xkey.keycode = meta_l; - XLookupString (&xkey, buf, 32, &keysym_l, 0); + XLookupString(&xkey, buf, 32, &keysym_l, 0); xkey.keycode = meta_r; - XLookupString (&xkey, buf, 32, &keysym_r, 0); + XLookupString(&xkey, buf, 32, &keysym_r, 0); if ((meta_l == alt_l && keysym_l == XK_Meta_L) || (meta_r == alt_r && keysym_r == XK_Meta_R)) __current_meta_mask = ShiftMask + __current_alt_mask; @@ -2297,16 +2353,16 @@ static void initialize_modifier_bits (Display *display) __current_meta_mask = ShiftMask + ControlMask; } - XFreeModifiermap (mods); + XFreeModifiermap(mods); } -static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask) +static unsigned int scim_x11_keymask_scim_to_x11(Display *display, uint16 scimkeymask) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; unsigned int state = 0; - initialize_modifier_bits (display); + initialize_modifier_bits(display); if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask; if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask; @@ -2320,9 +2376,9 @@ static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimk return state; } -static XKeyEvent createKeyEvent (Display *display, Window &win, - Window &winRoot, bool press, - int keycode, int modifiers) +static XKeyEvent createKeyEvent(Display *display, Window &win, + Window &winRoot, bool press, + int keycode, int modifiers) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; @@ -2339,7 +2395,7 @@ static XKeyEvent createKeyEvent (Display *display, Window &win, event.y_root = 1; event.same_screen = EINA_TRUE; event.state = modifiers; - event.keycode = XKeysymToKeycode (display, keycode); + event.keycode = XKeysymToKeycode(display, keycode); if (press) event.type = KeyPress; else @@ -2350,12 +2406,12 @@ static XKeyEvent createKeyEvent (Display *display, Window &win, return event; } -static void _x_send_key_event (const KeyEvent &key) +static void _x_send_key_event(const KeyEvent &key) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; // Obtain the X11 display. - Display *display = XOpenDisplay (NULL); + Display *display = XOpenDisplay(NULL); if (display == NULL) { std::cerr << "XOpenDisplay failed\n"; @@ -2363,98 +2419,98 @@ static void _x_send_key_event (const KeyEvent &key) } // Get the root window for the current display. - Window winRoot = 0;// = XRootWindow (display, 1); + Window winRoot = 0; // Find the window which has the current keyboard focus. Window winFocus = 0; int revert = RevertToParent; - XGetInputFocus (display, &winFocus, &revert); + XGetInputFocus(display, &winFocus, &revert); // Send a fake key press event to the window. - XSelectInput (display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); - XMapWindow (display, winFocus); + XSelectInput(display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); + XMapWindow(display, winFocus); - unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask); + unsigned int modifier = scim_x11_keymask_scim_to_x11(display, key.mask); XKeyEvent event; - if (key.is_key_press ()) + if (key.is_key_press()) { - event = createKeyEvent (display, winFocus, winRoot, true, key.code, modifier); - XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event); + event = createKeyEvent(display, winFocus, winRoot, true, key.code, modifier); + XSendEvent(event.display, event.window, True, KeyPressMask, (XEvent *)&event); } else { - event = createKeyEvent (display, winFocus, winRoot, false, key.code, modifier); - XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event); + event = createKeyEvent(display, winFocus, winRoot, false, key.code, modifier); + XSendEvent(event.display, event.window, True, KeyReleaseMask, (XEvent *)&event); } - XCloseDisplay (display); + XCloseDisplay(display); } static void -attach_instance (const IMEngineInstancePointer &si) +attach_instance(const IMEngineInstancePointer &si) { - si->signal_connect_show_preedit_string ( - slot (slot_show_preedit_string)); - si->signal_connect_show_aux_string ( - slot (slot_show_aux_string)); - si->signal_connect_show_lookup_table ( - slot (slot_show_lookup_table)); + si->signal_connect_show_preedit_string( + slot(slot_show_preedit_string)); + si->signal_connect_show_aux_string( + slot(slot_show_aux_string)); + si->signal_connect_show_lookup_table( + slot(slot_show_lookup_table)); - si->signal_connect_hide_preedit_string ( - slot (slot_hide_preedit_string)); - si->signal_connect_hide_aux_string ( - slot (slot_hide_aux_string)); - si->signal_connect_hide_lookup_table ( - slot (slot_hide_lookup_table)); + si->signal_connect_hide_preedit_string( + slot(slot_hide_preedit_string)); + si->signal_connect_hide_aux_string( + slot(slot_hide_aux_string)); + si->signal_connect_hide_lookup_table( + slot(slot_hide_lookup_table)); - si->signal_connect_update_preedit_caret ( - slot (slot_update_preedit_caret)); - si->signal_connect_update_preedit_string ( - slot (slot_update_preedit_string)); - si->signal_connect_update_aux_string ( - slot (slot_update_aux_string)); - si->signal_connect_update_lookup_table ( - slot (slot_update_lookup_table)); + si->signal_connect_update_preedit_caret( + slot(slot_update_preedit_caret)); + si->signal_connect_update_preedit_string( + slot(slot_update_preedit_string)); + si->signal_connect_update_aux_string( + slot(slot_update_aux_string)); + si->signal_connect_update_lookup_table( + slot(slot_update_lookup_table)); - si->signal_connect_commit_string ( - slot (slot_commit_string)); + si->signal_connect_commit_string( + slot(slot_commit_string)); - si->signal_connect_forward_key_event ( - slot (slot_forward_key_event)); + si->signal_connect_forward_key_event( + slot(slot_forward_key_event)); - si->signal_connect_register_properties ( - slot (slot_register_properties)); + si->signal_connect_register_properties( + slot(slot_register_properties)); - si->signal_connect_update_property ( - slot (slot_update_property)); + si->signal_connect_update_property( + slot(slot_update_property)); - si->signal_connect_beep ( - slot (slot_beep)); + si->signal_connect_beep( + slot(slot_beep)); - si->signal_connect_start_helper ( - slot (slot_start_helper)); + si->signal_connect_start_helper( + slot(slot_start_helper)); - si->signal_connect_stop_helper ( - slot (slot_stop_helper)); + si->signal_connect_stop_helper( + slot(slot_stop_helper)); - si->signal_connect_send_helper_event ( - slot (slot_send_helper_event)); + si->signal_connect_send_helper_event( + slot(slot_send_helper_event)); - si->signal_connect_get_surrounding_text ( - slot (slot_get_surrounding_text)); + si->signal_connect_get_surrounding_text( + slot(slot_get_surrounding_text)); - si->signal_connect_delete_surrounding_text ( - slot (slot_delete_surrounding_text)); + si->signal_connect_delete_surrounding_text( + slot(slot_delete_surrounding_text)); } // Implementation of slot functions static void -slot_show_preedit_string (IMEngineInstanceBase *si) +slot_show_preedit_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { @@ -2462,102 +2518,102 @@ slot_show_preedit_string (IMEngineInstanceBase *si) { if (!ic->impl->preedit_started) { - ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); + ecore_imf_context_preedit_start_event_add(_focused_ic->ctx); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); ic->impl->preedit_started = true; } } else - _panel_client.show_preedit_string (ic->id); + _panel_client.show_preedit_string(ic->id); } } static void -slot_show_aux_string (IMEngineInstanceBase *si) +slot_show_aux_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.show_aux_string (ic->id); + _panel_client.show_aux_string(ic->id); } static void -slot_show_lookup_table (IMEngineInstanceBase *si) +slot_show_lookup_table(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.show_lookup_table (ic->id); + _panel_client.show_lookup_table(ic->id); } static void -slot_hide_preedit_string (IMEngineInstanceBase *si) +slot_hide_preedit_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { bool emit = false; - if (ic->impl->preedit_string.length ()) + if (ic->impl->preedit_string.length()) { - ic->impl->preedit_string = WideString (); + ic->impl->preedit_string = WideString(); ic->impl->preedit_caret = 0; - ic->impl->preedit_attrlist.clear (); + ic->impl->preedit_attrlist.clear(); emit = true; } if (ic->impl->use_preedit) { if (emit) { - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } if (ic->impl->preedit_started) { - ecore_imf_context_preedit_end_event_add (ic->ctx); + ecore_imf_context_preedit_end_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); ic->impl->preedit_started = false; } } else - _panel_client.hide_preedit_string (ic->id); + _panel_client.hide_preedit_string(ic->id); } } static void -slot_hide_aux_string (IMEngineInstanceBase *si) +slot_hide_aux_string(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.hide_aux_string (ic->id); + _panel_client.hide_aux_string(ic->id); } static void -slot_hide_lookup_table (IMEngineInstanceBase *si) +slot_hide_lookup_table(IMEngineInstanceBase *si) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.hide_lookup_table (ic->id); + _panel_client.hide_lookup_table(ic->id); } static void -slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) +slot_update_preedit_caret(IMEngineInstanceBase *si, int caret) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) { @@ -2566,28 +2622,28 @@ slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) { if (!ic->impl->preedit_started) { - ecore_imf_context_preedit_start_event_add (ic->ctx); + ecore_imf_context_preedit_start_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); ic->impl->preedit_started = true; } - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } else - _panel_client.update_preedit_caret (ic->id, caret); + _panel_client.update_preedit_caret(ic->id, caret); } } static void -slot_update_preedit_string (IMEngineInstanceBase *si, +slot_update_preedit_string(IMEngineInstanceBase *si, const WideString & str, const AttributeList & attrs) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); - if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ())) + if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length())) { ic->impl->preedit_string = str; ic->impl->preedit_attrlist = attrs; @@ -2595,178 +2651,178 @@ slot_update_preedit_string (IMEngineInstanceBase *si, { if (!ic->impl->preedit_started) { - ecore_imf_context_preedit_start_event_add (_focused_ic->ctx); + ecore_imf_context_preedit_start_event_add(_focused_ic->ctx); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); ic->impl->preedit_started = true; } - ic->impl->preedit_caret = str.length (); + ic->impl->preedit_caret = str.length(); ic->impl->preedit_updating = true; - ecore_imf_context_preedit_changed_event_add (ic->ctx); + ecore_imf_context_preedit_changed_event_add(ic->ctx); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); ic->impl->preedit_updating = false; } else { - _panel_client.update_preedit_string (ic->id, str, attrs); + _panel_client.update_preedit_string(ic->id, str, attrs); } } } static void -slot_update_aux_string (IMEngineInstanceBase *si, +slot_update_aux_string(IMEngineInstanceBase *si, const WideString & str, const AttributeList & attrs) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.update_aux_string (ic->id, str, attrs); + _panel_client.update_aux_string(ic->id, str, attrs); } static void -slot_commit_string (IMEngineInstanceBase *si, +slot_commit_string(IMEngineInstanceBase *si, const WideString & str) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->ctx) { - ecore_imf_context_commit_event_add (ic->ctx, utf8_wcstombs (str).c_str ()); + ecore_imf_context_commit_event_add(ic->ctx, utf8_wcstombs(str).c_str()); ecore_imf_context_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); } } static void -slot_forward_key_event (IMEngineInstanceBase *si, +slot_forward_key_event(IMEngineInstanceBase *si, const KeyEvent & key) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && _focused_ic == ic) { - if (!_fallback_instance->process_key_event (key)) + if (!_fallback_instance->process_key_event(key)) _x_send_key_event(key); } } static void -slot_update_lookup_table (IMEngineInstanceBase *si, +slot_update_lookup_table(IMEngineInstanceBase *si, const LookupTable & table) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.update_lookup_table (ic->id, table); + _panel_client.update_lookup_table(ic->id, table); } static void -slot_register_properties (IMEngineInstanceBase *si, - const PropertyList & properties) +slot_register_properties(IMEngineInstanceBase *si, + const PropertyList & properties) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.register_properties (ic->id, properties); + _panel_client.register_properties(ic->id, properties); } static void -slot_update_property (IMEngineInstanceBase *si, - const Property & property) +slot_update_property(IMEngineInstanceBase *si, + const Property & property) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) - _panel_client.update_property (ic->id, property); + _panel_client.update_property(ic->id, property); } static void -slot_beep (IMEngineInstanceBase *si __UNUSED__) +slot_beep(IMEngineInstanceBase *si __UNUSED__) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; } static void -slot_start_helper (IMEngineInstanceBase *si, - const String &helper_uuid) +slot_start_helper(IMEngineInstanceBase *si, + const String &helper_uuid) { - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic - << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; + << " ic-uuid=" << ((ic ) ? ic->impl->si->get_factory_uuid() : "") << "...\n"; if (ic && ic->impl) - _panel_client.start_helper (ic->id, helper_uuid); + _panel_client.start_helper(ic->id, helper_uuid); } static void -slot_stop_helper (IMEngineInstanceBase *si, - const String &helper_uuid) +slot_stop_helper(IMEngineInstanceBase *si, + const String &helper_uuid) { - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic << "...\n"; if (ic && ic->impl) - _panel_client.stop_helper (ic->id, helper_uuid); + _panel_client.stop_helper(ic->id, helper_uuid); } static void -slot_send_helper_event (IMEngineInstanceBase *si, - const String &helper_uuid, - const Transaction &trans) +slot_send_helper_event(IMEngineInstanceBase *si, + const String &helper_uuid, + const Transaction &trans) { - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " helper= " << helper_uuid << " context=" << (ic ? ic->id : -1) << " ic=" << ic - << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid () : "") << "...\n"; + << " ic-uuid=" << ((ic) ? ic->impl->si->get_factory_uuid() : "") << "...\n"; if (ic && ic->impl) - _panel_client.send_helper_event (ic->id, helper_uuid, trans); + _panel_client.send_helper_event(ic->id, helper_uuid, trans); } static bool -slot_get_surrounding_text (IMEngineInstanceBase *si, - WideString &text, - int &cursor, - int maxlen_before, - int maxlen_after) +slot_get_surrounding_text(IMEngineInstanceBase *si, + WideString &text, + int &cursor, + int maxlen_before, + int maxlen_after) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { char *surrounding = NULL; int cursor_index; - if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index)) + if (ecore_imf_context_surrounding_get(_focused_ic->ctx, &surrounding, &cursor_index)) { SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n"; SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n"; - WideString before (utf8_mbstowcs (String (surrounding, surrounding + cursor_index))); - WideString after (utf8_mbstowcs (String (surrounding + cursor_index))); - if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length ()) - before = WideString (before.begin () + (before.length () - maxlen_before), before.end ()); - else if (maxlen_before == 0) before = WideString (); - if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length ()) - after = WideString (after.begin (), after.begin () + maxlen_after); - else if (maxlen_after == 0) after = WideString (); + WideString before(utf8_mbstowcs(String(surrounding, surrounding + cursor_index))); + WideString after(utf8_mbstowcs(String(surrounding + cursor_index))); + if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length()) + before = WideString(before.begin() + (before.length() - maxlen_before), before.end()); + else if (maxlen_before == 0) before = WideString(); + if (maxlen_after > 0 && ((unsigned int)maxlen_after) < after.length()) + after = WideString(after.begin(), after.begin() + maxlen_after); + else if (maxlen_after == 0) after = WideString(); text = before + after; - cursor = before.length (); + cursor = before.length(); return true; } } @@ -2774,13 +2830,13 @@ slot_get_surrounding_text (IMEngineInstanceBase *si, } static bool -slot_delete_surrounding_text (IMEngineInstanceBase *si, - int offset, - int len) +slot_delete_surrounding_text(IMEngineInstanceBase *si, + int offset, + int len) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + EcoreIMFContextISF *ic = static_cast(si->get_frontend_data()); if (ic && ic->impl && _focused_ic == ic) { @@ -2788,7 +2844,7 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si, ev.ctx = _focused_ic->ctx; ev.n_chars = len; ev.offset = offset; - ecore_imf_context_delete_surrounding_event_add (_focused_ic->ctx, offset, len); + ecore_imf_context_delete_surrounding_event_add(_focused_ic->ctx, offset, len); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev); return true; } @@ -2796,43 +2852,43 @@ slot_delete_surrounding_text (IMEngineInstanceBase *si, } static void -reload_config_callback (const ConfigPointer &config) +reload_config_callback(const ConfigPointer &config) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; - _frontend_hotkey_matcher.load_hotkeys (config); - _imengine_hotkey_matcher.load_hotkeys (config); + _frontend_hotkey_matcher.load_hotkeys(config); + _imengine_hotkey_matcher.load_hotkeys(config); KeyEvent key; - scim_string_to_key (key, - config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK), - String ("Shift+Control+Alt+Lock"))); + scim_string_to_key(key, + config->read(String(SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK), + String("Shift+Control+Alt+Lock"))); _valid_key_mask = (key.mask > 0)?(key.mask):0xFFFF; _valid_key_mask |= SCIM_KEY_ReleaseMask; // Special treatment for two backslash keys on jp106 keyboard. _valid_key_mask |= SCIM_KEY_QuirkKanaRoMask; - _on_the_spot = config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); - _shared_input_method = config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); + _on_the_spot = config->read(String(SCIM_CONFIG_FRONTEND_ON_THE_SPOT), _on_the_spot); + _shared_input_method = config->read(String(SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), _shared_input_method); // Get keyboard layout setting // Flush the global config first, in order to load the new configs from disk. - scim_global_config_flush (); + scim_global_config_flush(); - _keyboard_layout = scim_get_default_keyboard_layout (); + _keyboard_layout = scim_get_default_keyboard_layout(); } static void -fallback_commit_string_cb (IMEngineInstanceBase *si __UNUSED__, - const WideString &str) +fallback_commit_string_cb(IMEngineInstanceBase *si __UNUSED__, + const WideString &str) { SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; if (_focused_ic && _focused_ic->impl) { - ecore_imf_context_commit_event_add (_focused_ic->ctx, utf8_wcstombs (str).c_str ()); + ecore_imf_context_commit_event_add(_focused_ic->ctx, utf8_wcstombs(str).c_str()); ecore_imf_context_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); } } diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h index 84f1a2f..72533e2 100644 --- a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h +++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h @@ -32,6 +32,8 @@ Eina_Bool isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event void isf_imf_context_prediction_allow_set (Ecore_IMF_Context* ctx, Eina_Bool prediction); void isf_imf_context_autocapital_type_set (Ecore_IMF_Context* ctx, Ecore_IMF_Autocapital_Type autocapital_type); void isf_imf_context_input_panel_layout_set (Ecore_IMF_Context* ctx, Ecore_IMF_Input_Panel_Layout layout); +void isf_imf_context_input_panel_show(Ecore_IMF_Context *ctx); +void isf_imf_context_input_panel_hide(Ecore_IMF_Context *ctx); EcoreIMFContextISF* isf_imf_context_new (void); void isf_imf_context_shutdown (void); diff --git a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp index eff6381..d17e37a 100644 --- a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp +++ b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp @@ -19,8 +19,8 @@ extern "C" isf_imf_context_del, /* del */ isf_imf_context_client_window_set, /* client_window_set */ isf_imf_context_client_canvas_set, /* client_canvas_set */ - NULL, /* isf_imf_context_input_panel_show, - show */ - NULL, /* isf_imf_context_input_panel_hide, - hide */ + isf_imf_context_input_panel_show, /* input_panel_show, - show */ + isf_imf_context_input_panel_hide, /* input_panel_hide, - hide */ isf_imf_context_preedit_string_get, /* get_preedit_string */ isf_imf_context_focus_in, /* focus_in */ isf_imf_context_focus_out, /* focus_out */ @@ -38,7 +38,12 @@ extern "C" NULL, /* isf_imf_context_input_panel_layout_get, */ NULL, /* isf_imf_context_input_panel_language_set, */ NULL, /* isf_imf_context_input_panel_language_get, */ - isf_imf_context_cursor_location_set /* cursor_location_set */ + isf_imf_context_cursor_location_set, /* cursor_location_set */ + NULL, /* input_panel_imdata_set */ + NULL, /* input_panel_imdata_get */ + NULL, /* input_panel_return_key_type_set */ + NULL, /* input_panel_return_key_disabled_set */ + NULL /* input_panel_caps_lock_mode_set */ }; static Ecore_IMF_Context *imf_module_create (void); diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.in b/libraries/ecore/src/modules/immodules/xim/Makefile.in index 5b78946..775b574 100644 --- a/libraries/ecore/src/modules/immodules/xim/Makefile.in +++ b/libraries/ecore/src/modules/immodules/xim/Makefile.in @@ -48,16 +48,15 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -189,6 +188,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -244,6 +245,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -254,6 +257,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c index ea7ee7f..01a3576 100644 --- a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c +++ b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c @@ -294,6 +294,10 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx) imf_context_data = ecore_imf_context_data_get(ctx); ic = imf_context_data->ic; imf_context_data->has_focus = EINA_TRUE; + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_show(ctx); + if (ic) { char *str; @@ -326,6 +330,9 @@ _ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx) ic = imf_context_data->ic; if (ic) XUnsetICFocus(ic); + + if (ecore_imf_context_input_panel_enabled_get(ctx)) + ecore_imf_context_input_panel_hide(ctx); } #else (void)ctx; @@ -501,6 +508,38 @@ _ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx, (void)(w); // yes w is unused, but only a bi-product of the algorithm } +static void +_ecore_imf_context_xim_input_panel_show(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + ecore_x_e_virtual_keyboard_state_set + (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_ON); +#else + (void)ctx; +#endif +} + +static void +_ecore_imf_context_xim_input_panel_hide(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + ecore_x_e_virtual_keyboard_state_set + (imf_context_data->win, ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF); +#else + (void)ctx; +#endif +} + #ifdef ENABLE_XIM static unsigned int _ecore_x_event_reverse_modifiers(unsigned int state) @@ -739,8 +778,8 @@ static Ecore_IMF_Context_Class xim_class = { .del = _ecore_imf_context_xim_del, .client_window_set = _ecore_imf_context_xim_client_window_set, .client_canvas_set = NULL, - .show = NULL, - .hide = NULL, + .show = _ecore_imf_context_xim_input_panel_show, + .hide = _ecore_imf_context_xim_input_panel_hide, .preedit_string_get = _ecore_imf_context_xim_preedit_string_get, .focus_in = _ecore_imf_context_xim_focus_in, .focus_out = _ecore_imf_context_xim_focus_out, @@ -759,6 +798,11 @@ static Ecore_IMF_Context_Class xim_class = { .input_panel_language_set = NULL, .input_panel_language_get = NULL, .cursor_location_set = _ecore_imf_context_xim_cursor_location_set, + .input_panel_imdata_set = NULL, + .input_panel_imdata_get = NULL, + .input_panel_return_key_type_set = NULL, + .input_panel_return_key_disabled_set = NULL, + .input_panel_caps_lock_mode_set = NULL }; static Ecore_IMF_Context * 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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -174,6 +173,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -229,6 +230,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -239,6 +242,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ diff --git a/libraries/ecore/src/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 @@ #include "ecore_suite.h" +/* FIXME: Currently disable these tests. They are useless ATM and they just + * make buildbot complain. Once we add useful tests here we'll also bother + * with getting X on the server. */ +#undef HAVE_ECORE_X_XLIB /* TODO: change to HAVE_ECORE_X when xcb implementation is done */ #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 \ $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -163,6 +162,8 @@ EVAS_LIBS = @EVAS_LIBS@ EVIL_CFLAGS = @EVIL_CFLAGS@ EVIL_LIBS = @EVIL_LIBS@ EXEEXT = @EXEEXT@ +EXOTIC_CFLAGS = @EXOTIC_CFLAGS@ +EXOTIC_LIBS = @EXOTIC_LIBS@ FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GLIB_CFLAGS = @GLIB_CFLAGS@ @@ -218,6 +219,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCIM_CFLAGS = @SCIM_CFLAGS@ @@ -228,6 +231,7 @@ SDL_LIBS = @SDL_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_OPEN_LIBS = @SHM_OPEN_LIBS@ SSL_CFLAGS = @SSL_CFLAGS@ SSL_LIBS = @SSL_LIBS@ STRIP = @STRIP@ -- cgit v1.1