From 825a3d837a33f226c879cd02ad15c3fba57e8b2c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 23:30:42 +1000 Subject: Update the EFL to what I'm actually using, coz I'm using some stuff not yet released. --- libraries/ecore/src/Makefile.in | 14 +- libraries/ecore/src/bin/Makefile.in | 14 +- libraries/ecore/src/examples/Makefile.am | 6 +- libraries/ecore/src/examples/Makefile.in | 76 +- libraries/ecore/src/lib/Makefile.am | 4 + libraries/ecore/src/lib/Makefile.in | 33 +- libraries/ecore/src/lib/ecore/Ecore.h | 572 ++-- libraries/ecore/src/lib/ecore/Makefile.am | 1 + libraries/ecore/src/lib/ecore/Makefile.in | 45 +- libraries/ecore/src/lib/ecore/ecore.c | 24 +- libraries/ecore/src/lib/ecore/ecore_alloc.c | 132 + libraries/ecore/src/lib/ecore/ecore_anim.c | 19 +- libraries/ecore/src/lib/ecore/ecore_events.c | 25 +- libraries/ecore/src/lib/ecore/ecore_getopt.c | 11 +- libraries/ecore/src/lib/ecore/ecore_glib.c | 8 +- libraries/ecore/src/lib/ecore/ecore_idle_enterer.c | 9 +- libraries/ecore/src/lib/ecore/ecore_idle_exiter.c | 7 +- libraries/ecore/src/lib/ecore/ecore_idler.c | 7 +- libraries/ecore/src/lib/ecore/ecore_job.c | 9 +- libraries/ecore/src/lib/ecore/ecore_main.c | 33 +- libraries/ecore/src/lib/ecore/ecore_pipe.c | 9 +- libraries/ecore/src/lib/ecore/ecore_poll.c | 17 +- libraries/ecore/src/lib/ecore/ecore_private.h | 29 +- libraries/ecore/src/lib/ecore/ecore_thread.c | 15 +- libraries/ecore/src/lib/ecore/ecore_timer.c | 46 +- libraries/ecore/src/lib/ecore_cocoa/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_con/Ecore_Con.h | 124 +- libraries/ecore/src/lib/ecore_con/Makefile.am | 1 + libraries/ecore/src/lib/ecore_con/Makefile.in | 38 +- libraries/ecore/src/lib/ecore_con/ecore_con.c | 646 +++-- .../ecore/src/lib/ecore_con/ecore_con_alloc.c | 4 +- libraries/ecore/src/lib/ecore_con/ecore_con_ares.c | 14 +- libraries/ecore/src/lib/ecore_con/ecore_con_info.c | 9 +- .../src/lib/ecore_con/ecore_con_local_win32.c | 29 +- .../ecore/src/lib/ecore_con/ecore_con_private.h | 101 +- .../ecore/src/lib/ecore_con/ecore_con_socks.c | 496 ++++ libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c | 471 +++- libraries/ecore/src/lib/ecore_con/ecore_con_url.c | 734 ++--- libraries/ecore/src/lib/ecore_config/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_directfb/Makefile.in | 14 +- .../ecore/src/lib/ecore_directfb/ecore_directfb.c | 70 +- libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h | 263 +- libraries/ecore/src/lib/ecore_evas/Makefile.am | 38 +- libraries/ecore/src/lib/ecore_evas/Makefile.in | 57 +- libraries/ecore/src/lib/ecore_evas/ecore_evas.c | 153 +- .../ecore/src/lib/ecore_evas/ecore_evas_buffer.c | 164 +- .../ecore/src/lib/ecore_evas/ecore_evas_cocoa.c | 4 +- .../ecore/src/lib/ecore_evas/ecore_evas_ews.c | 5 + .../ecore/src/lib/ecore_evas/ecore_evas_extn.c | 2152 +++++++++++++++ libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c | 22 +- .../ecore/src/lib/ecore_evas/ecore_evas_private.h | 52 +- .../ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c | 46 +- .../ecore/src/lib/ecore_evas/ecore_evas_sdl.c | 3 + .../ecore/src/lib/ecore_evas/ecore_evas_util.c | 12 +- .../src/lib/ecore_evas/ecore_evas_wayland_egl.c | 1131 ++++++++ .../src/lib/ecore_evas/ecore_evas_wayland_shm.c | 1257 +++++++++ .../ecore/src/lib/ecore_evas/ecore_evas_win32.c | 8 +- libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | 53 +- libraries/ecore/src/lib/ecore_fb/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c | 8 +- .../ecore/src/lib/ecore_fb/ecore_fb_private.h | 3 + libraries/ecore/src/lib/ecore_file/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_file/ecore_file.c | 17 +- .../ecore/src/lib/ecore_file/ecore_file_download.c | 3 + .../lib/ecore_file/ecore_file_monitor_inotify.c | 1 + .../src/lib/ecore_file/ecore_file_monitor_poll.c | 1 + .../ecore/src/lib/ecore_file/ecore_file_path.c | 3 +- libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h | 19 +- libraries/ecore/src/lib/ecore_imf/Makefile.in | 14 +- .../ecore/src/lib/ecore_imf/ecore_imf_context.c | 141 +- .../ecore/src/lib/ecore_imf/ecore_imf_private.h | 9 + libraries/ecore/src/lib/ecore_imf_evas/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_input/Makefile.in | 14 +- .../ecore/src/lib/ecore_input_evas/Makefile.in | 14 +- .../src/lib/ecore_input_evas/ecore_input_evas.c | 1 + libraries/ecore/src/lib/ecore_ipc/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c | 3 +- .../ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h | 13 +- libraries/ecore/src/lib/ecore_psl1ght/Makefile.in | 14 +- .../ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c | 111 +- libraries/ecore/src/lib/ecore_sdl/Makefile.in | 14 +- .../ecore/src/lib/ecore_wayland/Ecore_Wayland.h | 123 + libraries/ecore/src/lib/ecore_wayland/Makefile.am | 31 + libraries/ecore/src/lib/ecore_wayland/Makefile.in | 829 ++++++ libraries/ecore/src/lib/ecore_wayland/ecore_wl.c | 1213 +++++++++ .../ecore/src/lib/ecore_wayland/ecore_wl_private.h | 85 + libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h | 36 +- libraries/ecore/src/lib/ecore_win32/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_win32/ecore_win32.c | 61 +- .../ecore/src/lib/ecore_win32/ecore_win32_event.c | 192 +- .../src/lib/ecore_win32/ecore_win32_private.h | 19 +- libraries/ecore/src/lib/ecore_wince/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_x/Ecore_X.h | 7 +- libraries/ecore/src/lib/ecore_x/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_x/xcb/Makefile.in | 14 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c | 2 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c | 5 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c | 6 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c | 14 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c | 3 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c | 45 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c | 5 +- .../ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c | 14 +- libraries/ecore/src/lib/ecore_x/xlib/Makefile.in | 14 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c | 324 +-- .../ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c | 18 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_composite.c | 42 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c | 24 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_damage.c | 12 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c | 86 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c | 32 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c | 26 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c | 232 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_error.c | 36 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_events.c | 421 +-- .../ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c | 99 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c | 10 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c | 18 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c | 248 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_image.c | 100 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c | 10 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c | 424 +-- .../ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c | 40 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c | 49 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c | 339 +-- .../src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c | 46 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c | 9 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_region.c | 40 +- .../src/lib/ecore_x/xlib/ecore_x_screensaver.c | 24 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_selection.c | 333 +-- .../ecore/src/lib/ecore_x/xlib/ecore_x_sync.c | 30 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_test.c | 8 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c | 38 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_window.c | 344 +-- .../src/lib/ecore_x/xlib/ecore_x_window_prop.c | 190 +- .../src/lib/ecore_x/xlib/ecore_x_window_shape.c | 150 +- libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c | 10 +- .../ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c | 6 +- libraries/ecore/src/modules/Makefile.in | 14 +- libraries/ecore/src/modules/immodules/Makefile.am | 4 + libraries/ecore/src/modules/immodules/Makefile.in | 19 +- .../ecore/src/modules/immodules/scim/Makefile.am | 36 + .../ecore/src/modules/immodules/scim/Makefile.in | 849 ++++++ .../src/modules/immodules/scim/scim_imcontext.cpp | 2839 ++++++++++++++++++++ .../src/modules/immodules/scim/scim_imcontext.h | 40 + .../src/modules/immodules/scim/scim_module.cpp | 93 + .../ecore/src/modules/immodules/xim/Makefile.in | 14 +- .../src/modules/immodules/xim/ecore_imf_xim.c | 614 +++-- libraries/ecore/src/tests/Makefile.in | 14 +- libraries/ecore/src/util/Makefile.in | 14 +- 150 files changed, 17074 insertions(+), 3877 deletions(-) create mode 100644 libraries/ecore/src/lib/ecore/ecore_alloc.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_socks.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c create mode 100644 libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h create mode 100644 libraries/ecore/src/lib/ecore_wayland/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_wayland/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_wayland/ecore_wl.c create mode 100644 libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h create mode 100644 libraries/ecore/src/modules/immodules/scim/Makefile.am create mode 100644 libraries/ecore/src/modules/immodules/scim/Makefile.in create mode 100644 libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp create mode 100644 libraries/ecore/src/modules/immodules/scim/scim_imcontext.h create mode 100644 libraries/ecore/src/modules/immodules/scim/scim_module.cpp (limited to 'libraries/ecore/src') diff --git a/libraries/ecore/src/Makefile.in b/libraries/ecore/src/Makefile.in index 29b69db..bf6f05c 100644 --- a/libraries/ecore/src/Makefile.in +++ b/libraries/ecore/src/Makefile.in @@ -229,10 +229,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -251,6 +251,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -364,6 +368,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -376,6 +382,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -420,12 +428,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/bin/Makefile.in b/libraries/ecore/src/bin/Makefile.in index 387db21..72d2bfd 100644 --- a/libraries/ecore/src/bin/Makefile.in +++ b/libraries/ecore/src/bin/Makefile.in @@ -223,10 +223,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -245,6 +245,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -358,6 +362,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -370,6 +376,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -414,12 +422,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/examples/Makefile.am b/libraries/ecore/src/examples/Makefile.am index 63748a5..afb6f40 100644 --- a/libraries/ecore/src/examples/Makefile.am +++ b/libraries/ecore/src/examples/Makefile.am @@ -1,6 +1,6 @@ MAINTAINERCLEANFILES = Makefile.in -pkglibdir = $(datadir)/$(PACKAGE)/examples +examplesdir = $(datadir)/$(PACKAGE)/examples filesdir = $(datadir)/$(PACKAGE)/examples files_DATA = @@ -59,7 +59,7 @@ SRCS = \ EXTRA_DIST = $(SRCS) \ $(srcdir)/red.png -pkglib_PROGRAMS = +examples_PROGRAMS = if EFL_INSTALL_EXAMPLES files_DATA += $(SRCS) \ @@ -67,7 +67,7 @@ files_DATA += $(SRCS) \ endif if EFL_BUILD_EXAMPLES -pkglib_PROGRAMS += \ +examples_PROGRAMS += \ ecore_animator_example \ ecore_fd_handler_example \ ecore_poller_example \ diff --git a/libraries/ecore/src/examples/Makefile.in b/libraries/ecore/src/examples/Makefile.in index dc38e0d..7fac88c 100644 --- a/libraries/ecore/src/examples/Makefile.in +++ b/libraries/ecore/src/examples/Makefile.in @@ -19,6 +19,7 @@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 @@ -34,7 +35,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -pkglib_PROGRAMS = $(am__EXEEXT_1) +examples_PROGRAMS = $(am__EXEEXT_1) @EFL_INSTALL_EXAMPLES_TRUE@am__append_1 = $(SRCS) \ @EFL_INSTALL_EXAMPLES_TRUE@ $(srcdir)/red.png @@ -120,8 +121,8 @@ CONFIG_CLEAN_VPATH_FILES = @EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_ews_example$(EXEEXT) \ @EFL_BUILD_EXAMPLES_TRUE@ ecore_client_bench$(EXEEXT) \ @EFL_BUILD_EXAMPLES_TRUE@ ecore_server_bench$(EXEEXT) -am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)" -PROGRAMS = $(pkglib_PROGRAMS) +am__installdirs = "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(filesdir)" +PROGRAMS = $(examples_PROGRAMS) ecore_animator_example_SOURCES = ecore_animator_example.c ecore_animator_example_OBJECTS = ecore_animator_example.$(OBJEXT) ecore_animator_example_LDADD = $(LDADD) @@ -344,7 +345,6 @@ DATA = $(files_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -pkglibdir = $(datadir)/$(PACKAGE)/examples ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ @@ -463,10 +463,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -485,6 +485,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -598,6 +602,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -610,6 +616,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -654,12 +662,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ @@ -677,6 +687,7 @@ x_cflags = @x_cflags@ x_includes = @x_includes@ x_libs = @x_libs@ MAINTAINERCLEANFILES = Makefile.in +examplesdir = $(datadir)/$(PACKAGE)/examples filesdir = $(datadir)/$(PACKAGE)/examples files_DATA = $(am__append_1) AM_CPPFLAGS = \ @@ -778,10 +789,10 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -install-pkglibPROGRAMS: $(pkglib_PROGRAMS) +install-examplesPROGRAMS: $(examples_PROGRAMS) @$(NORMAL_INSTALL) - test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" - @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ + test -z "$(examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(examplesdir)" + @list='$(examples_PROGRAMS)'; test -n "$(examplesdir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ @@ -798,23 +809,23 @@ install-pkglibPROGRAMS: $(pkglib_PROGRAMS) while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkglibdir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkglibdir)$$dir" || exit $$?; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(examplesdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(examplesdir)$$dir" || exit $$?; \ } \ ; done -uninstall-pkglibPROGRAMS: +uninstall-examplesPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ + @list='$(examples_PROGRAMS)'; test -n "$(examplesdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkglibdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkglibdir)" && rm -f $$files + echo " ( cd '$(DESTDIR)$(examplesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(examplesdir)" && rm -f $$files -clean-pkglibPROGRAMS: - @list='$(pkglib_PROGRAMS)'; test -n "$$list" || exit 0; \ +clean-examplesPROGRAMS: + @list='$(examples_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ @@ -1069,7 +1080,7 @@ check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)"; do \ + for dir in "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(filesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1100,7 +1111,7 @@ maintainer-clean-generic: -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-generic clean-libtool clean-pkglibPROGRAMS \ +clean-am: clean-examplesPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am @@ -1121,13 +1132,13 @@ info: info-am info-am: -install-data-am: install-filesDATA +install-data-am: install-examplesPROGRAMS install-filesDATA install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-pkglibPROGRAMS +install-exec-am: install-html: install-html-am @@ -1167,24 +1178,25 @@ ps: ps-am ps-am: -uninstall-am: uninstall-filesDATA uninstall-pkglibPROGRAMS +uninstall-am: uninstall-examplesPROGRAMS uninstall-filesDATA .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pkglibPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-filesDATA \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-pkglibPROGRAMS \ +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-examplesPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am \ + install-examplesPROGRAMS install-exec install-exec-am \ + install-filesDATA install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-filesDATA \ - uninstall-pkglibPROGRAMS + tags uninstall uninstall-am uninstall-examplesPROGRAMS \ + uninstall-filesDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/libraries/ecore/src/lib/Makefile.am b/libraries/ecore/src/lib/Makefile.am index b13bc18..d43ad75 100644 --- a/libraries/ecore/src/lib/Makefile.am +++ b/libraries/ecore/src/lib/Makefile.am @@ -46,6 +46,10 @@ if BUILD_ECORE_COCOA SUBDIRS += ecore_cocoa endif +if BUILD_ECORE_WAYLAND +SUBDIRS += ecore_wayland +endif + if BUILD_ECORE_IPC SUBDIRS += ecore_ipc endif diff --git a/libraries/ecore/src/lib/Makefile.in b/libraries/ecore/src/lib/Makefile.in index b351087..09271c2 100644 --- a/libraries/ecore/src/lib/Makefile.in +++ b/libraries/ecore/src/lib/Makefile.in @@ -44,12 +44,13 @@ host_triplet = @host@ @BUILD_ECORE_SDL_TRUE@am__append_9 = ecore_sdl @BUILD_ECORE_PSL1GHT_TRUE@am__append_10 = ecore_psl1ght @BUILD_ECORE_COCOA_TRUE@am__append_11 = ecore_cocoa -@BUILD_ECORE_IPC_TRUE@am__append_12 = ecore_ipc -@BUILD_ECORE_EVAS_TRUE@am__append_13 = ecore_evas -@BUILD_ECORE_CONFIG_TRUE@am__append_14 = ecore_config -@BUILD_ECORE_FILE_TRUE@am__append_15 = ecore_file -@BUILD_ECORE_IMF_TRUE@am__append_16 = ecore_imf -@BUILD_ECORE_IMF_EVAS_TRUE@am__append_17 = ecore_imf_evas +@BUILD_ECORE_WAYLAND_TRUE@am__append_12 = ecore_wayland +@BUILD_ECORE_IPC_TRUE@am__append_13 = ecore_ipc +@BUILD_ECORE_EVAS_TRUE@am__append_14 = ecore_evas +@BUILD_ECORE_CONFIG_TRUE@am__append_15 = ecore_config +@BUILD_ECORE_FILE_TRUE@am__append_16 = ecore_file +@BUILD_ECORE_IMF_TRUE@am__append_17 = ecore_imf +@BUILD_ECORE_IMF_EVAS_TRUE@am__append_18 = ecore_imf_evas subdir = src/lib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -101,8 +102,8 @@ ETAGS = etags CTAGS = ctags DIST_SUBDIRS = ecore ecore_input ecore_input_evas ecore_fb \ ecore_directfb ecore_con ecore_x ecore_win32 ecore_wince \ - ecore_sdl ecore_psl1ght ecore_cocoa ecore_ipc ecore_evas \ - ecore_config ecore_file ecore_imf ecore_imf_evas + ecore_sdl ecore_psl1ght ecore_cocoa ecore_wayland ecore_ipc \ + ecore_evas ecore_config ecore_file ecore_imf ecore_imf_evas DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -247,10 +248,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -269,6 +270,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -382,6 +387,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -394,6 +401,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -438,12 +447,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ @@ -466,7 +477,7 @@ SUBDIRS = ecore $(am__append_1) $(am__append_2) $(am__append_3) \ $(am__append_7) $(am__append_8) $(am__append_9) \ $(am__append_10) $(am__append_11) $(am__append_12) \ $(am__append_13) $(am__append_14) $(am__append_15) \ - $(am__append_16) $(am__append_17) + $(am__append_16) $(am__append_17) $(am__append_18) all: all-recursive .SUFFIXES: diff --git a/libraries/ecore/src/lib/ecore/Ecore.h b/libraries/ecore/src/lib/ecore/Ecore.h index fe4e631..fbe4dda 100644 --- a/libraries/ecore/src/lib/ecore/Ecore.h +++ b/libraries/ecore/src/lib/ecore/Ecore.h @@ -95,13 +95,23 @@ @author Mike McCormack @author Sangho Park @author Jihoon Kim + @author PnB @author Daniel Juyung Seo + @author Christopher 'devilhorns' Michael + @author ChunEon Park + @author xlopez@igalia.com + @author Rafael Antognolli + @author Kim Yunhan + @author Youness Alaoui + @author Bluezery + @author Doyoun Kang + @author Haifeng Deng Please contact to get in contact with the developers and maintainers. */ -/* +/** @page Ecore_Main_Loop_Page The Ecore Main Loop @section intro What is Ecore? @@ -315,10 +325,8 @@ extern "C" { * @{ */ -EAPI int - ecore_init(void); -EAPI int - ecore_shutdown(void); +EAPI int ecore_init(void); +EAPI int ecore_shutdown(void); /** * @} @@ -390,28 +398,21 @@ EAPI extern Ecore_Version *ecore_version; typedef Eina_Bool (*Ecore_Task_Cb)(void *data); /** - * @typedef Ecore_Eselect_Function Ecore_Eselect_Function + * @typedef Ecore_Eselect_Function * A function which can be used to replace select() in the main loop */ typedef int (*Ecore_Select_Function)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); -EAPI void -ecore_main_loop_iterate(void); +EAPI void ecore_main_loop_iterate(void); -EAPI void - ecore_main_loop_select_func_set(Ecore_Select_Function func); -EAPI Ecore_Select_Function - ecore_main_loop_select_func_get(void); +EAPI void ecore_main_loop_select_func_set(Ecore_Select_Function func); +EAPI Ecore_Select_Function ecore_main_loop_select_func_get(void); -EAPI Eina_Bool - ecore_main_loop_glib_integrate(void); -EAPI void - ecore_main_loop_glib_always_integrate_disable(void); +EAPI Eina_Bool ecore_main_loop_glib_integrate(void); +EAPI void ecore_main_loop_glib_always_integrate_disable(void); -EAPI void - ecore_main_loop_begin(void); -EAPI void - ecore_main_loop_quit(void); +EAPI void ecore_main_loop_begin(void); +EAPI void ecore_main_loop_quit(void); /** * @typedef Ecore_Cb Ecore_Cb @@ -441,9 +442,7 @@ typedef void *(*Ecore_Data_Cb)(void *data); * in the thread, it is owned by the main loop and your callback should take * care of freeing it if necessary. */ -EAPI void -ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, - void *data); +EAPI void ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, void *data); /** * @brief Call callback synchronously in the main loop. @@ -460,9 +459,7 @@ ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, * Remember this function will block until the callback is executed in the * main loop. It can take time and you have no guaranty about the timeline. */ -EAPI void * -ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, - void *data); +EAPI void *ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, void *data); /** * @brief This function suspend the main loop in a know state @@ -482,8 +479,7 @@ ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, * We still advise you, when possible, to use ecore_main_loop_thread_safe_call_async() * as it will not block the thread nor the main loop. */ -EAPI int -ecore_thread_main_loop_begin(void); +EAPI int ecore_thread_main_loop_begin(void); /** * @brief Unlock the main loop. @@ -496,8 +492,7 @@ ecore_thread_main_loop_begin(void); * After a call to ecore_thread_main_loop_begin(), you need to absolutly * call ecore_thread_main_loop_end(), or you application will stay frozen. */ -EAPI int -ecore_thread_main_loop_end(void); +EAPI int ecore_thread_main_loop_end(void); /** * @} @@ -631,37 +626,17 @@ struct _Ecore_Event_Signal_Realtime /** Realtime event */ #endif }; -EAPI Ecore_Event_Handler * -ecore_event_handler_add(int type, - Ecore_Event_Handler_Cb func, - const void *data); -EAPI void * - ecore_event_handler_del(Ecore_Event_Handler *event_handler); -EAPI Ecore_Event * - ecore_event_add(int type, - void *ev, - Ecore_End_Cb func_free, - void *data); -EAPI void * - ecore_event_del(Ecore_Event *event); -EAPI void * - ecore_event_handler_data_get(Ecore_Event_Handler *eh); -EAPI void * - ecore_event_handler_data_set(Ecore_Event_Handler *eh, - const void *data); -EAPI int - ecore_event_type_new(void); -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); -EAPI void * - ecore_event_filter_del(Ecore_Event_Filter *ef); -EAPI int - ecore_event_current_type_get(void); -EAPI void * - ecore_event_current_event_get(void); +EAPI Ecore_Event_Handler *ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data); +EAPI void *ecore_event_handler_del(Ecore_Event_Handler *event_handler); +EAPI Ecore_Event *ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data); +EAPI void *ecore_event_del(Ecore_Event *event); +EAPI void *ecore_event_handler_data_get(Ecore_Event_Handler *eh); +EAPI void *ecore_event_handler_data_set(Ecore_Event_Handler *eh, const void *data); +EAPI int ecore_event_type_new(void); +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); +EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef); +EAPI int ecore_event_current_type_get(void); +EAPI void *ecore_event_current_event_get(void); /** * @} @@ -702,11 +677,11 @@ typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags; enum _Ecore_Exe_Win32_Priority { - ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */ - ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */ - ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */ - ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */ - ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */ + ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */ + ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */ + ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */ + ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */ + ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */ ECORE_EXE_WIN32_PRIORITY_REALTIME /**< Realtime priority, should be almost never used as it can interrupt system threads that manage mouse input, keyboard input, and background disk flushing */ }; typedef enum _Ecore_Exe_Win32_Priority Ecore_Exe_Win32_Priority; @@ -759,72 +734,32 @@ struct _Ecore_Exe_Event_Data /** Data from a child process event */ Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */ }; -EAPI void - ecore_exe_run_priority_set(int pri); -EAPI int - ecore_exe_run_priority_get(void); -EAPI Ecore_Exe * - ecore_exe_run(const char *exe_cmd, - const void *data); -EAPI Ecore_Exe * -ecore_exe_pipe_run(const char *exe_cmd, - Ecore_Exe_Flags flags, - const void *data); -EAPI void -ecore_exe_callback_pre_free_set(Ecore_Exe *exe, - Ecore_Exe_Cb func); -EAPI Eina_Bool -ecore_exe_send(Ecore_Exe *exe, - const void *data, - int size); -EAPI void - ecore_exe_close_stdin(Ecore_Exe *exe); -EAPI void - ecore_exe_auto_limits_set(Ecore_Exe *exe, - int start_bytes, - int end_bytes, - int start_lines, - int end_lines); -EAPI Ecore_Exe_Event_Data * -ecore_exe_event_data_get(Ecore_Exe *exe, - Ecore_Exe_Flags flags); -EAPI void - ecore_exe_event_data_free(Ecore_Exe_Event_Data *data); -EAPI void * - ecore_exe_free(Ecore_Exe *exe); -EAPI pid_t - ecore_exe_pid_get(const Ecore_Exe *exe); -EAPI void - ecore_exe_tag_set(Ecore_Exe *exe, - const char *tag); -EAPI const char * - ecore_exe_tag_get(const Ecore_Exe *exe); -EAPI const char * - ecore_exe_cmd_get(const Ecore_Exe *exe); -EAPI void * - ecore_exe_data_get(const Ecore_Exe *exe); -EAPI void * - ecore_exe_data_set(Ecore_Exe *exe, - void *data); -EAPI Ecore_Exe_Flags - ecore_exe_flags_get(const Ecore_Exe *exe); -EAPI void - ecore_exe_pause(Ecore_Exe *exe); -EAPI void - ecore_exe_continue(Ecore_Exe *exe); -EAPI void - ecore_exe_interrupt(Ecore_Exe *exe); -EAPI void - ecore_exe_quit(Ecore_Exe *exe); -EAPI void - ecore_exe_terminate(Ecore_Exe *exe); -EAPI void - ecore_exe_kill(Ecore_Exe *exe); -EAPI void - ecore_exe_signal(Ecore_Exe *exe, - int num); -EAPI void -ecore_exe_hup(Ecore_Exe *exe); +EAPI void ecore_exe_run_priority_set(int pri); +EAPI int ecore_exe_run_priority_get(void); +EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data); +EAPI Ecore_Exe *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data); +EAPI void ecore_exe_callback_pre_free_set(Ecore_Exe *exe, Ecore_Exe_Cb func); +EAPI Eina_Bool ecore_exe_send(Ecore_Exe *exe, const void *data, int size); +EAPI void ecore_exe_close_stdin(Ecore_Exe *exe); +EAPI void ecore_exe_auto_limits_set(Ecore_Exe *exe, int start_bytes, int end_bytes, int start_lines, int end_lines); +EAPI Ecore_Exe_Event_Data *ecore_exe_event_data_get(Ecore_Exe *exe, Ecore_Exe_Flags flags); +EAPI void ecore_exe_event_data_free(Ecore_Exe_Event_Data *data); +EAPI void *ecore_exe_free(Ecore_Exe *exe); +EAPI pid_t ecore_exe_pid_get(const Ecore_Exe *exe); +EAPI void ecore_exe_tag_set(Ecore_Exe *exe, const char *tag); +EAPI const char *ecore_exe_tag_get(const Ecore_Exe *exe); +EAPI const char *ecore_exe_cmd_get(const Ecore_Exe *exe); +EAPI void *ecore_exe_data_get(const Ecore_Exe *exe); +EAPI void *ecore_exe_data_set(Ecore_Exe *exe, void *data); +EAPI Ecore_Exe_Flags ecore_exe_flags_get(const Ecore_Exe *exe); +EAPI void ecore_exe_pause(Ecore_Exe *exe); +EAPI void ecore_exe_continue(Ecore_Exe *exe); +EAPI void ecore_exe_interrupt(Ecore_Exe *exe); +EAPI void ecore_exe_quit(Ecore_Exe *exe); +EAPI void ecore_exe_terminate(Ecore_Exe *exe); +EAPI void ecore_exe_kill(Ecore_Exe *exe); +EAPI void ecore_exe_signal(Ecore_Exe *exe, int num); +EAPI void ecore_exe_hup(Ecore_Exe *exe); /** * @} @@ -839,7 +774,7 @@ ecore_exe_hup(Ecore_Exe *exe); * for data available for reading, for the availability to write * without blocking, and for errors on the file descriptor. * - * ecore_main_fd_handler_add() is used to setup a handler for a + *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 @@ -888,34 +823,15 @@ 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); -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); -EAPI void -ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, - Ecore_Fd_Prep_Cb func, - const void *data); -EAPI void * - ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); -EAPI int - ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler); -EAPI Eina_Bool - ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, - Ecore_Fd_Handler_Flags flags); -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); -EAPI void * -ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler); +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); +EAPI void ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data); +EAPI void *ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); +EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler); +EAPI Eina_Bool ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags); +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); +EAPI void *ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler); /** * @} @@ -930,7 +846,7 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler); * areound a core poll interval. For now only 1 core poller type is * supprted: ECORE_POLLER_CORE * - * Example of @ref Ecore_Poller: + * Example of @ref Ecore_Poller : * @li @ref ecore_poller_example_c * * @ingroup Ecore_Main_Loop_Group @@ -946,21 +862,11 @@ typedef enum _Ecore_Poller_Type Ecore_Poller_Type; typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */ -EAPI void -ecore_poller_poll_interval_set(Ecore_Poller_Type type, - double poll_time); -EAPI double - ecore_poller_poll_interval_get(Ecore_Poller_Type type); -EAPI Eina_Bool - ecore_poller_poller_interval_set(Ecore_Poller *poller, - int interval); -EAPI int - ecore_poller_poller_interval_get(Ecore_Poller *poller); -EAPI Ecore_Poller * - ecore_poller_add(Ecore_Poller_Type type, - int interval, - Ecore_Task_Cb func, - const void *data); +EAPI void ecore_poller_poll_interval_set(Ecore_Poller_Type type, double poll_time); +EAPI double ecore_poller_poll_interval_get(Ecore_Poller_Type type); +EAPI Eina_Bool ecore_poller_poller_interval_set(Ecore_Poller *poller, int interval); +EAPI int ecore_poller_poller_interval_get(Ecore_Poller *poller); +EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_Task_Cb func, const void *data); EAPI void *ecore_poller_del(Ecore_Poller *poller); /** @@ -984,14 +890,14 @@ EAPI void *ecore_poller_del(Ecore_Poller *poller); * ... do some more animating ... * } * ... - * ecore_animator_timeline_add(2, _do_animation, my_evas_object); + *ecore_animator_timeline_add(2, _do_animation, my_evas_object); * @endcode * In the sample above we create an animation to move * @c my_evas_object from position (0,0) to (100,100) in 2 seconds. * * If your animation will run for an unspecified amount of time you * can use ecore_animator_add(), which is like using - * ecore_timer_add() with the interval being the + *ecore_timer_add() with the interval being the * @ref ecore_animator_frametime_set "framerate". Note that this has * tangible benefits to creating a timer for each animation in terms * of performance. @@ -1057,8 +963,7 @@ typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos); * @see ecore_animator_timeline_add() * @see ecore_animator_frametime_set() */ -EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, - const void *data); +EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data); /** * @brief Add a animator that runs for a limited time * @@ -1086,10 +991,7 @@ EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, * @see ecore_animator_pos_map() * @since 1.1.0 */ -EAPI Ecore_Animator * -ecore_animator_timeline_add(double runtime, - Ecore_Timeline_Cb func, - const void *data); +EAPI Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data); /** * @brief Delete the specified animator from the animator list. * @@ -1103,8 +1005,7 @@ ecore_animator_timeline_add(double runtime, * is invalid and should not be used again. It will not get called again after * deletion. */ -EAPI void * -ecore_animator_del(Ecore_Animator *animator); +EAPI void *ecore_animator_del(Ecore_Animator *animator); /** * @brief Suspend the specified animator. * @@ -1115,12 +1016,11 @@ ecore_animator_del(Ecore_Animator *animator); * * @warning Freezing an animator doesn't freeze accounting of how long that * animator has been running. Therefore if the animator was created with - * ecore_animator_timeline_add() the @p pos argument given to the callback + *ecore_animator_timeline_add() the @p pos argument given to the callback * will increase as if the animator hadn't been frozen and the animator may * have it's execution halted if @p runtime elapsed. */ -EAPI void -ecore_animator_freeze(Ecore_Animator *animator); +EAPI void ecore_animator_freeze(Ecore_Animator *animator); /** * @brief Restore execution of the specified animator. * @@ -1129,8 +1029,7 @@ ecore_animator_freeze(Ecore_Animator *animator); * The specified @p animator will be put back in the set of animators that are * executed during main loop. */ -EAPI void -ecore_animator_thaw(Ecore_Animator *animator); +EAPI void ecore_animator_thaw(Ecore_Animator *animator); /** * @brief Set the animator call interval in seconds. * @@ -1144,8 +1043,7 @@ ecore_animator_thaw(Ecore_Animator *animator); * * @note The default @p frametime value is 1/30th of a second. */ -EAPI void -ecore_animator_frametime_set(double frametime); +EAPI void ecore_animator_frametime_set(double frametime); /** * @brief Get the animator call interval in seconds. * @@ -1155,8 +1053,7 @@ ecore_animator_frametime_set(double frametime); * * @see ecore_animator_frametime_set() */ -EAPI double -ecore_animator_frametime_get(void); +EAPI double ecore_animator_frametime_get(void); /** * @brief Maps an input position from 0.0 to 1.0 along a timeline to a * position in a different curve. @@ -1217,11 +1114,7 @@ ecore_animator_frametime_get(void); * * @since 1.1.0 */ -EAPI double -ecore_animator_pos_map(double pos, - Ecore_Pos_Map map, - double v1, - double v2); +EAPI double ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2); /** * @brief Set the source of animator ticks for the mainloop * @@ -1238,14 +1131,13 @@ ecore_animator_pos_map(double pos, * ECORE_ANIMATOR_SOURCE_CUSTOM and then drive it yourself based on some input * tick source (like another application via ipc, some vertical blanking * interrupt interrupt etc.) using - * ecore_animator_custom_source_tick_begin_callback_set() and - * ecore_animator_custom_source_tick_end_callback_set() to set the functions + *ecore_animator_custom_source_tick_begin_callback_set() and + *ecore_animator_custom_source_tick_end_callback_set() to set the functions * that will be called to start and stop the ticking source, which when it * gets a "tick" should call ecore_animator_custom_tick() to make the "tick" over 1 * frame. */ -EAPI void -ecore_animator_source_set(Ecore_Animator_Source source); +EAPI void ecore_animator_source_set(Ecore_Animator_Source source); /** * @brief Get the animator source currently set. * @@ -1255,8 +1147,7 @@ ecore_animator_source_set(Ecore_Animator_Source source); * * @see ecore_animator_source_set() */ -EAPI Ecore_Animator_Source -ecore_animator_source_get(void); +EAPI Ecore_Animator_Source ecore_animator_source_get(void); /** * @brief Set the function that begins a custom animator tick source * @@ -1266,7 +1157,7 @@ ecore_animator_source_get(void); * The Ecore Animator infrastructure handles tracking if animators are needed * or not and which ones need to be called and when, but when the tick source * is custom, you have to provide a tick source by calling - * ecore_animator_custom_tick() to indicate a frame tick happened. In order + *ecore_animator_custom_tick() to indicate a frame tick happened. In order * to allow the source of ticks to be dynamically enabled or disabled as * needed, the @p func when set is called to enable the tick source to * produce tick events that call ecore_animator_custom_tick(). If @p func @@ -1276,9 +1167,7 @@ ecore_animator_source_get(void); * @see ecore_animator_custom_source_tick_end_callback_set() * @see ecore_animator_custom_tick() */ -EAPI void -ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, - const void *data); +EAPI void ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data); /** * @brief Set the function that ends a custom animator tick source * @@ -1286,18 +1175,16 @@ ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, * @param data The data passed to the tick end function as its parameter * * This function is a matching pair to the function set by - * ecore_animator_custom_source_tick_begin_callback_set() and is called + *ecore_animator_custom_source_tick_begin_callback_set() and is called * when ticking is to stop. If @p func is NULL then no function will be * called to stop ticking. For more information please see - * ecore_animator_custom_source_tick_begin_callback_set(). + *ecore_animator_custom_source_tick_begin_callback_set(). * * @see ecore_animator_source_set() * @see ecore_animator_custom_source_tick_begin_callback_set() * @see ecore_animator_custom_tick() */ -EAPI void -ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, - const void *data); +EAPI void ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data); /** * @brief Trigger a custom animator tick * @@ -1311,8 +1198,7 @@ ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, * @see ecore_animator_custom_source_tick_begin_callback_set * @see ecore_animator_custom_source_tick_end_callback_set()() */ -EAPI void -ecore_animator_custom_tick(void); +EAPI void ecore_animator_custom_tick(void); /** * @} @@ -1338,43 +1224,23 @@ 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); -EAPI void - ecore_timer_interval_set(Ecore_Timer *timer, - double in); -EAPI double - ecore_timer_interval_get(Ecore_Timer *timer); -EAPI void - ecore_timer_freeze(Ecore_Timer *timer); -EAPI void - ecore_timer_thaw(Ecore_Timer *timer); -EAPI void - ecore_timer_delay(Ecore_Timer *timer, - double add); -EAPI double - ecore_timer_pending_get(Ecore_Timer *timer); -EAPI double - ecore_timer_precision_get(void); -EAPI void - ecore_timer_precision_set(double precision); -EAPI char * - ecore_timer_dump(void); +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); +EAPI void ecore_timer_interval_set(Ecore_Timer *timer, double in); +EAPI double ecore_timer_interval_get(Ecore_Timer *timer); +EAPI void ecore_timer_freeze(Ecore_Timer *timer); +EAPI void ecore_timer_thaw(Ecore_Timer *timer); +EAPI void ecore_timer_delay(Ecore_Timer *timer, double add); +EAPI void ecore_timer_reset(Ecore_Timer *timer); +EAPI double ecore_timer_pending_get(Ecore_Timer *timer); +EAPI double ecore_timer_precision_get(void); +EAPI void ecore_timer_precision_set(double precision); +EAPI char *ecore_timer_dump(void); /** * @} @@ -1443,9 +1309,7 @@ typedef struct _Ecore_Idle_Exiter Ecore_Idle_Exiter; /**< A handle for idle exi * * Idlers are useful for progressively prossessing data without blocking. */ -EAPI Ecore_Idler * -ecore_idler_add(Ecore_Task_Cb func, - const void *data); +EAPI Ecore_Idler *ecore_idler_add(Ecore_Task_Cb func, const void *data); /** * Delete an idler callback from the list to be executed. @@ -1453,23 +1317,14 @@ ecore_idler_add(Ecore_Task_Cb func, * @return The data pointer passed to the idler callback on success. NULL * otherwise. */ -EAPI void * -ecore_idler_del(Ecore_Idler *idler); +EAPI void *ecore_idler_del(Ecore_Idler *idler); -EAPI Ecore_Idle_Enterer * -ecore_idle_enterer_add(Ecore_Task_Cb func, - const void *data); -EAPI Ecore_Idle_Enterer * -ecore_idle_enterer_before_add(Ecore_Task_Cb func, - const void *data); -EAPI void * -ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer); +EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data); +EAPI Ecore_Idle_Enterer *ecore_idle_enterer_before_add(Ecore_Task_Cb func, const void *data); +EAPI void *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer); -EAPI Ecore_Idle_Exiter * -ecore_idle_exiter_add(Ecore_Task_Cb func, - const void *data); -EAPI void * -ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter); +EAPI Ecore_Idle_Exiter *ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data); +EAPI void *ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter); /** * @} @@ -1525,7 +1380,7 @@ ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter); * * The worker function, that's the one running in the thread, also receives * an ::Ecore_Thread handler that can be used with ecore_thread_cancel() and - * ecore_thread_check(), sharing the flag with the main loop. But this + *ecore_thread_check(), sharing the flag with the main loop. But this * handler is also associated with the thread where the function is running. * This has strong implications when working with thread local data. * @@ -1611,7 +1466,7 @@ typedef void (*Ecore_Thread_Notify_Cb)(void *data, Ecore_Thread *thread, void *m * so here it's safe to use anything from the EFL freely. * * The thread can also be cancelled before its completion calling - * ecore_thread_cancel(), either from the main thread or @p func_blocking. + *ecore_thread_cancel(), either from the main thread or @p func_blocking. * In this case, @p func_cancel will be called, also from the main thread * to inform of this happening. If the thread could not be created, this * function will be called and it's @c thread parameter will be NULL. It's @@ -1636,11 +1491,7 @@ typedef void (*Ecore_Thread_Notify_Cb)(void *data, Ecore_Thread *thread, void *m * @see ecore_thread_reschedule() * @see ecore_thread_max_set() */ -EAPI Ecore_Thread * -ecore_thread_run(Ecore_Thread_Cb func_blocking, - Ecore_Thread_Cb func_end, - Ecore_Thread_Cb func_cancel, - const void *data); +EAPI Ecore_Thread *ecore_thread_run(Ecore_Thread_Cb func_blocking, Ecore_Thread_Cb func_end, Ecore_Thread_Cb func_cancel, const void *data); /** * Launch a thread to run a task than can talk back to the main thread * @@ -1681,13 +1532,9 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking, * @see ecore_thread_reschedule() * @see ecore_thread_max_set() */ -EAPI Ecore_Thread * -ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, - Ecore_Thread_Notify_Cb func_notify, - Ecore_Thread_Cb func_end, - Ecore_Thread_Cb func_cancel, - const void *data, - Eina_Bool try_no_queue); +EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, Ecore_Thread_Notify_Cb func_notify, + Ecore_Thread_Cb func_end, Ecore_Thread_Cb func_cancel, + const void *data, Eina_Bool try_no_queue); /** * Cancel a running thread. * @@ -1709,9 +1556,9 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, * @li The function ends and returns normally. If it hadn't been cancelled, * @c func_end would be called here, but instead @c func_cancel will happen. * @li The function returns after requesting to be rescheduled with - * ecore_thread_reschedule(). + *ecore_thread_reschedule(). * @li The function is prepared to leave early by checking if - * ecore_thread_check() returns EINA_TRUE. + *ecore_thread_check() returns EINA_TRUE. * * The user function can cancel itself by calling ecore_thread_cancel(), but * it should always use the ::Ecore_Thread handle passed to it and never @@ -1723,8 +1570,7 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, * * @see ecore_thread_check() */ -EAPI Eina_Bool -ecore_thread_cancel(Ecore_Thread *thread); +EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread); /** * Checks if a thread is pending cancellation * @@ -1744,8 +1590,7 @@ ecore_thread_cancel(Ecore_Thread *thread); * * @see ecore_thread_cancel() */ -EAPI Eina_Bool -ecore_thread_check(Ecore_Thread *thread); +EAPI Eina_Bool ecore_thread_check(Ecore_Thread *thread); /** * Sends data from the worker thread to the main loop * @@ -1767,9 +1612,7 @@ ecore_thread_check(Ecore_Thread *thread); * * @see ecore_thread_feedback_run() */ -EAPI Eina_Bool -ecore_thread_feedback(Ecore_Thread *thread, - const void *msg_data); +EAPI Eina_Bool ecore_thread_feedback(Ecore_Thread *thread, const void *msg_data); /** * Asks for the function in the thread to be called again at a later time * @@ -1778,7 +1621,7 @@ ecore_thread_feedback(Ecore_Thread *thread, * EINA_FALSE if anything goes wrong. * * This function should be called only from the same function represented - * by @pthread. + * by @p thread. * * Calling this function will mark the thread for a reschedule, so as soon * as it returns, it will be added to the end of the list of pending tasks. @@ -1793,8 +1636,7 @@ ecore_thread_feedback(Ecore_Thread *thread, * Similarly, if the @p thread is cancelled, the reschedule will not take * effect. */ -EAPI Eina_Bool -ecore_thread_reschedule(Ecore_Thread *thread); +EAPI Eina_Bool ecore_thread_reschedule(Ecore_Thread *thread); /** * Gets the number of active threads running jobs * @@ -1808,8 +1650,7 @@ ecore_thread_reschedule(Ecore_Thread *thread); * in the return of this function unless the thread creation fails and it * falls back to using one from the pool. */ -EAPI int -ecore_thread_active_get(void); +EAPI int ecore_thread_active_get(void); /** * Gets the number of short jobs waiting for a thread to run * @@ -1818,8 +1659,7 @@ ecore_thread_active_get(void); * This returns the number of tasks started with ecore_thread_run() that are * pending, waiting for a thread to become available to run them. */ -EAPI int -ecore_thread_pending_get(void); +EAPI int ecore_thread_pending_get(void); /** * Gets the number of feedback jobs waiting for a thread to run * @@ -1828,18 +1668,16 @@ ecore_thread_pending_get(void); * This returns the number of tasks started with ecore_thread_feedback_run() * that are pending, waiting for a thread to become available to run them. */ -EAPI int -ecore_thread_pending_feedback_get(void); +EAPI int ecore_thread_pending_feedback_get(void); /** * Gets the total number of pending jobs * * @return Number of pending threads running jobs * * Same as the sum of ecore_thread_pending_get() and - * ecore_thread_pending_feedback_get(). + *ecore_thread_pending_feedback_get(). */ -EAPI int -ecore_thread_pending_total_get(void); +EAPI int ecore_thread_pending_total_get(void); /** * Gets the maximum number of threads that can run simultaneously * @@ -1847,7 +1685,7 @@ ecore_thread_pending_total_get(void); * * This returns the maximum number of Ecore_Thread's that may be running at * the same time. If this number is reached, new jobs started by either - * ecore_thread_run() or ecore_thread_feedback_run() will be added to the + *ecore_thread_run() or ecore_thread_feedback_run() will be added to the * respective pending queue until one of the running threads finishes its * task and becomes available to run a new one. * @@ -1858,8 +1696,7 @@ ecore_thread_pending_total_get(void); * @see ecore_thread_max_set() * @see ecore_thread_max_reset() */ -EAPI int -ecore_thread_max_get(void); +EAPI int ecore_thread_max_get(void); /** * Sets the maximum number of threads allowed to run simultaneously * @@ -1872,8 +1709,7 @@ ecore_thread_max_get(void); * @see ecore_thread_max_get() * @see ecore_thread_max_reset() */ -EAPI void -ecore_thread_max_set(int num); +EAPI void ecore_thread_max_set(int num); /** * Resets the maximum number of concurrently running threads to the default * @@ -1883,8 +1719,7 @@ ecore_thread_max_set(int num); * @see ecore_thread_max_get() * @see ecore_thread_max_set() */ -EAPI void -ecore_thread_max_reset(void); +EAPI void ecore_thread_max_reset(void); /** * Gets the number of threads available for running tasks * @@ -1896,8 +1731,7 @@ ecore_thread_max_reset(void); * changed the maximum number of running threads while other tasks are * running. */ -EAPI int -ecore_thread_available_get(void); +EAPI int ecore_thread_available_get(void); /** * Adds some data to a hash local to the thread * @@ -1970,7 +1804,7 @@ ecore_thread_available_get(void); * because @p thread was terminated and the hash destroyed. This parameter * may be NULL, in which case @p value needs to be manually freed after * removing it from the hash with either ecore_thread_local_data_del() or - * ecore_thread_local_data_set(), but it's very unlikely that this is what + *ecore_thread_local_data_set(), but it's very unlikely that this is what * you want. * * This function, and all of the others in the @c ecore_thread_local_data @@ -1982,12 +1816,8 @@ ecore_thread_available_get(void); * @see ecore_thread_local_data_find() * @see ecore_thread_local_data_del() */ -EAPI Eina_Bool -ecore_thread_local_data_add(Ecore_Thread *thread, - const char *key, - void *value, - Eina_Free_Cb cb, - Eina_Bool direct); +EAPI Eina_Bool ecore_thread_local_data_add(Ecore_Thread *thread, const char *key, void *value, + Eina_Free_Cb cb, Eina_Bool direct); /** * Sets some data in the hash local to the given thread * @@ -2015,11 +1845,7 @@ ecore_thread_local_data_add(Ecore_Thread *thread, * @see ecore_thread_local_data_del() * @see ecore_thread_local_data_find() */ -EAPI void * -ecore_thread_local_data_set(Ecore_Thread *thread, - const char *key, - void *value, - Eina_Free_Cb cb); +EAPI void *ecore_thread_local_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb); /** * Gets data stored in the hash local to the given thread * @@ -2037,9 +1863,7 @@ ecore_thread_local_data_set(Ecore_Thread *thread, * @see ecore_thread_local_data_add() * @see ecore_thread_local_data_wait() */ -EAPI void * -ecore_thread_local_data_find(Ecore_Thread *thread, - const char *key); +EAPI void *ecore_thread_local_data_find(Ecore_Thread *thread, const char *key); /** * Deletes from the thread's hash the data corresponding to the given key * @@ -2064,9 +1888,7 @@ ecore_thread_local_data_find(Ecore_Thread *thread, * * @see ecore_thread_local_data_add() */ -EAPI Eina_Bool -ecore_thread_local_data_del(Ecore_Thread *thread, - const char *key); +EAPI Eina_Bool ecore_thread_local_data_del(Ecore_Thread *thread, const char *key); /** * Adds some data to a hash shared by all threads @@ -2096,7 +1918,7 @@ ecore_thread_local_data_del(Ecore_Thread *thread, * because Ecore Thread was shut down and the hash destroyed. This parameter * may be NULL, in which case @p value needs to be manually freed after * removing it from the hash with either ecore_thread_global_data_del() or - * ecore_thread_global_data_set(). + *ecore_thread_global_data_set(). * * Manually freeing any data that was added to the hash with a @p cb function * is likely to produce a segmentation fault, or any other strange @@ -2106,11 +1928,7 @@ ecore_thread_local_data_del(Ecore_Thread *thread, * @see ecore_thread_global_data_set() * @see ecore_thread_global_data_find() */ -EAPI Eina_Bool -ecore_thread_global_data_add(const char *key, - void *value, - Eina_Free_Cb cb, - Eina_Bool direct); +EAPI Eina_Bool ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct); /** * Sets some data in the hash shared by all threads * @@ -2132,10 +1950,7 @@ ecore_thread_global_data_add(const char *key, * @see ecore_thread_global_data_del() * @see ecore_thread_global_data_find() */ -EAPI void * -ecore_thread_global_data_set(const char *key, - void *value, - Eina_Free_Cb cb); +EAPI void *ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb); /** * Gets data stored in the hash shared by all threads * @@ -2152,8 +1967,7 @@ ecore_thread_global_data_set(const char *key, * @see ecore_thread_global_data_add() * @see ecore_thread_global_data_wait() */ -EAPI void * -ecore_thread_global_data_find(const char *key); +EAPI void *ecore_thread_global_data_find(const char *key); /** * Deletes from the shared hash the data corresponding to the given key * @@ -2176,8 +1990,7 @@ ecore_thread_global_data_find(const char *key); * * @see ecore_thread_global_data_add() */ -EAPI Eina_Bool -ecore_thread_global_data_del(const char *key); +EAPI Eina_Bool ecore_thread_global_data_del(const char *key); /** * Gets data stored in the shared hash, or wait for it if it doesn't exist * @@ -2190,7 +2003,7 @@ ecore_thread_global_data_del(const char *key); * If there's nothing in the hash under the given @p key, the function * will block and wait up to @p seconds seconds for some other thread to * add it with either ecore_thread_global_data_add() or - * ecore_thread_global_data_set(). If after waiting there's still no data + *ecore_thread_global_data_set(). If after waiting there's still no data * to get, NULL will be returned. * * If @p seconds is 0, then no waiting will happen and this function works @@ -2205,9 +2018,7 @@ ecore_thread_global_data_del(const char *key); * @see ecore_thread_global_data_add() * @see ecore_thread_global_data_find() */ -EAPI void * -ecore_thread_global_data_wait(const char *key, - double seconds); +EAPI void *ecore_thread_global_data_wait(const char *key, double seconds); /** * @} @@ -2242,27 +2053,14 @@ typedef struct _Ecore_Pipe Ecore_Pipe; /**< A handle for pipes */ */ typedef void (*Ecore_Pipe_Cb)(void *data, void *buffer, unsigned int nbyte); -EAPI Ecore_Pipe * -ecore_pipe_add(Ecore_Pipe_Cb handler, - const void *data); -EAPI void * - ecore_pipe_del(Ecore_Pipe *p); -EAPI Eina_Bool - ecore_pipe_write(Ecore_Pipe *p, - const void *buffer, - unsigned int nbytes); -EAPI void - ecore_pipe_write_close(Ecore_Pipe *p); -EAPI void - ecore_pipe_read_close(Ecore_Pipe *p); -EAPI void - ecore_pipe_thaw(Ecore_Pipe *p); -EAPI void - ecore_pipe_freeze(Ecore_Pipe *p); -EAPI int - ecore_pipe_wait(Ecore_Pipe *p, - int message_count, - double wait); +EAPI Ecore_Pipe *ecore_pipe_add(Ecore_Pipe_Cb handler, const void *data); +EAPI void *ecore_pipe_del(Ecore_Pipe *p); +EAPI Eina_Bool ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes); +EAPI void ecore_pipe_write_close(Ecore_Pipe *p); +EAPI void ecore_pipe_read_close(Ecore_Pipe *p); +EAPI void ecore_pipe_thaw(Ecore_Pipe *p); +EAPI void ecore_pipe_freeze(Ecore_Pipe *p); +EAPI int ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait); /** * @} @@ -2284,7 +2082,7 @@ EAPI int * will be processed first). This also gives the chance to other * actions in your program to cancel the job before it is started. * - * Examples of using @ref Ecore_Job: + * Examples of using @ref Ecore_Job : * @li @ref ecore_job_example_c * * @ingroup Ecore_Main_Loop_Group @@ -2294,11 +2092,8 @@ EAPI int typedef struct _Ecore_Job Ecore_Job; /**< A job handle */ -EAPI Ecore_Job * -ecore_job_add(Ecore_Cb func, - const void *data); -EAPI void * -ecore_job_del(Ecore_Job *job); +EAPI Ecore_Job *ecore_job_add(Ecore_Cb func, const void *data); +EAPI void *ecore_job_del(Ecore_Job *job); /** * @} @@ -2310,14 +2105,9 @@ ecore_job_del(Ecore_Job *job); * @{ */ -EAPI void -ecore_app_args_set(int argc, - const char **argv); -EAPI void -ecore_app_args_get(int *argc, - char ***argv); -EAPI void -ecore_app_restart(void); +EAPI void ecore_app_args_set(int argc, const char **argv); +EAPI void ecore_app_args_get(int *argc, char ***argv); +EAPI void ecore_app_restart(void); /** * @} @@ -2331,10 +2121,8 @@ ecore_app_restart(void); * @{ */ -EAPI void - ecore_throttle_adjust(double amount); -EAPI double - ecore_throttle_get(void); +EAPI void ecore_throttle_adjust(double amount); +EAPI double ecore_throttle_get(void); /** * @} diff --git a/libraries/ecore/src/lib/ecore/Makefile.am b/libraries/ecore/src/lib/ecore/Makefile.am index 2fb6a0a..ec3d99f 100644 --- a/libraries/ecore/src/lib/ecore/Makefile.am +++ b/libraries/ecore/src/lib/ecore/Makefile.am @@ -11,6 +11,7 @@ includesdir = $(includedir)/ecore-@VMAJ@ libecore_la_SOURCES = \ ecore.c \ +ecore_alloc.c \ ecore_anim.c \ ecore_app.c \ ecore_events.c \ diff --git a/libraries/ecore/src/lib/ecore/Makefile.in b/libraries/ecore/src/lib/ecore/Makefile.in index e19bfde..66a25cd 100644 --- a/libraries/ecore/src/lib/ecore/Makefile.in +++ b/libraries/ecore/src/lib/ecore/Makefile.in @@ -91,8 +91,8 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libecore_la_DEPENDENCIES = -am__libecore_la_SOURCES_DIST = ecore.c ecore_anim.c ecore_app.c \ - ecore_events.c ecore_getopt.c ecore_idle_enterer.c \ +am__libecore_la_SOURCES_DIST = ecore.c ecore_alloc.c ecore_anim.c \ + ecore_app.c ecore_events.c ecore_getopt.c ecore_idle_enterer.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 ecore_exe_win32.c \ @@ -102,13 +102,13 @@ am__libecore_la_SOURCES_DIST = ecore.c ecore_anim.c ecore_app.c \ @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_libecore_la_OBJECTS = ecore.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_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) libecore_la_OBJECTS = $(am_libecore_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -266,10 +266,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -288,6 +288,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -401,6 +405,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -413,6 +419,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -457,12 +465,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ @@ -488,12 +498,12 @@ Ecore.h \ Ecore_Getopt.h includesdir = $(includedir)/ecore-@VMAJ@ -libecore_la_SOURCES = ecore.c ecore_anim.c ecore_app.c ecore_events.c \ - ecore_getopt.c ecore_idle_enterer.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) +libecore_la_SOURCES = ecore.c ecore_alloc.c ecore_anim.c ecore_app.c \ + ecore_events.c ecore_getopt.c ecore_idle_enterer.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) 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 @@ -572,6 +582,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_anim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_app.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_events.Plo@am__quote@ diff --git a/libraries/ecore/src/lib/ecore/ecore.c b/libraries/ecore/src/lib/ecore/ecore.c index 99d79c1..7e0f973 100644 --- a/libraries/ecore/src/lib/ecore/ecore.c +++ b/libraries/ecore/src/lib/ecore/ecore.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include #include @@ -159,6 +160,7 @@ ecore_init(void) } if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1; if (_ecore_fps_debug) _ecore_fps_debug_init(); + if (!ecore_mempool_init()) goto shutdown_mempool; _ecore_main_loop_init(); _ecore_signal_init(); _ecore_thread_init(); @@ -191,6 +193,8 @@ ecore_init(void) return _ecore_init_count; +shutdown_mempool: + ecore_mempool_shutdown(); shutdown_log_dom: eina_shutdown(); shutdown_evil: @@ -219,8 +223,22 @@ ecore_shutdown(void) _ecore_lock(); if (--_ecore_init_count != 0) goto unlock; - - ecore_pipe_del(_thread_call); + + /* this looks horrible - a hack for now, but something to note. as + * we delete the _thread_call pipe a thread COULD be doing + * ecore_pipe_write() or what not to it at the same time - we + * must ensure all possible users of this _thread_call are finished + * and exited before we delete it here */ + /* + * ok - this causes other valgrind complaints regarding glib aquiring + * locks internally. so fix bug a or bug b. let's leave the original + * bug in then and leave this as a note for now + Ecore_Pipe *p; + p = _thread_call; + _thread_call = NULL; + ecore_pipe_wait(p, 1, 0.1); + ecore_pipe_del(p); + */ eina_lock_free(&_thread_safety); eina_condition_free(&_thread_cond); eina_lock_free(&_thread_mutex); @@ -255,7 +273,7 @@ ecore_shutdown(void) _ecore_memory_max_free); } #endif - + ecore_mempool_shutdown(); eina_log_domain_unregister(_ecore_log_dom); _ecore_log_dom = -1; eina_shutdown(); diff --git a/libraries/ecore/src/lib/ecore/ecore_alloc.c b/libraries/ecore/src/lib/ecore/ecore_alloc.c new file mode 100644 index 0000000..412c383 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_alloc.c @@ -0,0 +1,132 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +typedef struct _Ecore_Mempool Ecore_Mempool; +struct _Ecore_Mempool +{ + const char *name; + Eina_Mempool *mp; + size_t size; +}; + +#define GENERIC_ALLOC_FREE(TYPE, Type) \ + extern size_t _ecore_sizeof_##TYPE; \ + Ecore_Mempool Type##_mp = { #TYPE, NULL, 0 }; \ + TYPE * \ + Type##_calloc(unsigned int num) \ + { \ + return eina_mempool_calloc(Type##_mp.mp, \ + num * _ecore_sizeof_##TYPE); \ + } \ + void \ + Type##_mp_free(TYPE *e) \ + { \ + eina_mempool_free(Type##_mp.mp, e); \ + } + +GENERIC_ALLOC_FREE(Ecore_Animator, ecore_animator); +GENERIC_ALLOC_FREE(Ecore_Event_Handler, ecore_event_handler); +GENERIC_ALLOC_FREE(Ecore_Event_Filter, ecore_event_filter); +GENERIC_ALLOC_FREE(Ecore_Event, ecore_event); +GENERIC_ALLOC_FREE(Ecore_Idle_Exiter, ecore_idle_exiter); +GENERIC_ALLOC_FREE(Ecore_Idle_Enterer, ecore_idle_enterer); +GENERIC_ALLOC_FREE(Ecore_Idler, ecore_idler); +GENERIC_ALLOC_FREE(Ecore_Job, ecore_job); +GENERIC_ALLOC_FREE(Ecore_Timer, ecore_timer); +GENERIC_ALLOC_FREE(Ecore_Poller, ecore_poller); +GENERIC_ALLOC_FREE(Ecore_Pipe, ecore_pipe); +GENERIC_ALLOC_FREE(Ecore_Fd_Handler, ecore_fd_handler); +#ifdef _WIN32 +GENERIC_ALLOC_FREE(Ecore_Win32_Handler, ecore_win32_handler); +#endif + +static Ecore_Mempool *mempool_array[] = { + &ecore_animator_mp, + &ecore_event_handler_mp, + &ecore_event_filter_mp, + &ecore_event_mp, + &ecore_idle_exiter_mp, + &ecore_idle_enterer_mp, + &ecore_idler_mp, + &ecore_job_mp, + &ecore_timer_mp, + &ecore_poller_mp, + &ecore_pipe_mp, + &ecore_fd_handler_mp, +#ifdef _WIN32 + &ecore_win32_handler_mp +#endif +}; + +Eina_Bool +ecore_mempool_init(void) +{ + const char *choice; + unsigned int i; + +#define MP_SIZE_INIT(TYPE, Type) \ + Type##_mp.size = _ecore_sizeof_##TYPE + + MP_SIZE_INIT(Ecore_Animator, ecore_animator); + MP_SIZE_INIT(Ecore_Event_Handler, ecore_event_handler); + MP_SIZE_INIT(Ecore_Event_Filter, ecore_event_filter); + MP_SIZE_INIT(Ecore_Event, ecore_event); + MP_SIZE_INIT(Ecore_Idle_Exiter, ecore_idle_exiter); + MP_SIZE_INIT(Ecore_Idle_Enterer, ecore_idle_enterer); + MP_SIZE_INIT(Ecore_Idler, ecore_idler); + MP_SIZE_INIT(Ecore_Job, ecore_job); + MP_SIZE_INIT(Ecore_Timer, ecore_timer); + MP_SIZE_INIT(Ecore_Poller, ecore_poller); + MP_SIZE_INIT(Ecore_Pipe, ecore_pipe); + MP_SIZE_INIT(Ecore_Fd_Handler, ecore_fd_handler); +#ifdef _WIN32 + MP_SIZE_INIT(Ecore_Win32_Handler, ecore_win32_handler); +#endif +#undef MP_SIZE_INIT + + choice = getenv("EINA_MEMPOOL"); + if ((!choice) || (!choice[0])) + choice = "chained_mempool"; + + for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i) + { + retry: + mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64); + if (!mempool_array[i]->mp) + { + if (!strcmp(choice, "pass_through")) + { + ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice); + choice = "pass_through"; + goto retry; + } + else + { + ERR("Impossible to allocate mempool '%s' !", choice); + return EINA_FALSE; + } + } + } + return EINA_TRUE; +} + +void +ecore_mempool_shutdown(void) +{ + unsigned int i; + + for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i) + { + eina_mempool_del(mempool_array[i]->mp); + mempool_array[i]->mp = NULL; + } +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_anim.c b/libraries/ecore/src/lib/ecore/ecore_anim.c index 9adaa77..78abad7 100644 --- a/libraries/ecore/src/lib/ecore/ecore_anim.c +++ b/libraries/ecore/src/lib/ecore/ecore_anim.c @@ -22,8 +22,11 @@ struct _Ecore_Animator Eina_Bool delete_me : 1; Eina_Bool suspended : 1; + Eina_Bool just_added : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Animator); + static Eina_Bool _ecore_animator_run(void *data); static Eina_Bool _ecore_animator(void *data); @@ -99,7 +102,13 @@ _do_tick(void) EINA_INLIST_FOREACH(animators, animator) { - if (!animator->delete_me && !animator->suspended) + animator->just_added = EINA_FALSE; + } + EINA_INLIST_FOREACH(animators, animator) + { + if ((!animator->delete_me) && + (!animator->suspended) && + (!animator->just_added)) { if (!_ecore_call_task_cb(animator->func, animator->data)) { @@ -107,6 +116,7 @@ _do_tick(void) animators_delete_me++; } } + else animator->just_added = EINA_FALSE; } if (animators_delete_me) { @@ -121,7 +131,7 @@ _do_tick(void) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE); - free(animator); + ecore_animator_mp_free(animator); animators_delete_me--; if (animators_delete_me == 0) break; } @@ -142,11 +152,12 @@ _ecore_animator_add(Ecore_Task_Cb func, Ecore_Animator *animator = NULL; if (!func) return animator; - animator = calloc(1, sizeof(Ecore_Animator)); + animator = ecore_animator_calloc(1); if (!animator) return animator; ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR); animator->func = func; animator->data = (void *)data; + animator->just_added = EINA_TRUE; animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); _begin_tick(); return animator; @@ -443,7 +454,7 @@ _ecore_animator_shutdown(void) animator = animators; animators = (Ecore_Animator *)eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators)); ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE); - free(animator); + ecore_animator_mp_free(animator); } } diff --git a/libraries/ecore/src/lib/ecore/ecore_events.c b/libraries/ecore/src/lib/ecore/ecore_events.c index f31baf8..0550224 100644 --- a/libraries/ecore/src/lib/ecore/ecore_events.c +++ b/libraries/ecore/src/lib/ecore/ecore_events.c @@ -19,6 +19,7 @@ struct _Ecore_Event_Handler int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Handler); struct _Ecore_Event_Filter { @@ -32,6 +33,7 @@ struct _Ecore_Event_Filter int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event_Filter); struct _Ecore_Event { @@ -44,6 +46,7 @@ struct _Ecore_Event int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Event); static int events_num = 0; static Ecore_Event *events = NULL; @@ -109,7 +112,7 @@ ecore_event_handler_add(int type, if (!func) goto unlock; if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) goto unlock; - eh = calloc(1, sizeof(Ecore_Event_Handler)); + eh = ecore_event_handler_calloc(1); if (!eh) goto unlock; ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER); eh->type = type; @@ -130,7 +133,7 @@ ecore_event_handler_add(int type, new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *)); if (!new_handlers) { - free(eh); + ecore_event_handler_mp_free(eh); goto unlock; } event_handlers = new_handlers; @@ -234,7 +237,7 @@ unlock: static void _ecore_event_generic_free(void *data __UNUSED__, void *event) -{ +{ /* DO NOT MEMPOOL FREE THIS */ free (event); } @@ -358,7 +361,7 @@ ecore_event_filter_add(Ecore_Data_Cb func_start, _ecore_lock(); if (!func_filter) goto unlock; - ef = calloc(1, sizeof(Ecore_Event_Filter)); + ef = ecore_event_filter_calloc(1); if (!ef) goto unlock; ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER); ef->func_start = func_start; @@ -469,11 +472,11 @@ _ecore_event_shutdown(void) { event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i])); ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE); - if (!eh->delete_me) free(eh); + if (!eh->delete_me) ecore_event_handler_mp_free(eh); } } EINA_LIST_FREE(event_handlers_delete_list, eh) - free(eh); + ecore_event_handler_mp_free(eh); if (event_handlers) free(event_handlers); event_handlers = NULL; event_handlers_num = 0; @@ -482,7 +485,7 @@ _ecore_event_shutdown(void) { event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters)); ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE); - free(ef); + ecore_event_filter_mp_free(ef); } event_filters_delete_me = 0; event_filter_current = NULL; @@ -506,7 +509,7 @@ _ecore_event_add(int type, { Ecore_Event *e; - e = calloc(1, sizeof(Ecore_Event)); + e = ecore_event_calloc(1); if (!e) return NULL; ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT); e->type = type; @@ -535,7 +538,7 @@ _ecore_event_del(Ecore_Event *event) if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event); events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event)); ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE); - free(event); + ecore_event_mp_free(event); events_num--; return data; } @@ -638,7 +641,7 @@ _ecore_event_filters_apply() event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef)); ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE); - free(ef); + ecore_event_filter_mp_free(ef); } } if (!deleted_in_use) @@ -742,7 +745,7 @@ _ecore_event_call(void) event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh)); ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE); - free(eh); + ecore_event_handler_mp_free(eh); } } diff --git a/libraries/ecore/src/lib/ecore/ecore_getopt.c b/libraries/ecore/src/lib/ecore/ecore_getopt.c index 0ce8f6e..76272d3 100644 --- a/libraries/ecore/src/lib/ecore/ecore_getopt.c +++ b/libraries/ecore/src/lib/ecore/ecore_getopt.c @@ -19,6 +19,7 @@ extern "C" void *alloca(size_t); #endif +#include #include #include #include @@ -130,7 +131,7 @@ _ecore_getopt_help_line(FILE *fp, todo = len; for (i = 0; i < todo; i++) - if (isspace(text[i])) + if (isspace((unsigned char)text[i])) { space = text + i; break; @@ -1762,7 +1763,7 @@ _ecore_getopt_find_help(const Ecore_Getopt *parser) * will be applied on them if ecore was compiled with such support. * * @param parser description of how to work. - * @param value where to store values, it is assumed that this is a vector + * @param values where to store values, it is assumed that this is a vector * of the same size as @c parser->descs. Values should be previously * initialized. * @param argc how many elements in @a argv. If not provided it will be @@ -1854,7 +1855,8 @@ ecore_getopt_list_free(Eina_List *list) /** * Helper ecore_getopt callback to parse geometry (x:y:w:h). * - * Storage must be a pointer to @c Eina_Rectangle and will be used to + * @param str Geometry value + * @param storage must be a pointer to @c Eina_Rectangle and will be used to * store the four values passed in the given string. * * @c callback_data value is ignored, you can safely use @c NULL. @@ -1880,7 +1882,8 @@ ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__, /** * Helper ecore_getopt callback to parse geometry size (WxH). * - * Storage must be a pointer to @c Eina_Rectangle and will be used to + * @param str size value + * @param storage must be a pointer to @c Eina_Rectangle and will be used to * store the two values passed in the given string and 0 in the x and y * fields. * diff --git a/libraries/ecore/src/lib/ecore/ecore_glib.c b/libraries/ecore/src/lib/ecore/ecore_glib.c index 6ddcd36..7cea1c9 100644 --- a/libraries/ecore/src/lib/ecore/ecore_glib.c +++ b/libraries/ecore/src/lib/ecore/ecore_glib.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include "Ecore.h" @@ -189,7 +190,9 @@ _ecore_glib_select(int ecore_fds, int ret; if (g_main_context_acquire(ctx)) - g_mutex_lock(mutex); + { + if (mutex) g_mutex_lock(mutex); + } else { if (!_ecore_glib_cond) @@ -202,8 +205,9 @@ _ecore_glib_select(int ecore_fds, ret = _ecore_glib_select__locked (ctx, ecore_fds, rfds, wfds, efds, ecore_timeout); - g_mutex_unlock(mutex); + if (mutex) g_mutex_unlock(mutex); g_main_context_release(ctx); + g_static_mutex_free(&lock); return ret; } diff --git a/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c b/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c index 03cd1c4..8e4ae50 100644 --- a/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c +++ b/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c @@ -16,6 +16,7 @@ struct _Ecore_Idle_Enterer int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Enterer); static Ecore_Idle_Enterer *idle_enterers = NULL; static Ecore_Idle_Enterer *idle_enterer_current = NULL; @@ -49,7 +50,7 @@ ecore_idle_enterer_add(Ecore_Task_Cb func, _ecore_lock(); if (!func) goto unlock; - ie = calloc(1, sizeof(Ecore_Idle_Enterer)); + ie = ecore_idle_enterer_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); ie->func = func; @@ -79,7 +80,7 @@ ecore_idle_enterer_before_add(Ecore_Task_Cb func, _ecore_lock(); if (!func) goto unlock; - ie = calloc(1, sizeof(Ecore_Idle_Enterer)); + ie = ecore_idle_enterer_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); ie->func = func; @@ -134,7 +135,7 @@ _ecore_idle_enterer_shutdown(void) { idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers)); ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); - free(ie); + ecore_idle_enterer_mp_free(ie); } idle_enterers_delete_me = 0; idle_enterer_current = NULL; @@ -190,7 +191,7 @@ _ecore_idle_enterer_call(void) idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); - free(ie); + ecore_idle_enterer_mp_free(ie); } } if (!deleted_idler_enterers_in_use) diff --git a/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c b/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c index 70c6a7a..4e454e2 100644 --- a/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c +++ b/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c @@ -16,6 +16,7 @@ struct _Ecore_Idle_Exiter int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idle_Exiter); static Ecore_Idle_Exiter *idle_exiters = NULL; static Ecore_Idle_Exiter *idle_exiter_current = NULL; @@ -47,7 +48,7 @@ ecore_idle_exiter_add(Ecore_Task_Cb func, _ecore_lock(); if (!func) goto unlock; - ie = calloc(1, sizeof(Ecore_Idle_Exiter)); + ie = ecore_idle_exiter_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER); ie->func = func; @@ -102,7 +103,7 @@ _ecore_idle_exiter_shutdown(void) { idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters)); ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); - free(ie); + ecore_idle_exiter_mp_free(ie); } idle_exiters_delete_me = 0; idle_exiter_current = NULL; @@ -159,7 +160,7 @@ _ecore_idle_exiter_call(void) idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie)); ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); - free(ie); + ecore_idle_exiter_mp_free(ie); } } if (!deleted_idler_exiters_in_use) diff --git a/libraries/ecore/src/lib/ecore/ecore_idler.c b/libraries/ecore/src/lib/ecore/ecore_idler.c index 6c0cab8..5114654 100644 --- a/libraries/ecore/src/lib/ecore/ecore_idler.c +++ b/libraries/ecore/src/lib/ecore/ecore_idler.c @@ -16,6 +16,7 @@ struct _Ecore_Idler int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Idler); static Ecore_Idler *idlers = NULL; static Ecore_Idler *idler_current = NULL; @@ -32,7 +33,7 @@ ecore_idler_add(Ecore_Task_Cb func, _ecore_lock(); if (!func) goto unlock; - ie = calloc(1, sizeof(Ecore_Idler)); + ie = ecore_idler_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLER); ie->func = func; @@ -86,7 +87,7 @@ _ecore_idler_shutdown(void) { idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers)); ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); - free(ie); + ecore_idler_mp_free(ie); } idlers_delete_me = 0; idler_current = NULL; @@ -139,7 +140,7 @@ _ecore_idler_all_call(void) idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie)); ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); - free(ie); + ecore_idler_mp_free(ie); } } if (!deleted_idlers_in_use) diff --git a/libraries/ecore/src/lib/ecore/ecore_job.c b/libraries/ecore/src/lib/ecore/ecore_job.c index 481c3f3..ac27c7a 100644 --- a/libraries/ecore/src/lib/ecore/ecore_job.c +++ b/libraries/ecore/src/lib/ecore/ecore_job.c @@ -23,6 +23,7 @@ struct _Ecore_Job Ecore_Cb func; void *data; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Job); void _ecore_job_init(void) @@ -61,13 +62,13 @@ ecore_job_add(Ecore_Cb func, if (!func) return NULL; - job = calloc(1, sizeof(Ecore_Job)); + job = ecore_job_calloc(1); if (!job) return NULL; ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB); job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, NULL); if (!job->event) { - free(job); + ecore_job_mp_free(job); return NULL; } job->func = func; @@ -115,8 +116,8 @@ _ecore_job_event_handler(void *data __UNUSED__, static void _ecore_job_event_free(void *data __UNUSED__, - void *ev) + void *job) { - free(ev); + ecore_job_mp_free(job); } diff --git a/libraries/ecore/src/lib/ecore/ecore_main.c b/libraries/ecore/src/lib/ecore/ecore_main.c index 152836a..76aced6 100644 --- a/libraries/ecore/src/lib/ecore/ecore_main.c +++ b/libraries/ecore/src/lib/ecore/ecore_main.c @@ -167,6 +167,7 @@ struct _Ecore_Fd_Handler GPollFD gfd; #endif }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Fd_Handler); #ifdef _WIN32 struct _Ecore_Win32_Handler @@ -179,6 +180,7 @@ struct _Ecore_Win32_Handler int references; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Win32_Handler); #endif #ifndef USE_G_MAIN_LOOP @@ -207,9 +209,7 @@ static void _ecore_main_win32_handlers_cleanup(void); #endif static int in_main_loop = 0; -#ifndef USE_G_MAIN_LOOP static int do_quit = 0; -#endif static Ecore_Fd_Handler *fd_handlers = NULL; static Ecore_Fd_Handler *fd_handler_current = NULL; static Eina_List *fd_handlers_with_prep = NULL; @@ -889,8 +889,13 @@ ecore_main_loop_begin(void) in_main_loop--; _ecore_unlock(); #else - ecore_main_loop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(ecore_main_loop); + if (!do_quit) + { + if (!ecore_main_loop) + ecore_main_loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(ecore_main_loop); + } + do_quit = 0; #endif } @@ -904,10 +909,10 @@ ecore_main_loop_begin(void) EAPI void ecore_main_loop_quit(void) { -#ifndef USE_G_MAIN_LOOP do_quit = 1; -#else - g_main_loop_quit(ecore_main_loop); +#ifdef USE_G_MAIN_LOOP + if (ecore_main_loop) + g_main_loop_quit(ecore_main_loop); #endif } @@ -987,7 +992,7 @@ ecore_main_fd_handler_add(int fd, if ((fd < 0) || (flags == 0) || (!func)) goto unlock; - fdh = calloc(1, sizeof(Ecore_Fd_Handler)); + fdh = ecore_fd_handler_calloc(1); if (!fdh) goto unlock; ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER); fdh->next_ready = NULL; @@ -997,7 +1002,7 @@ ecore_main_fd_handler_add(int fd, { int err = errno; ERR("Failed to add poll on fd %d (errno = %d: %s)!", fd, err, strerror(err)); - free(fdh); + ecore_fd_handler_mp_free(fdh); fdh = NULL; goto unlock; } @@ -1030,7 +1035,7 @@ ecore_main_win32_handler_add(void *h, if (!h || !func) return NULL; - wh = calloc(1, sizeof(Ecore_Win32_Handler)); + wh = ecore_win32_handler_calloc(1); if (!wh) return NULL; ECORE_MAGIC_SET(wh, ECORE_MAGIC_WIN32_HANDLER); wh->h = (HANDLE)h; @@ -1260,7 +1265,7 @@ _ecore_main_shutdown(void) fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh)); ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); - free(fdh); + ecore_fd_handler_mp_free(fdh); } if (fd_handlers_with_buffer) fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer); @@ -1283,7 +1288,7 @@ _ecore_main_shutdown(void) win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers), EINA_INLIST_GET(wh)); ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE); - free(wh); + ecore_win32_handler_mp_free(wh); } win32_handlers_delete_me = EINA_FALSE; win32_handler_current = NULL; @@ -1524,7 +1529,7 @@ _ecore_main_fd_handlers_cleanup(void) fd_handlers = (Ecore_Fd_Handler *) eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh)); ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); - free(fdh); + ecore_fd_handler_mp_free(fdh); fd_handlers_to_delete = eina_list_remove_list(fd_handlers_to_delete, l); } } @@ -1555,7 +1560,7 @@ _ecore_main_win32_handlers_cleanup(void) eina_inlist_remove(EINA_INLIST_GET(win32_handlers), EINA_INLIST_GET(wh)); ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE); - free(wh); + ecore_win32_handler_mp_free(wh); } } if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE; diff --git a/libraries/ecore/src/lib/ecore/ecore_pipe.c b/libraries/ecore/src/lib/ecore/ecore_pipe.c index 0ab7dd0..aa640cd 100644 --- a/libraries/ecore/src/lib/ecore/ecore_pipe.c +++ b/libraries/ecore/src/lib/ecore/ecore_pipe.c @@ -95,6 +95,7 @@ struct _Ecore_Pipe int message; Eina_Bool delete_me : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Pipe); static Eina_Bool _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler); @@ -125,12 +126,12 @@ ecore_pipe_add(Ecore_Pipe_Cb handler, if (!handler) return NULL; - p = (Ecore_Pipe *)calloc(1, sizeof(Ecore_Pipe)); + p = ecore_pipe_calloc(1); if (!p) return NULL; if (pipe(fds)) { - free(p); + ecore_pipe_mp_free(p); return NULL; } @@ -171,7 +172,7 @@ ecore_pipe_del(Ecore_Pipe *p) if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read); if (p->fd_write != PIPE_FD_INVALID) pipe_close(p->fd_write); data = (void *)p->data; - free(p); + ecore_pipe_mp_free(p); return data; } @@ -535,7 +536,6 @@ _ecore_pipe_read(void *data, else if ((ret == PIPE_FD_ERROR) && ((errno == EINTR) || (errno == EAGAIN))) { - _ecore_pipe_unhandle(p); return ECORE_CALLBACK_RENEW; } else @@ -543,7 +543,6 @@ _ecore_pipe_read(void *data, ERR("An unhandled error (ret: %i errno: %i [%s])" "occurred while reading from the pipe the length", (int)ret, errno, strerror(errno)); - _ecore_pipe_unhandle(p); return ECORE_CALLBACK_RENEW; } #else diff --git a/libraries/ecore/src/lib/ecore/ecore_poll.c b/libraries/ecore/src/lib/ecore/ecore_poll.c index a283cb5..732850b 100644 --- a/libraries/ecore/src/lib/ecore/ecore_poll.c +++ b/libraries/ecore/src/lib/ecore/ecore_poll.c @@ -16,6 +16,7 @@ struct _Ecore_Poller Ecore_Task_Cb func; void *data; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Poller); static Ecore_Timer *timer = NULL; static int min_interval = -1; @@ -109,8 +110,8 @@ _ecore_poller_cb_timer(void *data __UNUSED__) at_tick++; last_tick = ecore_time_get(); - /* we have 16 counters - each incriments every time the poller counter - * "ticks". it incriments by the minimum interval (which can be 1, 2, 4, + /* we have 16 counters - each increments every time the poller counter + * "ticks". it increments by the minimum interval (which can be 1, 2, 4, * 7, 16 etc. up to 32768) */ for (i = 0; i < 15; i++) { @@ -159,7 +160,7 @@ _ecore_poller_cb_timer(void *data __UNUSED__) if (poller->delete_me) { pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller)); - free(poller); + ecore_poller_mp_free(poller); poller_delete_count--; changes++; if (poller_delete_count <= 0) break; @@ -179,7 +180,7 @@ _ecore_poller_cb_timer(void *data __UNUSED__) at_tick--; /* if the timer was deleted then there is no point returning 1 - ambiguous - * if we do as it im plies "keep running me" but we have been deleted + * if we do as it implies keep running me" but we have been deleted * anyway */ if (!timer) return ECORE_CALLBACK_CANCEL; @@ -215,7 +216,7 @@ ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__, * @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 specifider 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__) @@ -281,7 +282,7 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__, if (!func) return NULL; if (interval < 1) interval = 1; - poller = calloc(1, sizeof(Ecore_Poller)); + poller = ecore_poller_calloc(1); if (!poller) return NULL; ECORE_MAGIC_SET(poller, ECORE_MAGIC_POLLER); /* interval MUST be a power of 2, so enforce it */ @@ -413,7 +414,7 @@ ecore_poller_del(Ecore_Poller *poller) /* not in loop so safe - delete immediately */ data = poller->data; pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller)); - free(poller); + ecore_poller_mp_free(poller); _ecore_poller_next_tick_eval(); return data; } @@ -433,7 +434,7 @@ _ecore_poller_shutdown(void) while ((poller = pollers[i])) { pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i])); - free(poller); + ecore_poller_mp_free(poller); } } } diff --git a/libraries/ecore/src/lib/ecore/ecore_private.h b/libraries/ecore/src/lib/ecore/ecore_private.h index f328605..50d502c 100644 --- a/libraries/ecore/src/lib/ecore/ecore_private.h +++ b/libraries/ecore/src/lib/ecore/ecore_private.h @@ -79,6 +79,7 @@ extern int _ecore_log_dom; #define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3 #define ECORE_MAGIC_JOB 0x76543210 +typedef unsigned int Ecore_Magic; #define ECORE_MAGIC Ecore_Magic __magic #define ECORE_MAGIC_SET(d, m) (d)->__magic = (m) @@ -116,8 +117,6 @@ ecore_print_warning(const char *function, return; \ } -typedef unsigned int Ecore_Magic; - EAPI void _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, @@ -350,4 +349,30 @@ extern double _ecore_time_loop_time; extern Eina_Bool _ecore_glib_always_integrate; extern Ecore_Select_Function main_loop_select; +Eina_Bool ecore_mempool_init(void); +void ecore_mempool_shutdown(void); +#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \ + TYPE *Type##_calloc(unsigned int); \ + void Type##_mp_free(TYPE *e); +#define GENERIC_ALLOC_SIZE_DECLARE(TYPE) \ + size_t _ecore_sizeof_##TYPE = sizeof (TYPE); + +GENERIC_ALLOC_FREE_HEADER(Ecore_Animator, ecore_animator); +GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Handler, ecore_event_handler); +GENERIC_ALLOC_FREE_HEADER(Ecore_Event_Filter, ecore_event_filter); +GENERIC_ALLOC_FREE_HEADER(Ecore_Event, ecore_event); +GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Exiter, ecore_idle_exiter); +GENERIC_ALLOC_FREE_HEADER(Ecore_Idle_Enterer, ecore_idle_enterer); +GENERIC_ALLOC_FREE_HEADER(Ecore_Idler, ecore_idler); +GENERIC_ALLOC_FREE_HEADER(Ecore_Job, ecore_job); +GENERIC_ALLOC_FREE_HEADER(Ecore_Timer, ecore_timer); +GENERIC_ALLOC_FREE_HEADER(Ecore_Poller, ecore_poller); +GENERIC_ALLOC_FREE_HEADER(Ecore_Pipe, ecore_pipe); +GENERIC_ALLOC_FREE_HEADER(Ecore_Fd_Handler, ecore_fd_handler); +#ifdef _WIN32 +GENERIC_ALLOC_FREE_HEADER(Ecore_Win32_Handler, ecore_win32_handler); +#endif + +#undef GENERIC_ALLOC_FREE_HEADER + #endif diff --git a/libraries/ecore/src/lib/ecore/ecore_thread.c b/libraries/ecore/src/lib/ecore/ecore_thread.c index 2a8ea76..4444ad4 100644 --- a/libraries/ecore/src/lib/ecore/ecore_thread.c +++ b/libraries/ecore/src/lib/ecore/ecore_thread.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include #include @@ -388,7 +389,7 @@ static void _ecore_thread_handler(void *data __UNUSED__, static Ecore_Pipe * _ecore_thread_pipe_get(void) { - if (eina_array_count_get(_ecore_thread_pipe) > 0) + if (eina_array_count(_ecore_thread_pipe) > 0) return eina_array_pop(_ecore_thread_pipe); return ecore_pipe_add(_ecore_thread_handler, NULL); @@ -458,7 +459,7 @@ _ecore_thread_pipe_free(void *data __UNUSED__, { Ecore_Pipe *p = event; - if (eina_array_count_get(_ecore_thread_pipe) < 50) + if (eina_array_count(_ecore_thread_pipe) < 50) eina_array_push(_ecore_thread_pipe, p); else ecore_pipe_del(p); @@ -544,7 +545,7 @@ _ecore_thread_kill(Ecore_Pthread_Worker *work) LKD(work->mutex); if (work->hash) eina_hash_free(work->hash); - free(work); + _ecore_thread_worker_free(work); } static void @@ -594,7 +595,8 @@ _ecore_notify_handler(void *data, } static void -_ecore_short_job(Ecore_Pipe *end_pipe) +_ecore_short_job(Ecore_Pipe *end_pipe, + PH(thread)) { Ecore_Pthread_Worker *work; @@ -614,6 +616,7 @@ _ecore_short_job(Ecore_Pipe *end_pipe) LKU(_ecore_pending_job_threads_mutex); + work->self = thread; if (!work->cancel) work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work); @@ -737,7 +740,7 @@ _ecore_thread_worker(Ecore_Pthread_Data *pth) eina_sched_prio_drop(); restart: - if (_ecore_pending_job_threads) _ecore_short_job(pth->p); + 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); /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */ @@ -929,6 +932,7 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking, work->data = data; #ifdef EFL_HAVE_THREADS + work->self = 0; work->hash = NULL; CDI(work->cond); LKI(work->mutex); @@ -1114,6 +1118,7 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, worker->feedback_run = EINA_TRUE; worker->kill = EINA_FALSE; worker->reschedule = EINA_FALSE; + worker->self = 0; worker->u.feedback_run.send = 0; worker->u.feedback_run.received = 0; diff --git a/libraries/ecore/src/lib/ecore/ecore_timer.c b/libraries/ecore/src/lib/ecore/ecore_timer.c index 9c66545..cc19e3f 100644 --- a/libraries/ecore/src/lib/ecore/ecore_timer.c +++ b/libraries/ecore/src/lib/ecore/ecore_timer.c @@ -35,6 +35,7 @@ struct _Ecore_Timer unsigned char just_added : 1; unsigned char frozen : 1; }; +GENERIC_ALLOC_SIZE_DECLARE(Ecore_Timer); static void _ecore_timer_set(Ecore_Timer *timer, double at, @@ -140,7 +141,7 @@ ecore_timer_add(double in, _ecore_lock(); if (!func) goto unlock; if (in < 0.0) in = 0.0; - timer = calloc(1, sizeof(Ecore_Timer)); + timer = ecore_timer_calloc(1); if (!timer) goto unlock; ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); now = ecore_time_get(); @@ -287,6 +288,37 @@ ecore_timer_delay(Ecore_Timer *timer, } /** + * Reset a timer to its full interval + * This doesn't affect the interval of a timer + * @param timer The timer + * @since 1.2 + * @note This is equivalent to (but faster than) + * @code + * ecore_timer_delay(timer, ecore_timer_interval_get(timer) - ecore_timer_pending_get(timer)); + * @endcode + */ +EAPI void +ecore_timer_reset(Ecore_Timer *timer) +{ + double now, add; + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + __func__); + return; + } + _ecore_lock(); + now = ecore_time_get(); + + if (timer->frozen) + add = timer->pending; + else + add = timer->at - now; + _ecore_timer_delay(timer, timer->in - add); + _ecore_unlock(); +} + +/** * Get the pending time regarding a timer. * * @param timer The timer to learn from. @@ -470,7 +502,7 @@ _ecore_timer_loop_add(double in, if (!func) return timer; if (in < 0.0) in = 0.0; - timer = calloc(1, sizeof(Ecore_Timer)); + timer = ecore_timer_calloc(1); if (!timer) return timer; ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); now = ecore_loop_time_get(); @@ -510,7 +542,7 @@ _ecore_timer_del(Ecore_Timer *timer) if (timer->delete_me) timers_delete_me--; - free(timer); + ecore_timer_mp_free(timer); return data; } @@ -529,14 +561,14 @@ _ecore_timer_shutdown(void) { timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers)); ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); - free(timer); + ecore_timer_mp_free(timer); } while ((timer = suspended)) { suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended)); ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); - free(timer); + ecore_timer_mp_free(timer); } timer_current = NULL; @@ -563,7 +595,7 @@ _ecore_timer_cleanup(void) } timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); - free(timer); + ecore_timer_mp_free(timer); timers_delete_me--; done++; if (timers_delete_me == 0) return; @@ -583,7 +615,7 @@ _ecore_timer_cleanup(void) } suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); - free(timer); + ecore_timer_mp_free(timer); timers_delete_me--; done++; if (timers_delete_me == 0) return; diff --git a/libraries/ecore/src/lib/ecore_cocoa/Makefile.in b/libraries/ecore/src/lib/ecore_cocoa/Makefile.in index ede48a2..15ce879 100644 --- a/libraries/ecore/src/lib/ecore_cocoa/Makefile.in +++ b/libraries/ecore/src/lib/ecore_cocoa/Makefile.in @@ -247,10 +247,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -269,6 +269,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -382,6 +386,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -394,6 +400,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -438,12 +446,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h index e3b68c4..c3af46a 100644 --- a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h +++ b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h @@ -234,6 +234,14 @@ typedef struct _Ecore_Con_Server Ecore_Con_Server; typedef struct _Ecore_Con_Client Ecore_Con_Client; /** + * @typedef Ecore_Con_Socks + * An object representing a SOCKS proxy + * @ingroup Ecore_Con_Socks_Group + * @since 1.2 + */ +typedef struct Ecore_Con_Socks Ecore_Con_Socks; + +/** * @typedef Ecore_Con_Url * A handle to an http upload/download object * @ingroup Ecore_Con_Url_Group @@ -325,6 +333,13 @@ typedef struct _Ecore_Con_Event_Client_Write Ecore_Con_Event_Client_Write; typedef struct _Ecore_Con_Event_Server_Write Ecore_Con_Event_Server_Write; /** + * @typedef Ecore_Con_Event_Proxy_Bind + * Used as the @p data param for the corresponding event + * @since 1.2 + */ +typedef struct _Ecore_Con_Event_Proxy_Bind Ecore_Con_Event_Proxy_Bind; + +/** * @typedef Ecore_Con_Event_Url_Data * Used as the @p data param for the corresponding event * @ingroup Ecore_Con_Url_Group @@ -464,6 +479,19 @@ struct _Ecore_Con_Event_Server_Write }; /** + * @struct _Ecore_Con_Event_Proxy_Bind + * Used as the @p data param for the @ref ECORE_CON_EVENT_PROXY_BIND event + * @ingroup Ecore_Con_Socks_Group + * @since 1.2 + */ +struct _Ecore_Con_Event_Proxy_Bind +{ + Ecore_Con_Server *server; /**< the server object connected to the proxy */ + const char *ip; /**< the proxy-bound ip address */ + int port; /**< the proxy-bound port */ +}; + +/** * @struct _Ecore_Con_Event_Url_Data * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_DATA event * @ingroup Ecore_Con_Url_Group @@ -542,6 +570,10 @@ EAPI extern int ECORE_CON_EVENT_SERVER_WRITE; EAPI extern int ECORE_CON_EVENT_CLIENT_DATA; /** A server connection object has data */ EAPI extern int ECORE_CON_EVENT_SERVER_DATA; +/** A server connection has successfully negotiated an ip:port binding + * @since 1.2 + */ +EAPI extern int ECORE_CON_EVENT_PROXY_BIND; /** A URL object has data */ EAPI extern int ECORE_CON_EVENT_URL_DATA; /** A URL object has completed its transfer to and from the server and can be reused */ @@ -605,7 +637,13 @@ typedef enum _Ecore_Con_Type ECORE_CON_REMOTE_UDP = 5, /** Remote broadcast using UDP */ ECORE_CON_REMOTE_BROADCAST = 6, + /** Remote connection sending packets immediately */ ECORE_CON_REMOTE_NODELAY = 7, + /** Remote connection sending data in large chunks + * @note Only available on Linux + * @since 1.2 + */ + ECORE_CON_REMOTE_CORK = 8, /** Use SSL2: UNSUPPORTED. **/ ECORE_CON_USE_SSL2 = (1 << 4), /** Use SSL3 */ @@ -675,6 +713,8 @@ EAPI Eina_Bool ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr, const EAPI Eina_Bool ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr, const char *ca_file); EAPI void ecore_con_ssl_server_verify(Ecore_Con_Server *svr); EAPI void ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr); +EAPI void ecore_con_ssl_server_verify_name_set(Ecore_Con_Server *svr, const char *name); +EAPI const char *ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr); EAPI Eina_Bool ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type compl_type); EAPI Eina_Bool ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type compl_type); @@ -682,6 +722,18 @@ 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 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); +EAPI void ecore_con_socks_remote_del(Ecore_Con_Socks *ecs); +EAPI void ecore_con_socks_apply_once(Ecore_Con_Socks *ecs); +EAPI void ecore_con_socks_apply_always(Ecore_Con_Socks *ecs); + /** * @defgroup Ecore_Con_Server_Group Ecore Connection Server Functions * @@ -1185,6 +1237,8 @@ EAPI Eina_Bool ecore_con_client_connected_get(Ecore_Con_Client *cl); */ EAPI int ecore_con_client_port_get(Ecore_Con_Client *cl); + + /** * @} */ @@ -1583,7 +1637,7 @@ EAPI Eina_Bool ecore_con_url_post(Ecore_Con_Url *url_con, * modification time. * * @param url_con Ecore_Con_Url to act upon. - * @param condition Condition to use for HTTP requests. + * @param time_condition Condition to use for HTTP requests. * @param timestamp Time since 1 Jan 1970 to use in the condition. * * This function may set the header "If-Modified-Since" or @@ -1791,6 +1845,74 @@ EAPI int ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path); /** + * Set HTTP proxy to use. + * + * The parameter should be a char * to a zero terminated string holding + * the host name or dotted IP address. To specify port number in this string, + * append :[port] to the end of the host name. + * The proxy string may be prefixed with [protocol]:// since any such prefix + * will be ignored. + * The proxy's port number may optionally be specified with the separate option. + * If not specified, libcurl will default to using port 1080 for proxies. + * + * @param url_con Connection object that will use the proxy. + * @param proxy Porxy string or @c NULL to disable + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * @since 1.2 + */ +EAPI Eina_Bool ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy); + +/** + * Set zero terminated username to use for proxy. + * + * if socks protocol is used for proxy, protocol should be socks5 and above. + * + * @param url_con Connection object that will use the proxy. + * @param username Username string. + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * + * @see ecore_con_url_proxy_set() + * + * @since 1.2 + */ +EAPI Eina_Bool ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username); + +/** + * Set zero terminated password to use for proxy. + * + * if socks protocol is used for proxy, protocol should be socks5 and above. + * + * @param url_con Connection object that will use the proxy. + * @param password Password string. + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * + * @see ecore_con_url_proxy_set() + * + * @since 1.2 + */ +EAPI Eina_Bool ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password); + +/** + * Set timeout in seconds. + * + * the maximum time in seconds that you allow the ecore con url transfer + * operation to take. Normally, name lookups can take a considerable time + * and limiting operations to less than a few minutes risk aborting perfectly + * normal operations. + * + * @param url_con Connection object that will use the timeout. + * @param timeout time in seconds. + * + * @see ecore_con_url_cookies_jar_file_set() + * + * @since 1.2 + */ +EAPI void ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout); + +/** * @} */ diff --git a/libraries/ecore/src/lib/ecore_con/Makefile.am b/libraries/ecore/src/lib/ecore_con/Makefile.am index 300586d..929b30e 100644 --- a/libraries/ecore/src/lib/ecore_con/Makefile.am +++ b/libraries/ecore/src/lib/ecore_con/Makefile.am @@ -19,6 +19,7 @@ includesdir = $(includedir)/ecore-@VMAJ@ libecore_con_la_SOURCES = \ ecore_con.c \ +ecore_con_socks.c \ ecore_con_ssl.c \ ecore_con_url.c \ ecore_con_alloc.c diff --git a/libraries/ecore/src/lib/ecore_con/Makefile.in b/libraries/ecore/src/lib/ecore_con/Makefile.in index 5940a83..58811da 100644 --- a/libraries/ecore/src/lib/ecore_con/Makefile.in +++ b/libraries/ecore/src/lib/ecore_con/Makefile.in @@ -92,15 +92,17 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libecore_con_la_DEPENDENCIES = \ $(top_builddir)/src/lib/ecore/libecore.la -am__libecore_con_la_SOURCES_DIST = ecore_con.c ecore_con_ssl.c \ - ecore_con_url.c ecore_con_alloc.c ecore_con_local_win32.c \ - ecore_con_local.c ecore_con_ares.c ecore_con_info.c +am__libecore_con_la_SOURCES_DIST = ecore_con.c ecore_con_socks.c \ + ecore_con_ssl.c ecore_con_url.c ecore_con_alloc.c \ + ecore_con_local_win32.c ecore_con_local.c ecore_con_ares.c \ + ecore_con_info.c @ECORE_HAVE_WIN32_TRUE@am__objects_1 = libecore_con_la-ecore_con_local_win32.lo @ECORE_HAVE_WIN32_FALSE@am__objects_2 = \ @ECORE_HAVE_WIN32_FALSE@ libecore_con_la-ecore_con_local.lo @HAVE_CARES_TRUE@am__objects_3 = libecore_con_la-ecore_con_ares.lo @HAVE_CARES_FALSE@am__objects_4 = libecore_con_la-ecore_con_info.lo am_libecore_con_la_OBJECTS = libecore_con_la-ecore_con.lo \ + libecore_con_la-ecore_con_socks.lo \ libecore_con_la-ecore_con_ssl.lo \ libecore_con_la-ecore_con_url.lo \ libecore_con_la-ecore_con_alloc.lo $(am__objects_1) \ @@ -263,10 +265,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -285,6 +287,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -398,6 +404,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -410,6 +418,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -454,12 +464,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ @@ -493,9 +505,10 @@ AM_CPPFLAGS = \ lib_LTLIBRARIES = libecore_con.la includes_HEADERS = Ecore_Con.h includesdir = $(includedir)/ecore-@VMAJ@ -libecore_con_la_SOURCES = ecore_con.c ecore_con_ssl.c ecore_con_url.c \ - ecore_con_alloc.c $(am__append_1) $(am__append_2) \ - $(am__append_3) $(am__append_4) +libecore_con_la_SOURCES = ecore_con.c ecore_con_socks.c \ + ecore_con_ssl.c ecore_con_url.c ecore_con_alloc.c \ + $(am__append_1) $(am__append_2) $(am__append_3) \ + $(am__append_4) libecore_con_la_CFLAGS = @WIN32_CFLAGS@ libecore_con_la_LIBADD = \ $(top_builddir)/src/lib/ecore/libecore.la \ @@ -583,6 +596,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_local.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_local_win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_socks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_ssl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_url.Plo@am__quote@ @@ -618,6 +632,14 @@ libecore_con_la-ecore_con.lo: ecore_con.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con.lo `test -f 'ecore_con.c' || echo '$(srcdir)/'`ecore_con.c +libecore_con_la-ecore_con_socks.lo: ecore_con_socks.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_socks.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_socks.Tpo -c -o libecore_con_la-ecore_con_socks.lo `test -f 'ecore_con_socks.c' || echo '$(srcdir)/'`ecore_con_socks.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_socks.Tpo $(DEPDIR)/libecore_con_la-ecore_con_socks.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_socks.c' object='libecore_con_la-ecore_con_socks.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_socks.lo `test -f 'ecore_con_socks.c' || echo '$(srcdir)/'`ecore_con_socks.c + libecore_con_la-ecore_con_ssl.lo: ecore_con_ssl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_ssl.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_ssl.Tpo -c -o libecore_con_la-ecore_con_ssl.lo `test -f 'ecore_con_ssl.c' || echo '$(srcdir)/'`ecore_con_ssl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_ssl.Tpo $(DEPDIR)/libecore_con_la-ecore_con_ssl.Plo diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con.c b/libraries/ecore/src/lib/ecore_con/ecore_con.c index 7bd0358..de291b3 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con.c @@ -45,7 +45,6 @@ static Eina_Bool _ecore_con_client_timer(Ecore_Con_Client *cl); static void _ecore_con_cl_timer_update(Ecore_Con_Client *cl); - static Eina_Bool _ecore_con_server_timer(Ecore_Con_Server *svr); static void _ecore_con_server_timer_update(Ecore_Con_Server *svr); @@ -104,6 +103,45 @@ static void _ecore_con_lookup_done(void *data, static const char * _ecore_con_pretty_ip(struct sockaddr *client_addr); + +void +_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); + INF("Lost client %s", (cl->ip) ? cl->ip : ""); + if (cl->fd_handler) + ecore_main_fd_handler_del(cl->fd_handler); + + cl->fd_handler = NULL; +} + +void +_ecore_con_server_kill(Ecore_Con_Server *svr) +{ + if (svr->delete_me) + DBG("Multi kill request for svr %p", svr); + else + ecore_con_event_server_del(svr); + + if (svr->fd_handler) + ecore_main_fd_handler_del(svr->fd_handler); + + svr->fd_handler = NULL; +} + +#define _ecore_con_server_kill(svr) do { \ + DBG("KILL %p", (svr)); \ + _ecore_con_server_kill((svr)); \ +} while (0) + +#define _ecore_con_client_kill(cl) do { \ + DBG("KILL %p", (cl)); \ + _ecore_con_client_kill((cl)); \ +} while (0) + EAPI int ECORE_CON_EVENT_CLIENT_ADD = 0; EAPI int ECORE_CON_EVENT_CLIENT_DEL = 0; EAPI int ECORE_CON_EVENT_SERVER_ADD = 0; @@ -114,11 +152,14 @@ EAPI int ECORE_CON_EVENT_CLIENT_WRITE = 0; EAPI int ECORE_CON_EVENT_SERVER_WRITE = 0; EAPI int ECORE_CON_EVENT_CLIENT_ERROR = 0; EAPI int ECORE_CON_EVENT_SERVER_ERROR = 0; +EAPI int ECORE_CON_EVENT_PROXY_BIND = 0; static Eina_List *servers = NULL; static int _ecore_con_init_count = 0; static int _ecore_con_event_count = 0; int _ecore_con_log_dom = -1; +Ecore_Con_Socks *_ecore_con_proxy_once = NULL; +Ecore_Con_Socks *_ecore_con_proxy_global = NULL; EAPI int ecore_con_init(void) @@ -156,6 +197,7 @@ ecore_con_init(void) ECORE_CON_EVENT_SERVER_WRITE = ecore_event_type_new(); ECORE_CON_EVENT_CLIENT_ERROR = ecore_event_type_new(); ECORE_CON_EVENT_SERVER_ERROR = ecore_event_type_new(); + ECORE_CON_EVENT_PROXY_BIND = ecore_event_type_new(); eina_magic_string_set(ECORE_MAGIC_CON_SERVER, "Ecore_Con_Server"); @@ -163,6 +205,7 @@ ecore_con_init(void) eina_magic_string_set(ECORE_MAGIC_CON_URL, "Ecore_Con_Url"); /* TODO Remember return value, if it fails, use gethostbyname() */ + ecore_con_socks_init(); ecore_con_ssl_init(); ecore_con_info_init(); @@ -182,13 +225,15 @@ ecore_con_shutdown(void) { Ecore_Con_Event_Server_Add *ev; - svr->delete_me = svr->dead = EINA_TRUE; + svr->delete_me = EINA_TRUE; + INF("svr %p is dead", svr); /* some pointer hacks here to prevent double frees if people are being stupid */ EINA_LIST_FREE(svr->event_count, ev) ev->server = NULL; _ecore_con_server_free(svr); } + ecore_con_socks_shutdown(); if (!_ecore_con_event_count) ecore_con_mempool_shutdown(); ecore_con_info_shutdown(); @@ -301,8 +346,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type, svr->port = port; svr->data = (void *)data; svr->created = EINA_TRUE; - if (compl_type & ECORE_CON_LOAD_CERT) - svr->use_cert = EINA_TRUE; + svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT; svr->reject_excess_clients = EINA_FALSE; svr->client_limit = -1; svr->clients = NULL; @@ -325,7 +369,8 @@ ecore_con_server_add(Ecore_Con_Type compl_type, #endif if ((type == ECORE_CON_REMOTE_TCP) || - (type == ECORE_CON_REMOTE_NODELAY)) + (type == ECORE_CON_REMOTE_NODELAY) || + (type == ECORE_CON_REMOTE_CORK)) { /* TCP */ if (!ecore_con_info_tcp_listen(svr, _ecore_con_cb_tcp_listen, @@ -395,17 +440,36 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, svr->port = port; svr->data = (void *)data; svr->created = EINA_FALSE; - svr->use_cert = (compl_type & ECORE_CON_LOAD_CERT); + svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT; svr->reject_excess_clients = EINA_FALSE; svr->clients = NULL; svr->client_limit = -1; - if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL)) - goto error; type = compl_type & ECORE_CON_TYPE; + if (type > ECORE_CON_LOCAL_ABSTRACT) + { + /* never use proxies on local connections */ + if (_ecore_con_proxy_once) + svr->ecs = _ecore_con_proxy_once; + else if (_ecore_con_proxy_global) + svr->ecs = _ecore_con_proxy_global; + _ecore_con_proxy_once = NULL; + if (svr->ecs) + { + if ((!svr->ecs->lookup) && + (!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; + } + } + if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL)) + goto error; + if (((type == ECORE_CON_REMOTE_TCP) || (type == ECORE_CON_REMOTE_NODELAY) || + (type == ECORE_CON_REMOTE_CORK) || (type == ECORE_CON_REMOTE_UDP) || (type == ECORE_CON_REMOTE_BROADCAST)) && (port < 0)) @@ -424,7 +488,8 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, #endif if ((type == ECORE_CON_REMOTE_TCP) || - (type == ECORE_CON_REMOTE_NODELAY)) + (type == ECORE_CON_REMOTE_NODELAY) || + (type == ECORE_CON_REMOTE_CORK)) { /* TCP */ if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect, @@ -492,8 +557,6 @@ ecore_con_server_timeout_get(Ecore_Con_Server *svr) EAPI void * ecore_con_server_del(Ecore_Con_Server *svr) { - void *data; - if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) { ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del"); @@ -503,20 +566,8 @@ ecore_con_server_del(Ecore_Con_Server *svr) if (svr->delete_me) return NULL; - data = svr->data; - svr->delete_me = EINA_TRUE; - if (svr->event_count) - { - if (svr->fd_handler) - { - ecore_main_fd_handler_del(svr->fd_handler); - svr->fd_handler = NULL; - } - } - else - _ecore_con_server_free(svr); - - return data; + _ecore_con_server_kill(svr); + return svr->data; } EAPI void * @@ -524,9 +575,7 @@ ecore_con_server_data_get(Ecore_Con_Server *svr) { if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) { - ECORE_MAGIC_FAIL(svr, - ECORE_MAGIC_CON_SERVER, - "ecore_con_server_data_get"); + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get"); return NULL; } @@ -541,9 +590,7 @@ ecore_con_server_data_set(Ecore_Con_Server *svr, if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) { - ECORE_MAGIC_FAIL(svr, - ECORE_MAGIC_CON_SERVER, - "ecore_con_server_data_get"); + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_data_get"); return NULL; } @@ -557,8 +604,7 @@ ecore_con_server_connected_get(Ecore_Con_Server *svr) { if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) { - ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, - "ecore_con_server_connected_get"); + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_connected_get"); return EINA_FALSE; } @@ -617,7 +663,7 @@ ecore_con_server_send(Ecore_Con_Server *svr, return 0; } - EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->dead, 0); + EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->delete_me, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); @@ -630,6 +676,15 @@ ecore_con_server_send(Ecore_Con_Server *svr, { svr->buf = eina_binbuf_new(); EINA_SAFETY_ON_NULL_RETURN_VAL(svr->buf, 0); +#ifdef TCP_CORK + if ((svr->fd >= 0) && ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)) + { + int state = 1; + if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0) + /* realistically this isn't anything serious so we can just log and continue */ + ERR("corking failed! %s", strerror(errno)); + } +#endif } eina_binbuf_append_length(svr->buf, data, size); @@ -716,7 +771,7 @@ ecore_con_client_send(Ecore_Con_Client *cl, return 0; } - EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->dead, 0); + EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->delete_me, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); @@ -732,6 +787,15 @@ ecore_con_client_send(Ecore_Con_Client *cl, { cl->buf = eina_binbuf_new(); EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0); +#ifdef TCP_CORK + if ((cl->fd >= 0) && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)) + { + int state = 1; + if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0) + /* realistically this isn't anything serious so we can just log and continue */ + ERR("corking failed! %s", strerror(errno)); + } +#endif } eina_binbuf_append_length(cl->buf, data, size); @@ -761,7 +825,7 @@ ecore_con_client_connected_get(Ecore_Con_Client *cl) return EINA_FALSE; } - return !cl->dead; + return !cl->delete_me; } EAPI void @@ -795,36 +859,14 @@ ecore_con_client_timeout_get(Ecore_Con_Client *cl) EAPI void * ecore_con_client_del(Ecore_Con_Client *cl) { - void *data = NULL; - if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) { ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del"); return NULL; } - data = cl->data; - cl->delete_me = EINA_TRUE; - if (cl->event_count) - { - if (cl->fd_handler) - { - ecore_main_fd_handler_del(cl->fd_handler); - cl->fd_handler = NULL; - } - } - else - { - if (cl->host_server) - { - cl->host_server->clients = eina_list_remove(cl->host_server->clients, cl); - --cl->host_server->client_count; - } - - _ecore_con_client_free(cl); - } - - return data; + _ecore_con_client_kill(cl); + return cl->data; } EAPI void @@ -833,9 +875,7 @@ ecore_con_client_data_set(Ecore_Con_Client *cl, { if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) { - ECORE_MAGIC_FAIL(cl, - ECORE_MAGIC_CON_CLIENT, - "ecore_con_client_data_set"); + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_set"); return; } @@ -847,9 +887,7 @@ ecore_con_client_data_get(Ecore_Con_Client *cl) { if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) { - ECORE_MAGIC_FAIL(cl, - ECORE_MAGIC_CON_CLIENT, - "ecore_con_client_data_get"); + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_data_get"); return NULL; } @@ -939,6 +977,25 @@ ecore_con_client_fd_get(Ecore_Con_Client *cl) */ void +ecore_con_event_proxy_bind(Ecore_Con_Server *svr) +{ + Ecore_Con_Event_Proxy_Bind *e; + int ev = ECORE_CON_EVENT_PROXY_BIND; + + e = ecore_con_event_proxy_bind_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + svr->event_count = eina_list_append(svr->event_count, e); + _ecore_con_server_timer_update(svr); + e->server = svr; + e->ip = svr->proxyip; + e->port = svr->proxyport; + ecore_event_add(ev, e, + _ecore_con_event_server_add_free, NULL); + _ecore_con_event_count++; +} + +void ecore_con_event_server_add(Ecore_Con_Server *svr) { /* we got our server! */ @@ -948,6 +1005,8 @@ ecore_con_event_server_add(Ecore_Con_Server *svr) e = ecore_con_event_server_add_alloc(); EINA_SAFETY_ON_NULL_RETURN(e); + svr->connecting = EINA_FALSE; + svr->start_time = ecore_time_get(); svr->event_count = eina_list_append(svr->event_count, e); _ecore_con_server_timer_update(svr); e->server = svr; @@ -962,12 +1021,20 @@ ecore_con_event_server_del(Ecore_Con_Server *svr) { Ecore_Con_Event_Server_Del *e; + svr->delete_me = EINA_TRUE; + INF("svr %p is dead", svr); e = ecore_con_event_server_del_alloc(); EINA_SAFETY_ON_NULL_RETURN(e); svr->event_count = eina_list_append(svr->event_count, e); _ecore_con_server_timer_update(svr); e->server = svr; + if (svr->ecs) + { + svr->ecs_state = svr->ecs->lookup ? ECORE_CON_SOCKS_STATE_RESOLVED : ECORE_CON_SOCKS_STATE_DONE; + eina_stringshare_replace(&svr->proxyip, NULL); + svr->proxyport = 0; + } ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e, _ecore_con_event_server_del_free, NULL); _ecore_con_event_count++; @@ -981,6 +1048,7 @@ ecore_con_event_server_write(Ecore_Con_Server *svr, int num) e = ecore_con_event_server_write_alloc(); EINA_SAFETY_ON_NULL_RETURN(e); + INF("Wrote %d bytes", num); svr->event_count = eina_list_append(svr->event_count, e); e->server = svr; e->size = num; @@ -1044,6 +1112,8 @@ ecore_con_event_client_del(Ecore_Con_Client *cl) Ecore_Con_Event_Client_Del *e; if (!cl) return; + cl->delete_me = EINA_TRUE; + INF("cl %p is dead", cl); e = ecore_con_event_client_del_alloc(); EINA_SAFETY_ON_NULL_RETURN(e); cl->event_count = eina_list_append(cl->event_count, e); @@ -1112,7 +1182,7 @@ ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info) } void -ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error) +_ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate) { Ecore_Con_Event_Server_Error *e; @@ -1120,7 +1190,7 @@ ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error) EINA_SAFETY_ON_NULL_RETURN(e); e->server = svr; - e->error = strdup(error); + e->error = duplicate ? strdup(error) : error; ERR("%s", error); svr->event_count = eina_list_append(svr->event_count, e); ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL); @@ -1157,16 +1227,9 @@ _ecore_con_server_free(Ecore_Con_Server *svr) ecore_con_info_data_clear(svr->infos->data); svr->infos = eina_list_remove_list(svr->infos, svr->infos); } - if ((!svr->buf) && svr->delete_me && (!svr->dead) && (!svr->event_count)) - { - /* this is a catch-all for cases when a server is not properly killed. */ - svr->dead = EINA_TRUE; - ecore_con_event_server_del(svr); - return; - } t_start = ecore_time_get(); - while (svr->buf && (!svr->dead)) + while (svr->buf && (!svr->delete_me)) { _ecore_con_server_flush(svr); t = ecore_time_get(); @@ -1196,7 +1259,8 @@ _ecore_con_server_free(Ecore_Con_Server *svr) /* some pointer hacks here to prevent double frees if people are being stupid */ EINA_LIST_FREE(cl->event_count, ev) ev->server = NULL; - cl->delete_me = cl->dead = EINA_TRUE; + cl->delete_me = EINA_TRUE; + INF("cl %p is dead", cl); _ecore_con_client_free(cl); } if ((svr->created) && (svr->path) && (svr->ppid == getpid())) @@ -1208,6 +1272,10 @@ _ecore_con_server_free(Ecore_Con_Server *svr) free(svr->path); eina_stringshare_del(svr->ip); + eina_stringshare_del(svr->verify_name); + + if (svr->ecs_buf) eina_binbuf_free(svr->ecs_buf); + if (svr->ecs_recvbuf) eina_binbuf_free(svr->ecs_recvbuf); if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler); @@ -1230,17 +1298,8 @@ _ecore_con_client_free(Ecore_Con_Client *cl) if (cl->event_count) return; - if (cl->delete_me && (!cl->dead) && (!cl->event_count)) - { - /* this is a catch-all for cases when a client is not properly killed. */ - cl->dead = EINA_TRUE; - ecore_con_event_client_del(cl); - return; - } - - t_start = ecore_time_get(); - while ((cl->buf) && (!cl->dead)) + while ((cl->buf) && (!cl->delete_me)) { _ecore_con_client_flush(cl); t = ecore_time_get(); @@ -1284,19 +1343,6 @@ _ecore_con_client_free(Ecore_Con_Client *cl) return; } -static void -_ecore_con_server_kill(Ecore_Con_Server *svr) -{ - if (!svr->delete_me) - ecore_con_event_server_del(svr); - - svr->dead = EINA_TRUE; - if (svr->fd_handler) - ecore_main_fd_handler_del(svr->fd_handler); - - svr->fd_handler = NULL; -} - static Eina_Bool _ecore_con_server_timer(Ecore_Con_Server *svr) { @@ -1384,40 +1430,25 @@ _ecore_con_cb_tcp_listen(void *data, { Ecore_Con_Server *svr; struct linger lin; + const char *memerr = NULL; svr = data; + errno = 0; if (!net_info) /* error message has already been handled */ goto error; svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol); - if (svr->fd < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + if (svr->fd < 0) goto error; + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error; + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error; lin.l_onoff = 1; lin.l_linger = 0; if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin, sizeof(struct linger)) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY) { @@ -1428,34 +1459,27 @@ _ecore_con_cb_tcp_listen(void *data, sizeof(int)) < 0) #endif { - ecore_con_event_server_error(svr, strerror(errno)); goto error; } } - if (bind(svr->fd, net_info->info.ai_addr, - net_info->info.ai_addrlen) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - if (listen(svr->fd, 4096) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) + goto error; + + if (listen(svr->fd, 4096) < 0) goto error; svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, _ecore_con_svr_tcp_handler, svr, NULL, NULL); if (!svr->fd_handler) { - ecore_con_event_server_error(svr, "Memory allocation failure"); + memerr = "Memory allocation failure"; goto error; } return; error: + if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno)); ecore_con_ssl_server_shutdown(svr); _ecore_con_server_kill(svr); } @@ -1471,21 +1495,19 @@ _ecore_con_cb_udp_listen(void *data, struct ipv6_mreq mreq6; #endif const int on = 1; + const char *memerr = NULL; svr = data; type = svr->type; type &= ECORE_CON_TYPE; + errno = 0; if (!net_info) /* error message has already been handled */ goto error; svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol); - if (svr->fd < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + if (svr->fd < 0) goto error; if (type == ECORE_CON_REMOTE_MCAST) { @@ -1493,69 +1515,41 @@ _ecore_con_cb_udp_listen(void *data, { if (!inet_pton(net_info->info.ai_family, net_info->ip, &mreq.imr_multiaddr)) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; mreq.imr_interface.s_addr = htonl(INADDR_ANY); if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) != 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; } #ifdef HAVE_IPV6 else if (net_info->info.ai_family == AF_INET6) { if (!inet_pton(net_info->info.ai_family, net_info->ip, &mreq6.ipv6mr_multiaddr)) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; mreq6.ipv6mr_interface = htonl(INADDR_ANY); if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq6, sizeof(mreq6)) != 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; } #endif } if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on)) != 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error; + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error; if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, _ecore_con_svr_udp_handler, svr, NULL, NULL); if (!svr->fd_handler) { - ecore_con_event_server_error(svr, "Memory allocation failure"); + memerr = "Memory allocation failure"; goto error; } @@ -1564,6 +1558,7 @@ _ecore_con_cb_udp_listen(void *data, return; error: + if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno)); ecore_con_ssl_server_shutdown(svr); _ecore_con_server_kill(svr); } @@ -1575,37 +1570,23 @@ _ecore_con_cb_tcp_connect(void *data, Ecore_Con_Server *svr; int res; int curstate = 0; + const char *memerr = NULL; svr = data; + errno = 0; if (!net_info) /* error message has already been handled */ goto error; svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol); - if (svr->fd < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + if (svr->fd < 0) goto error; - if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error; + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error; if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY) { @@ -1615,7 +1596,6 @@ _ecore_con_cb_tcp_connect(void *data, if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0) #endif { - ecore_con_event_server_error(svr, strerror(errno)); goto error; } } @@ -1625,17 +1605,19 @@ _ecore_con_cb_tcp_connect(void *data, if (res == SOCKET_ERROR) { if (WSAGetLastError() != WSAEINPROGRESS) - goto error; /* FIXME: strerror on windows? */ + { + char *err; + err = evil_format_message(WSAGetLastError()); + _ecore_con_event_server_error(svr, err, EINA_FALSE); + ecore_con_ssl_server_shutdown(svr); + _ecore_con_server_kill(svr); + return; + } #else if (res < 0) { - if (errno != EINPROGRESS) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - + if (errno != EINPROGRESS) goto error; #endif svr->connecting = EINA_TRUE; svr->fd_handler = @@ -1650,22 +1632,24 @@ _ecore_con_cb_tcp_connect(void *data, { svr->handshaking = EINA_TRUE; svr->ssl_state = ECORE_CON_SSL_STATE_INIT; - DBG("beginning ssl handshake"); - if (ecore_con_ssl_server_init(svr)) + DBG("%s ssl handshake", svr->ecs_state ? "Queuing" : "Beginning"); + if ((!svr->ecs_state) && ecore_con_ssl_server_init(svr)) goto error; } if (!svr->fd_handler) { - ecore_con_event_server_error(svr, "Memory allocation failure"); + memerr = "Memory allocation failure"; goto error; } - svr->ip = eina_stringshare_add(net_info->ip); + if ((!svr->ecs) || (svr->ecs->lookup)) + svr->ip = eina_stringshare_add(net_info->ip); return; error: + if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno)); ecore_con_ssl_server_shutdown(svr); _ecore_con_server_kill(svr); } @@ -1677,68 +1661,50 @@ _ecore_con_cb_udp_connect(void *data, Ecore_Con_Server *svr; int curstate = 0; int broadcast = 1; + const char *memerr = NULL; svr = data; + errno = 0; if (!net_info) /* error message has already been handled */ goto error; svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, net_info->info.ai_protocol); - if (svr->fd < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - - if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } - + if (svr->fd < 0) goto error; + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) goto error; + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) goto error; if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_BROADCAST) { if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST, (const void *)&broadcast, sizeof(broadcast)) < 0) { - ecore_con_event_server_error(svr, strerror(errno)); goto error; } } - else if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, - (const void *)&curstate, sizeof(curstate)) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, + (const void *)&curstate, sizeof(curstate)) < 0) + goto error; if (connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto error; - } + goto error; svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE, _ecore_con_cl_udp_handler, svr, NULL, NULL); if (!svr->fd_handler) { - ecore_con_event_server_error(svr, "Memory allocation failure"); + memerr = "Memory allocation failure"; goto error; } - svr->ip = eina_stringshare_add(net_info->ip); + if ((!svr->ecs) || (svr->ecs->lookup)) + svr->ip = eina_stringshare_add(net_info->ip); return; error: + if (errno || memerr) ecore_con_event_server_error(svr, memerr ?: strerror(errno)); ecore_con_ssl_server_shutdown(svr); _ecore_con_server_kill(svr); } @@ -1755,14 +1721,14 @@ svr_try_connect_plain(Ecore_Con_Server *svr) if (res == SOCKET_ERROR) so_err = WSAGetLastError(); - if ((so_err == WSAEINPROGRESS) && !svr->dead) + if ((so_err == WSAEINPROGRESS) && !svr->delete_me) return ECORE_CON_INPROGRESS; #else if (res < 0) so_err = errno; - if ((so_err == EINPROGRESS) && !svr->dead) + if ((so_err == EINPROGRESS) && !svr->delete_me) return ECORE_CON_INPROGRESS; #endif @@ -1778,15 +1744,19 @@ svr_try_connect_plain(Ecore_Con_Server *svr) if ((!svr->delete_me) && (!svr->handshaking) && svr->connecting) { - svr->connecting = EINA_FALSE; - svr->start_time = ecore_time_get(); - ecore_con_event_server_add(svr); + if (svr->ecs) + { + if (ecore_con_socks_svr_init(svr)) + return ECORE_CON_INPROGRESS; + } + else + ecore_con_event_server_add(svr); } if (svr->fd_handler && (!svr->buf)) ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); - if (!svr->dead) + if (!svr->delete_me) return ECORE_CON_CONNECTED; else return ECORE_CON_DISCONNECTED; @@ -1838,9 +1808,10 @@ _ecore_con_svr_tcp_handler(void *data, Ecore_Con_Client *cl = NULL; unsigned char client_addr[256]; unsigned int client_addr_len; + const char *clerr = NULL; svr = data; - if (svr->dead) + if (svr->delete_me) return ECORE_CALLBACK_RENEW; if (svr->delete_me) @@ -1863,34 +1834,19 @@ _ecore_con_svr_tcp_handler(void *data, client_addr_len = sizeof(client_addr); memset(&client_addr, 0, client_addr_len); cl->fd = accept(svr->fd, (struct sockaddr *)&client_addr, (socklen_t *)&client_addr_len); - if (cl->fd < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto free_cl; - } - + if (cl->fd < 0) goto error; if ((svr->client_limit >= 0) && (svr->reject_excess_clients) && (svr->client_count >= (unsigned int)svr->client_limit)) { - ecore_con_event_server_error(svr, "Maximum client limit reached"); - goto close_fd; + clerr = "Maximum client limit reached"; + goto error; } - if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto close_fd; - } - if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) - { - ecore_con_event_server_error(svr, strerror(errno)); - goto close_fd; - } + if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) goto error; + if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) goto error; cl->fd_handler = ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ, _ecore_con_svr_cl_handler, cl, NULL, NULL); - if (!cl->fd_handler) - goto close_fd; - + if (!cl->fd_handler) goto error; ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT); if ((!svr->upgrade) && (svr->type & ECORE_CON_SSL)) @@ -1898,14 +1854,14 @@ _ecore_con_svr_tcp_handler(void *data, cl->handshaking = EINA_TRUE; cl->ssl_state = ECORE_CON_SSL_STATE_INIT; if (ecore_con_ssl_client_init(cl)) - goto del_handler; + goto error; } cl->client_addr = malloc(client_addr_len); if (!cl->client_addr) { - ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client"); - goto del_handler; + clerr = "Memory allocation failure when attempting to add a new client"; + goto error; } cl->client_addr_len = client_addr_len; memcpy(cl->client_addr, &client_addr, client_addr_len); @@ -1918,29 +1874,28 @@ _ecore_con_svr_tcp_handler(void *data, return ECORE_CALLBACK_RENEW; - del_handler: - ecore_main_fd_handler_del(cl->fd_handler); - close_fd: - close(cl->fd); - free_cl: +error: + if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler); + if (cl->fd >= 0) close(cl->fd); free(cl); - + if (clerr || errno) ecore_con_event_server_error(svr, clerr ?: strerror(errno)); return ECORE_CALLBACK_RENEW; } static void _ecore_con_cl_read(Ecore_Con_Server *svr) { - DBG("svr=%p", svr); int num = 0; Eina_Bool lost_server = EINA_TRUE; unsigned char buf[READBUFSIZ]; + DBG("svr=%p", svr); + /* only possible with non-ssl connections */ if (svr->connecting && (svr_try_connect_plain(svr) != ECORE_CON_CONNECTED)) return; - if (svr->handshaking) + if (svr->handshaking && (!svr->ecs_state)) { DBG("Continuing ssl handshake"); if (!ecore_con_ssl_server_init(svr)) @@ -1948,8 +1903,9 @@ _ecore_con_cl_read(Ecore_Con_Server *svr) _ecore_con_server_timer_update(svr); } - if (!(svr->type & ECORE_CON_SSL)) + if (svr->ecs_state || !(svr->type & ECORE_CON_SSL)) { + errno = 0; num = read(svr->fd, buf, sizeof(buf)); /* 0 is not a valid return value for a tcp socket */ if ((num > 0) || ((num < 0) && (errno == EAGAIN))) @@ -1966,7 +1922,12 @@ _ecore_con_cl_read(Ecore_Con_Server *svr) } if ((!svr->delete_me) && (num > 0)) - ecore_con_event_server_data(svr, buf, num, EINA_TRUE); + { + if (svr->ecs_state) + ecore_con_socks_read(svr, buf, num); + else + ecore_con_event_server_data(svr, buf, num, EINA_TRUE); + } if (lost_server) _ecore_con_server_kill(svr); @@ -1980,7 +1941,7 @@ _ecore_con_cl_handler(void *data, Eina_Bool want_read, want_write; svr = data; - if (svr->dead) + if (svr->delete_me) return ECORE_CALLBACK_RENEW; if (svr->delete_me) @@ -1989,7 +1950,7 @@ _ecore_con_cl_handler(void *data, want_read = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ); want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE); - if (svr->handshaking && (want_read || want_write)) + if ((!svr->ecs_state) && svr->handshaking && (want_read || want_write)) { DBG("Continuing ssl handshake: preparing to %s...", want_read ? "read" : "write"); #ifdef ISCOMFITOR @@ -2005,20 +1966,25 @@ _ecore_con_cl_handler(void *data, { ERR("ssl handshaking failed!"); svr->handshaking = EINA_FALSE; - } else if (!svr->ssl_state) + 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_state < ECORE_CON_SOCKS_STATE_INIT) { - svr->connecting = EINA_FALSE; - svr->start_time = ecore_time_get(); - ecore_con_event_server_add(svr); + INF("PROXY STATE++"); + svr->ecs_state++; } + if (ecore_con_socks_svr_init(svr)) return ECORE_CALLBACK_RENEW; } - else if (want_read) + if (want_read) _ecore_con_cl_read(svr); else if (want_write) /* only possible with non-ssl connections */ { - if (svr->connecting && (!svr_try_connect_plain(svr))) + if (svr->connecting && (!svr_try_connect_plain(svr)) && (!svr->ecs_state)) return ECORE_CALLBACK_RENEW; _ecore_con_server_flush(svr); @@ -2040,7 +2006,7 @@ _ecore_con_cl_udp_handler(void *data, want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE); svr = data; - if (svr->dead || svr->delete_me || ((!want_read) && (!want_write))) + if (svr->delete_me || svr->delete_me || ((!want_read) && (!want_write))) return ECORE_CALLBACK_RENEW; if (want_write) @@ -2076,7 +2042,7 @@ _ecore_con_svr_udp_handler(void *data, svr = data; - if (svr->delete_me || svr->dead) + if (svr->delete_me) return ECORE_CALLBACK_RENEW; if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) @@ -2106,9 +2072,7 @@ _ecore_con_svr_udp_handler(void *data, ecore_con_event_server_error(svr, strerror(errno)); if (!svr->delete_me) ecore_con_event_client_del(NULL); - - svr->dead = EINA_TRUE; - svr->fd_handler = NULL; + _ecore_con_server_kill(svr); return ECORE_CALLBACK_CANCEL; } @@ -2177,18 +2141,7 @@ _ecore_con_svr_cl_read(Ecore_Con_Client *cl) if ((!cl->delete_me) && (num > 0)) ecore_con_event_client_data(cl, buf, num, EINA_TRUE); - if (lost_client) - { - if (!cl->delete_me) - ecore_con_event_client_del(cl); - INF("Lost client %s", (cl->ip) ? cl->ip : ""); - cl->dead = EINA_TRUE; - if (cl->fd_handler) - ecore_main_fd_handler_del(cl->fd_handler); - - cl->fd_handler = NULL; - return; - } + if (lost_client) _ecore_con_client_kill(cl); } static Eina_Bool @@ -2198,9 +2151,6 @@ _ecore_con_svr_cl_handler(void *data, Ecore_Con_Client *cl; cl = data; - if (cl->dead) - return ECORE_CALLBACK_RENEW; - if (cl->delete_me) return ECORE_CALLBACK_RENEW; @@ -2209,10 +2159,8 @@ _ecore_con_svr_cl_handler(void *data, if (ecore_con_ssl_client_init(cl)) { ERR("ssl handshaking failed!"); - cl->handshaking = EINA_FALSE; - cl->dead = EINA_TRUE; - INF("Lost client %s", (cl->ip) ? cl->ip : ""); - ecore_con_event_client_del(cl); + _ecore_con_client_kill(cl); + return ECORE_CALLBACK_RENEW; } else if (!cl->ssl_state) ecore_con_event_client_add(cl); @@ -2230,19 +2178,25 @@ static void _ecore_con_server_flush(Ecore_Con_Server *svr) { int count, num; + size_t buf_len, buf_offset; + const void *buf; + DBG("(svr=%p,buf=%p)", svr, svr->buf); #ifdef _WIN32 if (ecore_con_local_win32_server_flush(svr)) return; #endif - if ((!svr->buf) && svr->fd_handler) + if ((!svr->buf) && (!svr->ecs_buf) && svr->fd_handler) { ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); return; } - num = eina_binbuf_length_get(svr->buf) - svr->write_buf_offset; + buf = svr->buf ? eina_binbuf_string_get(svr->buf) : eina_binbuf_string_get(svr->ecs_buf); + buf_len = svr->buf ? eina_binbuf_length_get(svr->buf) : eina_binbuf_length_get(svr->ecs_buf); + buf_offset = svr->buf ? svr->write_buf_offset : svr->ecs_buf_offset; + num = buf_len - buf_offset; /* check whether we need to write anything at all. * we must not write zero bytes with SSL_write() since it @@ -2253,7 +2207,7 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) */ if (num <= 0) return; - if (svr->handshaking) + if ((!svr->ecs_state) && svr->handshaking) { DBG("Continuing ssl handshake"); if (ecore_con_ssl_server_init(svr)) @@ -2262,10 +2216,10 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) return; } - if (!(svr->type & ECORE_CON_SSL)) - count = write(svr->fd, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num); + if (svr->ecs_state || (!(svr->type & ECORE_CON_SSL))) + count = write(svr->fd, buf + buf_offset, num); else - count = ecore_con_ssl_server_write(svr, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num); + count = ecore_con_ssl_server_write(svr, buf + buf_offset, num); if (count < 0) { @@ -2277,13 +2231,36 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) return; } - if (count) ecore_con_event_server_write(svr, count); - svr->write_buf_offset += count; - if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf)) + if (count && (!svr->ecs_state)) ecore_con_event_server_write(svr, count); + if (svr->ecs_buf) + buf_offset = svr->ecs_buf_offset += count; + else + buf_offset = svr->write_buf_offset += count; + if (buf_offset >= buf_len) { - svr->write_buf_offset = 0; - eina_binbuf_free(svr->buf); - svr->buf = NULL; + if (svr->ecs_buf) + { + svr->ecs_buf_offset = 0; + eina_binbuf_free(svr->ecs_buf); + svr->ecs_buf = NULL; + INF("PROXY STATE++"); + svr->ecs_state++; + } + else + { + svr->write_buf_offset = 0; + eina_binbuf_free(svr->buf); + svr->buf = NULL; +#ifdef TCP_CORK + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK) + { + int state = 0; + if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0) + /* realistically this isn't anything serious so we can just log and continue */ + ERR("uncorking failed! %s", strerror(errno)); + } +#endif + } if (svr->fd_handler) ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); } @@ -2330,13 +2307,7 @@ _ecore_con_client_flush(Ecore_Con_Client *cl) if ((errno != EAGAIN) && (errno != EINTR) && (!cl->delete_me)) { ecore_con_event_client_error(cl, strerror(errno)); - ecore_con_event_client_del(cl); - cl->dead = EINA_TRUE; - INF("Lost client %s", (cl->ip) ? cl->ip : ""); - if (cl->fd_handler) - ecore_main_fd_handler_del(cl->fd_handler); - - cl->fd_handler = NULL; + _ecore_con_client_kill(cl); } return; @@ -2349,6 +2320,15 @@ _ecore_con_client_flush(Ecore_Con_Client *cl) cl->buf_offset = 0; eina_binbuf_free(cl->buf); cl->buf = NULL; +#ifdef TCP_CORK + if ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK) + { + int state = 0; + if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0) + /* realistically this isn't anything serious so we can just log and continue */ + ERR("uncorking failed! %s", strerror(errno)); + } +#endif if (cl->fd_handler) ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); } @@ -2398,7 +2378,7 @@ _ecore_con_event_client_del_free(Ecore_Con_Server *svr, if ((!svr->event_count) && (svr->delete_me)) _ecore_con_server_free(svr); } - if ((!e->client->event_count) && (e->client->delete_me)) + if (!e->client->event_count) ecore_con_client_del(e->client); } ecore_con_event_client_del_free(e); @@ -2490,7 +2470,7 @@ _ecore_con_event_server_del_free(void *data __UNUSED__, if (e->server) { e->server->event_count = eina_list_remove(e->server->event_count, ev); - if ((!e->server->event_count) && (e->server->delete_me)) + if (!e->server->event_count) _ecore_con_server_free(e->server); } ecore_con_event_server_del_free(e); diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c b/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c index 206948b..d922f20 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c @@ -40,6 +40,7 @@ GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Add, ecore_con_event_server_add); GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Del, ecore_con_event_server_del); GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Write, ecore_con_event_server_write); GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Data, ecore_con_event_server_data); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind); static Ecore_Con_Mempool *mempool_array[] = { &ecore_con_event_client_add_mp, @@ -51,7 +52,8 @@ static Ecore_Con_Mempool *mempool_array[] = { &ecore_con_event_server_add_mp, &ecore_con_event_server_del_mp, &ecore_con_event_server_write_mp, - &ecore_con_event_server_data_mp + &ecore_con_event_server_data_mp, + &ecore_con_event_proxy_bind_mp }; void diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c b/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c index dd5a212..5dfe70b 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c @@ -309,7 +309,7 @@ ecore_con_info_get(Ecore_Con_Server *svr, memcpy(&cares->hints, hints, sizeof(struct addrinfo)); } - if (inet_pton(AF_INET, svr->name, &cares->addr.v4) == 1) + if (inet_pton(AF_INET, svr->ecs ? svr->ecs->ip : svr->name, &cares->addr.v4) == 1) { cares->byaddr = EINA_TRUE; cares->isv6 = EINA_FALSE; @@ -320,7 +320,7 @@ ecore_con_info_get(Ecore_Con_Server *svr, cares); } #ifdef HAVE_IPV6 - else if (inet_pton(AF_INET6, svr->name, &cares->addr.v6) == 1) + else if (inet_pton(AF_INET6, svr->ecs ? svr->ecs->ip : svr->name, &cares->addr.v6) == 1) { cares->byaddr = EINA_TRUE; cares->isv6 = EINA_TRUE; @@ -334,7 +334,7 @@ ecore_con_info_get(Ecore_Con_Server *svr, else { cares->byaddr = EINA_FALSE; - ares_gethostbyname(info_channel, svr->name, ai_family, + ares_gethostbyname(info_channel, svr->ecs ? svr->ecs->ip : svr->name, ai_family, (ares_host_callback)_ecore_con_info_ares_host_cb, cares); } @@ -457,7 +457,7 @@ _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, goto on_mem_error; addri->sin_family = AF_INET; - addri->sin_port = htons(arg->svr->port); + addri->sin_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port); memcpy(&addri->sin_addr.s_addr, hostent->h_addr_list[0], sizeof(struct in_addr)); @@ -477,7 +477,7 @@ _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, goto on_mem_error; addri6->sin6_family = AF_INET6; - addri6->sin6_port = htons(arg->svr->port); + addri6->sin6_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port); addri6->sin6_flowinfo = 0; addri6->sin6_scope_id = 0; @@ -516,7 +516,7 @@ _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, goto on_mem_error; addri6->sin6_family = AF_INET6; - addri6->sin6_port = htons(arg->svr->port); + addri6->sin6_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port); addri6->sin6_flowinfo = 0; addri6->sin6_scope_id = 0; @@ -537,7 +537,7 @@ _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, goto on_mem_error; addri->sin_family = AF_INET; - addri->sin_port = htons(arg->svr->port); + addri->sin_port = htons(arg->svr->ecs ? arg->svr->ecs->port : arg->svr->port); memcpy(&addri->sin_addr.s_addr, &arg->addr.v4, sizeof(struct in_addr)); diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_info.c b/libraries/ecore/src/lib/ecore_con/ecore_con_info.c index 4ece6b0..fdcf0b9 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con_info.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_info.c @@ -244,11 +244,10 @@ ecore_con_info_get(Ecore_Con_Server *svr, unsigned char *tosend = NULL; int tosend_len; int canonname_len = 0; - int err; - eina_convert_itoa(svr->port, service); + eina_convert_itoa(svr->ecs ? svr->ecs->port : svr->port, service); /* CHILD */ - if (!getaddrinfo(svr->name, service, hints, &result) && result) + if (!getaddrinfo(svr->ecs ? svr->ecs->ip : svr->name, service, hints, &result) && result) { if (result->ai_canonname) canonname_len = strlen(result->ai_canonname) + 1; @@ -281,13 +280,13 @@ ecore_con_info_get(Ecore_Con_Server *svr, memcpy(container->service, sbuf, sizeof(container->service)); } - err = write(fd[1], tosend, tosend_len); + if (write(fd[1], tosend, tosend_len) < 0) perror("write"); } if (result) freeaddrinfo(result); - err = write(fd[1], "", 1); + if (write(fd[1], "", 1) < 0) perror("write"); close(fd[1]); #if defined(__USE_ISOC99) && !defined(__UCLIBC__) _Exit(0); diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c b/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c index 858daa5..2b7e5c5 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c @@ -75,9 +75,7 @@ _ecore_con_local_win32_server_read_client_handler(void *data, Ecore_Win32_Handle free(msg); } #endif - if (!cl->delete_me) - ecore_con_event_client_del(cl); - cl->dead = EINA_TRUE; + _ecore_con_client_kill(cl); return ECORE_CALLBACK_CANCEL; } @@ -110,9 +108,7 @@ _ecore_con_local_win32_server_peek_client_handler(void *data, Ecore_Win32_Handle free(msg); } #endif - if (!cl->host_server->delete_me) - ecore_con_event_server_del(cl->host_server); - cl->host_server->dead = EINA_TRUE; + _ecore_con_server_kill(cl->host_server); return ECORE_CALLBACK_CANCEL; ecore_main_win32_handler_del(wh); @@ -140,9 +136,7 @@ _ecore_con_local_win32_client_peek_server_handler(void *data, Ecore_Win32_Handle free(msg); } #endif - if (!svr->delete_me) - ecore_con_event_server_del(svr); - svr->dead = EINA_TRUE; + _ecore_con_server_kill(svr); return ECORE_CALLBACK_CANCEL; ecore_main_win32_handler_del(wh); @@ -191,9 +185,7 @@ _ecore_con_local_win32_client_read_server_handler(void *data, Ecore_Win32_Handle free(msg); } #endif - if (!svr->delete_me) - ecore_con_event_server_del(svr); - svr->dead = EINA_TRUE; + _ecore_con_server_kill(svr); return ECORE_CALLBACK_CANCEL; } @@ -296,9 +288,6 @@ _ecore_con_local_win32_client_add(void *data, Ecore_Win32_Handler *wh) if (!svr->pipe) return ECORE_CALLBACK_CANCEL; - if (svr->dead) - return ECORE_CALLBACK_CANCEL; - if (svr->delete_me) return ECORE_CALLBACK_CANCEL; @@ -698,16 +687,14 @@ ecore_con_local_win32_server_flush(Ecore_Con_Server *svr) ecore_con_event_server_error(svr, msg); free(msg); } - if (!svr->delete_me) - ecore_con_event_server_del(svr); - svr->dead = EINA_TRUE; + _ecore_con_server_kill(svr); } svr->write_buf_offset += written; if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf)) { svr->write_buf_offset = 0; - eina_binbuf_free(svr->buf); + eina_binbuf_free(svr->buf); svr->buf = NULL; svr->want_write = 0; } @@ -749,9 +736,7 @@ ecore_con_local_win32_client_flush(Ecore_Con_Client *cl) ecore_con_event_client_error(cl, msg); free(msg); } - if (!cl->delete_me) - ecore_con_event_client_del(cl); - cl->dead = EINA_TRUE; + _ecore_con_client_kill(cl); } cl->buf_offset += written; 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 f601465..35f2310 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,8 @@ 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_v5 Ecore_Con_Socks_v5; typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos); typedef enum _Ecore_Con_State @@ -82,6 +83,14 @@ 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; + struct _Ecore_Con_Client { ECORE_MAGIC; @@ -107,9 +116,8 @@ struct _Ecore_Con_Client #endif Ecore_Con_Ssl_State ssl_state; Eina_Bool handshaking : 1; - Eina_Bool upgrade : 1; - Eina_Bool dead : 1; - Eina_Bool delete_me : 1; + Eina_Bool upgrade : 1; /* STARTTLS queued */ + Eina_Bool delete_me : 1; /* del event has been queued */ }; struct _Ecore_Con_Server @@ -130,6 +138,18 @@ struct _Ecore_Con_Server Eina_List *event_count; int client_limit; pid_t ppid; + /* socks */ + Ecore_Con_Socks *ecs; + Ecore_Con_Socks_State ecs_state; + int ecs_addrlen; + unsigned char ecs_addr[16]; + unsigned int ecs_buf_offset; + Eina_Binbuf *ecs_buf; + Eina_Binbuf *ecs_recvbuf; + const char *proxyip; + int proxyport; + /* endsocks */ + const char *verify_name; #if USE_GNUTLS gnutls_session_t session; gnutls_anon_client_credentials_t anoncred_c; @@ -149,18 +169,17 @@ struct _Ecore_Con_Server double disconnect_time; double client_disconnect_time; const char *ip; - Eina_Bool dead : 1; Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */ Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */ Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */ - Eina_Bool upgrade : 1; + Eina_Bool upgrade : 1; /* STARTTLS queued */ Eina_Bool ssl_prepared : 1; Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */ Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */ Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */ Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */ Eina_Bool reject_excess_clients : 1; - Eina_Bool delete_me : 1; + Eina_Bool delete_me : 1; /* del event has been queued */ #ifdef _WIN32 Eina_Bool want_write : 1; Eina_Bool read_stop : 1; @@ -182,19 +201,18 @@ struct _Ecore_Con_Url Eina_List *additional_headers; Eina_List *response_headers; const char *url; + long proxy_type; + + Ecore_Timer *timer; Ecore_Con_Url_Time time_condition; double timestamp; void *data; - - Ecore_Fd_Handler *fd_handler; - int fd; - int flags; + + void *post_data; int received; int write_fd; - - Eina_Bool active : 1; }; #endif @@ -212,16 +230,68 @@ struct _Ecore_Con_Lookup const void *data; }; +#define ECORE_CON_SOCKS_CAST_ELSE(X) \ + Ecore_Con_Socks_v4 *v4 = NULL; \ + Ecore_Con_Socks_v5 *v5 = NULL; \ + if ((X) && ((X)->version == 4)) \ + v4 = (Ecore_Con_Socks_v4*)(X); \ + else if ((X) && ((X)->version == 5)) \ + 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 +{ + unsigned char version; + + const char *ip; + int port; + const char *username; + Eina_Bool lookup : 1; + Eina_Bool bind : 1; +}; + +struct Ecore_Con_Socks_v5 +{ + unsigned char version; + + const char *ip; + int port; + const char *username; + Eina_Bool lookup : 1; + Eina_Bool bind : 1; +}; + +extern Ecore_Con_Socks *_ecore_con_proxy_once; +extern Ecore_Con_Socks *_ecore_con_proxy_global; +void ecore_con_socks_init(void); +void ecore_con_socks_shutdown(void); +Eina_Bool ecore_con_socks_svr_init(Ecore_Con_Server *svr); +void ecore_con_socks_read(Ecore_Con_Server *svr, unsigned char *buf, int num); +void ecore_con_socks_dns_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, Ecore_Con_Server *svr); /* from ecore_con.c */ void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info); +void ecore_con_event_proxy_bind(Ecore_Con_Server *svr); void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate); void ecore_con_event_server_del(Ecore_Con_Server *svr); -void ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error); +#define ecore_con_event_server_error(svr, error) _ecore_con_event_server_error((svr), (char*)(error), EINA_TRUE) +void _ecore_con_event_server_error(Ecore_Con_Server *svr, char *error, Eina_Bool duplicate); void ecore_con_event_client_add(Ecore_Con_Client *cl); void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate); void ecore_con_event_client_del(Ecore_Con_Client *cl); void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error); - +void _ecore_con_server_kill(Ecore_Con_Server *svr); +void _ecore_con_client_kill(Ecore_Con_Client *cl); /* from ecore_local_win32.c */ #ifdef _WIN32 Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr); @@ -312,6 +382,7 @@ GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Add, ecore_con_event_server_add GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del); GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write); GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Proxy_Bind, ecore_con_event_proxy_bind); void ecore_con_mempool_init(void); void ecore_con_mempool_shutdown(void); diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c b/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c new file mode 100644 index 0000000..aecaff0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_socks.c @@ -0,0 +1,496 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_NETINET_TCP_H +# include +#endif + +#ifdef HAVE_NET_IF_H +# include +#endif + +/* if net/if.h is not found or if an older versions of net/if.h is provided + which does not define IF_NAMESIZE. We must define it ourselves */ +#ifndef IF_NAMESIZE +# ifdef IFNAMSIZ +# define IF_NAMESIZE IFNAMSIZ +# else +# define IF_NAMESIZE 16 +# endif +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef HAVE_SYS_UN_H +# include +#endif + +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +#define _ecore_con_server_kill(svr) do { \ + DBG("KILL %p", (svr)); \ + _ecore_con_server_kill((svr)); \ +} while (0) + +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) +{ + Eina_List *l; + Ecore_Con_Socks *ecs; + + if (!ecore_con_socks_proxies) return NULL; + + EINA_LIST_FOREACH(ecore_con_socks_proxies, l, ecs) + { + if (ecs->version != version) continue; + if (strcmp(ecs->ip, ip)) continue; + if ((port != -1) && (port != ecs->port)) continue; + if (username && strcmp(ecs->username, username)) continue; + return ecs; + } + return NULL; +} + +static void +_ecore_con_socks_free(Ecore_Con_Socks *ecs) +{ + ECORE_CON_SOCKS_CAST_ELSE(ecs) return; + + if (_ecore_con_proxy_once == ecs) _ecore_con_proxy_once = NULL; + if (_ecore_con_proxy_global == ecs) _ecore_con_proxy_global = NULL; + eina_stringshare_del(ecs->ip); + eina_stringshare_del(ecs->username); + free(ecs); +} +///////////////////////////////////////////////////////////////////////////////////// +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) +{ + const unsigned char *data; + ECORE_CON_SOCKS_CAST_ELSE(svr->ecs) return; + + if (svr->ecs_state != ECORE_CON_SOCKS_STATE_READ) return; + + if (v4) + { + 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 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]; + + 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_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); + } + return; +error: + _ecore_con_server_kill(svr); +} + +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; + 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; +} + +void +ecore_con_socks_dns_cb(const char *canonname __UNUSED__, const char *ip, struct sockaddr *addr, int addrlen, 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); +#ifdef HAVE_IPV6 + else + memcpy(svr->ecs_addr, &((struct sockaddr_in6 *)addr)->sin6_addr.s6_addr, addrlen); +#endif + ecore_con_socks_svr_init(svr); +} + +void +ecore_con_socks_init(void) +{ + const char *socks; + char *u, *h, *p, *l; + char buf[64]; + int port, lookup = 0; + Ecore_Con_Socks *ecs; + unsigned char addr[sizeof(struct in_addr)]; + + /* ECORE_CON_SOCKS_V4=user@host:port:[1|0] */ + socks = getenv("ECORE_CON_SOCKS_V4"); + if ((!socks) || (!socks[0]) || (strlen(socks) > 64)) 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, ':'); + if (!p) return; + *p++ = 0; + if (!inet_pton(AF_INET, h, addr)) return; + + 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 (!ecs) return; + ecore_con_socks4_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"); +} + +///////////////////////////////////////////////////////////////////////////////////// + +/** + * @defgroup Ecore_Con_Socks_Group Ecore Connection SOCKS functions + * @{ + */ + +/** + * Add a SOCKS v4 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) + * @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_socks4_remote_add(const char *ip, int port, const char *username) +{ + Ecore_Con_Socks *ecs; + + if ((!ip) || (!ip[0]) || (port < 0) || (port > 65535)) return NULL; + + ecs = _ecore_con_socks_find(4, ip, port, username); + if (ecs) return ecs; + + ecs = calloc(1, sizeof(Ecore_Con_Socks_v4)); + if (!ecs) return NULL; + + ecs->version = 4; + ecs->ip = eina_stringshare_add(ip); + ecs->port = port; + ecs->username = eina_stringshare_add(username); + ecore_con_socks_proxies = eina_list_append(ecore_con_socks_proxies, ecs); + return ecs; +} + +/** + * Set DNS lookup mode on an existing SOCKS v4 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. 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_socks4_lookup_set(Ecore_Con_Socks *ecs, Eina_Bool enable) +{ + ECORE_CON_SOCKS_CAST_ELSE(ecs) return; + if (v4) v4->lookup = !!enable; +} + +/** + * Get DNS lookup mode on an existing SOCKS v4 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. 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_socks4_lookup_get(Ecore_Con_Socks *ecs) +{ + ECORE_CON_SOCKS_CAST_ELSE(ecs) return EINA_FALSE; + return v4 ? v4->lookup : EINA_FALSE; +} + +/** + * Find a SOCKS v4 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) + * @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 Eina_Bool +ecore_con_socks4_remote_exists(const char *ip, int port, const char *username) +{ + if ((!ip) || (!ip[0]) || (port < -1) || (port > 65535) || (username && (!username[0]))) + return EINA_FALSE; + return !!_ecore_con_socks_find(4, ip, port, username); +} + +/** + * Remove a SOCKS v4 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) + * @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_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); + if (!v4) return; + ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, v4); + _ecore_con_socks_free((Ecore_Con_Socks*)v4); +} + +/** + * Enable bind mode on a SOCKS proxy + * + * Use this function to enable binding a remote port for use with a remote server. + * For more information, see http://ufasoft.com/doc/socks4_protocol.htm + * @param ecs The proxy object + * @param is_bind If true, the connection established will be a port binding + * @warning Be aware that changing the operation mode of an active proxy may result in undefined behavior + * @since 1.2 + */ +EAPI void +ecore_con_socks_bind_set(Ecore_Con_Socks *ecs, Eina_Bool is_bind) +{ + EINA_SAFETY_ON_NULL_RETURN(ecs); + ecs->bind = !!is_bind; +} + +/** + * Return bind mode of a SOCKS proxy + * + * Use this function to return bind mode of a proxy (binding a remote port for use with a remote server). + * For more information, see http://ufasoft.com/doc/socks4_protocol.htm + * @param ecs The proxy object + * @return If true, the connection established will be a port binding + * @since 1.2 + */ +EAPI Eina_Bool +ecore_con_socks_bind_get(Ecore_Con_Socks *ecs) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ecs, EINA_FALSE); + return ecs->bind; +} + +EAPI unsigned int +ecore_con_socks_version_get(Ecore_Con_Socks *ecs) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ecs, 0); + return ecs->version; +} + +/** + * Remove a SOCKS v4 proxy from the proxy list and delete it + * + * Use this to remove a SOCKS proxy from the proxy list by directly deleting the object given. + * @param ecs The proxy object to delete + * @warning Be aware that deleting a proxy which is being used WILL ruin your life. + * @since 1.2 + */ +EAPI void +ecore_con_socks_remote_del(Ecore_Con_Socks *ecs) +{ + EINA_SAFETY_ON_NULL_RETURN(ecs); + if (!ecore_con_socks_proxies) return; + + ecore_con_socks_proxies = eina_list_remove(ecore_con_socks_proxies, ecs); + _ecore_con_socks_free(ecs); +} + +/** + * Set a proxy object to be used with the next server created with ecore_con_server_connect() + * + * This function sets a proxy for the next ecore_con connection. After the next server is created, + * the proxy will NEVER be applied again unless explicitly enabled. + * @param ecs The proxy object + * @see ecore_con_socks_apply_always() + * @since 1.2 + */ +EAPI void +ecore_con_socks_apply_once(Ecore_Con_Socks *ecs) +{ + _ecore_con_proxy_once = ecs; +} + +/** + * Set a proxy object to be used with all servers created with ecore_con_server_connect() + * + * This function sets a proxy for all ecore_con connections. It will always be used. + * @param ecs The proxy object + * @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 + * 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 + * lookup is 1 if the proxy should perform all DNS lookups, otherwise 0 or omitted + */ +EAPI void +ecore_con_socks_apply_always(Ecore_Con_Socks *ecs) +{ + _ecore_con_proxy_global = ecs; +} +/** @} */ 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 c352e94..6104632 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c @@ -16,6 +16,7 @@ # include #endif +#include #include "Ecore.h" #include "ecore_con_private.h" @@ -60,12 +61,34 @@ _gnutls_print_errors(void *conn, int type, int ret) ecore_con_event_server_error(conn, buf); } +static void +_gnutls_print_session(const gnutls_datum_t *cert_list, unsigned int cert_list_size) +{ + char *c = NULL; + gnutls_x509_crt_t crt; + unsigned int x; + + if (!eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) return; + for (x = 0; x < cert_list_size; x++) + { + gnutls_x509_crt_init(&crt); + gnutls_x509_crt_import(crt, &cert_list[x], GNUTLS_X509_FMT_DER); + gnutls_x509_crt_print(crt, GNUTLS_CRT_PRINT_FULL, (gnutls_datum_t*)&c); + INF("CERTIFICATE:\n%s", c); + gnutls_free(c); + gnutls_x509_crt_deinit(crt); + crt = NULL; + } +} + #ifdef ISCOMFITOR static void _gnutls_log_func(int level, const char *str) { - DBG("|<%d>| %s", level, str); + char buf[128]; + strncat(buf, str, strlen(str) - 1); + DBG("|<%d>| %s", level, buf); } #endif @@ -116,6 +139,185 @@ SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_description_t status) #elif USE_OPENSSL static void +_openssl_print_verify_error(int error) +{ + switch (error) + { +#define ERROR(X) \ + case (X): \ + ERR("%s", #X); \ + break +#ifdef X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT + ERROR(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT); +#endif +#ifdef X509_V_ERR_UNABLE_TO_GET_CRL + ERROR(X509_V_ERR_UNABLE_TO_GET_CRL); +#endif +#ifdef X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE + ERROR(X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE); +#endif +#ifdef X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE + ERROR(X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE); +#endif +#ifdef X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY + ERROR(X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY); +#endif +#ifdef X509_V_ERR_CERT_SIGNATURE_FAILURE + ERROR(X509_V_ERR_CERT_SIGNATURE_FAILURE); +#endif +#ifdef X509_V_ERR_CRL_SIGNATURE_FAILURE + ERROR(X509_V_ERR_CRL_SIGNATURE_FAILURE); +#endif +#ifdef X509_V_ERR_CERT_NOT_YET_VALID + ERROR(X509_V_ERR_CERT_NOT_YET_VALID); +#endif +#ifdef X509_V_ERR_CERT_HAS_EXPIRED + ERROR(X509_V_ERR_CERT_HAS_EXPIRED); +#endif +#ifdef X509_V_ERR_CRL_NOT_YET_VALID + ERROR(X509_V_ERR_CRL_NOT_YET_VALID); +#endif +#ifdef X509_V_ERR_CRL_HAS_EXPIRED + ERROR(X509_V_ERR_CRL_HAS_EXPIRED); +#endif +#ifdef X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD + ERROR(X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD); +#endif +#ifdef X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD + ERROR(X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD); +#endif +#ifdef X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD + ERROR(X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD); +#endif +#ifdef X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD + ERROR(X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD); +#endif +#ifdef X509_V_ERR_OUT_OF_MEM + ERROR(X509_V_ERR_OUT_OF_MEM); +#endif +#ifdef X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT + ERROR(X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT); +#endif +#ifdef X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN + ERROR(X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN); +#endif +#ifdef X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY + ERROR(X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY); +#endif +#ifdef X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE + ERROR(X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE); +#endif +#ifdef X509_V_ERR_CERT_CHAIN_TOO_LONG + ERROR(X509_V_ERR_CERT_CHAIN_TOO_LONG); +#endif +#ifdef X509_V_ERR_CERT_REVOKED + ERROR(X509_V_ERR_CERT_REVOKED); +#endif +#ifdef X509_V_ERR_INVALID_CA + ERROR(X509_V_ERR_INVALID_CA); +#endif +#ifdef X509_V_ERR_PATH_LENGTH_EXCEEDED + ERROR(X509_V_ERR_PATH_LENGTH_EXCEEDED); +#endif +#ifdef X509_V_ERR_INVALID_PURPOSE + ERROR(X509_V_ERR_INVALID_PURPOSE); +#endif +#ifdef X509_V_ERR_CERT_UNTRUSTED + ERROR(X509_V_ERR_CERT_UNTRUSTED); +#endif +#ifdef X509_V_ERR_CERT_REJECTED + ERROR(X509_V_ERR_CERT_REJECTED); +#endif + /* These are 'informational' when looking for issuer cert */ +#ifdef X509_V_ERR_SUBJECT_ISSUER_MISMATCH + ERROR(X509_V_ERR_SUBJECT_ISSUER_MISMATCH); +#endif +#ifdef X509_V_ERR_AKID_SKID_MISMATCH + ERROR(X509_V_ERR_AKID_SKID_MISMATCH); +#endif +#ifdef X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH + ERROR(X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH); +#endif +#ifdef X509_V_ERR_KEYUSAGE_NO_CERTSIGN + ERROR(X509_V_ERR_KEYUSAGE_NO_CERTSIGN); +#endif + +#ifdef X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER + ERROR(X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER); +#endif +#ifdef X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION + ERROR(X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION); +#endif +#ifdef X509_V_ERR_KEYUSAGE_NO_CRL_SIGN + ERROR(X509_V_ERR_KEYUSAGE_NO_CRL_SIGN); +#endif +#ifdef X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION + ERROR(X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION); +#endif +#ifdef X509_V_ERR_INVALID_NON_CA + ERROR(X509_V_ERR_INVALID_NON_CA); +#endif +#ifdef X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED + ERROR(X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED); +#endif +#ifdef X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE + ERROR(X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE); +#endif +#ifdef X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED + ERROR(X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED); +#endif + +#ifdef X509_V_ERR_INVALID_EXTENSION + ERROR(X509_V_ERR_INVALID_EXTENSION); +#endif +#ifdef X509_V_ERR_INVALID_POLICY_EXTENSION + ERROR(X509_V_ERR_INVALID_POLICY_EXTENSION); +#endif +#ifdef X509_V_ERR_NO_EXPLICIT_POLICY + ERROR(X509_V_ERR_NO_EXPLICIT_POLICY); +#endif +#ifdef X509_V_ERR_DIFFERENT_CRL_SCOPE + ERROR(X509_V_ERR_DIFFERENT_CRL_SCOPE); +#endif +#ifdef X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE + ERROR(X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE); +#endif + +#ifdef X509_V_ERR_UNNESTED_RESOURCE + ERROR(X509_V_ERR_UNNESTED_RESOURCE); +#endif + +#ifdef X509_V_ERR_PERMITTED_VIOLATION + ERROR(X509_V_ERR_PERMITTED_VIOLATION); +#endif +#ifdef X509_V_ERR_EXCLUDED_VIOLATION + ERROR(X509_V_ERR_EXCLUDED_VIOLATION); +#endif +#ifdef X509_V_ERR_SUBTREE_MINMAX + ERROR(X509_V_ERR_SUBTREE_MINMAX); +#endif +#ifdef X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE + ERROR(X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE); +#endif +#ifdef X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX + ERROR(X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX); +#endif +#ifdef X509_V_ERR_UNSUPPORTED_NAME_SYNTAX + ERROR(X509_V_ERR_UNSUPPORTED_NAME_SYNTAX); +#endif +#ifdef X509_V_ERR_CRL_PATH_VALIDATION_ERROR + ERROR(X509_V_ERR_CRL_PATH_VALIDATION_ERROR); +#endif + + /* The application is not happy */ +#ifdef X509_V_ERR_APPLICATION_VERIFICATION + ERROR(X509_V_ERR_APPLICATION_VERIFICATION); +#endif + } +#undef ERROR +} + +static void _openssl_print_errors(void *conn, int type) { char buf[1024]; @@ -152,13 +354,57 @@ _openssl_name_verify(const char *name, const char *svrname) EINA_SAFETY_ON_TRUE_RETURN_VAL(!s, EINA_FALSE); /* same as above for the stored name */ EINA_SAFETY_ON_TRUE_RETURN_VAL(!strchr(s + 1, '.'), EINA_FALSE); - EINA_SAFETY_ON_TRUE_RETURN_VAL(strcasecmp(s, name + 1), EINA_FALSE); + if (strcasecmp(s, name + 1)) + { + ERR("%s != %s", s, name + 1); + return EINA_FALSE; + } } else - EINA_SAFETY_ON_TRUE_RETURN_VAL(strcasecmp(name, svrname), EINA_FALSE); + if (strcasecmp(name, svrname)) + { + ERR("%s != %s", name, svrname); + return EINA_FALSE; + } return EINA_TRUE; } +static void +_openssl_print_session(SSL *ssl) +{ + /* print session info into DBG */ + SSL_SESSION *s; + STACK_OF(X509) *sk; + BIO *b; + char log[4096], *p; + int x; + + if (!eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) return; + + memset(log, 0, sizeof(log)); + b = BIO_new(BIO_s_mem()); + sk = SSL_get_peer_cert_chain(ssl); + if (sk) + { + DBG("CERTIFICATES:"); + for (x = 0; x < sk_X509_num(sk); x++) + { + p = X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, x)), log, sizeof(log)); + DBG("%2d s:%s", x, p); + p = X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk, x)), log, sizeof(log)); + DBG(" i:%s", p); + PEM_write_X509(stderr, sk_X509_value(sk, x)); + } + } + s = SSL_get_session(ssl); + SSL_SESSION_print(b, s); + fprintf(stderr, "\n"); + while (BIO_read(b, log, sizeof(log)) > 0) + fprintf(stderr, "%s", log); + + BIO_free(b); +} + #endif #define SSL_ERROR_CHECK_GOTO_ERROR(X) \ @@ -356,6 +602,51 @@ ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr) } /** + * @brief Set the hostname to verify against in certificate verification + * + * Sometimes the certificate hostname will not match the hostname that you are + * connecting to, and will instead match a different name. An example of this is + * that if you connect to talk.google.com to use Google Talk, you receive Google's + * certificate for gmail.com. This certificate should be trusted, and so you must call + * this function with "gmail.com" as @p name. + * See RFC2818 for more details. + * @param svr The server object + * @param name The hostname to verify against + * @since 1.2 + */ +EAPI void +ecore_con_ssl_server_verify_name_set(Ecore_Con_Server *svr, const char *name) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__); + return; + } + eina_stringshare_replace(&svr->verify_name, name); +} + +/** + * @brief Get the hostname to verify against in certificate verification + * + * This function returns the name which will be used to validate the SSL certificate + * common name (CN) or alt name (subjectAltName). It will default to the @p name + * param in ecore_con_server_connect(), but can be changed with ecore_con_ssl_server_verify_name_set(). + * @param svr The server object + * @return The hostname which will be used + * @since 1.2 + */ +EAPI const char * +ecore_con_ssl_server_verify_name_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__); + return NULL; + } + return svr->verify_name ?: svr->name; +} + +/** * @brief Add an ssl certificate for use in ecore_con functions. * * Use this function to add a SSL PEM certificate. @@ -375,6 +666,14 @@ ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr, return EINA_FALSE; } + if (!svr->ssl_prepared) + { + svr->use_cert = EINA_TRUE; + svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT; + if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL)) + return EINA_FALSE; + } + return SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (svr, cert); } @@ -386,6 +685,7 @@ ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr, * If there is an error loading the CAs, an error will automatically be logged. * @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 */ EAPI Eina_Bool @@ -398,6 +698,14 @@ ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr, return EINA_FALSE; } + if (!svr->ssl_prepared) + { + svr->use_cert = EINA_TRUE; + svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT; + if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL)) + return EINA_FALSE; + } + return SSL_SUFFIX(_ecore_con_ssl_server_cafile_add) (svr, ca_file); } @@ -422,6 +730,14 @@ ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr, return EINA_FALSE; } + if (!svr->ssl_prepared) + { + svr->use_cert = EINA_TRUE; + svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT; + if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL)) + return EINA_FALSE; + } + return SSL_SUFFIX(_ecore_con_ssl_server_privkey_add) (svr, key_file); } @@ -446,6 +762,14 @@ ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr, return EINA_FALSE; } + if (!svr->ssl_prepared) + { + svr->use_cert = EINA_TRUE; + svr->type |= ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT; + if (ecore_con_ssl_server_prepare(svr, svr->type & ECORE_CON_SSL)) + return EINA_FALSE; + } + return SSL_SUFFIX(_ecore_con_ssl_server_crl_add) (svr, crl_file); } @@ -480,7 +804,8 @@ ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type ssl_type) if (ecore_con_ssl_server_prepare(svr, ssl_type)) return EINA_FALSE; } - svr->type |= ssl_type; + if (!svr->use_cert) + svr->type |= ssl_type; svr->upgrade = EINA_TRUE; svr->handshaking = EINA_TRUE; svr->ssl_state = ECORE_CON_SSL_STATE_INIT; @@ -494,7 +819,7 @@ ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type ssl_type) * Once the upgrade has been completed, an ECORE_CON_EVENT_CLIENT_UPGRADE event will be emitted. * The connection should be treated as disconnected until the next event. * @param cl The client object - * @param compl_type The SSL connection type (ONLY). + * @param ssl_type The SSL connection type (ONLY). * @return EINA_FALSE if the connection cannot be upgraded, otherwise EINA_TRUE. * @warning Setting a wrong value for @p compl_type WILL mess up your program. * @since 1.1 @@ -517,7 +842,8 @@ ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type ssl_type) if (ecore_con_ssl_server_prepare(cl->host_server, ssl_type)) return EINA_FALSE; } - cl->host_server->type |= ssl_type; + if (!cl->host_server->use_cert) + cl->host_server->type |= ssl_type; cl->upgrade = EINA_TRUE; cl->host_server->upgrade = EINA_TRUE; cl->handshaking = EINA_TRUE; @@ -546,8 +872,11 @@ _ecore_con_ssl_init_gnutls(void) return ECORE_CON_SSL_ERROR_INIT_FAILED; #ifdef ISCOMFITOR - gnutls_global_set_log_level(9); - gnutls_global_set_log_function(_gnutls_log_func); + if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) + { + gnutls_global_set_log_level(9); + gnutls_global_set_log_function(_gnutls_log_func); + } #endif return ECORE_CON_SSL_ERROR_NONE; } @@ -728,10 +1057,12 @@ _ecore_con_ssl_server_init_gnutls(Ecore_Con_Server *svr) SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(svr->session, &cert_list_size))); SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size); + _gnutls_print_session(cert_list, cert_list_size); + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert)); SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER)); - SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, svr->name)); + SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, svr->verify_name ?: svr->name)); gnutls_x509_crt_deinit(cert); DBG("SSL certificate verification succeeded!"); return ECORE_CON_SSL_ERROR_NONE; @@ -755,10 +1086,32 @@ static Eina_Bool _ecore_con_ssl_server_cafile_add_gnutls(Ecore_Con_Server *svr, const char *ca_file) { - SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_trust_file(svr->cert, ca_file, - GNUTLS_X509_FMT_PEM) < 1); + struct stat st; + Eina_Iterator *it; + const char *file; + Eina_Bool error = EINA_FALSE; - return EINA_TRUE; + if (stat(ca_file, &st)) return EINA_FALSE; + if (S_ISDIR(st.st_mode)) + { + it = eina_file_ls(ca_file); + SSL_ERROR_CHECK_GOTO_ERROR(!it); + EINA_ITERATOR_FOREACH(it, file) + { + if (!error) + { + if (gnutls_certificate_set_x509_trust_file(svr->cert, file, GNUTLS_X509_FMT_PEM) < 1) + error++; + } + eina_stringshare_del(file); + } + eina_iterator_free(it); + } + else + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_trust_file(svr->cert, ca_file, + GNUTLS_X509_FMT_PEM) < 1); + + return !error; error: ERR("Could not load CA file!"); return EINA_FALSE; @@ -1026,6 +1379,7 @@ _ecore_con_ssl_client_init_gnutls(Ecore_Con_Client *cl) SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(cl->session, &cert_list_size))); SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size); + _gnutls_print_session(cert_list, cert_list_size); /* gnutls_x509_crt_t cert = NULL; SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert)); @@ -1282,23 +1636,7 @@ _ecore_con_ssl_server_init_openssl(Ecore_Con_Server *svr) break; } -#ifdef ISCOMFITOR - { - /* print session info into DBG */ - SSL_SESSION *s; - BIO *b; - char log[4096]; - - memset(log, 0, sizeof(log)); - s = SSL_get_session(svr->ssl); - b = BIO_new(BIO_s_mem()); - SSL_SESSION_print(b, s); - while (BIO_read(b, log, sizeof(log)) > 0) - DBG("%s", log); - - BIO_free(b); - } -#endif + _openssl_print_session(svr->ssl); if ((!svr->verify) && (!svr->verify_basic)) /* not verifying certificates, so we're done! */ return ECORE_CON_SSL_ERROR_NONE; @@ -1310,17 +1648,29 @@ _ecore_con_ssl_server_init_openssl(Ecore_Con_Server *svr) cert = SSL_get_peer_certificate(svr->ssl); if (cert) { - char buf[256] = {0}; + char *c; + int clen; + int name = 0; + if (svr->verify) - SSL_ERROR_CHECK_GOTO_ERROR(SSL_get_verify_result(svr->ssl)); - X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_subject_alt_name, buf, sizeof(buf)); - if (buf[0]) - SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(buf, svr->name)); - else { - X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, buf, sizeof(buf)); - SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(buf, svr->name)); + int err; + + err = SSL_get_verify_result(svr->ssl); + _openssl_print_verify_error(err); + SSL_ERROR_CHECK_GOTO_ERROR(err); } + clen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_subject_alt_name, NULL, 0); + if (clen > 0) + name = NID_subject_alt_name; + else + clen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, NULL, 0); + SSL_ERROR_CHECK_GOTO_ERROR(clen < 1); + if (!name) name = NID_commonName; + c = alloca(++clen); + X509_NAME_get_text_by_NID(X509_get_subject_name(cert), name, c, clen); + INF("CERT NAME: %s\n", c); + SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(c, svr->verify_name ?: svr->name)); } } @@ -1338,7 +1688,13 @@ static Eina_Bool _ecore_con_ssl_server_cafile_add_openssl(Ecore_Con_Server *svr, const char *ca_file) { - SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, ca_file, NULL)); + struct stat st; + + if (stat(ca_file, &st)) return EINA_FALSE; + if (S_ISDIR(st.st_mode)) + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, NULL, ca_file)); + else + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, ca_file, NULL)); return EINA_TRUE; error: @@ -1543,31 +1899,20 @@ _ecore_con_ssl_client_init_openssl(Ecore_Con_Client *cl) break; } -#ifdef ISCOMFITOR - { - /* print session info into DBG */ - SSL_SESSION *s; - BIO *b; - char log[4096]; - - memset(log, 0, sizeof(log)); - s = SSL_get_session(cl->ssl); - b = BIO_new(BIO_s_mem()); - SSL_SESSION_print(b, s); - while (BIO_read(b, log, sizeof(log)) > 0) - DBG("%s", log); - - BIO_free(b); - } -#endif - + _openssl_print_session(cl->ssl); if (!cl->host_server->verify) /* not verifying certificates, so we're done! */ return ECORE_CON_SSL_ERROR_NONE; SSL_set_verify(cl->ssl, SSL_VERIFY_PEER, NULL); /* use CRL/CA lists to verify */ if (SSL_get_peer_certificate(cl->ssl)) - SSL_ERROR_CHECK_GOTO_ERROR(SSL_get_verify_result(cl->ssl)); + { + int err; + + err = SSL_get_verify_result(cl->ssl); + _openssl_print_verify_error(err); + SSL_ERROR_CHECK_GOTO_ERROR(err); + } return ECORE_CON_SSL_ERROR_NONE; @@ -1679,12 +2024,6 @@ _ecore_con_ssl_server_prepare_none(Ecore_Con_Server *svr __UNUSED__, } static Ecore_Con_Ssl_Error -_ecore_con_ssl_server_upgrade_none(Ecore_Con_Server *svr __UNUSED__) -{ - return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; -} - -static Ecore_Con_Ssl_Error _ecore_con_ssl_server_init_none(Ecore_Con_Server *svr __UNUSED__) { return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; @@ -1741,12 +2080,6 @@ _ecore_con_ssl_server_write_none(Ecore_Con_Server *svr __UNUSED__, } static Ecore_Con_Ssl_Error -_ecore_con_ssl_client_upgrade_none(Ecore_Con_Client *cl __UNUSED__) -{ - return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; -} - -static Ecore_Con_Ssl_Error _ecore_con_ssl_client_init_none(Ecore_Con_Client *cl __UNUSED__) { return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; 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 cfcf095..709b554 100644 --- a/libraries/ecore/src/lib/ecore_con/ecore_con_url.c +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_url.c @@ -35,8 +35,6 @@ int ECORE_CON_EVENT_URL_COMPLETE = 0; int ECORE_CON_EVENT_URL_PROGRESS = 0; #ifdef HAVE_CURL -static Eina_Bool _ecore_con_url_fd_handler(void *data, - Ecore_Fd_Handler *fd_handler); 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, @@ -57,50 +55,18 @@ static size_t _ecore_con_url_read_cb(void *ptr, void *stream); static void _ecore_con_event_url_free(void *data __UNUSED__, void *ev); -static int _ecore_con_url_process_completed_jobs( - Ecore_Con_Url *url_con_to_match); 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 Eina_Bool _ecore_con_url_timeout_cb(void *data); -static Ecore_Idler *_fd_idler_handler = NULL; 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 Eina_Bool pipelining = EINA_FALSE; -typedef struct _Ecore_Con_Url_Event Ecore_Con_Url_Event; -struct _Ecore_Con_Url_Event -{ - int type; - void *ev; -}; - -static Eina_Bool -_url_complete_idler_cb(void *data) -{ - Ecore_Con_Url_Event *lev; - - lev = data; - ecore_event_add(lev->type, lev->ev, _ecore_con_event_url_free, NULL); - free(lev); - - return ECORE_CALLBACK_CANCEL; -} - -static void -_url_complete_push_event(int type, - void *ev) -{ - Ecore_Con_Url_Event *lev; - - lev = malloc(sizeof(Ecore_Con_Url_Event)); - lev->type = type; - lev->ev = ev; - - ecore_idler_add(_url_complete_idler_cb, lev); -} - #endif /** @@ -113,51 +79,30 @@ EAPI int ecore_con_url_init(void) { #ifdef HAVE_CURL - _init_count++; - - if (_init_count > 1) - return _init_count; + if (++_init_count > 1) return _init_count; - if (!ECORE_CON_EVENT_URL_DATA) - { - 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(); - } + 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(); if (!_curlm) { long ms; - FD_ZERO(&_current_fd_set); - if (curl_global_init(CURL_GLOBAL_ALL)) - { - while (_url_con_list) - ecore_con_url_free(eina_list_data_get(_url_con_list)); - return 0; - } + // curl_global_init() is not thread safe! + if (curl_global_init(CURL_GLOBAL_ALL)) return --_init_count; _curlm = curl_multi_init(); - if (!_curlm) - { - while (_url_con_list) - ecore_con_url_free(eina_list_data_get(_url_con_list)); - - _init_count--; - return 0; - } + if (!_curlm) return --_init_count; curl_multi_timeout(_curlm, &ms); - if (ms <= 0) - ms = 1000; + if (ms <= 0) ms = 100; - _curl_timeout = - ecore_timer_add((double)ms / 1000, _ecore_con_url_idler_handler, - (void *)0xACE); + _curl_timeout = ecore_timer_add((double)ms / 1000, _ecore_con_url_idler_handler, (void *)0xACE); ecore_timer_freeze(_curl_timeout); } - return 1; + return _init_count; #else return 0; #endif @@ -167,34 +112,31 @@ EAPI int ecore_con_url_shutdown(void) { #ifdef HAVE_CURL - if (!_init_count) - return 0; - - _init_count--; + if (_init_count == 0) return 0; - if (_init_count != 0) - return _init_count; - - if (_fd_idler_handler) - ecore_idler_del(_fd_idler_handler); - - _fd_idler_handler = NULL; - - if (_curl_timeout) - ecore_timer_del(_curl_timeout); - - _curl_timeout = NULL; + if (--_init_count == 0) + { + Ecore_Con_Url *con_url; + Ecore_Fd_Handler *fd_handler; - while (_url_con_list) - ecore_con_url_free(eina_list_data_get(_url_con_list)); + if (_curl_timeout) + { + ecore_timer_del(_curl_timeout); + _curl_timeout = NULL; + } - if (_curlm) - { - curl_multi_cleanup(_curlm); - _curlm = 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); - curl_global_cleanup(); + if (_curlm) + { + curl_multi_cleanup(_curlm); + _curlm = NULL; + } + curl_global_cleanup(); + } + return _init_count; #endif return 1; } @@ -237,7 +179,6 @@ ecore_con_url_new(const char *url) if (!url_con) return NULL; - url_con->fd = -1; url_con->write_fd = -1; url_con->curl_easy = curl_easy_init(); @@ -255,6 +196,24 @@ ecore_con_url_new(const char *url) return NULL; } + url_con->proxy_type = -1; + if (_ecore_con_proxy_global) + { + if (_ecore_con_proxy_global->ip) + { + 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", + _ecore_con_proxy_global->ip); + ecore_con_url_proxy_set(url_con, host); + } + } + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate"); if (ret != CURLE_OK) { @@ -344,43 +303,30 @@ ecore_con_url_free(Ecore_Con_Url *url_con) } ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE); - if(url_con->fd != -1) - { - FD_CLR(url_con->fd, &_current_fd_set); - if (url_con->fd_handler) - ecore_main_fd_handler_del(url_con->fd_handler); - - url_con->fd = -1; - url_con->fd_handler = NULL; - } if (url_con->curl_easy) { - // FIXME: For an unknown reason, progress continue to arrive after destruction - // this prevent any further call to the callback. curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL); curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_TRUE); - if (url_con->active) + if (eina_list_data_find(_url_con_list, url_con)) { - url_con->active = EINA_FALSE; - 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)); + 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); } curl_easy_cleanup(url_con->curl_easy); } + if (url_con->timer) ecore_timer_del(url_con->timer); - _url_con_list = eina_list_remove(_url_con_list, url_con); curl_slist_free_all(url_con->headers); EINA_LIST_FREE(url_con->additional_headers, s) free(s); EINA_LIST_FREE(url_con->response_headers, s) free(s); eina_stringshare_del(url_con->url); + if (url_con->post_data) free(url_con->post_data); free(url_con); #else return; @@ -415,8 +361,7 @@ ecore_con_url_url_set(Ecore_Con_Url *url_con, return EINA_FALSE; } - if (url_con->active) - return EINA_FALSE; + if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; eina_stringshare_replace(&url_con->url, url); @@ -660,7 +605,7 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, #ifdef HAVE_CURL Eina_List *l; const char *s; - char tmp[256]; + char tmp[512]; if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) { @@ -668,8 +613,7 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, return EINA_FALSE; } - if (url_con->active) - return EINA_FALSE; + if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; if (!url_con->url) return EINA_FALSE; @@ -684,16 +628,24 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, if ((mode == MODE_POST) || (mode == MODE_AUTO)) { - if (data) + if (url_con->post_data) free(url_con->post_data); + url_con->post_data = NULL; + if ((data) && (length > 0)) { - if ((content_type) && (strlen(content_type) < 200)) + url_con->post_data = malloc(length); + if (url_con->post_data) { - snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type); - url_con->headers = curl_slist_append(url_con->headers, tmp); + memcpy(url_con->post_data, data, length); + if ((content_type) && (strlen(content_type) < 450)) + { + snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type); + url_con->headers = curl_slist_append(url_con->headers, tmp); + } + curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, url_con->post_data); + curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length); } - - curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data); - curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length); + else + return EINA_FALSE; } else curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 0); if (mode == MODE_POST) @@ -787,8 +739,7 @@ ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, return EINA_FALSE; } - if (url_con->active) - return EINA_FALSE; + if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; if (!url_con->url) return EINA_FALSE; @@ -1021,8 +972,7 @@ ecore_con_url_verbose_set(Ecore_Con_Url *url_con, return; } - if (url_con->active) - return; + if (eina_list_data_find(_url_con_list, url_con)) return; if (!url_con->url) return; @@ -1047,8 +997,7 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, return; } - if (url_con->active) - return; + if (eina_list_data_find(_url_con_list, url_con)) return; if (!url_con->url) return; @@ -1085,8 +1034,7 @@ ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, return; } - if (url_con->active) - return; + if (eina_list_data_find(_url_con_list, url_con)) return; if (!url_con->url) return; @@ -1129,7 +1077,7 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path) return -1; } - if (url_con->active) return -1; + if (eina_list_data_find(_url_con_list, url_con)) return -1; if (!url_con->url) return -1; if (ca_path == NULL) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 0); @@ -1148,58 +1096,180 @@ ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path) return res; } - -/** - * @} - */ - -#ifdef HAVE_CURL -static int -_ecore_con_url_suspend_fd_handler(void) +EAPI Eina_Bool +ecore_con_url_proxy_set(Ecore_Con_Url *url_con, const char *proxy) { - Eina_List *l; - Ecore_Con_Url *url_con; - int deleted = 0; +#ifdef HAVE_CURL + int res = -1; + curl_version_info_data *vers = NULL; - if (!_url_con_list) - return 0; + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_proxy_set"); + return EINA_FALSE; + } - EINA_LIST_FOREACH(_url_con_list, l, url_con) + if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; + if (!url_con->url) return EINA_FALSE; + + if (!proxy) res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, ""); + else { - if (url_con->active && url_con->fd_handler) + // before curl version 7.21.7, socks protocol:// prefix is not supported + // (e.g. socks4://, socks4a://, socks5:// or socks5h://, etc.) + vers = curl_version_info(CURLVERSION_NOW); + if (vers->version_num < 0x71507) { - ecore_main_fd_handler_del(url_con->fd_handler); - url_con->fd_handler = NULL; - deleted++; + 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 (res != CURLE_OK) + { + ERR("curl proxy type setting failed: %s", curl_easy_strerror(res)); + url_con->proxy_type = -1; + return EINA_FALSE; + } } + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PROXY, proxy); + } + if (res != CURLE_OK) + { + ERR("curl proxy setting failed: %s", curl_easy_strerror(res)); + url_con->proxy_type = -1; + return EINA_FALSE; + } + return EINA_TRUE; +#else + return EINA_FALSE; + (void)url_con; + (void)proxy; +#endif +} + +EAPI void +ecore_con_url_timeout_set(Ecore_Con_Url *url_con, double timeout) +{ +#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_timeout_set"); + return; } - return deleted; + if (eina_list_data_find(_url_con_list, url_con)) 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); +#else + return; + (void)url_con; + (void)timeout; +#endif } -static int -_ecore_con_url_restart_fd_handler(void) +EAPI Eina_Bool +ecore_con_url_proxy_username_set(Ecore_Con_Url *url_con, const char *username) { - Eina_List *l; - Ecore_Con_Url *url_con; - int activated = 0; +#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_proxy_username_set"); + return EINA_FALSE; + } - if (!_url_con_list) - return 0; + if (eina_list_data_find(_url_con_list, url_con)) return EINA_FALSE; + if (!url_con->url) return EINA_FALSE; + if (!username) return EINA_FALSE; + if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A) + { + ERR("Proxy type should be socks5 and above"); + return EINA_FALSE; + } - EINA_LIST_FOREACH(_url_con_list, l, url_con) + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username); + if (res != CURLE_OK) { - if (!url_con->fd_handler && url_con->fd != -1) - { - url_con->fd_handler = - ecore_main_fd_handler_add(url_con->fd, url_con->flags, - _ecore_con_url_fd_handler, - NULL, NULL, NULL); - activated++; - } + ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res)); + return EINA_FALSE; + } + return EINA_TRUE; +#else + return EINA_FALSE; + (void)url_con; + (void)username; +#endif +} + +EAPI Eina_Bool +ecore_con_url_proxy_password_set(Ecore_Con_Url *url_con, const char *password) +{ +#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_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 (!password) return EINA_FALSE; + if (url_con->proxy_type == CURLPROXY_SOCKS4 || url_con->proxy_type == CURLPROXY_SOCKS4A) + { + ERR("Proxy type should be socks5 and above"); + return EINA_FALSE; + } + + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password); + if (res != CURLE_OK) + { + ERR("curl_easy_setopt() failed: %s", curl_easy_strerror(res)); + return EINA_FALSE; } + return EINA_TRUE; +#else + return EINA_FALSE; + (void)url_con; + (void)password; +#endif +} + +/** + * @} + */ - return activated; +#ifdef HAVE_CURL +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)); + _url_con_list = eina_list_remove(_url_con_list, url_con); + + curl_slist_free_all(url_con->headers); + url_con->headers = NULL; + + 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); + } + return ECORE_CALLBACK_CANCEL; } static size_t @@ -1235,8 +1305,7 @@ _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); + ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, _ecore_con_event_url_free, NULL); } } else @@ -1266,22 +1335,6 @@ _ecore_con_url_data_cb(void *buffer, return real_size; } -#define ECORE_CON_URL_TRANSMISSION(Transmit, Event, Url_con, Total, Now) \ - { \ - Ecore_Con_Event_Url_Progress *e; \ - if ((Total != 0) || (Now != 0)) \ - { \ - e = calloc(1, sizeof(Ecore_Con_Event_Url_Progress)); \ - if (e) \ - { \ - e->url_con = url_con; \ - e->total = Total; \ - e->now = Now; \ - ecore_event_add(Event, e, _ecore_con_event_url_free, NULL); \ - } \ - } \ - } - static size_t _ecore_con_url_header_cb(void *ptr, size_t size, @@ -1324,8 +1377,7 @@ _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); + ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, _ecore_con_event_url_free, NULL); } return 0; @@ -1358,208 +1410,196 @@ _ecore_con_url_read_cb(void *ptr, return retcode; } -static Eina_Bool -_ecore_con_url_perform(Ecore_Con_Url *url_con) +static void +_ecore_con_url_info_read(void) { - fd_set read_set, write_set, exc_set; - int fd_max, fd; - int flags, still_running; - int completed_immediately = 0; - CURLMcode ret; - - _url_con_list = eina_list_append(_url_con_list, url_con); - - url_con->active = EINA_TRUE; - curl_multi_add_handle(_curlm, url_con->curl_easy); - curl_multi_perform(_curlm, &still_running); - - completed_immediately = _ecore_con_url_process_completed_jobs(url_con); + CURLMsg *curlmsg; + int n_remaining; - if (!completed_immediately) + while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining))) { - if (url_con->fd_handler) - ecore_main_fd_handler_del(url_con->fd_handler); - - url_con->fd_handler = NULL; - - /* url_con still active -- set up an fd_handler */ - FD_ZERO(&read_set); - FD_ZERO(&write_set); - FD_ZERO(&exc_set); - - /* Stupid curl, why can't I get the fd to the current added job? */ - ret = curl_multi_fdset(_curlm, &read_set, &write_set, &exc_set, - &fd_max); - if (ret != CURLM_OK) + if (curlmsg->msg == CURLMSG_DONE) { - ERR("curl_multi_fdset failed: %s", curl_multi_strerror(ret)); - return EINA_FALSE; - } + Eina_List *l, *ll; + Ecore_Con_Url *url_con; - for (fd = 0; fd <= fd_max; fd++) - { - if (!FD_ISSET(fd, &_current_fd_set)) + EINA_LIST_FOREACH_SAFE(_url_con_list, l, ll, url_con) { - flags = 0; - if (FD_ISSET(fd, &read_set)) - flags |= ECORE_FD_READ; - - if (FD_ISSET(fd, &write_set)) - flags |= ECORE_FD_WRITE; + if (curlmsg->easy_handle == url_con->curl_easy) + { + CURLMcode ret; + Ecore_Con_Event_Url_Complete *e; - if (FD_ISSET(fd, &exc_set)) - flags |= ECORE_FD_ERROR; + 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); + } - if (flags) - { - long ms = 0; - - ret = curl_multi_timeout(_curlm, &ms); - if (ret != CURLM_OK) - ERR("curl_multi_timeout failed: %s", - curl_multi_strerror(ret)); - - if (ms == 0) - ms = 1000; - - FD_SET(fd, &_current_fd_set); - url_con->fd = fd; - url_con->flags = flags; - url_con->fd_handler = - ecore_main_fd_handler_add(fd, flags, - _ecore_con_url_fd_handler, - NULL, NULL, 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; } } } - if (!url_con->fd_handler) - { - /* Failed to set up an fd_handler */ - ecore_timer_freeze(_curl_timeout); - - 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->active = EINA_FALSE; - url_con->fd = -1; - return EINA_FALSE; - } - - ecore_timer_thaw(_curl_timeout); } - - return EINA_TRUE; } -static Eina_Bool -_ecore_con_url_idler_handler(void *data) +static void +_ecore_con_url_curl_clear(void) { - int done, still_running; - - done = (curl_multi_perform(_curlm, &still_running) != CURLM_CALL_MULTI_PERFORM); - - _ecore_con_url_process_completed_jobs(NULL); + Ecore_Con_Url *url_con; - if (done) + FD_ZERO(&_current_fd_set); + if (_fd_hd_list) { - _ecore_con_url_restart_fd_handler(); - _fd_idler_handler = NULL; + 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); + } + } - if (!_url_con_list) - ecore_timer_freeze(_curl_timeout); + EINA_LIST_FREE(_url_con_list, url_con) + { + CURLMcode ret; + Ecore_Con_Event_Url_Complete *e; - return data == - (void *)0xACE ? ECORE_CALLBACK_RENEW : ECORE_CALLBACK_CANCEL; + 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)); } - - return ECORE_CALLBACK_RENEW; } static Eina_Bool -_ecore_con_url_fd_handler(void *data __UNUSED__, - Ecore_Fd_Handler *fd_handler __UNUSED__) +_ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) { - _ecore_con_url_suspend_fd_handler(); - - if (!_fd_idler_handler) - _fd_idler_handler = ecore_idler_add( - _ecore_con_url_idler_handler, NULL); - + 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; } -static int -_ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match) +static void +_ecore_con_url_fdset(void) { - Eina_List *l; - Ecore_Con_Url *url_con; - Ecore_Con_Event_Url_Complete *e; - CURLMsg *curlmsg; CURLMcode ret; - int n_remaining; - int job_matched = 0; + fd_set read_set, write_set, exc_set; + int fd, fd_max; + Ecore_Fd_Handler *fd_handler; - /* Loop jobs and check if any are done */ - while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining))) + FD_ZERO(&read_set); + FD_ZERO(&write_set); + FD_ZERO(&exc_set); + + ret = curl_multi_fdset(_curlm, &read_set, &write_set, &exc_set, &fd_max); + if (ret != CURLM_OK) { - if (curlmsg->msg != CURLMSG_DONE) - continue; + ERR("curl_multi_fdset failed: %s", curl_multi_strerror(ret)); + return; + } - /* find the job which is done */ - EINA_LIST_FOREACH(_url_con_list, l, url_con) + for (fd = 0; fd <= fd_max; fd++) + { + int flags = 0; + 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 (flags) { - if (curlmsg->easy_handle == url_con->curl_easy) + if (!FD_ISSET(fd, &_current_fd_set)) { - if (url_con_to_match && - (url_con == url_con_to_match)) - job_matched = 1; - - if(url_con->fd != -1) - { - FD_CLR(url_con->fd, &_current_fd_set); - if (url_con->fd_handler) - ecore_main_fd_handler_del( - url_con->fd_handler); + 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); + } + } + } +} - url_con->fd = -1; - url_con->fd_handler = NULL; - } +static Eina_Bool +_ecore_con_url_idler_handler(void *data __UNUSED__) +{ + int still_running; + CURLMcode ret; - _url_con_list = eina_list_remove(_url_con_list, url_con); - url_con->active = EINA_FALSE; - 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 */ + ret = curl_multi_perform(_curlm, &still_running); + if (ret == CURLM_CALL_MULTI_PERFORM) + { + DBG("Call multiperform again"); + 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; + } - status = 0; - curl_easy_getinfo(curlmsg->easy_handle, - CURLINFO_RESPONSE_CODE, - &status); - e->status = status; - } + _ecore_con_url_info_read(); + if (still_running) + { + DBG("multiperform is still_running"); + _ecore_con_url_fdset(); + } + else + { + DBG("multiperform ended"); + _ecore_con_url_curl_clear(); + ecore_timer_freeze(_curl_timeout); + } - _url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e); - } + return ECORE_CALLBACK_RENEW; +} - 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)); +static Eina_Bool +_ecore_con_url_perform(Ecore_Con_Url *url_con) +{ + CURLMcode ret; - break; - } - } + ret = curl_multi_add_handle(_curlm, url_con->curl_easy); + if (ret != CURLM_OK) + { + ERR("curl_multi_add_handle() failed: %s", curl_multi_strerror(ret)); + return EINA_FALSE; } - return job_matched; + _url_con_list = eina_list_append(_url_con_list, url_con); + ecore_timer_thaw(_curl_timeout); + + return EINA_TRUE; } static void diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.in b/libraries/ecore/src/lib/ecore_config/Makefile.in index 1732a34..6870d44 100644 --- a/libraries/ecore/src/lib/ecore_config/Makefile.in +++ b/libraries/ecore/src/lib/ecore_config/Makefile.in @@ -260,10 +260,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -282,6 +282,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -395,6 +399,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -407,6 +413,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -451,12 +459,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_directfb/Makefile.in b/libraries/ecore/src/lib/ecore_directfb/Makefile.in index 51d113f..b7e1d29 100644 --- a/libraries/ecore/src/lib/ecore_directfb/Makefile.in +++ b/libraries/ecore/src/lib/ecore_directfb/Makefile.in @@ -245,10 +245,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -267,6 +267,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -380,6 +384,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -392,6 +398,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -436,12 +444,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c index f45b3c3..7c56b5d 100644 --- a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c +++ b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c @@ -80,7 +80,7 @@ _ecore_directfb_event_free_key_down(void *data __UNUSED__, void *ev) free(e->key_compose); free(e); -} /* _ecore_directfb_event_free_key_down */ +} static void _ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev) @@ -98,7 +98,7 @@ _ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev) free(e->key_compose); free(e); -} /* _ecore_directfb_event_free_key_up */ +} /* directfb window input events handler */ /****************************************/ @@ -131,7 +131,7 @@ _ecore_directfb_event_handle_motion(DFBEvent *evt) default: return; - } /* switch */ + } e->win = _ecore_directfb_fullscreen_window_id; e->time = 0; break; @@ -146,9 +146,9 @@ _ecore_directfb_event_handle_motion(DFBEvent *evt) default: break; - } /* switch */ + } ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL); -} /* _ecore_directfb_event_handle_motion */ +} static void _ecore_directfb_event_handle_key_down(DFBEvent *evt) @@ -197,10 +197,10 @@ _ecore_directfb_event_handle_key_down(DFBEvent *evt) default: break; - } /* switch */ + } ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL); -} /* _ecore_directfb_event_handle_key_down */ +} static void _ecore_directfb_event_handle_key_up(DFBEvent *evt) @@ -249,9 +249,9 @@ _ecore_directfb_event_handle_key_up(DFBEvent *evt) default: break; - } /* switch */ + } ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL); -} /* _ecore_directfb_event_handle_key_up */ +} static void _ecore_directfb_event_handle_button_down(DFBEvent *evt) @@ -283,10 +283,10 @@ _ecore_directfb_event_handle_button_down(DFBEvent *evt) default: break; - } /* switch */ + } ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL); -} /* _ecore_directfb_event_handle_button_down */ +} static void _ecore_directfb_event_handle_button_up(DFBEvent *evt) @@ -317,9 +317,9 @@ _ecore_directfb_event_handle_button_up(DFBEvent *evt) default: break; - } /* switch */ + } ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL); -} /* _ecore_directfb_event_handle_button_up */ +} static void _ecore_directfb_event_handle_enter(DFBWindowEvent *evt) @@ -334,7 +334,7 @@ _ecore_directfb_event_handle_enter(DFBWindowEvent *evt) e->time = 0; ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL); -} /* _ecore_directfb_event_handle_enter */ +} static void _ecore_directfb_event_handle_leave(DFBWindowEvent *evt) @@ -349,7 +349,7 @@ _ecore_directfb_event_handle_leave(DFBWindowEvent *evt) e->time = 0; ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL); -} /* _ecore_directfb_event_handle_leave */ +} static void _ecore_directfb_event_handle_wheel(DFBWindowEvent *evt) @@ -365,7 +365,7 @@ _ecore_directfb_event_handle_wheel(DFBWindowEvent *evt) e->time = 0; ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL); -} /* _ecore_directfb_event_handle_wheel */ +} static void _ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt) @@ -377,7 +377,7 @@ _ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt) e->time = 0; ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL); -} /* _ecore_directfb_event_handle_got_focus */ +} static void _ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt) @@ -389,7 +389,7 @@ _ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt) e->time = 0; ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL); -} /* _ecore_directfb_event_handle_lost_focus */ +} /* inputs and windows fds handlers */ /***********************************/ @@ -428,7 +428,7 @@ _ecore_directfb_input_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *f _ecore_directfb_event_handle_motion(&evt); return EINA_TRUE; -} /* _ecore_directfb_input_event_fd_handler */ +} static Eina_Bool _ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__) @@ -486,7 +486,7 @@ _ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler * _ecore_directfb_event_handle_wheel(&evt.window); return EINA_TRUE; -} /* _ecore_directfb_window_event_fd_handler */ +} /* api functions */ /*****************/ @@ -495,7 +495,7 @@ EAPI IDirectFB * ecore_directfb_interface_get(void) { return _dfb; -} /* ecore_directfb_interface_get */ +} EAPI Ecore_DirectFB_Window * ecore_directfb_window_new(int x, int y, int w, int h) @@ -530,7 +530,7 @@ ecore_directfb_window_new(int x, int y, int w, int h) window->cursor = NULL; return window; -} /* ecore_directfb_window_new */ +} EAPI void ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window) @@ -538,37 +538,37 @@ ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window) DFBCHECK(ecore_window->surface->Release(ecore_window->surface)); DFBCHECK(ecore_window->window->Release(ecore_window->window)); free(ecore_window); -} /* ecore_directfb_window_free */ +} EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y) { DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y)); -} /* ecore_directfb_window_move */ +} EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h) { DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h)); -} /* ecore_directfb_window_resize */ +} EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window) { DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window)); -} /* ecore_directfb_window_focus */ +} EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window) { DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0)); -} /* ecore_directfb_window_hide */ +} EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window) { DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF)); -} /* ecore_directfb_window_show */ +} EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool set) @@ -588,7 +588,7 @@ ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool opts &= ~DWOP_ALPHACHANNEL; DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts)); } -} /* ecore_directfb_window_shaped_set */ +} EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool show) @@ -622,7 +622,7 @@ ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0)); } } -} /* ecore_directfb_window_cursor_show */ +} EAPI void ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor) @@ -639,7 +639,7 @@ ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_Dire ecore_window->cursor = cursor; DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y)); } -} /* ecore_directfb_window_cursor_set */ +} EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool on) @@ -666,14 +666,14 @@ ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_B DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface)); _ecore_directfb_fullscreen_window_id = 0; } -} /* ecore_directfb_window_fullscreen_set */ +} EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h) { DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h)); return; -} /* ecore_directfb_window_size_get */ +} EAPI int ecore_directfb_init(const char *name __UNUSED__) @@ -730,7 +730,7 @@ ecore_directfb_init(const char *name __UNUSED__) } /* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */ return _ecore_directfb_init_count; -} /* ecore_directfb_init */ +} EAPI int ecore_directfb_shutdown(void) @@ -753,5 +753,5 @@ ecore_directfb_shutdown(void) eina_log_domain_unregister(_ecore_directfb_log_dom); _ecore_directfb_log_dom = -1; return _ecore_directfb_init_count; -} /* ecore_directfb_shutdown */ +} diff --git a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h index 256e57c..8d9abc4 100644 --- a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h +++ b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h @@ -81,6 +81,8 @@ extern "C" { #define HAVE_ECORE_EVAS_WINCE 1 #define HAVE_ECORE_EVAS_EWS 1 #define HAVE_ECORE_EVAS_PSL1GHT 1 +#define HAVE_ECORE_EVAS_WAYLAND_SHM 1 +#define HAVE_ECORE_EVAS_WAYLAND_EGL 1 typedef enum _Ecore_Evas_Engine_Type { @@ -104,7 +106,9 @@ typedef enum _Ecore_Evas_Engine_Type ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, ECORE_EVAS_ENGINE_OPENGL_SDL, ECORE_EVAS_ENGINE_EWS, - ECORE_EVAS_ENGINE_PSL1GHT + ECORE_EVAS_ENGINE_PSL1GHT, + ECORE_EVAS_ENGINE_WAYLAND_SHM, + ECORE_EVAS_ENGINE_WAYLAND_EGL } Ecore_Evas_Engine_Type; typedef enum _Ecore_Evas_Avoid_Damage_Type @@ -689,6 +693,11 @@ 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 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); + /** * @brief Create a new @c Ecore_Evas canvas bound to the Evas * @b buffer engine @@ -818,7 +827,7 @@ EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); /** * @brief Create an Evas image object with image data bound to an - * own, internal @c Ecore_Evas canvas wrapper + * own, internal @c Ecore_Evas canvas wrapper * * @param ee_target @c Ecore_Evas to have the canvas receiving the new * image object @@ -1320,7 +1329,7 @@ EAPI void ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h); * @param h The step height * * This function sets the size steps of @p ee to be @p w x @p h. This - * limits the size of this @cEcore_Evas window to be @b always an + * limits the size of this @c Ecore_Evas window to be @b always an * integer multiple of the step size, for each axis. */ EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); @@ -1450,6 +1459,9 @@ EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee); */ EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); +EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame); +EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee); + /** * @brief Associate the given object to this ecore evas. * @@ -1625,29 +1637,238 @@ EAPI void ecore_evas_ews_manager_set(const void *manager); */ EAPI const void *ecore_evas_ews_manager_get(void); -EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed */ -EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created */ -EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. */ -EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized */ -EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved */ -EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible */ -EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden */ -EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused */ -EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus */ -EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised */ -EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered */ -EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated */ - -EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed */ -EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed */ -EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed */ -EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed */ -EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) */ +EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated @since 1.1 */ + +EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed @since 1.1 */ +EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) @since 1.1 */ /** * @} */ +/** + * @defgroup Ecore_Evas_Extn External plug/socket infrastructure to remote canvases + * + * These functions allow 1 process to create a "socket" was pluged into which another + * process can create a "plug" remotely to plug into. + * Socket can provides content for several plugs. + * This is best for small sized objects (about the size range + * of a small icon up to a few large icons). Sine the plug is actually an + * image object, you can fetch the pixel data + * + * @since 1.2 + * @{ + */ + +EAPI extern int ECORE_EVAS_EXTN_CLIENT_ADD; /**< this event is received when a plug has connected to an extn socket @since 1.2 */ +EAPI extern int ECORE_EVAS_EXTN_CLIENT_DEL; /**< this event is received when a plug has disconnected from an extn socket @since 1.2 */ + +/** + * @brief Create a new Ecore_Evas canvas for the new external ecore evas socket + * + * @param w The width of the canvas, in pixels + * @param h The height of the canvas, in pixels + * @return A new @c Ecore_Evas instance or @c NULL, on failure + * + * This creates a new extn_socket canvas wrapper, with image data array + * @b bound to the ARGB format, 8 bits per pixel. + * + * If creation is successful, an Ecore_Evas handle is returned or NULL if creation + * fails. Also focus, show, hide etc. callbacks + * will also be called if the plug object is shown, or already visible on + * connect, or if it is hidden later, focused or unfocused. + * + * This function has to be flowed by ecore_evas_extn_socket_listen(), + * for starting ecore ipc service. + * + * @code + * Eina_Bool res = EINA_FALSE; + * Ecore_Evas *ee = ecore_evas_extn_socket_new(1, 1); + * + * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE); + * if (!res) return; + * ecore_evas_resize(ee, 240, 400); + * @endcode + * + * or + * + * @code + * Eina_Bool res = EINA_FALSE; + * Ecore_Evas *ee = ecore_evas_extn_socket_new(240, 400); + * + * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE); + * if (!res) return; + * @endcode + * + * When a client(plug) connects, you will get the ECORE_EVAS_EXTN_CLIENT_ADD event + * in the ecore event queue, with event_info being the image object pointer + * passed as a void pointer. When a client disconnects you will get the + * ECORE_EVAS_EXTN_CLIENT_DEL event. + * + * You can set up event handles for these events as follows: + * + * @code + * static void client_add_cb(void *data, int event, void *event_info) + * { + * Evas_Object *obj = event_info; + * printf("client added to image object %p\n", obj); + * evas_object_show(obj); + * } + * + * static void client_del_cb(void *data, int event, void *event_info) + * { + * Evas_Object *obj = event_info; + * printf("client deleted from image object %p\n", obj); + * evas_object_hide(obj); + * } + * + * void setup(void) + * { + * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_ADD, + * client_add_cb, NULL); + * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_DEL, + * client_del_cb, NULL); + * } + * @endcode + * + * Note that events come in later after the event happened. You may want to be + * careful as data structures you had associated with the image object + * may have been freed after deleting, but the object may still be around + * awating cleanup and thus still be valid.You can change the size with something like: + * + * @see ecore_evas_extn_socket_listen() + * @see ecore_evas_extn_plug_new() + * @see ecore_evas_extn_plug_object_data_lock() + * @see ecore_evas_extn_plug_object_data_unlock() + * + * @since 1.2 + */ +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 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. + * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not. + * + * This creates socket specified by @p svcname, @p svcnum and @p svcsys. If creation + * is successful, EINA_TRUE is returned or EINA_FALSE if creation + * fails. + * + * @see ecore_evas_extn_socket_new() + * @see ecore_evas_extn_plug_new() + * @see ecore_evas_extn_plug_object_data_lock() + * @see ecore_evas_extn_plug_object_data_unlock() + * + * @since 1.2 + */ +EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys); + +/** + * @brief Lock the pixel data so the socket cannot change it + * + * @param obj The image object returned by ecore_evas_extn_plug_new() to lock + * + * You may need to get the image pixel data with evas_object_image_data_get() + * from the image object, but need to ensure that it does not change while + * you are using the data. This function lets you set an advisory lock on the + * 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 + * 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 + * odd behavior. + * + * @see ecore_evas_extn_plug_new() + * @see ecore_evas_extn_plug_object_data_unlock() + * + * @since 1.2 + */ +EAPI void ecore_evas_extn_plug_object_data_lock(Evas_Object *obj); + +/** + * @brief Unlock the pixel data so the socket can change it again. + * + * @param obj The image object returned by ecore_evas_extn_plug_new() to unlock + * + * This unlocks after an advisor lock has been taken by + * ecore_evas_extn_plug_object_data_lock(). + * + * @see ecore_evas_extn_plug_new() + * @see ecore_evas_extn_plug_object_data_lock() + * + * @since 1.2 + */ +EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj); + +/** + * @brief Create a new external ecore evas plug + * + * @param ee_target The Ecore_Evas containing the canvas in which the new image object will live. + * @return An evas image object that will contain the image output of a socket. + * + * This creates an image object that will contain the output of another + * processes socket canvas when it connects. All input will be sent back to + * this process as well, effectively swallowing or placing the socket process + * 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 + * of the plug is the master size and determines size in pixels of the + * plug canvas. You can change the size with something like: + * + * @code + * Eina_Bool res = EINA_FALSE; + * Evas_Object *obj = ecore_evas_extn_plug_new(ee); + * + * res = ecore_evas_extn_plug_connect("svcname", 1, EINA_FALSE); + * if (!res) return; + * ecore_evas_resize(ee, 240, 400); + * @endcode + * + * @see ecore_evas_extn_socket_new() + * @see ecore_evas_extn_plug_connect() + * @since 1.2 + */ +EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target); + +/** + * @brief Connect a external ecore evas plug to service provided by external ecore evas socket + * + * @param obj The Ecore_Evas containing the canvas in which the new image object will live. + * @param svcname The service name to connect to set up by the socket. + * @param svcnum The service number to connect to (set up by socket). + * @param svcsys Booleain to set if the service is a system one or not (set up by socket). + * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not. + * + * + * @see ecore_evas_extn_plug_new() + * + * @since 1.2 + */ +EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys); + +/** + * @} + */ /** * @} diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am index fbb7190..a1d9215 100644 --- a/libraries/ecore/src/lib/ecore_evas/Makefile.am +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.am @@ -1,8 +1,8 @@ MAINTAINERCLEANFILES = Makefile.in if BUILD_ECORE_X -ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ -ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ +ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ +ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ else ECORE_X_INC = ECORE_X_LIB = @@ -66,6 +66,24 @@ ECORE_PSL1GHT_INC = ECORE_PSL1GHT_LIB = endif +if BUILD_ECORE_WAYLAND +ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@ +ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la +ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB) +else +ECORE_WAYLAND_INC = +ECORE_WAYLAND_LIB = +ECORE_WAYLAND_LIBADD = +endif + +if BUILD_ECORE_IPC +ECORE_IPC_INC= \ +-I$(top_srcdir)/src/lib/ecore_ipc \ +-I$(top_builddir)/src/lib/ecore_ipc + +ECORE_IPC_LIB=$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la +endif + AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_evas \ @@ -84,9 +102,12 @@ $(ECORE_SDL_INC) \ $(ECORE_COCOA_INC) \ $(ECORE_WINCE_INC) \ $(ECORE_PSL1GHT_INC) \ +$(ECORE_WAYLAND_INC) \ +$(ECORE_IPC_INC) \ @EVAS_CFLAGS@ \ @EINA_CFLAGS@ \ -@EVIL_CFLAGS@ +@EVIL_CFLAGS@ \ +@WAYLAND_EGL_CFLAGS@ AM_CFLAGS = @WIN32_CFLAGS@ @@ -106,7 +127,10 @@ ecore_evas_sdl.c \ ecore_evas_cocoa.c \ ecore_evas_wince.c \ ecore_evas_ews.c \ -ecore_evas_psl1ght.c +ecore_evas_psl1ght.c \ +ecore_evas_wayland_shm.c \ +ecore_evas_wayland_egl.c \ +ecore_evas_extn.c libecore_evas_la_LIBADD = \ $(ECORE_X_LIB) \ @@ -117,13 +141,17 @@ $(ECORE_SDL_LIB) \ $(ECORE_SDL_LIBADD) \ $(ECORE_COCOA_LIB) \ $(ECORE_WINCE_LIB) \ +$(ECORE_IPC_LIB) \ $(ECORE_PSL1GHT_LIB) \ +$(ECORE_WAYLAND_LIB) \ +$(ECORE_WAYLAND_LIBADD) \ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ $(top_builddir)/src/lib/ecore/libecore.la \ @EVAS_LIBS@ \ @EINA_LIBS@ \ -@EVIL_LIBS@ +@EVIL_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 793e59d..a269b75 100644 --- a/libraries/ecore/src/lib/ecore_evas/Makefile.in +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.in @@ -95,11 +95,15 @@ LTLIBRARIES = $(lib_LTLIBRARIES) @BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la @BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la @BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la +@BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_10 = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la +@BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_11 = \ +@BUILD_ECORE_WAYLAND_TRUE@ $(am__DEPENDENCIES_10) libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \ - $(am__DEPENDENCIES_8) $(am__DEPENDENCIES_9) \ + $(am__DEPENDENCIES_8) $(ECORE_IPC_LIB) $(am__DEPENDENCIES_9) \ + $(am__DEPENDENCIES_10) $(am__DEPENDENCIES_11) \ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ $(top_builddir)/src/lib/ecore/libecore.la @@ -107,7 +111,8 @@ am_libecore_evas_la_OBJECTS = ecore_evas.lo ecore_evas_util.lo \ ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \ ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \ ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \ - ecore_evas_psl1ght.lo + ecore_evas_psl1ght.lo ecore_evas_wayland_shm.lo \ + ecore_evas_wayland_egl.lo ecore_evas_extn.lo libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -266,10 +271,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -288,6 +293,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -401,6 +410,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -413,6 +424,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -457,12 +470,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ @@ -481,9 +496,9 @@ x_includes = @x_includes@ x_libs = @x_libs@ MAINTAINERCLEANFILES = Makefile.in @BUILD_ECORE_X_FALSE@ECORE_X_INC = -@BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ +@BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @BUILD_ECORE_X_FALSE@ECORE_X_LIB = -@BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ +@BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @BUILD_ECORE_FB_FALSE@ECORE_FB_INC = @BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb @BUILD_ECORE_FB_FALSE@ECORE_FB_LIB = @@ -514,6 +529,17 @@ MAINTAINERCLEANFILES = Makefile.in @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB = @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la +@BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_INC = +@BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@ +@BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIB = +@BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la +@BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIBADD = +@BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB) +@BUILD_ECORE_IPC_TRUE@ECORE_IPC_INC = \ +@BUILD_ECORE_IPC_TRUE@-I$(top_srcdir)/src/lib/ecore_ipc \ +@BUILD_ECORE_IPC_TRUE@-I$(top_builddir)/src/lib/ecore_ipc + +@BUILD_ECORE_IPC_TRUE@ECORE_IPC_LIB = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_evas \ @@ -532,9 +558,12 @@ $(ECORE_SDL_INC) \ $(ECORE_COCOA_INC) \ $(ECORE_WINCE_INC) \ $(ECORE_PSL1GHT_INC) \ +$(ECORE_WAYLAND_INC) \ +$(ECORE_IPC_INC) \ @EVAS_CFLAGS@ \ @EINA_CFLAGS@ \ -@EVIL_CFLAGS@ +@EVIL_CFLAGS@ \ +@WAYLAND_EGL_CFLAGS@ AM_CFLAGS = @WIN32_CFLAGS@ lib_LTLIBRARIES = libecore_evas.la @@ -552,7 +581,10 @@ ecore_evas_sdl.c \ ecore_evas_cocoa.c \ ecore_evas_wince.c \ ecore_evas_ews.c \ -ecore_evas_psl1ght.c +ecore_evas_psl1ght.c \ +ecore_evas_wayland_shm.c \ +ecore_evas_wayland_egl.c \ +ecore_evas_extn.c libecore_evas_la_LIBADD = \ $(ECORE_X_LIB) \ @@ -563,13 +595,17 @@ $(ECORE_SDL_LIB) \ $(ECORE_SDL_LIBADD) \ $(ECORE_COCOA_LIB) \ $(ECORE_WINCE_LIB) \ +$(ECORE_IPC_LIB) \ $(ECORE_PSL1GHT_LIB) \ +$(ECORE_WAYLAND_LIB) \ +$(ECORE_WAYLAND_LIBADD) \ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ $(top_builddir)/src/lib/ecore/libecore.la \ @EVAS_LIBS@ \ @EINA_LIBS@ \ -@EVIL_LIBS@ +@EVIL_LIBS@ \ +@WAYLAND_EGL_LIBS@ libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ EXTRA_DIST = \ @@ -654,10 +690,13 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_extn.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_egl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_shm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@ diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c index dc42f92..2b04488 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c @@ -2,14 +2,21 @@ # include #endif +#include #include #include #include +#include +#include #ifndef _MSC_VER # include #endif +#ifdef HAVE_SYS_MMAN_H +# include +#endif + #ifdef HAVE_EVIL # include #endif @@ -194,6 +201,18 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) #else return EINA_FALSE; #endif + case ECORE_EVAS_ENGINE_WAYLAND_SHM: +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_WAYLAND_EGL: +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL + return EINA_TRUE; +#else + return EINA_FALSE; +#endif default: return EINA_FALSE; }; @@ -237,6 +256,8 @@ ecore_evas_init(void) _ecore_evas_ews_events_init(); #endif + _ecore_evas_extn_init(); + if (getenv("ECORE_EVAS_COMP_NOSYNC")) _ecore_evas_app_comp_sync = 0; return _ecore_evas_init_count; @@ -257,6 +278,8 @@ ecore_evas_shutdown(void) while (ecore_evases) _ecore_evas_free(ecore_evases); + _ecore_evas_extn_shutdown(); + if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); ecore_idle_enterer_del(ecore_evas_idle_enterer); ecore_evas_idle_enterer = NULL; @@ -282,6 +305,7 @@ ecore_evas_shutdown(void) #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE while (_ecore_evas_wince_shutdown()); #endif + if (_ecore_evas_async_events_fd) ecore_main_fd_handler_del(_ecore_evas_async_events_fd); @@ -577,6 +601,40 @@ _ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h } #endif +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM +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; + 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); + free(disp_name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL +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; + 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); + free(disp_name); + + return ee; +} +#endif + #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI static Ecore_Evas * _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) @@ -714,7 +772,16 @@ static const struct ecore_evas_engine _engines[] = { {"psl1ght", _ecore_evas_constructor_psl1ght}, #endif - /* Last chance to have a window */ + /* Wayland */ +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM + {"wayland_shm", _ecore_evas_constructor_wayland_shm}, +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL + {"wayland_egl", _ecore_evas_constructor_wayland_egl}, +#endif + + /* Last chance to have a window */ #ifdef BUILD_ECORE_EVAS_OPENGL_SDL {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, #endif @@ -1938,7 +2005,7 @@ ecore_evas_fullscreen_get(const Ecore_Evas *ee) * Set whether or not an Ecore_Evas' window should avoid damage * * @param ee The Ecore_Evas - * @param The type of the damage management + * @param on The type of the damage management * * This function causes @p ee to be drawn to a pixmap to avoid recalculations. * On expose events it will copy from the pixmap to the window. @@ -2008,8 +2075,8 @@ ecore_evas_withdrawn_get(const Ecore_Evas *ee) ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_withdrawn_get"); return EINA_FALSE; - } else - return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; + } + return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; } /** @@ -2048,8 +2115,8 @@ ecore_evas_sticky_get(const Ecore_Evas *ee) ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_sticky_get"); return EINA_FALSE; - } else - return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; + } + return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; } EAPI void @@ -2170,6 +2237,28 @@ ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int IFE; } +EAPI void +ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set"); + return; + } + ee->prop.draw_frame = draw_frame; +} + +EAPI Eina_Bool +ecore_evas_draw_frame_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get"); + return EINA_FALSE; + } + return ee->prop.draw_frame; +} + /* fps debug calls - for debugging how much time your app actually spends */ /* rendering graphics... :) */ @@ -2586,3 +2675,55 @@ ecore_evas_input_event_unregister(Ecore_Evas *ee) { ecore_event_window_unregister((Ecore_Window)ee); } + +#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL) +EAPI void +ecore_evas_wayland_resize(Ecore_Evas *ee, int location) +{ + if (!ee) return; + if (!strcmp(ee->driver, "wayland_shm")) + { +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM + _ecore_evas_wayland_shm_resize(ee, location); +#endif + } + else if (!strcmp(ee->driver, "wayland_egl")) + { +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL + _ecore_evas_wayland_egl_resize(ee, location); +#endif + } +} + +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 a3e49d6..3f82efb 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c @@ -3,6 +3,7 @@ #endif // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! +#include #include #include "ecore_private.h" @@ -93,6 +94,12 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h) if (ee->func.fn_resize) ee->func.fn_resize(ee); } +static void +_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) +{ + _ecore_evas_resize(ee, w, h); +} + int _ecore_evas_buffer_shutdown(void) { @@ -168,6 +175,14 @@ _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) if (fw < 1) fw = 1; if (fh < 1) fh = 1; + if (evas_object_map_get(ee->engine.buffer.image) && + evas_object_map_enable_get(ee->engine.buffer.image)) + { + fx = 0; fy = 0; + fw = ee->w; fh = ee->h; + ww = ee->w; hh = ee->h; + } + if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) { *x = (ee->w * (*x - xx)) / fw; @@ -188,51 +203,80 @@ _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) } static void -_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_ecore_evas_buffer_transfer_modifiers_locks(Evas *e, Evas *e2) +{ + const char *mods[] = + { "Shift", "Control", "Alt", "Meta", "Hyper", "Super", NULL }; + const char *locks[] = + { "Scroll_Lock", "Num_Lock", "Caps_Lock", NULL }; + int i; + + for (i = 0; mods[i]; i++) + { + if (evas_key_modifier_is_set(evas_key_modifier_get(e), mods[i])) + evas_key_modifier_on(e2, mods[i]); + else + evas_key_modifier_off(e2, mods[i]); + } + for (i = 0; locks[i]; i++) + { + if (evas_key_lock_is_set(evas_key_lock_get(e), locks[i])) + evas_key_lock_on(e2, locks[i]); + else + evas_key_lock_off(e2, locks[i]); + } +} + +static void +_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Ecore_Evas *ee; Evas_Event_Mouse_In *ev; ee = data; ev = event_info; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Ecore_Evas *ee; Evas_Event_Mouse_Out *ev; ee = data; ev = event_info; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Mouse_Down *ev; ee = data; ev = event_info; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Mouse_Up *ev; ee = data; ev = event_info; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Mouse_Move *ev; @@ -243,22 +287,24 @@ _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *ob x = ev->cur.canvas.x; y = ev->cur.canvas.y; _ecore_evas_buffer_coord_translate(ee, &x, &y); + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); } static void -_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Mouse_Wheel *ev; ee = data; ev = event_info; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_multi_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Multi_Down *ev; @@ -274,11 +320,12 @@ _ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *ob _ecore_evas_buffer_coord_translate(ee, &x, &y); xf = (ev->canvas.xsub - (double)xx) + (double)x; yf = (ev->canvas.ysub - (double)yy) + (double)y; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_multi_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Multi_Up *ev; @@ -294,11 +341,12 @@ _ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj _ecore_evas_buffer_coord_translate(ee, &x, &y); xf = (ev->canvas.xsub - (double)xx) + (double)x; yf = (ev->canvas.ysub - (double)yy) + (double)y; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); } static void -_ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_ecore_evas_buffer_cb_multi_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee; Evas_Event_Multi_Move *ev; @@ -314,6 +362,7 @@ _ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *ob _ecore_evas_buffer_coord_translate(ee, &x, &y); xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); } @@ -334,42 +383,7 @@ _ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, ee = data; ev = event_info; - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) - evas_key_modifier_on(ee->evas, "Shift"); - else - evas_key_modifier_off(ee->evas, "Shift"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) - evas_key_modifier_on(ee->evas, "Control"); - else - evas_key_modifier_off(ee->evas, "Control"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) - evas_key_modifier_on(ee->evas, "Alt"); - else - evas_key_modifier_off(ee->evas, "Alt"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) - evas_key_modifier_on(ee->evas, "Meta"); - else - evas_key_modifier_off(ee->evas, "Meta"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) - evas_key_modifier_on(ee->evas, "Hyper"); - else - evas_key_modifier_off(ee->evas, "Hyper"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) - evas_key_modifier_on(ee->evas, "Super"); - else - evas_key_modifier_off(ee->evas, "Super"); - if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) - evas_key_lock_on(ee->evas, "Scroll_Lock"); - else - evas_key_lock_off(ee->evas, "Scroll_Lock"); - if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) - evas_key_lock_on(ee->evas, "Num_Lock"); - else - evas_key_lock_off(ee->evas, "Num_Lock"); - if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) - evas_key_lock_on(ee->evas, "Caps_Lock"); - else - evas_key_lock_off(ee->evas, "Caps_Lock"); + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); } @@ -381,42 +395,7 @@ _ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, v ee = data; ev = event_info; - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) - evas_key_modifier_on(ee->evas, "Shift"); - else - evas_key_modifier_off(ee->evas, "Shift"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) - evas_key_modifier_on(ee->evas, "Control"); - else - evas_key_modifier_off(ee->evas, "Control"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) - evas_key_modifier_on(ee->evas, "Alt"); - else - evas_key_modifier_off(ee->evas, "Alt"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) - evas_key_modifier_on(ee->evas, "Meta"); - else - evas_key_modifier_off(ee->evas, "Meta"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) - evas_key_modifier_on(ee->evas, "Hyper"); - else - evas_key_modifier_off(ee->evas, "Hyper"); - if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) - evas_key_modifier_on(ee->evas, "Super"); - else - evas_key_modifier_off(ee->evas, "Super"); - if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) - evas_key_lock_on(ee->evas, "Scroll_Lock"); - else - evas_key_lock_off(ee->evas, "Scroll_Lock"); - if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) - evas_key_lock_on(ee->evas, "Num_Lock"); - else - evas_key_lock_off(ee->evas, "Num_Lock"); - if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) - evas_key_lock_on(ee->evas, "Caps_Lock"); - else - evas_key_lock_off(ee->evas, "Caps_Lock"); + _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); } @@ -469,6 +448,20 @@ _ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha) ee->alpha = alpha; if (ee->engine.buffer.image) evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha); + else + { + Evas_Engine_Info_Buffer *einfo; + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->alpha) + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + else + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + } + } } static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = @@ -491,7 +484,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = NULL, NULL, _ecore_evas_resize, - NULL, + _ecore_evas_move_resize, NULL, NULL, _ecore_evas_show, @@ -520,7 +513,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = _ecore_evas_buffer_alpha_set, NULL, //transparent - NULL, // render + _ecore_evas_buffer_render, NULL // screen_geometry_get }; #endif @@ -604,7 +597,7 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); if (einfo) { - einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; einfo->info.dest_buffer = ee->engine.buffer.pixels; einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int); einfo->info.use_color_key = 0; @@ -636,7 +629,6 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i evas_event_feed_mouse_in(ee->evas, 0, NULL); - ee->engine.func->fn_render = _ecore_evas_buffer_render; _ecore_evas_register(ee); evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); @@ -818,8 +810,6 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target) ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); - ee->engine.func->fn_render = _ecore_evas_buffer_render; - return o; #else return NULL; 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 1f946d5..36d41f8 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -568,7 +568,7 @@ ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) #else ERR("Cocoa support in ecore-evas not enabled"); return NULL; - parent = NULL; - x = y = w = h = 0; + (void) parent; + (void) x; (void) y; (void) w; (void) h; #endif } 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 e19fb05..eccf98b 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c @@ -2,6 +2,11 @@ # include #endif +#include +#include +#include + +#include #include #include "ecore_private.h" #include diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c new file mode 100644 index 0000000..e46ab4a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c @@ -0,0 +1,2152 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include +#include "ecore_private.h" +#include + +#ifdef BUILD_ECORE_IPC +# ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER +# define EXTN_ENABLED 1 +# endif +#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 + +typedef struct _Shmfile Shmfile; + +struct _Shmfile +{ + int fd; + int size; + void *addr; + const char *file; +}; + +static int blank = 0x00000000; + +static Shmfile * +shmfile_new(const char *base, int id, int size, Eina_Bool sys) +{ + Shmfile *sf; + char file[PATH_MAX]; + + sf = calloc(1, sizeof(Shmfile)); + do + { + mode_t mode; + + snprintf(file, sizeof(file), "/%s-%i-%i.%i.%i", + base, id, (int)time(NULL), (int)getpid(), (int)rand()); + mode = S_IRUSR | S_IWUSR; + if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; + sf->fd = shm_open(file, O_RDWR | O_CREAT | O_EXCL, mode); + } + while (sf->fd < 0); + + sf->file = eina_stringshare_add(file); + if (!sf->file) + { + close(sf->fd); + shm_unlink(sf->file); + eina_stringshare_del(sf->file); + free(sf); + return NULL; + } + sf->size = size; + if (ftruncate(sf->fd, size) < 0) + { + close(sf->fd); + shm_unlink(sf->file); + eina_stringshare_del(sf->file); + free(sf); + return NULL; + } + sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0); + if (sf->addr == MAP_FAILED) + { + close(sf->fd); + shm_unlink(sf->file); + eina_stringshare_del(sf->file); + free(sf); + return NULL; + } + return sf; +} + +void +shmfile_free(Shmfile *sf) +{ + munmap(sf->addr, sf->size); + close(sf->fd); + shm_unlink(sf->file); + eina_stringshare_del(sf->file); + free(sf); +} + +static Shmfile * +shmfile_open(const char *ref, int size, Eina_Bool sys) +{ + Shmfile *sf; + mode_t mode; + + sf = calloc(1, sizeof(Shmfile)); + mode = S_IRUSR | S_IWUSR; + if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; + sf->fd = shm_open(ref, O_RDWR, mode); + if (sf->fd < 0) + { + free(sf); + return NULL; + } + sf->file = eina_stringshare_add(ref); + if (!sf->file) + { + close(sf->fd); + eina_stringshare_del(sf->file); + free(sf); + return NULL; + } + sf->size = size; + sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0); + if (sf->addr == MAP_FAILED) + { + close(sf->fd); + eina_stringshare_del(sf->file); + free(sf); + return NULL; + } + return sf; +} + +void +shmfile_close(Shmfile *sf) +{ + munmap(sf->addr, sf->size); + close(sf->fd); + eina_stringshare_del(sf->file); + free(sf); +} + +// procotol version - change this as needed +#define MAJOR 0x1011 + +enum // opcodes +{ + OP_RESIZE, + OP_SHOW, + OP_HIDE, + OP_FOCUS, + OP_UNFOCUS, + OP_UPDATE, + OP_UPDATE_DONE, + OP_LOCK_FILE, + OP_SHM_REF, + OP_EV_MOUSE_IN, + OP_EV_MOUSE_OUT, + OP_EV_MOUSE_UP, + OP_EV_MOUSE_DOWN, + OP_EV_MOUSE_MOVE, + OP_EV_MOUSE_WHEEL, + OP_EV_MULTI_UP, + OP_EV_MULTI_DOWN, + OP_EV_MULTI_MOVE, + OP_EV_KEY_UP, + OP_EV_KEY_DOWN, + OP_EV_HOLD +}; + +enum +{ + MOD_SHIFT = (1 << 0), + MOD_CTRL = (1 << 1), + MOD_ALT = (1 << 2), + MOD_META = (1 << 3), + MOD_HYPER = (1 << 4), + MOD_SUPER = (1 << 5), + MOD_CAPS = (1 << 6), + MOD_NUM = (1 << 7), + MOD_SCROLL = (1 << 8), +}; + +typedef struct _Ipc_Data_Resize Ipc_Data_Resize; +typedef struct _Ipc_Data_Update Ipc_Data_Update; +typedef struct _Ipc_Data_Ev_Mouse_In Ipc_Data_Ev_Mouse_In; +typedef struct _Ipc_Data_Ev_Mouse_Out Ipc_Data_Ev_Mouse_Out; +typedef struct _Ipc_Data_Ev_Mouse_Up Ipc_Data_Ev_Mouse_Up; +typedef struct _Ipc_Data_Ev_Mouse_Down Ipc_Data_Ev_Mouse_Down; +typedef struct _Ipc_Data_Ev_Mouse_Move Ipc_Data_Ev_Mouse_Move; +typedef struct _Ipc_Data_Ev_Mouse_Wheel Ipc_Data_Ev_Mouse_Wheel; +typedef struct _Ipc_Data_Ev_Hold Ipc_Data_Ev_Hold; +typedef struct _Ipc_Data_Ev_Multi_Up Ipc_Data_Ev_Multi_Up; +typedef struct _Ipc_Data_Ev_Multi_Down Ipc_Data_Ev_Multi_Down; +typedef struct _Ipc_Data_Ev_Multi_Move Ipc_Data_Ev_Multi_Move; +typedef struct _Ipc_Data_Ev_Key_Up Ipc_Data_Ev_Key_Up; +typedef struct _Ipc_Data_Ev_Key_Down Ipc_Data_Ev_Key_Down; + +struct _Ipc_Data_Resize +{ + int w, h; +}; + +struct _Ipc_Data_Update +{ + int x, w, y, h; +}; + +struct _Ipc_Data_Ev_Mouse_In +{ + unsigned int timestamp; + int mask; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Mouse_Out +{ + unsigned int timestamp; + int mask; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Mouse_Up +{ + int b; + Evas_Button_Flags flags; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Mouse_Down +{ + int b; + Evas_Button_Flags flags; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Mouse_Move +{ + int x, y; + Evas_Button_Flags flags; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Mouse_Wheel +{ + int direction, z; + Evas_Button_Flags flags; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Hold +{ + int hold; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Multi_Up +{ + Evas_Button_Flags flags; + int d, x, y; + double rad, radx, rady, pres, ang, fx, fy; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Multi_Down +{ + Evas_Button_Flags flags; + int d, x, y; + double rad, radx, rady, pres, ang, fx, fy; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Multi_Move +{ + int d, x, y; + double rad, radx, rady, pres, ang, fx, fy; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Key_Up +{ + const char *keyname, *key, *string, *compose; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +struct _Ipc_Data_Ev_Key_Down +{ + const char *keyname, *key, *string, *compose; + int mask; + unsigned int timestamp; + Evas_Event_Flags event_flags; +}; + +typedef struct _Extn Extn; + +struct _Extn +{ + struct { + Ecore_Ipc_Server *server; + Eina_List *clients; + Eina_List *handlers; + Eina_Bool am_server : 1; + } ipc; + struct { + const char *name; + int num; + Eina_Bool sys : 1; + } svc; + struct { + const char *lock; + int lockfd; + const char *shm; + int w, h; + Shmfile *shmfile; + Eina_List *updates; + Eina_Bool have_lock : 1; + } file; +}; + +static Eina_List *extn_ee_list = NULL; + +EAPI int ECORE_EVAS_EXTN_CLIENT_ADD = 0; +EAPI int ECORE_EVAS_EXTN_CLIENT_DEL = 0; + +void +_ecore_evas_extn_init(void) +{ + if (ECORE_EVAS_EXTN_CLIENT_ADD) return; + ECORE_EVAS_EXTN_CLIENT_ADD = ecore_event_type_new(); + ECORE_EVAS_EXTN_CLIENT_DEL = ecore_event_type_new(); +} + +void +_ecore_evas_extn_shutdown(void) +{ +} + +static void +_ecore_evas_extn_event_free(void *data, void *ev __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee->engine.buffer.image) + evas_object_unref(ee->engine.buffer.image); + _ecore_evas_unref(ee); +} + +static void +_ecore_evas_extn_event(Ecore_Evas *ee, int event) +{ + _ecore_evas_ref(ee); + if (ee->engine.buffer.image) + evas_object_ref(ee->engine.buffer.image); + ecore_event_add(event, ee->engine.buffer.image, + _ecore_evas_extn_event_free, ee); +} + +static void +_ecore_evas_socket_lock(Ecore_Evas *ee) +{ + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->file.lockfd < 0) return; + if (extn->file.have_lock) return; + flock(extn->file.lockfd, LOCK_EX); + extn->file.have_lock = EINA_TRUE; +} + +static void +_ecore_evas_socket_unlock(Ecore_Evas *ee) +{ + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->file.lockfd < 0) return; + if (!extn->file.have_lock) return; + flock(extn->file.lockfd, LOCK_UN); + extn->file.have_lock = EINA_FALSE; +} + +static void +_ecore_evas_extn_plug_targer_render_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee) _ecore_evas_socket_lock(ee); +} + +static void +_ecore_evas_extn_plug_targer_render_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee) _ecore_evas_socket_unlock(ee); +} + +static void +_ecore_evas_extn_plug_image_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee) ecore_evas_free(ee); +} + +static void +_ecore_evas_extn_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) +{ + Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; + + evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh); + evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh); + + if (fw < 1) fw = 1; + if (fh < 1) fh = 1; + + if (evas_object_map_get(ee->engine.buffer.image) && + evas_object_map_enable_get(ee->engine.buffer.image)) + { + fx = 0; fy = 0; + fw = ee->w; fh = ee->h; + ww = ee->w; hh = ee->h; + } + + if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) + { + *x = (ee->w * (*x - xx)) / fw; + *y = (ee->h * (*y - yy)) / fh; + } + else + { + xx = (*x - xx) - fx; + while (xx < 0) xx += fw; + while (xx > fw) xx -= fw; + *x = (ee->w * xx) / fw; + + yy = (*y - yy) - fy; + while (yy < 0) yy += fh; + while (yy > fh) yy -= fh; + *y = (ee->h * yy) / fh; + } +} + +static void +_ecore_evas_extn_free(Ecore_Evas *ee) +{ + Extn *extn; + Ecore_Ipc_Client *client; + + extn = ee->engine.buffer.data; + if (extn) + { + Ecore_Event_Handler *hdl; + + if (extn->file.have_lock) + _ecore_evas_socket_unlock(ee); + if (extn->file.lockfd) + { + close(extn->file.lockfd); + if (extn->ipc.am_server) + { + if (extn->file.lock) unlink(extn->file.lock); + } + } + if (extn->svc.name) eina_stringshare_del(extn->svc.name); + if (extn->ipc.clients) + { + EINA_LIST_FREE(extn->ipc.clients, client) + ecore_ipc_client_del(client); + } + if (extn->ipc.server) ecore_ipc_server_del(extn->ipc.server); + if (extn->file.lock) eina_stringshare_del(extn->file.lock); + if (extn->file.shm) eina_stringshare_del(extn->file.shm); + if (extn->file.shmfile) + { + if (extn->ipc.am_server) + shmfile_free(extn->file.shmfile); + else + shmfile_close(extn->file.shmfile); + } + + EINA_LIST_FREE(extn->ipc.handlers, hdl) + ecore_event_handler_del(hdl); + free(extn); + ecore_ipc_shutdown(); + ee->engine.buffer.data = NULL; + } + if (ee->engine.buffer.image) + { + Ecore_Evas *ee2; + + evas_object_event_callback_del_full(ee->engine.buffer.image, + EVAS_CALLBACK_DEL, + _ecore_evas_extn_plug_image_obj_del, + ee); + evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image), + EVAS_CALLBACK_RENDER_PRE, + _ecore_evas_extn_plug_targer_render_pre, + ee); + evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image), + EVAS_CALLBACK_RENDER_POST, + _ecore_evas_extn_plug_targer_render_post, + ee); + evas_object_del(ee->engine.buffer.image); + ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); + if (ee2) + { + ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); + } + } + extn_ee_list = eina_list_remove(extn_ee_list, ee); +} + +static void +_ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->req.w = w; + ee->req.h = h; + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + + /* + * No need for it if not used later. + Extn *extn; + + extn = ee->engine.buffer.data; + */ + if (ee->engine.buffer.image) + evas_object_image_size_set(ee->engine.buffer.image, ee->w, ee->h); + /* Server can have many plugs, so I block resize comand from client to server * + if ((extn) && (extn->ipc.server)) + { + Ipc_Data_Resize ipc; + + ipc.w = ee->w; + ipc.h = ee->h; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_RESIZE, 0, 0, 0, &ipc, sizeof(ipc)); + }*/ + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) +{ + _ecore_evas_resize(ee, w, h); +} + +static int +_ecore_evas_modifiers_locks_mask_get(Evas *e) +{ + int mask = 0; + + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) + mask |= MOD_SHIFT; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) + mask |= MOD_CTRL; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) + mask |= MOD_ALT; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) + mask |= MOD_META; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) + mask |= MOD_HYPER; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) + mask |= MOD_SUPER; + if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) + mask |= MOD_SCROLL; + if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) + mask |= MOD_NUM; + if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) + mask |= MOD_CAPS; + return mask; +} + +static void +_ecore_evas_modifiers_locks_mask_set(Evas *e, int mask) +{ + if (mask & MOD_SHIFT) evas_key_modifier_on (e, "Shift"); + else evas_key_modifier_off(e, "Shift"); + if (mask & MOD_CTRL) evas_key_modifier_on (e, "Control"); + else evas_key_modifier_off(e, "Control"); + if (mask & MOD_ALT) evas_key_modifier_on (e, "Alt"); + else evas_key_modifier_off(e, "Alt"); + if (mask & MOD_META) evas_key_modifier_on (e, "Meta"); + else evas_key_modifier_off(e, "Meta"); + if (mask & MOD_HYPER) evas_key_modifier_on (e, "Hyper"); + else evas_key_modifier_off(e, "Hyper"); + if (mask & MOD_SUPER) evas_key_modifier_on (e, "Super"); + else evas_key_modifier_off(e, "Super"); + if (mask & MOD_SCROLL) evas_key_lock_on (e, "Scroll_Lock"); + else evas_key_lock_off(e, "Scroll_Lock"); + if (mask & MOD_NUM) evas_key_lock_on (e, "Num_Lock"); + else evas_key_lock_off(e, "Num_Lock"); + if (mask & MOD_CAPS) evas_key_lock_on (e, "Caps_Lock"); + else evas_key_lock_off(e, "Caps_Lock"); +} + +static void +_ecore_evas_extn_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_In *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Mouse_In ipc; + + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_IN, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Out *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Mouse_Out ipc; + + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_OUT, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Down *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Mouse_Down ipc; + + ipc.b = ev->button; + ipc.flags = ev->flags; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_DOWN, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Up *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Mouse_Up ipc; + + ipc.b = ev->button; + ipc.flags = ev->flags; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_UP, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Move *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Mouse_Move ipc; + Evas_Coord x, y; + + x = ev->cur.canvas.x; + y = ev->cur.canvas.y; + _ecore_evas_extn_coord_translate(ee, &x, &y); + ipc.x = x; + ipc.y = y; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Wheel *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Mouse_Wheel ipc; + + ipc.direction = ev->direction; + ipc.z = ev->z; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_WHEEL, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Multi_Down *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Multi_Down ipc; + Evas_Coord x, y; + + ipc.d = ev->device; + x = ev->canvas.x; + y = ev->canvas.y; + _ecore_evas_extn_coord_translate(ee, &x, &y); + ipc.x = x; + ipc.y = y; + ipc.rad = ev->radius; + ipc.radx = ev->radius_x; + ipc.rady = ev->radius_y; + ipc.pres = ev->pressure; + ipc.ang = ev->angle; + ipc.fx = ev->canvas.xsub; + ipc.fy = ev->canvas.ysub; + ipc.flags = ev->flags; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_DOWN, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + + +static void +_ecore_evas_extn_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Multi_Up *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Multi_Up ipc; + Evas_Coord x, y; + + ipc.d = ev->device; + x = ev->canvas.x; + y = ev->canvas.y; + _ecore_evas_extn_coord_translate(ee, &x, &y); + ipc.x = x; + ipc.y = y; + ipc.rad = ev->radius; + ipc.radx = ev->radius_x; + ipc.rady = ev->radius_y; + ipc.pres = ev->pressure; + ipc.ang = ev->angle; + ipc.fx = ev->canvas.xsub; + ipc.fy = ev->canvas.ysub; + ipc.flags = ev->flags; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_UP, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Multi_Move *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Multi_Move ipc; + Evas_Coord x, y; + + ipc.d = ev->device; + x = ev->cur.canvas.x; + y = ev->cur.canvas.y; + _ecore_evas_extn_coord_translate(ee, &x, &y); + ipc.x = x; + ipc.y = y; + ipc.rad = ev->radius; + ipc.radx = ev->radius_x; + ipc.rady = ev->radius_y; + ipc.pres = ev->pressure; + ipc.ang = ev->angle; + ipc.fx = ev->cur.canvas.xsub; + ipc.fy = ev->cur.canvas.ysub; + ipc.timestamp = ev->timestamp; + ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_MOVE, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee->driver) _ecore_evas_free(ee); +} + +static void +_ecore_evas_extn_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Key_Down *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Key_Down *ipc; + char *st, *p; + int len = 0; + + len = sizeof(Ipc_Data_Ev_Key_Down); + if (ev->key) len += strlen(ev->key) + 1; + if (ev->keyname) len += strlen(ev->keyname) + 1; + if (ev->string) len += strlen(ev->string) + 1; + if (ev->compose) len += strlen(ev->compose) + 1; + len += 1; + st = alloca(len); + ipc = (Ipc_Data_Ev_Key_Down *)st; + memset(st, 0, len); + p = st + sizeof(Ipc_Data_Ev_Key_Down); + if (ev->key) + { + strcpy(p, ev->key); + ipc->key = p - (long)st; + p += strlen(p) + 1; + } + if (ev->keyname) + { + strcpy(p, ev->keyname); + ipc->keyname = p - (long)st; + p += strlen(p) + 1; + } + if (ev->string) + { + strcpy(p, ev->string); + ipc->string = p - (long)st; + p += strlen(p) + 1; + } + if (ev->compose) + { + strcpy(p, ev->compose); + ipc->compose = p - (long)st; + p += strlen(p) + 1; + } + ipc->timestamp = ev->timestamp; + ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc->event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_DOWN, 0, 0, 0, ipc, len); + } +} + +static void +_ecore_evas_extn_cb_key_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Key_Up *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Key_Up *ipc; + char *st, *p; + int len = 0; + + len = sizeof(Ipc_Data_Ev_Key_Up); + if (ev->key) len += strlen(ev->key) + 1; + if (ev->keyname) len += strlen(ev->keyname) + 1; + if (ev->string) len += strlen(ev->string) + 1; + if (ev->compose) len += strlen(ev->compose) + 1; + len += 1; + st = alloca(len); + ipc = (Ipc_Data_Ev_Key_Up *)st; + memset(st, 0, len); + p = st + sizeof(Ipc_Data_Ev_Key_Down); + if (ev->key) + { + strcpy(p, ev->key); + ipc->key = p - (long)st; + p += strlen(p) + 1; + } + if (ev->keyname) + { + strcpy(p, ev->keyname); + ipc->keyname = p - (long)st; + p += strlen(p) + 1; + } + if (ev->string) + { + strcpy(p, ev->string); + ipc->string = p - (long)st; + p += strlen(p) + 1; + } + if (ev->compose) + { + strcpy(p, ev->compose); + ipc->compose = p - (long)st; + p += strlen(p) + 1; + } + ipc->timestamp = ev->timestamp; + ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); + ipc->event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_UP, 0, 0, 0, ipc, len); + } +} + +static void +_ecore_evas_extn_cb_hold(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Hold *ev = event_info; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (extn->ipc.server) + { + Ipc_Data_Ev_Hold ipc; + + ipc.hold = ev->hold; + ipc.timestamp = ev->timestamp; + ipc.event_flags = ev->event_flags; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_HOLD, 0, 0, 0, &ipc, sizeof(ipc)); + } +} + +static void +_ecore_evas_extn_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + Extn *extn; + + ee = data; + ee->prop.focused = 1; + extn = ee->engine.buffer.data; + if (!extn) return; + if (!extn->ipc.server) return; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_FOCUS, 0, 0, 0, NULL, 0); +} + +static void +_ecore_evas_extn_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + Extn *extn; + + ee = data; + ee->prop.focused = 0; + extn = ee->engine.buffer.data; + if (!extn) return; + if (!extn->ipc.server) return; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_UNFOCUS, 0, 0, 0, NULL, 0); +} + +static void +_ecore_evas_extn_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + Extn *extn; + + ee = data; + ee->visible = 1; + extn = ee->engine.buffer.data; + if (!extn) return; + if (!extn->ipc.server) return; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_SHOW, 0, 0, 0, NULL, 0); +} + +static void +_ecore_evas_extn_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + Extn *extn; + + ee = data; + ee->visible = 0; + extn = ee->engine.buffer.data; + if (!extn) return; + if (!extn->ipc.server) return; + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0); +} + +static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = +{ + _ecore_evas_extn_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_resize, + _ecore_evas_move_resize, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, //transparent + + NULL, // render + NULL // screen_geometry_get +}; + +static Eina_Bool +_ipc_server_add(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Event_Server_Add *e = event; + Ecore_Evas *ee = data; + Extn *extn; + + if (ee != ecore_ipc_server_data_get(e->server)) + return ECORE_CALLBACK_PASS_ON; + if (!eina_list_data_find(extn_ee_list, ee)) + return ECORE_CALLBACK_PASS_ON; + extn = ee->engine.buffer.data; + if (!extn) return ECORE_CALLBACK_PASS_ON; + //FIXME: find a way to let app know server there + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ipc_server_del(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Event_Server_Del *e = event; + Ecore_Evas *ee = data; + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return ECORE_CALLBACK_PASS_ON; + if (extn->ipc.server != e->server) return ECORE_CALLBACK_PASS_ON; + evas_object_image_data_set(ee->engine.buffer.image, NULL); + ee->engine.buffer.pixels = NULL; + if (extn->file.shmfile) + { + shmfile_close(extn->file.shmfile); + extn->file.shmfile = NULL; + } + if (extn->file.shm) + { + eina_stringshare_del(extn->file.shm); + extn->file.shm = NULL; + } + extn->ipc.server = NULL; + if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ipc_server_data(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Event_Server_Data *e = event; + Ecore_Evas *ee = data; + Extn *extn; + + if (ee != ecore_ipc_server_data_get(e->server)) + return ECORE_CALLBACK_PASS_ON; + if (!eina_list_data_find(extn_ee_list, ee)) + return ECORE_CALLBACK_PASS_ON; + extn = ee->engine.buffer.data; + if (!extn) return ECORE_CALLBACK_PASS_ON; + if (e->major != MAJOR) + return ECORE_CALLBACK_PASS_ON; + switch (e->minor) + { + case OP_UPDATE: + // add rect to update list + if (e->size >= (int)sizeof(Ipc_Data_Update)) + { + Ipc_Data_Update *ipc = malloc(sizeof(Ipc_Data_Update)); + if (ipc) + { + memcpy(ipc, e->data, sizeof(Ipc_Data_Update)); + extn->file.updates = eina_list_append(extn->file.updates, ipc); + } + } + break; + case OP_UPDATE_DONE: + // updates finished being sent - done now. frame ready + { + Ipc_Data_Update *ipc; + + EINA_LIST_FREE(extn->file.updates, ipc) + { + if (ee->engine.buffer.image) + evas_object_image_data_update_add(ee->engine.buffer.image, + ipc->x, ipc->y, + ipc->w, ipc->h); + } + } + break; + case OP_LOCK_FILE: + if ((e->data) && (e->size > 0) && + (((unsigned char *)e->data)[e->size - 1] == 0)) + { + if (extn->file.lockfd) close(extn->file.lockfd); + if (extn->file.lock) eina_stringshare_del(extn->file.lock); + extn->file.lock = eina_stringshare_add(e->data); + extn->file.lockfd = open(extn->file.lock, O_RDONLY); + } + break; + case OP_SHM_REF: + // e->ref == w + // e->ref_to == h + // e->response == alpha + // e->data = shm ref string + nul byte + if ((e->data) && ((unsigned char *)e->data)[e->size - 1] == 0) + { + ee->engine.buffer.pixels = NULL; + if (extn->file.shmfile) + { + shmfile_close(extn->file.shmfile); + extn->file.shmfile = NULL; + } + if (extn->file.shm) + { + eina_stringshare_del(extn->file.shm); + extn->file.shm = NULL; + } + if ((e->ref > 0) && (e->ref_to > 0)) + { + extn->file.w = e->ref; + extn->file.h = e->ref_to; + extn->file.shm = eina_stringshare_add(e->data); + extn->file.shmfile = shmfile_open(extn->file.shm, + extn->file.w * + extn->file.h * 4, + EINA_TRUE); + if (extn->file.shmfile) + { + ee->engine.buffer.pixels = extn->file.shmfile->addr; + if (ee->engine.buffer.image) + { + if (e->response) + evas_object_image_alpha_set(ee->engine.buffer.image, + EINA_TRUE); + else + evas_object_image_alpha_set(ee->engine.buffer.image, + EINA_FALSE); + evas_object_image_size_set(ee->engine.buffer.image, + extn->file.w, + extn->file.h); + evas_object_image_data_set(ee->engine.buffer.image, + ee->engine.buffer.pixels); + evas_object_image_data_update_add(ee->engine.buffer.image, + 0, 0, + extn->file.w, + extn->file.h); + _ecore_evas_resize(ee, + extn->file.w, + extn->file.h); + } + else + evas_object_image_data_set(ee->engine.buffer.image, NULL); + } + else + evas_object_image_data_set(ee->engine.buffer.image, NULL); + } + else + evas_object_image_data_set(ee->engine.buffer.image, NULL); + } + break; + case OP_RESIZE: + if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize))) + { + Ipc_Data_Resize *ipc = e->data; + _ecore_evas_resize(ee, ipc->w, ipc->h); + } + break; + default: + break; + } + return ECORE_CALLBACK_PASS_ON; +} +#else +void +_ecore_evas_extn_init(void) +{ +} + +void +_ecore_evas_extn_shutdown(void) +{ +} +#endif + +EAPI Evas_Object * +ecore_evas_extn_plug_new(Ecore_Evas *ee_target) +{ +#ifdef EXTN_ENABLED + Evas_Object *o; + Ecore_Evas *ee; + int w = 1, h = 1; + + if (!ee_target) return NULL; + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + o = evas_object_image_filled_add(ee_target->evas); + evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); + evas_object_image_alpha_set(o, 1); + evas_object_image_size_set(o, 1, 1); + evas_object_image_data_set(o, &blank); + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_plug_engine_func; + + ee->driver = "extn_plug"; + + ee->rotation = 0; + ee->visible = 0; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 0; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 0; + ee->prop.fullscreen = 0; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + + ee->engine.buffer.image = o; + evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee); + evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_IN, + _ecore_evas_extn_cb_mouse_in, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_OUT, + _ecore_evas_extn_cb_mouse_out, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_DOWN, + _ecore_evas_extn_cb_mouse_down, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_UP, + _ecore_evas_extn_cb_mouse_up, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_MOVE, + _ecore_evas_extn_cb_mouse_move, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_WHEEL, + _ecore_evas_extn_cb_mouse_wheel, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MULTI_DOWN, + _ecore_evas_extn_cb_multi_down, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MULTI_UP, + _ecore_evas_extn_cb_multi_up, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MULTI_MOVE, + _ecore_evas_extn_cb_multi_move, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_FREE, + _ecore_evas_extn_cb_free, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_KEY_DOWN, + _ecore_evas_extn_cb_key_down, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_KEY_UP, + _ecore_evas_extn_cb_key_up, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_HOLD, + _ecore_evas_extn_cb_hold, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_FOCUS_IN, + _ecore_evas_extn_cb_focus_in, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_FOCUS_OUT, + _ecore_evas_extn_cb_focus_out, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_SHOW, + _ecore_evas_extn_cb_show, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_HIDE, + _ecore_evas_extn_cb_hide, ee); + + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_DEL, + _ecore_evas_extn_plug_image_obj_del, ee); + + + extn_ee_list = eina_list_append(extn_ee_list, ee); + ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); + + evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_PRE, + _ecore_evas_extn_plug_targer_render_pre, ee); + evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_POST, + _ecore_evas_extn_plug_targer_render_post, ee); + return o; +#else + return NULL; +#endif +} + +EAPI Eina_Bool +ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) +{ +#ifdef EXTN_ENABLED + Extn *extn; + Ecore_Evas *ee = NULL; + + if (!obj) return EINA_FALSE; + + ee = evas_object_data_get(obj, "Ecore_Evas"); + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) return EINA_FALSE; + + extn = calloc(1, sizeof(Extn)); + if (!extn) return EINA_FALSE; + + Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; + + ecore_ipc_init(); + extn->svc.name = eina_stringshare_add(svcname); + extn->svc.num = svcnum; + extn->svc.sys = svcsys; + + if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM; + extn->ipc.server = ecore_ipc_server_connect(ipctype, (char *)extn->svc.name, + extn->svc.num, ee); + if (!extn->ipc.server) + { + eina_stringshare_del(extn->svc.name); + free(extn); + ecore_ipc_shutdown(); + return EINA_FALSE; + } + ee->engine.buffer.data = extn; + extn->ipc.handlers = eina_list_append + (extn->ipc.handlers, + ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, + _ipc_server_add, ee)); + extn->ipc.handlers = eina_list_append + (extn->ipc.handlers, + ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, + _ipc_server_del, ee)); + extn->ipc.handlers = eina_list_append + (extn->ipc.handlers, + ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, + _ipc_server_data, ee)); + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +EAPI void +ecore_evas_extn_plug_object_data_lock(Evas_Object *obj) +{ +#ifdef EXTN_ENABLED + Ecore_Evas *ee; + + ee = ecore_evas_object_ecore_evas_get(obj); + if (!ee) return; + _ecore_evas_socket_lock(ee); +#endif +} + +EAPI void +ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj) +{ +#ifdef EXTN_ENABLED + Ecore_Evas *ee; + + ee = ecore_evas_object_ecore_evas_get(obj); + if (!ee) return; + _ecore_evas_socket_unlock(ee); +#endif +} + +#ifdef EXTN_ENABLED +static void +_ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h) +{ + Extn *extn; + Evas_Engine_Info_Buffer *einfo; + int stride = 0; + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->req.w = w; + ee->req.h = h; + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + 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); + extn = ee->engine.buffer.data; + if (extn) + { + if (extn->file.shmfile) + shmfile_free(extn->file.shmfile); + ee->engine.buffer.pixels = NULL; + extn->file.shmfile = shmfile_new(extn->svc.name, extn->svc.num, + ee->w * ee->h * 4, extn->svc.sys); + if (extn->file.shmfile) + ee->engine.buffer.pixels = extn->file.shmfile->addr; + + stride = ee->w * 4; + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->alpha) + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + else + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + einfo->info.dest_buffer = ee->engine.buffer.pixels; + einfo->info.dest_buffer_row_bytes = stride; + 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; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + + if (extn->ipc.clients && extn->file.shmfile) + { + Ipc_Data_Resize ipc; + Eina_List *l; + Ecore_Ipc_Client *client; + + EINA_LIST_FOREACH(extn->ipc.clients, l, client) + ecore_ipc_client_send(client, MAJOR, OP_SHM_REF, + ee->w, ee->h, ee->alpha, + extn->file.shmfile->file, + strlen(extn->file.shmfile->file) + 1); + ipc.w = ee->w; + ipc.h = ee->h; + EINA_LIST_FOREACH(extn->ipc.clients, l, client) + ecore_ipc_client_send(client, MAJOR, OP_RESIZE, + 0, 0, 0, &ipc, sizeof(ipc)); + } + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_socket_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) +{ + _ecore_evas_socket_resize(ee, w, h); +} + +int +_ecore_evas_extn_socket_render(Ecore_Evas *ee) +{ + Eina_List *updates = NULL, *l, *ll; + Ecore_Evas *ee2; + int rend = 0; + Eina_Rectangle *r; + Extn *extn; + Ecore_Ipc_Client *client; + + extn = ee->engine.buffer.data; + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + if (ee->engine.buffer.pixels) + { + _ecore_evas_socket_lock(ee); + updates = evas_render_updates(ee->evas); + _ecore_evas_socket_unlock(ee); + } + EINA_LIST_FOREACH(updates, l, r) + { + Ipc_Data_Update ipc; + + + ipc.x = r->x; + ipc.y = r->y; + ipc.w = r->w; + ipc.h = r->h; + EINA_LIST_FOREACH(extn->ipc.clients, ll, client) + ecore_ipc_client_send(client, MAJOR, OP_UPDATE, 0, 0, 0, &ipc, sizeof(ipc)); + } + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + EINA_LIST_FOREACH(extn->ipc.clients, ll, client) + ecore_ipc_client_send(client, MAJOR, OP_UPDATE_DONE, 0, 0, 0, NULL, 0); + } + + return updates ? 1 : rend; +} + +static Eina_Bool +_ipc_client_add(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Event_Client_Add *e = event; + Ecore_Evas *ee = data; + Extn *extn; + + if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client))) + return ECORE_CALLBACK_PASS_ON; + if (!eina_list_data_find(extn_ee_list, ee)) + return ECORE_CALLBACK_PASS_ON; + extn = ee->engine.buffer.data; + if (!extn) return ECORE_CALLBACK_PASS_ON; + + extn->ipc.clients = eina_list_append(extn->ipc.clients, e->client); + ecore_ipc_client_send(e->client, MAJOR, OP_LOCK_FILE, 0, 0, 0, extn->file.lock, strlen(extn->file.lock) + 1); + + if (extn->file.shmfile) + { + Ipc_Data_Resize ipc; + + ecore_ipc_client_send(e->client, MAJOR, OP_SHM_REF, + ee->w, ee->h, ee->alpha, + extn->file.shmfile->file, + strlen(extn->file.shmfile->file) + 1); + ipc.w = ee->w; + ipc.h = ee->h; + + ecore_ipc_client_send(e->client, MAJOR, OP_RESIZE, + 0, 0, 0, &ipc, sizeof(ipc)); + } + _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_ADD); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ipc_client_del(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Event_Client_Del *e = event; + Ecore_Evas *ee = data; + Extn *extn; + extn = ee->engine.buffer.data; + if (!extn) return ECORE_CALLBACK_PASS_ON; + if (!eina_list_data_find(extn->ipc.clients, e->client)) return ECORE_CALLBACK_PASS_ON; + + extn->ipc.clients = eina_list_remove(extn->ipc.clients, e->client); + + _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_DEL); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ipc_client_data(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Event_Client_Data *e = event; + Ecore_Evas *ee = data; + Extn *extn; + + if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client))) + return ECORE_CALLBACK_PASS_ON; + if (!eina_list_data_find(extn_ee_list, ee)) + return ECORE_CALLBACK_PASS_ON; + extn = ee->engine.buffer.data; + if (!extn) return ECORE_CALLBACK_PASS_ON; + if (e->major != MAJOR) + return ECORE_CALLBACK_PASS_ON; + switch (e->minor) + { + case OP_RESIZE: + if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize))) + { + + Ipc_Data_Resize *ipc = e->data; + /* create callbacke data size changed */ + _ecore_evas_socket_resize(ee, ipc->w, ipc->h); + } + break; + case OP_SHOW: + if (!ee->visible) + { + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); + } + break; + case OP_HIDE: + if (ee->visible) + { + ee->visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); + } + break; + case OP_FOCUS: + if (!ee->prop.focused) + { + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + } + break; + case OP_UNFOCUS: + if (ee->prop.focused) + { + ee->prop.focused = 0; + evas_focus_out(ee->evas); + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + } + break; + case OP_EV_MOUSE_IN: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_In)) + { + Ipc_Data_Ev_Mouse_In *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_mouse_in(ee->evas, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MOUSE_OUT: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Out)) + { + Ipc_Data_Ev_Mouse_Out *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_mouse_out(ee->evas, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MOUSE_UP: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Up)) + { + Ipc_Data_Ev_Mouse_Up *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_mouse_up(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MOUSE_DOWN: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Down)) + { + Ipc_Data_Ev_Mouse_Up *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_mouse_down(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MOUSE_MOVE: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Move)) + { + Ipc_Data_Ev_Mouse_Move *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_mouse_move(ee->evas, ipc->x, ipc->y, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MOUSE_WHEEL: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Wheel)) + { + Ipc_Data_Ev_Mouse_Wheel *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_mouse_wheel(ee->evas, ipc->direction, ipc->z, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MULTI_UP: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Up)) + { + Ipc_Data_Ev_Multi_Up *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_multi_up(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MULTI_DOWN: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Down)) + { + Ipc_Data_Ev_Multi_Down *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_multi_down(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + case OP_EV_MULTI_MOVE: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Move)) + { + Ipc_Data_Ev_Multi_Move *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_multi_move(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + +#define STRGET(val) \ + do { \ + if ((ipc->val) && (ipc->val < (char *)(e->size - 1))) \ + ipc->val = ((char *)ipc) + (long)ipc->val; \ + else \ + ipc->val = NULL; \ + } while (0) + + case OP_EV_KEY_UP: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Up)) + { + if ((e->data) && (e->size > 0) && + (((unsigned char *)e->data)[e->size - 1] == 0)) + { + Ipc_Data_Ev_Key_Up *ipc = e->data; + Evas_Event_Flags flags; + + STRGET(keyname); + STRGET(key); + STRGET(string); + STRGET(compose); + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_key_up(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + } + break; + case OP_EV_KEY_DOWN: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Down)) + { + if ((e->data) && (e->size > 0) && + (((unsigned char *)e->data)[e->size - 1] == 0)) + { + Ipc_Data_Ev_Key_Down *ipc = e->data; + Evas_Event_Flags flags; + + STRGET(keyname); + STRGET(key); + STRGET(string); + STRGET(compose); + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); + evas_event_feed_key_down(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + } + break; + case OP_EV_HOLD: + if (e->size >= (int)sizeof(Ipc_Data_Ev_Hold)) + { + Ipc_Data_Ev_Hold *ipc = e->data; + Evas_Event_Flags flags; + + flags = evas_event_default_flags_get(ee->evas); + evas_event_default_flags_set(ee->evas, ipc->event_flags); + evas_event_feed_hold(ee->evas, ipc->hold, ipc->timestamp, NULL); + evas_event_default_flags_set(ee->evas, flags); + } + break; + default: + break; + } + return ECORE_CALLBACK_PASS_ON; +} + +static void +_ecore_evas_extn_socket_alpha_set(Ecore_Evas *ee, int alpha) +{ + Extn *extn; + Eina_List *l; + Ecore_Ipc_Client *client; + + if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return; + ee->alpha = alpha; + + extn = ee->engine.buffer.data; + if (extn) + { + Evas_Engine_Info_Buffer *einfo; + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->alpha) + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + else + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + EINA_LIST_FOREACH(extn->ipc.clients, l, client) + ecore_ipc_client_send(client, MAJOR, OP_SHM_REF, + ee->w, ee->h, ee->alpha, + extn->file.shmfile->file, + strlen(extn->file.shmfile->file) + 1); + } +} + +static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = +{ + _ecore_evas_extn_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_socket_resize, + _ecore_evas_socket_move_resize, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_extn_socket_alpha_set, + NULL, //transparent + + _ecore_evas_extn_socket_render, // render + NULL // screen_geometry_get +}; + +#endif + +EAPI Ecore_Evas * +ecore_evas_extn_socket_new(int w, int h) +{ +#ifdef EXTN_ENABLED + Evas_Engine_Info_Buffer *einfo; + Ecore_Evas *ee; + int rmethod; + + rmethod = evas_render_method_lookup("buffer"); + if (!rmethod) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_socket_engine_func; + + ee->driver = "extn_socket"; + + ee->rotation = 0; + ee->visible = 0; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 0; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 0; + ee->prop.fullscreen = 0; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->alpha) + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + else + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; + einfo->info.dest_buffer = NULL; + einfo->info.dest_buffer_row_bytes = 0; + 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; + 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); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + evas_key_modifier_add(ee->evas, "Shift"); + evas_key_modifier_add(ee->evas, "Control"); + evas_key_modifier_add(ee->evas, "Alt"); + evas_key_modifier_add(ee->evas, "Meta"); + evas_key_modifier_add(ee->evas, "Hyper"); + evas_key_modifier_add(ee->evas, "Super"); + evas_key_lock_add(ee->evas, "Caps_Lock"); + evas_key_lock_add(ee->evas, "Num_Lock"); + evas_key_lock_add(ee->evas, "Scroll_Lock"); + + extn_ee_list = eina_list_append(extn_ee_list, ee); + + _ecore_evas_register(ee); + + return ee; +#else + return NULL; +#endif +} + +EAPI Eina_Bool +ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys) +{ +#ifdef EXTN_ENABLED + Extn *extn; + + extn = calloc(1, sizeof(Extn)); + if (!extn) + { + return EINA_FALSE; + } + else + { + Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; + char buf[PATH_MAX]; + + ecore_ipc_init(); + extn->svc.name = eina_stringshare_add(svcname); + extn->svc.num = svcnum; + extn->svc.sys = svcsys; + + snprintf(buf, sizeof(buf), "/tmp/ee-lock-XXXXXX"); + extn->file.lockfd = mkstemp(buf); + if (extn->file.lockfd >= 0) + extn->file.lock = eina_stringshare_add(buf); + if ((extn->file.lockfd < 0) || (!extn->file.lock)) + { + if (extn->file.lockfd) + { + close(extn->file.lockfd); + unlink(buf); + } + eina_stringshare_del(extn->svc.name); + if (extn->file.lock) eina_stringshare_del(extn->file.lock); + free(extn); + ecore_ipc_shutdown(); + return EINA_FALSE; + } + + if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM; + extn->ipc.am_server = EINA_TRUE; + extn->ipc.server = ecore_ipc_server_add(ipctype, + (char *)extn->svc.name, + extn->svc.num, ee); + if (!extn->ipc.server) + { + if (extn->file.lockfd) + { + close(extn->file.lockfd); + if (extn->file.lock) unlink(extn->file.lock); + } + eina_stringshare_del(extn->svc.name); + eina_stringshare_del(extn->file.lock); + free(extn); + ecore_ipc_shutdown(); + return EINA_FALSE; + } + ee->engine.buffer.data = extn; + extn->ipc.handlers = eina_list_append + (extn->ipc.handlers, + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, + _ipc_client_add, ee)); + extn->ipc.handlers = eina_list_append + (extn->ipc.handlers, + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, + _ipc_client_del, ee)); + extn->ipc.handlers = eina_list_append + (extn->ipc.handlers, + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, + _ipc_client_data, ee)); + } + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} 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 3ee913e..74caada 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include @@ -154,9 +155,9 @@ _ecore_evas_fb_render(Ecore_Evas *ee) if (ee->visible) { Eina_List *updates; - Eina_List *ll; Ecore_Evas *ee2; + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) @@ -184,31 +185,26 @@ _ecore_evas_fb_render(Ecore_Evas *ee) static int _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) { + Eina_File_Direct_Info *info; + Eina_Iterator *ls; Ecore_Fb_Input_Device *device; Ecore_Fb_Input_Device_Cap caps; int mouse_handled = 0; - DIR *input_dir; - struct dirent *input_entry; - _ecore_evas_init_count++; if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; ecore_event_evas_init(); /* register all input devices */ - input_dir = opendir("/dev/input/"); - if (!input_dir) return _ecore_evas_init_count; + ls = eina_file_direct_ls("/dev/input/"); - while ((input_entry = readdir(input_dir))) + EINA_ITERATOR_FOREACH(ls, info) { - char device_path[256]; - - if (strncmp(input_entry->d_name, "event", 5) != 0) + if (strncmp(info->path + info->name_start, "event", 5) != 0) continue; - snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name); - if (!(device = ecore_fb_input_device_open(device_path))) + if (!(device = ecore_fb_input_device_open(info->path))) continue; ecore_fb_input_device_window_set(device, ee); @@ -240,7 +236,7 @@ _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); } } - closedir(input_dir); + eina_iterator_free(ls); if (!mouse_handled) { 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 2c20761..9a88a7a 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h @@ -1,18 +1,6 @@ #ifndef _ECORE_EVAS_PRIVATE_H #define _ECORE_EVAS_PRIVATE_H -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#ifdef HAVE_SYS_MMAN_H -# include -#endif - #include #include #include @@ -91,9 +79,17 @@ # include #endif -/** - Log domain macros and variable - **/ +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM +# include "Ecore_Wayland.h" +# include +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL +# include "Ecore_Wayland.h" +# include +#endif + +/** Log domain macros and variables **/ extern int _ecore_evas_log_dom; @@ -272,6 +268,17 @@ struct _Ecore_Evas_Engine } ews; #endif +#if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL) + struct + { + Evas_Object *frame; + + struct wl_shell_surface *shell_surface; + struct wl_surface *surface; + struct wl_buffer *buffer; + } wl; +#endif + Ecore_Timer *idle_flush_timer; }; @@ -290,6 +297,7 @@ struct _Ecore_Evas Eina_Bool should_be_visible : 1; Eina_Bool alpha : 1; Eina_Bool transparent : 1; + Eina_Bool in : 1; Eina_Hash *data; @@ -334,6 +342,7 @@ struct _Ecore_Evas char withdrawn : 1; char sticky : 1; char request_pos : 1; + char draw_frame : 1; } prop; struct { @@ -394,6 +403,16 @@ void _ecore_evas_ews_events_init(void); int _ecore_evas_ews_shutdown(void); #endif +#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); +#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); +#endif + void _ecore_evas_fps_debug_init(void); void _ecore_evas_fps_debug_shutdown(void); void _ecore_evas_fps_debug_rendertime_add(double t); @@ -430,4 +449,7 @@ void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, extern Eina_Bool _ecore_evas_app_comp_sync; +void _ecore_evas_extn_init(void); +void _ecore_evas_extn_shutdown(void); + #endif 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 0849c79..be130ad 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c @@ -16,7 +16,7 @@ static int _ecore_evas_init_count = 0; static Ecore_Evas *psl1ght_ee = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { +static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { NULL, NULL, NULL, NULL }; @@ -48,7 +48,7 @@ _ecore_evas_psl1ght_event_got_focus(void *data __UNUSED__, int type __UNUSED__, ee->prop.focused = 1; evas_focus_in(ee->evas); if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); - + return ECORE_CALLBACK_PASS_ON; } @@ -64,7 +64,7 @@ _ecore_evas_psl1ght_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, 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; } @@ -98,6 +98,19 @@ _ecore_evas_psl1ght_event_key_modifiers(void *data __UNUSED__, int type __UNUSED return ECORE_CALLBACK_PASS_ON; } +static Eina_Bool +_ecore_evas_psl1ght_event_quit (void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + ee = _ecore_evas_psl1ght_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (ee->func.fn_delete_request) + ee->func.fn_delete_request(ee); + return ECORE_CALLBACK_PASS_ON; +} + static int _ecore_evas_render(Ecore_Evas *ee) { @@ -170,10 +183,21 @@ _ecore_evas_psl1ght_init(int w __UNUSED__, int h __UNUSED__) ecore_event_evas_init(); - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, _ecore_evas_psl1ght_event_got_focus, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, _ecore_evas_psl1ght_event_lost_focus, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, _ecore_evas_psl1ght_event_video_expose, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, _ecore_evas_psl1ght_event_key_modifiers, NULL); + ecore_evas_event_handlers[0] = + ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, + _ecore_evas_psl1ght_event_got_focus, NULL); + ecore_evas_event_handlers[1] = + ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, + _ecore_evas_psl1ght_event_lost_focus, NULL); + ecore_evas_event_handlers[2] = + ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, + _ecore_evas_psl1ght_event_video_expose, NULL); + ecore_evas_event_handlers[3] = + ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, + _ecore_evas_psl1ght_event_key_modifiers, NULL); + ecore_evas_event_handlers[4] = + ecore_event_handler_add(ECORE_PSL1GHT_EVENT_QUIT, + _ecore_evas_psl1ght_event_quit, NULL); return _ecore_evas_init_count; } @@ -209,6 +233,12 @@ _ecore_evas_psl1ght_free(Ecore_Evas *ee) } static void +_ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + ee->func.fn_delete_request = func; +} + +static void _ecore_evas_screen_resized(Ecore_Evas *ee) { int w, h; @@ -324,7 +354,7 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = NULL, NULL, NULL, - NULL, + _ecore_evas_psl1ght_callback_delete_request_set, NULL, NULL, NULL, 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 b333d96..a3be2c7 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c @@ -15,6 +15,9 @@ # endif #endif +#include +#include + #include "ecore_evas_private.h" #include "Ecore_Evas.h" diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c index 95b6d22..839f0c8 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include @@ -115,15 +116,16 @@ _ecore_evas_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj _ } static void -_ecore_evas_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +_ecore_evas_obj_callback_resize(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__) { Ecore_Evas *ee = data; - Evas_Coord ow, oh, w, h; + Evas_Coord ow, oh, fw, fh; evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); - ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); - /*if ((w != ow) || (h != oh))*/ /* avoid recursion on ecore_evas_resize side */ - ecore_evas_resize(ee, ow, oh); + evas_output_framespace_get(e, NULL, NULL, &fw, &fh); + ow += fw; + oh += fh; + ecore_evas_resize(ee, ow, oh); } static void 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 new file mode 100644 index 0000000..72e8555 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -0,0 +1,1131 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#define LOGFNS 1 + +#ifdef LOGFNS +# include +# define LOGFN(fl, ln, fn) \ + printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); +#else +# define LOGFN(fl, ln, fn) +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL +# include +# include +# include +# include +# include +#endif + +#include +#include +#include + +#include "ecore_evas_private.h" +#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 +{ + Evas_Object *frame, *text; + Evas_Coord x, y, w, h; +}; + +/* local function prototypes */ +static int _ecore_evas_wl_init(void); +static int _ecore_evas_wl_shutdown(void); +static void _ecore_evas_wl_pre_free(Ecore_Evas *ee); +static void _ecore_evas_wl_free(Ecore_Evas *ee); +static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +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_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_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 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__); + +/* SMART stuff for frame */ +static Evas_Smart *_ecore_evas_wl_smart = NULL; + +static void _ecore_evas_wl_smart_init(void); +static void _ecore_evas_wl_smart_add(Evas_Object *obj); +static void _ecore_evas_wl_smart_del(Evas_Object *obj); +static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _ecore_evas_wl_smart_show(Evas_Object *obj); +static void _ecore_evas_wl_smart_hide(Evas_Object *obj); + +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_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_fullscreen_set, + NULL, // _ecore_evas_wl_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_render, + _ecore_evas_wl_screen_geometry_get +}; + +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_EGL +EAPI Ecore_Evas * +ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame) +{ + 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"))) + { + printf("Render method lookup failed for Wayland Egl"); + return NULL; + } + + if (!ecore_wl_init(disp_name)) + { + printf("Failed to initialize Ecore Wayland"); + return NULL; + } + + if (!(ee = calloc(1, sizeof(Ecore_Evas)))) + { + printf("Failed to allocate Ecore_Evas."); + ecore_wl_shutdown(); + return NULL; + } + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_wl_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; + + ee->driver = "wayland_egl"; + if (disp_name) ee->name = strdup(disp_name); + + 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->rotation = 0; + ee->prop.max.w = 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); + evas_output_method_set(ee->evas, method); + 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) + evas_output_framespace_set(ee->evas, 4, 18, 8, 22); + + if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) + { + einfo->info.display = ecore_wl_display_get(); + einfo->info.rotation = ee->rotation; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + printf("Failed to set Evas Engine Info for '%s'.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + printf("Failed to get Evas Engine Info for '%s'.", ee->driver); + ecore_evas_free(ee); + 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) + { + ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas); + evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE); + evas_object_move(ee->engine.wl.frame, 0, 0); + } + + ecore_evas_input_event_register(ee); + _ecore_evas_register(ee); + + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + + return ee; +} + +/* local functions */ +static int +_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_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, + _ecore_evas_wl_event_mouse_in, NULL); + _ecore_evas_wl_event_handlers[5] = + ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, + _ecore_evas_wl_event_mouse_out, NULL); + _ecore_evas_wl_event_handlers[6] = + ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, + _ecore_evas_wl_event_focus_in, NULL); + _ecore_evas_wl_event_handlers[7] = + ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, + _ecore_evas_wl_event_focus_out, NULL); + + ecore_event_evas_init(); + + return _ecore_evas_wl_init_count; +} + +static int +_ecore_evas_wl_shutdown(void) +{ + unsigned int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + 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++) + { + if (_ecore_evas_wl_event_handlers[i]) + ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); + } + + ecore_event_evas_shutdown(); + + return _ecore_evas_wl_init_count; +} + +static void +_ecore_evas_wl_pre_free(Ecore_Evas *ee) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); +} + +static void +_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; + + /* 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_evas_wl_shutdown(); + ecore_wl_shutdown(); +} + +static void +_ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_resize = func; +} + +static void +_ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_move = func; +} + +static void +_ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_delete_request = func; +} + +static void +_ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_focus_in = func; +} + +static void +_ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_focus_out = func; +} + +static void +_ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_mouse_in = 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->func.fn_move) ee->func.fn_move(ee); +} + +static void +_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; + + 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); */ + /* } */ + + ee->w = w; + ee->h = h; + +// ecore_wl_flush(); + + 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); */ + + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_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); + + /* 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); + + /* create new shell surface */ + ee->engine.wl.shell_surface = + wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); + + /* set the engine surface here. This should trigger an egl window create */ + einfo->info.surface = ee->engine.wl.surface; + 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(); + + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); +} + +static void +_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); + + /* 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; + + ee->visible = 0; + ee->should_be_visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); +} + +static void +_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); +} + +static void +_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) +{ + 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 ((ee->prop.draw_frame) && (ee->engine.wl.frame)) + { + EE_Wl_Smart_Data *sd; + + if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return; + evas_object_text_text_set(sd->text, ee->prop.title); + } +} + +static void +_ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.name) free(ee->prop.name); + if (ee->prop.clas) free(ee->prop.clas); + ee->prop.name = NULL; + ee->prop.clas = NULL; + if (n) ee->prop.name = strdup(n); + if (c) ee->prop.clas = strdup(c); + /* FIXME: Forward these changes to Wayland somehow */ +} + +static void +_ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; + ee->prop.min.w = w; + ee->prop.min.h = h; +} + +static void +_ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; + ee->prop.max.w = w; + ee->prop.max.h = h; +} + +static void +_ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; + ee->prop.base.w = w; + ee->prop.base.h = h; +} + +static void +_ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; + ee->prop.step.w = w; + ee->prop.step.h = h; +} + +static void +_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + 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); +} + +static void +_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + if (!(ee = data)) return; + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) +{ + 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; +} + +static void +_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) +{ + 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_iconified_set(Ecore_Evas *ee, int iconify) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.iconified == iconify) return; + ee->prop.iconified = iconify; + /* FIXME: Implement this in Wayland someshow */ +} + +static void +_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.maximized == max) return; + ee->prop.maximized = max; + /* FIXME: Implement this in Wayland someshow */ +} + +static void +_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) +{ + 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); +} + +static int +_ecore_evas_wl_render(Ecore_Evas *ee) +{ + int rend = 0; + + if (!ee) return 0; + if (!ee->visible) + evas_norender(ee->evas); + else + { + Eina_List *ll = NULL, *updates = NULL; + Ecore_Evas *ee2 = NULL; + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if ((updates = evas_render_updates(ee->evas))) + { + /* if (ee->engine.wl.surface) */ + /* { */ + /* Eina_List *l = NULL; */ + /* Eina_Rectangle *r; */ + + /* EINA_LIST_FOREACH(updates, l, r) */ + /* wl_surface_damage(ee->engine.wl.surface, */ + /* r->x, r->y, r->w, r->h); */ + /* } */ + + 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; +} + +static void +_ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (x) *x = 0; + if (y) *y = 0; + 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) +{ + 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; +} + +static Eina_Bool +_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Mouse_In *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; + 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); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Mouse_Out *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; + 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); + 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 *ee; + Ecore_Wl_Event_Focus_In *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; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Focus_Out *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_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) +{ + Ecore_Evas *ee; + + /* NB: Trap to prevent compositor from crashing */ + if ((width <= 0) || (height <= 0)) return; + + if (!(ee = data)) return; + + printf("EGL Handle Configure Message\n"); + 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_smart_init(void) +{ + if (_ecore_evas_wl_smart) return; + { + static const Evas_Smart_Class sc = + { + "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, + _ecore_evas_wl_smart_add, + _ecore_evas_wl_smart_del, + NULL, + _ecore_evas_wl_smart_resize, + _ecore_evas_wl_smart_show, + _ecore_evas_wl_smart_hide, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + }; + _ecore_evas_wl_smart = evas_smart_class_new(&sc); + } +} + +static void +_ecore_evas_wl_smart_add(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + Evas *evas; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return; + + evas = evas_object_evas_get(obj); + + sd->x = 0; + sd->y = 0; + sd->w = 1; + sd->h = 1; + + sd->frame = evas_object_rectangle_add(evas); + evas_object_is_frame_object_set(sd->frame, EINA_TRUE); + evas_object_color_set(sd->frame, 249, 249, 249, 255); + evas_object_smart_member_add(sd->frame, obj); + + sd->text = evas_object_text_add(evas); + evas_object_color_set(sd->text, 0, 0, 0, 255); + evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(sd->text, "Sans", 10); + evas_object_text_text_set(sd->text, "Smart Test"); + + evas_object_smart_data_set(obj, sd); +} + +static void +_ecore_evas_wl_smart_del(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + evas_object_del(sd->text); + evas_object_del(sd->frame); + free(sd); +} + +static void +_ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + if ((sd->w == w) && (sd->h == h)) return; + sd->w = w; + sd->h = h; + evas_object_resize(sd->frame, w, h); +} + +static void +_ecore_evas_wl_smart_show(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + evas_object_show(sd->frame); + evas_object_show(sd->text); +} + +static void +_ecore_evas_wl_smart_hide(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + evas_object_hide(sd->text); + evas_object_hide(sd->frame); +} + +static Evas_Object * +_ecore_evas_wl_frame_add(Evas *evas) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_evas_wl_smart_init(); + 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__) +{ + return NULL; +} +#endif 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 new file mode 100644 index 0000000..e3b15c8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c @@ -0,0 +1,1257 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +//#define LOGFNS 1 + +#ifdef LOGFNS +# include +# define LOGFN(fl, ln, fn) \ + printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); +#else +# define LOGFN(fl, ln, fn) +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM +# include +# include +# include +# include +# include +#endif + +# include +# include +# include + +# include "ecore_evas_private.h" +# include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM +# include +# include + +/* local structures */ +typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; +struct _EE_Wl_Smart_Data +{ + Evas_Object *frame; + Evas_Object *text; + Evas_Coord x, y, w, h; +}; + +/* local function prototypes */ +static int _ecore_evas_wl_init(void); +static int _ecore_evas_wl_shutdown(void); +static void _ecore_evas_wl_pre_free(Ecore_Evas *ee); +static void _ecore_evas_wl_free(Ecore_Evas *ee); +static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); +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_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_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 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__); + +/* SMART stuff for frame */ +static Evas_Smart *_ecore_evas_wl_smart = NULL; + +static void _ecore_evas_wl_smart_init(void); +static void _ecore_evas_wl_smart_add(Evas_Object *obj); +static void _ecore_evas_wl_smart_del(Evas_Object *obj); +static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); +static void _ecore_evas_wl_smart_show(Evas_Object *obj); +static void _ecore_evas_wl_smart_hide(Evas_Object *obj); + +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_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, + 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_render, + _ecore_evas_wl_screen_geometry_get +}; + +/* external variables */ +#endif + +#ifdef BUILD_ECORE_EVAS_WAYLAND_SHM +EAPI Ecore_Evas * +ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame) +{ + 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"))) + { + ERR("Render method lookup failed."); + return NULL; + } + + if (!(ecore_wl_init(disp_name))) + { + ERR("Failed to initialize Ecore Wayland."); + return NULL; + } + + if (!(ee = calloc(1, sizeof(Ecore_Evas)))) + { + ERR("Failed to allocate Ecore_Evas."); + ecore_wl_shutdown(); + return NULL; + } + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_wl_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; + + ee->driver = "wayland_shm"; + if (disp_name) ee->name = strdup(disp_name); + + 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->rotation = 0; + ee->prop.max.w = 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); + evas_output_method_set(ee->evas, method); + 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) + evas_output_framespace_set(ee->evas, 4, 18, 8, 22); + + 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)) + { + ERR("Failed to set Evas Engine Info for '%s'.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("Failed to get Evas Engine Info for '%s'.", ee->driver); + ecore_evas_free(ee); + 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) + { + ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas); + evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE); + evas_object_move(ee->engine.wl.frame, 0, 0); + } + + ecore_evas_input_event_register(ee); + _ecore_evas_register(ee); + + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + + return ee; +} + +/* local functions */ +static int +_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_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, + _ecore_evas_wl_event_mouse_in, NULL); + _ecore_evas_wl_event_handlers[5] = + ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, + _ecore_evas_wl_event_mouse_out, NULL); + _ecore_evas_wl_event_handlers[6] = + ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, + _ecore_evas_wl_event_focus_in, NULL); + _ecore_evas_wl_event_handlers[7] = + ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, + _ecore_evas_wl_event_focus_out, NULL); + + ecore_event_evas_init(); + + return _ecore_evas_wl_init_count; +} + +static int +_ecore_evas_wl_shutdown(void) +{ + unsigned int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + 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++) + { + if (_ecore_evas_wl_event_handlers[i]) + ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); + } + + ecore_event_evas_shutdown(); + + return _ecore_evas_wl_init_count; +} + +static void +_ecore_evas_wl_pre_free(Ecore_Evas *ee) +{ + Evas_Engine_Info_Wayland_Shm *einfo; + + 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)); + } +} + +static void +_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; + + ecore_event_window_unregister(ee->prop.window); + ecore_evas_input_event_unregister(ee); + + _ecore_evas_wl_shutdown(); + ecore_wl_shutdown(); +} + +static void +_ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_resize = func; +} + +static void +_ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_move = func; +} + +static void +_ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_delete_request = func; +} + +static void +_ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_focus_in = func; +} + +static void +_ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_focus_out = func; +} + +static void +_ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + ee->func.fn_mouse_in = 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->func.fn_move) ee->func.fn_move(ee); +} + +static void +_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; + + 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); + } + + /* get engine info */ + einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); + if (einfo->info.dest) + { + int ret = 0; + + /* munmap previous engine destination */ + ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); + } + + /* 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 */ + 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); + + /* set new engine destination */ + 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); + + if (ee->visible) + { + /* damage surface */ + wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); + + /* if visible, attach to surface */ + wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0); + } + + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_wl_show(Ecore_Evas *ee) +{ + Evas_Engine_Info_Wayland_Shm *einfo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (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); + + /* 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); + + /* create buffer @ new size (also mmaps the new destination) */ + _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); + + 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); */ + + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); +} + +static void +_ecore_evas_wl_hide(Ecore_Evas *ee) +{ + Evas_Engine_Info_Wayland_Shm *einfo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (!ee->visible) return; + + /* get engine info */ + einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); + if (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; + } + + /* 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; + + ee->visible = 0; + ee->should_be_visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); +} + +static void +_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); +} + +static void +_ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) +{ + 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 ((ee->prop.draw_frame) && (ee->engine.wl.frame)) + { + EE_Wl_Smart_Data *sd; + + if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return; + evas_object_text_text_set(sd->text, ee->prop.title); + } +} + +static void +_ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.name) free(ee->prop.name); + if (ee->prop.clas) free(ee->prop.clas); + ee->prop.name = NULL; + ee->prop.clas = NULL; + if (n) ee->prop.name = strdup(n); + if (c) ee->prop.clas = strdup(c); + /* FIXME: Forward these changes to Wayland somehow */ +} + +static void +_ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; + ee->prop.min.w = w; + ee->prop.min.h = h; +} + +static void +_ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; + ee->prop.max.w = w; + ee->prop.max.h = h; +} + +static void +_ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; + ee->prop.base.w = w; + ee->prop.base.h = h; +} + +static void +_ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; + ee->prop.step.w = w; + ee->prop.step.h = h; +} + +static void +_ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + 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); +} + +static void +_ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + if (!(ee = data)) return; + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) +{ + 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; +} + +static void +_ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) +{ + 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_iconified_set(Ecore_Evas *ee, int iconify) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.iconified == iconify) return; + ee->prop.iconified = iconify; + /* FIXME: Implement this in Wayland someshow */ +} + +static void +_ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.maximized == max) return; + ee->prop.maximized = max; + /* FIXME: Implement this in Wayland someshow */ +} + +static void +_ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) +{ + 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); +} + +static int +_ecore_evas_wl_render(Ecore_Evas *ee) +{ + int rend = 0; + + if (!ee) return 0; + if (!ee->visible) + evas_norender(ee->evas); + else + { + Eina_List *ll = NULL, *updates = NULL; + Ecore_Evas *ee2 = NULL; + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if ((updates = evas_render_updates(ee->evas))) + { + Eina_List *l = NULL; + Eina_Rectangle *r; + + 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); + } + + 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; +} + +static void +_ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (x) *x = 0; + if (y) *y = 0; + 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) +{ + 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; +} + +static Eina_Bool +_ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Mouse_In *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; + 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); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Mouse_Out *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; + 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); + 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 *ee; + Ecore_Wl_Event_Focus_In *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; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Wl_Event_Focus_Out *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_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) +{ + 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; + + 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) + { + ERR("Could not truncate temporary file."); + close(fd); + return; + } + + ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); + unlink(tmp); + + if (ret == MAP_FAILED) + { + ERR("mmap of temporary file failed."); + close(fd); + return; + } + + 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 void +_ecore_evas_wl_smart_init(void) +{ + if (_ecore_evas_wl_smart) return; + { + static const Evas_Smart_Class sc = + { + "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, + _ecore_evas_wl_smart_add, + _ecore_evas_wl_smart_del, + NULL, + _ecore_evas_wl_smart_resize, + _ecore_evas_wl_smart_show, + _ecore_evas_wl_smart_hide, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + }; + _ecore_evas_wl_smart = evas_smart_class_new(&sc); + } +} + +static void +_ecore_evas_wl_smart_add(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + Evas *evas; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return; + + evas = evas_object_evas_get(obj); + + sd->x = 0; + sd->y = 0; + sd->w = 1; + sd->h = 1; + + sd->frame = evas_object_rectangle_add(evas); + evas_object_is_frame_object_set(sd->frame, EINA_TRUE); + evas_object_color_set(sd->frame, 249, 249, 249, 255); + evas_object_smart_member_add(sd->frame, obj); + + sd->text = evas_object_text_add(evas); + evas_object_color_set(sd->text, 0, 0, 0, 255); + evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(sd->text, "Sans", 10); + evas_object_text_text_set(sd->text, "Smart Test"); + + evas_object_smart_data_set(obj, sd); +} + +static void +_ecore_evas_wl_smart_del(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + evas_object_del(sd->text); + evas_object_del(sd->frame); + free(sd); +} + +static void +_ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + if ((sd->w == w) && (sd->h == h)) return; + sd->w = w; + sd->h = h; + evas_object_resize(sd->frame, w, h); +} + +static void +_ecore_evas_wl_smart_show(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + evas_object_show(sd->frame); + evas_object_show(sd->text); +} + +static void +_ecore_evas_wl_smart_hide(Evas_Object *obj) +{ + EE_Wl_Smart_Data *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + evas_object_hide(sd->text); + evas_object_hide(sd->frame); +} + +static Evas_Object * +_ecore_evas_wl_frame_add(Evas *evas) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_evas_wl_smart_init(); + 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__) +{ + return NULL; +} +#endif 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 2ca7cb0..cfec528 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c @@ -147,9 +147,9 @@ _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); /* FIXME to do */ /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - evas_event_feed_mouse_in(ee->evas, e->time, NULL); + evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL); evas_focus_in(ee->evas); - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); return 1; } @@ -169,9 +169,9 @@ _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo /* FIXME to do */ /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); - evas_event_feed_mouse_out(ee->evas, e->time, NULL); + evas_event_feed_mouse_out(ee->evas, e->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); 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 d9ccd6e..7d3af12 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c @@ -1,4 +1,13 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include #include + +#include +#include + #include "ecore_evas_private.h" #include "Ecore_Evas.h" @@ -731,10 +740,14 @@ _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *e // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) // return 0; /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ - if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); - ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); - evas_event_feed_mouse_in(ee->evas, e->time, NULL); - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + if (!ee->in) + { + if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); + ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); + evas_event_feed_mouse_in(ee->evas, e->time, NULL); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + ee->in = EINA_TRUE; + } return ECORE_CALLBACK_PASS_ON; } @@ -783,13 +796,23 @@ _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void * // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) // return 0; /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ - ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); - _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); - if (e->mode == ECORE_X_EVENT_MODE_GRAB) - evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); - evas_event_feed_mouse_out(ee->evas, e->time, 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); +// printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n", +// ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas)); + if (ee->in) + { + if ((evas_event_down_count_get(ee->evas) > 0) && + (!((e->mode == ECORE_X_EVENT_MODE_GRAB) && + (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)))) + return ECORE_CALLBACK_PASS_ON; + ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + if (e->mode == ECORE_X_EVENT_MODE_GRAB) + evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); + evas_event_feed_mouse_out(ee->evas, e->time, 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); + ee->in = EINA_FALSE; + } return ECORE_CALLBACK_PASS_ON; } @@ -1023,6 +1046,14 @@ _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void ee = ecore_event_window_match(e->win); if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ee->in) + { + evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); + evas_event_feed_mouse_out(ee->evas, e->time, 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); + ee->in = EINA_FALSE; + } if (!ee->visible) return ECORE_CALLBACK_PASS_ON; // if (!ee->visible) return ECORE_CALLBACK_DONE; // printf("HIDE EVENT %p\n", ee); diff --git a/libraries/ecore/src/lib/ecore_fb/Makefile.in b/libraries/ecore/src/lib/ecore_fb/Makefile.in index b37120f..c0c30a5 100644 --- a/libraries/ecore/src/lib/ecore_fb/Makefile.in +++ b/libraries/ecore/src/lib/ecore_fb/Makefile.in @@ -249,10 +249,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -271,6 +271,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -384,6 +388,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -396,6 +402,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -440,12 +448,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c index 4a196dd..3850792 100644 --- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c @@ -2,6 +2,8 @@ # include #endif +#include + #include "Ecore_Fb.h" #include "ecore_fb_private.h" @@ -452,9 +454,9 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen) #endif /** - * @brief Associates an input device with the given @ref Ecore_Evas. + * @brief Associates an input device with the given @ref Ecore_Evas_Group. * - * @param dev The input being associated with an @ref Ecore_Evas (not @c NULL). + * @param dev The input being associated with an @ref Ecore_Evas_Group (not @c NULL). * @param window The window which this input is being associated to. * @c NULL will remove any previous association. * @@ -475,7 +477,7 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen) * @endcode * * On the previous code, all input captured on the mentioned device will be - * delivered to the @Ecore_Evas @c ee. + * delivered to the @c Ecore_Evas @c ee. * * @since 1.1 */ diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h b/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h index 3e908a0..797f863 100644 --- a/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h @@ -6,6 +6,7 @@ #include "Ecore_Input.h" #include +#include #include #include #include @@ -30,6 +31,8 @@ #include #include +#include + /* ecore_fb_li.c */ struct _Ecore_Fb_Input_Device { diff --git a/libraries/ecore/src/lib/ecore_file/Makefile.in b/libraries/ecore/src/lib/ecore_file/Makefile.in index 34945b3..04e0bf1 100644 --- a/libraries/ecore/src/lib/ecore_file/Makefile.in +++ b/libraries/ecore/src/lib/ecore_file/Makefile.in @@ -250,10 +250,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -272,6 +272,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -385,6 +389,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -397,6 +403,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -441,12 +449,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file.c b/libraries/ecore/src/lib/ecore_file/ecore_file.c index 2546f2f..cfbf2b5 100644 --- a/libraries/ecore/src/lib/ecore_file/ecore_file.c +++ b/libraries/ecore/src/lib/ecore_file/ecore_file.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include @@ -597,11 +598,7 @@ ecore_file_mv(const char *src, const char *dst) dir, ecore_file_file_get(dst)); free(dir); fd = mkstemp(buf); - if (fd < 0) - { - perror("mkstemp"); - goto FAIL; - } + if (fd < 0) goto FAIL; close(fd); // Copy to temp file @@ -761,7 +758,7 @@ ecore_file_can_write(const char *file) } /** - * @bbrief Check if the given file can be executed. + * @brief Check if the given file can be executed. * * @param file The name of the file. * @return EINA_TRUE if the file can be executed, EINA_FALSE otherwise. @@ -859,7 +856,7 @@ ecore_file_app_exe_get(const char *app) p = (char *)app; restart: - while ((*p) && (isspace(*p))) p++; + while ((*p) && (isspace((unsigned char)*p))) p++; exe1 = p; while (*p) { @@ -879,7 +876,7 @@ restart: in_quot_sing = 1; else if (*p == '\"') in_quot_dbl = 1; - if ((isspace(*p)) && (!((p > app) && (p[-1] != '\\')))) + if ((isspace((unsigned char)*p)) && ((p <= app) || (p[-1] == '\\'))) break; } p++; @@ -974,7 +971,7 @@ restart: in_quot_sing = 1; else if (*p == '\"') in_quot_dbl = 1; - else if (isspace(*p)) + else if (isspace((unsigned char)*p)) { if (restart) goto restart; @@ -1040,7 +1037,7 @@ ecore_file_escape_name(const char *filename) } /** - * @bried Remove the extension from the given file name. + * @brief Remove the extension from the given file name. * * @param path The name of the file. * @return A newly allocated string with the extension stripped out or 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 c7efc4d..c5e56bd 100644 --- a/libraries/ecore/src/lib/ecore_file/ecore_file_download.c +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_download.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include @@ -14,6 +15,7 @@ #ifdef BUILD_ECORE_CON #define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8 +#define ECORE_FILE_DOWNLOAD_TIMEOUT 30 struct _Ecore_File_Download_Job { @@ -360,6 +362,7 @@ _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_file/ecore_file_monitor_inotify.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c index c3533ad..efdd8c2 100644 --- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include #include diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c index 1f71b55..49bfcb6 100644 --- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c @@ -2,6 +2,7 @@ # include #endif +#include #include #include diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_path.c b/libraries/ecore/src/lib/ecore_file/ecore_file_path.c index ade3bc6..f5294b7 100644 --- a/libraries/ecore/src/lib/ecore_file/ecore_file_path.c +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_path.c @@ -20,6 +20,7 @@ extern "C" void *alloca (size_t); #endif +#include #include #include @@ -85,7 +86,7 @@ _ecore_file_path_from_env(const char *env) /** * @brief Check if the given directory is in PATH. * - * @param The name of the directory to search in PATH. + * @param in_dir The name of the directory to search in PATH. * @return EINA_TRUE if the directory exist in PATH, EINA_FALSE otherwise. * * This function checks if @p in_dir is in the environment variable diff --git a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h index 21df2a0..adea35d 100644 --- a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h +++ b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h @@ -64,6 +64,17 @@ EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED; EAPI extern int ECORE_IMF_EVENT_COMMIT; EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING; +typedef void (*Ecore_IMF_Event_Cb) (void *data, Ecore_IMF_Context *ctx, void *event_info); + +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_Type; + typedef enum { ECORE_IMF_EVENT_MOUSE_DOWN, @@ -138,7 +149,10 @@ typedef enum ECORE_IMF_INPUT_PANEL_LAYOUT_IP, /**< IP layout */ ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */ ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */ - ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID + ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this */ + ECORE_IMF_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout @since 1.2 */ + ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout @since 1.2 */ + ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */ } Ecore_IMF_Input_Panel_Layout; typedef enum @@ -385,6 +399,9 @@ EAPI void ecore_imf_context_preedit_end_event_add(Ecore EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str); EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars); +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); +EAPI void *ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func); +EAPI void ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info); EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction); EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type); diff --git a/libraries/ecore/src/lib/ecore_imf/Makefile.in b/libraries/ecore/src/lib/ecore_imf/Makefile.in index adf8dea..9f91360 100644 --- a/libraries/ecore/src/lib/ecore_imf/Makefile.in +++ b/libraries/ecore/src/lib/ecore_imf/Makefile.in @@ -248,10 +248,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -270,6 +270,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -383,6 +387,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -395,6 +401,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -439,12 +447,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ 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 417fad3..b65ee26 100644 --- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c +++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c @@ -223,6 +223,8 @@ ecore_imf_context_info_get(Ecore_IMF_Context *ctx) EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx) { + Ecore_IMF_Func_Node *fn; + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, @@ -230,6 +232,13 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx) return; } if (ctx->klass->del) ctx->klass->del(ctx); + + if (ctx->callbacks) + { + EINA_LIST_FREE(ctx->callbacks, fn) + free(fn); + } + ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); free(ctx); } @@ -529,7 +538,7 @@ ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int /** * Set whether the IM context should use the preedit string - * to display feedback. If @use_preedit is EINA_FALSE (default + * to display feedback. If @c use_preedit is EINA_FALSE (default * is EINA_TRUE), then the IM context may use some other method to display * feedback, such as displaying it in a child of the root window. * @@ -551,7 +560,7 @@ ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit) /** * Set whether the IM context should allow to use the text prediction. - * If @prediction is EINA_FALSE (default is EINA_TRUE), then the IM context will not display the text prediction window. + * If @c prediction is EINA_FALSE (default is EINA_TRUE), then the IM context will not display the text prediction window. * * @param ctx An #Ecore_IMF_Context. * @param prediction Whether the IM context should allow to use the text prediction. @@ -1016,6 +1025,134 @@ ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offse } /** + * Add (register) a callback function to a given context event. + * + * This function adds a function callback to the context @p ctx when the + * event of type @p type occurs on it. The function pointer is @p + * func. + * + * The event type @p type to trigger the function may be one of + * #ECORE_IMF_CALLBACK_PREEDIT_START, #ECORE_IMF_CALLBACK_PREEDIT_END, + * #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT and + * #ECORE_IMF_CALLBACK_DELETE_SURROUNDING. + * + * @param ctx Ecore_IMF_Context to attach a callback to. + * @param type The type of event that will trigger the callback + * @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 + * @since 1.2.0 + */ +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) +{ + Ecore_IMF_Func_Node *fn = NULL; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_event_callback_add"); + return; + } + + if (!func) return; + + fn = calloc(1, sizeof (Ecore_IMF_Func_Node)); + if (!fn) return; + + fn->func = func; + fn->data = data; + fn->type = type; + + ctx->callbacks = eina_list_append(ctx->callbacks, fn); +} + +/** + * Delete (unregister) a callback function registered to a given + * context event. + * + * This function removes a function callback from the context @p ctx when the + * event of type @p type occurs on it. The function pointer is @p + * func. + * + * @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 func The (callback) function that was to be called when the event was triggered + * @return the data pointer + * @ingroup Ecore_IMF_Context_Module_Group + * @since 1.2.0 + */ +EAPI void * +ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func) +{ + Eina_List *l = NULL; + Eina_List *l_next = NULL; + Ecore_IMF_Func_Node *fn = NULL; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_event_callback_del"); + return; + } + + if (!func) return NULL; + if (!ctx->callbacks) return NULL; + + EINA_LIST_FOREACH_SAFE(ctx->callbacks, l, l_next, fn) + { + if ((fn) && (fn->func == func) && (fn->type == type)) + { + void *tmp = fn->data; + free(fn); + ctx->callbacks = eina_list_remove_list(ctx->callbacks, l); + return tmp; + } + } + return NULL; +} + +/** + * Call a given callback on the context @p ctx. + * + * ecore_imf_context_preedit_start_event_add, ecore_imf_context_preedit_end_event_add, + * ecore_imf_context_preedit_changed_event_add, ecore_imf_context_commit_event_add and + * ecore_imf_context_delete_surrounding_event_add APIs are asynchronous + * because those API adds each event to the event queue. + * + * This API provides the way to call each callback function immediately. + * + * @param ctx Ecore_IMF_Context. + * @param type The type of event that will trigger the callback + * @param event_info The pointer to event specific struct or information to + * pass to the callback functions registered on this event + * @ingroup Ecore_IMF_Context_Module_Group + * @since 1.2.0 + */ +EAPI void +ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info) +{ + Ecore_IMF_Func_Node *fn = NULL; + Eina_List *l = NULL; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_event_callback_call"); + return; + } + + EINA_LIST_FOREACH(ctx->callbacks, l, fn) + { + if ((fn) && (fn->type == type) && (fn->func)) + fn->func(fn->data, ctx, event_info); + } +} + +/** * Ask the Input Method Context to show the control panel of using Input Method. * * @param ctx An #Ecore_IMF_Context. 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 07a5b09..d9dae80 100644 --- a/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h +++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h @@ -35,6 +35,7 @@ extern int _ecore_imf_log_dom; #define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_imf_log_dom, __VA_ARGS__) typedef struct _Ecore_IMF_Module Ecore_IMF_Module; +typedef struct _Ecore_IMF_Func_Node Ecore_IMF_Func_Node; struct _Ecore_IMF_Context { @@ -47,6 +48,7 @@ struct _Ecore_IMF_Context void *client_canvas; Eina_Bool (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos); void *retrieve_surrounding_data; + Eina_List *callbacks; Ecore_IMF_Autocapital_Type autocapital_type; Ecore_IMF_Input_Panel_Layout input_panel_layout; Ecore_IMF_Input_Panel_Lang input_panel_lang; @@ -61,6 +63,13 @@ struct _Ecore_IMF_Module Ecore_IMF_Context *(*exit)(void); }; +struct _Ecore_IMF_Func_Node +{ + void (*func) (); + const void *data; + Ecore_IMF_Callback_Type type; +}; + void ecore_imf_module_init(void); void ecore_imf_module_shutdown(void); Eina_List *ecore_imf_module_available_get(void); diff --git a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in index 9b26915..ab6503b 100644 --- a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in +++ b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in @@ -247,10 +247,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -269,6 +269,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -382,6 +386,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -394,6 +400,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -438,12 +446,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_input/Makefile.in b/libraries/ecore/src/lib/ecore_input/Makefile.in index dd4d663..f9fc99a 100644 --- a/libraries/ecore/src/lib/ecore_input/Makefile.in +++ b/libraries/ecore/src/lib/ecore_input/Makefile.in @@ -247,10 +247,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -269,6 +269,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -382,6 +386,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -394,6 +400,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -438,12 +446,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_input_evas/Makefile.in b/libraries/ecore/src/lib/ecore_input_evas/Makefile.in index 9097992..d0ac95e 100644 --- a/libraries/ecore/src/lib/ecore_input_evas/Makefile.in +++ b/libraries/ecore/src/lib/ecore_input_evas/Makefile.in @@ -248,10 +248,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -270,6 +270,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -383,6 +387,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -395,6 +401,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -439,12 +447,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c b/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c index 0cfe20a..53d206e 100644 --- a/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c @@ -3,6 +3,7 @@ #endif #include +#include #include "Ecore.h" #include "Ecore_Input.h" diff --git a/libraries/ecore/src/lib/ecore_ipc/Makefile.in b/libraries/ecore/src/lib/ecore_ipc/Makefile.in index 189e069..ac2cf6f 100644 --- a/libraries/ecore/src/lib/ecore_ipc/Makefile.in +++ b/libraries/ecore/src/lib/ecore_ipc/Makefile.in @@ -248,10 +248,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -270,6 +270,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -383,6 +387,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -395,6 +401,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -439,12 +447,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c index c17cadd..e27134d 100644 --- a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c +++ b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c @@ -926,7 +926,7 @@ ecore_ipc_client_data_get(Ecore_Ipc_Client *cl) /** * Sets the max data payload size for an Ipc message in bytes * - * @param client The given client. + * @param cl The given client. * @param size The maximum data payload size in bytes. * @ingroup Ecore_Ipc_Client_Group */ @@ -946,7 +946,6 @@ ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size) * Sets the max data payload size for an Ipc message in bytes * * @param cl The given client. - * @param size The maximum data payload size in bytes. * @ingroup Ecore_Ipc_Client_Group */ EAPI int diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h index 39331f7..c6300fd 100644 --- a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h +++ b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h @@ -28,6 +28,7 @@ EAPI extern int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS; EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS; EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS; EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE; +EAPI extern int ECORE_PSL1GHT_EVENT_QUIT; typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers; struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */ @@ -105,14 +106,10 @@ struct _Ecore_Psl1ght_Event_Mouse_Wheel /** PSL1GHT Mouse Wheel event */ unsigned int time; }; -EAPI int - ecore_psl1ght_init(const char *name); -EAPI int - ecore_psl1ght_shutdown(void); -EAPI void - ecore_psl1ght_resolution_set(int width, int height); -EAPI void - ecore_psl1ght_poll_events(void); +EAPI int ecore_psl1ght_init(const char *name); +EAPI int ecore_psl1ght_shutdown(void); +EAPI void ecore_psl1ght_resolution_set(int width, int height); +EAPI void ecore_psl1ght_poll_events(void); EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h); EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h); diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in index 9b75b74..487231b 100644 --- a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in +++ b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in @@ -249,10 +249,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -271,6 +271,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -384,6 +388,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -396,6 +402,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -440,12 +448,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c index 64cef9f..16487ad 100644 --- a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c +++ b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c @@ -31,6 +31,7 @@ EAPI int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0; EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0; EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0; EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0; +EAPI int ECORE_PSL1GHT_EVENT_QUIT = 0; static int _ecore_psl1ght_init_count = 0; static int window_width = 0; @@ -47,6 +48,7 @@ static KbMkey keyboard_mods = {{0}}; static u16 keyboard_old_key = 0; /* Pad support */ static padData pad_data; +static padData old_pad_data = {0}; static int pad_old_x = 0; static int pad_old_o = 0; /* Move support */ @@ -148,6 +150,7 @@ ecore_psl1ght_init(const char *name __UNUSED__) ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new(); ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new(); ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new(); + ECORE_PSL1GHT_EVENT_QUIT = ecore_event_type_new(); mouse_x = 0; mouse_y = 0; @@ -175,6 +178,7 @@ ecore_psl1ght_shutdown(void) ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0; ECORE_PSL1GHT_EVENT_EXPOSE = 0; ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0; + ECORE_PSL1GHT_EVENT_QUIT = 0; ioPadEnd(); ioMouseEnd(); @@ -354,7 +358,6 @@ _ecore_psl1ght_event_key(u16 key) ev->event_window = 0; ev->modifiers = _ecore_psl1ght_get_modifiers(); - printf ("Key is %X\n", key); key &= ~KB_KEYPAD; for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i) if (keystable[i].code == key) @@ -364,13 +367,11 @@ _ecore_psl1ght_event_key(u16 key) ev->string = keystable[i].compose; ev->compose = keystable[i].compose; - printf ("Found key '%s' in the table\n", ev->keyname); return ev; } utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key); unicodeToUtf8(utf16, utf8); - printf ("Converting to utf16 : %X - utf8 : %s\n", utf16, utf8); ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8); return ev; @@ -460,6 +461,30 @@ _ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt) ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); } +static void +_ecore_psl1ght_pad_button (const char *name, int pressed) +{ + Ecore_Event_Key *ev = NULL; + + ev = malloc(sizeof(Ecore_Event_Key)); + if (!ev) return; + + ev->timestamp = _ecore_psl1ght_get_time (); + ev->window = 0; + ev->event_window = 0; + ev->modifiers = 0; + + ev->keyname = name; + ev->key = name; + ev->string = ""; + ev->compose = ""; + + if (pressed) + ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); + else + ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); +} + #define PAD_STICK_DEADZONE 0x20 static void @@ -502,15 +527,44 @@ _ecore_psl1ght_poll_joypad(void) if (analog_h != 0 || analog_v != 0) _ecore_psl1ght_mouse_move (analog_h, analog_v); - if (pad_old_x != pad_data.BTN_CROSS) + if (old_pad_data.BTN_CROSS ^ pad_data.BTN_CROSS) { + _ecore_psl1ght_pad_button ("Cross", pad_data.BTN_CROSS); _ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS); - if (pad_old_o != pad_data.BTN_CIRCLE) + } + if (old_pad_data.BTN_CIRCLE ^ pad_data.BTN_CIRCLE) { + _ecore_psl1ght_pad_button ("Circle", pad_data.BTN_CIRCLE); _ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE); - - pad_old_x = pad_data.BTN_CROSS; - pad_old_o = pad_data.BTN_CIRCLE; - - //pad_buttons = paddata.buttons; + } + if (old_pad_data.BTN_SQUARE ^ pad_data.BTN_SQUARE) + _ecore_psl1ght_pad_button ("Square", pad_data.BTN_SQUARE); + if (old_pad_data.BTN_TRIANGLE ^ pad_data.BTN_TRIANGLE) + _ecore_psl1ght_pad_button ("Triangle", pad_data.BTN_TRIANGLE); + if (old_pad_data.BTN_UP ^ pad_data.BTN_UP) + _ecore_psl1ght_pad_button ("Up", pad_data.BTN_UP); + if (old_pad_data.BTN_DOWN ^ pad_data.BTN_DOWN) + _ecore_psl1ght_pad_button ("Down", pad_data.BTN_DOWN); + if (old_pad_data.BTN_LEFT ^ pad_data.BTN_LEFT) + _ecore_psl1ght_pad_button ("Left", pad_data.BTN_LEFT); + if (old_pad_data.BTN_RIGHT ^ pad_data.BTN_RIGHT) + _ecore_psl1ght_pad_button ("Right", pad_data.BTN_RIGHT); + if (old_pad_data.BTN_L1 ^ pad_data.BTN_L1) + _ecore_psl1ght_pad_button ("L1", pad_data.BTN_L1); + if (old_pad_data.BTN_L2 ^ pad_data.BTN_L2) + _ecore_psl1ght_pad_button ("L2", pad_data.BTN_L2); + if (old_pad_data.BTN_L3 ^ pad_data.BTN_L3) + _ecore_psl1ght_pad_button ("L3", pad_data.BTN_L3); + if (old_pad_data.BTN_R1 ^ pad_data.BTN_R1) + _ecore_psl1ght_pad_button ("R1", pad_data.BTN_R1); + if (old_pad_data.BTN_R2 ^ pad_data.BTN_R2) + _ecore_psl1ght_pad_button ("R2", pad_data.BTN_R2); + if (old_pad_data.BTN_R3 ^ pad_data.BTN_R3) + _ecore_psl1ght_pad_button ("R3", pad_data.BTN_R3); + if (old_pad_data.BTN_START ^ pad_data.BTN_START) + _ecore_psl1ght_pad_button ("Start", pad_data.BTN_START); + if (old_pad_data.BTN_SELECT ^ pad_data.BTN_SELECT) + _ecore_psl1ght_pad_button ("Select", pad_data.BTN_SELECT); + + old_pad_data = pad_data; } } } @@ -602,7 +656,7 @@ _ecore_psl1ght_poll_move(void) case 4: // Move button - printf ("Calibrating\n"); + //printf ("Calibrating\n"); gemCalibrate (0); calibrated = 1; break; @@ -717,23 +771,24 @@ _ecore_psl1ght_poll_keyboard(void) static void xmb_event_handler(u64 status, u64 param, void *user_data) { - printf ("Received event %lX\n", status); - if (status == SYSUTIL_EXIT_GAME) - { - ecore_main_loop_quit(); - } - else if (status == SYSUTIL_MENU_OPEN) - { - } - else if (status == SYSUTIL_MENU_CLOSE) - { - } - else if (status == SYSUTIL_DRAW_BEGIN) - { - } - else if (status == SYSUTIL_DRAW_END) - { - } + //printf ("Received event %lX\n", status); + switch (status) { + case SYSUTIL_EXIT_GAME: + ecore_event_add(ECORE_PSL1GHT_EVENT_QUIT, NULL, NULL, NULL); + break; + case SYSUTIL_DRAW_BEGIN: + ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL); + case SYSUTIL_MENU_OPEN: + ecore_event_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, NULL, NULL, NULL); + break; + case SYSUTIL_DRAW_END: + ecore_event_add(ECORE_PSL1GHT_EVENT_EXPOSE, NULL, NULL, NULL); + case SYSUTIL_MENU_CLOSE: + ecore_event_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, NULL, NULL, NULL); + break; + default: + break; + } } EAPI void diff --git a/libraries/ecore/src/lib/ecore_sdl/Makefile.in b/libraries/ecore/src/lib/ecore_sdl/Makefile.in index 0141ebe..c0312b0 100644 --- a/libraries/ecore/src/lib/ecore_sdl/Makefile.in +++ b/libraries/ecore/src/lib/ecore_sdl/Makefile.in @@ -248,10 +248,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -270,6 +270,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -383,6 +387,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -395,6 +401,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -439,12 +447,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h new file mode 100644 index 0000000..fdf6314 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h @@ -0,0 +1,123 @@ +#ifndef _ECORE_WAYLAND_H_ +# define _ECORE_WAYLAND_H_ + +# include +# include + +# ifdef EAPI +# undef EAPI +# endif + +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif + +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_Drag_Source Ecore_Wl_Drag_Source; + +typedef struct _Ecore_Wl_Event_Drag_Start Ecore_Wl_Event_Drag_Start; +typedef struct _Ecore_Wl_Event_Drag_Stop Ecore_Wl_Event_Drag_Stop; + +struct _Ecore_Wl_Event_Mouse_In +{ + int modifiers; + int x, y; + + struct + { + int x, y; + } root; + + unsigned int window; + + unsigned int time; +}; + +struct _Ecore_Wl_Event_Mouse_Out +{ + int modifiers; + int x, y; + + struct + { + int x, y; + } root; + + unsigned int window; + + unsigned int time; +}; + +struct _Ecore_Wl_Event_Focus_In +{ + unsigned int window; + /* TODO: mode & detail */ + unsigned int time; +}; + +struct _Ecore_Wl_Event_Focus_Out +{ + unsigned int window; + /* TODO: mode & detail */ + unsigned int time; +}; + +struct _Ecore_Wl_Event_Drag_Start +{ + struct wl_data_device *device; + struct wl_surface *surface; + const char *mime_type; + uint32_t timestamp; +}; + +struct _Ecore_Wl_Event_Drag_Stop +{ + +}; + +/** + * @file + * @brief Ecore functions for dealing with the Wayland window system + * + * 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 + */ + +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 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; + +#endif diff --git a/libraries/ecore/src/lib/ecore_wayland/Makefile.am b/libraries/ecore/src/lib/ecore_wayland/Makefile.am new file mode 100644 index 0000000..ea005b2 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wayland/Makefile.am @@ -0,0 +1,31 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@WAYLAND_CFLAGS@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_wayland.la +includes_HEADERS = Ecore_Wayland.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_wayland_la_SOURCES = \ +ecore_wl.c + +## ecore_wl_window.c + +libecore_wayland_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@WAYLAND_LIBS@ \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_wayland_la_LDFLAGS = -version-info @version_info@ @release_info@ +libecore_wayland_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la + +EXTRA_DIST = ecore_wl_private.h diff --git a/libraries/ecore/src/lib/ecore_wayland/Makefile.in b/libraries/ecore/src/lib/ecore_wayland/Makefile.in new file mode 100644 index 0000000..411da19 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wayland/Makefile.in @@ -0,0 +1,829 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_wayland +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.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 +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + 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 +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)) +am__v_lt_0 = --silent +libecore_wayland_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_wayland_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_wayland_la_SOURCES) +DIST_SOURCES = $(libecore_wayland_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SCIM_CFLAGS = @SCIM_CFLAGS@ +SCIM_LIBS = @SCIM_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@WAYLAND_CFLAGS@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_wayland.la +includes_HEADERS = Ecore_Wayland.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_wayland_la_SOURCES = \ +ecore_wl.c + +libecore_wayland_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@WAYLAND_LIBS@ \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_wayland_la_LDFLAGS = -version-info @version_info@ @release_info@ +libecore_wayland_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la +EXTRA_DIST = ecore_wl_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_wayland/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_wayland/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_wayland.la: $(libecore_wayland_la_OBJECTS) $(libecore_wayland_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_wayland_la_LINK) -rpath $(libdir) $(libecore_wayland_la_OBJECTS) $(libecore_wayland_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wl.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c b/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c new file mode 100644 index 0000000..f62503b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wayland/ecore_wl.c @@ -0,0 +1,1213 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Input.h" +#include "ecore_wl_private.h" +#include "Ecore_Wayland.h" + +/* FIXME: This gives BTN_LEFT/RIGHT/MIDDLE for linux systems ... + * What about other OSs ?? */ +#include +#ifdef __linux__ +# include +#else +# define BTN_LEFT 0x110 +# define BTN_RIGHT 0x111 +# define BTN_MIDDLE 0x112 +# define BTN_SIDE 0x113 +# define BTN_EXTRA 0x114 +# define BTN_FORWARD 0x115 +# define BTN_BACK 0x116 +#endif + +#include + +/* 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); + +/* 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; +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_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 (!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) + { + EINA_LOG_ERR("Cannot create a log domain for Ecore Wayland."); + eina_shutdown(); + return --_ecore_wl_init_count; + } + + if (!ecore_init()) + { + eina_log_domain_unregister(_ecore_wl_log_dom); + _ecore_wl_log_dom = -1; + eina_shutdown(); + return --_ecore_wl_init_count; + } + + if (!ecore_event_init()) + { + eina_log_domain_unregister(_ecore_wl_log_dom); + _ecore_wl_log_dom = -1; + ecore_shutdown(); + eina_shutdown(); + return --_ecore_wl_init_count; + } + + 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(); + } + + /* 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))) + { + ERR("Could not compile keymap"); + 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; + } + + /* connect to the wayland display */ + if (!(_ecore_wl_disp = wl_display_connect(name))) + { + 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; + } + + /* setup handler for wayland interfaces */ + wl_display_add_global_listener(_ecore_wl_disp, + _ecore_wl_cb_disp_handle_global, NULL); + + /* process connection events */ + wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); + + fd = wl_display_get_fd(_ecore_wl_disp, + _ecore_wl_cb_disp_event_mask_update, NULL); + + _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) + { + wl_display_destroy(_ecore_wl_disp); + _ecore_wl_disp = NULL; + 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; + } + + return _ecore_wl_init_count; +} + +EAPI int +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; +} + +EAPI struct wl_shell * +ecore_wl_shell_get(void) +{ + return _ecore_wl_shell; +} + +EAPI struct wl_input_device * +ecore_wl_input_device_get(void) +{ + return _ecore_wl_input_dev; +} + +EAPI void +ecore_wl_screen_size_get(int *w, int *h) +{ + 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; +} + +EAPI void +ecore_wl_flush(void) +{ + wl_display_flush(_ecore_wl_disp); +} + +EAPI void +ecore_wl_sync(void) +{ + wl_display_iterate(_ecore_wl_disp, WL_DISPLAY_READABLE); +} + +EAPI void +ecore_wl_pointer_xy_get(int *x, int *y) +{ + if (x) *x = _ecore_wl_screen_x; + if (y) *y = _ecore_wl_screen_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) +{ + 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; +} + +EAPI void +ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer) +{ + source->buffer = buffer; + + wl_data_device_start_drag(source->data_dev, source->data_source, + surface, source->timestamp); +} + +EAPI void +ecore_wl_drag_stop(void) +{ + +} + +/* local functions */ +static Eina_Bool +_ecore_wl_shutdown(Eina_Bool close_display) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + 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); + + if (_ecore_wl_fd_hdl) ecore_main_fd_handler_del(_ecore_wl_fd_hdl); + _ecore_wl_fd_hdl = NULL; + + if (close_display) + { + 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) + { + wl_display_flush(_ecore_wl_disp); + wl_display_destroy(_ecore_wl_disp); + } + _ecore_wl_disp = NULL; + } + + 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; +} + +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__) +{ +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_wl_disp_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__) +{ + struct wl_display *disp; + +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(disp = data)) return ECORE_CALLBACK_RENEW; + if (disp != _ecore_wl_disp) return ECORE_CALLBACK_RENEW; + + 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); + + 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) +{ + unsigned int keycode = 0; + + if (dev != _ecore_wl_input_dev) return; + + keycode = key + _ecore_wl_xkb->min_key_code; + + if (state) + _ecore_wl_input_modifiers |= _ecore_wl_xkb->map->modmap[keycode]; + else + _ecore_wl_input_modifiers &= ~_ecore_wl_xkb->map->modmap[keycode]; +} + +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 (!_ecore_wl_input_button) + _ecore_wl_mouse_out_send(_ecore_wl_input_surface, t); + } + + if (surface) + { + 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_input_surface = NULL; + + 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]; + + 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); + } +} + +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) +{ + 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; + + { + 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; + + 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; + + { + unsigned int id = 0; + + if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface))) + { + ev->window = id; + ev->event_window = id; + } + } + + _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; + + { + unsigned int id = 0; + + if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_touch_surface))) + { + ev->window = id; + ev->event_window = id; + } + } + + 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))) + { + /* 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); + } +} + +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; + + { + unsigned int id = 0; + + if ((id = (unsigned int)wl_surface_get_user_data(_ecore_wl_input_surface))) + { + ev->window = id; + ev->event_window = id; + } + } + + 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) + { + unsigned int id = 0; + + if ((id = (unsigned int)wl_surface_get_user_data(surface))) + ev->window = id; + } + + ecore_event_add(ECORE_WL_EVENT_MOUSE_OUT, ev, NULL, NULL); +} + +static void +_ecore_wl_mouse_in_send(struct wl_surface *surface, uint32_t timestamp) +{ + 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; + + if (surface) + { + unsigned int id = 0; + + if ((id = (unsigned int)wl_surface_get_user_data(surface))) + ev->window = id; + } + + ecore_event_add(ECORE_WL_EVENT_MOUSE_IN, ev, NULL, NULL); +} + +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; + + { + 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_UP, ev, NULL, NULL); +} + +static void +_ecore_wl_mouse_down_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; + + { + 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_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) + { + unsigned int id = 0; + + if ((id = (unsigned int)wl_surface_get_user_data(surface))) + ev->window = id; + } + ecore_event_add(ECORE_WL_EVENT_FOCUS_OUT, ev, NULL, NULL); +} + +static void +_ecore_wl_focus_in_send(struct wl_surface *surface, uint32_t timestamp) +{ + 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; + + if ((id = (unsigned int)wl_surface_get_user_data(surface))) + ev->window = id; + } + ecore_event_add(ECORE_WL_EVENT_FOCUS_IN, ev, NULL, NULL); +} diff --git a/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h new file mode 100644 index 0000000..eec5ffe --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wayland/ecore_wl_private.h @@ -0,0 +1,85 @@ +#ifndef _ECORE_WAYLAND_PRIVATE_H +# define _ECORE_WAYLAND_PRIVATE_H + +# include + +//# define LOGFNS 1 + +# ifdef LOGFNS +# include +# define LOGFN(fl, ln, fn) printf("-ECORE-WL: %25s: %5i - %s\n", fl, ln, fn); +# else +# define LOGFN(fl, ln, fn) +# endif + +extern int _ecore_wl_log_dom; + +# ifdef ECORE_WL_DEFAULT_LOG_COLOR +# undef ECORE_WL_DEFAULT_LOG_COLOR +# endif +# define ECORE_WL_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +# ifdef ERR +# undef ERR +# endif +# define ERR(...) EINA_LOG_DOM_ERR(_ecore_wl_log_dom, __VA_ARGS__) + +# ifdef DBG +# undef DBG +# endif +# define DBG(...) EINA_LOG_DOM_DBG(_ecore_wl_log_dom, __VA_ARGS__) + +# ifdef INF +# undef INF +# endif +# define INF(...) EINA_LOG_DOM_INFO(_ecore_wl_log_dom, __VA_ARGS__) + +# ifdef WRN +# undef WRN +# endif +# define WRN(...) EINA_LOG_DOM_WARN(_ecore_wl_log_dom, __VA_ARGS__) + +# ifdef CRIT +# undef CRIT +# endif +# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__) + +typedef struct _Ecore_Wl_Dnd_Source +{ + struct wl_data_offer *offer; + int refs; + + Eina_Array *types; + + uint32_t timestamp; + void *data; +} Ecore_Wl_Dnd_Source; + +typedef 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; + + uint32_t timestamp; + void *data; +} Ecore_Wl_Dnd_Target; + +struct _Ecore_Wl_Drag_Source +{ + struct wl_data_device *data_dev; + struct wl_buffer *buffer; + + int32_t hotspot_x, hotspot_y; + int32_t offset_x, offset_y; + const char *mimetype; + uint32_t timestamp; + void *data; + + struct wl_data_source *data_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 bdfb1c8..95e3749 100644 --- a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h +++ b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h @@ -221,7 +221,7 @@ struct _Ecore_Win32_Event_Mouse_In Ecore_Win32_Window *window; /**< The window that received the event */ int x; /**< The x coordinate where the mouse leaved */ int y; /**< The y coordinate where the mouse entered */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -233,7 +233,7 @@ struct _Ecore_Win32_Event_Mouse_Out Ecore_Win32_Window *window; /**< The window that received the event */ int x; /**< The x coordinate where the mouse leaved */ int y; /**< The y coordinate where the mouse leaved */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -243,7 +243,7 @@ struct _Ecore_Win32_Event_Mouse_Out struct _Ecore_Win32_Event_Window_Focus_In { Ecore_Win32_Window *window; /**< The window that received the event */ - long long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -253,7 +253,7 @@ struct _Ecore_Win32_Event_Window_Focus_In struct _Ecore_Win32_Event_Window_Focus_Out { Ecore_Win32_Window *window; /**< The window that received the event */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -267,7 +267,7 @@ struct _Ecore_Win32_Event_Window_Damage int y; /**< The y coordinate of the top left corner of the damaged region */ int width; /**< The width of the damaged region */ int height; /**< The time the event occurred */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -277,7 +277,7 @@ struct _Ecore_Win32_Event_Window_Damage struct _Ecore_Win32_Event_Window_Create { Ecore_Win32_Window *window; /**< The window that received the event */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -287,7 +287,7 @@ struct _Ecore_Win32_Event_Window_Create struct _Ecore_Win32_Event_Window_Destroy { Ecore_Win32_Window *window; /**< The window that received the event */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -297,7 +297,7 @@ struct _Ecore_Win32_Event_Window_Destroy struct _Ecore_Win32_Event_Window_Hide { Ecore_Win32_Window *window; /**< The window that received the event */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -307,7 +307,7 @@ struct _Ecore_Win32_Event_Window_Hide struct _Ecore_Win32_Event_Window_Show { Ecore_Win32_Window *window; /**< The window that received the event */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -322,7 +322,7 @@ struct _Ecore_Win32_Event_Window_Configure int y; /**< The new y coordinate of the top left corner */ int width; /**< The new width */ int height; /**< The new height */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -334,7 +334,7 @@ struct _Ecore_Win32_Event_Window_Resize Ecore_Win32_Window *window; /**< The window that received the event */ int width; /**< The new width */ int height; /**< The new height */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -344,7 +344,7 @@ struct _Ecore_Win32_Event_Window_Resize struct _Ecore_Win32_Event_Window_Delete_Request { Ecore_Win32_Window *window; /**< The window that received the event */ - long time; /**< The time the event occurred */ + unsigned long timestamp; /**< The time the event occurred */ }; /** @@ -369,12 +369,12 @@ EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for th /* Core */ -EAPI int ecore_win32_init(); -EAPI int ecore_win32_shutdown(); -EAPI int ecore_win32_screen_depth_get(); -EAPI void ecore_win32_double_click_time_set(double t); -EAPI double ecore_win32_double_click_time_get(void); -EAPI long ecore_win32_current_time_get(void); +EAPI int ecore_win32_init(); +EAPI int ecore_win32_shutdown(); +EAPI int ecore_win32_screen_depth_get(); +EAPI void ecore_win32_double_click_time_set(double t); +EAPI double ecore_win32_double_click_time_get(void); +EAPI unsigned long ecore_win32_current_time_get(void); /* Window */ diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.in b/libraries/ecore/src/lib/ecore_win32/Makefile.in index 4e4f363..9994ee7 100644 --- a/libraries/ecore/src/lib/ecore_win32/Makefile.in +++ b/libraries/ecore/src/lib/ecore_win32/Makefile.in @@ -268,10 +268,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -290,6 +290,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -403,6 +407,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -415,6 +421,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -459,12 +467,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c index 19ca3ed..b571d74 100644 --- a/libraries/ecore/src/lib/ecore_win32/ecore_win32.c +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c @@ -73,18 +73,44 @@ _ecore_win32_window_procedure(HWND window, data->message = message; data->window_param = window_param; data->data_param = data_param; - data->time = GetMessageTime(); + data->timestamp = GetMessageTime(); coord = GetMessagePos(); point = MAKEPOINTS(coord); data->x = point.x; data->y = point.y; + data->discard_ctrl = EINA_FALSE; switch (data->message) { /* Keyboard input notifications */ case WM_KEYDOWN: case WM_SYSKEYDOWN: - INF("keydown message"); + if ((data->message == WM_KEYDOWN) && + (data->window_param == VK_CONTROL) && + ((HIWORD(data->data_param) & KF_EXTENDED) == 0)) + { + /* Ctrl left key is pressed */ + BOOL res; + MSG next_msg; + + /* + * we check if the next message + * - is a WM_KEYDOWN + * - has the same timestamp than the Ctrl one + * - is the key press of the right Alt key + */ + res = PeekMessage(&next_msg, data->window, + WM_KEYDOWN, WM_KEYDOWN, + PM_NOREMOVE); + if (res && + (next_msg.wParam == VK_MENU) && + (next_msg.time == data->timestamp) && + (HIWORD(next_msg.lParam) & KF_EXTENDED)) + { + INF("discard left Ctrl key press (sent by AltGr key press)"); + data->discard_ctrl = EINA_TRUE; + } + } _ecore_win32_event_handle_key_press(data, 1); return 0; case WM_CHAR: @@ -95,6 +121,33 @@ _ecore_win32_window_procedure(HWND window, case WM_KEYUP: case WM_SYSKEYUP: INF("keyup message"); + if ((data->window_param == VK_CONTROL) && + ((HIWORD(data->data_param) & KF_EXTENDED) == 0)) + { + /* Ctrl left key is pressed */ + BOOL res; + MSG next_msg; + + /* + * we check if the next message + * - is a WM_KEYUP or WM_SYSKEYUP + * - has the same timestamp than the Ctrl one + * - is the key release of the right Alt key + */ + res = PeekMessage(&next_msg, data->window, + WM_KEYUP, WM_SYSKEYUP, + PM_NOREMOVE); + if (res && + ((next_msg.message == WM_KEYUP) || + (next_msg.message == WM_SYSKEYUP)) && + (next_msg.wParam == VK_MENU) && + (next_msg.time == data->timestamp) && + (HIWORD(next_msg.lParam) & KF_EXTENDED)) + { + INF("discard left Ctrl key release (sent by AltGr key release)"); + data->discard_ctrl = EINA_TRUE; + } + } _ecore_win32_event_handle_key_release(data); return 0; case WM_SETFOCUS: @@ -492,7 +545,7 @@ _ecore_win32_window_procedure(HWND window, HINSTANCE _ecore_win32_instance = NULL; double _ecore_win32_double_click_time = 0.25; -long _ecore_win32_event_last_time = 0; +unsigned long _ecore_win32_event_last_time = 0; Ecore_Win32_Window *_ecore_win32_event_last_window = NULL; int _ecore_win32_log_dom_global = -1; @@ -777,7 +830,7 @@ ecore_win32_double_click_time_get(void) * * This function returns the last event time. */ -EAPI long +EAPI unsigned long ecore_win32_current_time_get(void) { return _ecore_win32_event_last_time; diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c index 63356d3..388776c 100644 --- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c @@ -45,18 +45,18 @@ static void _ecore_win32_event_free_key_down(void *data, static void _ecore_win32_event_free_key_up(void *data, void *ev); -static int _ecore_win32_event_keystroke_get(int key, - int is_extended, - Eina_Bool is_down, - char **keyname, - char **keysymbol, - char **keycompose, - unsigned int *modifiers); +static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, + Eina_Bool is_down, + char **keyname, + char **keysymbol, + char **keycompose, + unsigned int *modifiers); -static int _ecore_win32_event_char_get(int key, - char **keyname, - char **keysymbol, - char **keycompose); +static int _ecore_win32_event_char_get(int key, + char **keyname, + char **keysymbol, + char **keycompose, + unsigned int *modifiers); /***** Global functions definitions *****/ @@ -74,8 +74,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, if (is_keystroke) { - if (!_ecore_win32_event_keystroke_get(msg->window_param, - msg->data_param & 0x01000000, + if (!_ecore_win32_event_keystroke_get(msg, EINA_TRUE, (char **)&e->keyname, (char **)&e->key, @@ -91,7 +90,8 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), (char **)&e->keyname, (char **)&e->key, - (char **)&e->string)) + (char **)&e->string, + &e->modifiers)) { free(e); return; @@ -105,7 +105,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, return; } e->event_window = e->window; - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; @@ -122,18 +122,19 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg) e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); if (!e) return; - if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), - msg->data_param & 0x01000000, + if (!_ecore_win32_event_keystroke_get(msg, EINA_FALSE, (char **)&e->keyname, (char **)&e->key, (char **)&e->string, &e->modifiers)) { - if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), + if (msg->discard_ctrl || + !_ecore_win32_event_char_get(LOWORD(msg->window_param), (char **)&e->keyname, (char **)&e->key, - (char **)&e->string)) + (char **)&e->string, + &e->modifiers)) { free(e); return; @@ -147,7 +148,7 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg) return; } e->event_window = e->window; - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; @@ -178,7 +179,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; @@ -197,7 +198,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, e->event_window = e->window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; @@ -224,7 +225,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, e->buttons = button; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->timestamp = msg->time; + e->timestamp = msg->timestamp; if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) @@ -279,7 +280,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, e->event_window = e->window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; @@ -298,7 +299,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, e->buttons = button; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_mouse_up_count++; @@ -334,7 +335,7 @@ _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) e->event_window = e->window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); - e->timestamp = msg->time; + e->timestamp = msg->timestamp; ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); } @@ -354,7 +355,7 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) e->event_window = e->window; e->x = msg->x; e->y = msg->y; - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; @@ -371,9 +372,9 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->x = msg->x; e->y = msg->y; - e->time = msg->time ; + e->timestamp = msg->timestamp ; - _ecore_win32_event_last_time = e->time; + _ecore_win32_event_last_time = e->timestamp; ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL); } @@ -394,7 +395,7 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) e->event_window = e->window; e->x = msg->x; e->y = msg->y; - e->timestamp = msg->time; + e->timestamp = msg->timestamp; _ecore_win32_event_last_time = e->timestamp; _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; @@ -411,9 +412,9 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->x = msg->x; e->y = msg->y; - e->time = msg->time; + e->timestamp = msg->timestamp; - _ecore_win32_event_last_time = e->time; + _ecore_win32_event_last_time = e->timestamp; ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL); } @@ -431,8 +432,8 @@ _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; - _ecore_win32_event_last_time = e->time; + e->timestamp = _ecore_win32_event_last_time; + _ecore_win32_event_last_time = e->timestamp; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); } @@ -449,8 +450,8 @@ _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; - _ecore_win32_event_last_time = e->time; + e->timestamp = _ecore_win32_event_last_time; + _ecore_win32_event_last_time = e->timestamp; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); } @@ -472,7 +473,7 @@ _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg) e->width = msg->update.right - msg->update.left; e->height = msg->update.bottom - msg->update.top; - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL); } @@ -489,7 +490,7 @@ _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); } @@ -506,7 +507,7 @@ _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); @@ -524,7 +525,7 @@ _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL); } @@ -541,7 +542,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); } @@ -572,7 +573,7 @@ _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg) e->y = wi.rcClient.top; e->width = wi.rcClient.right - wi.rcClient.left; e->height = wi.rcClient.bottom - wi.rcClient.top; - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); } @@ -594,7 +595,7 @@ _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg) e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->width = rect.right - rect.left; e->height = rect.bottom - rect.top; - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL); } @@ -610,7 +611,7 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); - e->time = _ecore_win32_event_last_time; + e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); } @@ -645,24 +646,28 @@ _ecore_win32_event_free_key_up(void *data __UNUSED__, } static int -_ecore_win32_event_keystroke_get(int key, - int is_extended, +_ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, Eina_Bool is_down, char **keyname, char **keysymbol, char **keycompose, unsigned int *modifiers) { + WCHAR buf[3]; + char delete_string[2] = { 0x7f, 0 }; char *kn = NULL; char *ks = NULL; char *kc = NULL; + int key; + int is_extended; + + key = msg->window_param; + is_extended = msg->data_param & 0x01000000; *keyname = NULL; *keysymbol = NULL; *keycompose = NULL; - - printf("vk key 0x%x\n", key); switch (key) { /* Keystroke */ @@ -751,7 +756,6 @@ _ecore_win32_event_keystroke_get(int key, } break; case VK_RIGHT: - printf("vk val 0x%x (right)\n", VK_RIGHT); if (is_extended) { kn = "Right"; @@ -798,8 +802,7 @@ _ecore_win32_event_keystroke_get(int key, { kn = "Delete"; ks = "Delete"; - /* FIXME: kc is wrong, here */ - kc = "Delete"; + kc = delete_string; } else { @@ -830,7 +833,7 @@ _ecore_win32_event_keystroke_get(int key, ks = "Shift_R"; kc = ""; } - *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; } else /* is_up */ { @@ -852,7 +855,7 @@ _ecore_win32_event_keystroke_get(int key, kc = ""; _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT; } - *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; + *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; } break; } @@ -860,6 +863,9 @@ _ecore_win32_event_keystroke_get(int key, { SHORT res; + if (msg->discard_ctrl) + return 0; + if (is_down) { res = GetKeyState(VK_LCONTROL); @@ -1113,11 +1119,53 @@ _ecore_win32_event_keystroke_get(int key, kc = ""; break; default: - /* other non keystroke characters */ - return 0; + { + /* other non keystroke characters */ + BYTE kbd_state[256]; + int res; + + if (is_down) + return 0; + + if (!GetKeyboardState(kbd_state)) + return 0; + + res = ToUnicode(msg->window_param, + MapVirtualKey(msg->window_param, 2), + kbd_state, buf, 3, 0); + if (res == 1) + { + /* FIXME: might be troublesome for non european languages */ + /* in that case, UNICODE should be used, I guess */ + buf[1] = '\0'; + kn = (char *)buf; + ks = (char *)buf; + kc = (char *)buf; + + res = GetAsyncKeyState(VK_SHIFT); + if (res & 0x8000) + *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + else + *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; + + res = GetKeyState(VK_CONTROL); + if (res & 0x8000) + *modifiers |= ECORE_EVENT_MODIFIER_CTRL; + else + *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL; + + res = GetKeyState(VK_MENU); + if (res & 0x8000) + *modifiers |= ECORE_EVENT_MODIFIER_ALT; + else + *modifiers &= ~ECORE_EVENT_MODIFIER_ALT; + + break; + } + return 0; + } } - printf("sortie...\n"); *keyname = strdup(kn); if (!*keyname) return 0; *keysymbol = strdup(ks); @@ -1141,28 +1189,27 @@ _ecore_win32_event_keystroke_get(int key, return 0; } } - printf("sortie 2 ...\n"); return 1; } static int -_ecore_win32_event_char_get(int key, - char **keyname, - char **keysymbol, - char **keycompose) +_ecore_win32_event_char_get(int key, + char **keyname, + char **keysymbol, + char **keycompose, + unsigned int *modifiers) { char *kn = NULL; char *ks = NULL; char *kc = NULL; char buf[2]; + SHORT res; *keyname = NULL; *keysymbol = NULL; *keycompose = NULL; - printf("char key 0x%x\n", key); - switch (key) { case VK_PROCESSKEY: @@ -1200,7 +1247,6 @@ _ecore_win32_event_char_get(int key, break; default: /* displayable characters */ - printf (" * key : %d\n", key); buf[0] = key; buf[1] = '\0'; kn = buf; @@ -1227,5 +1273,23 @@ _ecore_win32_event_char_get(int key, return 0; } + res = GetAsyncKeyState(VK_SHIFT); + if (res & 0x8000) + *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + else + *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; + + res = GetKeyState(VK_CONTROL); + if (res & 0x8000) + *modifiers |= ECORE_EVENT_MODIFIER_CTRL; + else + *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL; + + res = GetKeyState(VK_MENU); + if (res & 0x8000) + *modifiers |= ECORE_EVENT_MODIFIER_ALT; + else + *modifiers &= ~ECORE_EVENT_MODIFIER_ALT; + return 1; } 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 4533169..ab54763 100644 --- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h @@ -49,14 +49,15 @@ typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data; struct _Ecore_Win32_Callback_Data { - RECT update; - HWND window; - unsigned int message; - WPARAM window_param; - LPARAM data_param; - long time; - int x; - int y; + RECT update; + HWND window; + unsigned int message; + WPARAM window_param; + LPARAM data_param; + unsigned long timestamp; + int x; + int y; + Eina_Bool discard_ctrl; }; struct _Ecore_Win32_Window @@ -130,7 +131,7 @@ struct _Ecore_Win32_Window extern HINSTANCE _ecore_win32_instance; extern double _ecore_win32_double_click_time; -extern long _ecore_win32_event_last_time; +extern unsigned long _ecore_win32_event_last_time; extern Ecore_Win32_Window *_ecore_win32_event_last_window; diff --git a/libraries/ecore/src/lib/ecore_wince/Makefile.in b/libraries/ecore/src/lib/ecore_wince/Makefile.in index 0610122..d23bf51 100644 --- a/libraries/ecore/src/lib/ecore_wince/Makefile.in +++ b/libraries/ecore/src/lib/ecore_wince/Makefile.in @@ -249,10 +249,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -271,6 +271,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -384,6 +388,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -396,6 +402,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -440,12 +448,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X.h b/libraries/ecore/src/lib/ecore_x/Ecore_X.h index 6588a75..b5d2c3f 100644 --- a/libraries/ecore/src/lib/ecore_x/Ecore_X.h +++ b/libraries/ecore/src/lib/ecore_x/Ecore_X.h @@ -1181,6 +1181,8 @@ EAPI int ecore_x_error_request_get(void); EAPI int ecore_x_error_code_get(void); +EAPI Ecore_X_ID +ecore_x_error_resource_id_get(void); EAPI void ecore_x_event_mask_set(Ecore_X_Window w, @@ -3114,7 +3116,10 @@ EAPI Ecore_X_Randr_Edid_Display_Interface_Type ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, unsigned long edid_length); -/* ecore_x_randr_13.c */ +/* ecore_x_randr_12.c */ + +EAPI Eina_Bool +ecore_x_randr_output_backlight_available(void); EAPI void ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, double level); diff --git a/libraries/ecore/src/lib/ecore_x/Makefile.in b/libraries/ecore/src/lib/ecore_x/Makefile.in index d5f4247..3b53cfe 100644 --- a/libraries/ecore/src/lib/ecore_x/Makefile.in +++ b/libraries/ecore/src/lib/ecore_x/Makefile.in @@ -279,10 +279,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -301,6 +301,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -414,6 +418,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -426,6 +432,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -470,12 +478,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in index 0213aea..9108f23 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in +++ b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in @@ -261,10 +261,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -283,6 +283,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -396,6 +400,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -408,6 +414,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -452,12 +460,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c index d0ffde1..bbab308 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c @@ -99,7 +99,7 @@ ecore_x_damage_new(Ecore_X_Drawable drawable, /** * Destroy a damage object * - * @param The damage object to destroy + * @param damage The damage object to destroy * * Destroys the damage object @p damage * diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c index 677de38..177e61d 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c @@ -422,9 +422,8 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, * @param data User data. */ EAPI void -ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, - Ecore_X_Xdnd_Position *data), - const void *data) +ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, Ecore_X_Xdnd_Position *data), + const void *data) { _posupdatecb = cb; _posupdatedata = (void *)data; diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c index 63b7f1e..324717c 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c @@ -270,7 +270,7 @@ ecore_x_dpms_timeout_off_get(void) /** * Sets the standby timeout (in unit of seconds). - * @param new_standby Amount of time of inactivity before standby mode will be invoked. + * @param new_timeout Amount of time of inactivity before standby mode will be invoked. * @ingroup Ecore_X_DPMS_Group */ EAPI void @@ -286,7 +286,7 @@ ecore_x_dpms_timeout_standby_set(unsigned int new_timeout) /** * Sets the suspend timeout (in unit of seconds). - * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode. * @ingroup Ecore_X_DPMS_Group */ EAPI void @@ -302,7 +302,7 @@ ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout) /** * Sets the off timeout (in unit of seconds). - * @param off Amount of time of inactivity before the monitor is shut off. + * @param new_timeout Amount of time of inactivity before the monitor is shut off. * @ingroup Ecore_X_DPMS_Group */ EAPI void diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c index bbd9c2a..fc32926 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c @@ -8,6 +8,7 @@ static void (*_io_error_func)(void *data) = NULL; static void *_io_error_data = NULL; static int _error_request_code = 0; static int _error_code = 0; +static Ecore_X_ID _error_resource_id = 0; /** * Set the error handler. @@ -63,6 +64,18 @@ ecore_x_error_code_get(void) return _error_code; } +/** + * Get the resource id that caused the error. + * @return The resource id causing the X error + * + * Return the X resource id that caused the last X error + */ +EAPI Ecore_X_ID +ecore_x_error_resource_id_get(void) +{ + return _error_resource_id; +} + int _ecore_xcb_error_handle(xcb_generic_error_t *err) { @@ -84,6 +97,7 @@ _ecore_xcb_error_handle(xcb_generic_error_t *err) _error_request_code = err->sequence; _error_code = err->error_code; + _error_resource_id = err->resource_id; if (_error_func) _error_func(_error_data); diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c index 6459db7..8dea861 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c @@ -396,7 +396,7 @@ ecore_x_icccm_transient_for_set(Ecore_X_Window win, /** * Remove the transient_for setting from a window. - * @param The window + * @param win The window */ EAPI void ecore_x_icccm_transient_for_unset(Ecore_X_Window win) @@ -1452,6 +1452,7 @@ ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t) { LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, XCB_EVENT_MASK_NO_EVENT, 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 510da49..62f7618 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 @@ -1528,9 +1528,9 @@ ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, /** * @brief sets a CRTC relative to another one. - * @param crtc_r1 the CRTC to be positioned. - * @param crtc_r2 the CRTC the position should be relative to - * @param position the relation between the crtcs + * @param crtc1 the CRTC to be positioned. + * @param crtc2 the CRTC the position should be relative to + * @param policy the relation between the crtcs * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's * borders * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if @@ -2449,6 +2449,45 @@ ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, return EINA_FALSE; } +/* + * @brief check if a backlight is available + * @return whether a blacklight is available + */ +EAPI Eina_Bool +ecore_x_randr_output_backlight_available(void) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Atom _backlight; + xcb_intern_atom_cookie_t acookie; + xcb_intern_atom_reply_t *areply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + acookie = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, + strlen("Backlight"), "Backlight"); + areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); + + if (!areply) + { + ERR("Backlight property is not suppported on this server or driver"); + return EINA_FALSE; + } + else + { + _backlight = areply->atom; + free(areply); + return EINA_TRUE; + } +#endif + return EINA_FALSE; +} + EAPI int ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length) { 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 2616c93..27bceaf 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 @@ -783,13 +783,14 @@ ecore_x_window_focus(Ecore_X_Window win) */ EAPI void ecore_x_window_focus_at_time(Ecore_X_Window win, - Ecore_X_Time time) + Ecore_X_Time time __UNUSED__) { LOGFN(__FILE__, __LINE__, __FUNCTION__); CHECK_XCB_CONN; if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; - xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_PARENT, win, time); + xcb_set_input_focus(_ecore_xcb_conn, + XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME); // ecore_x_flush(); } diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c index bf9d5ee..bbca2a5 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c @@ -178,7 +178,7 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) /** * Create a region from a window. - * @param window The window used to initialize the region. + * @param win The window used to initialize the region. * @param type The type of the region. * @return The newly created region. * @@ -609,8 +609,8 @@ ecore_x_region_expand(Ecore_X_Region dest, * Change clip-mask in a graphic context to the specified region. * @param region The region to change. * @param gc The clip-mask graphic context. - * @param x_origin The horizontal translation. - * @param y_origin The vertical translation. + * @param x The horizontal translation. + * @param y The vertical translation. * * Changes clip-mask in @p gc to the specified @p region and * sets the clip origin with the values of @p x_origin and @p y_origin. @@ -643,8 +643,8 @@ ecore_x_region_gc_clip_set(Ecore_X_Region region, * @param region The region. * @param dest The window whose shape is changed. * @param type The kind of shape. - * @param x_offset The horizontal offset. - * @param y_offset The vertical offset. + * @param x The horizontal offset. + * @param y The vertical offset. * * Set the specified Shape extension region of @p window to @p region, * offset by @p x_offset and @p y_offset. Future changes to region @@ -673,8 +673,8 @@ ecore_x_region_window_shape_set(Ecore_X_Region region, * Change clip-mask in picture to the specified region. * @param region The region. * @param picture The picture. - * @param x_origin The X coordinate of the origin. - * @param y_origin The Y coordinate of the origin. + * @param x The X coordinate of the origin. + * @param y The Y coordinate of the origin. * * Changes clip-mask in picture to the specified @p region * and sets the clip origin. Input and output will be clipped to diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in index e1026e5..27a2841 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in +++ b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in @@ -252,10 +252,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -274,6 +274,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -387,6 +391,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -399,6 +405,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -443,12 +451,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c index 844ab04..6d275bc 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c @@ -19,9 +19,9 @@ #include "Ecore_X_Atoms.h" #include "Ecore_Input.h" -static Eina_Bool _ecore_x_fd_handler(void *data, +static Eina_Bool _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); -static Eina_Bool _ecore_x_fd_handler_buf(void *data, +static Eina_Bool _ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler); static int _ecore_x_key_mask_get(KeySym sym); static int _ecore_x_event_modifier(unsigned int state); @@ -139,9 +139,9 @@ EAPI int ECORE_X_LOCK_SHIFT = 0; #ifdef LOGRT static double t0 = 0.0; static Status (*_logrt_real_reply)(Display *disp, - void *rep, - int extra, - Bool discard) = NULL; + void *rep, + int extra, + Bool discard) = NULL; static void _logrt_init(void) { @@ -159,13 +159,13 @@ _logrt_init(void) _logrt_real_reply = dlsym(lib, "_XReply"); t0 = ecore_time_get(); -} /* _logrt_init */ +} Status _XReply(Display *disp, - void *rep, - int extra, - Bool discard) + void *rep, + int extra, + Bool discard) { void *bt[128]; int i, n; @@ -207,7 +207,7 @@ _XReply(Display *disp, // fixme: logme return _logrt_real_reply(disp, rep, extra, discard); -} /* _XReply */ +} #endif /* ifdef LOGRT */ @@ -215,35 +215,35 @@ void _ecore_x_modifiers_get(void) { /* everything has these... unless its like a pda... :) */ - ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); - ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L); + ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); + ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L); - /* apple's xdarwin has no alt!!!! */ - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L); + /* apple's xdarwin has no alt!!!! */ + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L); - if (!ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L); - /* the windows key... a valid modifier :) */ - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L); - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch); + /* the windows key... a valid modifier :) */ + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch); - if (!ECORE_X_MODIFIER_WIN) - ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L); - if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT) - ECORE_X_MODIFIER_WIN = 0; + if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_WIN = 0; - if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL) - ECORE_X_MODIFIER_ALT = 0; + if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL) + ECORE_X_MODIFIER_ALT = 0; - ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock); - ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock); - ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock); - ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock); + ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock); + ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock); + ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock); + ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock); } /** @@ -300,7 +300,7 @@ ecore_x_init(const char *name) eina_init(); _ecore_xlib_log_dom = eina_log_domain_register ("ecore_x", ECORE_XLIB_DEFAULT_LOG_COLOR); - if(_ecore_xlib_log_dom < 0) + if (_ecore_xlib_log_dom < 0) { EINA_LOG_ERR( "Impossible to create a log domain for the Ecore Xlib module."); @@ -375,7 +375,7 @@ ecore_x_init(const char *name) #ifdef ECORE_XGESTURE if (XGestureQueryExtension(_ecore_x_disp, &gesture_base, &gesture_err_base)) - _ecore_x_event_gesture_id = gesture_base; + _ecore_x_event_gesture_id = gesture_base; ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents); #endif /* ifdef ECORE_XGESTURE */ @@ -497,20 +497,20 @@ ecore_x_init(const char *name) #ifdef ECORE_XGESTURE if (_ecore_x_event_gesture_id) { - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] = - _ecore_x_event_handle_gesture_notify_flick; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] = - _ecore_x_event_handle_gesture_notify_pan; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] = - _ecore_x_event_handle_gesture_notify_pinchrotation; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] = - _ecore_x_event_handle_gesture_notify_tap; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] = - _ecore_x_event_handle_gesture_notify_tapnhold; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] = - _ecore_x_event_handle_gesture_notify_hold; - _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] = - _ecore_x_event_handle_gesture_notify_group; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] = + _ecore_x_event_handle_gesture_notify_flick; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] = + _ecore_x_event_handle_gesture_notify_pan; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] = + _ecore_x_event_handle_gesture_notify_pinchrotation; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] = + _ecore_x_event_handle_gesture_notify_tap; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] = + _ecore_x_event_handle_gesture_notify_tapnhold; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] = + _ecore_x_event_handle_gesture_notify_hold; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] = + _ecore_x_event_handle_gesture_notify_group; } #endif /* ifdef ECORE_XGESTURE */ @@ -641,7 +641,7 @@ shutdown_eina: eina_shutdown(); return --_ecore_x_init_count; -} /* ecore_x_init */ +} static int _ecore_x_shutdown(int close_display) @@ -683,7 +683,7 @@ _ecore_x_shutdown(int close_display) eina_shutdown(); return _ecore_x_init_count; -} /* _ecore_x_shutdown */ +} /** * Shuts down the Ecore X library. @@ -699,7 +699,7 @@ EAPI int ecore_x_shutdown(void) { return _ecore_x_shutdown(1); -} /* ecore_x_shutdown */ +} /** * Shuts down the Ecore X library. @@ -712,7 +712,7 @@ EAPI int ecore_x_disconnect(void) { return _ecore_x_shutdown(0); -} /* ecore_x_disconnect */ +} /** * @defgroup Ecore_X_Display_Attr_Group X Display Attributes @@ -729,7 +729,7 @@ EAPI Ecore_X_Display * ecore_x_display_get(void) { return (Ecore_X_Display *)_ecore_x_disp; -} /* ecore_x_display_get */ +} /** * Retrieves the X display file descriptor. @@ -741,7 +741,7 @@ ecore_x_fd_get(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ConnectionNumber(_ecore_x_disp); -} /* ecore_x_fd_get */ +} /** * Retrieves the Ecore_X_Screen handle used for the current X connection. @@ -753,7 +753,7 @@ ecore_x_default_screen_get(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return (Ecore_X_Screen *)DefaultScreenOfDisplay(_ecore_x_disp); -} /* ecore_x_default_screen_get */ +} /** * Retrieves the size of an Ecore_X_Screen. @@ -767,8 +767,8 @@ ecore_x_default_screen_get(void) */ EAPI void ecore_x_screen_size_get(const Ecore_X_Screen *screen, - int *w, - int *h) + int *w, + int *h) { Screen *s = (Screen *)screen; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -840,7 +840,7 @@ ecore_x_double_click_time_set(double t) t = 0.0; _ecore_x_double_click_time = t; -} /* ecore_x_double_click_time_set */ +} /** * Retrieves the double and triple click flag timeout. @@ -854,7 +854,7 @@ EAPI double ecore_x_double_click_time_get(void) { return _ecore_x_double_click_time; -} /* ecore_x_double_click_time_get */ +} /** * @defgroup Ecore_X_Flush_Group X Synchronization Functions @@ -872,7 +872,7 @@ ecore_x_flush(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XFlush(_ecore_x_disp); -} /* ecore_x_flush */ +} /** * Flushes the command buffer and waits until all requests have been @@ -884,7 +884,7 @@ ecore_x_sync(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSync(_ecore_x_disp, False); -} /* ecore_x_sync */ +} /** * Kill all clients with subwindows under a given window. @@ -920,7 +920,7 @@ ecore_x_killall(Ecore_X_Window root) } XUngrabServer(_ecore_x_disp); XSync(_ecore_x_disp, False); -} /* ecore_x_killall */ +} /** * Kill a specific client @@ -934,7 +934,7 @@ ecore_x_kill(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XKillClient(_ecore_x_disp, win); -} /* ecore_x_kill */ +} /** * Return the last event time @@ -943,7 +943,7 @@ EAPI Ecore_X_Time ecore_x_current_time_get(void) { return _ecore_x_event_last_time; -} /* ecore_x_current_time_get */ +} /** * Return the screen DPI @@ -965,7 +965,7 @@ ecore_x_dpi_get(void) return 75; return (((s->width * 254) / s->mwidth) + 5) / 10; -} /* ecore_x_dpi_get */ +} /** * Invoke the standard system beep to alert users @@ -989,10 +989,10 @@ ecore_x_bell(int percent) return EINA_FALSE; return EINA_TRUE; -} /* ecore_x_bell */ +} static Eina_Bool -_ecore_x_fd_handler(void *data, +_ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) { Display *d; @@ -1021,10 +1021,10 @@ _ecore_x_fd_handler(void *data, } } return ECORE_CALLBACK_RENEW; -} /* _ecore_x_fd_handler */ +} static Eina_Bool -_ecore_x_fd_handler_buf(void *data, +_ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) { Display *d; @@ -1034,7 +1034,7 @@ _ecore_x_fd_handler_buf(void *data, return ECORE_CALLBACK_RENEW; return ECORE_CALLBACK_CANCEL; -} /* _ecore_x_fd_handler_buf */ +} static int _ecore_x_key_mask_get(KeySym sym) @@ -1080,7 +1080,7 @@ _ecore_x_key_mask_get(KeySym sym) } return 0; -} /* _ecore_x_key_mask_get */ +} /*****************************************************************************/ /*****************************************************************************/ @@ -1132,7 +1132,7 @@ ecore_x_window_root_list(int *num_ret) overlap++; } } - roots = malloc((num - overlap) * sizeof(Window)); + roots = malloc(MAX((num - overlap) * sizeof(Window), 1)); if (roots) { int k; @@ -1195,7 +1195,7 @@ ecore_x_window_root_list(int *num_ret) roots[i] = RootWindow(_ecore_x_disp, i); #endif /* ifdef ECORE_XPRINT */ return roots; -} /* ecore_x_window_root_list */ +} EAPI Ecore_X_Window ecore_x_window_root_first_get(void) @@ -1217,7 +1217,7 @@ ecore_x_window_root_first_get(void) free(roots); return root; */ -} /* ecore_x_window_root_first_get */ +} static void _ecore_x_window_manage_error(void *data); @@ -1228,7 +1228,7 @@ _ecore_x_window_manage_error(void *data __UNUSED__) if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) && (ecore_x_error_code_get() == BadAccess)) _ecore_x_window_manage_failed = 1; -} /* _ecore_x_window_manage_error */ +} EAPI Eina_Bool ecore_x_window_manage(Ecore_X_Window win) @@ -1262,7 +1262,7 @@ ecore_x_window_manage(Ecore_X_Window win) } return EINA_TRUE; -} /* ecore_x_window_manage */ +} EAPI void ecore_x_window_container_manage(Ecore_X_Window win) @@ -1271,7 +1271,7 @@ ecore_x_window_container_manage(Ecore_X_Window win) XSelectInput(_ecore_x_disp, win, SubstructureRedirectMask | SubstructureNotifyMask); -} /* ecore_x_window_container_manage */ +} EAPI void ecore_x_window_client_manage(Ecore_X_Window win) @@ -1287,7 +1287,7 @@ ecore_x_window_client_manage(Ecore_X_Window win) SubstructureNotifyMask ); XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); -} /* ecore_x_window_client_manage */ +} EAPI void ecore_x_window_sniff(Ecore_X_Window win) @@ -1296,7 +1296,7 @@ ecore_x_window_sniff(Ecore_X_Window win) XSelectInput(_ecore_x_disp, win, PropertyChangeMask | SubstructureNotifyMask); -} /* ecore_x_window_sniff */ +} EAPI void ecore_x_window_client_sniff(Ecore_X_Window win) @@ -1310,10 +1310,10 @@ ecore_x_window_client_sniff(Ecore_X_Window win) StructureNotifyMask | SubstructureNotifyMask); XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); -} /* ecore_x_window_client_sniff */ +} EAPI Eina_Bool -ecore_x_window_attributes_get(Ecore_X_Window win, +ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att_ret) { XWindowAttributes att; @@ -1353,25 +1353,25 @@ ecore_x_window_attributes_get(Ecore_X_Window win, att_ret->colormap = att.colormap; att_ret->visual = att.visual; return EINA_TRUE; -} /* ecore_x_window_attributes_get */ +} EAPI void ecore_x_window_save_set_add(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XAddToSaveSet(_ecore_x_disp, win); -} /* ecore_x_window_save_set_add */ +} EAPI void ecore_x_window_save_set_del(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XRemoveFromSaveSet(_ecore_x_disp, win); -} /* ecore_x_window_save_set_del */ +} EAPI Ecore_X_Window * ecore_x_window_children_get(Ecore_X_Window win, - int *num) + int *num) { Ecore_X_Window *windows = NULL; Window root_ret = 0, parent_ret = 0, *children_ret = NULL; @@ -1398,7 +1398,7 @@ ecore_x_window_children_get(Ecore_X_Window win, } return windows; -} /* ecore_x_window_children_get */ +} EAPI Eina_Bool ecore_x_pointer_control_set(int accel_num, @@ -1408,7 +1408,7 @@ ecore_x_pointer_control_set(int accel_num, LOGFN(__FILE__, __LINE__, __FUNCTION__); return XChangePointerControl(_ecore_x_disp, 1, 1, accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_pointer_control_set */ +} EAPI Eina_Bool ecore_x_pointer_control_get(int *accel_num, @@ -1418,23 +1418,23 @@ ecore_x_pointer_control_get(int *accel_num, LOGFN(__FILE__, __LINE__, __FUNCTION__); return XGetPointerControl(_ecore_x_disp, accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_pointer_control_get */ +} EAPI Eina_Bool ecore_x_pointer_mapping_set(unsigned char *map, - int nmap) + int nmap) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XSetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_pointer_mapping_set */ +} EAPI Eina_Bool ecore_x_pointer_mapping_get(unsigned char *map, - int nmap) + int nmap) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XGetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_pointer_mapping_get */ +} EAPI Eina_Bool ecore_x_pointer_grab(Ecore_X_Window win) @@ -1448,7 +1448,7 @@ ecore_x_pointer_grab(Ecore_X_Window win) return EINA_TRUE; return EINA_FALSE; -} /* ecore_x_pointer_grab */ +} EAPI Eina_Bool ecore_x_pointer_confine_grab(Ecore_X_Window win) @@ -1462,23 +1462,23 @@ ecore_x_pointer_confine_grab(Ecore_X_Window win) return EINA_TRUE; return EINA_FALSE; -} /* ecore_x_pointer_confine_grab */ +} EAPI void ecore_x_pointer_ungrab(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XUngrabPointer(_ecore_x_disp, CurrentTime); -} /* ecore_x_pointer_ungrab */ +} EAPI Eina_Bool ecore_x_pointer_warp(Ecore_X_Window win, - int x, - int y) + int x, + int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_pointer_warp */ +} EAPI Eina_Bool ecore_x_keyboard_grab(Ecore_X_Window win) @@ -1490,14 +1490,14 @@ ecore_x_keyboard_grab(Ecore_X_Window win) return EINA_TRUE; return EINA_FALSE; -} /* ecore_x_keyboard_grab */ +} EAPI void ecore_x_keyboard_ungrab(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XUngrabKeyboard(_ecore_x_disp, CurrentTime); -} /* ecore_x_keyboard_ungrab */ +} EAPI void ecore_x_grab(void) @@ -1506,7 +1506,7 @@ ecore_x_grab(void) _ecore_x_grab_count++; if (_ecore_x_grab_count == 1) XGrabServer(_ecore_x_disp); -} /* ecore_x_grab */ +} EAPI void ecore_x_ungrab(void) @@ -1518,32 +1518,32 @@ ecore_x_ungrab(void) if (_ecore_x_grab_count == 0) XUngrabServer(_ecore_x_disp); -} /* ecore_x_ungrab */ +} int _ecore_window_grabs_num = 0; Window *_ecore_window_grabs = NULL; Eina_Bool (*_ecore_window_grab_replay_func)(void *data, - int event_type, + int event_type, void *event); void *_ecore_window_grab_replay_data; EAPI void -ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, - int event_type, - void *event), - void *data) +ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, + int event_type, + void *event), + void *data) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_window_grab_replay_func = func; _ecore_window_grab_replay_data = data; -} /* ecore_x_passive_grab_replay_func_set */ +} EAPI void -ecore_x_window_button_grab(Ecore_X_Window win, - int button, +ecore_x_window_button_grab(Ecore_X_Window win, + int button, Ecore_X_Event_Mask event_mask, - int mod, - int any_mod) + int mod, + int any_mod) { unsigned int b; unsigned int m; @@ -1578,10 +1578,10 @@ ecore_x_window_button_grab(Ecore_X_Window win, if (!t) return; _ecore_window_grabs = t; _ecore_window_grabs[_ecore_window_grabs_num - 1] = win; -} /* ecore_x_window_button_grab */ +} void -_ecore_x_sync_magic_send(int val, +_ecore_x_sync_magic_send(int val, Ecore_X_Window swin) { XEvent xev; @@ -1597,7 +1597,7 @@ _ecore_x_sync_magic_send(int val, xev.xclient.data.l[1] = 0x10000000 + val; xev.xclient.data.l[2] = swin; XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev); -} /* _ecore_x_sync_magic_send */ +} void _ecore_x_window_grab_remove(Ecore_X_Window win) @@ -1631,13 +1631,13 @@ _ecore_x_window_grab_remove(Ecore_X_Window win) _ecore_window_grabs = t; } } -} /* _ecore_x_window_grab_remove */ +} EAPI void ecore_x_window_button_ungrab(Ecore_X_Window win, - int button, - int mod, - int any_mod) + int button, + int mod, + int any_mod) { unsigned int b; unsigned int m; @@ -1664,16 +1664,16 @@ ecore_x_window_button_ungrab(Ecore_X_Window win, for (i = 0; i < 8; i++) XUngrabButton(_ecore_x_disp, b, m | locks[i], win); _ecore_x_sync_magic_send(1, win); -} /* ecore_x_window_button_ungrab */ +} int _ecore_key_grabs_num = 0; Window *_ecore_key_grabs = NULL; EAPI void ecore_x_window_key_grab(Ecore_X_Window win, - const char *key, - int mod, - int any_mod) + const char *key, + int mod, + int any_mod) { KeyCode keycode = 0; KeySym keysym; @@ -1718,7 +1718,7 @@ ecore_x_window_key_grab(Ecore_X_Window win, if (!t) return; _ecore_key_grabs = t; _ecore_key_grabs[_ecore_key_grabs_num - 1] = win; -} /* ecore_x_window_key_grab */ +} void _ecore_x_key_grab_remove(Ecore_X_Window win) @@ -1751,13 +1751,13 @@ _ecore_x_key_grab_remove(Ecore_X_Window win) _ecore_key_grabs = t; } } -} /* _ecore_x_key_grab_remove */ +} EAPI void ecore_x_window_key_ungrab(Ecore_X_Window win, - const char *key, - int mod, - int any_mod) + const char *key, + int mod, + int any_mod) { KeyCode keycode = 0; KeySym keysym; @@ -1795,7 +1795,7 @@ ecore_x_window_key_ungrab(Ecore_X_Window win, for (i = 0; i < 8; i++) XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win); _ecore_x_sync_magic_send(2, win); -} /* ecore_x_window_key_ungrab */ +} /** * Send client message with given type and format 32. @@ -1811,14 +1811,14 @@ ecore_x_window_key_ungrab(Ecore_X_Window win, * @return EINA_TRUE on success EINA_FALSE otherwise. */ EAPI Eina_Bool -ecore_x_client_message32_send(Ecore_X_Window win, - Ecore_X_Atom type, +ecore_x_client_message32_send(Ecore_X_Window win, + Ecore_X_Atom type, Ecore_X_Event_Mask mask, - long d0, - long d1, - long d2, - long d3, - long d4) + long d0, + long d1, + long d2, + long d3, + long d4) { XEvent xev; @@ -1834,7 +1834,7 @@ ecore_x_client_message32_send(Ecore_X_Window win, xev.xclient.data.l[4] = d4; return XSendEvent(_ecore_x_disp, win, False, mask, &xev) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_client_message32_send */ +} /** * Send client message with given type and format 8. @@ -1848,9 +1848,9 @@ ecore_x_client_message32_send(Ecore_X_Window win, */ EAPI Eina_Bool ecore_x_client_message8_send(Ecore_X_Window win, - Ecore_X_Atom type, - const void *data, - int len) + Ecore_X_Atom type, + const void *data, + int len) { XEvent xev; @@ -1866,12 +1866,12 @@ ecore_x_client_message8_send(Ecore_X_Window win, memset(xev.xclient.data.b + len, 0, 20 - len); return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_client_message8_send */ +} EAPI Eina_Bool ecore_x_mouse_move_send(Ecore_X_Window win, - int x, - int y) + int x, + int y) { XEvent xev; XWindowAttributes att; @@ -1894,13 +1894,13 @@ ecore_x_mouse_move_send(Ecore_X_Window win, xev.xmotion.is_hint = 0; xev.xmotion.same_screen = 1; return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_mouse_move_send */ +} EAPI Eina_Bool ecore_x_mouse_down_send(Ecore_X_Window win, - int x, - int y, - int b) + int x, + int y, + int b) { XEvent xev; XWindowAttributes att; @@ -1923,13 +1923,13 @@ ecore_x_mouse_down_send(Ecore_X_Window win, xev.xbutton.button = b; xev.xbutton.same_screen = 1; return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_mouse_down_send */ +} EAPI Eina_Bool ecore_x_mouse_up_send(Ecore_X_Window win, - int x, - int y, - int b) + int x, + int y, + int b) { XEvent xev; XWindowAttributes att; @@ -1952,21 +1952,21 @@ ecore_x_mouse_up_send(Ecore_X_Window win, xev.xbutton.button = b; xev.xbutton.same_screen = 1; return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_mouse_up_send */ +} EAPI void ecore_x_focus_reset(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime); -} /* ecore_x_focus_reset */ +} EAPI void ecore_x_events_allow_all(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime); -} /* ecore_x_events_allow_all */ +} EAPI void ecore_x_pointer_last_xy_get(int *x, @@ -1977,12 +1977,12 @@ ecore_x_pointer_last_xy_get(int *x, if (y) *y = _ecore_x_event_last_root_y; -} /* ecore_x_pointer_last_xy_get */ +} EAPI void ecore_x_pointer_xy_get(Ecore_X_Window win, - int *x, - int *y) + int *x, + int *y) { Window rwin, cwin; int rx, ry, wx, wy, ret; @@ -1996,7 +1996,7 @@ ecore_x_pointer_xy_get(Ecore_X_Window win, if (x) *x = wx; if (y) *y = wy; -} /* ecore_x_pointer_xy_get */ +} /** * Retrieve the Visual ID from a given Visual. @@ -2023,7 +2023,7 @@ ecore_x_visual_id_get(Ecore_X_Visual visual) */ EAPI Ecore_X_Visual ecore_x_default_visual_get(Ecore_X_Display *disp, - Ecore_X_Screen *screen) + Ecore_X_Screen *screen) { return DefaultVisual(disp, ecore_x_screen_index_get(screen)); } @@ -2039,7 +2039,7 @@ ecore_x_default_visual_get(Ecore_X_Display *disp, */ EAPI Ecore_X_Colormap ecore_x_default_colormap_get(Ecore_X_Display *disp, - Ecore_X_Screen *screen) + Ecore_X_Screen *screen) { return DefaultColormap(disp, ecore_x_screen_index_get(screen)); } @@ -2055,7 +2055,7 @@ ecore_x_default_colormap_get(Ecore_X_Display *disp, */ EAPI int ecore_x_default_depth_get(Ecore_X_Display *disp, - Ecore_X_Screen *screen) + Ecore_X_Screen *screen) { return DefaultDepth(disp, ecore_x_screen_index_get(screen)); } @@ -2094,5 +2094,5 @@ _ecore_x_event_modifier(unsigned int state) xmodifiers |= ECORE_X_LOCK_SHIFT; return xmodifiers; -} /* _ecore_x_event_modifier */ +} 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 fd96d5c..ee981fe 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 @@ -291,10 +291,12 @@ _ecore_x_atoms_init(void) num = sizeof(items) / sizeof(Atom_Item); atoms = alloca(num * sizeof(Atom)); names = alloca(num * sizeof(char *)); - for (i = 0; i < num; i++) names[i] = (char *)items[i].name; + for (i = 0; i < num; i++) + names[i] = (char *)items[i].name; XInternAtoms(_ecore_x_disp, names, num, False, atoms); - for (i = 0; i < num; i++) *(items[i].atom) = atoms[i]; -} /* _ecore_x_atoms_init */ + for (i = 0; i < num; i++) + *(items[i].atom) = atoms[i]; +} /** * Retrieves the atom value associated with the given name. @@ -309,11 +311,11 @@ ecore_x_atom_get(const char *name) LOGFN(__FILE__, __LINE__, __FUNCTION__); return XInternAtom(_ecore_x_disp, name, False); -} /* ecore_x_atom_get */ +} EAPI void -ecore_x_atoms_get(const char **names, - int num, +ecore_x_atoms_get(const char **names, + int num, Ecore_X_Atom *atoms) { Atom *atoms_int; @@ -327,7 +329,7 @@ ecore_x_atoms_get(const char **names, XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int); for (i = 0; i < num; i++) atoms[i] = atoms_int[i]; -} /* ecore_x_atoms_get */ +} EAPI char * ecore_x_atom_name_get(Ecore_X_Atom atom) @@ -348,5 +350,5 @@ ecore_x_atom_name_get(Ecore_X_Atom atom) XFree(xname); return name; -} /* ecore_x_atom_name_get */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c index 43153ff..b919db9 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c @@ -30,24 +30,24 @@ _ecore_x_composite_init(void) # endif } #endif -} /* _ecore_x_composite_init */ +} EAPI Eina_Bool ecore_x_composite_query(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _composite_available; -} /* ecore_x_composite_query */ +} EAPI void -ecore_x_composite_redirect_window(Ecore_X_Window win, +ecore_x_composite_redirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type) { #ifdef ECORE_XCOMPOSITE int update = CompositeRedirectAutomatic; LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch(type) + switch (type) { case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: update = CompositeRedirectAutomatic; @@ -56,20 +56,20 @@ ecore_x_composite_redirect_window(Ecore_X_Window win, case ECORE_X_COMPOSITE_UPDATE_MANUAL: update = CompositeRedirectManual; break; - } /* switch */ + } XCompositeRedirectWindow(_ecore_x_disp, win, update); #endif /* ifdef ECORE_XCOMPOSITE */ -} /* ecore_x_composite_redirect_window */ +} EAPI void -ecore_x_composite_redirect_subwindows(Ecore_X_Window win, +ecore_x_composite_redirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type) { #ifdef ECORE_XCOMPOSITE int update = CompositeRedirectAutomatic; LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch(type) + switch (type) { case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: update = CompositeRedirectAutomatic; @@ -78,20 +78,20 @@ ecore_x_composite_redirect_subwindows(Ecore_X_Window win, case ECORE_X_COMPOSITE_UPDATE_MANUAL: update = CompositeRedirectManual; break; - } /* switch */ + } XCompositeRedirectSubwindows(_ecore_x_disp, win, update); #endif /* ifdef ECORE_XCOMPOSITE */ -} /* ecore_x_composite_redirect_subwindows */ +} EAPI void -ecore_x_composite_unredirect_window(Ecore_X_Window win, +ecore_x_composite_unredirect_window(Ecore_X_Window win, Ecore_X_Composite_Update_Type type) { #ifdef ECORE_XCOMPOSITE int update = CompositeRedirectAutomatic; LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch(type) + switch (type) { case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: update = CompositeRedirectAutomatic; @@ -100,20 +100,20 @@ ecore_x_composite_unredirect_window(Ecore_X_Window win, case ECORE_X_COMPOSITE_UPDATE_MANUAL: update = CompositeRedirectManual; break; - } /* switch */ + } XCompositeUnredirectWindow(_ecore_x_disp, win, update); #endif /* ifdef ECORE_XCOMPOSITE */ -} /* ecore_x_composite_unredirect_window */ +} EAPI void -ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, +ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, Ecore_X_Composite_Update_Type type) { #ifdef ECORE_XCOMPOSITE int update = CompositeRedirectAutomatic; LOGFN(__FILE__, __LINE__, __FUNCTION__); - switch(type) + switch (type) { case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: update = CompositeRedirectAutomatic; @@ -122,10 +122,10 @@ ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, case ECORE_X_COMPOSITE_UPDATE_MANUAL: update = CompositeRedirectManual; break; - } /* switch */ + } XCompositeUnredirectSubwindows(_ecore_x_disp, win, update); #endif /* ifdef ECORE_XCOMPOSITE */ -} /* ecore_x_composite_unredirect_subwindows */ +} EAPI Ecore_X_Pixmap ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) @@ -136,7 +136,7 @@ ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win); #endif /* ifdef ECORE_XCOMPOSITE */ return pixmap; -} /* ecore_x_composite_name_window_pixmap_get */ +} EAPI void ecore_x_composite_window_events_disable(Ecore_X_Window win) @@ -163,7 +163,7 @@ ecore_x_composite_render_window_enable(Ecore_X_Window root) ecore_x_composite_window_events_disable(win); #endif /* ifdef ECORE_XCOMPOSITE */ return win; -} /* ecore_x_composite_render_window_enable */ +} EAPI void ecore_x_composite_render_window_disable(Ecore_X_Window root) @@ -172,5 +172,5 @@ ecore_x_composite_render_window_disable(Ecore_X_Window root) LOGFN(__FILE__, __LINE__, __FUNCTION__); XCompositeReleaseOverlayWindow(_ecore_x_disp, root); #endif /* ifdef ECORE_XCOMPOSITE */ -} /* ecore_x_composite_render_window_disable */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c index 434505c..a968c56 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c @@ -10,15 +10,15 @@ EAPI Eina_Bool ecore_x_cursor_color_supported_get(void) { return _ecore_x_xcursor; -} /* ecore_x_cursor_color_supported_get */ +} EAPI Ecore_X_Cursor ecore_x_cursor_new(Ecore_X_Window win, - int *pixels, - int w, - int h, - int hot_x, - int hot_y) + int *pixels, + int w, + int h, + int hot_x, + int hot_y) { #ifdef ECORE_XCURSOR LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -43,7 +43,7 @@ ecore_x_cursor_new(Ecore_X_Window win, // r = (((pixels[i] >> 16) & 0xff) * a) / 0xff; // g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff; // b = (((pixels[i] ) & 0xff) * a) / 0xff; - xci->pixels[i] = pixels[i]; + xci->pixels[i] = pixels[i]; // (a << 24) | (r << 16) | (g << 8) | (b); } c = XcursorImageLoadCursor(_ecore_x_disp, xci); @@ -200,14 +200,14 @@ ecore_x_cursor_new(Ecore_X_Window win, } return 0; -} /* ecore_x_cursor_new */ +} EAPI void ecore_x_cursor_free(Ecore_X_Cursor c) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XFreeCursor(_ecore_x_disp, c); -} /* ecore_x_cursor_free */ +} /* * Returns the cursor for the given shape. @@ -220,7 +220,7 @@ ecore_x_cursor_shape_get(int shape) LOGFN(__FILE__, __LINE__, __FUNCTION__); /* Shapes are defined in Ecore_X_Cursor.h */ return XCreateFontCursor(_ecore_x_disp, shape); -} /* ecore_x_cursor_shape_get */ +} EAPI void ecore_x_cursor_size_set(int size) @@ -231,7 +231,7 @@ ecore_x_cursor_size_set(int size) #else /* ifdef ECORE_XCURSOR */ size = 0; #endif /* ifdef ECORE_XCURSOR */ -} /* ecore_x_cursor_size_set */ +} EAPI int ecore_x_cursor_size_get(void) @@ -242,5 +242,5 @@ ecore_x_cursor_size_get(void) #else /* ifdef ECORE_XCURSOR */ return 0; #endif /* ifdef ECORE_XCURSOR */ -} /* ecore_x_cursor_size_get */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c index 5e44d07..b094f85 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c @@ -26,16 +26,16 @@ _ecore_x_damage_init(void) #else /* ifdef ECORE_XDAMAGE */ _damage_available = EINA_FALSE; #endif /* ifdef ECORE_XDAMAGE */ -} /* _ecore_x_damage_init */ +} EAPI Eina_Bool ecore_x_damage_query(void) { return _damage_available; -} /* ecore_x_damage_query */ +} EAPI Ecore_X_Damage -ecore_x_damage_new(Ecore_X_Drawable d, +ecore_x_damage_new(Ecore_X_Drawable d, Ecore_X_Damage_Report_Level level) { #ifdef ECORE_XDAMAGE @@ -47,7 +47,7 @@ ecore_x_damage_new(Ecore_X_Drawable d, #else /* ifdef ECORE_XDAMAGE */ return 0; #endif /* ifdef ECORE_XDAMAGE */ -} /* ecore_x_damage_new */ +} EAPI void ecore_x_damage_free(Ecore_X_Damage damage) @@ -56,7 +56,7 @@ ecore_x_damage_free(Ecore_X_Damage damage) LOGFN(__FILE__, __LINE__, __FUNCTION__); XDamageDestroy(_ecore_x_disp, damage); #endif /* ifdef ECORE_XDAMAGE */ -} /* ecore_x_damage_free */ +} EAPI void ecore_x_damage_subtract(Ecore_X_Damage damage, @@ -67,5 +67,5 @@ ecore_x_damage_subtract(Ecore_X_Damage damage, LOGFN(__FILE__, __LINE__, __FUNCTION__); XDamageSubtract(_ecore_x_disp, damage, repair, parts); #endif /* ifdef ECORE_XDAMAGE */ -} /* ecore_x_damage_subtract */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c index 7908584..372470a 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c @@ -65,7 +65,7 @@ _ecore_x_dnd_init(void) } _ecore_x_dnd_init_count++; -} /* _ecore_x_dnd_init */ +} void _ecore_x_dnd_shutdown(void) @@ -85,16 +85,16 @@ _ecore_x_dnd_shutdown(void) _target = NULL; _ecore_x_dnd_init_count = 0; -} /* _ecore_x_dnd_shutdown */ +} static Eina_Bool -_ecore_x_dnd_converter_copy(char *target __UNUSED__, - void *data, - int size, - void **data_ret, - int *size_ret, +_ecore_x_dnd_converter_copy(char *target __UNUSED__, + void *data, + int size, + void **data_ret, + int *size_ret, Ecore_X_Atom *tprop __UNUSED__, - int *count __UNUSED__) + int *count __UNUSED__) { XTextProperty text_prop; char *mystr; @@ -130,11 +130,11 @@ _ecore_x_dnd_converter_copy(char *target __UNUSED__, free(mystr); return EINA_FALSE; } -} /* _ecore_x_dnd_converter_copy */ +} EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, - Eina_Bool on) + Eina_Bool on) { Ecore_X_Atom prop_data = ECORE_X_DND_VERSION; @@ -144,7 +144,7 @@ ecore_x_dnd_aware_set(Ecore_X_Window win, XA_ATOM, 32, &prop_data, 1); else ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE); -} /* ecore_x_dnd_aware_set */ +} EAPI int ecore_x_dnd_version_get(Ecore_X_Window win) @@ -208,11 +208,11 @@ ecore_x_dnd_version_get(Ecore_X_Window win) } return 0; -} /* ecore_x_dnd_version_get */ +} EAPI Eina_Bool ecore_x_dnd_type_isset(Ecore_X_Window win, - const char *type) + const char *type) { int num, i, ret = EINA_FALSE; unsigned char *data; @@ -237,12 +237,12 @@ ecore_x_dnd_type_isset(Ecore_X_Window win, XFree(data); return ret; -} /* ecore_x_dnd_type_isset */ +} EAPI void ecore_x_dnd_type_set(Ecore_X_Window win, - const char *type, - Eina_Bool on) + const char *type, + Eina_Bool on) { Ecore_X_Atom atom; Ecore_X_Atom *oldset = NULL, *newset = NULL; @@ -305,12 +305,12 @@ ecore_x_dnd_type_set(Ecore_X_Window win, XFree(oldset); free(newset); -} /* ecore_x_dnd_type_set */ +} EAPI void ecore_x_dnd_types_set(Ecore_X_Window win, - const char **types, - unsigned int num_types) + const char **types, + unsigned int num_types) { Ecore_X_Atom *newset = NULL; unsigned int i; @@ -336,12 +336,12 @@ ecore_x_dnd_types_set(Ecore_X_Window win, XA_ATOM, 32, data, num_types); free(newset); } -} /* ecore_x_dnd_types_set */ +} EAPI void ecore_x_dnd_actions_set(Ecore_X_Window win, - Ecore_X_Atom *actions, - unsigned int num_actions) + Ecore_X_Atom *actions, + unsigned int num_actions) { unsigned int i; unsigned char *data = NULL; @@ -360,7 +360,7 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST, XA_ATOM, 32, data, num_actions); } -} /* ecore_x_dnd_actions_set */ +} /** * The DND position update cb is called Ecore_X sends a DND position to a @@ -378,9 +378,9 @@ ecore_x_dnd_actions_set(Ecore_X_Window win, */ EAPI void ecore_x_dnd_callback_pos_update_set( - void (*cb)(void *, - Ecore_X_Xdnd_Position *data), - const void *data) + void (*cb)(void *, + Ecore_X_Xdnd_Position *data), + const void *data) { _posupdatecb = cb; _posupdatedata = (void *)data; /* Discard the const early */ @@ -390,18 +390,18 @@ Ecore_X_DND_Source * _ecore_x_dnd_source_get(void) { return _source; -} /* _ecore_x_dnd_source_get */ +} Ecore_X_DND_Target * _ecore_x_dnd_target_get(void) { return _target; -} /* _ecore_x_dnd_target_get */ +} EAPI Eina_Bool ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, - int size) + int size) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!ecore_x_dnd_version_get(source)) @@ -433,7 +433,7 @@ ecore_x_dnd_begin(Ecore_X_Window source, _source->dest = None; return EINA_TRUE; -} /* ecore_x_dnd_begin */ +} EAPI Eina_Bool ecore_x_dnd_drop(void) @@ -471,8 +471,8 @@ ecore_x_dnd_drop(void) else { /* Dropping on nothing */ - ecore_x_selection_xdnd_clear(); - _source->state = ECORE_X_DND_SOURCE_IDLE; + ecore_x_selection_xdnd_clear(); + _source->state = ECORE_X_DND_SOURCE_IDLE; } ecore_x_window_ignore_set(_source->win, 0); @@ -480,13 +480,13 @@ ecore_x_dnd_drop(void) _source->prev.window = 0; return status; -} /* ecore_x_dnd_drop */ +} EAPI void -ecore_x_dnd_send_status(Eina_Bool will_accept, - Eina_Bool suppress, +ecore_x_dnd_send_status(Eina_Bool will_accept, + Eina_Bool suppress, Ecore_X_Rectangle rectangle, - Ecore_X_Atom action) + Ecore_X_Atom action) { XEvent xev; @@ -532,7 +532,7 @@ ecore_x_dnd_send_status(Eina_Bool will_accept, } XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev); -} /* ecore_x_dnd_send_status */ +} EAPI void ecore_x_dnd_send_finished(void) @@ -561,7 +561,7 @@ ecore_x_dnd_send_finished(void) XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev); _target->state = ECORE_X_DND_TARGET_IDLE; -} /* ecore_x_dnd_send_finished */ +} EAPI void ecore_x_dnd_source_action_set(Ecore_X_Atom action) @@ -569,18 +569,18 @@ ecore_x_dnd_source_action_set(Ecore_X_Atom action) _source->action = action; if (_source->prev.window) _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y); -} /* ecore_x_dnd_source_action_set */ +} EAPI Ecore_X_Atom ecore_x_dnd_source_action_get(void) { return _source->action; -} /* ecore_x_dnd_source_action_get */ +} void _ecore_x_dnd_drag(Ecore_X_Window root, - int x, - int y) + int x, + int y) { XEvent xev; Ecore_X_Window win; @@ -701,6 +701,6 @@ _ecore_x_dnd_drag(Ecore_X_Window root, _source->prev.y = y; _source->prev.window = root; _source->dest = win; -} /* _ecore_x_dnd_drag */ +} /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c index 74d5344..23349f4 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c @@ -23,7 +23,7 @@ _ecore_x_dpms_init(void) #else /* ifdef ECORE_XDPMS */ _dpms_available = EINA_FALSE; #endif /* ifdef ECORE_XDPMS */ -} /* _ecore_x_dpms_init */ +} /** * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions @@ -40,7 +40,7 @@ EAPI Eina_Bool ecore_x_dpms_query(void) { return _dpms_available; -} /* ecore_x_dpms_query */ +} /** * Checks if the X server is capable of DPMS. @@ -56,7 +56,7 @@ ecore_x_dpms_capable_get(void) #else /* ifdef ECORE_XDPMS */ return EINA_FALSE; #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_capable_get */ +} /** * Checks the DPMS state of the display. @@ -76,7 +76,7 @@ ecore_x_dpms_enabled_get(void) #else /* ifdef ECORE_XDPMS */ return EINA_FALSE; #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_enabled_get */ +} /** * Sets the DPMS state of the display. @@ -94,7 +94,7 @@ ecore_x_dpms_enabled_set(int enabled) DPMSDisable(_ecore_x_disp); #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_enabled_set */ +} /** * Gets the timeouts. The values are in unit of seconds. @@ -113,7 +113,7 @@ ecore_x_dpms_timeouts_get(unsigned int *standby, DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby, (unsigned short *)suspend, (unsigned short *)off); #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeouts_get */ +} /** * Sets the timeouts. The values are in unit of seconds. @@ -133,7 +133,7 @@ ecore_x_dpms_timeouts_set(unsigned int standby, #else /* ifdef ECORE_XDPMS */ return EINA_FALSE; #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeouts_set */ +} /** * Returns the amount of time of inactivity before standby mode is invoked. @@ -152,7 +152,7 @@ ecore_x_dpms_timeout_standby_get(void) #else /* ifdef ECORE_XDPMS */ return 0; #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeout_standby_get */ +} /** * Returns the amount of time of inactivity before the second level of @@ -172,7 +172,7 @@ ecore_x_dpms_timeout_suspend_get(void) #else /* ifdef ECORE_XDPMS */ return 0; #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeout_suspend_get */ +} /** * Returns the amount of time of inactivity before the third and final @@ -192,11 +192,11 @@ ecore_x_dpms_timeout_off_get(void) #else /* ifdef ECORE_XDPMS */ return 0; #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeout_off_get */ +} /** * Sets the standby timeout (in unit of seconds). - * @param new_standby Amount of time of inactivity before standby mode will be invoked. + * @param new_timeout Amount of time of inactivity before standby mode will be invoked. * @ingroup Ecore_X_DPMS_Group */ EAPI void @@ -209,11 +209,11 @@ ecore_x_dpms_timeout_standby_set(unsigned int new_timeout) DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off); #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeout_standby_set */ +} /** * Sets the suspend timeout (in unit of seconds). - * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode. * @ingroup Ecore_X_DPMS_Group */ EAPI void @@ -226,11 +226,11 @@ ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout) DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off); #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeout_suspend_set */ +} /** * Sets the off timeout (in unit of seconds). - * @param off Amount of time of inactivity before the monitor is shut off. + * @param new_timeout Amount of time of inactivity before the monitor is shut off. * @ingroup Ecore_X_DPMS_Group */ EAPI void @@ -243,5 +243,5 @@ ecore_x_dpms_timeout_off_set(unsigned int new_timeout) DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout); #endif /* ifdef ECORE_XDPMS */ -} /* ecore_x_dpms_timeout_off_set */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c index a64060b..d1b4111 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c @@ -21,10 +21,10 @@ */ EAPI void ecore_x_drawable_geometry_get(Ecore_X_Drawable d, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { Window dummy_win; int ret_x, ret_y; @@ -51,7 +51,7 @@ ecore_x_drawable_geometry_get(Ecore_X_Drawable d, if (h) *h = (int)ret_h; -} /* ecore_x_drawable_geometry_get */ +} /** * Retrieves the width of the border of the given drawable. @@ -72,7 +72,7 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable d) border_ret = 0; return (int)border_ret; -} /* ecore_x_drawable_border_width_get */ +} /** * Retrieves the depth of the given drawable. @@ -93,7 +93,7 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d) depth_ret = 0; return (int)depth_ret; -} /* ecore_x_drawable_depth_get */ +} /** * Fill the specified rectangle on a drawable. @@ -106,13 +106,13 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d) */ EAPI void ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, - Ecore_X_GC gc, - int x, - int y, - int width, - int height) + Ecore_X_GC gc, + int x, + int y, + int width, + int height) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height); -} /* ecore_x_drawable_rectangle_fill */ +} 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 d357c9b..5966bbd 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 @@ -14,14 +14,14 @@ EAPI void ecore_x_e_init(void) { -} /* ecore_x_e_init */ +} EAPI void ecore_x_e_frame_size_set(Ecore_X_Window win, - int fl, - int fr, - int ft, - int fb) + int fl, + int fr, + int ft, + int fb) { unsigned int frames[4]; @@ -31,16 +31,16 @@ ecore_x_e_frame_size_set(Ecore_X_Window win, frames[2] = ft; frames[3] = fb; ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4); -} /* ecore_x_e_frame_size_set */ +} EAPI void ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, - unsigned int is_keyboard) + unsigned int is_keyboard) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, &is_keyboard, 1); -} /* ecore_x_e_virtual_keyboard_set */ +} EAPI Eina_Bool ecore_x_e_virtual_keyboard_get(Ecore_X_Window win) @@ -53,7 +53,7 @@ ecore_x_e_virtual_keyboard_get(Ecore_X_Window win) return EINA_FALSE; return val ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_e_virtual_keyboard_get */ +} static Ecore_X_Virtual_Keyboard_State _ecore_x_e_vkbd_state_get(Ecore_X_Atom atom) @@ -104,7 +104,7 @@ _ecore_x_e_vkbd_state_get(Ecore_X_Atom atom) return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME; return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; -} /* _ecore_x_e_vkbd_state_get */ +} static Ecore_X_Atom _ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state) @@ -157,12 +157,12 @@ _ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state) return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME; default: break; - } /* switch */ + } return 0; -} /* _ecore_x_e_vkbd_atom_get */ +} EAPI void -ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, +ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state) { Ecore_X_Atom atom = 0; @@ -171,7 +171,7 @@ ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, atom = _ecore_x_e_vkbd_atom_get(state); ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, &atom, 1); -} /* ecore_x_e_virtual_keyboard_state_set */ +} EAPI Ecore_X_Virtual_Keyboard_State ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win) @@ -184,10 +184,10 @@ ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win) return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; return _ecore_x_e_vkbd_state_get(atom); -} /* ecore_x_e_virtual_keyboard_state_get */ +} EAPI void -ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, +ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, Ecore_X_Virtual_Keyboard_State state) { LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -195,7 +195,7 @@ ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, _ecore_x_e_vkbd_atom_get(state), 0, 0, 0, 0); -} /* ecore_x_e_virtual_keyboard_state_send */ +} static Ecore_X_Atom _ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode) @@ -213,9 +213,9 @@ _ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode) default: break; - } /* switch */ + } return ECORE_X_ILLUME_MODE_UNKNOWN; -} /* _ecore_x_e_illume_atom_get */ +} static Ecore_X_Illume_Mode _ecore_x_e_illume_mode_get(Ecore_X_Atom atom) @@ -230,7 +230,7 @@ _ecore_x_e_illume_mode_get(Ecore_X_Atom atom) return ECORE_X_ILLUME_MODE_DUAL_LEFT; return ECORE_X_ILLUME_MODE_UNKNOWN; -} /* _ecore_x_e_illume_mode_get */ +} EAPI void ecore_x_e_illume_zone_set(Ecore_X_Window win, @@ -239,7 +239,7 @@ ecore_x_e_illume_zone_set(Ecore_X_Window win, LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE, &zone, 1); -} /* ecore_x_e_illume_zone_set */ +} EAPI Ecore_X_Window ecore_x_e_illume_zone_get(Ecore_X_Window win) @@ -252,26 +252,26 @@ ecore_x_e_illume_zone_get(Ecore_X_Window win) return 0; return zone; -} /* ecore_x_e_illume_zone_get */ +} EAPI void -ecore_x_e_illume_zone_list_set(Ecore_X_Window win, +ecore_x_e_illume_zone_list_set(Ecore_X_Window win, Ecore_X_Window *zones, - unsigned int n_zones) + unsigned int n_zones) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST, zones, n_zones); -} /* ecore_x_e_illume_zone_list_set */ +} EAPI void ecore_x_e_illume_conformant_set(Ecore_X_Window win, - unsigned int is_conformant) + unsigned int is_conformant) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, &is_conformant, 1); -} /* ecore_x_e_illume_conformant_set */ +} EAPI Eina_Bool ecore_x_e_illume_conformant_get(Ecore_X_Window win) @@ -284,10 +284,10 @@ ecore_x_e_illume_conformant_get(Ecore_X_Window win) return EINA_FALSE; return val ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_e_illume_conformant_get */ +} EAPI void -ecore_x_e_illume_mode_set(Ecore_X_Window win, +ecore_x_e_illume_mode_set(Ecore_X_Window win, Ecore_X_Illume_Mode mode) { Ecore_X_Atom atom = 0; @@ -296,7 +296,7 @@ ecore_x_e_illume_mode_set(Ecore_X_Window win, atom = _ecore_x_e_illume_atom_get(mode); ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1); -} /* ecore_x_e_illume_mode_set */ +} EAPI Ecore_X_Illume_Mode ecore_x_e_illume_mode_get(Ecore_X_Window win) @@ -308,10 +308,10 @@ ecore_x_e_illume_mode_get(Ecore_X_Window win) return ECORE_X_ILLUME_MODE_UNKNOWN; return _ecore_x_e_illume_mode_get(atom); -} /* ecore_x_e_illume_mode_get */ +} EAPI void -ecore_x_e_illume_mode_send(Ecore_X_Window win, +ecore_x_e_illume_mode_send(Ecore_X_Window win, Ecore_X_Illume_Mode mode) { LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -319,7 +319,7 @@ ecore_x_e_illume_mode_send(Ecore_X_Window win, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, _ecore_x_e_illume_atom_get(mode), 0, 0, 0, 0); -} /* ecore_x_e_illume_mode_send */ +} EAPI void ecore_x_e_illume_focus_back_send(Ecore_X_Window win) @@ -328,7 +328,7 @@ ecore_x_e_illume_focus_back_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_focus_back_send */ +} EAPI void ecore_x_e_illume_focus_forward_send(Ecore_X_Window win) @@ -337,7 +337,7 @@ ecore_x_e_illume_focus_forward_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_focus_forward_send */ +} EAPI void ecore_x_e_illume_focus_home_send(Ecore_X_Window win) @@ -346,7 +346,7 @@ ecore_x_e_illume_focus_home_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_focus_home_send */ +} EAPI void ecore_x_e_illume_close_send(Ecore_X_Window win) @@ -355,7 +355,7 @@ ecore_x_e_illume_close_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_close_send */ +} EAPI void ecore_x_e_illume_home_new_send(Ecore_X_Window win) @@ -364,7 +364,7 @@ ecore_x_e_illume_home_new_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_home_new_send */ +} EAPI void ecore_x_e_illume_home_del_send(Ecore_X_Window win) @@ -373,15 +373,15 @@ ecore_x_e_illume_home_del_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_home_del_send */ +} EAPI void ecore_x_e_illume_drag_set(Ecore_X_Window win, - unsigned int drag) + unsigned int drag) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1); -} /* ecore_x_e_illume_drag_set */ +} EAPI Eina_Bool ecore_x_e_illume_drag_get(Ecore_X_Window win) @@ -393,16 +393,16 @@ ecore_x_e_illume_drag_get(Ecore_X_Window win) return EINA_FALSE; return val ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_e_illume_drag_get */ +} EAPI void ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, - unsigned int is_locked) + unsigned int is_locked) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, &is_locked, 1); -} /* ecore_x_e_illume_drag_locked_set */ +} EAPI Eina_Bool ecore_x_e_illume_drag_locked_get(Ecore_X_Window win) @@ -415,7 +415,7 @@ ecore_x_e_illume_drag_locked_get(Ecore_X_Window win) return EINA_FALSE; return val ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_e_illume_drag_locked_get */ +} EAPI void ecore_x_e_illume_drag_start_send(Ecore_X_Window win) @@ -424,7 +424,7 @@ ecore_x_e_illume_drag_start_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_drag_start_send */ +} EAPI void ecore_x_e_illume_drag_end_send(Ecore_X_Window win) @@ -433,14 +433,14 @@ ecore_x_e_illume_drag_end_send(Ecore_X_Window win) ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_drag_end_send */ +} EAPI void ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { unsigned int geom[4]; @@ -451,14 +451,14 @@ ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, geom[3] = h; ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, geom, 4); -} /* ecore_x_e_illume_indicator_geometry_set */ +} EAPI Eina_Bool ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { int ret = 0; unsigned int geom[4]; @@ -484,14 +484,14 @@ ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, *h = geom[3]; return EINA_TRUE; -} /* ecore_x_e_illume_indicator_geometry_get */ +} EAPI void ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { unsigned int geom[4]; @@ -502,14 +502,14 @@ ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, geom[3] = h; ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, geom, 4); -} /* ecore_x_e_illume_softkey_geometry_set */ +} EAPI Eina_Bool ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { int ret = 0; unsigned int geom[4]; @@ -535,14 +535,14 @@ ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, *h = geom[3]; return EINA_TRUE; -} /* ecore_x_e_illume_softkey_geometry_get */ +} EAPI void ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { unsigned int geom[4]; @@ -553,14 +553,14 @@ ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, geom[3] = h; ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, geom, 4); -} /* ecore_x_e_illume_keyboard_geometry_set */ +} EAPI Eina_Bool ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { int ret = 0; unsigned int geom[4]; @@ -586,7 +586,7 @@ ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, *h = geom[3]; return EINA_TRUE; -} /* ecore_x_e_illume_keyboard_geometry_get */ +} static Ecore_X_Atom _ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state) @@ -601,9 +601,9 @@ _ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state) default: break; - } /* switch */ + } return 0; -} /* _ecore_x_e_quickpanel_atom_get */ +} static Ecore_X_Illume_Quickpanel_State _ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom) @@ -615,16 +615,16 @@ _ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom) return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF; return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; -} /* _ecore_x_e_quickpanel_state_get */ +} EAPI void ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, - unsigned int is_quickpanel) + unsigned int is_quickpanel) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, &is_quickpanel, 1); -} /* ecore_x_e_illume_quickpanel_set */ +} EAPI Eina_Bool ecore_x_e_illume_quickpanel_get(Ecore_X_Window win) @@ -637,10 +637,10 @@ ecore_x_e_illume_quickpanel_get(Ecore_X_Window win) return EINA_FALSE; return val ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_e_illume_quickpanel_get */ +} EAPI void -ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, +ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state) { Ecore_X_Atom atom = 0; @@ -649,7 +649,7 @@ ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, atom = _ecore_x_e_quickpanel_atom_get(state); ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, &atom, 1); -} /* ecore_x_e_illume_quickpanel_state_set */ +} EAPI Ecore_X_Illume_Quickpanel_State ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win) @@ -663,10 +663,10 @@ ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win) return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; return _ecore_x_e_quickpanel_state_get(atom); -} /* ecore_x_e_illume_quickpanel_state_get */ +} EAPI void -ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, +ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, Ecore_X_Illume_Quickpanel_State state) { LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -674,7 +674,7 @@ ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, _ecore_x_e_quickpanel_atom_get(state), 0, 0, 0, 0); -} /* ecore_x_e_illume_quickpanel_state_send */ +} EAPI void ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) @@ -684,17 +684,17 @@ ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 0, 0, 0, 0, 0); -} /* ecore_x_e_illume_quickpanel_state_toggle */ +} EAPI void ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, - unsigned int priority) + unsigned int priority) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, &priority, 1); -} /* ecore_x_e_illume_quickpanel_priority_major_set */ +} EAPI int ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win) @@ -708,17 +708,17 @@ ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win) return 0; return val; -} /* ecore_x_e_illume_quickpanel_priority_major_get */ +} EAPI void ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, - unsigned int priority) + unsigned int priority) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, &priority, 1); -} /* ecore_x_e_illume_quickpanel_priority_minor_set */ +} EAPI int ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win) @@ -732,17 +732,17 @@ ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win) return 0; return val; -} /* ecore_x_e_illume_quickpanel_priority_minor_get */ +} EAPI void ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, - unsigned int zone) + unsigned int zone) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, &zone, 1); -} /* ecore_x_e_illume_quickpanel_zone_set */ +} EAPI int ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win) @@ -756,7 +756,7 @@ ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win) return 0; return val; -} /* ecore_x_e_illume_quickpanel_zone_get */ +} EAPI void ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win) @@ -766,10 +766,10 @@ ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win) ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); -} /* ecore_x_e_illume_quickpanel_position_update_send */ +} EAPI void -ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, +ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter) { LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -778,7 +778,7 @@ ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, ECORE_X_ATOM_CARDINAL, &counter, 1); else ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER); -} /* ecore_x_e_comp_sync_counter_set */ +} EAPI Ecore_X_Sync_Counter ecore_x_e_comp_sync_counter_get(Ecore_X_Window win) @@ -796,7 +796,7 @@ ecore_x_e_comp_sync_counter_get(Ecore_X_Window win) return 0; return counter; -} /* ecore_x_e_comp_sync_counter_get */ +} EAPI void ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, @@ -822,13 +822,13 @@ ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, XSendEvent(_ecore_x_disp, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_sync_draw_done_send */ +} EAPI void ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, Ecore_X_Window win, - int w, - int h) + int w, + int h) { XEvent xev; @@ -850,11 +850,11 @@ ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, XSendEvent(_ecore_x_disp, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_sync_draw_done_send */ +} EAPI void ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, - Eina_Bool enabled) + Eina_Bool enabled) { Ecore_X_Window win; @@ -887,7 +887,7 @@ ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, ecore_x_window_free(win); } } -} /* ecore_x_e_comp_sync_supported_set */ +} EAPI Eina_Bool ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) @@ -916,7 +916,7 @@ ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) } return EINA_FALSE; -} /* ecore_x_e_comp_sync_supported_get */ +} EAPI void ecore_x_e_comp_sync_begin_send(Ecore_X_Window win) @@ -938,7 +938,7 @@ ecore_x_e_comp_sync_begin_send(Ecore_X_Window win) XSendEvent(_ecore_x_disp, win, False, NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_sync_begin_send */ +} EAPI void ecore_x_e_comp_sync_end_send(Ecore_X_Window win) @@ -960,7 +960,7 @@ ecore_x_e_comp_sync_end_send(Ecore_X_Window win) XSendEvent(_ecore_x_disp, win, False, NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_sync_end_send */ +} EAPI void ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win) @@ -982,7 +982,7 @@ ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win) XSendEvent(_ecore_x_disp, win, False, NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_sync_cancel_send */ +} EAPI void ecore_x_e_comp_flush_send(Ecore_X_Window win) @@ -1004,7 +1004,7 @@ ecore_x_e_comp_flush_send(Ecore_X_Window win) XSendEvent(_ecore_x_disp, win, False, NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_flush_send */ +} EAPI void ecore_x_e_comp_dump_send(Ecore_X_Window win) @@ -1026,7 +1026,7 @@ ecore_x_e_comp_dump_send(Ecore_X_Window win) XSendEvent(_ecore_x_disp, win, False, NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_e_comp_dump_send */ +} EAPI void ecore_x_e_comp_pixmap_set(Ecore_X_Window win, @@ -1038,7 +1038,7 @@ ecore_x_e_comp_pixmap_set(Ecore_X_Window win, ECORE_X_ATOM_PIXMAP, &pixmap, 1); else ecore_x_window_prop_property_del(win, pixmap); -} /* ecore_x_e_comp_pixmap_set */ +} EAPI Ecore_X_Pixmap ecore_x_e_comp_pixmap_get(Ecore_X_Window win) @@ -1056,5 +1056,5 @@ ecore_x_e_comp_pixmap_get(Ecore_X_Window win) return 0; return pixmap; -} /* ecore_x_e_comp_pixmap_get */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c index 837ff53..11e9f20 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c @@ -9,7 +9,7 @@ #include "ecore_x_private.h" #include "Ecore_X.h" -static int _ecore_x_error_handle(Display *d, +static int _ecore_x_error_handle(Display *d, XErrorEvent *ev); static int _ecore_x_io_error_handle(Display *d); @@ -19,6 +19,7 @@ static void (*_io_error_func)(void *data) = NULL; static void *_io_error_data = NULL; static int _error_request_code = 0; static int _error_code = 0; +static Ecore_X_ID _error_resource_id = 0; /** * Set the error handler. @@ -28,12 +29,12 @@ static int _error_code = 0; * Set the X error handler function */ EAPI void -ecore_x_error_handler_set(void (*func)(void *data), +ecore_x_error_handler_set(void (*func)(void *data), const void *data) { _error_func = func; _error_data = (void *)data; -} /* ecore_x_error_handler_set */ +} /** * Set the I/O error handler. @@ -43,12 +44,12 @@ ecore_x_error_handler_set(void (*func)(void *data), * Set the X I/O error handler function */ EAPI void -ecore_x_io_error_handler_set(void (*func)(void *data), +ecore_x_io_error_handler_set(void (*func)(void *data), const void *data) { _io_error_func = func; _io_error_data = (void *)data; -} /* ecore_x_io_error_handler_set */ +} /** * Get the request code that caused the error. @@ -60,7 +61,7 @@ EAPI int ecore_x_error_request_get(void) { return _error_request_code; -} /* ecore_x_error_request_get */ +} /** * Get the error code from the error. @@ -72,28 +73,41 @@ EAPI int ecore_x_error_code_get(void) { return _error_code; -} /* ecore_x_error_code_get */ +} + +/** + * Get the resource id that caused the error. + * @return The resource id causing the X error + * + * Return the X resource id that caused the last X error + */ +EAPI Ecore_X_ID +ecore_x_error_resource_id_get(void) +{ + return _error_resource_id; +} void _ecore_x_error_handler_init(void) { XSetErrorHandler((XErrorHandler)_ecore_x_error_handle); XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle); -} /* _ecore_x_error_handler_init */ +} static int -_ecore_x_error_handle(Display *d, +_ecore_x_error_handle(Display *d, XErrorEvent *ev) { if (d == _ecore_x_disp) { _error_request_code = ev->request_code; _error_code = ev->error_code; + _error_resource_id = ev->resourceid; if (_error_func) _error_func(_error_data); } return 0; -} /* _ecore_x_error_handle */ +} static int _ecore_x_io_error_handle(Display *d) @@ -107,5 +121,5 @@ _ecore_x_io_error_handle(Display *d) } return 0; -} /* _ecore_x_io_error_handle */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c index 136cd63..0b06a79 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c @@ -100,10 +100,10 @@ _ecore_x_event_free_mouse_move(void *data __UNUSED__, } free(e); -} /* _ecore_x_event_free_mouse_move */ +} EAPI void -ecore_x_event_mask_set(Ecore_X_Window w, +ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mask mask) { XWindowAttributes attr; @@ -117,10 +117,10 @@ ecore_x_event_mask_set(Ecore_X_Window w, XGetWindowAttributes(_ecore_x_disp, w, &attr); s_attr.event_mask = mask | attr.your_event_mask; XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); -} /* ecore_x_event_mask_set */ +} EAPI void -ecore_x_event_mask_unset(Ecore_X_Window w, +ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask) { XWindowAttributes attr; @@ -134,7 +134,7 @@ ecore_x_event_mask_unset(Ecore_X_Window w, XGetWindowAttributes(_ecore_x_disp, w, &attr); s_attr.event_mask = attr.your_event_mask & ~mask; XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); -} /* ecore_x_event_mask_unset */ +} static void _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, @@ -148,7 +148,7 @@ _ecore_x_event_free_xdnd_enter(void *data __UNUSED__, XFree(e->types[i]); free(e->types); free(e); -} /* _ecore_x_event_free_xdnd_enter */ +} static void _ecore_x_event_free_selection_notify(void *data __UNUSED__, @@ -164,7 +164,7 @@ _ecore_x_event_free_selection_notify(void *data __UNUSED__, free(e->target); free(e); -} /* _ecore_x_event_free_selection_notify */ +} static unsigned int _ecore_x_event_modifiers(unsigned int state) @@ -196,28 +196,28 @@ _ecore_x_event_modifiers(unsigned int state) modifiers |= ECORE_EVENT_LOCK_SHIFT; return modifiers; -} /* _ecore_x_event_modifiers */ +} void _ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers, - int x, - int y, - int x_root, - int y_root, + int x, + int y, + int x_root, + int y_root, unsigned int event_window, unsigned int window, unsigned int root_win, - int same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - double mx, - double my, - double mrx, - double mry) + int same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + double mx, + double my, + double mrx, + double mry) { Ecore_Event_Mouse_Move *e; Ecore_Event *event; @@ -260,10 +260,10 @@ _ecore_mouse_move(unsigned int timestamp, _ecore_x_event_last_root_y = y_root; _ecore_x_last_event_mouse_move_event = event; -} /* _ecore_mouse_move */ +} static void -_ecore_key_press(int event, +_ecore_key_press(int event, XKeyEvent *xevent) { Ecore_Event_Key *e; @@ -343,30 +343,30 @@ _ecore_key_press(int event, on_error: if (tmp) free(tmp); -} /* _ecore_key_press */ +} Ecore_Event_Mouse_Button * -_ecore_mouse_button(int event, +_ecore_mouse_button(int event, unsigned int timestamp, unsigned int xmodifiers, unsigned int buttons, - int x, - int y, - int x_root, - int y_root, + int x, + int y, + int x_root, + int y_root, unsigned int event_window, unsigned int window, unsigned int root_win, - int same_screen, - int dev, - double radx, - double rady, - double pressure, - double angle, - double mx, - double my, - double mrx, - double mry) + int same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + double mx, + double my, + double mrx, + double mry) { Ecore_Event_Mouse_Button *e; @@ -407,37 +407,37 @@ _ecore_mouse_button(int event, { if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) { - //Check Double Clicked - if (((int)(timestamp - down_info->last_time) <= - (int)(1000 * _ecore_x_double_click_time)) && - (window == down_info->last_win) && - (event_window == down_info->last_event_win)) - { - e->double_click = 1; - down_info->did_double = EINA_TRUE; - } - else - { - down_info->did_double = EINA_FALSE; - down_info->did_triple = EINA_FALSE; - } - - //Check Triple Clicked - if (((int)(timestamp - down_info->last_last_time) <= - (int)(2 * 1000 * _ecore_x_double_click_time)) && - (window == down_info->last_win) && - (window == down_info->last_last_win) && - (event_window == down_info->last_event_win) && - (event_window == down_info->last_last_event_win) - ) - { - e->triple_click = 1; - down_info->did_triple = EINA_TRUE; - } - else - { - down_info->did_triple = EINA_FALSE; - } + //Check Double Clicked + if (((int)(timestamp - down_info->last_time) <= + (int)(1000 * _ecore_x_double_click_time)) && + (window == down_info->last_win) && + (event_window == down_info->last_event_win)) + { + e->double_click = 1; + down_info->did_double = EINA_TRUE; + } + else + { + down_info->did_double = EINA_FALSE; + down_info->did_triple = EINA_FALSE; + } + + //Check Triple Clicked + if (((int)(timestamp - down_info->last_last_time) <= + (int)(2 * 1000 * _ecore_x_double_click_time)) && + (window == down_info->last_win) && + (window == down_info->last_last_win) && + (event_window == down_info->last_event_win) && + (event_window == down_info->last_last_event_win) + ) + { + e->triple_click = 1; + down_info->did_triple = EINA_TRUE; + } + else + { + down_info->did_triple = EINA_FALSE; + } } else { @@ -491,7 +491,7 @@ _ecore_mouse_button(int event, } return e; -} /* _ecore_mouse_button */ +} void _ecore_x_event_handle_any_event(XEvent *xevent) @@ -500,19 +500,19 @@ _ecore_x_event_handle_any_event(XEvent *xevent) if (!ev) return; memcpy(ev, xevent, sizeof(XEvent)); ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL); -} /* _ecore_x_event_handle_any_event */ +} void _ecore_x_event_handle_key_press(XEvent *xevent) { _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent); -} /* _ecore_x_event_handle_key_press */ +} void _ecore_x_event_handle_key_release(XEvent *xevent) { _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent); -} /* _ecore_x_event_handle_key_release */ +} void _ecore_x_event_handle_button_press(XEvent *xevent) @@ -541,7 +541,7 @@ _ecore_x_event_handle_button_press(XEvent *xevent) case 7: e->direction = 1; e->z = 1; break; default: e->direction = 0; e->z = 0; break; - } /* switch */ + } e->x = xevent->xbutton.x; e->y = xevent->xbutton.y; @@ -663,7 +663,7 @@ _ecore_x_event_handle_button_press(XEvent *xevent) } } } -} /* _ecore_x_event_handle_button_press */ +} void _ecore_x_event_handle_button_release(XEvent *xevent) @@ -702,7 +702,7 @@ _ecore_x_event_handle_button_release(XEvent *xevent) xevent->xbutton.x, xevent->xbutton.y, xevent->xbutton.x_root, xevent->xbutton.y_root); } -} /* _ecore_x_event_handle_button_release */ +} void _ecore_x_event_handle_motion_notify(XEvent *xevent) @@ -715,27 +715,27 @@ _ecore_x_event_handle_motion_notify(XEvent *xevent) _ecore_x_last_event_mouse_move_event = NULL; } */ - _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state, - xevent->xmotion.x, xevent->xmotion.y, - xevent->xmotion.x_root, xevent->xmotion.y_root, - xevent->xmotion.window, - (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : - xevent->xmotion.window), - xevent->xmotion.root, - xevent->xmotion.same_screen, - 0, 1, 1, - 1.0, // pressure - 0.0, // angle - xevent->xmotion.x, xevent->xmotion.y, - xevent->xmotion.x_root, xevent->xmotion.y_root); - - _ecore_x_last_event_mouse_move = 1; - - /* Xdnd handling */ - _ecore_x_dnd_drag(xevent->xmotion.root, - xevent->xmotion.x_root, - xevent->xmotion.y_root); -} /* _ecore_x_event_handle_motion_notify */ + _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state, + xevent->xmotion.x, xevent->xmotion.y, + xevent->xmotion.x_root, xevent->xmotion.y_root, + xevent->xmotion.window, + (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : + xevent->xmotion.window), + xevent->xmotion.root, + xevent->xmotion.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xmotion.x, xevent->xmotion.y, + xevent->xmotion.x_root, xevent->xmotion.y_root); + + _ecore_x_last_event_mouse_move = 1; + + /* Xdnd handling */ + _ecore_x_dnd_drag(xevent->xmotion.root, + xevent->xmotion.x_root, + xevent->xmotion.y_root); +} void _ecore_x_event_handle_enter_notify(XEvent *xevent) @@ -799,7 +799,7 @@ _ecore_x_event_handle_enter_notify(XEvent *xevent) _ecore_x_event_last_time = e->time; ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL); } -} /* _ecore_x_event_handle_enter_notify */ +} void _ecore_x_event_handle_leave_notify(XEvent *xevent) @@ -866,7 +866,7 @@ _ecore_x_event_handle_leave_notify(XEvent *xevent) _ecore_x_event_last_root_y = e->root.y; ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL); } -} /* _ecore_x_event_handle_leave_notify */ +} void _ecore_x_event_handle_focus_in(XEvent *xevent) @@ -910,7 +910,7 @@ _ecore_x_event_handle_focus_in(XEvent *xevent) e->time = _ecore_x_event_last_time; _ecore_x_event_last_time = e->time; ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); -} /* _ecore_x_event_handle_focus_in */ +} void _ecore_x_event_handle_focus_out(XEvent *xevent) @@ -954,14 +954,14 @@ _ecore_x_event_handle_focus_out(XEvent *xevent) e->time = _ecore_x_event_last_time; _ecore_x_event_last_time = e->time; ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); -} /* _ecore_x_event_handle_focus_out */ +} void _ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__) { _ecore_x_last_event_mouse_move = 0; /* FIXME: handle this event type */ -} /* _ecore_x_event_handle_keymap_notify */ +} void _ecore_x_event_handle_expose(XEvent *xevent) @@ -981,7 +981,7 @@ _ecore_x_event_handle_expose(XEvent *xevent) e->h = xevent->xexpose.height; e->count = xevent->xexpose.count; ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); -} /* _ecore_x_event_handle_expose */ +} void _ecore_x_event_handle_graphics_expose(XEvent *xevent) @@ -1001,7 +1001,7 @@ _ecore_x_event_handle_graphics_expose(XEvent *xevent) e->h = xevent->xgraphicsexpose.height; e->count = xevent->xgraphicsexpose.count; ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); -} /* _ecore_x_event_handle_graphics_expose */ +} void _ecore_x_event_handle_visibility_notify(XEvent *xevent) @@ -1024,7 +1024,7 @@ _ecore_x_event_handle_visibility_notify(XEvent *xevent) ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL); } -} /* _ecore_x_event_handle_visibility_notify */ +} void _ecore_x_event_handle_create_notify(XEvent *xevent) @@ -1050,7 +1050,7 @@ _ecore_x_event_handle_create_notify(XEvent *xevent) e->border = xevent->xcreatewindow.border_width; e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL); -} /* _ecore_x_event_handle_create_notify */ +} void _ecore_x_event_handle_destroy_notify(XEvent *xevent) @@ -1069,7 +1069,7 @@ _ecore_x_event_handle_destroy_notify(XEvent *xevent) _ecore_x_event_last_win = 0; ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL); -} /* _ecore_x_event_handle_destroy_notify */ +} void _ecore_x_event_handle_unmap_notify(XEvent *xevent) @@ -1085,7 +1085,7 @@ _ecore_x_event_handle_unmap_notify(XEvent *xevent) e->event_win = xevent->xunmap.event; e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); -} /* _ecore_x_event_handle_unmap_notify */ +} void _ecore_x_event_handle_map_notify(XEvent *xevent) @@ -1101,7 +1101,7 @@ _ecore_x_event_handle_map_notify(XEvent *xevent) e->event_win = xevent->xmap.event; e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL); -} /* _ecore_x_event_handle_map_notify */ +} void _ecore_x_event_handle_map_request(XEvent *xevent) @@ -1117,7 +1117,7 @@ _ecore_x_event_handle_map_request(XEvent *xevent) e->time = _ecore_x_event_last_time; e->parent = xevent->xmaprequest.parent; ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL); -} /* _ecore_x_event_handle_map_request */ +} void _ecore_x_event_handle_reparent_notify(XEvent *xevent) @@ -1134,7 +1134,7 @@ _ecore_x_event_handle_reparent_notify(XEvent *xevent) e->parent = xevent->xreparent.parent; e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL); -} /* _ecore_x_event_handle_reparent_notify */ +} void _ecore_x_event_handle_configure_notify(XEvent *xevent) @@ -1158,7 +1158,7 @@ _ecore_x_event_handle_configure_notify(XEvent *xevent) e->from_wm = xevent->xconfigure.send_event; e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); -} /* _ecore_x_event_handle_configure_notify */ +} void _ecore_x_event_handle_configure_request(XEvent *xevent) @@ -1193,14 +1193,14 @@ _ecore_x_event_handle_configure_request(XEvent *xevent) e->detail = ECORE_X_WINDOW_STACK_OPPOSITE; ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL); -} /* _ecore_x_event_handle_configure_request */ +} void _ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__) { _ecore_x_last_event_mouse_move = 0; /* FIXME: handle this event type */ -} /* _ecore_x_event_handle_gravity_notify */ +} void _ecore_x_event_handle_resize_request(XEvent *xevent) @@ -1217,7 +1217,7 @@ _ecore_x_event_handle_resize_request(XEvent *xevent) e->h = xevent->xresizerequest.height; e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL); -} /* _ecore_x_event_handle_resize_request */ +} void _ecore_x_event_handle_circulate_notify(XEvent *xevent) @@ -1238,7 +1238,7 @@ _ecore_x_event_handle_circulate_notify(XEvent *xevent) e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL); -} /* _ecore_x_event_handle_circulate_notify */ +} void _ecore_x_event_handle_circulate_request(XEvent *xevent) @@ -1259,7 +1259,7 @@ _ecore_x_event_handle_circulate_request(XEvent *xevent) e->time = _ecore_x_event_last_time; ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL); -} /* _ecore_x_event_handle_circulate_request */ +} void _ecore_x_event_handle_property_notify(XEvent *xevent) @@ -1278,17 +1278,17 @@ _ecore_x_event_handle_property_notify(XEvent *xevent) _ecore_x_event_last_time = e->time; ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL); } -} /* _ecore_x_event_handle_property_notify */ +} void _ecore_x_event_handle_selection_clear(XEvent *xevent) { // Ecore_X_Selection_Intern *d; - Ecore_X_Event_Selection_Clear *e; - Ecore_X_Atom sel; + Ecore_X_Event_Selection_Clear *e; + Ecore_X_Atom sel; - LOGFN(__FILE__, __LINE__, __FUNCTION__); - _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_last_event_mouse_move = 0; /* errr..... why? paranoia. d = _ecore_x_selection_get(xevent->xselectionclear.selection); if (d && (xevent->xselectionclear.time > d->time)) @@ -1298,21 +1298,21 @@ _ecore_x_event_handle_selection_clear(XEvent *xevent) } */ /* Generate event for app cleanup */ - e = malloc(sizeof(Ecore_X_Event_Selection_Clear)); - e->win = xevent->xselectionclear.window; - e->time = xevent->xselectionclear.time; - e->atom = sel = xevent->xselectionclear.selection; - if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) - e->selection = ECORE_X_SELECTION_PRIMARY; - else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) - e->selection = ECORE_X_SELECTION_SECONDARY; - else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) - e->selection = ECORE_X_SELECTION_CLIPBOARD; - else - e->selection = ECORE_X_SELECTION_OTHER; - - ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); -} /* _ecore_x_event_handle_selection_clear */ + e = malloc(sizeof(Ecore_X_Event_Selection_Clear)); + e->win = xevent->xselectionclear.window; + e->time = xevent->xselectionclear.time; + e->atom = sel = xevent->xselectionclear.selection; + if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + + ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); +} void _ecore_x_event_handle_selection_request(XEvent *xevent) @@ -1360,17 +1360,17 @@ _ecore_x_event_handle_selection_request(XEvent *xevent) property = None; else if (data) { - /* FIXME: This does not properly handle large data transfers */ - ecore_x_window_prop_property_set( - xevent->xselectionrequest.requestor, - xevent->xselectionrequest. - property, - type, - typesize, - data, - len); - property = xevent->xselectionrequest.property; - free(data); + /* FIXME: This does not properly handle large data transfers */ + ecore_x_window_prop_property_set( + xevent->xselectionrequest.requestor, + xevent->xselectionrequest. + property, + type, + typesize, + data, + len); + property = xevent->xselectionrequest.property; + free(data); } ecore_x_selection_notify_send(xevent->xselectionrequest.requestor, @@ -1380,7 +1380,7 @@ _ecore_x_event_handle_selection_request(XEvent *xevent) xevent->xselectionrequest.time); } } -} /* _ecore_x_event_handle_selection_request */ +} void _ecore_x_event_handle_selection_notify(XEvent *xevent) @@ -1436,7 +1436,7 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent) ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, _ecore_x_event_free_selection_notify, NULL); -} /* _ecore_x_event_handle_selection_notify */ +} void _ecore_x_event_handle_colormap_notify(XEvent *xevent) @@ -1457,7 +1457,7 @@ _ecore_x_event_handle_colormap_notify(XEvent *xevent) e->installed = EINA_FALSE; ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); -} /* _ecore_x_event_handle_colormap_notify */ +} void _ecore_x_event_handle_client_message(XEvent *xevent) @@ -1528,32 +1528,32 @@ _ecore_x_event_handle_client_message(XEvent *xevent) if (xevent->xclient.data.l[1] & 0x1UL) { /* source supports more than 3 types, fetch property */ - unsigned char *data; - Ecore_X_Atom *types; - int i, num_ret; - - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (!(ecore_x_window_prop_property_get(target->source, - ECORE_X_ATOM_XDND_TYPE_LIST, - XA_ATOM, - 32, &data, &num_ret))) - { - WRN( - "DND: Could not fetch data type list from source window, aborting."); - free(e); - return; - } - - types = (Ecore_X_Atom *)data; - e->types = calloc(num_ret, sizeof(char *)); - if (e->types) - { - LOGFN(__FILE__, __LINE__, __FUNCTION__); - for (i = 0; i < num_ret; i++) - e->types[i] = XGetAtomName(_ecore_x_disp, types[i]); - } - - e->num_types = num_ret; + unsigned char *data; + Ecore_X_Atom *types; + int i, num_ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(ecore_x_window_prop_property_get(target->source, + ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, + 32, &data, &num_ret))) + { + WRN( + "DND: Could not fetch data type list from source window, aborting."); + free(e); + return; + } + + types = (Ecore_X_Atom *)data; + e->types = calloc(num_ret, sizeof(char *)); + if (e->types) + { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + for (i = 0; i < num_ret; i++) + e->types[i] = XGetAtomName(_ecore_x_disp, types[i]); + } + + e->num_types = num_ret; } else { @@ -1774,7 +1774,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN) { // char *name; - LOGFN(__FILE__, __LINE__, __FUNCTION__); + LOGFN(__FILE__, __LINE__, __FUNCTION__); // name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]); // if (name) ERR("Unknown state: %s", name); @@ -1784,7 +1784,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN) { // char *name; - LOGFN(__FILE__, __LINE__, __FUNCTION__); + LOGFN(__FILE__, __LINE__, __FUNCTION__); // name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]); // if (name) ERR("Unknown state: %s", name); @@ -1888,10 +1888,10 @@ _ecore_x_event_handle_client_message(XEvent *xevent) && (xevent->xclient.window == _ecore_x_private_win)) { /* a grab sync marker */ - if (xevent->xclient.data.l[1] == 0x10000001) - _ecore_x_window_grab_remove(xevent->xclient.data.l[2]); - else if (xevent->xclient.data.l[1] == 0x10000002) - _ecore_x_key_grab_remove(xevent->xclient.data.l[2]); + if (xevent->xclient.data.l[1] == 0x10000001) + _ecore_x_window_grab_remove(xevent->xclient.data.l[2]); + else if (xevent->xclient.data.l[1] == 0x10000002) + _ecore_x_key_grab_remove(xevent->xclient.data.l[2]); } else { @@ -1910,7 +1910,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL); } -} /* _ecore_x_event_handle_client_message */ +} void _ecore_x_event_handle_mapping_notify(XEvent *xevent) @@ -1940,7 +1940,7 @@ _ecore_x_event_handle_mapping_notify(XEvent *xevent) e->keycode = xevent->xmapping.first_keycode; e->num = xevent->xmapping.count; ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); -} /* _ecore_x_event_handle_mapping_notify */ +} void _ecore_x_event_handle_shape_change(XEvent *xevent) @@ -1979,7 +1979,7 @@ _ecore_x_event_handle_shape_change(XEvent *xevent) e->h = shape_event->height; e->shaped = shape_event->shaped; ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); -} /* _ecore_x_event_handle_shape_change */ +} void _ecore_x_event_handle_screensaver_notify(XEvent *xevent) @@ -2005,7 +2005,7 @@ _ecore_x_event_handle_screensaver_notify(XEvent *xevent) #else /* ifdef ECORE_XSS */ xevent = NULL; #endif /* ifdef ECORE_XSS */ -} /* _ecore_x_event_handle_screensaver_notify */ +} void _ecore_x_event_handle_sync_counter(XEvent *xevent) @@ -2021,7 +2021,7 @@ _ecore_x_event_handle_sync_counter(XEvent *xevent) e->time = sync_counter_event->time; ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); -} /* _ecore_x_event_handle_sync_counter */ +} void _ecore_x_event_handle_sync_alarm(XEvent *xevent) @@ -2039,7 +2039,7 @@ _ecore_x_event_handle_sync_alarm(XEvent *xevent) e->time = sync_alarm_event->time; e->alarm = sync_alarm_event->alarm; ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); -} /* _ecore_x_event_handle_sync_alarm */ +} #ifdef ECORE_XRANDR void @@ -2068,7 +2068,7 @@ _ecore_x_event_handle_randr_change(XEvent *xevent) e->orientation = randr_event->rotation; e->subpixel_order = randr_event->subpixel_order; ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL); -} /* _ecore_x_event_handle_randr_change */ +} static void _ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent) @@ -2091,7 +2091,7 @@ _ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent) e->geo.w = randr_event->width; e->geo.h = randr_event->height; ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL); -} /* _ecore_x_event_handle_randr_notify_crtc_change */ +} static void _ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent) @@ -2113,7 +2113,7 @@ _ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent) e->connection = randr_event->connection; e->subpixel_order = randr_event->subpixel_order; ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL); -} /* _ecore_x_event_handle_randr_notify_output_change */ +} static void _ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent) @@ -2136,7 +2136,7 @@ _ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent) else e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); -} /* _ecore_x_event_handle_randr_notify_output_property */ +} void _ecore_x_event_handle_randr_notify(XEvent *xevent) @@ -2164,8 +2164,8 @@ _ecore_x_event_handle_randr_notify(XEvent *xevent) ERR("Unknown XRandR RRNotify subtype: %d.", randr_event->subtype); break; - } /* switch */ -} /* _ecore_x_event_handle_randr_notify */ + } +} #endif /* ifdef ECORE_XRANDR */ @@ -2201,7 +2201,7 @@ _ecore_x_event_handle_fixes_selection_notify(XEvent *event) e->reason = notify_event->subtype; ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL); -} /* _ecore_x_event_handle_fixes_selection_notify */ +} #endif /* ifdef ECORE_XFIXES */ @@ -2234,7 +2234,7 @@ _ecore_x_event_handle_damage_notify(XEvent *event) e->geometry.height = damage_event->geometry.height; ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL); -} /* _ecore_x_event_handle_damage_notify */ +} #endif /* ifdef ECORE_XDAMAGE */ @@ -2256,7 +2256,7 @@ _ecore_x_event_free_generic_event(void *data, return; data = NULL; ev = NULL; #endif /* ifdef ECORE_XI2 */ -} /* _ecore_x_event_free_generic_event */ +} void _ecore_x_event_handle_generic_event(XEvent *event) @@ -2300,7 +2300,7 @@ _ecore_x_event_handle_generic_event(XEvent *event) return; event = NULL; #endif /* ifdef ECORE_XI2 */ -} /* _ecore_x_event_handle_generic_event */ +} #ifdef ECORE_XGESTURE void @@ -2315,7 +2315,7 @@ _ecore_x_event_handle_gesture_notify_flick(XEvent *xevent) xfe = (XGestureNotifyFlickEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)); if (!e) - return; + return; e->win = xfe->window; e->time = xfe->time; @@ -2341,7 +2341,7 @@ _ecore_x_event_handle_gesture_notify_pan(XEvent *xevent) xpe = (XGestureNotifyPanEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)); if (!e) - return; + return; e->win = xpe->window; e->time = xpe->time; @@ -2368,7 +2368,7 @@ _ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent) xpre = (XGestureNotifyPinchRotationEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)); if (!e) - return; + return; e->win = xpre->window; e->time = xpre->time; @@ -2395,7 +2395,7 @@ _ecore_x_event_handle_gesture_notify_tap(XEvent *xevent) xte = (XGestureNotifyTapEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)); if (!e) - return; + return; e->win = xte->window; e->time = xte->time; @@ -2421,7 +2421,7 @@ _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent) xthe = (XGestureNotifyTapNHoldEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)); if (!e) - return; + return; e->win = xthe->window; e->time = xthe->time; @@ -2436,7 +2436,7 @@ _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent) } void - _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent) +_ecore_x_event_handle_gesture_notify_hold(XEvent *xevent) { XGestureNotifyHoldEvent *xhe; Ecore_X_Event_Gesture_Notify_Hold *e; @@ -2447,7 +2447,7 @@ void xhe = (XGestureNotifyHoldEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)); if (!e) - return; + return; e->win = xhe->window; e->time = xhe->time; @@ -2461,7 +2461,7 @@ void } void - _ecore_x_event_handle_gesture_notify_group(XEvent *xevent) +_ecore_x_event_handle_gesture_notify_group(XEvent *xevent) { XGestureNotifyGroupEvent *xge; Ecore_X_Event_Gesture_Notify_Group *e; @@ -2472,7 +2472,7 @@ void xge = (XGestureNotifyGroupEvent *)xevent; e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)); if (!e) - return; + return; e->win = xge->window; e->time = xge->time; @@ -2482,5 +2482,6 @@ void ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL); } + #endif /* ifdef ECORE_XGESTURE */ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c index e81af13..da0a6c3 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c @@ -32,13 +32,13 @@ _ecore_x_fixes_init(void) #else /* ifdef ECORE_XFIXES */ _fixes_available = 0; #endif /* ifdef ECORE_XFIXES */ -} /* _ecore_x_fixes_init */ +} #ifdef ECORE_XFIXES /* I don't know what to call this function. */ static XRectangle * _ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, - int num) + int num) { XRectangle *xrect; int i; @@ -58,11 +58,11 @@ _ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, xrect[i].height = rects[i].height; } return xrect; -} /* _ecore_x_rectangle_ecore_to_x */ +} static Ecore_X_Rectangle * _ecore_x_rectangle_x_to_ecore(XRectangle *xrect, - int num) + int num) { Ecore_X_Rectangle *rects; int i; @@ -82,7 +82,7 @@ _ecore_x_rectangle_x_to_ecore(XRectangle *xrect, rects[i].height = xrect[i].height; } return rects; -} /* _ecore_x_rectangle_x_to_ecore */ +} #endif /* ifdef ECORE_XFIXES */ @@ -106,7 +106,7 @@ ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection) EAPI Ecore_X_Region ecore_x_region_new(Ecore_X_Rectangle *rects, - int num) + int num) { #ifdef ECORE_XFIXES Ecore_X_Region region; @@ -120,7 +120,7 @@ ecore_x_region_new(Ecore_X_Rectangle *rects, #else /* ifdef ECORE_XFIXES */ return 0; #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_new */ +} EAPI Ecore_X_Region ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) @@ -134,10 +134,10 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) #else /* ifdef ECORE_XFIXES */ return 0; #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_new_from_bitmap */ +} EAPI Ecore_X_Region -ecore_x_region_new_from_window(Ecore_X_Window win, +ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type) { #ifdef ECORE_XFIXES @@ -149,7 +149,7 @@ ecore_x_region_new_from_window(Ecore_X_Window win, #else /* ifdef ECORE_XFIXES */ return 0; #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_new_from_window */ +} EAPI Ecore_X_Region ecore_x_region_new_from_gc(Ecore_X_GC gc) @@ -163,7 +163,7 @@ ecore_x_region_new_from_gc(Ecore_X_GC gc) #else /* ifdef ECORE_XFIXES */ return 0; #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_new_from_gc */ +} EAPI Ecore_X_Region ecore_x_region_new_from_picture(Ecore_X_Picture picture) @@ -177,7 +177,7 @@ ecore_x_region_new_from_picture(Ecore_X_Picture picture) #else /* ifdef ECORE_XFIXES */ return 0; #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_new_from_picture */ +} EAPI void ecore_x_region_free(Ecore_X_Region region) @@ -186,19 +186,19 @@ ecore_x_region_free(Ecore_X_Region region) LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesDestroyRegion(_ecore_x_disp, region); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_free */ +} EAPI void -ecore_x_region_set(Ecore_X_Region region, +ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, - int num) + int num) { #ifdef ECORE_XFIXES XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num); LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesSetRegion(_ecore_x_disp, region, xrect, num); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_set */ +} EAPI void ecore_x_region_copy(Ecore_X_Region dest, @@ -208,7 +208,7 @@ ecore_x_region_copy(Ecore_X_Region dest, LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesCopyRegion(_ecore_x_disp, dest, source); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_copy */ +} EAPI void ecore_x_region_combine(Ecore_X_Region dest, @@ -219,7 +219,7 @@ ecore_x_region_combine(Ecore_X_Region dest, LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesUnionRegion(_ecore_x_disp, dest, source1, source2); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_combine */ +} EAPI void ecore_x_region_intersect(Ecore_X_Region dest, @@ -230,7 +230,7 @@ ecore_x_region_intersect(Ecore_X_Region dest, LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_intersect */ +} EAPI void ecore_x_region_subtract(Ecore_X_Region dest, @@ -241,35 +241,36 @@ ecore_x_region_subtract(Ecore_X_Region dest, LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_subtract */ +} EAPI void -ecore_x_region_invert(Ecore_X_Region dest, +ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, - Ecore_X_Region source) + Ecore_X_Region source) { #ifdef ECORE_XFIXES XRectangle *xbound; int num = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); - while (bounds + num) num++; + while (bounds + num) + num++; xbound = _ecore_x_rectangle_ecore_to_x(bounds, num); XFixesInvertRegion(_ecore_x_disp, dest, xbound, source); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_invert */ +} EAPI void ecore_x_region_translate(Ecore_X_Region region, - int dx, - int dy) + int dx, + int dy) { #ifdef ECORE_XFIXES LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesTranslateRegion(_ecore_x_disp, region, dx, dy); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_translate */ +} EAPI void ecore_x_region_extents(Ecore_X_Region dest, @@ -279,11 +280,11 @@ ecore_x_region_extents(Ecore_X_Region dest, LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesRegionExtents(_ecore_x_disp, dest, source); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_extents */ +} EAPI Ecore_X_Rectangle * -ecore_x_region_fetch(Ecore_X_Region region, - int *num, +ecore_x_region_fetch(Ecore_X_Region region, + int *num, Ecore_X_Rectangle *bounds){ #ifdef ECORE_XFIXES Ecore_X_Rectangle *rects; @@ -300,40 +301,40 @@ ecore_x_region_fetch(Ecore_X_Region region, #else /* ifdef ECORE_XFIXES */ return NULL; #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_fetch */ +} EAPI void ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, - unsigned int left, - unsigned int right, - unsigned int top, - unsigned int bottom) + unsigned int left, + unsigned int right, + unsigned int top, + unsigned int bottom) { #ifdef ECORE_XFIXES LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_expand */ +} EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region, - Ecore_X_GC gc, - int x_origin, - int y_origin) + Ecore_X_GC gc, + int x_origin, + int y_origin) { #ifdef ECORE_XFIXES LOGFN(__FILE__, __LINE__, __FUNCTION__); XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_gc_clip_set */ +} EAPI void -ecore_x_region_window_shape_set(Ecore_X_Region region, - Ecore_X_Window win, +ecore_x_region_window_shape_set(Ecore_X_Region region, + Ecore_X_Window win, Ecore_X_Shape_Type type, - int x_offset, - int y_offset) + int x_offset, + int y_offset) { #ifdef ECORE_XFIXES LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -344,13 +345,13 @@ ecore_x_region_window_shape_set(Ecore_X_Region region, y_offset, region); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_window_shape_set */ +} EAPI void -ecore_x_region_picture_clip_set(Ecore_X_Region region, +ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, - int x_origin, - int y_origin) + int x_origin, + int y_origin) { #ifdef ECORE_XFIXES LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -360,5 +361,5 @@ ecore_x_region_picture_clip_set(Ecore_X_Region region, y_origin, region); #endif /* ifdef ECORE_XFIXES */ -} /* ecore_x_region_picture_clip_set */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c index 10b807b..5396366 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c @@ -19,9 +19,9 @@ * @return The new default graphics context. */ EAPI Ecore_X_GC -ecore_x_gc_new(Ecore_X_Drawable draw, +ecore_x_gc_new(Ecore_X_Drawable draw, Ecore_X_GC_Value_Mask value_mask, - const unsigned int *value_list) + const unsigned int *value_list) { XGCValues gcv; int mask; @@ -152,11 +152,11 @@ ecore_x_gc_new(Ecore_X_Drawable draw, gcv.arc_mode = value_list[idx]; idx++; break; - } /* switch */ + } } return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv); -} /* ecore_x_gc_new */ +} /** * Deletes and frees the given graphics context. @@ -167,5 +167,5 @@ ecore_x_gc_free(Ecore_X_GC gc) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XFreeGC(_ecore_x_disp, gc); -} /* ecore_x_gc_free */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c index e1dc75c..e89421b 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c @@ -26,7 +26,7 @@ _ecore_x_gesture_init(void) _gesture_available = EINA_TRUE; } else - _gesture_available = EINA_FALSE; + _gesture_available = EINA_FALSE; #else /* ifdef ECORE_XGESTURE */ _gesture_available = EINA_FALSE; #endif /* ifdef ECORE_XGESTURE */ @@ -48,11 +48,11 @@ ecore_x_gesture_events_select(Ecore_X_Window win, { #ifdef ECORE_XGESTURE if (!_gesture_available) - return EINA_FALSE; + return EINA_FALSE; LOGFN(__FILE__, __LINE__, __FUNCTION__); XGestureSelectEvents(_ecore_x_disp, win, mask); - + return EINA_TRUE; #else /* ifdef ECORE_XGESTURE */ return EINA_FALSE; @@ -68,7 +68,7 @@ ecore_x_gesture_events_selected_get(Ecore_X_Window win) Ecore_X_Gesture_Event_Mask mask; if (!_gesture_available) - return ECORE_X_GESTURE_EVENT_MASK_NONE; + return ECORE_X_GESTURE_EVENT_MASK_NONE; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask)) @@ -76,7 +76,7 @@ ecore_x_gesture_events_selected_get(Ecore_X_Window win) mask = ECORE_X_GESTURE_EVENT_MASK_NONE; return mask; } - + return mask; #else /* ifdef ECORE_XGESTURE */ return ECORE_X_GESTURE_EVENT_MASK_NONE; @@ -91,14 +91,14 @@ ecore_x_gesture_event_grab(Ecore_X_Window win, { #ifdef ECORE_XGESTURE if (!_gesture_available) - return EINA_FALSE; + return EINA_FALSE; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime)) { return EINA_FALSE; } - + return EINA_TRUE; #else /* ifdef ECORE_XGESTURE */ return EINA_FALSE; @@ -117,14 +117,14 @@ ecore_x_gesture_event_ungrab(Ecore_X_Window win, Ecore_X_Gesture_Event_Mask mask; if (!_gesture_available) - return EINA_FALSE; + return EINA_FALSE; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime)) { return EINA_FALSE; } - + return EINA_TRUE; #else /* ifdef ECORE_XGESTURE */ return EINA_FALSE; diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c index 3899651..8d6ea1f 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c @@ -21,10 +21,10 @@ EAPI void ecore_x_icccm_init(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); -} /* ecore_x_icccm_init */ +} EAPI void -ecore_x_icccm_state_set(Ecore_X_Window win, +ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state) { unsigned long c[2]; @@ -41,7 +41,7 @@ ecore_x_icccm_state_set(Ecore_X_Window win, XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE, 32, PropModeReplace, (unsigned char *)c, 2); -} /* ecore_x_icccm_state_set */ +} EAPI Ecore_X_Window_State_Hint ecore_x_icccm_state_get(Ecore_X_Window win) @@ -72,47 +72,47 @@ ecore_x_icccm_state_get(Ecore_X_Window win) XFree(prop_ret); return hint; -} /* ecore_x_icccm_state_get */ +} EAPI void ecore_x_icccm_delete_window_send(Ecore_X_Window win, - Ecore_X_Time t) + Ecore_X_Time t) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_EVENT_MASK_NONE, ECORE_X_ATOM_WM_DELETE_WINDOW, t, 0, 0, 0); -} /* ecore_x_icccm_delete_window_send */ +} EAPI void ecore_x_icccm_take_focus_send(Ecore_X_Window win, - Ecore_X_Time t) + Ecore_X_Time t) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_EVENT_MASK_NONE, ECORE_X_ATOM_WM_TAKE_FOCUS, t, 0, 0, 0); -} /* ecore_x_icccm_take_focus_send */ +} EAPI void ecore_x_icccm_save_yourself_send(Ecore_X_Window win, - Ecore_X_Time t) + Ecore_X_Time t) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, ECORE_X_EVENT_MASK_NONE, ECORE_X_ATOM_WM_SAVE_YOURSELF, t, 0, 0, 0); -} /* ecore_x_icccm_save_yourself_send */ +} EAPI void ecore_x_icccm_move_resize_send(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { XEvent ev; @@ -129,17 +129,17 @@ ecore_x_icccm_move_resize_send(Ecore_X_Window win, ev.xconfigure.above = None; ev.xconfigure.override_redirect = False; XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev); -} /* ecore_x_icccm_move_resize_send */ +} EAPI void -ecore_x_icccm_hints_set(Ecore_X_Window win, - Eina_Bool accepts_focus, +ecore_x_icccm_hints_set(Ecore_X_Window win, + Eina_Bool accepts_focus, Ecore_X_Window_State_Hint initial_state, - Ecore_X_Pixmap icon_pixmap, - Ecore_X_Pixmap icon_mask, - Ecore_X_Window icon_window, - Ecore_X_Window window_group, - Eina_Bool is_urgent) + Ecore_X_Pixmap icon_pixmap, + Ecore_X_Pixmap icon_mask, + Ecore_X_Window icon_window, + Ecore_X_Window window_group, + Eina_Bool is_urgent) { XWMHints *hints; @@ -186,17 +186,17 @@ ecore_x_icccm_hints_set(Ecore_X_Window win, XSetWMHints(_ecore_x_disp, win, hints); XFree(hints); -} /* ecore_x_icccm_hints_set */ +} EAPI Eina_Bool -ecore_x_icccm_hints_get(Ecore_X_Window win, - Eina_Bool *accepts_focus, +ecore_x_icccm_hints_get(Ecore_X_Window win, + Eina_Bool *accepts_focus, Ecore_X_Window_State_Hint *initial_state, - Ecore_X_Pixmap *icon_pixmap, - Ecore_X_Pixmap *icon_mask, - Ecore_X_Window *icon_window, - Ecore_X_Window *window_group, - Eina_Bool *is_urgent) + Ecore_X_Pixmap *icon_pixmap, + Ecore_X_Pixmap *icon_mask, + Ecore_X_Window *icon_window, + Ecore_X_Window *window_group, + Eina_Bool *is_urgent) { XWMHints *hints; @@ -263,22 +263,22 @@ ecore_x_icccm_hints_get(Ecore_X_Window win, } return EINA_FALSE; -} /* ecore_x_icccm_hints_get */ +} EAPI void -ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, - Eina_Bool request_pos, +ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, + Eina_Bool request_pos, Ecore_X_Gravity gravity, - int min_w, - int min_h, - int max_w, - int max_h, - int base_w, - int base_h, - int step_x, - int step_y, - double min_aspect, - double max_aspect) + int min_w, + int min_h, + int max_w, + int max_h, + int base_w, + int base_h, + int step_x, + int step_y, + double min_aspect, + double max_aspect) { XSizeHints hint; long mask; @@ -335,22 +335,22 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, } XSetWMNormalHints(_ecore_x_disp, win, &hint); -} /* ecore_x_icccm_size_pos_hints_set */ +} EAPI Eina_Bool -ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, - Eina_Bool *request_pos, +ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, + Eina_Bool *request_pos, Ecore_X_Gravity *gravity, - int *min_w, - int *min_h, - int *max_w, - int *max_h, - int *base_w, - int *base_h, - int *step_x, - int *step_y, - double *min_aspect, - double *max_aspect) + int *min_w, + int *min_h, + int *max_w, + int *max_h, + int *base_w, + int *base_h, + int *step_x, + int *step_y, + double *min_aspect, + double *max_aspect) { XSizeHints hint; long mask; @@ -460,11 +460,11 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, *max_aspect = maxa; return EINA_TRUE; -} /* ecore_x_icccm_size_pos_hints_get */ +} EAPI void ecore_x_icccm_title_set(Ecore_X_Window win, - const char *t) + const char *t) { char *list[1]; XTextProperty xprop; @@ -500,7 +500,7 @@ ecore_x_icccm_title_set(Ecore_X_Window win, } free(list[0]); -} /* ecore_x_icccm_title_set */ +} EAPI char * ecore_x_icccm_title_get(Ecore_X_Window win) @@ -522,23 +522,23 @@ ecore_x_icccm_title_get(Ecore_X_Window win) t = strdup((char *)xprop.value); else { - /* convert to utf8 */ + /* convert to utf8 */ #ifdef X_HAVE_UTF8_STRING - ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); + ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); #else /* ifdef X_HAVE_UTF8_STRING */ - ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); + ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); #endif /* ifdef X_HAVE_UTF8_STRING */ - if ((ret == XLocaleNotSupported) || - (ret == XNoMemory) || (ret == XConverterNotFound)) - t = strdup((char *)xprop.value); - else if ((ret >= Success) && (num > 0)) - t = strdup(list[0]); + if ((ret == XLocaleNotSupported) || + (ret == XNoMemory) || (ret == XConverterNotFound)) + t = strdup((char *)xprop.value); + else if ((ret >= Success) && (num > 0)) + t = strdup(list[0]); - if (list) - XFreeStringList(list); + if (list) + XFreeStringList(list); } if (xprop.value) @@ -549,7 +549,7 @@ ecore_x_icccm_title_get(Ecore_X_Window win) } return NULL; -} /* ecore_x_icccm_title_get */ +} /** * Set protocol atoms explicitly @@ -559,15 +559,15 @@ ecore_x_icccm_title_get(Ecore_X_Window win) */ EAPI void ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, - Ecore_X_Atom *protos, - int num) + Ecore_X_Atom *protos, + int num) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (num > 0) XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num); else XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS); -} /* ecore_x_icccm_protocol_atoms_set */ +} /** * Set or unset a wm protocol property. @@ -576,9 +576,9 @@ ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, * @param on On/Off */ EAPI void -ecore_x_icccm_protocol_set(Ecore_X_Window win, +ecore_x_icccm_protocol_set(Ecore_X_Window win, Ecore_X_WM_Protocol protocol, - Eina_Bool on) + Eina_Bool on) { Atom *protos = NULL; Atom proto; @@ -653,7 +653,7 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win, leave: if (protos) XFree(protos); -} /* ecore_x_icccm_protocol_set */ +} /** * Determines whether a protocol is set for a window. @@ -662,7 +662,7 @@ leave: * @return 1 if the protocol is set, else 0. */ EAPI Eina_Bool -ecore_x_icccm_protocol_isset(Ecore_X_Window win, +ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol) { Atom proto, *protos = NULL; @@ -690,7 +690,7 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, XFree(protos); return ret; -} /* ecore_x_icccm_protocol_isset */ +} /** * Set a window name & class. @@ -702,8 +702,8 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win, */ EAPI void ecore_x_icccm_name_class_set(Ecore_X_Window win, - const char *n, - const char *c) + const char *n, + const char *c) { XClassHint *xch; @@ -716,7 +716,7 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, xch->res_class = (char *)c; XSetClassHint(_ecore_x_disp, win, xch); XFree(xch); -} /* ecore_x_icccm_name_class_set */ +} /** * Get a window name & class. @@ -728,8 +728,8 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, */ EAPI void ecore_x_icccm_name_class_get(Ecore_X_Window win, - char **n, - char **c) + char **n, + char **c) { XClassHint xch; @@ -755,7 +755,7 @@ ecore_x_icccm_name_class_get(Ecore_X_Window win, XFree(xch.res_name); XFree(xch.res_class); } -} /* ecore_x_icccm_name_class_get */ +} /** * Get a window client machine string. @@ -772,7 +772,7 @@ ecore_x_icccm_client_machine_get(Ecore_X_Window win) LOGFN(__FILE__, __LINE__, __FUNCTION__); name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE); return name; -} /* ecore_x_icccm_client_machine_get */ +} /** * Sets the WM_COMMAND property for @a win. @@ -783,12 +783,12 @@ ecore_x_icccm_client_machine_get(Ecore_X_Window win) */ EAPI void ecore_x_icccm_command_set(Ecore_X_Window win, - int argc, - char **argv) + int argc, + char **argv) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSetCommand(_ecore_x_disp, win, argv, argc); -} /* ecore_x_icccm_command_set */ +} /** * Get the WM_COMMAND property for @a win. @@ -801,8 +801,8 @@ ecore_x_icccm_command_set(Ecore_X_Window win, */ EAPI void ecore_x_icccm_command_get(Ecore_X_Window win, - int *argc, - char ***argv) + int *argc, + char ***argv) { int i, c; char **v; @@ -850,7 +850,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win, } XFreeStringList(v); -} /* ecore_x_icccm_command_get */ +} /** * Set a window icon name. @@ -861,7 +861,7 @@ ecore_x_icccm_command_get(Ecore_X_Window win, */ EAPI void ecore_x_icccm_icon_name_set(Ecore_X_Window win, - const char *t) + const char *t) { char *list[1]; XTextProperty xprop; @@ -892,7 +892,7 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win, } free(list[0]); -} /* ecore_x_icccm_icon_name_set */ +} /** * Get a window icon name. @@ -921,26 +921,26 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win) t = strdup((char *)xprop.value); else { - /* convert to utf8 */ + /* convert to utf8 */ #ifdef X_HAVE_UTF8_STRING - ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); + ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); #else /* ifdef X_HAVE_UTF8_STRING */ - ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, - &list, &num); + ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); #endif /* ifdef X_HAVE_UTF8_STRING */ - if ((ret == XLocaleNotSupported) || - (ret == XNoMemory) || (ret == XConverterNotFound)) - t = strdup((char *)xprop.value); - else if (ret >= Success) - { - if ((num >= 1) && (list)) - t = strdup(list[0]); - - if (list) - XFreeStringList(list); - } + if ((ret == XLocaleNotSupported) || + (ret == XNoMemory) || (ret == XConverterNotFound)) + t = strdup((char *)xprop.value); + else if (ret >= Success) + { + if ((num >= 1) && (list)) + t = strdup(list[0]); + + if (list) + XFreeStringList(list); + } } if (xprop.value) @@ -951,7 +951,7 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win) } return NULL; -} /* ecore_x_icccm_icon_name_get */ +} /** * Add a subwindow to the list of windows that need a different colormap installed. @@ -1014,7 +1014,7 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, XA_WINDOW, 32, data, num); free(newset); -} /* ecore_x_icccm_colormap_window_set */ +} /** * Remove a window from the list of colormap windows. @@ -1079,7 +1079,7 @@ ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, if (old_data) XFree(old_data); -} /* ecore_x_icccm_colormap_window_unset */ +} /** * Specify that a window is transient for another top-level window and should be handled accordingly. @@ -1092,18 +1092,18 @@ ecore_x_icccm_transient_for_set(Ecore_X_Window win, { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSetTransientForHint(_ecore_x_disp, win, forwin); -} /* ecore_x_icccm_transient_for_set */ +} /** * Remove the transient_for setting from a window. - * @param The window + * @param win The window */ EAPI void ecore_x_icccm_transient_for_unset(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR); -} /* ecore_x_icccm_transient_for_unset */ +} /** * Get the window this window is transient for, if any. @@ -1120,7 +1120,7 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win) return (Ecore_X_Window)forwin; else return 0; -} /* ecore_x_icccm_transient_for_get */ +} /** * Set the window role hint. @@ -1129,12 +1129,12 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win) */ EAPI void ecore_x_icccm_window_role_set(Ecore_X_Window win, - const char *role) + const char *role) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE, (char *)role); -} /* ecore_x_icccm_window_role_set */ +} /** * Get the window role. @@ -1146,7 +1146,7 @@ ecore_x_icccm_window_role_get(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE); -} /* ecore_x_icccm_window_role_get */ +} /** * Set the window's client leader. @@ -1163,7 +1163,7 @@ ecore_x_icccm_client_leader_set(Ecore_X_Window win, LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER, &l, 1); -} /* ecore_x_icccm_client_leader_set */ +} /** * Get the window's client leader. @@ -1180,7 +1180,7 @@ ecore_x_icccm_client_leader_get(Ecore_X_Window win) return l; return 0; -} /* ecore_x_icccm_client_leader_get */ +} EAPI void ecore_x_icccm_iconic_request_send(Ecore_X_Window win, @@ -1206,7 +1206,7 @@ ecore_x_icccm_iconic_request_send(Ecore_X_Window win, XSendEvent(_ecore_x_disp, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); -} /* ecore_x_icccm_iconic_request_send */ +} /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */ /* hints. each should go in their own file/section so we know which */ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c index 2de5319..b8e720c 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c @@ -1,26 +1,28 @@ #ifdef HAVE_CONFIG_H # include -#endif /* ifdef HAVE_CONFIG_H */ +#endif + +#include +#include +#include +#include #include "ecore_x_private.h" #include "Ecore_X.h" #include #include -#include -#include -#include static int _ecore_x_image_shm_can = -1; static int _ecore_x_image_err = 0; static int -_ecore_x_image_error_handler(Display *d __UNUSED__, +_ecore_x_image_error_handler(Display *d __UNUSED__, XErrorEvent *ev __UNUSED__) { _ecore_x_image_err = 1; return 0; -} /* _ecore_x_image_error_handler */ +} static void _ecore_x_image_shm_check(void) @@ -90,7 +92,7 @@ _ecore_x_image_shm_check(void) shmctl(shminfo.shmid, IPC_RMID, 0); _ecore_x_image_shm_can = 1; -} /* _ecore_x_image_shm_check */ +} struct _Ecore_X_Image { @@ -105,10 +107,10 @@ struct _Ecore_X_Image }; EAPI Ecore_X_Image * -ecore_x_image_new(int w, - int h, +ecore_x_image_new(int w, + int h, Ecore_X_Visual vis, - int depth) + int depth) { Ecore_X_Image *im; @@ -124,7 +126,7 @@ ecore_x_image_new(int w, _ecore_x_image_shm_check(); im->shm = _ecore_x_image_shm_can; return im; -} /* ecore_x_image_new */ +} EAPI void ecore_x_image_free(Ecore_X_Image *im) @@ -148,7 +150,7 @@ ecore_x_image_free(Ecore_X_Image *im) } free(im); -} /* ecore_x_image_free */ +} static void _ecore_x_image_shm_create(Ecore_X_Image *im) @@ -192,17 +194,17 @@ _ecore_x_image_shm_create(Ecore_X_Image *im) im->bpp = 2; else im->bpp = 4; -} /* _ecore_x_image_shm_create */ +} EAPI Eina_Bool -ecore_x_image_get(Ecore_X_Image *im, +ecore_x_image_get(Ecore_X_Image *im, Ecore_X_Drawable draw, - int x, - int y, - int sx, - int sy, - int w, - int h) + int x, + int y, + int sx, + int sy, + int w, + int h) { Eina_Bool ret = EINA_TRUE; XErrorHandler ph; @@ -278,18 +280,18 @@ ecore_x_image_get(Ecore_X_Image *im, } return ret; -} /* ecore_x_image_get */ +} EAPI void -ecore_x_image_put(Ecore_X_Image *im, +ecore_x_image_put(Ecore_X_Image *im, Ecore_X_Drawable draw, - Ecore_X_GC gc, - int x, - int y, - int sx, - int sy, - int w, - int h) + Ecore_X_GC gc, + int x, + int y, + int sx, + int sy, + int w, + int h) { Ecore_X_GC tgc = 0; @@ -306,13 +308,13 @@ ecore_x_image_put(Ecore_X_Image *im, if (im->xim) XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False); if (tgc) ecore_x_gc_free(tgc); -} /* ecore_x_image_put */ +} EAPI void * ecore_x_image_data_get(Ecore_X_Image *im, - int *bpl, - int *rows, - int *bpp) + int *bpl, + int *rows, + int *bpp) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!im->xim) _ecore_x_image_shm_create(im); @@ -321,7 +323,7 @@ ecore_x_image_data_get(Ecore_X_Image *im, if (rows) *rows = im->rows; if (bpp) *bpp = im->bpp; return im->data; -} /* ecore_x_image_data_get */ +} EAPI Eina_Bool ecore_x_image_is_argb32_get(Ecore_X_Image *im) @@ -345,19 +347,19 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im) } EAPI Eina_Bool -ecore_x_image_to_argb_convert(void *src, - int sbpp, - int sbpl, +ecore_x_image_to_argb_convert(void *src, + int sbpp, + int sbpl, Ecore_X_Colormap c, - Ecore_X_Visual v, - int x, - int y, - int w, - int h, - unsigned int *dst, - int dbpl, - int dx, - int dy) + Ecore_X_Visual v, + int x, + int y, + int w, + int h, + unsigned int *dst, + int dbpl, + int dx, + int dy) { Visual *vis = v; XColor *cols = NULL; @@ -411,9 +413,9 @@ ecore_x_image_to_argb_convert(void *src, else if ((vis->class == TrueColor) || (vis->class == DirectColor)) { - if ((vis->red_mask == 0x00ff0000) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x000000ff)) + if ((vis->red_mask == 0x00ff0000) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x000000ff)) mode = argbx888; else if ((vis->red_mask == 0x000000ff) && (vis->green_mask == 0x0000ff00) && diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c index 7459a8b..7812cc2 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c @@ -32,8 +32,8 @@ typedef struct _mwmhints MWMHints; EAPI Eina_Bool -ecore_x_mwm_hints_get(Ecore_X_Window win, - Ecore_X_MWM_Hint_Func *fhint, +ecore_x_mwm_hints_get(Ecore_X_Window win, + Ecore_X_MWM_Hint_Func *fhint, Ecore_X_MWM_Hint_Decor *dhint, Ecore_X_MWM_Hint_Input *ihint) { @@ -86,11 +86,11 @@ ecore_x_mwm_hints_get(Ecore_X_Window win, } return ret; -} /* ecore_x_mwm_hints_get */ +} EAPI void ecore_x_mwm_borderless_set(Ecore_X_Window win, - Eina_Bool borderless) + Eina_Bool borderless) { unsigned int data[5] = {0, 0, 0, 0, 0}; @@ -102,5 +102,5 @@ ecore_x_mwm_borderless_set(Ecore_X_Window win, ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS, 32, (void *)data, 5); -} /* ecore_x_mwm_borderless_set */ +} 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 1a6fc9a..9fc428a 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 @@ -4,8 +4,9 @@ #ifdef HAVE_CONFIG_H # include -#endif /* ifdef HAVE_CONFIG_H */ +#endif +#include #include #include @@ -39,17 +40,17 @@ struct _Ecore_X_Startup_Info int silent; }; -static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, - Ecore_X_Atom atom, - const char *str); +static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, + Ecore_X_Atom atom, + const char *str); static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, - Ecore_X_Atom atom); + Ecore_X_Atom atom); #if 0 /* Unused */ -static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info); -static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, - char *data); +static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info); +static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, + char *data); #endif /* if 0 */ -static void _ecore_x_netwm_startup_info_free(void *data); +static void _ecore_x_netwm_startup_info_free(void *data); /* * Convenience macros @@ -76,7 +77,7 @@ ecore_x_netwm_init(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); startup_info = eina_hash_string_superfast_new( _ecore_x_netwm_startup_info_free); -} /* ecore_x_netwm_init */ +} EAPI void ecore_x_netwm_shutdown(void) @@ -86,7 +87,7 @@ ecore_x_netwm_shutdown(void) eina_hash_free(startup_info); startup_info = NULL; -} /* ecore_x_netwm_shutdown */ +} /* * WM identification @@ -94,7 +95,7 @@ ecore_x_netwm_shutdown(void) EAPI void ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check, - const char *wm_name) + const char *wm_name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(root, @@ -112,27 +113,27 @@ ecore_x_netwm_wm_identify(Ecore_X_Window root, _ecore_x_window_prop_string_utf8_set(root, ECORE_X_ATOM_NET_WM_NAME, wm_name); -} /* ecore_x_netwm_wm_identify */ +} /* * Set supported atoms */ EAPI void ecore_x_netwm_supported_set(Ecore_X_Window root, - Ecore_X_Atom *supported, - int num) + Ecore_X_Atom *supported, + int num) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, supported, num); -} /* ecore_x_netwm_supported_set */ +} EAPI Eina_Bool ecore_x_netwm_supported_get(Ecore_X_Window root, Ecore_X_Atom **supported, - int *num) + int *num) { int num_ret; @@ -152,36 +153,36 @@ ecore_x_netwm_supported_get(Ecore_X_Window root, *num = num_ret; return EINA_TRUE; -} /* ecore_x_netwm_supported_get */ +} /* * Desktop configuration and status */ EAPI void ecore_x_netwm_desk_count_set(Ecore_X_Window root, - unsigned int n_desks) + unsigned int n_desks) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, &n_desks, 1); -} /* ecore_x_netwm_desk_count_set */ +} EAPI void -ecore_x_netwm_desk_roots_set(Ecore_X_Window root, +ecore_x_netwm_desk_roots_set(Ecore_X_Window root, Ecore_X_Window *vroots, - unsigned int n_desks) + unsigned int n_desks) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, vroots, n_desks); -} /* ecore_x_netwm_desk_roots_set */ +} EAPI void ecore_x_netwm_desk_names_set(Ecore_X_Window root, - const char **names, - unsigned int n_desks) + const char **names, + unsigned int n_desks) { char ss[32], *buf, *t; const char *s; @@ -198,8 +199,8 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root, if (!s) { /* Default to "Desk-" */ - sprintf(ss, "Desk-%d", i); - s = ss; + sprintf(ss, "Desk-%d", i); + s = ss; } l = strlen(s) + 1; @@ -215,12 +216,12 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root, _ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len); free(buf); -} /* ecore_x_netwm_desk_names_set */ +} EAPI void ecore_x_netwm_desk_size_set(Ecore_X_Window root, - unsigned int width, - unsigned int height) + unsigned int width, + unsigned int height) { unsigned int size[2]; @@ -229,24 +230,24 @@ ecore_x_netwm_desk_size_set(Ecore_X_Window root, size[1] = height; ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size, 2); -} /* ecore_x_netwm_desk_size_set */ +} EAPI void ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, - unsigned int *origins, - unsigned int n_desks) + unsigned int *origins, + unsigned int n_desks) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, origins, 2 * n_desks); -} /* ecore_x_netwm_desk_viewports_set */ +} EAPI void ecore_x_netwm_desk_layout_set(Ecore_X_Window root, - int orientation, - int columns, - int rows, - int starting_corner) + int orientation, + int columns, + int rows, + int starting_corner) { unsigned int layout[4]; @@ -257,26 +258,26 @@ ecore_x_netwm_desk_layout_set(Ecore_X_Window root, layout[3] = starting_corner; ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, layout, 4); -} /* ecore_x_netwm_desk_layout_set */ +} EAPI void ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, - unsigned int *areas, - unsigned int n_desks) + unsigned int *areas, + unsigned int n_desks) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas, 4 * n_desks); -} /* ecore_x_netwm_desk_workareas_set */ +} EAPI unsigned int * ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks) { int ret; unsigned int *areas = NULL; - + if (!root) root = DefaultRootWindow(_ecore_x_disp); - + ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA, &areas); if (!areas) @@ -290,16 +291,16 @@ ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks) EAPI void ecore_x_netwm_desk_current_set(Ecore_X_Window root, - unsigned int desk) + unsigned int desk) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, &desk, 1); -} /* ecore_x_netwm_desk_current_set */ +} EAPI void ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, - Eina_Bool on) + Eina_Bool on) { unsigned int val; @@ -307,7 +308,7 @@ ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, val = (on) ? 1 : 0; ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val, 1); -} /* ecore_x_netwm_showing_desktop_set */ +} /* * Client status @@ -315,25 +316,25 @@ ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, /* Mapping order */ EAPI void -ecore_x_netwm_client_list_set(Ecore_X_Window root, +ecore_x_netwm_client_list_set(Ecore_X_Window root, Ecore_X_Window *p_clients, - unsigned int n_clients) + unsigned int n_clients) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST, p_clients, n_clients); -} /* ecore_x_netwm_client_list_set */ +} /* Stacking order */ EAPI void -ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, +ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, Ecore_X_Window *p_clients, - unsigned int n_clients) + unsigned int n_clients) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, p_clients, n_clients); -} /* ecore_x_netwm_client_list_stacking_set */ +} EAPI void ecore_x_netwm_client_active_set(Ecore_X_Window root, @@ -342,12 +343,12 @@ ecore_x_netwm_client_active_set(Ecore_X_Window root, LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_ACTIVE_WINDOW, &win, 1); -} /* ecore_x_netwm_client_active_set */ +} EAPI void ecore_x_netwm_client_active_request(Ecore_X_Window root, Ecore_X_Window win, - int type, + int type, Ecore_X_Window current_win) { XEvent xev; @@ -369,19 +370,19 @@ ecore_x_netwm_client_active_request(Ecore_X_Window root, XSendEvent(_ecore_x_disp, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); -} /* ecore_x_netwm_client_active_request */ +} EAPI void ecore_x_netwm_name_set(Ecore_X_Window win, - const char *name) + const char *name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name); -} /* ecore_x_netwm_name_set */ +} EAPI int ecore_x_netwm_name_get(Ecore_X_Window win, - char **name) + char **name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (name) @@ -389,19 +390,19 @@ ecore_x_netwm_name_get(Ecore_X_Window win, ECORE_X_ATOM_NET_WM_NAME); return 1; -} /* ecore_x_netwm_name_get */ +} EAPI void ecore_x_netwm_startup_id_set(Ecore_X_Window win, - const char *id) + const char *id) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id); -} /* ecore_x_netwm_startup_id_set */ +} EAPI int ecore_x_netwm_startup_id_get(Ecore_X_Window win, - char **id) + char **id) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (id) @@ -409,20 +410,20 @@ ecore_x_netwm_startup_id_get(Ecore_X_Window win, ECORE_X_ATOM_NET_STARTUP_ID); return 1; -} /* ecore_x_netwm_startup_id_get */ +} EAPI void ecore_x_netwm_visible_name_set(Ecore_X_Window win, - const char *name) + const char *name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME, name); -} /* ecore_x_netwm_visible_name_set */ +} EAPI int ecore_x_netwm_visible_name_get(Ecore_X_Window win, - char **name) + char **name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (name) @@ -431,20 +432,20 @@ ecore_x_netwm_visible_name_get(Ecore_X_Window win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME); return 1; -} /* ecore_x_netwm_visible_name_get */ +} EAPI void ecore_x_netwm_icon_name_set(Ecore_X_Window win, - const char *name) + const char *name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); -} /* ecore_x_netwm_icon_name_set */ +} EAPI int ecore_x_netwm_icon_name_get(Ecore_X_Window win, - char **name) + char **name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (name) @@ -453,21 +454,21 @@ ecore_x_netwm_icon_name_get(Ecore_X_Window win, ECORE_X_ATOM_NET_WM_ICON_NAME); return 1; -} /* ecore_x_netwm_icon_name_get */ +} EAPI void ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, - const char *name) + const char *name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, name); -} /* ecore_x_netwm_visible_icon_name_set */ +} EAPI int ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, - char **name) + char **name) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (name) @@ -476,19 +477,19 @@ ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME); return 1; -} /* ecore_x_netwm_visible_icon_name_get */ +} EAPI void ecore_x_netwm_desktop_set(Ecore_X_Window win, - unsigned int desk) + unsigned int desk) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1); -} /* ecore_x_netwm_desktop_set */ +} EAPI Eina_Bool ecore_x_netwm_desktop_get(Ecore_X_Window win, - unsigned int *desk) + unsigned int *desk) { int ret; unsigned int tmp; @@ -501,17 +502,17 @@ ecore_x_netwm_desktop_get(Ecore_X_Window win, *desk = tmp; return ret == 1 ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_netwm_desktop_get */ +} /* * _NET_WM_STRUT is deprecated */ EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win, - int left, - int right, - int top, - int bottom) + int left, + int right, + int top, + int bottom) { unsigned int strut[4]; @@ -521,17 +522,17 @@ ecore_x_netwm_strut_set(Ecore_X_Window win, strut[2] = top; strut[3] = bottom; ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); -} /* ecore_x_netwm_strut_set */ +} /* * _NET_WM_STRUT is deprecated */ EAPI Eina_Bool ecore_x_netwm_strut_get(Ecore_X_Window win, - int *left, - int *right, - int *top, - int *bottom) + int *left, + int *right, + int *top, + int *bottom) { int ret = 0; unsigned int strut[4]; @@ -557,22 +558,22 @@ ecore_x_netwm_strut_get(Ecore_X_Window win, *bottom = strut[3]; return EINA_TRUE; -} /* ecore_x_netwm_strut_get */ +} EAPI void ecore_x_netwm_strut_partial_set(Ecore_X_Window win, - int left, - int right, - int top, - int bottom, - int left_start_y, - int left_end_y, - int right_start_y, - int right_end_y, - int top_start_x, - int top_end_x, - int bottom_start_x, - int bottom_end_x) + int left, + int right, + int top, + int bottom, + int left_start_y, + int left_end_y, + int right_start_y, + int right_end_y, + int top_start_x, + int top_end_x, + int bottom_start_x, + int bottom_end_x) { unsigned int strut[12]; @@ -593,22 +594,22 @@ ecore_x_netwm_strut_partial_set(Ecore_X_Window win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12); -} /* ecore_x_netwm_strut_partial_set */ +} EAPI Eina_Bool ecore_x_netwm_strut_partial_get(Ecore_X_Window win, - int *left, - int *right, - int *top, - int *bottom, - int *left_start_y, - int *left_end_y, - int *right_start_y, - int *right_end_y, - int *top_start_x, - int *top_end_x, - int *bottom_start_x, - int *bottom_end_x) + int *left, + int *right, + int *top, + int *bottom, + int *left_start_y, + int *left_end_y, + int *right_start_y, + int *right_end_y, + int *top_start_x, + int *top_end_x, + int *bottom_start_x, + int *bottom_end_x) { int ret = 0; unsigned int strut[12]; @@ -658,12 +659,12 @@ ecore_x_netwm_strut_partial_get(Ecore_X_Window win, *bottom_end_x = strut[11]; return EINA_TRUE; -} /* ecore_x_netwm_strut_partial_get */ +} EAPI Eina_Bool ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, - int *num) + int *num) { unsigned int *data, *p; unsigned int *src; @@ -767,14 +768,14 @@ ecore_x_netwm_icons_get(Ecore_X_Window win, free(data); return EINA_TRUE; -} /* ecore_x_netwm_icons_get */ +} EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, - int x, - int y, - int width, - int height) + int x, + int y, + int width, + int height) { unsigned int geometry[4]; @@ -787,14 +788,14 @@ ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4); -} /* ecore_x_netwm_icon_geometry_set */ +} EAPI Eina_Bool ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *width, - int *height) + int *x, + int *y, + int *width, + int *height) { int ret; unsigned int geometry[4]; @@ -820,11 +821,11 @@ ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, *height = geometry[3]; return EINA_TRUE; -} /* ecore_x_netwm_icon_geometry_get */ +} EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win, - int pid) + int pid) { unsigned int tmp; @@ -832,11 +833,11 @@ ecore_x_netwm_pid_set(Ecore_X_Window win, tmp = pid; ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1); -} /* ecore_x_netwm_pid_set */ +} EAPI Eina_Bool ecore_x_netwm_pid_get(Ecore_X_Window win, - int *pid) + int *pid) { int ret; unsigned int tmp; @@ -848,7 +849,7 @@ ecore_x_netwm_pid_get(Ecore_X_Window win, *pid = tmp; return ret == 1 ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_netwm_pid_get */ +} EAPI void ecore_x_netwm_handled_icons_set(Ecore_X_Window win) @@ -856,7 +857,7 @@ ecore_x_netwm_handled_icons_set(Ecore_X_Window win) LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, NULL, 0); -} /* ecore_x_netwm_handled_icons_set */ +} EAPI Eina_Bool ecore_x_netwm_handled_icons_get(Ecore_X_Window win) @@ -866,20 +867,20 @@ ecore_x_netwm_handled_icons_get(Ecore_X_Window win) ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, NULL, 0); return ret == 0 ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_netwm_handled_icons_get */ +} EAPI void ecore_x_netwm_user_time_set(Ecore_X_Window win, - unsigned int tim) + unsigned int tim) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, &tim, 1); -} /* ecore_x_netwm_user_time_set */ +} EAPI Eina_Bool ecore_x_netwm_user_time_get(Ecore_X_Window win, - unsigned int *tim) + unsigned int *tim) { int ret; unsigned int tmp; @@ -891,7 +892,7 @@ ecore_x_netwm_user_time_get(Ecore_X_Window win, *tim = tmp; return ret == 1 ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_netwm_user_time_get */ +} Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a) @@ -922,12 +923,12 @@ _ecore_x_netwm_state_get(Ecore_X_Atom a) return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; else return ECORE_X_WINDOW_STATE_UNKNOWN; -} /* _ecore_x_netwm_state_get */ +} static Ecore_X_Atom _ecore_x_netwm_state_atom_get(Ecore_X_Window_State s) { - switch(s) + switch (s) { case ECORE_X_WINDOW_STATE_MODAL: return ECORE_X_ATOM_NET_WM_STATE_MODAL; @@ -967,13 +968,13 @@ _ecore_x_netwm_state_atom_get(Ecore_X_Window_State s) default: return 0; - } /* switch */ -} /* _ecore_x_netwm_state_atom_get */ + } +} EAPI void -ecore_x_netwm_window_state_set(Ecore_X_Window win, +ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state, - unsigned int num) + unsigned int num) { Ecore_X_Atom *set; unsigned int i; @@ -995,12 +996,12 @@ ecore_x_netwm_window_state_set(Ecore_X_Window win, ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num); free(set); -} /* ecore_x_netwm_window_state_set */ +} EAPI Eina_Bool -ecore_x_netwm_window_state_get(Ecore_X_Window win, +ecore_x_netwm_window_state_get(Ecore_X_Window win, Ecore_X_Window_State **state, - unsigned int *num) + unsigned int *num) { int num_ret, i; Ecore_X_Atom *atoms; @@ -1030,7 +1031,7 @@ ecore_x_netwm_window_state_get(Ecore_X_Window win, free(atoms); return EINA_TRUE; -} /* ecore_x_netwm_window_state_get */ +} static Ecore_X_Window_Type _ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom) @@ -1065,7 +1066,7 @@ _ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom) return ECORE_X_WINDOW_TYPE_DND; else return ECORE_X_WINDOW_TYPE_UNKNOWN; -} /* _ecore_x_netwm_window_type_type_get */ +} static Ecore_X_Atom _ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type) @@ -1116,15 +1117,15 @@ _ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type) default: return 0; - } /* switch */ -} /* _ecore_x_netwm_window_type_atom_get */ + } +} /* * FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR * , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG */ EAPI void -ecore_x_netwm_window_type_set(Ecore_X_Window win, +ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type) { Ecore_X_Atom atom; @@ -1133,11 +1134,11 @@ ecore_x_netwm_window_type_set(Ecore_X_Window win, atom = _ecore_x_netwm_window_type_atom_get(type); ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atom, 1); -} /* ecore_x_netwm_window_type_set */ +} /* FIXME: Maybe return 0 on some conditions? */ EAPI Eina_Bool -ecore_x_netwm_window_type_get(Ecore_X_Window win, +ecore_x_netwm_window_type_get(Ecore_X_Window win, Ecore_X_Window_Type *type) { int num; @@ -1158,10 +1159,10 @@ ecore_x_netwm_window_type_get(Ecore_X_Window win, return EINA_TRUE; return EINA_FALSE; -} /* ecore_x_netwm_window_type_get */ +} EAPI int -ecore_x_netwm_window_types_get(Ecore_X_Window win, +ecore_x_netwm_window_types_get(Ecore_X_Window win, Ecore_X_Window_Type **types) { int num, i; @@ -1196,7 +1197,7 @@ ecore_x_netwm_window_types_get(Ecore_X_Window win, free(atoms2); return num; -} /* ecore_x_netwm_window_types_get */ +} static Ecore_X_Atom _ecore_x_netwm_action_atom_get(Ecore_X_Action action) @@ -1241,8 +1242,8 @@ _ecore_x_netwm_action_atom_get(Ecore_X_Action action) default: return 0; - } /* switch */ -} /* _ecore_x_netwm_action_atom_get */ + } +} /* FIXME: Get complete list */ EAPI Eina_Bool @@ -1272,13 +1273,13 @@ ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, free(atoms); return ret; -} /* ecore_x_netwm_allowed_action_isset */ +} /* FIXME: Set complete list */ EAPI void -ecore_x_netwm_allowed_action_set(Ecore_X_Window win, +ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action *action, - unsigned int num) + unsigned int num) { Ecore_X_Atom *set; unsigned int i; @@ -1304,12 +1305,12 @@ ecore_x_netwm_allowed_action_set(Ecore_X_Window win, num); free(set); -} /* ecore_x_netwm_allowed_action_set */ +} EAPI Eina_Bool -ecore_x_netwm_allowed_action_get(Ecore_X_Window win, +ecore_x_netwm_allowed_action_get(Ecore_X_Window win, Ecore_X_Action **action, - unsigned int *num) + unsigned int *num) { int num_ret, i; Ecore_X_Atom *atoms; @@ -1341,20 +1342,20 @@ ecore_x_netwm_allowed_action_get(Ecore_X_Window win, free(atoms); return EINA_TRUE; -} /* ecore_x_netwm_allowed_action_get */ +} EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, - unsigned int opacity) + unsigned int opacity) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, &opacity, 1); -} /* ecore_x_netwm_opacity_set */ +} EAPI Eina_Bool ecore_x_netwm_opacity_get(Ecore_X_Window win, - unsigned int *opacity) + unsigned int *opacity) { int ret; unsigned int tmp; @@ -1366,14 +1367,14 @@ ecore_x_netwm_opacity_get(Ecore_X_Window win, *opacity = tmp; return ret == 1 ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_netwm_opacity_get */ +} EAPI void ecore_x_netwm_frame_size_set(Ecore_X_Window win, - int fl, - int fr, - int ft, - int fb) + int fl, + int fr, + int ft, + int fb) { unsigned int frames[4]; @@ -1386,14 +1387,14 @@ ecore_x_netwm_frame_size_set(Ecore_X_Window win, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4); -} /* ecore_x_netwm_frame_size_set */ +} EAPI Eina_Bool ecore_x_netwm_frame_size_get(Ecore_X_Window win, - int *fl, - int *fr, - int *ft, - int *fb) + int *fl, + int *fr, + int *ft, + int *fb) { int ret = 0; unsigned int frames[4]; @@ -1419,10 +1420,10 @@ ecore_x_netwm_frame_size_get(Ecore_X_Window win, *fb = frames[3]; return EINA_TRUE; -} /* ecore_x_netwm_frame_size_get */ +} EAPI Eina_Bool -ecore_x_netwm_sync_counter_get(Ecore_X_Window win, +ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter) { int ret; @@ -1439,7 +1440,7 @@ ecore_x_netwm_sync_counter_get(Ecore_X_Window win, *counter = tmp; return ret == 1 ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_netwm_sync_counter_get */ +} EAPI void ecore_x_netwm_ping_send(Ecore_X_Window win) @@ -1462,11 +1463,11 @@ ecore_x_netwm_ping_send(Ecore_X_Window win) xev.xclient.data.l[4] = 0; XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); -} /* ecore_x_netwm_ping_send */ +} EAPI void ecore_x_netwm_sync_request_send(Ecore_X_Window win, - unsigned int serial) + unsigned int serial) { XSyncValue value; XEvent xev; @@ -1489,14 +1490,14 @@ ecore_x_netwm_sync_request_send(Ecore_X_Window win, xev.xclient.data.l[4] = 0; XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); -} /* ecore_x_netwm_sync_request_send */ +} EAPI void -ecore_x_netwm_state_request_send(Ecore_X_Window win, - Ecore_X_Window root, +ecore_x_netwm_state_request_send(Ecore_X_Window win, + Ecore_X_Window root, Ecore_X_Window_State s1, Ecore_X_Window_State s2, - Eina_Bool set) + Eina_Bool set) { XEvent xev; @@ -1524,12 +1525,12 @@ ecore_x_netwm_state_request_send(Ecore_X_Window win, XSendEvent(_ecore_x_disp, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); -} /* ecore_x_netwm_state_request_send */ +} EAPI void ecore_x_netwm_desktop_request_send(Ecore_X_Window win, Ecore_X_Window root, - unsigned int desktop) + unsigned int desktop) { XEvent xev; @@ -1551,11 +1552,11 @@ ecore_x_netwm_desktop_request_send(Ecore_X_Window win, XSendEvent(_ecore_x_disp, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); -} /* ecore_x_netwm_desktop_request_send */ +} int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, - char *data __UNUSED__) + char *data __UNUSED__) { #if 0 Ecore_X_Startup_Info *info; @@ -1600,11 +1601,11 @@ _ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, #endif /* if 0 */ return 1; -} /* _ecore_x_netwm_startup_info_begin */ +} int _ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__, - char *data __UNUSED__) + char *data __UNUSED__) { #if 0 Ecore_X_Startup_Info *info; @@ -1639,26 +1640,26 @@ _ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__, #endif /* if 0 */ return 1; -} /* _ecore_x_netwm_startup_info */ +} /* * Set UTF-8 string property */ static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, - Ecore_X_Atom atom, - const char *str) + Ecore_X_Atom atom, + const char *str) { XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, PropModeReplace, (unsigned char *)str, strlen(str)); -} /* _ecore_x_window_prop_string_utf8_set */ +} /* * Get UTF-8 string property */ static char * _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, - Ecore_X_Atom atom) + Ecore_X_Atom atom) { char *str; unsigned char *prop_ret; @@ -1685,7 +1686,7 @@ _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, XFree(prop_ret); return str; -} /* _ecore_x_window_prop_string_utf8_get */ +} #if 0 /* Unused */ /* @@ -1758,19 +1759,19 @@ _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info) else { /* Discard buffer */ - info->length = 0; - info->buffer[0] = 0; + info->length = 0; + info->buffer[0] = 0; } return 1; -} /* _ecore_x_netwm_startup_info_process */ +} /* * Parse startup info */ static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, - char *data) + char *data) { while (*data) { @@ -1780,7 +1781,8 @@ _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char value[1024]; /* Skip space */ - while (*data == ' ') data++; + while (*data == ' ') + data++; /* Get key */ key = data; data = strchr(key, '='); @@ -1920,7 +1922,7 @@ _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, return 0; return 1; -} /* _ecore_x_netwm_startup_info_parse */ +} #endif /* if 0 */ @@ -1958,7 +1960,7 @@ _ecore_x_netwm_startup_info_free(void *data) free(info->wmclass); free(info); -} /* _ecore_x_netwm_startup_info_free */ +} /* * Is screen composited? @@ -1981,10 +1983,10 @@ ecore_x_screen_is_composited(int screen) win = XGetSelectionOwner(_ecore_x_disp, atom); return (win != None) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_screen_is_composited */ +} EAPI void -ecore_x_screen_is_composited_set(int screen, +ecore_x_screen_is_composited_set(int screen, Ecore_X_Window win) { static Ecore_X_Atom atom = None; @@ -1999,5 +2001,5 @@ ecore_x_screen_is_composited_set(int screen, return; XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time); -} /* ecore_x_screen_is_composited_set */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c index b81d06c..7b13615 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c @@ -26,9 +26,9 @@ */ EAPI Ecore_X_Pixmap ecore_x_pixmap_new(Ecore_X_Window win, - int w, - int h, - int dep) + int w, + int h, + int dep) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (win == 0) @@ -38,7 +38,7 @@ ecore_x_pixmap_new(Ecore_X_Window win, dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); return XCreatePixmap(_ecore_x_disp, win, w, h, dep); -} /* ecore_x_pixmap_new */ +} /** * Deletes the reference to the given pixmap. @@ -54,7 +54,7 @@ ecore_x_pixmap_free(Ecore_X_Pixmap pmap) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XFreePixmap(_ecore_x_disp, pmap); -} /* ecore_x_pixmap_free */ +} /** * Pastes a rectangular area of the given pixmap onto the given drawable. @@ -71,19 +71,19 @@ ecore_x_pixmap_free(Ecore_X_Pixmap pmap) * @ingroup Ecore_X_Pixmap_Group */ EAPI void -ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, +ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, Ecore_X_Drawable dest, - Ecore_X_GC gc, - int sx, - int sy, - int w, - int h, - int dx, - int dy) + Ecore_X_GC gc, + int sx, + int sy, + int w, + int h, + int dx, + int dy) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy); -} /* ecore_x_pixmap_paste */ +} /** * Retrieves the size of the given pixmap. @@ -96,15 +96,15 @@ ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, */ EAPI void ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (pmap) ecore_x_drawable_geometry_get(pmap, x, y, w, h); -} /* ecore_x_pixmap_geometry_get */ +} /** * Retrieves the depth of the given pixmap. @@ -117,5 +117,5 @@ ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_drawable_depth_get(pmap); -} /* ecore_x_pixmap_depth_get */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c index a6bafb6..816f8d5 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c @@ -8,6 +8,10 @@ #include "ecore_x_private.h" #include "ecore_x_randr.h" +#include +#include +#include +#include #define Ecore_X_Randr_None 0 #ifdef ECORE_XRANDR @@ -18,7 +22,8 @@ root) ((screen = \ XRRRootToScreen(_ecore_x_disp, \ root)) != -1) -#define RANDR_CHECK_1_1_RET(ret) if(_randr_version < RANDR_1_1) return ret +#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) \ + return ret extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy, @@ -44,7 +49,7 @@ ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root) #else /* ifdef ECORE_XRANDR */ return Ecore_X_Randr_None; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_orientations_get */ +} /* * @param root window which's primary output will be queried @@ -61,7 +66,7 @@ ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root) #else /* ifdef ECORE_XRANDR */ return Ecore_X_Randr_None; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_orientation_get */ +} /* * @brief sets a given screen's primary output's orientation @@ -95,7 +100,7 @@ ecore_x_randr_screen_primary_output_orientation_set( #else /* ifdef ECORE_XRANDR */ return EINA_FALSE; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_orientation_set */ +} /* * @brief gets a screen's primary output's possible sizes @@ -105,7 +110,7 @@ ecore_x_randr_screen_primary_output_orientation_set( */ EAPI Ecore_X_Randr_Screen_Size_MM * ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, - int *num) + int *num) { #ifdef ECORE_XRANDR Ecore_X_Randr_Screen_Size_MM *ret = NULL; @@ -135,7 +140,7 @@ ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, #else /* ifdef ECORE_XRANDR */ return NULL; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_sizes_get */ +} /* * @brief get the current set size of a given screen's primary output @@ -148,11 +153,11 @@ ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, */ EAPI void ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, - int *w, - int *h, - int *w_mm, - int *h_mm, - int *size_index) + int *w, + int *h, + int *w_mm, + int *h_mm, + int *size_index) { #ifdef ECORE_XRANDR XRRScreenSize *sizes; @@ -192,7 +197,7 @@ ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, XRRFreeScreenConfigInfo(sc); #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_current_size_get */ +} /* * @brief sets a given screen's primary output size, but disables all other outputs at the same time @@ -202,18 +207,16 @@ ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, */ EAPI Eina_Bool ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, - int size_index) + int size_index) { #ifdef ECORE_XRANDR XRRScreenConfiguration *sc = NULL; - XRRScreenSize *sizes; Eina_Bool ret = EINA_FALSE; int nsizes = 0; if (size_index >= 0 && _ecore_x_randr_root_validate(root)) { - sizes = - XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, + XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, root), &nsizes); if (size_index < nsizes) @@ -235,7 +238,7 @@ ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, #else /* ifdef ECORE_XRANDR */ return EINA_FALSE; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_size_set */ +} /* * @param root window which's primary output will be queried @@ -261,7 +264,7 @@ ecore_x_randr_screen_primary_output_current_refresh_rate_get( #else /* ifdef ECORE_XRANDR */ return 0.0; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_current_refresh_rate_get */ +} /* * @param root window which's primary output will be queried @@ -270,8 +273,8 @@ ecore_x_randr_screen_primary_output_current_refresh_rate_get( */ EAPI Ecore_X_Randr_Refresh_Rate * ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, - int size_index, - int *num) + int size_index, + int *num) { #ifdef ECORE_XRANDR Ecore_X_Randr_Refresh_Rate *ret = NULL, *rates = NULL; @@ -293,7 +296,7 @@ ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, #else /* ifdef ECORE_XRANDR */ return NULL; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_refresh_rates_get */ +} //>= 1.1 /* @@ -306,7 +309,7 @@ ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, EAPI Eina_Bool ecore_x_randr_screen_primary_output_refresh_rate_set( Ecore_X_Window root, - int size_index, + int size_index, Ecore_X_Randr_Refresh_Rate rate) { @@ -328,5 +331,5 @@ ecore_x_randr_screen_primary_output_refresh_rate_set( #else /* ifdef ECORE_XRANDR */ return EINA_FALSE; #endif /* ifdef ECORE_XRANDR */ -} /* ecore_x_randr_screen_primary_output_refresh_rate_set */ +} 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 fb607d1..38218a5 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 @@ -8,6 +8,10 @@ #include "ecore_x_private.h" #include "ecore_x_randr.h" +#include +#include +#include +#include #define Ecore_X_Randr_None (Ecore_X_Randr_Crtc)0 #define Ecore_X_Randr_Unset (Ecore_X_Randr_Crtc) - 1 @@ -19,7 +23,8 @@ #define RANDR_VALIDATE_ROOT(screen, root) \ ((screen = XRRRootToScreen(_ecore_x_disp, root)) != -1) -#define RANDR_CHECK_1_2_RET(ret) if(_randr_version < RANDR_1_2) return ret +#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) \ + return ret #define RANDR_PROPERTY_EDID "EDID" #define RANDR_PROPERTY_BACKLIGHT "Backlight" @@ -45,7 +50,7 @@ extern int _randr_version; */ EAPI void ecore_x_randr_events_select(Ecore_X_Window win, - Eina_Bool on) + Eina_Bool on) { #ifdef ECORE_XRANDR int mask; @@ -73,7 +78,7 @@ ecore_x_randr_events_select(Ecore_X_Window win, * @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned. */ static inline Eina_Bool -_ecore_x_randr_crtc_validate(Ecore_X_Window root, +_ecore_x_randr_crtc_validate(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) { #ifdef ECORE_XRANDR @@ -108,7 +113,7 @@ _ecore_x_randr_crtc_validate(Ecore_X_Window root, } Eina_Bool -_ecore_x_randr_output_validate(Ecore_X_Window root, +_ecore_x_randr_output_validate(Ecore_X_Window root, Ecore_X_Randr_Output output) { #ifdef ECORE_XRANDR @@ -139,7 +144,7 @@ _ecore_x_randr_output_validate(Ecore_X_Window root, } static inline Eina_Bool -_ecore_x_randr_mode_validate(Ecore_X_Window root, +_ecore_x_randr_mode_validate(Ecore_X_Window root, Ecore_X_Randr_Mode mode) { #ifdef ECORE_XRANDR @@ -175,10 +180,10 @@ _ecore_x_randr_mode_validate(Ecore_X_Window root, */ EAPI void ecore_x_randr_screen_current_size_get(Ecore_X_Window root, - int *w, - int *h, - int *w_mm, - int *h_mm) + int *w, + int *h, + int *w_mm, + int *h_mm) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -211,10 +216,10 @@ ecore_x_randr_screen_current_size_get(Ecore_X_Window root, */ EAPI void ecore_x_randr_screen_size_range_get(Ecore_X_Window root, - int *wmin, - int *hmin, - int *wmax, - int *hmax) + int *wmin, + int *hmin, + int *wmax, + int *hmax) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -249,10 +254,10 @@ ecore_x_randr_screen_size_range_get(Ecore_X_Window root, */ EAPI Eina_Bool ecore_x_randr_screen_current_size_set(Ecore_X_Window root, - int w, - int h, - int w_mm, - int h_mm) + int w, + int h, + int w_mm, + int h_mm) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(EINA_FALSE); @@ -281,14 +286,14 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root, if (h <= 0) h = DisplayHeight(_ecore_x_disp, scr); - if(w_mm <= 0) + if (w_mm <= 0) w_mm = (int)(((double)(DisplayWidthMM(_ecore_x_disp, scr) / (double)DisplayWidth(_ecore_x_disp, scr))) * (double)w); - if(h_mm <= 0) + if (h_mm <= 0) h_mm = (int)(((double)(DisplayHeightMM(_ecore_x_disp, scr) / @@ -310,7 +315,7 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root, */ EAPI Ecore_X_Randr_Mode_Info ** ecore_x_randr_modes_info_get(Ecore_X_Window root, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -353,7 +358,7 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root, } else { - while(i > 0) + while (i > 0) free(ret[--i]); free(ret); ret = NULL; @@ -381,7 +386,7 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root, * @return mode's detailed information */ EAPI Ecore_X_Randr_Mode_Info * -ecore_x_randr_mode_info_get(Ecore_X_Window root, +ecore_x_randr_mode_info_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode) { #ifdef ECORE_XRANDR @@ -461,7 +466,7 @@ ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info) */ EAPI Ecore_X_Randr_Crtc * ecore_x_randr_crtcs_get(Ecore_X_Window root, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -488,7 +493,7 @@ ecore_x_randr_crtcs_get(Ecore_X_Window root, EAPI Ecore_X_Randr_Output * ecore_x_randr_outputs_get(Ecore_X_Window root, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -523,9 +528,9 @@ ecore_x_randr_outputs_get(Ecore_X_Window root, * @param num number of outputs referenced by given CRTC */ EAPI Ecore_X_Randr_Output * -ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, +ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -567,9 +572,9 @@ ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, * @param num number of possible outputs referenced by given CRTC */ EAPI Ecore_X_Randr_Output * -ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, +ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -581,7 +586,7 @@ ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, crtc) && (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) { - if((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) { if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->npossible))) @@ -605,12 +610,12 @@ ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, } EAPI void -ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, +ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -652,10 +657,10 @@ ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, * @return EINA_TRUE if position could be successfully be altered. */ EAPI Eina_Bool -ecore_x_randr_crtc_pos_set(Ecore_X_Window root, +ecore_x_randr_crtc_pos_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, - int x, - int y) + int x, + int y) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(EINA_FALSE); @@ -706,7 +711,7 @@ ecore_x_randr_crtc_pos_set(Ecore_X_Window root, * Ecore_X_Randr_Unset */ EAPI Ecore_X_Randr_Mode -ecore_x_randr_crtc_mode_get(Ecore_X_Window root, +ecore_x_randr_crtc_mode_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) { #ifdef ECORE_XRANDR @@ -746,11 +751,11 @@ ecore_x_randr_crtc_mode_get(Ecore_X_Window root, * @return EINA_TRUE if mode setting was successful. Else EINA_FALSE */ EAPI Eina_Bool -ecore_x_randr_crtc_mode_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, +ecore_x_randr_crtc_mode_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Output *outputs, - int noutputs, - Ecore_X_Randr_Mode mode) + int noutputs, + Ecore_X_Randr_Mode mode) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(EINA_FALSE); @@ -772,10 +777,10 @@ ecore_x_randr_crtc_mode_set(Ecore_X_Window root, } EAPI void -ecore_x_randr_crtc_size_get(Ecore_X_Window root, +ecore_x_randr_crtc_size_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, - int *w, - int *h) + int *w, + int *h) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -784,7 +789,7 @@ ecore_x_randr_crtc_size_get(Ecore_X_Window root, } EAPI Ecore_X_Randr_Refresh_Rate -ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, +ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Mode mode) { @@ -824,7 +829,7 @@ ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, } EAPI Ecore_X_Randr_Orientation -ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, +ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) { #ifdef ECORE_XRANDR @@ -855,7 +860,7 @@ ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, } EAPI Ecore_X_Randr_Orientation -ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, +ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) { #ifdef ECORE_XRANDR @@ -886,8 +891,8 @@ ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, } EAPI Eina_Bool -ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, +ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Orientation orientation) { #ifdef ECORE_XRANDR @@ -913,10 +918,10 @@ ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, } EAPI void -ecore_x_randr_crtc_pos_get(Ecore_X_Window root, +ecore_x_randr_crtc_pos_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, - int *x, - int *y) + int *x, + int *y) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -926,7 +931,7 @@ ecore_x_randr_crtc_pos_get(Ecore_X_Window root, } EAPI Eina_Bool -ecore_x_randr_crtc_clone_set(Ecore_X_Window root, +ecore_x_randr_crtc_clone_set(Ecore_X_Window root, Ecore_X_Randr_Crtc original, Ecore_X_Randr_Crtc clon) { @@ -993,13 +998,13 @@ ecore_x_randr_crtc_clone_set(Ecore_X_Window root, * EINA_FALSE */ EAPI Eina_Bool -ecore_x_randr_crtc_settings_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc, - Ecore_X_Randr_Output *outputs, - int noutputs, - int x, - int y, - Ecore_X_Randr_Mode mode, +ecore_x_randr_crtc_settings_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int noutputs, + int x, + int y, + Ecore_X_Randr_Mode mode, Ecore_X_Randr_Orientation orientation) { #ifdef ECORE_XRANDR @@ -1059,17 +1064,17 @@ ecore_x_randr_crtc_settings_set(Ecore_X_Window root, * @brief sets a CRTC relative to another one. * @param crtc_r1 the CRTC to be positioned. * @param crtc_r2 the CRTC the position should be relative to - * @param position the relation between the crtcs + * @param policy the relation between the crtcs * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's * borders * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if * repositioning failed or if position of new crtc would be out of given screen's min/max bounds. */ EAPI Eina_Bool -ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, - Ecore_X_Randr_Crtc crtc_r1, - Ecore_X_Randr_Crtc crtc_r2, - Ecore_X_Randr_Output_Policy policy, +ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc_r1, + Ecore_X_Randr_Crtc crtc_r2, + Ecore_X_Randr_Output_Policy policy, Ecore_X_Randr_Relative_Alignment alignment) { #ifdef ECORE_XRANDR @@ -1360,10 +1365,10 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, } EAPI Ecore_X_Randr_Mode * -ecore_x_randr_output_modes_get(Ecore_X_Window root, +ecore_x_randr_output_modes_get(Ecore_X_Window root, Ecore_X_Randr_Output output, - int *num, - int *npreferred) + int *num, + int *npreferred) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -1401,9 +1406,9 @@ ecore_x_randr_output_modes_get(Ecore_X_Window root, } EAPI Ecore_X_Randr_Crtc * -ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, +ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, Ecore_X_Randr_Output output, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -1441,9 +1446,9 @@ ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, * @param num number of possible clones */ EAPI Ecore_X_Randr_Output * -ecore_x_randr_output_clones_get(Ecore_X_Window root, +ecore_x_randr_output_clones_get(Ecore_X_Window root, Ecore_X_Randr_Output output, - int *num) + int *num) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -1474,7 +1479,7 @@ ecore_x_randr_output_clones_get(Ecore_X_Window root, } EAPI Ecore_X_Randr_Crtc -ecore_x_randr_output_crtc_get(Ecore_X_Window root, +ecore_x_randr_output_crtc_get(Ecore_X_Window root, Ecore_X_Randr_Output output) { #ifdef ECORE_XRANDR @@ -1509,9 +1514,9 @@ ecore_x_randr_output_crtc_get(Ecore_X_Window root, * @return name of the output as reported by X */ EAPI char * -ecore_x_randr_output_name_get(Ecore_X_Window root, +ecore_x_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output, - int *len) + int *len) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -1532,10 +1537,10 @@ ecore_x_randr_output_name_get(Ecore_X_Window root, * *len = output_info->nameLen; * */ - if ((ret = strdup(output_info->name)) && len) - *len = strlen(ret); + if ((ret = strdup(output_info->name)) && len) + *len = strlen(ret); - XRRFreeOutputInfo(output_info); + XRRFreeOutputInfo(output_info); } if (res) @@ -1554,10 +1559,10 @@ ecore_x_randr_output_name_get(Ecore_X_Window root, * @param h height of given mode in px */ EAPI void -ecore_x_randr_mode_size_get(Ecore_X_Window root, +ecore_x_randr_mode_size_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode, - int *w, - int *h) + int *w, + int *h) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -1598,9 +1603,9 @@ ecore_x_randr_mode_size_get(Ecore_X_Window root, * @param length length of the byte-array. If NULL, request will fail. */ EAPI unsigned char * -ecore_x_randr_output_edid_get(Ecore_X_Window root, +ecore_x_randr_output_edid_get(Ecore_X_Window root, Ecore_X_Randr_Output output, - unsigned long *length) + unsigned long *length) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -1613,18 +1618,18 @@ ecore_x_randr_output_edid_get(Ecore_X_Window root, if (!length || !_ecore_x_randr_output_validate(root, output)) return NULL; - if(XRRGetOutputProperty (_ecore_x_disp, output, name, - 0, 100, False, False, - AnyPropertyType, - &actual_type, &actual_format, - &nitems, &bytes_after, &prop_data) == Success) + if (XRRGetOutputProperty (_ecore_x_disp, output, name, + 0, 100, False, False, + AnyPropertyType, + &actual_type, &actual_format, + &nitems, &bytes_after, &prop_data) == Success) { if (actual_type == XA_INTEGER && actual_format == 8) { if ((ret = malloc(nitems * sizeof(unsigned char)))) { - if(length && - (memcpy(ret, prop_data, (nitems * sizeof(unsigned char))))) + if (length && + (memcpy(ret, prop_data, (nitems * sizeof(unsigned char))))) *length = nitems; return ret; @@ -1639,7 +1644,7 @@ ecore_x_randr_output_edid_get(Ecore_X_Window root, } EAPI Ecore_X_Randr_Connection_Status -ecore_x_randr_output_connection_status_get(Ecore_X_Window root, +ecore_x_randr_output_connection_status_get(Ecore_X_Window root, Ecore_X_Randr_Output output) { #ifdef ECORE_XRANDR @@ -1669,10 +1674,10 @@ ecore_x_randr_output_connection_status_get(Ecore_X_Window root, } EAPI void -ecore_x_randr_output_size_mm_get(Ecore_X_Window root, +ecore_x_randr_output_size_mm_get(Ecore_X_Window root, Ecore_X_Randr_Output output, - int *w_mm, - int *h_mm) + int *w_mm, + int *h_mm) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -1701,11 +1706,11 @@ ecore_x_randr_output_size_mm_get(Ecore_X_Window root, } EAPI Eina_Bool -ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, +ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, const Ecore_X_Randr_Crtc *not_moved, - int nnot_moved, - int dx, - int dy) + int nnot_moved, + int dx, + int dy) { #ifdef ECORE_XRANDR Ecore_X_Randr_Crtc *crtcs_to_be_moved = NULL; @@ -1754,11 +1759,11 @@ ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, * @return EINA_TRUE if all crtcs could be moved successfully. */ EAPI Eina_Bool -ecore_x_randr_move_crtcs(Ecore_X_Window root, +ecore_x_randr_move_crtcs(Ecore_X_Window root, const Ecore_X_Randr_Crtc *crtcs, - int ncrtc, - int dx, - int dy) + int ncrtc, + int dx, + int dy) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(EINA_FALSE); @@ -1821,18 +1826,18 @@ ecore_x_randr_move_crtcs(Ecore_X_Window root, { //something went wrong, let's try to move the already moved crtcs //back. - while ((i--) >= 0) - { - if (crtc_info[i]) - ecore_x_randr_crtc_settings_set(root, - crtcs[i], - NULL, - Ecore_X_Randr_Unset, - (crtc_info[i]->x - dx), - (crtc_info[i]->y - dy), - crtc_info[i]->mode, - crtc_info[i]->rotation); - } + while ((i--) >= 0) + { + if (crtc_info[i]) + ecore_x_randr_crtc_settings_set(root, + crtcs[i], + NULL, + Ecore_X_Randr_Unset, + (crtc_info[i]->x - dx), + (crtc_info[i]->y - dy), + crtc_info[i]->mode, + crtc_info[i]->rotation); + } } for (i = 0; i < ncrtc; i++) @@ -1923,7 +1928,7 @@ ecore_x_randr_screen_reset(Ecore_X_Window root) EAPI void ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, - double level) + double level) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -1965,6 +1970,26 @@ ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, } /* + * @brief check if a backlight is available + * @return whether a blacklight is available + */ + +EAPI Eina_Bool +ecore_x_randr_output_backlight_available(void) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(-1); + Atom _backlight; + + _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); + + return (_backlight == None) ? EINA_FALSE : EINA_TRUE; + +#endif + return EINA_FALSE; +} + +/* * @brief get the backlight level of the given output * @param root window which's screen should be queried * @param output from which the backlight level should be retrieved @@ -1972,7 +1997,7 @@ ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, */ EAPI double -ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, +ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, Ecore_X_Randr_Output output) { #ifdef ECORE_XRANDR @@ -2025,9 +2050,9 @@ ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, if ((info->range) && (info->num_values == 2)) { /* finally convert the current value in the interval [0..1] */ - min = info->values[0]; - max = info->values[1]; - dvalue = ((double)(value - min)) / ((double)(max - min)); + min = info->values[0]; + max = info->values[1]; + dvalue = ((double)(value - min)) / ((double)(max - min)); } free(info); return dvalue; @@ -2045,9 +2070,9 @@ ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, */ EAPI Eina_Bool -ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, +ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, Ecore_X_Randr_Output output, - double level) + double level) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(EINA_FALSE); @@ -2107,7 +2132,7 @@ ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, EAPI Ecore_X_Randr_Output * ecore_x_randr_window_outputs_get(Ecore_X_Window window, - int *num) + int *num) { #ifdef ECORE_XRANDR Ecore_X_Window root; @@ -2136,39 +2161,39 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, for (i = 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); - } + 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); + } } free(crtcs); @@ -2192,7 +2217,7 @@ _ecore_x_randr_current_output_get_fail: EINA_DEPRECATED EAPI Ecore_X_Randr_Output * ecore_x_randr_current_output_get(Ecore_X_Window window, - int *num) + int *num) { return ecore_x_randr_window_outputs_get(window, num); } diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c index d434f2f..5bda332 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c @@ -23,6 +23,10 @@ /* Heavily modified by: Leif Middelschulte */ #include "Ecore_X.h" +#include +#include +#include +#include /* TODO: * - see other TODO's within this file. @@ -100,7 +104,7 @@ typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred { EAPI Eina_Bool ecore_x_randr_edid_has_valid_header(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { const unsigned char header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; @@ -112,7 +116,7 @@ ecore_x_randr_edid_has_valid_header(unsigned char *edid, EAPI int ecore_x_randr_edid_version_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) && (ecore_x_randr_edid_has_valid_header(edid, edid_length))) @@ -123,7 +127,7 @@ ecore_x_randr_edid_version_get(unsigned char *edid, EAPI int ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { if ((edid_length > 0x0b) && (ecore_x_randr_edid_has_valid_header(edid, edid_length))) @@ -133,7 +137,7 @@ ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, EAPI int ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { if ((edid_length > 0x0f) && (ecore_x_randr_edid_has_valid_header(edid, edid_length))) @@ -144,7 +148,7 @@ ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, EAPI char * ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) && (ecore_x_randr_edid_has_valid_header(edid, edid_length))) @@ -166,7 +170,7 @@ ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, EAPI char * ecore_x_randr_edid_display_name_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { unsigned char *block = NULL; int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -196,7 +200,7 @@ ecore_x_randr_edid_display_name_get(unsigned char *edid, EAPI Ecore_X_Randr_Edid_Aspect_Ratio ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { unsigned char *block = NULL; int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -238,7 +242,7 @@ ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, EAPI Ecore_X_Randr_Edid_Aspect_Ratio ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; unsigned char *block = NULL; @@ -267,7 +271,7 @@ ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, EAPI char * ecore_x_randr_edid_display_ascii_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { unsigned char *block = NULL; int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -300,7 +304,7 @@ ecore_x_randr_edid_display_ascii_get(unsigned char *edid, EAPI char * ecore_x_randr_edid_display_serial_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { unsigned char *block = NULL; int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -333,7 +337,7 @@ ecore_x_randr_edid_display_serial_get(unsigned char *edid, EAPI Eina_Bool ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { unsigned char *cea_block_iter = NULL; char sum = 0; @@ -344,13 +348,15 @@ ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, if (edid_length < 128) return EINA_FALSE; /* Check the EDID block itself */ - for (i = 0; i < 128; i++) sum += edid[i]; + for (i = 0; i < 128; i++) + sum += edid[i]; if (sum) return EINA_FALSE; /* Check the cea extension blocks */ _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) { - for (i = 0, sum = 0; i < 128; i++) sum += cea_block_iter[i]; + for (i = 0, sum = 0; i < 128; i++) + sum += cea_block_iter[i]; } if (sum) return EINA_FALSE; return EINA_TRUE; @@ -358,7 +364,7 @@ ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, EAPI Eina_Bool ecore_x_randr_edid_dpms_available_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -369,7 +375,7 @@ ecore_x_randr_edid_dpms_available_get(unsigned char *edid, EAPI Eina_Bool ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -382,7 +388,7 @@ ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, EAPI Eina_Bool ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -395,7 +401,7 @@ ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, EAPI Eina_Bool ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -408,7 +414,7 @@ ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, EAPI Eina_Bool ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -419,7 +425,7 @@ ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, EAPI Ecore_X_Randr_Edid_Display_Colorscheme ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { Ecore_X_Randr_Edid_Display_Colorscheme colorscheme = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; int version = ecore_x_randr_edid_version_get(edid, edid_length); @@ -442,7 +448,7 @@ ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, EAPI Ecore_X_Randr_Edid_Display_Interface_Type ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, - unsigned long edid_length) + unsigned long edid_length) { Ecore_X_Randr_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; int version = ecore_x_randr_edid_version_get(edid, edid_length); diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c index ab242f7..5d1c8e9 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c @@ -8,6 +8,10 @@ #include "ecore_x_private.h" #include "ecore_x_randr.h" +#include +#include +#include +#include #define Ecore_X_Randr_None 0 #define Ecore_X_Randr_Unset -1 @@ -15,7 +19,8 @@ #ifdef ECORE_XRANDR #define RANDR_1_3 ((1 << 16) | 3) -#define RANDR_CHECK_1_3_RET(ret) if(_randr_version < RANDR_1_3) return ret +#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) \ + return ret extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy, @@ -47,7 +52,7 @@ ecore_x_randr_primary_output_get(Ecore_X_Window root) * @param output that should be set as given root window's screen primary output */ EAPI void -ecore_x_randr_primary_output_set(Ecore_X_Window root, +ecore_x_randr_primary_output_set(Ecore_X_Window root, Ecore_X_Randr_Output output) { #ifdef ECORE_XRANDR diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c index 7cc66e3..81d7eea 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c @@ -32,7 +32,7 @@ ecore_x_xregion_new() { LOGFN(__FILE__, __LINE__, __FUNCTION__); return (Ecore_X_XRegion *)XCreateRegion(); -} /* ecore_x_xregion_new */ +} EAPI void ecore_x_xregion_free(Ecore_X_XRegion *region) @@ -42,20 +42,20 @@ ecore_x_xregion_free(Ecore_X_XRegion *region) return; XDestroyRegion((Region)region); -} /* ecore_x_xregion_free */ +} EAPI Eina_Bool ecore_x_xregion_set(Ecore_X_XRegion *region, - Ecore_X_GC gc) + Ecore_X_GC gc) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_set */ +} EAPI void ecore_x_xregion_translate(Ecore_X_XRegion *region, - int x, - int y) + int x, + int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!region) @@ -63,7 +63,7 @@ ecore_x_xregion_translate(Ecore_X_XRegion *region, /* return value not used */ XOffsetRegion((Region)region, x, y); -} /* ecore_x_xregion_translate */ +} EAPI Eina_Bool ecore_x_xregion_intersect(Ecore_X_XRegion *dst, @@ -72,7 +72,7 @@ ecore_x_xregion_intersect(Ecore_X_XRegion *dst, { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XIntersectRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_intersect */ +} EAPI Eina_Bool ecore_x_xregion_union(Ecore_X_XRegion *dst, @@ -81,11 +81,11 @@ ecore_x_xregion_union(Ecore_X_XRegion *dst, { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_union */ +} EAPI Eina_Bool -ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, - Ecore_X_XRegion *src, +ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *src, Ecore_X_Rectangle *rect) { XRectangle xr; @@ -97,7 +97,7 @@ ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, xr.height = rect->height; return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_union_rect */ +} EAPI Eina_Bool ecore_x_xregion_subtract(Ecore_X_XRegion *dst, @@ -106,7 +106,7 @@ ecore_x_xregion_subtract(Ecore_X_XRegion *dst, { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XSubtractRegion((Region)rm, (Region)rs, (Region)dst) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_subtract */ +} EAPI Eina_Bool ecore_x_xregion_is_empty(Ecore_X_XRegion *region) @@ -116,7 +116,7 @@ ecore_x_xregion_is_empty(Ecore_X_XRegion *region) LOGFN(__FILE__, __LINE__, __FUNCTION__); return XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_is_empty */ +} EAPI Eina_Bool ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, @@ -127,22 +127,22 @@ ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, LOGFN(__FILE__, __LINE__, __FUNCTION__); return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_is_equal */ +} EAPI Eina_Bool ecore_x_xregion_point_contain(Ecore_X_XRegion *region, - int x, - int y) + int x, + int y) { if (!region) return EINA_FALSE; LOGFN(__FILE__, __LINE__, __FUNCTION__); return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_point_contain */ +} EAPI Eina_Bool -ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, +ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect) { if (!region || !rect) @@ -154,5 +154,5 @@ ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, rect->y, rect->width, rect->height) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_xregion_rect_contain */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c index a3bca67..40dd738 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c @@ -36,7 +36,7 @@ ecore_x_screensaver_event_available_get(void) _screensaver_available = 0; #endif /* ifdef ECORE_XSS */ return _screensaver_available; -} /* ecore_x_screensaver_event_available_get */ +} EAPI int ecore_x_screensaver_idle_time_get(void) @@ -57,7 +57,7 @@ ecore_x_screensaver_idle_time_get(void) #else return 0; #endif /* ifdef ECORE_XSS */ -} /* ecore_x_screensaver_idle_time_get */ +} EAPI void ecore_x_screensaver_set(int timeout, @@ -71,7 +71,7 @@ ecore_x_screensaver_set(int timeout, interval, prefer_blanking, allow_exposures); -} /* ecore_x_screensaver_set */ +} EAPI void ecore_x_screensaver_timeout_set(int timeout) @@ -81,7 +81,7 @@ ecore_x_screensaver_timeout_set(int timeout) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); XSetScreenSaver(_ecore_x_disp, timeout, pint, pblank, pexpo); -} /* ecore_x_screensaver_timeout_set */ +} EAPI int ecore_x_screensaver_timeout_get(void) @@ -91,7 +91,7 @@ ecore_x_screensaver_timeout_get(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); return pto; -} /* ecore_x_screensaver_timeout_get */ +} EAPI void ecore_x_screensaver_blank_set(int blank) @@ -101,7 +101,7 @@ ecore_x_screensaver_blank_set(int blank) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); XSetScreenSaver(_ecore_x_disp, pto, pint, blank, pexpo); -} /* ecore_x_screensaver_blank_set */ +} EAPI int ecore_x_screensaver_blank_get(void) @@ -111,7 +111,7 @@ ecore_x_screensaver_blank_get(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); return pblank; -} /* ecore_x_screensaver_blank_get */ +} EAPI void ecore_x_screensaver_expose_set(int expose) @@ -121,7 +121,7 @@ ecore_x_screensaver_expose_set(int expose) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); XSetScreenSaver(_ecore_x_disp, pto, pint, pblank, expose); -} /* ecore_x_screensaver_expose_set */ +} EAPI int ecore_x_screensaver_expose_get(void) @@ -131,7 +131,7 @@ ecore_x_screensaver_expose_get(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); return pexpo; -} /* ecore_x_screensaver_expose_get */ +} EAPI void ecore_x_screensaver_interval_set(int interval) @@ -141,7 +141,7 @@ ecore_x_screensaver_interval_set(int interval) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); XSetScreenSaver(_ecore_x_disp, pto, interval, pblank, pexpo); -} /* ecore_x_screensaver_interval_set */ +} EAPI int ecore_x_screensaver_interval_get(void) @@ -151,7 +151,7 @@ ecore_x_screensaver_interval_get(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); return pint; -} /* ecore_x_screensaver_interval_get */ +} EAPI void ecore_x_screensaver_event_listen_set(Eina_Bool on) @@ -169,5 +169,5 @@ ecore_x_screensaver_event_listen_set(Eina_Bool on) return; on = EINA_FALSE; #endif /* ifdef ECORE_XSS */ -} /* ecore_x_screensaver_event_listen_set */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c index b1aa611..fa177c3 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c @@ -15,29 +15,29 @@ static Ecore_X_Selection_Intern selections[4]; static Ecore_X_Selection_Converter *converters = NULL; static Ecore_X_Selection_Parser *parsers = NULL; -static Eina_Bool _ecore_x_selection_converter_text(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, +static Eina_Bool _ecore_x_selection_converter_text(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, Ecore_X_Atom *tprop, int *); static int _ecore_x_selection_data_default_free(void *data); static void *_ecore_x_selection_parser_files(const char *target, - void *data, - int size, - int format); + void *data, + int size, + int format); static int _ecore_x_selection_data_files_free(void *data); static void *_ecore_x_selection_parser_text(const char *target, - void *data, - int size, - int format); + void *data, + int size, + int format); static int _ecore_x_selection_data_text_free(void *data); static void *_ecore_x_selection_parser_targets(const char *target, - void *data, - int size, - int format); -static int _ecore_x_selection_data_targets_free(void *data); + void *data, + int size, + int format); +static int _ecore_x_selection_data_targets_free(void *data); #define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) @@ -45,32 +45,32 @@ void _ecore_x_selection_data_init(void) { /* Initialize global data */ - memset(selections, 0, sizeof(selections)); + memset(selections, 0, sizeof(selections)); - /* Initialize converters */ - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, - _ecore_x_selection_converter_text); + /* Initialize converters */ + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, + _ecore_x_selection_converter_text); #ifdef X_HAVE_UTF8_STRING - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, - _ecore_x_selection_converter_text); + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, + _ecore_x_selection_converter_text); #endif /* ifdef X_HAVE_UTF8_STRING */ - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, - _ecore_x_selection_converter_text); - ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, - _ecore_x_selection_converter_text); - - /* Initialize parsers */ - ecore_x_selection_parser_add("text/plain", - _ecore_x_selection_parser_text); - ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, - _ecore_x_selection_parser_text); - ecore_x_selection_parser_add("text/uri-list", - _ecore_x_selection_parser_files); - ecore_x_selection_parser_add("_NETSCAPE_URL", - _ecore_x_selection_parser_files); - ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, - _ecore_x_selection_parser_targets); -} /* _ecore_x_selection_data_init */ + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, + _ecore_x_selection_converter_text); + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, + _ecore_x_selection_converter_text); + + /* Initialize parsers */ + ecore_x_selection_parser_add("text/plain", + _ecore_x_selection_parser_text); + ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, + _ecore_x_selection_parser_text); + ecore_x_selection_parser_add("text/uri-list", + _ecore_x_selection_parser_files); + ecore_x_selection_parser_add("_NETSCAPE_URL", + _ecore_x_selection_parser_files); + ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, + _ecore_x_selection_parser_targets); +} void _ecore_x_selection_shutdown(void) @@ -102,7 +102,7 @@ _ecore_x_selection_shutdown(void) free(tmp); } parsers = NULL; -} /* _ecore_x_selection_shutdown */ +} Ecore_X_Selection_Intern * _ecore_x_selection_get(Ecore_X_Atom selection) @@ -117,12 +117,12 @@ _ecore_x_selection_get(Ecore_X_Atom selection) return &selections[3]; else return NULL; -} /* _ecore_x_selection_get */ +} Eina_Bool -_ecore_x_selection_set(Window w, - const void *data, - int size, +_ecore_x_selection_set(Window w, + const void *data, + int size, Ecore_X_Atom selection) { int in; @@ -162,7 +162,7 @@ _ecore_x_selection_set(Window w, } return EINA_TRUE; -} /* _ecore_x_selection_set */ +} /** * Claim ownership of the PRIMARY selection and set its data. @@ -174,12 +174,12 @@ _ecore_x_selection_set(Window w, */ EAPI Eina_Bool ecore_x_selection_primary_set(Ecore_X_Window w, - const void *data, - int size) + const void *data, + int size) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY); -} /* ecore_x_selection_primary_set */ +} /** * Release ownership of the primary selection @@ -192,7 +192,7 @@ ecore_x_selection_primary_clear(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY); -} /* ecore_x_selection_primary_clear */ +} /** * Claim ownership of the SECONDARY selection and set its data. @@ -204,15 +204,15 @@ ecore_x_selection_primary_clear(void) */ EAPI Eina_Bool ecore_x_selection_secondary_set(Ecore_X_Window w, - const void *data, - int size) + const void *data, + int size) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_SECONDARY); -} /* ecore_x_selection_secondary_set */ +} /** * Release ownership of the secondary selection @@ -228,7 +228,7 @@ ecore_x_selection_secondary_clear(void) NULL, 0, ECORE_X_ATOM_SELECTION_SECONDARY); -} /* ecore_x_selection_secondary_clear */ +} /** * Claim ownership of the XDND selection and set its data. @@ -240,12 +240,12 @@ ecore_x_selection_secondary_clear(void) */ EAPI Eina_Bool ecore_x_selection_xdnd_set(Ecore_X_Window w, - const void *data, - int size) + const void *data, + int size) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND); -} /* ecore_x_selection_xdnd_set */ +} /** * Release ownership of the XDND selection @@ -258,7 +258,7 @@ ecore_x_selection_xdnd_clear(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND); -} /* ecore_x_selection_xdnd_clear */ +} /** * Claim ownership of the CLIPBOARD selection and set its data. @@ -273,15 +273,15 @@ ecore_x_selection_xdnd_clear(void) */ EAPI Eina_Bool ecore_x_selection_clipboard_set(Ecore_X_Window w, - const void *data, - int size) + const void *data, + int size) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_CLIPBOARD); -} /* ecore_x_selection_clipboard_set */ +} /** * Release ownership of the clipboard selection @@ -297,7 +297,7 @@ ecore_x_selection_clipboard_clear(void) NULL, 0, ECORE_X_ATOM_SELECTION_CLIPBOARD); -} /* ecore_x_selection_clipboard_clear */ +} Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target) @@ -318,29 +318,29 @@ _ecore_x_selection_target_atom_get(const char *target) x_target = ecore_x_atom_get(target); return x_target; -} /* _ecore_x_selection_target_atom_get */ +} char * _ecore_x_selection_target_get(Ecore_X_Atom target) { /* FIXME: Should not return mem allocated with strdup or X mixed, * one should use free to free, the other XFree */ - if (target == ECORE_X_ATOM_FILE_NAME) - return strdup(ECORE_X_SELECTION_TARGET_FILENAME); - else if (target == ECORE_X_ATOM_STRING) - return strdup(ECORE_X_SELECTION_TARGET_STRING); - else if (target == ECORE_X_ATOM_UTF8_STRING) - return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); - else if (target == ECORE_X_ATOM_TEXT) - return strdup(ECORE_X_SELECTION_TARGET_TEXT); - else - return XGetAtomName(_ecore_x_disp, target); -} /* _ecore_x_selection_target_get */ + if (target == ECORE_X_ATOM_FILE_NAME) + return strdup(ECORE_X_SELECTION_TARGET_FILENAME); + else if (target == ECORE_X_ATOM_STRING) + return strdup(ECORE_X_SELECTION_TARGET_STRING); + else if (target == ECORE_X_ATOM_UTF8_STRING) + return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); + else if (target == ECORE_X_ATOM_TEXT) + return strdup(ECORE_X_SELECTION_TARGET_TEXT); + else + return XGetAtomName(_ecore_x_disp, target); +} static void _ecore_x_selection_request(Ecore_X_Window w, - Ecore_X_Atom selection, - const char *target_str) + Ecore_X_Atom selection, + const char *target_str) { Ecore_X_Atom target, prop; @@ -357,27 +357,27 @@ _ecore_x_selection_request(Ecore_X_Window w, XConvertSelection(_ecore_x_disp, selection, target, prop, w, CurrentTime); -} /* _ecore_x_selection_request */ +} EAPI void ecore_x_selection_primary_request(Ecore_X_Window w, - const char *target) + const char *target) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target); -} /* ecore_x_selection_primary_request */ +} EAPI void ecore_x_selection_secondary_request(Ecore_X_Window w, - const char *target) + const char *target) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target); -} /* ecore_x_selection_secondary_request */ +} EAPI void ecore_x_selection_xdnd_request(Ecore_X_Window w, - const char *target) + const char *target) { Ecore_X_Atom atom; Ecore_X_DND_Target *_target; @@ -388,25 +388,25 @@ ecore_x_selection_xdnd_request(Ecore_X_Window w, XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom, ECORE_X_ATOM_SELECTION_PROP_XDND, w, _target->time); -} /* ecore_x_selection_xdnd_request */ +} EAPI void ecore_x_selection_clipboard_request(Ecore_X_Window w, - const char *target) + const char *target) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); -} /* ecore_x_selection_clipboard_request */ +} EAPI void -ecore_x_selection_converter_atom_add(Ecore_X_Atom target, - Eina_Bool (*func)(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *ttype, - int *tsize)) +ecore_x_selection_converter_atom_add(Ecore_X_Atom target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *ttype, + int *tsize)) { Ecore_X_Selection_Converter *cnv; @@ -441,17 +441,17 @@ ecore_x_selection_converter_atom_add(Ecore_X_Atom cnv->target = target; cnv->convert = func; -} /* ecore_x_selection_converter_atom_add */ +} EAPI void -ecore_x_selection_converter_add(char *target, - Eina_Bool (*func)(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, - Ecore_X_Atom *, - int *)) +ecore_x_selection_converter_add(char *target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *, + int *)) { Ecore_X_Atom x_target; @@ -462,7 +462,7 @@ ecore_x_selection_converter_add(char *target, x_target = _ecore_x_selection_target_atom_get(target); ecore_x_selection_converter_atom_add(x_target, func); -} /* ecore_x_selection_converter_add */ +} EAPI void ecore_x_selection_converter_atom_del(Ecore_X_Atom target) @@ -492,7 +492,7 @@ ecore_x_selection_converter_atom_del(Ecore_X_Atom target) prev_cnv = cnv; cnv = cnv->next; } -} /* ecore_x_selection_converter_atom_del */ +} EAPI void ecore_x_selection_converter_del(char *target) @@ -505,14 +505,14 @@ ecore_x_selection_converter_del(char *target) LOGFN(__FILE__, __LINE__, __FUNCTION__); x_target = _ecore_x_selection_target_atom_get(target); ecore_x_selection_converter_atom_del(x_target); -} /* ecore_x_selection_converter_del */ +} EAPI Eina_Bool ecore_x_selection_notify_send(Ecore_X_Window requestor, - Ecore_X_Atom selection, - Ecore_X_Atom target, - Ecore_X_Atom property, - Ecore_X_Time tim) + Ecore_X_Atom selection, + Ecore_X_Atom target, + Ecore_X_Atom property, + Ecore_X_Time tim) { XEvent xev; XSelectionEvent xnotify; @@ -530,16 +530,16 @@ ecore_x_selection_notify_send(Ecore_X_Window requestor, xev.xselection = xnotify; return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE; -} /* ecore_x_selection_notify_send */ +} /* Locate and run conversion callback for specified selection target */ EAPI Eina_Bool -ecore_x_selection_convert(Ecore_X_Atom selection, - Ecore_X_Atom target, - void **data_ret, - int *size, +ecore_x_selection_convert(Ecore_X_Atom selection, + Ecore_X_Atom target, + void **data_ret, + int *size, Ecore_X_Atom *targtype, - int *typesize) + int *typesize) { Ecore_X_Selection_Intern *sel; Ecore_X_Selection_Converter *cnv; @@ -572,24 +572,24 @@ ecore_x_selection_convert(Ecore_X_Atom selection, return EINA_FALSE; /* Default, just return the data - *data_ret = malloc(sel->length); + * data_ret = malloc(sel->length); memcpy(*data_ret, sel->data, sel->length); free(tgt_str); return 1; */ -} /* ecore_x_selection_convert */ +} /* TODO: We need to work out a mechanism for automatic conversion to any requested * locale using Ecore_Txt functions */ /* Converter for standard non-utf8 text targets */ static Eina_Bool -_ecore_x_selection_converter_text(char *target, - void *data, - int size, - void **data_ret, - int *size_ret, +_ecore_x_selection_converter_text(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, Ecore_X_Atom *targprop __UNUSED__, - int *s __UNUSED__) + int *s __UNUSED__) { XTextProperty text_prop; char *mystr; @@ -651,7 +651,7 @@ _ecore_x_selection_converter_text(char *target, { return EINA_TRUE; } -} /* _ecore_x_selection_converter_text */ +} EAPI void ecore_x_selection_parser_add(const char *target, @@ -692,7 +692,7 @@ ecore_x_selection_parser_add(const char *target, prs->target = strdup(target); prs->parse = func; -} /* ecore_x_selection_parser_add */ +} EAPI void ecore_x_selection_parser_del(const char *target) @@ -726,19 +726,19 @@ ecore_x_selection_parser_del(const char *target) prev_prs = prs; prs = prs->next; } -} /* ecore_x_selection_parser_del */ +} /** * Change the owner and last-change time for the specified selection. * @param win The owner of the specified atom. * @param atom The selection atom - * @param time Specifies the time + * @param tim Specifies the time * @since 1.1.0 */ EAPI void ecore_x_selection_owner_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Time tim) + Ecore_X_Atom atom, + Ecore_X_Time tim) { XSetSelectionOwner(_ecore_x_disp, atom, win, tim); } @@ -760,9 +760,9 @@ ecore_x_selection_owner_get(Ecore_X_Atom atom) /* Locate and run conversion callback for specified selection target */ void * _ecore_x_selection_parse(const char *target, - void *data, - int size, - int format) + void *data, + int size, + int format) { Ecore_X_Selection_Parser *prs; Ecore_X_Selection_Data *sel; @@ -784,7 +784,7 @@ _ecore_x_selection_parse(const char *target, sel->format = format; sel->data = data; return sel; -} /* _ecore_x_selection_parse */ +} static int _ecore_x_selection_data_default_free(void *data) @@ -795,13 +795,13 @@ _ecore_x_selection_data_default_free(void *data) free(sel->data); free(sel); return 1; -} /* _ecore_x_selection_data_default_free */ +} static void * _ecore_x_selection_parser_files(const char *target, - void *_data, - int size, - int format __UNUSED__) + void *_data, + int size, + int format __UNUSED__) { Ecore_X_Selection_Data_Files *sel; char *t, *data = _data; @@ -820,15 +820,15 @@ _ecore_x_selection_parser_files(const char *target, if (data[size - 1]) { /* Isn't nul terminated */ - size++; - t = realloc(data, size); - if (!t) - { - free(sel); - return NULL; - } - data = t; - data[size - 1] = 0; + size++; + t = realloc(data, size); + if (!t) + { + free(sel); + return NULL; + } + data = t; + data[size - 1] = 0; } tmp = malloc(size); @@ -850,7 +850,8 @@ _ecore_x_selection_parser_files(const char *target, tmp[i++] = data[is++]; else { - while ((data[is] == '\r') || (data[is] == '\n')) is++; + while ((data[is] == '\r') || (data[is] == '\n')) + is++; tmp[i] = 0; sel->num_files++; t2 = realloc(sel->files, sel->num_files * sizeof(char *)); @@ -883,7 +884,7 @@ _ecore_x_selection_parser_files(const char *target, ECORE_X_SELECTION_DATA(sel)->length = sel->num_files; return ECORE_X_SELECTION_DATA(sel); -} /* _ecore_x_selection_parser_files */ +} static int _ecore_x_selection_data_files_free(void *data) @@ -901,13 +902,13 @@ _ecore_x_selection_data_files_free(void *data) free(sel); return 0; -} /* _ecore_x_selection_data_files_free */ +} static void * _ecore_x_selection_parser_text(const char *target __UNUSED__, - void *_data, - int size, - int format __UNUSED__) + void *_data, + int size, + int format __UNUSED__) { Ecore_X_Selection_Data_Text *sel; unsigned char *data = _data; @@ -918,15 +919,15 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__, if (data[size - 1]) { /* Isn't nul terminated */ - size++; - t = realloc(data, size); - if (!t) - { - free(sel); - return NULL; - } - data = t; - data[size - 1] = 0; + size++; + t = realloc(data, size); + if (!t) + { + free(sel); + return NULL; + } + data = t; + data[size - 1] = 0; } sel->text = (char *)data; @@ -935,7 +936,7 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__, ECORE_X_SELECTION_DATA(sel)->data = data; ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free; return sel; -} /* _ecore_x_selection_parser_text */ +} static int _ecore_x_selection_data_text_free(void *data) @@ -946,13 +947,13 @@ _ecore_x_selection_data_text_free(void *data) free(sel->text); free(sel); return 1; -} /* _ecore_x_selection_data_text_free */ +} static void * _ecore_x_selection_parser_targets(const char *target __UNUSED__, - void *data, - int size, - int format __UNUSED__) + void *data, + int size, + int format __UNUSED__) { Ecore_X_Selection_Data_Targets *sel; unsigned long *targets; @@ -977,7 +978,7 @@ _ecore_x_selection_parser_targets(const char *target __UNUSED__, ECORE_X_SELECTION_DATA(sel)->length = size; ECORE_X_SELECTION_DATA(sel)->data = data; return sel; -} /* _ecore_x_selection_parser_targets */ +} static int _ecore_x_selection_data_targets_free(void *data) @@ -997,5 +998,5 @@ _ecore_x_selection_data_targets_free(void *data) free(ECORE_X_SELECTION_DATA(sel)->data); free(sel); return 1; -} /* _ecore_x_selection_data_targets_free */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c index e49fede..0c7f546 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c @@ -42,18 +42,18 @@ ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter) ecore_x_sync(); return alarm; -} /* ecore_x_sync_alarm_new */ +} EAPI Eina_Bool ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XSyncDestroyAlarm(_ecore_x_disp, alarm); -} /* ecore_x_sync_alarm_free */ +} EAPI Eina_Bool ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, - unsigned int *val) + unsigned int *val) { XSyncValue value; @@ -65,7 +65,7 @@ ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, } return EINA_FALSE; -} /* ecore_x_sync_counter_query */ +} EAPI Ecore_X_Sync_Counter ecore_x_sync_counter_new(int val) @@ -77,29 +77,29 @@ ecore_x_sync_counter_new(int val) XSyncIntToValue(&v, val); counter = XSyncCreateCounter(_ecore_x_disp, v); return counter; -} /* ecore_x_sync_counter_new */ +} EAPI void ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSyncDestroyCounter(_ecore_x_disp, counter); -} /* ecore_x_sync_counter_free */ +} EAPI void ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, - int by) + int by) { XSyncValue v; LOGFN(__FILE__, __LINE__, __FUNCTION__); XSyncIntToValue(&v, by); XSyncChangeCounter(_ecore_x_disp, counter, v); -} /* ecore_x_sync_counter_inc */ +} EAPI void ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, - int val) + int val) { XSyncWaitCondition cond; XSyncValue v, v2; @@ -115,11 +115,11 @@ ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, cond.event_threshold = v2; XSyncAwait(_ecore_x_disp, &cond, 1); // XSync(_ecore_x_disp, False); // dont need this -} /* ecore_x_sync_counter_val_wait */ +} EAPI void ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, - int val) + int val) { XSyncValue v; @@ -130,8 +130,8 @@ ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, EAPI void ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, - int val_hi, - unsigned int val_lo) + int val_hi, + unsigned int val_lo) { XSyncValue v; @@ -142,8 +142,8 @@ ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, EAPI Eina_Bool ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, - int *val_hi, - unsigned int *val_lo) + int *val_hi, + unsigned int *val_lo) { XSyncValue value; 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 c4576f9..c8c04e4 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 @@ -42,7 +42,7 @@ ecore_x_test_fake_key_down(const char *key __UNUSED__) #else /* ifdef ECORE_XTEST */ return EINA_FALSE; #endif /* ifdef ECORE_XTEST */ -} /* ecore_x_test_fake_key_down */ +} EAPI Eina_Bool #ifdef ECORE_XTEST @@ -74,7 +74,7 @@ ecore_x_test_fake_key_up(const char *key __UNUSED__) #else /* ifdef ECORE_XTEST */ return EINA_FALSE; #endif /* ifdef ECORE_XTEST */ -} /* ecore_x_test_fake_key_up */ +} EAPI Eina_Bool #ifdef ECORE_XTEST @@ -145,11 +145,11 @@ ecore_x_test_fake_key_press(const char *key __UNUSED__) #else /* ifdef ECORE_XTEST */ return EINA_FALSE; #endif /* ifdef ECORE_XTEST */ -} /* ecore_x_test_fake_key_press */ +} EAPI const char * ecore_x_keysym_string_get(int keysym) { return XKeysymToString(keysym); -} /* ecore_x_keysym_string_get */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c index f054298..4296bb2 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c @@ -61,40 +61,40 @@ typedef union _drmVBlank typedef struct _drmEventContext { int version; - void (*vblank_handler)(int fd, + void (*vblank_handler)(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, - void *user_data); - void (*page_flip_handler)(int fd, + void *user_data); + void (*page_flip_handler)(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, - void *user_data); + void *user_data); } drmEventContext; static int (*sym_drmClose)(int fd) = NULL; -static int (*sym_drmGetMagic)(int fd, +static int (*sym_drmGetMagic)(int fd, drm_magic_t *magic) = NULL; -static int (*sym_drmWaitVBlank)(int fd, +static int (*sym_drmWaitVBlank)(int fd, drmVBlank *vbl) = NULL; -static int (*sym_drmHandleEvent)(int fd, +static int (*sym_drmHandleEvent)(int fd, drmEventContext *evctx) = NULL; //// dri static Bool (*sym_DRI2QueryExtension)(Display *display, - int *eventBase, - int *errorBase) = NULL; + int *eventBase, + int *errorBase) = NULL; static Bool (*sym_DRI2QueryVersion)(Display *display, - int *major, - int *minor) = NULL; + int *major, + int *minor) = NULL; static Bool (*sym_DRI2Connect)(Display *display, - XID window, - char **driverName, - char **deviceName) = NULL; -static Bool (*sym_DRI2Authenticate)(Display *display, - XID window, + XID window, + char **driverName, + char **deviceName) = NULL; +static Bool (*sym_DRI2Authenticate)(Display *display, + XID window, drm_magic_t magic) = NULL; //// dri/drm data needed @@ -142,18 +142,18 @@ _dri_drm_tick_end(void *data __UNUSED__) } static void -_dri_drm_vblank_handler(int fd __UNUSED__, +_dri_drm_vblank_handler(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec __UNUSED__, unsigned int usec __UNUSED__, - void *data __UNUSED__) + void *data __UNUSED__) { ecore_animator_custom_tick(); if (drm_event_is_busy) _dri_drm_tick_schedule(); } static Eina_Bool -_dri_drm_cb(void *data __UNUSED__, +_dri_drm_cb(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) { sym_drmHandleEvent(drm_fd, &drm_evctx); 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 76670d3..1adb36b 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 @@ -33,10 +33,10 @@ static Ecore_X_Window *ignore_list = NULL; */ EAPI Ecore_X_Window ecore_x_window_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { Window win; XSetWindowAttributes attr; @@ -87,7 +87,7 @@ ecore_x_window_new(Ecore_X_Window parent, ecore_x_window_defaults_set(win); return win; -} /* ecore_x_window_new */ +} /** * Creates a window with the override redirect attribute set to @c True. @@ -102,10 +102,10 @@ ecore_x_window_new(Ecore_X_Window parent, */ EAPI Ecore_X_Window ecore_x_window_override_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { Window win; XSetWindowAttributes attr; @@ -152,7 +152,7 @@ ecore_x_window_override_new(Ecore_X_Window parent, CWWinGravity, &attr); return win; -} /* ecore_x_window_override_new */ +} /** * Creates a new input window. @@ -167,10 +167,10 @@ ecore_x_window_override_new(Ecore_X_Window parent, */ EAPI Ecore_X_Window ecore_x_window_input_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { Window win; XSetWindowAttributes attr; @@ -209,7 +209,7 @@ ecore_x_window_input_new(Ecore_X_Window parent, } return win; -} /* ecore_x_window_input_new */ +} /** * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions @@ -263,18 +263,18 @@ ecore_x_window_defaults_set(Ecore_X_Window win) ecore_app_args_get(&argc, &argv); ecore_x_icccm_command_set(win, argc, argv); -} /* ecore_x_window_defaults_set */ +} EAPI void -ecore_x_window_configure(Ecore_X_Window win, +ecore_x_window_configure(Ecore_X_Window win, Ecore_X_Window_Configure_Mask mask, - int x, - int y, - int w, - int h, - int border_width, - Ecore_X_Window sibling, - int stack_mode) + int x, + int y, + int w, + int h, + int border_width, + Ecore_X_Window sibling, + int stack_mode) { XWindowChanges xwc; @@ -292,7 +292,7 @@ ecore_x_window_configure(Ecore_X_Window win, xwc.stack_mode = stack_mode; XConfigureWindow(_ecore_x_disp, win, mask, &xwc); -} /* ecore_x_window_configure */ +} /** * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions @@ -311,10 +311,10 @@ ecore_x_window_free(Ecore_X_Window win) /* sorry sir, deleting the root window doesn't sound like * a smart idea. */ - LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (win) - XDestroyWindow(_ecore_x_disp, win); -} /* ecore_x_window_free */ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win) + XDestroyWindow(_ecore_x_disp, win); +} /** * Set if a window should be ignored. @@ -323,7 +323,7 @@ ecore_x_window_free(Ecore_X_Window win) */ EAPI void ecore_x_window_ignore_set(Ecore_X_Window win, - int ignore) + int ignore) { int i, j, cnt; Ecore_X_Window *t; @@ -373,7 +373,7 @@ ecore_x_window_ignore_set(Ecore_X_Window win, t = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window)); if (t) ignore_list = t; } -} /* ecore_x_window_ignore_set */ +} /** * Get the ignore list @@ -387,7 +387,7 @@ ecore_x_window_ignore_list(int *num) *num = ignore_num; return ignore_list; -} /* ecore_x_window_ignore_list */ +} /** * Sends a delete request to the given window. @@ -415,7 +415,7 @@ ecore_x_window_delete_request_send(Ecore_X_Window win) xev.xclient.data.l[1] = CurrentTime; XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); -} /* ecore_x_window_delete_request_send */ +} /** * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions @@ -436,7 +436,7 @@ ecore_x_window_show(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XMapWindow(_ecore_x_disp, win); -} /* ecore_x_window_show */ +} /** * Hides a window. @@ -480,7 +480,7 @@ ecore_x_window_hide(Ecore_X_Window win) XSendEvent(_ecore_x_disp, xev.xunmap.event, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); XUnmapWindow(_ecore_x_disp, win); -} /* ecore_x_window_hide */ +} /** * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions @@ -501,12 +501,12 @@ ecore_x_window_hide(Ecore_X_Window win) */ EAPI void ecore_x_window_move(Ecore_X_Window win, - int x, - int y) + int x, + int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XMoveWindow(_ecore_x_disp, win, x, y); -} /* ecore_x_window_move */ +} /** * Resizes a window. @@ -517,8 +517,8 @@ ecore_x_window_move(Ecore_X_Window win, */ EAPI void ecore_x_window_resize(Ecore_X_Window win, - int w, - int h) + int w, + int h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (w < 1) @@ -528,7 +528,7 @@ ecore_x_window_resize(Ecore_X_Window win, h = 1; XResizeWindow(_ecore_x_disp, win, w, h); -} /* ecore_x_window_resize */ +} /** * Moves and resizes a window. @@ -541,10 +541,10 @@ ecore_x_window_resize(Ecore_X_Window win, */ EAPI void ecore_x_window_move_resize(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (w < 1) @@ -554,7 +554,7 @@ ecore_x_window_move_resize(Ecore_X_Window win, h = 1; XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h); -} /* ecore_x_window_move_resize */ +} /** * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions @@ -576,7 +576,7 @@ ecore_x_window_focus(Ecore_X_Window win) // XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime); XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime); -} /* ecore_x_window_focus */ +} /** * Sets the focus to the given window at a specific time. @@ -586,7 +586,7 @@ ecore_x_window_focus(Ecore_X_Window win) */ EAPI void ecore_x_window_focus_at_time(Ecore_X_Window win, - Ecore_X_Time t) + Ecore_X_Time t) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (win == 0) @@ -594,7 +594,7 @@ ecore_x_window_focus_at_time(Ecore_X_Window win, // XSetInputFocus(_ecore_x_disp, win, PointerRoot, t); XSetInputFocus(_ecore_x_disp, win, RevertToParent, t); -} /* ecore_x_window_focus_at_time */ +} /** * gets the focus to the window @p win. @@ -611,7 +611,7 @@ ecore_x_window_focus_get(void) win = 0; XGetInputFocus(_ecore_x_disp, &win, &revert_mode); return win; -} /* ecore_x_window_focus_get */ +} /** * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions @@ -629,7 +629,7 @@ ecore_x_window_raise(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XRaiseWindow(_ecore_x_disp, win); -} /* ecore_x_window_raise */ +} /** * Lowers the given window. @@ -641,7 +641,7 @@ ecore_x_window_lower(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XLowerWindow(_ecore_x_disp, win); -} /* ecore_x_window_lower */ +} /** * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions @@ -660,15 +660,15 @@ ecore_x_window_lower(Ecore_X_Window win) EAPI void ecore_x_window_reparent(Ecore_X_Window win, Ecore_X_Window new_parent, - int x, - int y) + int x, + int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (new_parent == 0) new_parent = DefaultRootWindow(_ecore_x_disp); XReparentWindow(_ecore_x_disp, win, new_parent, x, y); -} /* ecore_x_window_reparent */ +} /** * Retrieves the size of the given window. @@ -679,8 +679,8 @@ ecore_x_window_reparent(Ecore_X_Window win, */ EAPI void ecore_x_window_size_get(Ecore_X_Window win, - int *w, - int *h) + int *w, + int *h) { int dummy_x, dummy_y; @@ -689,7 +689,7 @@ ecore_x_window_size_get(Ecore_X_Window win, win = DefaultRootWindow(_ecore_x_disp); ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h); -} /* ecore_x_window_size_get */ +} /** * Retrieves the geometry of the given window. @@ -709,17 +709,17 @@ ecore_x_window_size_get(Ecore_X_Window win, */ EAPI void ecore_x_window_geometry_get(Ecore_X_Window win, - int *x, - int *y, - int *w, - int *h) + int *x, + int *y, + int *w, + int *h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!win) win = DefaultRootWindow(_ecore_x_disp); ecore_x_drawable_geometry_get(win, x, y, w, h); -} /* ecore_x_window_geometry_get */ +} /** * Retrieves the width of the border of the given window. @@ -736,7 +736,7 @@ ecore_x_window_border_width_get(Ecore_X_Window win) return 0; return ecore_x_drawable_border_width_get(win); -} /* ecore_x_window_border_width_get */ +} /** * Sets the width of the border of the given window. @@ -746,7 +746,7 @@ ecore_x_window_border_width_get(Ecore_X_Window win) */ EAPI void ecore_x_window_border_width_set(Ecore_X_Window win, - int width) + int width) { LOGFN(__FILE__, __LINE__, __FUNCTION__); /* doesn't make sense to call this on a root window */ @@ -754,7 +754,7 @@ ecore_x_window_border_width_set(Ecore_X_Window win, return; XSetWindowBorderWidth (_ecore_x_disp, win, width); -} /* ecore_x_window_border_width_set */ +} /** * Retrieves the depth of the given window. @@ -766,7 +766,7 @@ ecore_x_window_depth_get(Ecore_X_Window win) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_drawable_depth_get(win); -} /* ecore_x_window_depth_get */ +} /** * To be documented. @@ -775,7 +775,7 @@ ecore_x_window_depth_get(Ecore_X_Window win) */ EAPI void ecore_x_window_cursor_show(Ecore_X_Window win, - Eina_Bool show) + Eina_Bool show) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (win == 0) @@ -803,7 +803,7 @@ ecore_x_window_cursor_show(Ecore_X_Window win, } else XDefineCursor(_ecore_x_disp, win, 0); -} /* ecore_x_window_cursor_show */ +} EAPI void ecore_x_window_cursor_set(Ecore_X_Window win, @@ -814,7 +814,7 @@ ecore_x_window_cursor_set(Ecore_X_Window win, XUndefineCursor(_ecore_x_disp, win); else XDefineCursor(_ecore_x_disp, win, c); -} /* ecore_x_window_cursor_set */ +} /** * Finds out whether the given window is currently visible. @@ -830,7 +830,7 @@ ecore_x_window_visible_get(Ecore_X_Window win) LOGFN(__FILE__, __LINE__, __FUNCTION__); return XGetWindowAttributes(_ecore_x_disp, win, &attr) && (attr.map_state == IsViewable); -} /* ecore_x_window_visible_get */ +} typedef struct _Shadow Shadow; struct _Shadow @@ -914,7 +914,7 @@ _ecore_x_window_tree_walk(Window win) XFree(list); return s; -} /* _ecore_x_window_tree_walk */ +} static void _ecore_x_window_tree_shadow_free1(Shadow *s) @@ -935,7 +935,7 @@ _ecore_x_window_tree_shadow_free1(Shadow *s) } free(s); -} /* _ecore_x_window_tree_shadow_free1 */ +} static void _ecore_x_window_tree_shadow_free(void) @@ -955,7 +955,7 @@ _ecore_x_window_tree_shadow_free(void) free(shadow_base); shadow_base = NULL; shadow_num = 0; -} /* _ecore_x_window_tree_shadow_free */ +} static void _ecore_x_window_tree_shadow_populate(void) @@ -976,7 +976,7 @@ _ecore_x_window_tree_shadow_populate(void) free(roots); } -} /* _ecore_x_window_tree_shadow_populate */ +} /* static int shadow_count = 0; @@ -1000,7 +1000,7 @@ _ecore_x_window_tree_shadow_populate(void) static Shadow * _ecore_x_window_shadow_tree_find_shadow(Shadow *s, - Window win) + Window win) { Shadow *ss; int i; @@ -1020,7 +1020,7 @@ _ecore_x_window_shadow_tree_find_shadow(Shadow *s, } return NULL; -} /* _ecore_x_window_shadow_tree_find_shadow */ +} static Shadow * _ecore_x_window_shadow_tree_find(Window base) @@ -1037,16 +1037,16 @@ _ecore_x_window_shadow_tree_find(Window base) return s; } return NULL; -} /* _ecore_x_window_shadow_tree_find */ +} static int -_inside_rects(Shadow *s, - int x, - int y, - int bx, - int by, +_inside_rects(Shadow *s, + int x, + int y, + int bx, + int by, Ecore_X_Rectangle *rects, - int num) + int num) { int i, inside; @@ -1068,13 +1068,13 @@ _inside_rects(Shadow *s, } static Window -_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, - int bx, - int by, - int x, - int y, +_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, + int bx, + int by, + int x, + int y, Ecore_X_Window *skip, - int skip_num) + int skip_num) { Window child; int i, j; @@ -1131,16 +1131,16 @@ onward: } return s->win; -} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */ +} static Window -_ecore_x_window_shadow_tree_at_xy_get(Window base, - int bx, - int by, - int x, - int y, +_ecore_x_window_shadow_tree_at_xy_get(Window base, + int bx, + int by, + int x, + int y, Ecore_X_Window *skip, - int skip_num) + int skip_num) { Shadow *s; @@ -1162,7 +1162,7 @@ _ecore_x_window_shadow_tree_at_xy_get(Window base, y, skip, skip_num); -} /* _ecore_x_window_shadow_tree_at_xy_get */ +} /** * Retrieves the top, visible window at the given location, @@ -1177,11 +1177,11 @@ _ecore_x_window_shadow_tree_at_xy_get(Window base, * @ingroup Ecore_X_Window_Geometry_Group */ EAPI Ecore_X_Window -ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, - int x, - int y, +ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, + int x, + int y, Ecore_X_Window *skip, - int skip_num) + int skip_num) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return _ecore_x_window_shadow_tree_at_xy_get(base, @@ -1191,7 +1191,7 @@ ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, y, skip, skip_num); -} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */ +} /** * Retrieves the parent window a given window has. This uses the shadow window @@ -1231,7 +1231,7 @@ ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, } } return 0; -} /* ecore_x_window_shadow_parent_get */ +} /** * Flushes the window shadow tree so nothing is stored. @@ -1242,7 +1242,7 @@ ecore_x_window_shadow_tree_flush(void) { LOGFN(__FILE__, __LINE__, __FUNCTION__); _ecore_x_window_tree_shadow_free(); -} /* ecore_x_window_shadow_tree_flush */ +} /** * Retrieves the root window a given window is on. @@ -1260,16 +1260,16 @@ ecore_x_window_root_get(Ecore_X_Window win) return 0; return att.root; -} /* ecore_x_window_root_get */ +} static Window -_ecore_x_window_at_xy_get(Window base, - int bx, - int by, - int x, - int y, +_ecore_x_window_at_xy_get(Window base, + int bx, + int by, + int x, + int y, Ecore_X_Window *skip, - int skip_num) + int skip_num) { Window *list = NULL; Window parent_win = 0, child = 0, root_win = 0; @@ -1324,7 +1324,7 @@ onward: } return base; -} /* _ecore_x_window_at_xy_get */ +} /** * Retrieves the top, visible window at the given location. @@ -1349,7 +1349,7 @@ ecore_x_window_at_xy_get(int x, ecore_x_ungrab(); return win ? win : root; -} /* ecore_x_window_at_xy_get */ +} /** * Retrieves the top, visible window at the given location, @@ -1360,10 +1360,10 @@ ecore_x_window_at_xy_get(int x, * @ingroup Ecore_X_Window_Geometry_Group */ EAPI Ecore_X_Window -ecore_x_window_at_xy_with_skip_get(int x, - int y, +ecore_x_window_at_xy_with_skip_get(int x, + int y, Ecore_X_Window *skip, - int skip_num) + int skip_num) { Ecore_X_Window win, root; @@ -1377,12 +1377,12 @@ ecore_x_window_at_xy_with_skip_get(int x, ecore_x_ungrab(); return win ? win : root; -} /* ecore_x_window_at_xy_with_skip_get */ +} EAPI Ecore_X_Window ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, - int x, - int y) + int x, + int y) { Ecore_X_Window win; @@ -1392,7 +1392,7 @@ ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, ecore_x_ungrab(); return win ? win : begin; -} /* ecore_x_window_at_xy_begin_get */ +} /** * Retrieves the parent window of the given window. @@ -1414,7 +1414,7 @@ ecore_x_window_parent_get(Ecore_X_Window win) XFree(children); return parent; -} /* ecore_x_window_parent_get */ +} /** * Sets the background color of the given window. @@ -1443,10 +1443,10 @@ ecore_x_window_background_color_set(Ecore_X_Window win, attr.background_pixel = col.pixel; XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr); -} /* ecore_x_window_background_color_set */ +} EAPI void -ecore_x_window_gravity_set(Ecore_X_Window win, +ecore_x_window_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav) { XSetWindowAttributes att; @@ -1454,10 +1454,10 @@ ecore_x_window_gravity_set(Ecore_X_Window win, LOGFN(__FILE__, __LINE__, __FUNCTION__); att.win_gravity = grav; XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att); -} /* ecore_x_window_gravity_set */ +} EAPI void -ecore_x_window_pixel_gravity_set(Ecore_X_Window win, +ecore_x_window_pixel_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav) { XSetWindowAttributes att; @@ -1465,7 +1465,7 @@ ecore_x_window_pixel_gravity_set(Ecore_X_Window win, LOGFN(__FILE__, __LINE__, __FUNCTION__); att.bit_gravity = grav; XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att); -} /* ecore_x_window_pixel_gravity_set */ +} EAPI void ecore_x_window_pixmap_set(Ecore_X_Window win, @@ -1473,50 +1473,50 @@ ecore_x_window_pixmap_set(Ecore_X_Window win, { LOGFN(__FILE__, __LINE__, __FUNCTION__); XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap); -} /* ecore_x_window_pixmap_set */ +} EAPI void ecore_x_window_area_clear(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XClearArea(_ecore_x_disp, win, x, y, w, h, False); -} /* ecore_x_window_area_clear */ +} EAPI void ecore_x_window_area_expose(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XClearArea(_ecore_x_disp, win, x, y, w, h, True); -} /* ecore_x_window_area_expose */ +} EAPI void ecore_x_window_override_set(Ecore_X_Window win, - Eina_Bool override) + Eina_Bool override) { XSetWindowAttributes att; LOGFN(__FILE__, __LINE__, __FUNCTION__); att.override_redirect = override; XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att); -} /* ecore_x_window_override_set */ +} #ifdef ECORE_XRENDER static Ecore_X_Window _ecore_x_window_argb_internal_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h, - Eina_Bool override, - Eina_Bool saveunder) + int x, + int y, + int w, + int h, + Eina_Bool override, + Eina_Bool saveunder) { Window win; XSetWindowAttributes attr; @@ -1535,15 +1535,15 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent, else { /* ewww - round trip */ - XGetWindowAttributes(_ecore_x_disp, parent, &att); - for (i = 0; i < ScreenCount(_ecore_x_disp); i++) - { - if (att.screen == ScreenOfDisplay(_ecore_x_disp, i)) - { - scr = i; - break; - } - } + XGetWindowAttributes(_ecore_x_disp, parent, &att); + for (i = 0; i < ScreenCount(_ecore_x_disp); i++) + { + if (att.screen == ScreenOfDisplay(_ecore_x_disp, i)) + { + scr = i; + break; + } + } } vi_in.screen = scr; @@ -1615,7 +1615,7 @@ _ecore_x_window_argb_internal_new(Ecore_X_Window parent, ecore_x_window_defaults_set(win); return win; -} /* _ecore_x_window_argb_internal_new */ +} #endif /* ifdef ECORE_XRENDER */ @@ -1641,7 +1641,7 @@ ecore_x_window_argb_get(Ecore_X_Window win) #else /* ifdef ECORE_XRENDER */ return 0; #endif /* ifdef ECORE_XRENDER */ -} /* ecore_x_window_argb_get */ +} /** * Creates a new window. @@ -1656,10 +1656,10 @@ ecore_x_window_argb_get(Ecore_X_Window win) */ EAPI Ecore_X_Window ecore_x_window_manager_argb_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ECORE_XRENDER LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -1667,7 +1667,7 @@ ecore_x_window_manager_argb_new(Ecore_X_Window parent, #else /* ifdef ECORE_XRENDER */ return 0; #endif /* ifdef ECORE_XRENDER */ -} /* ecore_x_window_manager_argb_new */ +} /** * Creates a new window. @@ -1682,10 +1682,10 @@ ecore_x_window_manager_argb_new(Ecore_X_Window parent, */ EAPI Ecore_X_Window ecore_x_window_argb_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ECORE_XRENDER LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -1693,7 +1693,7 @@ ecore_x_window_argb_new(Ecore_X_Window parent, #else /* ifdef ECORE_XRENDER */ return 0; #endif /* ifdef ECORE_XRENDER */ -} /* ecore_x_window_argb_new */ +} /** * Creates a window with the override redirect attribute set to @c True. @@ -1708,10 +1708,10 @@ ecore_x_window_argb_new(Ecore_X_Window parent, */ EAPI Ecore_X_Window ecore_x_window_override_argb_new(Ecore_X_Window parent, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ECORE_XRENDER LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -1719,5 +1719,5 @@ ecore_x_window_override_argb_new(Ecore_X_Window parent, #else /* ifdef ECORE_XRENDER */ return 0; #endif /* ifdef ECORE_XRENDER */ -} /* ecore_x_window_override_argb_new */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c index 8d5c757..b581a0e 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c @@ -21,9 +21,9 @@ */ EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int *val, - unsigned int num) + Ecore_X_Atom atom, + unsigned int *val, + unsigned int num) { #if SIZEOF_INT == SIZEOF_LONG _ATOM_SET_CARD32(win, atom, val, num); @@ -41,7 +41,7 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win, _ATOM_SET_CARD32(win, atom, v2, num); free(v2); #endif /* if SIZEOF_INT == SIZEOF_LONG */ -} /* ecore_x_window_prop_card32_set */ +} /* * Get CARD32 (array) property @@ -53,9 +53,9 @@ ecore_x_window_prop_card32_set(Ecore_X_Window win, */ EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win, - Ecore_X_Atom atom, - unsigned int *val, - unsigned int len) + Ecore_X_Atom atom, + unsigned int *val, + unsigned int len) { unsigned char *prop_ret; Atom type_ret; @@ -89,7 +89,7 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win, XFree(prop_ret); return num; -} /* ecore_x_window_prop_card32_get */ +} /* * Get CARD32 (array) property of any length @@ -100,7 +100,7 @@ ecore_x_window_prop_card32_get(Ecore_X_Window win, */ EAPI int ecore_x_window_prop_card32_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, + Ecore_X_Atom atom, unsigned int **plst) { unsigned char *prop_ret; @@ -125,7 +125,7 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, else { val = malloc(num_ret * sizeof(unsigned int)); - if (!val) + if (!val) { if (prop_ret) XFree(prop_ret); return -1; @@ -140,17 +140,17 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win, XFree(prop_ret); return num; -} /* ecore_x_window_prop_card32_list_get */ +} /* * Set X ID (array) property */ EAPI void ecore_x_window_prop_xid_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID *lst, - unsigned int num) + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *lst, + unsigned int num) { #if SIZEOF_INT == SIZEOF_LONG XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace, @@ -170,7 +170,7 @@ ecore_x_window_prop_xid_set(Ecore_X_Window win, (unsigned char *)pl, num); free(pl); #endif /* if SIZEOF_INT == SIZEOF_LONG */ -} /* ecore_x_window_prop_xid_set */ +} /* * Get X ID (array) property @@ -182,10 +182,10 @@ ecore_x_window_prop_xid_set(Ecore_X_Window win, */ EAPI int ecore_x_window_prop_xid_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID *lst, - unsigned int len) + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *lst, + unsigned int len) { unsigned char *prop_ret; Atom type_ret; @@ -219,7 +219,7 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win, XFree(prop_ret); return num; -} /* ecore_x_window_prop_xid_get */ +} /* * Get X ID (array) property @@ -231,9 +231,9 @@ ecore_x_window_prop_xid_get(Ecore_X_Window win, */ EAPI int ecore_x_window_prop_xid_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID **val) + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID **val) { unsigned char *prop_ret; Atom type_ret; @@ -268,17 +268,17 @@ ecore_x_window_prop_xid_list_get(Ecore_X_Window win, XFree(prop_ret); return num; -} /* ecore_x_window_prop_xid_list_get */ +} /* * Remove/add/toggle X ID list item. */ EAPI void ecore_x_window_prop_xid_list_change(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom type, - Ecore_X_ID item, - int op) + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID item, + int op) { Ecore_X_ID *lst; int i, num; @@ -300,22 +300,22 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, if (i < num) { /* Was in list */ - if (op == ECORE_X_PROP_LIST_ADD) - goto done; /* Remove it */ + if (op == ECORE_X_PROP_LIST_ADD) + goto done; /* Remove it */ - num--; - for (; i < num; i++) - lst[i] = lst[i + 1]; + num--; + for (; i < num; i++) + lst[i] = lst[i + 1]; } else { /* Was not in list */ - if (op == ECORE_X_PROP_LIST_REMOVE) - goto done; /* Add it */ + if (op == ECORE_X_PROP_LIST_REMOVE) + goto done; /* Add it */ - num++; - lst = realloc(lst, num * sizeof(Ecore_X_ID)); - lst[i] = item; + num++; + lst = realloc(lst, num * sizeof(Ecore_X_ID)); + lst[i] = item; } ecore_x_window_prop_xid_set(win, atom, type, lst, num); @@ -323,20 +323,20 @@ ecore_x_window_prop_xid_list_change(Ecore_X_Window win, done: if (lst) free(lst); -} /* ecore_x_window_prop_xid_list_change */ +} /* * Set Atom (array) property */ EAPI void ecore_x_window_prop_atom_set(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom *lst, - unsigned int num) + Ecore_X_Atom atom, + Ecore_X_Atom *lst, + unsigned int num) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num); -} /* ecore_x_window_prop_atom_set */ +} /* * Get Atom (array) property @@ -348,13 +348,13 @@ ecore_x_window_prop_atom_set(Ecore_X_Window win, */ EAPI int ecore_x_window_prop_atom_get(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom *lst, - unsigned int len) + Ecore_X_Atom atom, + Ecore_X_Atom *lst, + unsigned int len) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len); -} /* ecore_x_window_prop_atom_get */ +} /* * Get Atom (array) property @@ -366,38 +366,38 @@ ecore_x_window_prop_atom_get(Ecore_X_Window win, */ EAPI int ecore_x_window_prop_atom_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, + Ecore_X_Atom atom, Ecore_X_Atom **plst) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst); -} /* ecore_x_window_prop_atom_list_get */ +} /* * Remove/add/toggle atom list item. */ EAPI void ecore_x_window_prop_atom_list_change(Ecore_X_Window win, - Ecore_X_Atom atom, - Ecore_X_Atom item, - int op) + Ecore_X_Atom atom, + Ecore_X_Atom item, + int op) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op); -} /* ecore_x_window_prop_atom_list_change */ +} /* * Set Window (array) property */ EAPI void -ecore_x_window_prop_window_set(Ecore_X_Window win, - Ecore_X_Atom atom, +ecore_x_window_prop_window_set(Ecore_X_Window win, + Ecore_X_Atom atom, Ecore_X_Window *lst, - unsigned int num) + unsigned int num) { LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num); -} /* ecore_x_window_prop_window_set */ +} /* * Get Window (array) property @@ -408,14 +408,14 @@ ecore_x_window_prop_window_set(Ecore_X_Window win, * Note: Return value 0 means that the property exists but has no elements. */ EAPI int -ecore_x_window_prop_window_get(Ecore_X_Window win, - Ecore_X_Atom atom, +ecore_x_window_prop_window_get(Ecore_X_Window win, + Ecore_X_Atom atom, Ecore_X_Window *lst, - unsigned int len) + unsigned int len) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len); -} /* ecore_x_window_prop_window_get */ +} /* * Get Window (array) property @@ -426,13 +426,13 @@ ecore_x_window_prop_window_get(Ecore_X_Window win, * Note: Return value 0 means that the property exists but has no elements. */ EAPI int -ecore_x_window_prop_window_list_get(Ecore_X_Window win, - Ecore_X_Atom atom, +ecore_x_window_prop_window_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, Ecore_X_Window **plst) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst); -} /* ecore_x_window_prop_window_list_get */ +} /** * To be documented. @@ -443,7 +443,7 @@ EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void) { return AnyPropertyType; -} /* ecore_x_window_prop_any_type */ +} /** * To be documented. @@ -452,11 +452,11 @@ ecore_x_window_prop_any_type(void) */ EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, - Ecore_X_Atom property, - Ecore_X_Atom type, - int size, - void *data, - int number) + Ecore_X_Atom property, + Ecore_X_Atom type, + int size, + void *data, + int number) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (win == 0) @@ -479,13 +479,14 @@ ecore_x_window_prop_property_set(Ecore_X_Window win, dat = malloc(sizeof(unsigned long) * number); if (dat) { - for (ptr = (int *)data, i = 0; i < number; i++) dat[i] = ptr[i]; + for (ptr = (int *)data, i = 0; i < number; i++) + dat[i] = ptr[i]; XChangeProperty(_ecore_x_disp, win, property, type, size, PropModeReplace, (unsigned char *)dat, number); free(dat); } } -} /* ecore_x_window_prop_property_set */ +} /** * To be documented. @@ -493,12 +494,12 @@ ecore_x_window_prop_property_set(Ecore_X_Window win, * FIXME: To be fixed. */ EAPI int -ecore_x_window_prop_property_get(Ecore_X_Window win, - Ecore_X_Atom property, - Ecore_X_Atom type, - int size __UNUSED__, +ecore_x_window_prop_property_get(Ecore_X_Window win, + Ecore_X_Atom property, + Ecore_X_Atom type, + int size __UNUSED__, unsigned char **data, - int *num) + int *num) { Atom type_ret = 0; int ret, size_ret = 0; @@ -552,7 +553,7 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, for (i = 0; i < num_ret; i++) ((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i]; break; - } /* switch */ + } XFree(prop_ret); @@ -560,19 +561,19 @@ ecore_x_window_prop_property_get(Ecore_X_Window win, *num = num_ret; return size_ret; -} /* ecore_x_window_prop_property_get */ +} EAPI void ecore_x_window_prop_property_del(Ecore_X_Window win, - Ecore_X_Atom property) + Ecore_X_Atom property) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XDeleteProperty(_ecore_x_disp, win, property); -} /* ecore_x_window_prop_property_del */ +} EAPI Ecore_X_Atom * ecore_x_window_prop_list(Ecore_X_Window win, - int *num_ret) + int *num_ret) { Ecore_X_Atom *atoms; Atom *atom_ret; @@ -589,14 +590,15 @@ ecore_x_window_prop_list(Ecore_X_Window win, atoms = malloc(num * sizeof(Ecore_X_Atom)); if (atoms) { - for (i = 0; i < num; i++) atoms[i] = atom_ret[i]; + for (i = 0; i < num; i++) + atoms[i] = atom_ret[i]; if (num_ret) *num_ret = num; } XFree(atom_ret); return atoms; -} /* ecore_x_window_prop_list */ +} /** * Set a window string property. @@ -608,8 +610,8 @@ ecore_x_window_prop_list(Ecore_X_Window win, */ EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win, - Ecore_X_Atom type, - const char *str) + Ecore_X_Atom type, + const char *str) { XTextProperty xtp; @@ -622,7 +624,7 @@ ecore_x_window_prop_string_set(Ecore_X_Window win, xtp.encoding = ECORE_X_ATOM_UTF8_STRING; xtp.nitems = strlen(str); XSetTextProperty(_ecore_x_disp, win, &xtp, type); -} /* ecore_x_window_prop_string_set */ +} /** * Get a window string property. @@ -633,7 +635,7 @@ ecore_x_window_prop_string_set(Ecore_X_Window win, */ EAPI char * ecore_x_window_prop_string_get(Ecore_X_Window win, - Ecore_X_Atom type) + Ecore_X_Atom type) { XTextProperty xtp; char *str = NULL; @@ -673,10 +675,10 @@ ecore_x_window_prop_string_get(Ecore_X_Window win, } return str; -} /* ecore_x_window_prop_string_get */ +} EAPI Eina_Bool -ecore_x_window_prop_protocol_isset(Ecore_X_Window win, +ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol) { Atom proto, *protos = NULL; @@ -703,7 +705,7 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, XFree(protos); return ret; -} /* ecore_x_window_prop_protocol_isset */ +} /** * To be documented. @@ -712,7 +714,7 @@ ecore_x_window_prop_protocol_isset(Ecore_X_Window win, */ EAPI Ecore_X_WM_Protocol * ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, - int *num_ret) + int *num_ret) { Atom *protos = NULL; int i, protos_count = 0; @@ -746,5 +748,5 @@ ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, XFree(protos); *num_ret = protos_count; return prot_ret; -} /* ecore_x_window_prop_protocol_list_get */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c index 2e8f8ce..71718cf 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c @@ -28,7 +28,7 @@ ecore_x_window_shape_mask_set(Ecore_X_Window win, { LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet); -} /* ecore_x_window_shape_mask_set */ +} /** * Sets the input shape of the given window to that given by the pixmap @p mask. @@ -48,7 +48,7 @@ ecore_x_window_shape_input_mask_set(Ecore_X_Window win, return; win = mask = 0; #endif /* ifdef ShapeInput */ -} /* ecore_x_window_shape_input_mask_set */ +} EAPI void ecore_x_window_shape_window_set(Ecore_X_Window win, @@ -63,7 +63,7 @@ ecore_x_window_shape_window_set(Ecore_X_Window win, shape_win, ShapeBounding, ShapeSet); -} /* ecore_x_window_shape_window_set */ +} EAPI void ecore_x_window_shape_input_window_set(Ecore_X_Window win, @@ -83,13 +83,13 @@ ecore_x_window_shape_input_window_set(Ecore_X_Window win, return; win = shape_win = 0; #endif -} /* ecore_x_window_shape_input_window_set */ +} EAPI void ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, - int x, - int y) + int x, + int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineShape(_ecore_x_disp, @@ -100,13 +100,13 @@ ecore_x_window_shape_window_set_xy(Ecore_X_Window win, shape_win, ShapeBounding, ShapeSet); -} /* ecore_x_window_shape_window_set_xy */ +} EAPI void ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, - int x, - int y) + int x, + int y) { #ifdef ShapeInput LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -122,14 +122,14 @@ ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, return; win = shape_win = x = y = 0; #endif -} /* ecore_x_window_shape_input_window_set_xy */ +} EAPI void ecore_x_window_shape_rectangle_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { XRectangle rect; @@ -147,14 +147,14 @@ ecore_x_window_shape_rectangle_set(Ecore_X_Window win, 1, ShapeSet, Unsorted); -} /* ecore_x_window_shape_rectangle_set */ +} EAPI void ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ShapeInput XRectangle rect; @@ -177,12 +177,12 @@ ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, return; win = x = y = w = h = 0; #endif -} /* ecore_x_window_shape_input_rectangle_set */ +} EAPI void -ecore_x_window_shape_rectangles_set(Ecore_X_Window win, +ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, - int num) + int num) { #ifdef ShapeInput XRectangle *rect = NULL; @@ -216,12 +216,12 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window win, return; win = rects = num = 0; #endif -} /* ecore_x_window_shape_rectangles_set */ +} EAPI void -ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, +ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, - int num) + int num) { #ifdef ShapeInput XRectangle *rect = NULL; @@ -255,14 +255,14 @@ ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, return; win = rects = num = 0; #endif -} /* ecore_x_window_shape_input_rectangles_set */ +} EAPI void ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { XRectangle rect; @@ -280,14 +280,14 @@ ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, 1, ShapeSubtract, Unsorted); -} /* ecore_x_window_shape_rectangle_subtract */ +} EAPI void ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ShapeInput XRectangle rect; @@ -310,7 +310,7 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, return; win = x = y = w = h = 0; #endif -} /* ecore_x_window_shape_input_rectangle_subtract */ +} EAPI void ecore_x_window_shape_window_add(Ecore_X_Window win, @@ -325,13 +325,13 @@ ecore_x_window_shape_window_add(Ecore_X_Window win, shape_win, ShapeBounding, ShapeUnion); -} /* ecore_x_window_shape_window_add */ +} EAPI void ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, - int x, - int y) + int x, + int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineShape(_ecore_x_disp, @@ -342,13 +342,13 @@ ecore_x_window_shape_window_add_xy(Ecore_X_Window win, shape_win, ShapeBounding, ShapeUnion); -} /* ecore_x_window_shape_window_add_xy */ +} EAPI void ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, - int x, - int y) + int x, + int y) { #ifdef ShapeInput LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -364,14 +364,14 @@ ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, return; win = shape_win = x = y = 0; #endif -} /* ecore_x_window_shape_input_window_add_xy */ +} EAPI void ecore_x_window_shape_rectangle_add(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { XRectangle rect; @@ -389,14 +389,14 @@ ecore_x_window_shape_rectangle_add(Ecore_X_Window win, 1, ShapeUnion, Unsorted); -} /* ecore_x_window_shape_rectangle_add */ +} EAPI void ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ShapeInput XRectangle rect; @@ -419,14 +419,14 @@ ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, return; win = x = y = w = h = 0; #endif -} /* ecore_x_window_shape_input_rectangle_add */ +} EAPI void ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { XRectangle rect; @@ -444,14 +444,14 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, 1, ShapeIntersect, Unsorted); -} /* ecore_x_window_shape_rectangle_clip */ +} EAPI void ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, - int x, - int y, - int w, - int h) + int x, + int y, + int w, + int h) { #ifdef ShapeInput XRectangle rect; @@ -474,12 +474,12 @@ ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, return; win = x = y = w = h = 0; #endif -} /* ecore_x_window_shape_input_rectangle_clip */ +} EAPI void -ecore_x_window_shape_rectangles_add(Ecore_X_Window win, +ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, - int num) + int num) { XRectangle *rect = NULL; int i; @@ -508,12 +508,12 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win, ShapeUnion, Unsorted); if (rect) free(rect); -} /* ecore_x_window_shape_rectangles_add */ +} EAPI void -ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, +ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, - int num) + int num) { #ifdef ShapeInput XRectangle *rect = NULL; @@ -547,11 +547,11 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, return; win = rects = num = 0; #endif -} /* ecore_x_window_shape_input_rectangles_add */ +} EAPI Ecore_X_Rectangle * ecore_x_window_shape_rectangles_get(Ecore_X_Window win, - int *num_ret) + int *num_ret) { XRectangle *rect; Ecore_X_Rectangle *rects = NULL; @@ -585,11 +585,11 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, } if (num_ret) *num_ret = num; return rects; -} /* ecore_x_window_shape_rectangles_get */ +} EAPI Ecore_X_Rectangle * ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, - int *num_ret) + int *num_ret) { Ecore_X_Rectangle *rects = NULL; #ifdef ShapeInput @@ -643,16 +643,16 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, if (num_ret) *num_ret = 1; return rects; #endif -} /* ecore_x_window_shape_input_rectangles_get */ +} EAPI void ecore_x_window_shape_events_select(Ecore_X_Window win, - Eina_Bool on) + Eina_Bool on) { LOGFN(__FILE__, __LINE__, __FUNCTION__); if (on) XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); else XShapeSelectInput(_ecore_x_disp, win, 0); -} /* ecore_x_window_shape_events_select */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c index 38a81dd..fbfbd43 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c @@ -46,7 +46,7 @@ _ecore_x_input_init(void) _ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices, &_ecore_x_xi2_num); #endif /* ifdef ECORE_XI2 */ -} /* _ecore_x_input_init */ +} void _ecore_x_input_shutdown(void) @@ -61,7 +61,7 @@ _ecore_x_input_shutdown(void) _ecore_x_xi2_num = 0; _ecore_x_xi2_opcode = -1; #endif /* ifdef ECORE_XI2 */ -} /* _ecore_x_input_shutdown */ +} void _ecore_x_input_handler(XEvent *xevent) @@ -205,9 +205,9 @@ _ecore_x_input_handler(XEvent *xevent) #endif default: break; - } /* switch */ + } #endif /* ifdef ECORE_XI2 */ -} /* _ecore_x_input_handler */ +} EAPI Eina_Bool ecore_x_input_multi_select(Ecore_X_Window win) @@ -279,5 +279,5 @@ ecore_x_input_multi_select(Ecore_X_Window win) #else /* ifdef ECORE_XI2 */ return EINA_FALSE; #endif /* ifdef ECORE_XI2 */ -} /* ecore_x_input_multi_select */ +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c index 1d956b7..f49a4d3 100644 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c @@ -36,10 +36,10 @@ ecore_x_xinerama_screen_count_get(void) #endif /* ifdef ECORE_XINERAMA */ return 0; -} /* ecore_x_xinerama_screen_count_get */ +} EAPI Eina_Bool -ecore_x_xinerama_screen_geometry_get(int screen, +ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, @@ -87,5 +87,5 @@ ecore_x_xinerama_screen_geometry_get(int screen, return EINA_FALSE; screen = 0; -} /* ecore_x_xinerama_screen_geometry_get */ +} diff --git a/libraries/ecore/src/modules/Makefile.in b/libraries/ecore/src/modules/Makefile.in index 62cbce2..4bb9420 100644 --- a/libraries/ecore/src/modules/Makefile.in +++ b/libraries/ecore/src/modules/Makefile.in @@ -227,10 +227,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -249,6 +249,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -362,6 +366,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -374,6 +380,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -418,12 +426,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/modules/immodules/Makefile.am b/libraries/ecore/src/modules/immodules/Makefile.am index 6978672..2f121ae 100644 --- a/libraries/ecore/src/modules/immodules/Makefile.am +++ b/libraries/ecore/src/modules/immodules/Makefile.am @@ -5,3 +5,7 @@ SUBDIRS = if BUILD_ECORE_IMF_XIM SUBDIRS += xim endif + +if BUILD_ECORE_IMF_SCIM +SUBDIRS += scim +endif diff --git a/libraries/ecore/src/modules/immodules/Makefile.in b/libraries/ecore/src/modules/immodules/Makefile.in index 2ebe9fe..e65881c 100644 --- a/libraries/ecore/src/modules/immodules/Makefile.in +++ b/libraries/ecore/src/modules/immodules/Makefile.in @@ -34,6 +34,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @BUILD_ECORE_IMF_XIM_TRUE@am__append_1 = xim +@BUILD_ECORE_IMF_SCIM_TRUE@am__append_2 = scim subdir = src/modules/immodules DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -83,7 +84,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ distdir ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = xim +DIST_SUBDIRS = xim scim DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -228,10 +229,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -250,6 +251,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -363,6 +368,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -375,6 +382,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -419,12 +428,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ @@ -442,7 +453,7 @@ x_cflags = @x_cflags@ x_includes = @x_includes@ x_libs = @x_libs@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = $(am__append_1) +SUBDIRS = $(am__append_1) $(am__append_2) all: all-recursive .SUFFIXES: diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.am b/libraries/ecore/src/modules/immodules/scim/Makefile.am new file mode 100644 index 0000000..40579ca --- /dev/null +++ b/libraries/ecore/src/modules/immodules/scim/Makefile.am @@ -0,0 +1,36 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_imf \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_imf \ +-I$(top_builddir)/src/lib/ecore_evas \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@SCIM_CFLAGS@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +pkgdir = $(libdir)/ecore/immodules + +pkg_LTLIBRARIES = scim.la +scim_la_SOURCES = \ +scim_imcontext.cpp \ +scim_module.cpp \ +scim_imcontext.h + +scim_la_LIBADD = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ + $(top_builddir)/src/lib/ecore_x/libecore_x.la \ + @SCIM_LIBS@ \ + @EVAS_LIBS@ \ + @EINA_LIBS@ +scim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +scim_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/libraries/ecore/src/modules/immodules/scim/Makefile.in b/libraries/ecore/src/modules/immodules/scim/Makefile.in new file mode 100644 index 0000000..9fc3283 --- /dev/null +++ b/libraries/ecore/src/modules/immodules/scim/Makefile.in @@ -0,0 +1,849 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/modules/immodules/scim +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.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 +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +scim_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ + $(top_builddir)/src/lib/ecore_x/libecore_x.la +am_scim_la_OBJECTS = scim_la-scim_imcontext.lo scim_la-scim_module.lo +scim_la_OBJECTS = $(am_scim_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +scim_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(scim_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(scim_la_SOURCES) +DIST_SOURCES = $(scim_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SCIM_CFLAGS = @SCIM_CFLAGS@ +SCIM_LIBS = @SCIM_LIBS@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_imf \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_imf \ +-I$(top_builddir)/src/lib/ecore_evas \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@SCIM_CFLAGS@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +pkgdir = $(libdir)/ecore/immodules +pkg_LTLIBRARIES = scim.la +scim_la_SOURCES = \ +scim_imcontext.cpp \ +scim_module.cpp \ +scim_imcontext.h + +scim_la_LIBADD = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ + $(top_builddir)/src/lib/ecore_x/libecore_x.la \ + @SCIM_LIBS@ \ + @EVAS_LIBS@ \ + @EINA_LIBS@ + +scim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +scim_la_LIBTOOLFLAGS = --tag=disable-static +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/immodules/scim/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/immodules/scim/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +scim.la: $(scim_la_OBJECTS) $(scim_la_DEPENDENCIES) + $(AM_V_CXXLD)$(scim_la_LINK) -rpath $(pkgdir) $(scim_la_OBJECTS) $(scim_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_la-scim_imcontext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scim_la-scim_module.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +scim_la-scim_imcontext.lo: scim_imcontext.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scim_la-scim_imcontext.lo -MD -MP -MF $(DEPDIR)/scim_la-scim_imcontext.Tpo -c -o scim_la-scim_imcontext.lo `test -f 'scim_imcontext.cpp' || echo '$(srcdir)/'`scim_imcontext.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scim_la-scim_imcontext.Tpo $(DEPDIR)/scim_la-scim_imcontext.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scim_imcontext.cpp' object='scim_la-scim_imcontext.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scim_la-scim_imcontext.lo `test -f 'scim_imcontext.cpp' || echo '$(srcdir)/'`scim_imcontext.cpp + +scim_la-scim_module.lo: scim_module.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT scim_la-scim_module.lo -MD -MP -MF $(DEPDIR)/scim_la-scim_module.Tpo -c -o scim_la-scim_module.lo `test -f 'scim_module.cpp' || echo '$(srcdir)/'`scim_module.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/scim_la-scim_module.Tpo $(DEPDIR)/scim_la-scim_module.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scim_module.cpp' object='scim_la-scim_module.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CXX $(scim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o scim_la-scim_module.lo `test -f 'scim_module.cpp' || echo '$(srcdir)/'`scim_module.cpp + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp new file mode 100644 index 0000000..6cb72c2 --- /dev/null +++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.cpp @@ -0,0 +1,2839 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#define Uses_SCIM_DEBUG +#define Uses_SCIM_BACKEND +#define Uses_SCIM_IMENGINE_MODULE +#define Uses_SCIM_HOTKEY +#define Uses_SCIM_PANEL_CLIENT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include "scim_imcontext.h" + +using namespace scim; + +struct _EcoreIMFContextISFImpl +{ + EcoreIMFContextISF *parent; + IMEngineInstancePointer si; + Ecore_X_Window client_window; + Evas *client_canvas; + Ecore_IMF_Input_Mode input_mode; + WideString preedit_string; + AttributeList preedit_attrlist; + Ecore_IMF_Autocapital_Type autocapital_type; + int preedit_caret; + int cursor_x; + int cursor_y; + int cursor_pos; + bool use_preedit; + bool is_on; + bool shared_si; + bool preedit_started; + bool preedit_updating; + bool need_commit_preedit; + bool uppercase; + bool prediction_allow; + + EcoreIMFContextISFImpl *next; +}; + +/* Input Context handling functions. */ +static EcoreIMFContextISFImpl *new_ic_impl (EcoreIMFContextISF *parent); +static void delete_ic_impl (EcoreIMFContextISFImpl *impl); +static void delete_all_ic_impl (void); + +static EcoreIMFContextISF *find_ic (int id); + + +/* private functions */ +static void panel_slot_reload_config (int context); +static void panel_slot_exit (int context); +static void panel_slot_update_lookup_table_page_size(int context, + int page_size); +static void panel_slot_lookup_table_page_up (int context); +static void panel_slot_lookup_table_page_down (int context); +static void panel_slot_trigger_property (int context, + const String &property); +static void panel_slot_process_helper_event (int context, + const String &target_uuid, + const String &helper_uuid, + const Transaction &trans); +static void panel_slot_move_preedit_caret (int context, + int caret_pos); +static void panel_slot_select_candidate (int context, + int cand_index); +static void panel_slot_process_key_event (int context, + const KeyEvent &key); +static void panel_slot_commit_string (int context, + const WideString &wstr); +static void panel_slot_forward_key_event (int context, + const KeyEvent &key); +static void panel_slot_request_help (int context); +static void panel_slot_request_factory_menu (int context); +static void panel_slot_change_factory (int context, + const String &uuid); + +static void panel_req_focus_in (EcoreIMFContextISF *ic); +static void panel_req_update_factory_info (EcoreIMFContextISF *ic); +static void panel_req_update_spot_location (EcoreIMFContextISF *ic); +static void panel_req_show_help (EcoreIMFContextISF *ic); +static void panel_req_show_factory_menu (EcoreIMFContextISF *ic); + +/* Panel iochannel handler*/ +static bool panel_initialize (void); +static void panel_finalize (void); +static Eina_Bool panel_iochannel_handler (void *data, + Ecore_Fd_Handler *fd_handler); + +/* utility functions */ +static bool filter_hotkeys (EcoreIMFContextISF *ic, + const KeyEvent &key); +static void turn_on_ic (EcoreIMFContextISF *ic); +static void turn_off_ic (EcoreIMFContextISF *ic); +static void set_ic_capabilities (EcoreIMFContextISF *ic); + +static void initialize (void); +static void finalize (void); + +static void open_next_factory (EcoreIMFContextISF *ic); +static void open_previous_factory (EcoreIMFContextISF *ic); +static void open_specific_factory (EcoreIMFContextISF *ic, + const String &uuid); +static void initialize_modifier_bits (Display *display); +static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask); +static XKeyEvent createKeyEvent (Display *display, Window &win, + Window &winRoot, bool press, + int keycode, int modifiers); +static void _x_send_key_event (const KeyEvent &key); + +static void attach_instance (const IMEngineInstancePointer &si); + +/* slot functions */ +static void slot_show_preedit_string (IMEngineInstanceBase *si); +static void slot_show_aux_string (IMEngineInstanceBase *si); +static void slot_show_lookup_table (IMEngineInstanceBase *si); + +static void slot_hide_preedit_string (IMEngineInstanceBase *si); +static void slot_hide_aux_string (IMEngineInstanceBase *si); +static void slot_hide_lookup_table (IMEngineInstanceBase *si); + +static void slot_update_preedit_caret (IMEngineInstanceBase *si, + int caret); +static void slot_update_preedit_string (IMEngineInstanceBase *si, + const WideString &str, + const AttributeList &attrs); +static void slot_update_aux_string (IMEngineInstanceBase *si, + const WideString &str, + const AttributeList &attrs); +static void slot_commit_string (IMEngineInstanceBase *si, + const WideString &str); +static void slot_forward_key_event (IMEngineInstanceBase *si, + const KeyEvent &key); +static void slot_update_lookup_table (IMEngineInstanceBase *si, + const LookupTable &table); + +static void slot_register_properties (IMEngineInstanceBase *si, + const PropertyList &properties); +static void slot_update_property (IMEngineInstanceBase *si, + const Property &property); +static void slot_beep (IMEngineInstanceBase *si); +static void slot_start_helper (IMEngineInstanceBase *si, + const String &helper_uuid); +static void slot_stop_helper (IMEngineInstanceBase *si, + const String &helper_uuid); +static void slot_send_helper_event (IMEngineInstanceBase *si, + const String &helper_uuid, + const Transaction &trans); +static bool slot_get_surrounding_text (IMEngineInstanceBase *si, + WideString &text, + int &cursor, + int maxlen_before, + int maxlen_after); +static bool slot_delete_surrounding_text (IMEngineInstanceBase *si, + int offset, + int len); + +static void reload_config_callback (const ConfigPointer &config); + +static void fallback_commit_string_cb (IMEngineInstanceBase *si, + const WideString &str); + +static void caps_mode_check (Ecore_IMF_Context *ctx, Eina_Bool force); + +/* Local variables declaration */ +static String _language; +static EcoreIMFContextISFImpl *_used_ic_impl_list = 0; +static EcoreIMFContextISFImpl *_free_ic_impl_list = 0; +static EcoreIMFContextISF *_ic_list = 0; + +static KeyboardLayout _keyboard_layout = SCIM_KEYBOARD_Default; +static int _valid_key_mask = SCIM_KEY_AllMasks; + +static FrontEndHotkeyMatcher _frontend_hotkey_matcher; +static IMEngineHotkeyMatcher _imengine_hotkey_matcher; + +static IMEngineInstancePointer _default_instance; + +static ConfigModule *_config_module = 0; +static ConfigPointer _config; +static BackEndPointer _backend; + +static EcoreIMFContextISF *_focused_ic = 0; + +static bool _scim_initialized = false; + +static int _instance_count = 0; +static int _context_count = 0; + +static IMEngineFactoryPointer _fallback_factory; +static IMEngineInstancePointer _fallback_instance; +static PanelClient _panel_client; + +static Ecore_Fd_Handler *_panel_iochannel_read_handler = 0; +static Ecore_Fd_Handler *_panel_iochannel_err_handler = 0; + +static Ecore_X_Window _client_window = 0; + +static bool _on_the_spot = true; +static bool _shared_input_method = false; + +static Eina_Bool autocap_allow = EINA_FALSE; + +static Display *__current_display = 0; +static int __current_alt_mask = Mod1Mask; +static int __current_meta_mask = 0; +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. +class FinalizeHandler +{ +public: + FinalizeHandler () + { + SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::FinalizeHandler ()\n"; + } + ~FinalizeHandler () + { + SCIM_DEBUG_FRONTEND(1) << "FinalizeHandler::~FinalizeHandler ()\n"; + isf_imf_context_shutdown (); + } +}; + +static FinalizeHandler _finalize_handler; + +static unsigned int +utf8_offset_to_index(const char *str, int offset) +{ + int index = 0; + int i; + for (i = 0; i < offset; i++) + { + eina_unicode_utf8_get_next(str, &index); + } + + return index; +} + +static unsigned int +get_time (void) +{ + unsigned int tint; + struct timeval tv; + struct timezone tz; /* is not used since ages */ + gettimeofday (&tv, &tz); + tint = tv.tv_sec * 1000; + tint = tint / 1000 * 1000; + tint = tint + tv.tv_usec / 1000; + return tint; +} + +/* Function Implementations */ +static EcoreIMFContextISFImpl * +new_ic_impl (EcoreIMFContextISF *parent) +{ + EcoreIMFContextISFImpl *impl = NULL; + + if (_free_ic_impl_list != NULL) + { + impl = _free_ic_impl_list; + _free_ic_impl_list = _free_ic_impl_list->next; + } + else + { + impl = new EcoreIMFContextISFImpl; + if (impl == NULL) + return NULL; + } + + impl->uppercase = false; + impl->autocapital_type = ECORE_IMF_AUTOCAPITAL_TYPE_NONE; + impl->next = _used_ic_impl_list; + _used_ic_impl_list = impl; + + impl->parent = parent; + + return impl; +} + +static void +delete_ic_impl (EcoreIMFContextISFImpl *impl) +{ + EcoreIMFContextISFImpl *rec = _used_ic_impl_list, *last = 0; + + for (; rec != 0; last = rec, rec = rec->next) + { + if (rec == impl) + { + if (last != 0) + last->next = rec->next; + else + _used_ic_impl_list = rec->next; + + rec->next = _free_ic_impl_list; + _free_ic_impl_list = rec; + + rec->parent = 0; + rec->si.reset (); + rec->client_window = 0; + rec->preedit_string = WideString (); + rec->preedit_attrlist.clear (); + + return; + } + } +} + +static void +delete_all_ic_impl (void) +{ + EcoreIMFContextISFImpl *it = _used_ic_impl_list; + + while (it != 0) + { + _used_ic_impl_list = it->next; + delete it; + it = _used_ic_impl_list; + } + + it = _free_ic_impl_list; + while (it != 0) + { + _free_ic_impl_list = it->next; + delete it; + it = _free_ic_impl_list; + } +} + +static EcoreIMFContextISF * +find_ic (int id) +{ + EcoreIMFContextISFImpl *rec = _used_ic_impl_list; + + while (rec != 0) + { + if (rec->parent && rec->parent->id == id) + return rec->parent; + rec = rec->next; + } + + return 0; +} + +static Eina_Bool +analyze_surrounding_text(Ecore_IMF_Context *ctx) +{ + char *plain_str = NULL; + char *markup_str = NULL; + const char *puncs[3] = {". ", "! ", "? "}; + 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]; + EcoreIMFContextISF *context_scim; + + if (!ctx) return EINA_FALSE; + context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + if (!context_scim || !context_scim->impl) return EINA_FALSE; + + switch (context_scim->impl->autocapital_type) + { + case ECORE_IMF_AUTOCAPITAL_TYPE_NONE: + return EINA_FALSE; + case ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER: + return EINA_TRUE; + default: + break; + } + + for (i=0; i<3; i++) + uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL); + + ecore_imf_context_surrounding_get(ctx, &markup_str, &cursor_pos); + if (!markup_str) goto done; + + if (cursor_pos == 0) + { + ret = EINA_TRUE; + goto done; + } + + // Convert into plain string + plain_str = evas_textblock_text_markup_to_utf8(NULL, markup_str); + if (!plain_str) goto done; + + // Convert string from utf8 to unicode + ustr = eina_unicode_utf8_to_unicode(plain_str, NULL); + if (!ustr) goto done; + + if (cursor_pos >= 1) + { + if (context_scim->impl->autocapital_type == ECORE_IMF_AUTOCAPITAL_TYPE_WORD) + { + if (ustr[cursor_pos-1] == ' ') + { + ret = EINA_TRUE; + goto done; + } + } + + // Check paragraph separator and carrage return
+ if ((ustr[cursor_pos-1] == 0x2029) || (ustr[cursor_pos-1] == '\n')) + { + ret = EINA_TRUE; + goto done; + } + } + + // check punctuation + if (cursor_pos >= 2) + { + tail = eina_unicode_strndup(ustr+cursor_pos-2, 2); + + if (tail) + { + for (i=0; i<3; i++) + { + if (!eina_unicode_strcmp(tail, uni_puncs[i])) + { + ret = EINA_TRUE; + break; + } + } + free(tail); + tail = NULL; + } + } + +done: + if (ustr) free(ustr); + if (markup_str) free(markup_str); + if (plain_str) free(plain_str); + + for (i=0; i<3; i++) + if (uni_puncs[i]) free(uni_puncs[i]); + + return ret; +} + +static void +caps_mode_check(Ecore_IMF_Context *ctx, Eina_Bool force) +{ + Eina_Bool uppercase; + EcoreIMFContextISF *context_scim; + + if (!ctx) return; + context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + + if (autocap_allow == EINA_FALSE) + return; + + // Check autocapital type + if (!context_scim || !context_scim->impl) + return; + + if (analyze_surrounding_text(ctx)) + uppercase = EINA_TRUE; + else + uppercase = EINA_FALSE; + + if (force) + context_scim->impl->uppercase = uppercase; + else + if (context_scim->impl->uppercase != uppercase) + context_scim->impl->uppercase = uppercase; +} + +static void +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 (); + + 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"; + } + 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"; + } +} + +/* Public functions */ +/** + * isf_imf_context_new + * + * This function will be called by Ecore IMF. + * Create a instance of type EcoreIMFContextISF. + * + * Return value: A pointer to the newly created EcoreIMFContextISF instance + */ +EAPI EcoreIMFContextISF * +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) + { + std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n"; + return NULL; + } + + context_scim->id = _context_count++; + + if (!_scim_initialized) + { + initialize (); + _scim_initialized = true; + } + + env = getenv("ECORE_IMF_AUTOCAPITAL_ALLOW"); + if (env) + autocap_allow = !!atoi(env); + + return context_scim; +} + +/** + * isf_imf_shutdown + * + * It will be called when the scim im module is unloaded by ecore. It will do some + * cleanup job. + */ +EAPI void +isf_imf_context_shutdown (void) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (_scim_initialized) + { + _scim_initialized = false; + finalize (); + } +} + +EAPI void +isf_imf_context_add (Ecore_IMF_Context *ctx) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + + if (!context_scim) return; + + context_scim->impl = 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 ()) + { + si = _default_instance; + 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 ()) + { + 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 ()) + { + SCIM_DEBUG_FRONTEND(2) << "update default instance.\n"; + _default_instance = si; + } + + context_scim->ctx = ctx; + context_scim->impl = new_ic_impl (context_scim); + if (context_scim->impl == NULL) + { + std::cerr << "memory allocation failed in " << __FUNCTION__ << "\n"; + return; + } + + context_scim->impl->si = si; + context_scim->impl->client_window = 0; + context_scim->impl->client_canvas = NULL; + context_scim->impl->preedit_caret = 0; + context_scim->impl->cursor_x = 0; + context_scim->impl->cursor_y = 0; + context_scim->impl->cursor_pos = -1; + context_scim->impl->is_on = false; + context_scim->impl->shared_si = _shared_input_method; + context_scim->impl->use_preedit = _on_the_spot; + context_scim->impl->preedit_started = false; + context_scim->impl->preedit_updating = false; + context_scim->impl->need_commit_preedit = false; + + if (!_ic_list) + context_scim->next = NULL; + else + context_scim->next = _ic_list; + _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); + + _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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (!_ic_list) return; + + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + + if (context_scim) + { + if (context_scim->id != _ic_list->id) + { + EcoreIMFContextISF * pre = _ic_list; + EcoreIMFContextISF * cur = _ic_list->next; + while (cur != NULL) + { + if (cur->id == context_scim->id) + { + pre->next = cur->next; + break; + } + pre = cur; + cur = cur->next; + } + } + else + _ic_list = _ic_list->next; + } + + if (context_scim && context_scim->impl) + { + _panel_client.prepare (context_scim->id); + + if (context_scim == _focused_ic) + context_scim->impl->si->focus_out (); + + // Delete the instance. + EcoreIMFContextISF *old_focused = _focused_ic; + _focused_ic = context_scim; + 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.remove_input_context (context_scim->id); + _panel_client.send (); + + if (context_scim->impl->client_window) + isf_imf_context_client_window_set (ctx, NULL); + + if (context_scim->impl) + { + delete_ic_impl (context_scim->impl); + context_scim->impl = 0; + } + } + + if (context_scim == _focused_ic) + _focused_ic = 0; + + if (context_scim) + { + delete context_scim; + context_scim = 0; + } +} + +/** + * isf_imf_context_client_canvas_set + * @ctx: a #Ecore_IMF_Context + * @canvas: the client canvas + * + * This function will be called by Ecore IMF. + * + * Set the client canvas for the Input Method Context; this is the canvas + * in which the input appears. + * + * The canvas type can be determined by using the context canvas type. + * Actually only canvas with type "evas" (Evas *) is supported. This canvas + * may be used in order to correctly position status windows, and may also + * be used for purposes internal to the Input Method Context. + */ +EAPI void +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); + + if (context_scim && context_scim->impl && context_scim->impl->client_canvas != (Evas*) canvas) + context_scim->impl->client_canvas = (Evas*)canvas; +} + +/** + * isf_imf_context_client_window_set + * @ctx: a #Ecore_IMF_Context + * @window: the client window + * + * This function will be called by Ecore IMF. + * + * Set the client window for the Input Method Context; this is the Ecore_X_Window + * when using X11, Ecore_Win32_Window when using Win32, etc. + * + * This window is used in order to correctly position status windows, + * 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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + 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)) + { + context_scim->impl->client_window = (Ecore_X_Window)((Ecore_Window)window); + + if ((context_scim->impl->client_window != 0) && + (context_scim->impl->client_window != _client_window)) + _client_window = context_scim->impl->client_window; + } +} + +/** + * isf_imf_context_reset + * @ctx: a #Ecore_IMF_Context + * + * This function will be called by Ecore IMF. + * + * Notify the Input Method Context that a change such as a change in cursor + * position has been made. This will typically cause the Input Method Context + * to clear the preedit state. + */ +EAPI void +isf_imf_context_reset (Ecore_IMF_Context *ctx) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + 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 (); + + if (context_scim->impl->need_commit_preedit) + { + if (wstr.length ()) + { + 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 (); + } + } +} + +/** + * isf_imf_context_focus_in + * @ctx: a #Ecore_IMF_Context + * + * This function will be called by Ecore IMF. + * + * 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) +{ + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + + if (!context_scim) + return; + + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__<< "(" << context_scim->id << ")...\n"; + + if (_focused_ic) + { + 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); + } + + bool need_cap = false; + bool need_reset = false; + bool need_reg = false; + + if (context_scim && context_scim->impl) + { + _focused_ic = context_scim; + _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 ()) + { + 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"; + } + + 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->preedit_caret = 0; + context_scim->impl->preedit_started = false; + need_cap = true; + need_reset = true; + need_reg = true; + } + } + 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 ()) + { + 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); + 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"; + } + } + + 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 (); + + 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 (); + } + else + { + _panel_client.turn_off (context_scim->id); + } + + _panel_client.send (); + } +} + +/** + * isf_imf_context_focus_out + * @ctx: a #Ecore_IMF_Context + * + * This function will be called by Ecore IMF. + * + * 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) +{ + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + + if (!context_scim) return; + + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "(" << context_scim->id << ")...\n"; + + if (context_scim && context_scim->impl && context_scim == _focused_ic) + { + WideString wstr = context_scim->impl->preedit_string; + + if (context_scim->impl->need_commit_preedit) + { + if (wstr.length ()) + { + 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); + 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; + } +} + +/** + * isf_imf_context_cursor_location_set + * @ctx: a #Ecore_IMF_Context + * @x: x position of New cursor. + * @y: y position of New cursor. + * @w: the width of New cursor. + * @h: the height of New cursor. + * + * This function will be called by Ecore IMF. + * + * 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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + Ecore_Evas *ee; + int canvas_x, canvas_y; + + if (cw == 0 && ch == 0) + return; + + if (context_scim && context_scim->impl && context_scim == _focused_ic) + { + // Don't update spot location while updating preedit string. + 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; + + ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL); + + 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 (); + SCIM_DEBUG_FRONTEND(2) << "new cursor location = " << context_scim->impl->cursor_x << "," << context_scim->impl->cursor_y << "\n"; + } + } +} + +/** + * isf_imf_context_use_preedit_set + * @ctx: a #Ecore_IMF_Context + * @use_preedit: Whether the IM context should use the preedit string. + * + * This function will be called by Ecore IMF. + * + * Set whether the IM context should use the preedit string to display feedback. + * If is 0 (default is 1), then the IM context may use some other method to + * 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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << (use_preedit ? "true" : "false") << "...\n"; + + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF*)ecore_imf_context_data_get (ctx); + + if (!_on_the_spot) return; + + if (context_scim && context_scim->impl) + { + bool old = context_scim->impl->use_preedit; + context_scim->impl->use_preedit = use_preedit; + if (context_scim == _focused_ic) + { + _panel_client.prepare (context_scim->id); + + if (old != use_preedit) + set_ic_capabilities (context_scim); + + if (context_scim->impl->preedit_string.length ()) + slot_show_preedit_string (context_scim->impl->si); + + _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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + 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); + + if (str) + { + if (mbs.length ()) + *str = strdup (mbs.c_str ()); + else + *str = strdup (""); + } + + if (cursor_pos) + { + *cursor_pos = context_scim->impl->preedit_caret; + } + + if (attrs) + { + if (mbs.length ()) + { + int start_index, end_index; + 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)); + + 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 (); + + 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 ()); + + if (i->get_type () == SCIM_ATTR_DECORATE) + { + attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); + if (attr == NULL) + continue; + attr->start_index = start_index; + attr->end_index = end_index; + + 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) + { + attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; + *attrs = eina_list_append(*attrs, (void *)attr); + } + 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); + } + + switch(i->get_value()) + { + case SCIM_ATTR_DECORATE_UNDERLINE: + case SCIM_ATTR_DECORATE_REVERSE: + case SCIM_ATTR_DECORATE_HIGHLIGHT: + // Record which character has attribute. + for (int pos = start_index; pos < end_index; ++pos) + attrs_flag [pos] = 1; + break; + default: + break; + } + } + else if (i->get_type () == SCIM_ATTR_FOREGROUND) + { + SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_FOREGROUND\n"; + } + else if (i->get_type () == SCIM_ATTR_BACKGROUND) + { + SCIM_DEBUG_FRONTEND(4) << "SCIM_ATTR_BACKGROUND\n"; + } + } + } + + // Add underline for all characters which don't have attribute. + for (unsigned int pos = 0; pos < mbs.length (); ++pos) + { + if (!attrs_flag [pos]) + { + int begin_pos = pos; + + while (pos < mbs.length () && !attrs_flag [pos]) + ++pos; + + // use REVERSE style as default + attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); + if (attr == NULL) + continue; + attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; + attr->start_index = begin_pos; + attr->end_index = pos; + *attrs = eina_list_append(*attrs, (void *)attr); + } + } + + delete [] attrs_flag; + } + } + } + else + { + if (str) + *str = strdup (""); + + if (cursor_pos) + *cursor_pos = 0; + + if (attrs) + *attrs = NULL; + } +} + +/** + * isf_imf_context_preedit_string_get + * @ctx: a #Ecore_IMF_Context + * @str: the preedit string + * @cursor_pos: the cursor position + * + * This function will be called by Ecore IMF. + * + * 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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + 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); + + if (str) + { + if (mbs.length ()) + *str = strdup (mbs.c_str ()); + else + *str = strdup (""); + } + + if (cursor_pos) + *cursor_pos = context_scim->impl->preedit_caret; + } + else + { + if (str) + *str = strdup (""); + + if (cursor_pos) + *cursor_pos = 0; + } +} + +/** + * isf_imf_context_cursor_position_set + * @ctx: a #Ecore_IMF_Context + * @cursor_pos: New cursor position in characters. + * + * This function will be called by Ecore IMF. + * + * 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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *context_scim = (EcoreIMFContextISF *)ecore_imf_context_data_get (ctx); + + if (context_scim && context_scim->impl && context_scim == _focused_ic) + { + // Don't update spot location while updating preedit string. + if (context_scim->impl->preedit_updating) + return; + + if (context_scim->impl->cursor_pos != cursor_pos) + { + context_scim->impl->cursor_pos = cursor_pos; + caps_mode_check(ctx, EINA_FALSE); + } + } +} + +/** + * isf_imf_context_input_mode_set + * @ctx: a #Ecore_IMF_Context + * @input_mode: the input mode + * + * This function will be called by Ecore IMF. + * + * To set the input mode of input method. The definition of Ecore_IMF_Input_Mode + * is in Ecore_IMF.h. + */ +EAPI void +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); + if (context_scim && context_scim->impl) + context_scim->impl->input_mode = input_mode; +} + +/** + * isf_imf_context_prediction_allow_set + * @ctx: a #Ecore_IMF_Context + * @use_prediction: Whether the IM context should use the prediction. + * + * This function will be called by Ecore IMF. + * + * Set whether the IM context should use the prediction. + */ +EAPI void +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); + + 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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " = " << autocapital_type << "...\n"; + + 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; +} + +/** + * isf_imf_context_filter_event + * @ctx: a #Ecore_IMF_Context + * @type: The type of event defined by Ecore_IMF_Event_Type. + * @event: The event itself. + * Return value: %TRUE if the input method handled the key event. + * + * This function will be called by Ecore IMF. + * + * Allow an Ecore Input Context to internally handle an event. If this function + * returns 1, then no further processing should be done for this event. Input + * methods must be able to accept all types of events (simply returning 0 if + * the event was not handled), but there is no obligation of any events to be + * submitted to this function. + */ + +EAPI Eina_Bool +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); + Eina_Bool ret = EINA_FALSE; + + if (ic == NULL || ic->impl == NULL) + return ret; + + KeyEvent key; + + 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); + 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; + if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_CAPS) key.mask |=SCIM_KEY_CapsLockMask; + if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_NUM) key.mask |=SCIM_KEY_NumLockMask; + } + 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); + 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; + if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask; + if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_CAPS) key.mask |=SCIM_KEY_CapsLockMask; + if (ev->locks & ECORE_IMF_KEYBOARD_LOCK_NUM) key.mask |=SCIM_KEY_NumLockMask; + } + else + { + return ret; + } + + key.mask &= _valid_key_mask; + + _panel_client.prepare (ic->id); + + ret = EINA_TRUE; + if (!filter_hotkeys (ic, key)) + { + if (!_focused_ic || !_focused_ic->impl->is_on || + !_focused_ic->impl->si->process_key_event (key)) + ret = EINA_FALSE; + } + + _panel_client.send (); + + return ret; +} + +/* Panel Slot functions */ +static void +panel_slot_reload_config (int context __UNUSED__) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + _config->reload (); +} + +static void +panel_slot_exit (int /* context */) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + finalize (); +} + +static void +panel_slot_update_lookup_table_page_size (int context, int page_size) +{ + 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 (); + } +} + +static void +panel_slot_lookup_table_page_up (int 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 (); + } +} + +static void +panel_slot_lookup_table_page_down (int 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 (); + } +} + +static void +panel_slot_trigger_property (int context, const String &property) +{ + 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 (); + } +} + +static void +panel_slot_process_helper_event (int context, const String &target_uuid, const String &helper_uuid, const Transaction &trans) +{ + 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) + { + _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 (); + } +} + +static void +panel_slot_move_preedit_caret (int context, int caret_pos) +{ + 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 (); + } +} + +static void +panel_slot_select_candidate (int context, int cand_index) +{ + 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 (); + } +} + +static void +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"; + + if (ic && ic->impl && ic->impl->client_canvas) + feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE); +} + +static void +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"; + + 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_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) +{ + 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); +} + +static void +panel_slot_request_help (int 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 (); + } +} + +static void +panel_slot_request_factory_menu (int 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 (); + } +} + +static void +panel_slot_change_factory (int context, const String &uuid) +{ + 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 (); + } +} + +/* Panel Requestion functions. */ +static void +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"); + + if (ic && ic->impl) + { + 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_help ()); + help += String ("\n\n"); + + help += utf8_wcstombs (sf->get_credits ()); + } + _panel_client.show_help (ic->id, help); + } +} + +static void +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"); + + 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 ())); + } + + if (menu.size ()) + _panel_client.show_factory_menu (ic->id, menu); +} + +static void +panel_req_update_factory_info (EcoreIMFContextISF *ic) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (ic && ic->impl && ic == _focused_ic) + { + PanelFactoryInfo info; + if (ic->impl->is_on) + { + 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 ()); + } + else + { + info = PanelFactoryInfo (String (""), String ("English/Keyboard"), String ("C"), ""); + } + _panel_client.update_factory_info (ic->id, info); + } +} + +static void +panel_req_focus_in (EcoreIMFContextISF *ic) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + _panel_client.focus_in (ic->id, ic->impl->si->get_factory_uuid ()); +} + +static void +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); +} + +static bool +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); + + 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); + else + turn_off_ic (ic); + ret = true; + } + else if (hotkey_action == SCIM_FRONTEND_HOTKEY_ON) + { + if (!ic->impl->is_on) + turn_on_ic (ic); + ret = true; + } + else if (hotkey_action == SCIM_FRONTEND_HOTKEY_OFF) + { + if (ic->impl->is_on) + turn_off_ic (ic); + ret = true; + } + else if (hotkey_action == SCIM_FRONTEND_HOTKEY_NEXT_FACTORY) + { + open_next_factory (ic); + ret = true; + } + else if (hotkey_action == SCIM_FRONTEND_HOTKEY_PREVIOUS_FACTORY) + { + open_previous_factory (ic); + ret = true; + } + else if (hotkey_action == SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU) + { + panel_req_show_factory_menu (ic); + ret = true; + } + else if (_imengine_hotkey_matcher.is_matched ()) + { + String sfid = _imengine_hotkey_matcher.get_match_result (); + open_specific_factory (ic, sfid); + ret = true; + } + return ret; +} + +static bool +panel_initialize (void) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + String display_name; + { + const char *p = getenv ("DISPLAY"); + if (p) display_name = String (p); + } + + if (_panel_client.open_connection (_config->get_name (), display_name) >= 0) + { + 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); + + SCIM_DEBUG_FRONTEND(2) << " Panel FD= " << fd << "\n"; + + return true; + } + std::cerr << "panel_initialize () failed!!!\n"; + return false; +} + +static void +panel_finalize (void) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + _panel_client.close_connection (); + + if (_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); + _panel_iochannel_err_handler = 0; + } +} + +static Eina_Bool +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 ()) + { + panel_finalize (); + panel_initialize (); + return ECORE_CALLBACK_CANCEL; + } + } + else if (fd_handler == _panel_iochannel_err_handler) + { + panel_finalize (); + panel_initialize (); + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + +static void +turn_on_ic (EcoreIMFContextISF *ic) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (ic && ic->impl && !ic->impl->is_on) + { + ic->impl->is_on = true; + + 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 (); + } + + //Record the IC on/off status + if (_shared_input_method) + _config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), true); + + if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + { + 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_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); + ic->impl->preedit_started = true; + } + } +} + +static void +turn_off_ic (EcoreIMFContextISF *ic) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (ic && ic->impl && ic->impl->is_on) + { + ic->impl->is_on = false; + + if (ic == _focused_ic) + { + ic->impl->si->focus_out (); + + 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); + + if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + { + 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_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); + ic->impl->preedit_started = false; + } + } +} + +static void +set_ic_capabilities (EcoreIMFContextISF *ic) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (ic && ic->impl) + { + unsigned int cap = SCIM_CLIENT_CAP_ALL_CAPABILITIES; + + if (!_on_the_spot || !ic->impl->use_preedit) + cap -= SCIM_CLIENT_CAP_ONTHESPOT_PREEDIT; + + ic->impl->si->update_client_capabilities (cap); + } +} + +static bool +check_socket_frontend (void) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + SocketAddress address; + SocketClient client; + + uint32 magic; + + address.set_address (scim_get_default_socket_frontend_address ()); + + if (!client.connect (address)) + return false; + + if (!scim_socket_open_connection (magic, + String ("ConnectionTester"), + String ("SocketFrontEnd"), + client, + 1000)) + return false; + + return true; +} + +void +initialize (void) +{ + std::vector config_list; + std::vector engine_list; + std::vector load_engine_list; + + std::vector::iterator it; + + bool manual = false; + + bool socket = true; + + String config_module_name = "simple"; + + printf("Initializing Ecore SCIM IMModule...\n"); + + SCIM_DEBUG_FRONTEND(1) << "Initializing Ecore SCIM IMModule...\n"; + + // Get system language. + _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 (); + if (!check_result) + { + std::cerr << "Launching a SCIM daemon with Socket FrontEnd...\n"; + //get modules list + scim_get_imengine_module_list (engine_list); + + for (it = engine_list.begin (); it != engine_list.end (); it++) + { + if (*it != "socket") + 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); + manual = false; + } + + // If there is one Socket FrontEnd running and it's not manual mode, + // then just use this Socket Frontend. + if (!manual) + { + for (int i = 0; i < 200; ++i) + { + if (check_result) + { + config_module_name = "socket"; + load_engine_list.clear (); + load_engine_list.push_back ("socket"); + break; + } + scim_usleep (50000); + check_result = check_socket_frontend (); + } + } + } + + if (config_module_name != "dummy") + { + //load config module + SCIM_DEBUG_FRONTEND(1) << "Loading Config module: " << config_module_name << "...\n"; + _config_module = new ConfigModule (config_module_name); + + //create config instance + if (_config_module != NULL && _config_module->valid ()) + _config = _config_module->create_config (); + } + + 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_module_name = "dummy"; + } + + 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); + + if (_backend.null ()) + std::cerr << "Cannot create BackEnd Object!\n"; + else + _fallback_factory = _backend->get_factory (SCIM_COMPOSE_KEY_FACTORY_UUID); + + 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)); + + // 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 ()) + std::cerr << "Ecore IM Module: Cannot connect to Panel!\n"; +} + +static 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 (); + + SCIM_DEBUG_FRONTEND(2) << "Finalize all IC partially.\n"; + while (_used_ic_impl_list) + { + // 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); + } + + delete_all_ic_impl (); + + _fallback_instance.reset (); + _fallback_factory.reset (); + + SCIM_DEBUG_FRONTEND(2) << " Releasing BackEnd...\n"; + _backend.reset (); + + SCIM_DEBUG_FRONTEND(2) << " Releasing Config...\n"; + _config.reset (); + + if (_config_module) + { + SCIM_DEBUG_FRONTEND(2) << " Deleting _config_module...\n"; + delete _config_module; + _config_module = 0; + } + + _focused_ic = NULL; + _ic_list = NULL; + + _scim_initialized = false; + + panel_finalize (); +} + +static void +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 ()); + + 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 (); + 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); + + if (_shared_input_method) + { + _default_instance = ic->impl->si; + ic->impl->shared_si = true; + } + } +} + +static void +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 ()); + + 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 (); + 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); + + if (_shared_input_method) + { + _default_instance = ic->impl->si; + ic->impl->shared_si = true; + } + } +} + +static void +open_specific_factory (EcoreIMFContextISF *ic, + const String &uuid) +{ + if (ic == NULL) + return; + + 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) + { + turn_on_ic (ic); + return; + } + + IMEngineFactoryPointer sf = _backend->get_factory (uuid); + + 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 (); + 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); + + if (_shared_input_method) + { + _default_instance = ic->impl->si; + ic->impl->shared_si = true; + } + } + else + { + // 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 (); + + 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); + + if (ic->impl->use_preedit && ic->impl->preedit_string.length ()) + { + 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_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); + ic->impl->preedit_started = false; + } + } + } +} + +static void initialize_modifier_bits (Display *display) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + if (__current_display == display) + return; + + __current_display = display; + + if (display == 0) + { + __current_alt_mask = Mod1Mask; + __current_meta_mask = ShiftMask | Mod1Mask; + __current_super_mask = 0; + __current_hyper_mask = 0; + __current_numlock_mask = Mod2Mask; + return; + } + + 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); + + int i, j; + + mods = XGetModifierMapping (display); + if (mods == NULL) + return; + + __current_alt_mask = 0; + __current_meta_mask = 0; + __current_super_mask = 0; + __current_hyper_mask = 0; + __current_numlock_mask = 0; + + /* We skip the first three sets for Shift, Lock, and Control. The + remaining sets are for Mod1, Mod2, Mod3, Mod4, and Mod5. */ + for (i = 3; i < 8; i++) + { + for (j = 0; j < mods->max_keypermod; j++) + { + ::KeyCode code = mods->modifiermap [i * mods->max_keypermod + j]; + if (! code) continue; + if (code == alt_l || code == alt_r) + __current_alt_mask |= (1 << i); + else if (code == meta_l || code == meta_r) + __current_meta_mask |= (1 << i); + else if (code == super_l || code == super_r) + __current_super_mask |= (1 << i); + else if (code == hyper_l || code == hyper_r) + __current_hyper_mask |= (1 << i); + else if (code == numlock) + __current_numlock_mask |= (1 << i); + } + } + + /* Check whether there is a combine keys mapped to Meta */ + if (__current_meta_mask == 0) + { + char buf [32]; + XKeyEvent xkey; + KeySym keysym_l, keysym_r; + + xkey.type = KeyPress; + xkey.display = display; + xkey.serial = 0L; + xkey.send_event = False; + xkey.x = xkey.y = xkey.x_root = xkey.y_root = 0; + xkey.time = 0; + xkey.same_screen = False; + xkey.subwindow = None; + xkey.window = None; + xkey.root = DefaultRootWindow (display); + xkey.state = ShiftMask; + + xkey.keycode = meta_l; + XLookupString (&xkey, buf, 32, &keysym_l, 0); + xkey.keycode = meta_r; + 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; + else if ((meta_l == ctrl_l && keysym_l == XK_Meta_L) || (meta_r == ctrl_r && keysym_r == XK_Meta_R)) + __current_meta_mask = ShiftMask + ControlMask; + } + + XFreeModifiermap (mods); +} + +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); + + if (scimkeymask & SCIM_KEY_ShiftMask) state |= ShiftMask; + if (scimkeymask & SCIM_KEY_CapsLockMask) state |= LockMask; + if (scimkeymask & SCIM_KEY_ControlMask) state |= ControlMask; + if (scimkeymask & SCIM_KEY_AltMask) state |= __current_alt_mask; + if (scimkeymask & SCIM_KEY_MetaMask) state |= __current_meta_mask; + if (scimkeymask & SCIM_KEY_SuperMask) state |= __current_super_mask; + if (scimkeymask & SCIM_KEY_HyperMask) state |= __current_hyper_mask; + if (scimkeymask & SCIM_KEY_NumLockMask) state |= __current_numlock_mask; + + return state; +} + +static XKeyEvent createKeyEvent (Display *display, Window &win, + Window &winRoot, bool press, + int keycode, int modifiers) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + XKeyEvent event; + + event.display = display; + event.window = win; + event.root = winRoot; + event.subwindow = None; + event.time = CurrentTime; + event.x = 1; + event.y = 1; + event.x_root = 1; + event.y_root = 1; + event.same_screen = EINA_TRUE; + event.state = modifiers; + event.keycode = XKeysymToKeycode (display, keycode); + if (press) + event.type = KeyPress; + else + event.type = KeyRelease; + event.send_event = EINA_FALSE; + event.serial = 0; + + return event; +} + +static void _x_send_key_event (const KeyEvent &key) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + // Obtain the X11 display. + Display *display = XOpenDisplay (NULL); + if (display == NULL) + { + std::cerr << "XOpenDisplay failed\n"; + return; + } + + // Get the root window for the current display. + Window winRoot = 0;// = XRootWindow (display, 1); + + // Find the window which has the current keyboard focus. + Window winFocus = 0; + int revert = RevertToParent; + + XGetInputFocus (display, &winFocus, &revert); + + // Send a fake key press event to the window. + XSelectInput (display, winFocus, FocusChangeMask|KeyPressMask|KeyReleaseMask); + XMapWindow (display, winFocus); + + unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask); + XKeyEvent event; + if (key.is_key_press ()) + { + 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); + } + + XCloseDisplay (display); +} + +static void +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_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_commit_string ( + slot (slot_commit_string)); + + si->signal_connect_forward_key_event ( + slot (slot_forward_key_event)); + + si->signal_connect_register_properties ( + slot (slot_register_properties)); + + si->signal_connect_update_property ( + slot (slot_update_property)); + + si->signal_connect_beep ( + slot (slot_beep)); + + si->signal_connect_start_helper ( + slot (slot_start_helper)); + + si->signal_connect_stop_helper ( + slot (slot_stop_helper)); + + 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_delete_surrounding_text ( + slot (slot_delete_surrounding_text)); +} + +// Implementation of slot functions +static void +slot_show_preedit_string (IMEngineInstanceBase *si) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + { + if (ic->impl->use_preedit) + { + if (!ic->impl->preedit_started) + { + 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); + } +} + +static void +slot_show_aux_string (IMEngineInstanceBase *si) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.show_aux_string (ic->id); +} + +static void +slot_show_lookup_table (IMEngineInstanceBase *si) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.show_lookup_table (ic->id); +} + +static void +slot_hide_preedit_string (IMEngineInstanceBase *si) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + { + bool emit = false; + if (ic->impl->preedit_string.length ()) + { + ic->impl->preedit_string = WideString (); + ic->impl->preedit_caret = 0; + 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_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_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); + ic->impl->preedit_started = false; + } + } + else + _panel_client.hide_preedit_string (ic->id); + } +} + +static void +slot_hide_aux_string (IMEngineInstanceBase *si) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.hide_aux_string (ic->id); +} + +static void +slot_hide_lookup_table (IMEngineInstanceBase *si) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.hide_lookup_table (ic->id); +} + +static void +slot_update_preedit_caret (IMEngineInstanceBase *si, int caret) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic && ic->impl->preedit_caret != caret) + { + ic->impl->preedit_caret = caret; + if (ic->impl->use_preedit) + { + if (!ic->impl->preedit_started) + { + 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_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); + } + else + _panel_client.update_preedit_caret (ic->id, caret); + } +} + +static void +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 ()); + + if (ic && ic->impl && _focused_ic == ic && (ic->impl->preedit_string != str || str.length ())) + { + ic->impl->preedit_string = str; + ic->impl->preedit_attrlist = attrs; + if (ic->impl->use_preedit) + { + if (!ic->impl->preedit_started) + { + 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_updating = true; + 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); + } + } +} + +static void +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 ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.update_aux_string (ic->id, str, attrs); +} + +static void +slot_commit_string (IMEngineInstanceBase *si, + const WideString & str) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + 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_event_callback_call(ic->ctx, ECORE_IMF_CALLBACK_COMMIT, (void *)utf8_wcstombs(str).c_str()); + } +} + +static void +slot_forward_key_event (IMEngineInstanceBase *si, + const KeyEvent & key) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && _focused_ic == ic) + { + if (!_fallback_instance->process_key_event (key)) + _x_send_key_event(key); + } +} + +static void +slot_update_lookup_table (IMEngineInstanceBase *si, + const LookupTable & table) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.update_lookup_table (ic->id, table); +} + +static void +slot_register_properties (IMEngineInstanceBase *si, + const PropertyList & properties) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.register_properties (ic->id, properties); +} + +static void +slot_update_property (IMEngineInstanceBase *si, + const Property & property) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + _panel_client.update_property (ic->id, property); +} + +static void +slot_beep (IMEngineInstanceBase *si __UNUSED__) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; +} + +static void +slot_start_helper (IMEngineInstanceBase *si, + const String &helper_uuid) +{ + 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"; + + if (ic && ic->impl) + _panel_client.start_helper (ic->id, helper_uuid); +} + +static void +slot_stop_helper (IMEngineInstanceBase *si, + const String &helper_uuid) +{ + 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); +} + +static void +slot_send_helper_event (IMEngineInstanceBase *si, + const String &helper_uuid, + const Transaction &trans) +{ + 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"; + + if (ic && ic->impl) + _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) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + 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)) + { + 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 (); + text = before + after; + cursor = before.length (); + return true; + } + } + return false; +} + +static bool +slot_delete_surrounding_text (IMEngineInstanceBase *si, + int offset, + int len) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + EcoreIMFContextISF *ic = static_cast (si->get_frontend_data ()); + + if (ic && ic->impl && _focused_ic == ic) + { + Ecore_IMF_Event_Delete_Surrounding ev; + 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_event_callback_call(_focused_ic->ctx, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, &ev); + return true; + } + return false; +} + +static void +reload_config_callback (const ConfigPointer &config) +{ + SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n"; + + _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"))); + + _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); + + // Get keyboard layout setting + // Flush the global config first, in order to load the new configs from disk. + scim_global_config_flush (); + + _keyboard_layout = scim_get_default_keyboard_layout (); +} + +static void +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_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 new file mode 100644 index 0000000..84f1a2f --- /dev/null +++ b/libraries/ecore/src/modules/immodules/scim/scim_imcontext.h @@ -0,0 +1,40 @@ +#ifndef __ISF_IMF_CONTEXT_H +#define __ISF_IMF_CONTEXT_H + +#include + +typedef struct _EcoreIMFContextISF EcoreIMFContextISF; +typedef struct _EcoreIMFContextISFImpl EcoreIMFContextISFImpl; + +struct _EcoreIMFContextISF { + Ecore_IMF_Context *ctx; + + EcoreIMFContextISFImpl *impl; + + int id; /* Input Context id*/ + struct _EcoreIMFContextISF *next; +}; + +void isf_imf_context_add (Ecore_IMF_Context *ctx); +void isf_imf_context_del (Ecore_IMF_Context *ctx); +void isf_imf_context_client_window_set (Ecore_IMF_Context *ctx, void *window); +void isf_imf_context_client_canvas_set (Ecore_IMF_Context *ctx, void *window); +void isf_imf_context_focus_in (Ecore_IMF_Context *ctx); +void isf_imf_context_focus_out (Ecore_IMF_Context *ctx); +void isf_imf_context_reset (Ecore_IMF_Context *ctx); +void isf_imf_context_cursor_position_set (Ecore_IMF_Context *ctx, int cursor_pos); +void isf_imf_context_cursor_location_set (Ecore_IMF_Context *ctx, int x, int y, int w, int h); +void isf_imf_context_input_mode_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); +void isf_imf_context_preedit_string_get (Ecore_IMF_Context *ctx, char** str, int *cursor_pos); +void isf_imf_context_preedit_string_with_attributes_get (Ecore_IMF_Context *ctx, char** str, Eina_List **attrs, int *cursor_pos); +void isf_imf_context_use_preedit_set (Ecore_IMF_Context* ctx, Eina_Bool use_preedit); +Eina_Bool isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *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); + +EcoreIMFContextISF* isf_imf_context_new (void); +void isf_imf_context_shutdown (void); + +#endif /* __ISF_IMF_CONTEXT_H */ + diff --git a/libraries/ecore/src/modules/immodules/scim/scim_module.cpp b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp new file mode 100644 index 0000000..eff6381 --- /dev/null +++ b/libraries/ecore/src/modules/immodules/scim/scim_module.cpp @@ -0,0 +1,93 @@ +#include +#include "scim_imcontext.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + static const Ecore_IMF_Context_Info isf_imf_info = { + "scim", /* ID */ + "SCIM immodule for Ecore", /* Description */ + "*", /* Default locales */ + NULL, /* Canvas type */ + 0 /* Canvas required */ + }; + + static Ecore_IMF_Context_Class isf_imf_class = { + isf_imf_context_add, /* add */ + 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_preedit_string_get, /* get_preedit_string */ + isf_imf_context_focus_in, /* focus_in */ + isf_imf_context_focus_out, /* focus_out */ + isf_imf_context_reset, /* reset */ + isf_imf_context_cursor_position_set, /* cursor_position_set */ + isf_imf_context_use_preedit_set, /* use_preedit_set */ + isf_imf_context_input_mode_set, /* input_mode_set */ + isf_imf_context_filter_event, /* filter_event */ + isf_imf_context_preedit_string_with_attributes_get, /* preedit_string_with_attribute_get */ + isf_imf_context_prediction_allow_set, /* prediction_allow_set */ + isf_imf_context_autocapital_type_set, /* autocapital_type_set */ + NULL, /* control panel show */ + NULL, /* control panel hide */ + NULL, /* input_panel_layout_set */ + 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 */ + }; + + static Ecore_IMF_Context *imf_module_create (void); + static Ecore_IMF_Context *imf_module_exit (void); + + static Eina_Bool imf_module_init (void) + { + ecore_imf_module_register (&isf_imf_info, imf_module_create, imf_module_exit); + return EINA_TRUE; + } + + static void imf_module_shutdown (void) + { + isf_imf_context_shutdown (); + } + + static Ecore_IMF_Context *imf_module_create (void) + { + Ecore_IMF_Context *ctx = NULL; + EcoreIMFContextISF *ctxd = NULL; + + ctxd = isf_imf_context_new (); + if (!ctxd) + { + printf ("isf_imf_context_new () failed!!!\n"); + return NULL; + } + + ctx = ecore_imf_context_new (&isf_imf_class); + if (!ctx) + { + delete ctxd; + return NULL; + } + + ecore_imf_context_data_set (ctx, ctxd); + + return ctx; + } + + static Ecore_IMF_Context *imf_module_exit (void) + { + return NULL; + } + + EINA_MODULE_INIT(imf_module_init); + EINA_MODULE_SHUTDOWN(imf_module_shutdown); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.in b/libraries/ecore/src/modules/immodules/xim/Makefile.in index ec58d4b..5b78946 100644 --- a/libraries/ecore/src/modules/immodules/xim/Makefile.in +++ b/libraries/ecore/src/modules/immodules/xim/Makefile.in @@ -244,10 +244,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -266,6 +266,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -379,6 +383,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -391,6 +397,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -435,12 +443,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c index 7c40606..ea7ee7f 100644 --- a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c +++ b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include @@ -12,9 +16,6 @@ #include #include #include -#ifdef HAVE_CONFIG_H -# include -#endif #define CLAMP(x, low, high) (x > high) ? high : (x < low) ? low : x #define _(x) x @@ -23,6 +24,8 @@ static Eina_List *open_ims = NULL; #endif +#define FEEDBACK_MASK (XIMReverse | XIMUnderline | XIMHighlight) + typedef struct _XIM_Im_Info XIM_Im_Info; struct _XIM_Im_Info { @@ -51,6 +54,7 @@ struct _Ecore_IMF_Context_Data Eina_Bool finalizing; Eina_Bool has_focus; Eina_Bool in_toplevel; + XIMFeedback *feedbacks; XIMCallback preedit_start_cb; XIMCallback preedit_done_cb; @@ -63,40 +67,62 @@ Ecore_IMF_Context_Data *imf_context_data_new(); void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data); #ifdef ENABLE_XIM -static void reinitialize_ic(Ecore_IMF_Context *ctx); -static void reinitialize_all_ics(XIM_Im_Info *info); -static void set_ic_client_window(Ecore_IMF_Context *ctx, - Ecore_X_Window window); -static int preedit_start_callback(XIC xic, - XPointer client_data, - XPointer call_data); -static void preedit_done_callback(XIC xic, - XPointer client_data, - XPointer call_data); -static int xim_text_to_utf8(Ecore_IMF_Context *ctx, - XIMText *xim_text, - char **text); -static void preedit_draw_callback(XIC xic, - XPointer client_data, - XIMPreeditDrawCallbackStruct *call_data); -static void preedit_caret_callback(XIC xic, - XPointer client_data, - XIMPreeditCaretCallbackStruct *call_data); +static void add_feedback_attr(Eina_List **attrs, + const char *str, + XIMFeedback feedback, + int start_pos, + int end_pos); + +static void reinitialize_ic(Ecore_IMF_Context *ctx); +static void reinitialize_all_ics(XIM_Im_Info *info); +static void set_ic_client_window(Ecore_IMF_Context *ctx, + Ecore_X_Window window); +static int preedit_start_callback(XIC xic, + XPointer client_data, + XPointer call_data); +static void preedit_done_callback(XIC xic, + XPointer client_data, + XPointer call_data); +static int xim_text_to_utf8(Ecore_IMF_Context *ctx, + XIMText *xim_text, + char **text); +static void preedit_draw_callback(XIC xic, + XPointer client_data, + XIMPreeditDrawCallbackStruct *call_data); +static void preedit_caret_callback(XIC xic, + XPointer client_data, + XIMPreeditCaretCallbackStruct *call_data); static XVaNestedList preedit_callback_set(Ecore_IMF_Context *ctx); static XIC get_ic(Ecore_IMF_Context *ctx); static XIM_Im_Info *get_im(Ecore_X_Window window, - char *locale); + char *locale); static void xim_info_try_im(XIM_Im_Info *info); static void xim_info_display_closed(Ecore_X_Display *display, - int is_error, - XIM_Im_Info *info); -static void xim_instantiate_callback(Display *display, - XPointer client_data, - XPointer call_data); -static void setup_im(XIM_Im_Info *info); -static void xim_destroy_callback(XIM xim, - XPointer client_data, - XPointer call_data); + int is_error, + XIM_Im_Info *info); +static void xim_instantiate_callback(Display *display, + XPointer client_data, + XPointer call_data); +static void setup_im(XIM_Im_Info *info); +static void xim_destroy_callback(XIM xim, + XPointer client_data, + XPointer call_data); +#endif + +#ifdef ENABLE_XIM +static unsigned int +utf8_offset_to_index(const char *str, int offset) +{ + int index = 0; + int i; + for (i = 0; i < offset; i++) + { + eina_unicode_utf8_get_next(str, &index); + } + + return index; +} + #endif static void @@ -107,7 +133,7 @@ _ecore_imf_context_xim_add(Ecore_IMF_Context *ctx) Ecore_IMF_Context_Data *imf_context_data = NULL; imf_context_data = imf_context_data_new(); - if(!imf_context_data) return; + if (!imf_context_data) return; imf_context_data->use_preedit = EINA_TRUE; imf_context_data->finalizing = EINA_FALSE; @@ -115,6 +141,8 @@ _ecore_imf_context_xim_add(Ecore_IMF_Context *ctx) imf_context_data->in_toplevel = EINA_FALSE; ecore_imf_context_data_set(ctx, imf_context_data); +#else + (void)ctx; #endif } @@ -127,48 +155,53 @@ _ecore_imf_context_xim_del(Ecore_IMF_Context *ctx) imf_context_data = ecore_imf_context_data_get(ctx); imf_context_data->finalizing = EINA_TRUE; - if(imf_context_data->im_info && !imf_context_data->im_info->ics->next) + if (imf_context_data->im_info && !imf_context_data->im_info->ics->next) { - if(imf_context_data->im_info->reconnecting == EINA_TRUE) + if (imf_context_data->im_info->reconnecting == EINA_TRUE) { Ecore_X_Display *dsp; dsp = ecore_x_display_get(); - XUnregisterIMInstantiateCallback (dsp, - NULL, NULL, NULL, - xim_instantiate_callback, - (XPointer)imf_context_data->im_info); + XUnregisterIMInstantiateCallback(dsp, + NULL, NULL, NULL, + xim_instantiate_callback, + (XPointer)imf_context_data->im_info); } - else if(imf_context_data->im_info->im) + else if (imf_context_data->im_info->im) { XIMCallback im_destroy_callback; im_destroy_callback.client_data = NULL; im_destroy_callback.callback = NULL; - XSetIMValues (imf_context_data->im_info->im, - XNDestroyCallback, &im_destroy_callback, - NULL); + XSetIMValues(imf_context_data->im_info->im, + XNDestroyCallback, &im_destroy_callback, + NULL); } } set_ic_client_window(ctx, 0); imf_context_data_destroy(imf_context_data); +#else + (void)ctx; #endif } static void _ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx, - void *window) + void *window) { EINA_LOG_DBG("in"); #ifdef ENABLE_XIM set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window)); +#else + (void)ctx; + (void)window; #endif } static void _ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx, - char **str, - int *cursor_pos) + char **str, + int *cursor_pos) { EINA_LOG_DBG("in"); #ifdef ENABLE_XIM @@ -180,25 +213,73 @@ _ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx, { utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars, &len); - if(str) - *str = utf8; + if (str) + *str = utf8; else - free(utf8); + free(utf8); } else { - if(str) - *str = NULL; - if(cursor_pos) - *cursor_pos = 0; + if (str) + *str = NULL; + if (cursor_pos) + *cursor_pos = 0; } - if(cursor_pos) + if (cursor_pos) *cursor_pos = imf_context_data->preedit_cursor; #else - if(str) + (void)ctx; + if (str) + *str = NULL; + if (cursor_pos) + *cursor_pos = 0; +#endif +} + +static void +_ecore_imf_context_xim_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, + char **str, + Eina_List **attrs, + int *cursor_pos) +{ + EINA_LOG_DBG("in"); + +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); + + _ecore_imf_context_xim_preedit_string_get(ctx, str, cursor_pos); + + if (!attrs) return; + if (!imf_context_data || !imf_context_data->feedbacks) return; + + int i = 0; + XIMFeedback last_feedback = 0; + int start = -1; + + for (i = 0; i < imf_context_data->preedit_length; i++) + { + XIMFeedback new_feedback = imf_context_data->feedbacks[i] & FEEDBACK_MASK; + + if (new_feedback != last_feedback) + { + if (start >= 0) + add_feedback_attr(attrs, *str, last_feedback, start, i); + + last_feedback = new_feedback; + start = i; + } + } + + if (start >= 0) + add_feedback_attr(attrs, *str, last_feedback, start, i); +#else + (void)ctx; + if (str) *str = NULL; - if(cursor_pos) + if (attrs) + *attrs = NULL; + if (cursor_pos) *cursor_pos = 0; #endif } @@ -213,7 +294,7 @@ _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(ic) + if (ic) { char *str; @@ -226,6 +307,8 @@ _ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx) XSetICFocus(ic); } +#else + (void)ctx; #endif } @@ -237,13 +320,15 @@ _ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx) XIC ic; Ecore_IMF_Context_Data *imf_context_data; imf_context_data = ecore_imf_context_data_get(ctx); - if(imf_context_data->has_focus == EINA_TRUE) + if (imf_context_data->has_focus == EINA_TRUE) { imf_context_data->has_focus = EINA_FALSE; ic = imf_context_data->ic; - if(ic) + if (ic) XUnsetICFocus(ic); } +#else + (void)ctx; #endif } @@ -263,18 +348,18 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx) imf_context_data = ecore_imf_context_data_get(ctx); ic = imf_context_data->ic; - if(!ic) + if (!ic) return; - if(imf_context_data->preedit_length == 0) + if (imf_context_data->preedit_length == 0) return; preedit_attr = XVaCreateNestedList(0, XNPreeditState, &preedit_state, NULL); - if(!XGetICValues(ic, - XNPreeditAttributes, preedit_attr, - NULL)) + if (!XGetICValues(ic, + XNPreeditAttributes, preedit_attr, + NULL)) have_preedit_state = EINA_TRUE; XFree(preedit_attr); @@ -284,38 +369,49 @@ _ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx) preedit_attr = XVaCreateNestedList(0, XNPreeditState, preedit_state, NULL); - if(have_preedit_state) + if (have_preedit_state) XSetICValues(ic, XNPreeditAttributes, preedit_attr, NULL); XFree(preedit_attr); - if(imf_context_data->preedit_length) + if (imf_context_data->feedbacks) + { + free(imf_context_data->feedbacks); + imf_context_data->feedbacks = NULL; + } + + if (imf_context_data->preedit_length) { imf_context_data->preedit_length = 0; free(imf_context_data->preedit_chars); imf_context_data->preedit_chars = NULL; + ecore_imf_context_preedit_changed_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } - if(result) + if (result) { - char *result_utf8 = strdup(result); - if(result_utf8) - { - ecore_imf_context_commit_event_add(ctx, result_utf8); - free(result_utf8); - } + char *result_utf8 = strdup(result); + if (result_utf8) + { + ecore_imf_context_commit_event_add(ctx, result_utf8); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, result_utf8); + free(result_utf8); + } } - XFree (result); + XFree(result); +#else + (void)ctx; #endif } static void _ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx, - Eina_Bool use_preedit) + Eina_Bool use_preedit) { EINA_LOG_DBG("in"); #ifdef ENABLE_XIM @@ -324,17 +420,53 @@ _ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx, use_preedit = use_preedit != EINA_FALSE; - if(imf_context_data->use_preedit != use_preedit) + if (imf_context_data->use_preedit != use_preedit) { imf_context_data->use_preedit = use_preedit; reinitialize_ic(ctx); } +#else + (void)ctx; + (void)use_preedit; #endif } +#ifdef ENABLE_XIM +static void +add_feedback_attr(Eina_List **attrs, + const char *str, + XIMFeedback feedback, + int start_pos, + int end_pos) +{ + Ecore_IMF_Preedit_Attr *attr = NULL; + + unsigned int start_index = utf8_offset_to_index(str, start_pos); + unsigned int end_index = utf8_offset_to_index(str, end_pos); + + if (feedback & FEEDBACK_MASK) + { + attr = (Ecore_IMF_Preedit_Attr *)calloc(1, sizeof(Ecore_IMF_Preedit_Attr)); + attr->start_index = start_index; + attr->end_index = end_index; + *attrs = eina_list_append(*attrs, (void *)attr); + } + + if (feedback & XIMUnderline) + attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB1; + + if (feedback & XIMReverse) + attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2; + + if (feedback & XIMHighlight) + attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB3; +} + +#endif + static void -_ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx, - int x, int y, int w, int h) +_ecore_imf_context_xim_cursor_location_set(Ecore_IMF_Context *ctx, + int x, int y, int w, int h) { EINA_LOG_DBG("%s in", __FUNCTION__); @@ -342,7 +474,7 @@ _ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx, Ecore_IMF_Context_Data *imf_context_data; XIC ic; XVaNestedList preedit_attr; - XPoint spot; + XPoint spot; imf_context_data = ecore_imf_context_data_get(ctx); ic = imf_context_data->ic; @@ -351,15 +483,20 @@ _ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx, spot.x = x; spot.y = y + h; - - preedit_attr = XVaCreateNestedList (0, - XNSpotLocation, &spot, - NULL); - XSetICValues (ic, - XNPreeditAttributes, preedit_attr, - NULL); + + preedit_attr = XVaCreateNestedList(0, + XNSpotLocation, &spot, + NULL); + XSetICValues(ic, + XNPreeditAttributes, preedit_attr, + NULL); XFree(preedit_attr); +#else + (void)ctx; + (void)x; + (void)y; + (void)h; #endif (void)(w); // yes w is unused, but only a bi-product of the algorithm } @@ -371,19 +508,19 @@ _ecore_x_event_reverse_modifiers(unsigned int state) unsigned int modifiers = 0; /**< "Control" is pressed */ - if(state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) + if (state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) modifiers |= ControlMask; /**< "Alt" is pressed */ - if(state & ECORE_IMF_KEYBOARD_MODIFIER_ALT) + if (state & ECORE_IMF_KEYBOARD_MODIFIER_ALT) modifiers |= Mod1Mask; /**< "Shift" is pressed */ - if(state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) + if (state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) modifiers |= ShiftMask; /**< "Win" (between "Ctrl" and "A */ - if(state & ECORE_IMF_KEYBOARD_MODIFIER_WIN) + if (state & ECORE_IMF_KEYBOARD_MODIFIER_WIN) modifiers |= Mod5Mask; return modifiers; @@ -395,14 +532,14 @@ _ecore_x_event_reverse_locks(unsigned int state) unsigned int locks = 0; /**< "Num" lock is active */ - if(state & ECORE_IMF_KEYBOARD_LOCK_NUM) + if (state & ECORE_IMF_KEYBOARD_LOCK_NUM) locks |= Mod3Mask; - if(state & ECORE_IMF_KEYBOARD_LOCK_CAPS) + if (state & ECORE_IMF_KEYBOARD_LOCK_CAPS) locks |= LockMask; -#if 0 /* FIXME: add mask. */ - if(state & ECORE_IMF_KEYBOARD_LOCK_SCROLL) +#if 0 /* FIXME: add mask. */ + if (state & ECORE_IMF_KEYBOARD_LOCK_SCROLL) ; #endif @@ -411,12 +548,12 @@ _ecore_x_event_reverse_locks(unsigned int state) static KeyCode _keycode_get(Ecore_X_Display *dsp, - const char *keyname) + const char *keyname) { KeyCode keycode; // EINA_LOG_DBG("keyname:%s keysym:%lu", keyname, XStringToKeysym(keyname)); - if(strcmp(keyname, "Keycode-0") == 0) + if (strcmp(keyname, "Keycode-0") == 0) { keycode = 0; } @@ -430,9 +567,9 @@ _keycode_get(Ecore_X_Display *dsp, #endif static Eina_Bool -_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, +_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, - Ecore_IMF_Event *event) + Ecore_IMF_Event *event) { EINA_LOG_DBG("%s in", __FUNCTION__); #ifdef ENABLE_XIM @@ -451,12 +588,12 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, imf_context_data = ecore_imf_context_data_get(ctx); ic = imf_context_data->ic; - if(!ic) + if (!ic) { ic = get_ic(ctx); } - if(type == ECORE_IMF_EVENT_KEY_DOWN) + if (type == ECORE_IMF_EVENT_KEY_DOWN) { XKeyPressedEvent xev; Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; @@ -481,7 +618,7 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, xev.keycode = _keycode_get(dsp, ev->keyname); xev.same_screen = True; - if(ic) + if (ic) { Status mbstatus; #ifdef X_HAVE_UTF8_STRING @@ -563,15 +700,16 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, } } - if(compose) + if (compose) { Eina_Unicode *unicode; int len; unicode = eina_unicode_utf8_to_unicode(compose, &len); - if(!unicode) abort(); - if(unicode[0] >= 0x20 && unicode[0] != 0x7f) + if (!unicode) abort(); + if (unicode[0] >= 0x20 && unicode[0] != 0x7f) { ecore_imf_context_commit_event_add(ctx, compose); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_COMMIT, compose); result = EINA_TRUE; } free(compose); @@ -581,6 +719,9 @@ _ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, return result; #else + (void)ctx; + (void)type; + (void)event; return EINA_FALSE; #endif } @@ -608,7 +749,7 @@ static Ecore_IMF_Context_Class xim_class = { .use_preedit_set = _ecore_imf_context_xim_use_preedit_set, .input_mode_set = NULL, .filter_event = _ecore_imf_context_xim_filter_event, - .preedit_string_with_attributes_get = NULL, + .preedit_string_with_attributes_get = _ecore_imf_context_xim_preedit_string_with_attributes_get, .prediction_allow_set = NULL, .autocapital_type_set = NULL, .control_panel_show = NULL, @@ -627,7 +768,7 @@ xim_imf_module_create(void) Ecore_IMF_Context *ctx = NULL; ctx = ecore_imf_context_new(&xim_class); - if(!ctx) + if (!ctx) goto error; return ctx; @@ -686,15 +827,15 @@ imf_context_data_new() char *locale; locale = setlocale(LC_CTYPE, ""); - if(!locale) return NULL; + if (!locale) return NULL; - if(!XSupportsLocale()) return NULL; + if (!XSupportsLocale()) return NULL; imf_context_data = calloc(1, sizeof(Ecore_IMF_Context_Data)); - if(!imf_context_data) return NULL; + if (!imf_context_data) return NULL; imf_context_data->locale = strdup(locale); - if(!imf_context_data->locale) goto error; + if (!imf_context_data->locale) goto error; return imf_context_data; error: @@ -705,19 +846,26 @@ error: void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data) { - if(!imf_context_data) + if (!imf_context_data) return; - if(imf_context_data->ic) + if (imf_context_data->ic) XDestroyIC(imf_context_data->ic); free(imf_context_data->preedit_chars); + + if (imf_context_data->feedbacks) + { + free(imf_context_data->feedbacks); + imf_context_data->feedbacks = NULL; + } + free(imf_context_data->locale); free(imf_context_data); } static int -preedit_start_callback(XIC xic __UNUSED__, +preedit_start_callback(XIC xic __UNUSED__, XPointer client_data, XPointer call_data __UNUSED__) { @@ -726,14 +874,16 @@ preedit_start_callback(XIC xic __UNUSED__, Ecore_IMF_Context_Data *imf_context_data; imf_context_data = ecore_imf_context_data_get(ctx); - if(imf_context_data->finalizing == EINA_FALSE) - ecore_imf_context_preedit_start_event_add(ctx); - + if (imf_context_data->finalizing == EINA_FALSE) + { + ecore_imf_context_preedit_start_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_START, NULL); + } return -1; } static void -preedit_done_callback(XIC xic __UNUSED__, +preedit_done_callback(XIC xic __UNUSED__, XPointer client_data, XPointer call_data __UNUSED__) { @@ -742,30 +892,34 @@ preedit_done_callback(XIC xic __UNUSED__, Ecore_IMF_Context_Data *imf_context_data; imf_context_data = ecore_imf_context_data_get(ctx); - if(imf_context_data->preedit_length) + if (imf_context_data->preedit_length) { imf_context_data->preedit_length = 0; free(imf_context_data->preedit_chars); imf_context_data->preedit_chars = NULL; ecore_imf_context_preedit_changed_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } - if(imf_context_data->finalizing == EINA_FALSE) - ecore_imf_context_preedit_end_event_add(ctx); + if (imf_context_data->finalizing == EINA_FALSE) + { + ecore_imf_context_preedit_end_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_END, NULL); + } } /* FIXME */ static int xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__, - XIMText *xim_text, - char **text) + XIMText *xim_text, + char **text) { int text_length = 0; char *result = NULL; - if(xim_text && xim_text->string.multi_byte) + if (xim_text && xim_text->string.multi_byte) { - if(xim_text->encoding_is_wchar) + if (xim_text->encoding_is_wchar) { EINA_LOG_WARN("Wide character return from Xlib not currently supported"); *text = NULL; @@ -774,7 +928,7 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__, /* XXX Convert to UTF-8 */ result = strdup(xim_text->string.multi_byte); - if(result) + if (result) { text_length = eina_unicode_utf8_get_len(result); if (text_length != xim_text->length) @@ -798,8 +952,8 @@ xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__, } static void -preedit_draw_callback(XIC xic __UNUSED__, - XPointer client_data, +preedit_draw_callback(XIC xic __UNUSED__, + XPointer client_data, XIMPreeditDrawCallbackStruct *call_data) { EINA_LOG_DBG("in"); @@ -811,59 +965,83 @@ preedit_draw_callback(XIC xic __UNUSED__, Eina_Unicode *new_text = NULL; Eina_UStrbuf *preedit_bufs = NULL; int new_text_length; + int i = 0; preedit_bufs = eina_ustrbuf_new(); - if(imf_context_data->preedit_chars) { - ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars); - if(ret == EINA_FALSE) goto done; - } + if (imf_context_data->preedit_chars) + { + ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars); + if (ret == EINA_FALSE) goto done; + } new_text_length = xim_text_to_utf8(ctx, t, &tmp); - if(tmp) + if (tmp) { int tmp_len; new_text = eina_unicode_utf8_to_unicode((const char *)tmp, &tmp_len); free(tmp); } - if(t == NULL) { - /* delete string */ - ret = eina_ustrbuf_remove(preedit_bufs, - call_data->chg_first, call_data->chg_length); - } else if(call_data->chg_length == 0) { - /* insert string */ - ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first); - } else if(call_data->chg_length > 0) { - /* replace string */ - ret = eina_ustrbuf_remove(preedit_bufs, - call_data->chg_first, call_data->chg_length); - if(ret == EINA_FALSE) goto done; - - ret = eina_ustrbuf_insert_n(preedit_bufs, new_text, - new_text_length, call_data->chg_first); - if(ret == EINA_FALSE) goto done; - } else { - ret = EINA_FALSE; - } - - done: - if(ret == EINA_TRUE) { - free(imf_context_data->preedit_chars); - imf_context_data->preedit_chars = + if (t == NULL) + { + /* delete string */ + ret = eina_ustrbuf_remove(preedit_bufs, + call_data->chg_first, call_data->chg_length); + } + else if (call_data->chg_length == 0) + { + /* insert string */ + ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first); + } + else if (call_data->chg_length > 0) + { + /* replace string */ + ret = eina_ustrbuf_remove(preedit_bufs, + call_data->chg_first, call_data->chg_length); + if (ret == EINA_FALSE) goto done; + + ret = eina_ustrbuf_insert_n(preedit_bufs, new_text, + new_text_length, call_data->chg_first); + if (ret == EINA_FALSE) goto done; + } + else { + ret = EINA_FALSE; + } + +done: + if (ret == EINA_TRUE) + { + free(imf_context_data->preedit_chars); + imf_context_data->preedit_chars = eina_ustrbuf_string_steal(preedit_bufs); - imf_context_data->preedit_length = + imf_context_data->preedit_length = eina_unicode_strlen(imf_context_data->preedit_chars); - ecore_imf_context_preedit_changed_event_add(ctx); - } + if (imf_context_data->feedbacks) + { + free(imf_context_data->feedbacks); + imf_context_data->feedbacks = NULL; + } + + if (imf_context_data->preedit_length > 0) + { + imf_context_data->feedbacks = calloc(imf_context_data->preedit_length, sizeof(XIMFeedback)); + + for (i = 0; i < imf_context_data->preedit_length; i++) + imf_context_data->feedbacks[i] = t->feedback[i]; + } + + ecore_imf_context_preedit_changed_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); + } free(new_text); eina_ustrbuf_free(preedit_bufs); } static void -preedit_caret_callback(XIC xic __UNUSED__, - XPointer client_data, +preedit_caret_callback(XIC xic __UNUSED__, + XPointer client_data, XIMPreeditCaretCallbackStruct *call_data) { EINA_LOG_DBG("in"); @@ -871,12 +1049,15 @@ preedit_caret_callback(XIC xic __UNUSED__, Ecore_IMF_Context_Data *imf_context_data; imf_context_data = ecore_imf_context_data_get(ctx); - if(call_data->direction == XIMAbsolutePosition) + if (call_data->direction == XIMAbsolutePosition) { // printf("call_data->position:%d\n", call_data->position); - imf_context_data->preedit_cursor = call_data->position; - if(imf_context_data->finalizing == EINA_FALSE) - ecore_imf_context_preedit_changed_event_add(ctx); + imf_context_data->preedit_cursor = call_data->position; + if (imf_context_data->finalizing == EINA_FALSE) + { + ecore_imf_context_preedit_changed_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); + } } } @@ -917,7 +1098,7 @@ get_ic(Ecore_IMF_Context *ctx) XIC ic; imf_context_data = ecore_imf_context_data_get(ctx); ic = imf_context_data->ic; - if(!ic) + if (!ic) { XIM_Im_Info *im_info = imf_context_data->im_info; XVaNestedList preedit_attr = NULL; @@ -930,7 +1111,7 @@ get_ic(Ecore_IMF_Context *ctx) EINA_LOG_WARN("Doesn't open XIM."); return NULL; } - + // supported styles #if 0 int i; @@ -940,23 +1121,23 @@ get_ic(Ecore_IMF_Context *ctx) { printf("%i: ", i); if (im_info->xim_styles->supported_styles[i] & XIMPreeditCallbacks) - printf("XIMPreeditCallbacks | "); + printf("XIMPreeditCallbacks | "); if (im_info->xim_styles->supported_styles[i] & XIMPreeditPosition) - printf("XIMPreeditPosition | "); + printf("XIMPreeditPosition | "); if (im_info->xim_styles->supported_styles[i] & XIMPreeditArea) - printf("XIMPreeditArea | "); + printf("XIMPreeditArea | "); if (im_info->xim_styles->supported_styles[i] & XIMPreeditNothing) - printf("XIMPreeditNothing | "); + printf("XIMPreeditNothing | "); if (im_info->xim_styles->supported_styles[i] & XIMPreeditNone) - printf("XIMPreeditNone | "); + printf("XIMPreeditNone | "); if (im_info->xim_styles->supported_styles[i] & XIMStatusArea) - printf("XIMStatusArea | "); + printf("XIMStatusArea | "); if (im_info->xim_styles->supported_styles[i] & XIMStatusCallbacks) - printf("XIMStatusCallbacks | "); + printf("XIMStatusCallbacks | "); if (im_info->xim_styles->supported_styles[i] & XIMStatusNothing) - printf("XIMStatusNothing | "); + printf("XIMStatusNothing | "); if (im_info->xim_styles->supported_styles[i] & XIMStatusNone) - printf("XIMStatusNone | "); + printf("XIMStatusNone | "); printf("\n"); } } @@ -969,12 +1150,12 @@ get_ic(Ecore_IMF_Context *ctx) { if (im_info->supports_cursor) { - // kinput2 DOES do this... + // kinput2 DOES do this... XFontSet fs; char **missing_charset_list; int missing_charset_count; char *def_string; - + im_style |= XIMPreeditPosition; im_style |= XIMStatusNothing; fs = XCreateFontSet(ecore_x_display_get(), @@ -995,7 +1176,7 @@ get_ic(Ecore_IMF_Context *ctx) } name = XNPreeditAttributes; } - else + else { im_style |= XIMPreeditNothing; im_style |= XIMStatusNothing; @@ -1009,18 +1190,18 @@ get_ic(Ecore_IMF_Context *ctx) name, preedit_attr, NULL); } XFree(preedit_attr); - if(ic) + if (ic) { unsigned long mask = 0xaaaaaaaa; - XGetICValues (ic, - XNFilterEvents, &mask, - NULL); + XGetICValues(ic, + XNFilterEvents, &mask, + NULL); imf_context_data->mask = mask; ecore_x_event_mask_set(imf_context_data->win, mask); } imf_context_data->ic = ic; - if(ic && imf_context_data->has_focus == EINA_TRUE) + if (ic && imf_context_data->has_focus == EINA_TRUE) XSetICFocus(ic); } @@ -1032,16 +1213,17 @@ reinitialize_ic(Ecore_IMF_Context *ctx) { Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); XIC ic = imf_context_data->ic; - if(ic) + if (ic) { XDestroyIC(ic); imf_context_data->ic = NULL; - if(imf_context_data->preedit_length) + if (imf_context_data->preedit_length) { imf_context_data->preedit_length = 0; free(imf_context_data->preedit_chars); imf_context_data->preedit_chars = NULL; ecore_imf_context_preedit_changed_event_add(ctx); + ecore_imf_context_event_callback_call(ctx, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, NULL); } } } @@ -1052,13 +1234,13 @@ reinitialize_all_ics(XIM_Im_Info *info) Eina_List *tmp_list; Ecore_IMF_Context *ctx; - EINA_LIST_FOREACH(info->ics, tmp_list, ctx) + EINA_LIST_FOREACH (info->ics, tmp_list, ctx) reinitialize_ic(ctx); } static void set_ic_client_window(Ecore_IMF_Context *ctx, - Ecore_X_Window window) + Ecore_X_Window window) { EINA_LOG_DBG("in"); Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); @@ -1069,7 +1251,7 @@ set_ic_client_window(Ecore_IMF_Context *ctx, old_win = imf_context_data->win; EINA_LOG_DBG("old_win:%d window:%d ", old_win, window); - if(old_win != 0 && old_win != window) /* XXX how do check window... */ + if (old_win != 0 && old_win != window) /* XXX how do check window... */ { XIM_Im_Info *info; info = imf_context_data->im_info; @@ -1079,7 +1261,7 @@ set_ic_client_window(Ecore_IMF_Context *ctx, imf_context_data->win = window; - if(window) /* XXX */ + if (window) /* XXX */ { XIM_Im_Info *info = NULL; info = get_im(window, imf_context_data->locale); @@ -1092,17 +1274,17 @@ set_ic_client_window(Ecore_IMF_Context *ctx, static XIM_Im_Info * get_im(Ecore_X_Window window, - char *locale) + char *locale) { EINA_LOG_DBG("in"); Eina_List *l; XIM_Im_Info *im_info = NULL; XIM_Im_Info *info = NULL; - EINA_LIST_FOREACH(open_ims, l, im_info) { - if(strcmp(im_info->locale, locale) == 0) + EINA_LIST_FOREACH (open_ims, l, im_info) { + if (strcmp(im_info->locale, locale) == 0) { - if(im_info->im) + if (im_info->im) { return im_info; } @@ -1113,10 +1295,10 @@ get_im(Ecore_X_Window window, } } - if(!info) + if (!info) { info = calloc(1, sizeof(XIM_Im_Info)); - if(!info) return NULL; + if (!info) return NULL; open_ims = eina_list_prepend(open_ims, info); info->win = window; info->locale = strdup(locale); @@ -1137,13 +1319,13 @@ xim_info_try_im(XIM_Im_Info *info) if (info->reconnecting == EINA_TRUE) return; - if(XSupportsLocale()) + if (XSupportsLocale()) { - if (!XSetLocaleModifiers ("")) + if (!XSetLocaleModifiers("")) EINA_LOG_WARN("Unable to set locale modifiers with XSetLocaleModifiers()"); dsp = ecore_x_display_get(); info->im = XOpenIM(dsp, NULL, NULL, NULL); - if(!info->im) + if (!info->im) { XRegisterIMInstantiateCallback(dsp, NULL, NULL, NULL, @@ -1158,8 +1340,8 @@ xim_info_try_im(XIM_Im_Info *info) static void xim_info_display_closed(Ecore_X_Display *display __UNUSED__, - int is_error __UNUSED__, - XIM_Im_Info *info) + int is_error __UNUSED__, + XIM_Im_Info *info) { Eina_List *ics, *tmp_list; Ecore_IMF_Context *ctx; @@ -1169,21 +1351,21 @@ xim_info_display_closed(Ecore_X_Display *display __UNUSED__, ics = info->ics; info->ics = NULL; - EINA_LIST_FOREACH(ics, tmp_list, ctx) + EINA_LIST_FOREACH (ics, tmp_list, ctx) set_ic_client_window(ctx, 0); - EINA_LIST_FREE(ics, ctx) { + EINA_LIST_FREE (ics, ctx) { Ecore_IMF_Context_Data *imf_context_data; imf_context_data = ecore_imf_context_data_get(ctx); imf_context_data_destroy(imf_context_data); } - free (info->locale); + free(info->locale); if (info->im) - XCloseIM (info->im); + XCloseIM(info->im); - free (info); + free(info); } static void @@ -1203,11 +1385,11 @@ xim_instantiate_callback(Display *display, } info->im = im; - setup_im (info); + setup_im(info); - XUnregisterIMInstantiateCallback (display, NULL, NULL, NULL, - xim_instantiate_callback, - (XPointer)info); + XUnregisterIMInstantiateCallback(display, NULL, NULL, NULL, + xim_instantiate_callback, + (XPointer)info); info->reconnecting = EINA_FALSE; } @@ -1217,7 +1399,7 @@ setup_im(XIM_Im_Info *info) XIMValuesList *ic_values = NULL; XIMCallback im_destroy_callback; - if(!info->im) + if (!info->im) return; im_destroy_callback.client_data = (XPointer)info; @@ -1239,25 +1421,25 @@ setup_im(XIM_Im_Info *info) { if (!strcmp(ic_values->supported_values[i], XNStringConversionCallback)) - info->supports_string_conversion = EINA_TRUE; + info->supports_string_conversion = EINA_TRUE; if (!strcmp(ic_values->supported_values[i], XNCursor)) - info->supports_cursor = EINA_TRUE; + info->supports_cursor = EINA_TRUE; } #if 0 printf("values........\n"); for (i = 0; i < ic_values->count_values; i++) - printf("%s\n", ic_values->supported_values[i]); + printf("%s\n", ic_values->supported_values[i]); printf("styles........\n"); for (i = 0; i < info->xim_styles->count_styles; i++) - printf("%lx\n", info->xim_styles->supported_styles[i]); + printf("%lx\n", info->xim_styles->supported_styles[i]); #endif XFree(ic_values); } } static void -xim_destroy_callback(XIM xim __UNUSED__, +xim_destroy_callback(XIM xim __UNUSED__, XPointer client_data, XPointer call_data __UNUSED__) { diff --git a/libraries/ecore/src/tests/Makefile.in b/libraries/ecore/src/tests/Makefile.in index a21773c..bd7726a 100644 --- a/libraries/ecore/src/tests/Makefile.in +++ b/libraries/ecore/src/tests/Makefile.in @@ -229,10 +229,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -251,6 +251,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -364,6 +368,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -376,6 +382,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -420,12 +428,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ diff --git a/libraries/ecore/src/util/Makefile.in b/libraries/ecore/src/util/Makefile.in index 0e1e6e7..96cb48a 100644 --- a/libraries/ecore/src/util/Makefile.in +++ b/libraries/ecore/src/util/Makefile.in @@ -218,10 +218,10 @@ 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@ +SCIM_LIBS = @SCIM_LIBS@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ @@ -240,6 +240,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ VMAJ = @VMAJ@ +WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ +WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ +WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ +WAYLAND_LIBS = @WAYLAND_LIBS@ WIN32_CFLAGS = @WIN32_CFLAGS@ WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ WIN32_LIBS = @WIN32_LIBS@ @@ -353,6 +357,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ ecore_imf_evas_libs = @ecore_imf_evas_libs@ ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ +ecore_imf_scim_libs = @ecore_imf_scim_libs@ ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ ecore_imf_xim_libs = @ecore_imf_xim_libs@ ecore_input_cflags = @ecore_input_cflags@ @@ -365,6 +371,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ ecore_psl1ght_libs = @ecore_psl1ght_libs@ ecore_sdl_cflags = @ecore_sdl_cflags@ ecore_sdl_libs = @ecore_sdl_libs@ +ecore_wayland_cflags = @ecore_wayland_cflags@ +ecore_wayland_libs = @ecore_wayland_libs@ ecore_win32_cflags = @ecore_win32_cflags@ ecore_win32_libs = @ecore_win32_libs@ ecore_wince_cflags = @ecore_wince_cflags@ @@ -409,12 +417,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ requirements_ecore_file = @requirements_ecore_file@ requirements_ecore_imf = @requirements_ecore_imf@ requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ requirements_ecore_input = @requirements_ecore_input@ requirements_ecore_input_evas = @requirements_ecore_input_evas@ requirements_ecore_ipc = @requirements_ecore_ipc@ requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_wayland = @requirements_ecore_wayland@ requirements_ecore_win32 = @requirements_ecore_win32@ requirements_ecore_wince = @requirements_ecore_wince@ requirements_ecore_x = @requirements_ecore_x@ -- cgit v1.1