From 7514fb4a81a44abac974ea0a67c0d8d42054fc72 Mon Sep 17 00:00:00 2001 From: Jaehwan Kim Date: Thu, 23 Jun 2011 19:35:13 +0900 Subject: [PATCH] svn update: 60286 (latest:60286) --- AUTHORS | 1 + ChangeLog | 106 ++++ NEWS | 38 ++ README.in | 8 + autogen.sh | 22 + configure.ac | 113 ++-- doc/.cvsignore | 3 - doc/{Doxyfile => Doxyfile.in} | 14 +- doc/Makefile.am | 8 +- doc/ecore.dox.in | 282 --------- src/.cvsignore | 2 - src/bin/.cvsignore | 10 - src/lib/.cvsignore | 2 - src/lib/ecore/.cvsignore | 6 - src/lib/ecore/Ecore.h | 328 +++++++++- src/lib/ecore/ecore.c | 2 +- src/lib/ecore/ecore_anim.c | 456 ++++++++++++-- src/lib/ecore/ecore_events.c | 2 +- src/lib/ecore/ecore_exe.c | 22 + src/lib/ecore/ecore_exe_win32.c | 6 +- src/lib/ecore/ecore_glib.c | 18 +- src/lib/ecore/ecore_job.c | 6 +- src/lib/ecore/ecore_main.c | 73 ++- src/lib/ecore/ecore_pipe.c | 175 +++++- src/lib/ecore/ecore_private.h | 1 + src/lib/ecore/ecore_thread.c | 26 +- src/lib/ecore/ecore_time.c | 27 +- src/lib/ecore/ecore_timer.c | 86 +++ src/lib/ecore_con/.cvsignore | 7 - src/lib/ecore_con/Ecore_Con.h | 14 +- src/lib/ecore_con/Makefile.am | 10 +- src/lib/ecore_con/ecore_con.c | 172 ++++-- src/lib/ecore_con/ecore_con_ares.c | 28 +- src/lib/ecore_con/ecore_con_info.c | 18 +- src/lib/ecore_con/ecore_con_local.c | 4 - src/lib/ecore_con/ecore_con_local_win32.c | 784 ++++++++++++++++++++++++ src/lib/ecore_con/ecore_con_private.h | 29 + src/lib/ecore_con/ecore_con_ssl.c | 14 +- src/lib/ecore_con/ecore_con_url.c | 54 +- src/lib/ecore_config/.cvsignore | 8 - src/lib/ecore_config/ecore_config.c | 14 +- src/lib/ecore_config/ecore_config_db.c | 30 +- src/lib/ecore_config/ecore_config_extra.c | 16 +- src/lib/ecore_config/ecore_config_ipc_ecore.c | 4 +- src/lib/ecore_config/ecore_config_ipc_main.c | 2 +- src/lib/ecore_config/ecore_config_storage.c | 2 +- src/lib/ecore_directfb/.cvsignore | 6 - src/lib/ecore_evas/.cvsignore | 6 - src/lib/ecore_evas/Ecore_Evas.h | 2 + src/lib/ecore_evas/Makefile.am | 13 +- src/lib/ecore_evas/ecore_evas.c | 108 ++-- src/lib/ecore_evas/ecore_evas_buffer.c | 122 ++-- src/lib/ecore_evas/ecore_evas_directfb.c | 11 +- src/lib/ecore_evas/ecore_evas_fb.c | 13 +- src/lib/ecore_evas/ecore_evas_private.h | 1 + src/lib/ecore_evas/ecore_evas_sdl.c | 15 +- src/lib/ecore_evas/ecore_evas_win32.c | 9 +- src/lib/ecore_evas/ecore_evas_wince.c | 7 +- src/lib/ecore_evas/ecore_evas_x.c | 93 +-- src/lib/ecore_fb/.cvsignore | 6 - src/lib/ecore_fb/ecore_fb.c | 8 +- src/lib/ecore_fb/ecore_fb_kbd.c | 174 +++--- src/lib/ecore_fb/ecore_fb_li.c | 2 +- src/lib/ecore_fb/ecore_fb_ps2.c | 20 +- src/lib/ecore_fb/ecore_fb_ts.c | 24 +- src/lib/ecore_fb/ecore_fb_vt.c | 28 +- src/lib/ecore_file/.cvsignore | 6 - src/lib/ecore_file/ecore_file.c | 22 +- src/lib/ecore_file/ecore_file_download.c | 4 +- src/lib/ecore_file/ecore_file_monitor_inotify.c | 18 +- src/lib/ecore_file/ecore_file_monitor_poll.c | 16 +- src/lib/ecore_file/ecore_file_path.c | 4 +- src/lib/ecore_imf/.cvsignore | 6 - src/lib/ecore_imf/Ecore_IMF.h | 52 +- src/lib/ecore_imf/ecore_imf_context.c | 108 +++- src/lib/ecore_imf/ecore_imf_private.h | 8 +- src/lib/ecore_imf_evas/.cvsignore | 6 - src/lib/ecore_input/ecore_input.c | 2 +- src/lib/ecore_input_evas/ecore_input_evas.c | 82 +-- src/lib/ecore_ipc/.cvsignore | 7 - src/lib/ecore_ipc/Ecore_Ipc.h | 18 +- src/lib/ecore_ipc/Makefile.am | 4 +- src/lib/ecore_ipc/ecore_ipc.c | 15 +- src/lib/ecore_ipc/ecore_ipc_private.h | 23 +- src/lib/ecore_sdl/.cvsignore | 6 - src/lib/ecore_win32/.cvsignore | 6 - src/lib/ecore_win32/Ecore_Win32.h | 26 +- src/lib/ecore_win32/ecore_win32.c | 8 +- src/lib/ecore_win32/ecore_win32_cursor.c | 2 +- src/lib/ecore_win32/ecore_win32_event.c | 40 +- src/lib/ecore_win32/ecore_win32_window.c | 368 +++++------ src/lib/ecore_wince/.cvsignore | 4 - src/lib/ecore_wince/Ecore_WinCE.h | 20 +- src/lib/ecore_wince/ecore_wince_window.c | 134 ++-- src/lib/ecore_x/.cvsignore | 6 - src/lib/ecore_x/Ecore_X.h | 261 +++++++- src/lib/ecore_x/xcb/.cvsignore | 6 - src/lib/ecore_x/xcb/ecore_xcb.c | 22 + src/lib/ecore_x/xlib/.cvsignore | 6 - src/lib/ecore_x/xlib/Makefile.am | 5 +- src/lib/ecore_x/xlib/ecore_x.c | 28 +- src/lib/ecore_x/xlib/ecore_x_composite.c | 2 +- src/lib/ecore_x/xlib/ecore_x_dnd.c | 2 +- src/lib/ecore_x/xlib/ecore_x_dpms.c | 6 +- src/lib/ecore_x/xlib/ecore_x_e.c | 6 +- src/lib/ecore_x/xlib/ecore_x_events.c | 61 +- src/lib/ecore_x/xlib/ecore_x_icccm.c | 2 +- src/lib/ecore_x/xlib/ecore_x_image.c | 16 +- src/lib/ecore_x/xlib/ecore_x_randr.c | 2 +- src/lib/ecore_x/xlib/ecore_x_randr_12.c | 140 ++++- src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c | 433 +++++++++++++ src/lib/ecore_x/xlib/ecore_x_screensaver.c | 2 +- src/lib/ecore_x/xlib/ecore_x_sync.c | 4 +- src/lib/ecore_x/xlib/ecore_x_vsync.c | 327 ++++++++++ src/lib/ecore_x/xlib/ecore_x_window.c | 44 +- src/lib/ecore_x/xlib/ecore_x_window_shape.c | 52 +- 116 files changed, 4577 insertions(+), 1592 deletions(-) delete mode 100644 doc/.cvsignore rename doc/{Doxyfile => Doxyfile.in} (94%) delete mode 100644 src/.cvsignore delete mode 100644 src/bin/.cvsignore delete mode 100644 src/lib/.cvsignore delete mode 100644 src/lib/ecore/.cvsignore delete mode 100644 src/lib/ecore_con/.cvsignore create mode 100644 src/lib/ecore_con/ecore_con_local_win32.c delete mode 100644 src/lib/ecore_config/.cvsignore delete mode 100644 src/lib/ecore_directfb/.cvsignore delete mode 100644 src/lib/ecore_evas/.cvsignore delete mode 100644 src/lib/ecore_fb/.cvsignore delete mode 100644 src/lib/ecore_file/.cvsignore delete mode 100644 src/lib/ecore_imf/.cvsignore delete mode 100644 src/lib/ecore_imf_evas/.cvsignore delete mode 100644 src/lib/ecore_ipc/.cvsignore delete mode 100644 src/lib/ecore_sdl/.cvsignore delete mode 100644 src/lib/ecore_win32/.cvsignore delete mode 100644 src/lib/ecore_wince/.cvsignore delete mode 100644 src/lib/ecore_x/.cvsignore delete mode 100644 src/lib/ecore_x/xcb/.cvsignore delete mode 100644 src/lib/ecore_x/xlib/.cvsignore create mode 100644 src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c create mode 100644 src/lib/ecore_x/xlib/ecore_x_vsync.c diff --git a/AUTHORS b/AUTHORS index bf44cd4..64054cd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,3 +39,4 @@ Mike McCormack Sangho Park Jihoon Kim PnB +Daniel Juyung Seo diff --git a/ChangeLog b/ChangeLog index d0daefd..12008fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -108,3 +108,109 @@ * Ecore_X gains some more x sync counter controls and Ecore_Evas now uses the netwm sync protocol to get wm's to only configure as fast as it can keep drawing. + +2011-04-05 Leif Middelschulte + + * Add ecore_x_randr_edid_* data extraction and validation functions + for EDID structures. + +2011-04-01 Cedric Bail + + * Add ecore_con_url_pipeline_set and ecore_con_url_pipeline_get for + HTTP 1.1 pipelining support. + +2011-04-05 Cedric Bail + + * Remove Ecore_Evas Cocoa backend that use depreacted Evas Quartz + backend. + +2011-04-11 Hannes Janetzek + + * Fix removal of windows from ignore_list with ecore_x_window_ignore_set + +2011-04-13 Doyun Kang + + * Ecore_X + Ecore_Evas: Add more support for shape input setting + +2011-04-15 Carsten Haitzler (The Rasterman) + + * Fix bug in Ecore_Evas setting modifiers for + sub-buffer-canvas. They never got set. Now they do. + +2011-04-19 Mike Blumenkrantz + + * Add ecore_exe_data_set + +2011-04-20 Carsten Haitzler (The Rasterman) + + * Added ecore animator timeline, where animator runs for a + specified time (in seconds) and then stops, but it also passes + the position in the timeline (as a 0.0 to 1.0 value) to the + callback which it can then use the new pos map call to map to + some ease in/out, bounce, spring or whatever position. + +2011-04-28 Eduardo Felipe Castegnaro + + * Add a monotonic clock implementation for Mac OS X to fix warning. + Mac OS X does not provide an implementation of clock_gettime() + even though it's POSIX, but it does provide a fast high-resolution + monotonic clock through mach specific APIs that are perfectly suited + for usage in ecore_timer. + +2011-04-20 Jihoon Kim + + * Ecore_IMF: Added support for auto-capitalization and prediction + control API's + +2011-05-03 Carsten Haitzler (The Rasterman) + + * Fixed null pointer dereference in selection notification + handling in Ecore_X. + +2011-05-12 Carsten Haitzler (The Rasterman) + + * Add a custom Ecore Animator source and tick ability to be able + to plug in external animator tick sources like vblank interrupts + and so on. + +2011-05-14 Cedric Bail + + * Sync GNUTLS threads activation with Eina. + +2011-05-14 Vincent Torri + + * Make ecore_con work on Windows (only the local connections + need a port) + * Make ecore_ipc compile on Windows + +2011-05-17 Cedric Bail + + * Add ecore_timer_dump. + +2011-05-19 Carsten Haitzler (The Rasterman) + + * Fix Ecore_X shadow tree search handling to respect shape and + shape input of windows. + +2011-05-20 Daniel Juyung Seo (SeoZ) + + * Ecore ecore_main.c: Fixed ecore_main_loop + (_ecore_main_loop_iterate_internal). This fixes fd handler pending + issue when ecore_idler callback adds ecore_job/event. + * Ecore ecore_main.c: Refactoring _ecore_main_loop_iterate_internal(). + +2011-05-27 Gustavo Sverzut Barbieri (k-s) + + * Ecore_X: introduce ecore_x_screen_size_get() + * Ecore_Evas: be safer when returning Ecore_Evas* from + ecore_evas_ecore_evas_get() + * Ecore_Evas: introduce ecore_evas_screen_geometry_get() + +2011-05-30 Cedric Bail + + * Add ecore_pipe_freeze/thaw to suspend and restart watching the pipe + inside the main loop. + +2011-06-09 Cedric Bail + + * Add ecore_pipe_wait (should only called from outside of the main loop). diff --git a/NEWS b/NEWS index e69de29..164f8d0 100644 --- a/NEWS +++ b/NEWS @@ -0,0 +1,38 @@ +Ecore 1.1.0 + +Changes since Ecore 1.0.0: +-------------------------- + +New Features: + + * ecore_x: + - XRandR backlight support + - XRandR Extended Display Identification Data (EDID) support + +API Additions: + + * ecore: + - ecore_thread_reschedule() + - ecore_exe_data_set() + - ecore_animator_timeline_add() + + * ecore_con: + - ECORE_CON_EVENT_CLIENT_ERROR, ECORE_CON_EVENT_SERVER_ERROR events + - Ecore_Con_Event_Server_Error, Ecore_Con_Event_Client_Error types + - ecore_con_client_port_get() + - ecore_con_url_ssl_verify_peer_set() + - ecore_con_url_ssl_ca_set() + - ecore_con_url_pipeline_set() + - ecore_con_url_pipeline_get() + + * ecore_file: + - ecore_file_download_full() + + * ecore_imf: + - ecore_imf_context_canvas_get() + - ecore_imf_context_window_get() + - ecore_imf_context_preedit_string_with_attributes_get() + + * ecore_x: + - ecore_x_randr_edid_*() + - ecore_x_randr_screen_backlight_*() diff --git a/README.in b/README.in index e20ecfe..15ffc43 100644 --- a/README.in +++ b/README.in @@ -82,3 +82,11 @@ COMPILING AND INSTALLING: (as root unless you are installing in your users directories): make install +------------------------------------------------------------------------------ +NOTE: + +You can experience main loop lock (and more likely see UI lock) if libcurl +doesn't use an asynchronous dns resolver. Since Curl 7.21.0, you can use the +native dns resolver asynchronously by turning --enable-threaded-resolver +on during configure time. For older version, C-Ares is the way to solve that +issue (see: http://c-ares.haxx.se/ ). diff --git a/autogen.sh b/autogen.sh index 77515c5..60fd3f0 100755 --- a/autogen.sh +++ b/autogen.sh @@ -10,6 +10,28 @@ echo "Running autoconf..." ; autoconf || exit 1 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1 +W=0 + +rm -f config.cache-env.tmp +echo "OLD_PARM=\"$@\"" >> config.cache-env.tmp +echo "OLD_CFLAGS=\"$CFLAGS\"" >> config.cache-env.tmp +echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp +echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp +echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp + +cmp config.cache-env.tmp config.cache-env >> /dev/null +if [ $? -ne 0 ]; then + W=1; +fi + +if [ $W -ne 0 ]; then + echo "Cleaning configure cache..."; + rm -f config.cache config.cache-env + mv config.cache-env.tmp config.cache-env +else + rm -f config.cache-env.tmp +fi + if [ -z "$NOCONFIGURE" ]; then ./configure -C "$@" fi diff --git a/configure.ac b/configure.ac index 48be104..be308a9 100644 --- a/configure.ac +++ b/configure.ac @@ -59,11 +59,12 @@ VMAJ=v_maj AC_SUBST(VMAJ) m4_ifdef([AM_GNU_GETTEXT_VERSION], [ -AM_GNU_GETTEXT_VERSION([0.12.1]) +AM_GNU_GETTEXT_VERSION([0.14]) ]) m4_ifdef([AM_GNU_GETTEXT], [ AM_GNU_GETTEXT([external]) +po_makefile_in=po/Makefile.in AM_CONDITIONAL([HAVE_PO], [true]) ],[ AM_CONDITIONAL([HAVE_PO], [false]) @@ -108,7 +109,7 @@ want_glib="no" # core modules want_ecore_con="yes" -want_ecore_ipc="no" +want_ecore_ipc="yes" want_ecore_file="yes" #want_ecore_config="no" want_ecore_imf="no" @@ -156,7 +157,6 @@ want_ecore_evas_software_ddraw="no" want_ecore_evas_direct3d="no" want_ecore_evas_opengl_glew="no" want_ecore_evas_software_16_ddraw="no" -want_ecore_evas_cocoa="no" want_ecore_evas_software_sdl="no" want_ecore_evas_gl_sdl="no" want_ecore_evas_directfb="no" @@ -166,6 +166,7 @@ want_ecore_evas_software_16_wince="no" case "$host_os" in mingw32ce* | cegcc*) want_ecore_con="no" + want_ecore_ipc="no" want_ecore_wince="yes" want_ecore_evas_software_16_wince="yes" ;; @@ -188,10 +189,8 @@ case "$host_os" in want_glib="auto" want_gnutls="auto" want_openssl="auto" - want_ecore_ipc="yes" want_ecore_imf="yes" want_ecore_cocoa="yes" - want_ecore_evas_cocoa="yes" want_ecore_evas_software_sdl="yes" want_ecore_evas_gl_sdl="yes" ;; @@ -206,7 +205,6 @@ case "$host_os" in want_inotify="yes" want_tslib="yes" want_ecore_fb="yes" - want_ecore_ipc="yes" want_ecore_imf="yes" want_ecore_x="yes" want_ecore_evas_software_x11="yes" @@ -347,6 +345,19 @@ else fi AC_SUBST(pkgconfig_requires_private) +### Checks for some build time option +have_backtrace="no" +AC_CHECK_FUNCS([backtrace], [have_backtrace="yes"], []) + +want_ecore_timer_dump="yes" + +AC_ARG_ENABLE([ecore-timer-dump], + [AC_HELP_STRING([--disable-ecore-timer-dump], [disable tracking of timer allocation. @<:@default=enable@:>@])], + [want_ecore_timer_dump=$enableval], []) + +if test "x$want_ecore_timer_dump" = "xyes" -a "x$have_backtrace" = "xyes"; then + AC_DEFINE(WANT_ECORE_TIMER_DUMP, [1], [Want Ecore_Timer dump infrastructure]) +fi ### Checks for libraries @@ -363,12 +374,13 @@ case "$host_os" in requirements_ecore_imf_evas="evil ${requirements_ecore_imf_evas}" EFL_ECORE_BUILD="-DEFL_ECORE_BUILD" EFL_ECORE_CON_BUILD="-DEFL_ECORE_CON_BUILD" - EFL_ECORE_FILE_BUILD="-DEFL_ECORE_FILE_BUILD" EFL_ECORE_EVAS_BUILD="-DEFL_ECORE_EVAS_BUILD" + EFL_ECORE_FILE_BUILD="-DEFL_ECORE_FILE_BUILD" EFL_ECORE_IMF_BUILD="-DEFL_ECORE_IMF_BUILD" EFL_ECORE_IMF_EVAS_BUILD="-DEFL_ECORE_IMF_EVAS_BUILD" EFL_ECORE_INPUT_BUILD="-DEFL_ECORE_INPUT_BUILD" EFL_ECORE_INPUT_EVAS_BUILD="-DEFL_ECORE_INPUT_EVAS_BUILD" + EFL_ECORE_IPC_BUILD="-DEFL_ECORE_IPC_BUILD" ;; esac @@ -391,12 +403,13 @@ esac AC_SUBST(EFL_ECORE_BUILD) AC_SUBST(EFL_ECORE_CON_BUILD) -AC_SUBST(EFL_ECORE_FILE_BUILD) AC_SUBST(EFL_ECORE_EVAS_BUILD) +AC_SUBST(EFL_ECORE_FILE_BUILD) AC_SUBST(EFL_ECORE_IMF_BUILD) AC_SUBST(EFL_ECORE_IMF_EVAS_BUILD) AC_SUBST(EFL_ECORE_INPUT_BUILD) AC_SUBST(EFL_ECORE_INPUT_EVAS_BUILD) +AC_SUBST(EFL_ECORE_IPC_BUILD) AC_SUBST(EFL_ECORE_WINCE_BUILD) AC_SUBST(EFL_ECORE_WIN32_BUILD) AC_SUBST(EFL_ECORE_SDL_BUILD) @@ -1003,34 +1016,56 @@ AC_ISC_POSIX AC_FUNC_ALLOCA AC_CHECK_FUNCS(gettimeofday strlcpy) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]], + [[ +int i = isfinite(0); + ]])], + [ + AC_DEFINE(HAVE_ISFINITE, 1, [Define to 1 if you have `isfinite', as a function or macro.]) + have_isfinite="yes" + ], + [have_isfinite="no"]) + +AC_MSG_CHECKING([for isfinite]) +AC_MSG_RESULT([${have_isfinite}]) + have_atfile_source=auto -AC_ARG_ENABLE(atfile-source, - AC_HELP_STRING([--disable-atfile-source], - [disable use of atfile source functions as openat and mkdirat @<:@default=detect@:>@]), - [have_atfile_source=$enableval], [have_atfile_source=auto]) - -if test "x$have_atfile_source" != "xno"; then - AC_CHECK_FUNCS(mkdirat, - [ - have_atfile_source=yes - AC_DEFINE(HAVE_ATFILE_SOURCE, 1, [mkdirat exists]) - ], - [ - if test "x$have_atfile_source" = "xyes"; then - AC_MSG_ERROR([required atfile-source but no mkdirat()]) - fi - have_atfile_source=no - ]) +AC_ARG_ENABLE([atfile-source], + [AC_HELP_STRING([--disable-atfile-source], + [disable use of atfile source functions as openat and mkdirat @<:@default=detect@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + have_atfile_source="yes" + else + have_atfile_source="no" + fi], + [have_atfile_source=auto]) + +if ! test "x${have_atfile_source}" = "xno" ; then + AC_CHECK_FUNCS(mkdirat, + [ + have_atfile_source="yes" + AC_DEFINE(HAVE_ATFILE_SOURCE, 1, [mkdirat exists]) + ], + [ + if test "x${have_atfile_source}" = "xyes" ; then + AC_MSG_ERROR([required atfile-source but no mkdirat()]) + fi + have_atfile_source="no" + ]) fi ### Checks for optionnal feature -AC_CHECK_FUNC(mallinfo, - [ - have_mallinfo=yes - AC_DEFINE(HAVE_MALLINFO, 1, [Gather memory statistic]) - ], [ - have_mallinfo=no - ]) +AC_CHECK_FUNC([mallinfo], + [ + have_mallinfo="yes" + AC_DEFINE(HAVE_MALLINFO, 1, [Gather memory statistic]) + ], + [have_mallinfo="no"]) ### Ecore modules @@ -1322,14 +1357,6 @@ if test "x${have_ecore_evas_software_gdi}" = "xyes" -o \ requirements_ecore_evas="ecore-win32 >= 1.0.0 ${requirements_ecore_evas}" fi -# ecore_evas_cocoa - -ECORE_EVAS_CHECK_MODULE([cocoa], - [${want_ecore_evas_cocoa}], - [Cocoa], - [${have_ecore_cocoa}], - [requirements_ecore_evas="ecore-cocoa >= 1.0.0 ${requirements_ecore_evas}"]) - # ecore_evas_software_sdl ECORE_EVAS_CHECK_MODULE([software-sdl], @@ -1411,6 +1438,7 @@ ecore-wince.pc ecore.pc doc/ecore.dox doc/Makefile +doc/Doxyfile src/Makefile src/bin/Makefile src/lib/Makefile @@ -1436,10 +1464,9 @@ src/lib/ecore_x/xcb/Makefile src/tests/Makefile README ecore.spec +$po_makefile_in ]) -m4_ifdef([AM_GNU_GETTEXT], [AC_CONFIG_FILES([po/Makefile.in])]) - AC_OUTPUT echo @@ -1455,6 +1482,7 @@ echo " GLib support...............: $have_glib" echo " Always integrate GLib......: $want_glib_integration_always" echo " Use g_main_loop............: $want_g_main_loop" echo " Gathering memory statistic.: $have_mallinfo" +echo " Gathering timer allocation.: $want_ecore_timer_dump" echo " Ecore_Con....................: $have_ecore_con" if test "x$have_ecore_con" = "xyes" ; then echo $ECHO_N " OpenSSL....................: $have_openssl $ECHO_C" @@ -1559,7 +1587,6 @@ if test "x${have_ecore_evas}" = "xyes" ; then echo " Software DirectDraw........: $have_ecore_evas_software_ddraw" echo " Direct3D...................: $have_ecore_evas_direct3d" echo " OpenGL Glew................: $have_ecore_evas_opengl_glew" - echo " Cocoa......................: $have_ecore_evas_cocoa" echo " Software SDL...............: $have_ecore_evas_software_sdl" echo " OpenGL SDL.................: $have_ecore_evas_opengl_sdl" echo " DirectFB...................: $have_ecore_evas_directfb" diff --git a/doc/.cvsignore b/doc/.cvsignore deleted file mode 100644 index cc370ed..0000000 --- a/doc/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -html -latex -man diff --git a/doc/Doxyfile b/doc/Doxyfile.in similarity index 94% rename from doc/Doxyfile rename to doc/Doxyfile.in index 5992902..79d731a 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile.in @@ -73,16 +73,16 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = YES WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = -INPUT = ./ecore.dox \ - ../src/lib +INPUT = @srcdir@/ecore.dox \ + @top_srcdir@/src/lib INPUT_ENCODING = UTF-8 FILE_PATTERNS = RECURSIVE = YES -EXCLUDE = ../src/lib/ecore_config/* ../src/lib/ecore_x/xcb/*.c +EXCLUDE = @top_srcdir@/src/lib/ecore_config/* @top_srcdir@/src/lib/ecore_x/xcb/*.c EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = ecore_config* Ecore_Config* EXCLUDE_SYMBOLS = Ecore_Config* -EXAMPLE_PATH = ../examples/ +EXAMPLE_PATH = @top_srcdir@/examples/ EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = YES IMAGE_PATH = img @@ -103,9 +103,9 @@ IGNORE_PREFIX = GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html -HTML_HEADER = head.html -HTML_FOOTER = foot.html -HTML_STYLESHEET = e.css +HTML_HEADER = @srcdir@/head.html +HTML_FOOTER = @srcdir@/foot.html +HTML_STYLESHEET = @srcdir@/e.css HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 diff --git a/doc/Makefile.am b/doc/Makefile.am index 0ea8777..8547b40 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -7,18 +7,18 @@ PACKAGE_DOCNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc if EFL_BUILD_DOC doc-clean: - rm -rf html/ latex/ man/ xml/ $(PACKAGE_DOCNAME).tar* + rm -rf html/ latex/ man/ xml/ $(top_builddir)/$(PACKAGE_DOCNAME).tar* doc: all doc-clean $(efl_doxygen) - cp img/* html/ + cp $(srcdir)/img/* html/ rm -rf $(PACKAGE_DOCNAME).tar* mkdir -p $(PACKAGE_DOCNAME)/doc cp -R html/ latex/ man/ $(PACKAGE_DOCNAME)/doc tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/ bzip2 -9 $(PACKAGE_DOCNAME).tar rm -rf $(PACKAGE_DOCNAME)/ - mv $(PACKAGE_DOCNAME).tar.bz2 $(top_srcdir) + mv $(PACKAGE_DOCNAME).tar.bz2 $(top_builddir) clean-local: doc-clean @@ -29,4 +29,4 @@ doc: endif -EXTRA_DIST = Doxyfile $(wildcard img/*.*) e.css head.html foot.html ecore.dox.in +EXTRA_DIST = Doxyfile.in $(wildcard img/*.*) e.css head.html foot.html ecore.dox.in diff --git a/doc/ecore.dox.in b/doc/ecore.dox.in index 2356dce..e69de29 100644 --- a/doc/ecore.dox.in +++ b/doc/ecore.dox.in @@ -1,282 +0,0 @@ -/** -@brief Ecore Library Public API Calls - -These routines are used for Ecore Library interaction -*/ - -/** - -@mainpage Ecore - -@image html e.png - -@version @PACKAGE_VERSION@ -@author Carsten Haitzler -@author Tom Gilbert -@author Burra -@author Chris Ross -@author Term -@author Tilman Sauerbeck -@author Ibukun Olumuyiwa -@author Yuri -@author Nicholas Curran -@author Howell Tam -@author Nathan Ingersoll -@author Andrew Elcock -@author Kim Woelders -@author Sebastian Dransfeld -@author Simon Poole -@author Jorge Luis Zapata Muga -@author dan sinclair -@author Michael 'Mickey' Lauer -@author David 'onefang' Seikel -@author Hisham 'CodeWarrior' Mardam Bey -@author Brian 'rephorm' Mattern -@author Tim Horton -@author Arnaud de Turckheim 'quarium' -@author Matt Barclay -@author Peter Wehrfritz -@author Albin "Lutin" Tonnerre -@author Vincent Torri -@author Lars Munch -@author Andre Dieb -@author Mathieu Taillefumier -@author Rui Miguel Silva Seabra -@author Samsung Electronics -@author Samsung SAIT -@author Nicolas Aguirre -@author Brett Nash -@author Mike Blumenkrantz -@author Leif Middelschulte -@author Mike McCormack -@author Sangho Park -@author Jihoon Kim -@date 2000-2011 - -@section intro Introduction - -Ecore is a library of convenience functions. - -The Ecore library provides the following modules: -@li @ref Ecore_Group -@li @ref Ecore_File_Group -@li @ref Ecore_Con_Group -@li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink -@li @ref Ecore_FB_Group -@li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink -@li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink -@li @ref Ecore_Win32_Group -@li @ref Ecore_WinCE_Group - -@section compiling How to compile using Ecore? -pkgconfig (.pc) files are installed for every ecore module. -Thus, to compile using any of them, you can use something like the following: - -@verbatim -gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs) -@endverbatim - -@section install How is it installed? - -Suggested configure options for evas for a Linux desktop X display: - -@verbatim -./configure \ ---enable-ecore-x \ ---enable-ecore-fb \ ---enable-ecore-evas \ ---enable-ecore-evas-gl \ ---enable-ecore-con \ ---enable-ecore-ipc -make CFLAGS="-O9 -mpentiumpro -march=pentiumpro -mcpu=pentiumpro" -@endverbatim - -@todo (1.0) Document API - -/* -@page Ecore_Main_Loop_Page The Ecore Main Loop - -@section intro What is Ecore? - -Ecore is a clean and tiny event loop library with many modules to do lots of -convenient things for a programmer, to save time and effort. - -It's small and lean, designed to work on embedded systems all the way to -large and powerful multi-cpu workstations. It serialises all system signals, -events etc. into a single event queue, that is easily processed without -needing to worry about concurrency. A properly written, event-driven program -using this kind of programming doesn't need threads, nor has to worry about -concurrency. It turns a program into a state machine, and makes it very -robust and easy to follow. - -Ecore gives you other handy primitives, such as timers to tick over for you -and call specified functions at particular times so the programmer can use -this to do things, like animate, or time out on connections or tasks that take -too long etc. - -Idle handlers are provided too, as well as calls on entering an idle state -(often a very good time to update the state of the program). All events that -enter the system are passed to specific callback functions that the program -sets up to handle those events. Handling them is simple and other Ecore -modules produce more events on the queue, coming from other sources such as -file descriptors etc. - -Ecore also lets you have functions called when file descriptors become active -for reading or writing, allowing for streamlined, non-blocking IO. - -Here is an example of a simple program and its basic event loop flow: - -@image html prog_flow.png - - - -@section work How does Ecore work? - -Ecore is very easy to learn and use. All the function calls are designed to -be easy to remember, explicit in describing what they do, and heavily -name-spaced. Ecore programs can start and be very simple. - -For example: - -@code -#include - -int main(int argc, const char **argv) -{ - ecore_init(); - ecore_app_args_set(argc, argv); - ecore_main_loop_begin(); - ecore_shutdown(); - return 0; -} -@endcode - -This program is very simple and does't check for errors, but it does start up -and begin a main loop waiting for events or timers to tick off. This program -doesn't set up any, but now we can expand on this simple program a little -more by adding some event handlers and timers. - -@code -#include - -Ecore_Timer *timer1 = NULL; -Ecore_Event_Handler *handler1 = NULL; -double start_time = 0.0; - -int timer_func(void *data) -{ - printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); - return 1; -} - -int exit_func(void *data, int ev_type, void *ev) -{ - Ecore_Event_Signal_Exit *e; - - e = (Ecore_Event_Signal_Exit *)ev; - if (e->interrupt) printf("Exit: interrupt\n"); - else if (e->quit) printf("Exit: quit\n"); - else if (e->terminate) printf("Exit: terminate\n"); - ecore_main_loop_quit(); - return 1; -} - -int main(int argc, const char **argv) -{ - ecore_init(); - ecore_app_args_set(argc, argv); - start_time = ecore_time_get(); - handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); - timer1 = ecore_timer_add(0.5, timer_func, NULL); - ecore_main_loop_begin(); - ecore_shutdown(); - return 0; -} -@endcode - -In the previous example, we initialize our application and get the time at -which our program has started so we can calculate an offset. We set -up a timer to tick off in 0.5 seconds, and since it returns 1, will -keep ticking off every 0.5 seconds until it returns 0, or is deleted -by hand. An event handler is set up to call a function - exit_func(), -whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C -on the command line will cause such an event to happen). If this event -occurs it tells you what kind of exit signal was received, and asks -the main loop to quit when it is finished by calling -ecore_main_loop_quit(). - -The handles returned by ecore_timer_add() and ecore_event_handler_add() are -only stored here as an example. If you don't need to address the timer or -event handler again you don't need to store the result, so just call the -function, and don't assign the result to any variable. - -This program looks slightly more complex than needed to do these simple -things, but in principle, programs don't get any more complex. You add more -event handlers, for more events, will have more timers and such, BUT it all -follows the same principles as shown in this example. - -*/ - -/* -@page Ecore_Config_Page The Enlightened Property Library - -The Enlightened Property Library (Ecore_Config) is an adbstraction -from the complexities of writing your own configuration. It provides -many features using the Enlightenment 17 development libraries. - -To use the library, you: -@li Set the default values of your properties. -@li Load the configuration from a file. You must set the default values - first, so that the library knows the correct type of each argument. - -The following examples show how to use the Enlightened Property Library: -@li @link config_basic_example.c config_basic_example.c @endlink -@li @link config_listener_example.c config_listener_example.c @endlink - -*/ - -/** -@page X_Window_System_Page X Window System - -The Ecore library includes a wrapper for handling the X window system. -This page briefly explains what the X window system is and various terms -that are used. -*/ - -// EXAMPLES - -/** -@example ecore_args_example.c -Shows how to set and retrieve the program arguments. -*/ - -/** -@example ecore_event_handler_example.c -Shows how to use event handlers. -*/ - -/** -@example ecore_fd_handler_example.c -Shows how to use fd handlers. -*/ - -/** -@example ecore_timer_example.c -Demonstrates use of the ecore_timer. -*/ - -/* -@example ecore_config_basic_example.c -Provides an example of how to use the basic configuration functions. -See the file Ecore_Config.h for the full list of available functions. -*/ - -/* -@example ecore_config_listener_example.c -Shows how to set up a listener to listen for configuration changes. -*/ - -/** -@example ecore_x_window_example.c -Shows the basics of using the X Windows system through Ecore functions. -*/ diff --git a/src/.cvsignore b/src/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/bin/.cvsignore b/src/bin/.cvsignore deleted file mode 100644 index 79fccac..0000000 --- a/src/bin/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -ecore_config -ecore_evas_test -ecore_test -ecore_dbus_test -ecore_dbus_hal_test -ecore_dbus_receiver_test diff --git a/src/lib/.cvsignore b/src/lib/.cvsignore deleted file mode 100644 index 282522d..0000000 --- a/src/lib/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/src/lib/ecore/.cvsignore b/src/lib/ecore/.cvsignore deleted file mode 100644 index 78de274..0000000 --- a/src/lib/ecore/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore.la diff --git a/src/lib/ecore/Ecore.h b/src/lib/ecore/Ecore.h index 02e1f71..19d9540 100644 --- a/src/lib/ecore/Ecore.h +++ b/src/lib/ecore/Ecore.h @@ -1,3 +1,288 @@ +/** +@brief Ecore Library Public API Calls + +These routines are used for Ecore Library interaction +*/ + +/** + +@mainpage Ecore + +@image html e.png + +@version @PACKAGE_VERSION@ +@author Carsten Haitzler +@author Tom Gilbert +@author Burra +@author Chris Ross +@author Term +@author Tilman Sauerbeck +@author Ibukun Olumuyiwa +@author Yuri +@author Nicholas Curran +@author Howell Tam +@author Nathan Ingersoll +@author Andrew Elcock +@author Kim Woelders +@author Sebastian Dransfeld +@author Simon Poole +@author Jorge Luis Zapata Muga +@author dan sinclair +@author Michael 'Mickey' Lauer +@author David 'onefang' Seikel +@author Hisham 'CodeWarrior' Mardam Bey +@author Brian 'rephorm' Mattern +@author Tim Horton +@author Arnaud de Turckheim 'quarium' +@author Matt Barclay +@author Peter Wehrfritz +@author Albin "Lutin" Tonnerre +@author Vincent Torri +@author Lars Munch +@author Andre Dieb +@author Mathieu Taillefumier +@author Rui Miguel Silva Seabra +@author Samsung Electronics +@author Samsung SAIT +@author Nicolas Aguirre +@author Brett Nash +@author Mike Blumenkrantz +@author Leif Middelschulte +@author Mike McCormack +@author Sangho Park +@author Jihoon Kim +@author Daniel Juyung Seo +@date 2000-2011 + +@section intro Introduction + +Ecore is a library of convenience functions. + +The Ecore library provides the following modules: +@li @ref Ecore_Group +@li @ref Ecore_File_Group +@li @ref Ecore_Con_Group +@li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink +@li @ref Ecore_FB_Group +@li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink +@li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink +@li @ref Ecore_Win32_Group +@li @ref Ecore_WinCE_Group + +@section compiling How to compile using Ecore? +pkgconfig (.pc) files are installed for every ecore module. +Thus, to compile using any of them, you can use something like the following: + +@verbatim +gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs) +@endverbatim + +@section install How is it installed? + +Suggested configure options for evas for a Linux desktop X display: + +@verbatim +./configure \ +--enable-ecore-x \ +--enable-ecore-fb \ +--enable-ecore-evas \ +--enable-ecore-evas-gl \ +--enable-ecore-con \ +--enable-ecore-ipc +make CFLAGS="-O9 -mpentiumpro -march=pentiumpro -mcpu=pentiumpro" +@endverbatim + +@todo (1.0) Document API +*/ + +/* +@page Ecore_Main_Loop_Page The Ecore Main Loop + +@section intro What is Ecore? + +Ecore is a clean and tiny event loop library with many modules to do lots of +convenient things for a programmer, to save time and effort. + +It's small and lean, designed to work on embedded systems all the way to +large and powerful multi-cpu workstations. It serialises all system signals, +events etc. into a single event queue, that is easily processed without +needing to worry about concurrency. A properly written, event-driven program +using this kind of programming doesn't need threads, nor has to worry about +concurrency. It turns a program into a state machine, and makes it very +robust and easy to follow. + +Ecore gives you other handy primitives, such as timers to tick over for you +and call specified functions at particular times so the programmer can use +this to do things, like animate, or time out on connections or tasks that take +too long etc. + +Idle handlers are provided too, as well as calls on entering an idle state +(often a very good time to update the state of the program). All events that +enter the system are passed to specific callback functions that the program +sets up to handle those events. Handling them is simple and other Ecore +modules produce more events on the queue, coming from other sources such as +file descriptors etc. + +Ecore also lets you have functions called when file descriptors become active +for reading or writing, allowing for streamlined, non-blocking IO. + +Here is an example of a simple program and its basic event loop flow: + +@image html prog_flow.png + + + +@section work How does Ecore work? + +Ecore is very easy to learn and use. All the function calls are designed to +be easy to remember, explicit in describing what they do, and heavily +name-spaced. Ecore programs can start and be very simple. + +For example: + +@code +#include + +int main(int argc, const char **argv) +{ + ecore_init(); + ecore_app_args_set(argc, argv); + ecore_main_loop_begin(); + ecore_shutdown(); + return 0; +} +@endcode + +This program is very simple and does't check for errors, but it does start up +and begin a main loop waiting for events or timers to tick off. This program +doesn't set up any, but now we can expand on this simple program a little +more by adding some event handlers and timers. + +@code +#include + +Ecore_Timer *timer1 = NULL; +Ecore_Event_Handler *handler1 = NULL; +double start_time = 0.0; + +int timer_func(void *data) +{ + printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); + return 1; +} + +int exit_func(void *data, int ev_type, void *ev) +{ + Ecore_Event_Signal_Exit *e; + + e = (Ecore_Event_Signal_Exit *)ev; + if (e->interrupt) printf("Exit: interrupt\n"); + else if (e->quit) printf("Exit: quit\n"); + else if (e->terminate) printf("Exit: terminate\n"); + ecore_main_loop_quit(); + return 1; +} + +int main(int argc, const char **argv) +{ + ecore_init(); + ecore_app_args_set(argc, argv); + start_time = ecore_time_get(); + handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); + timer1 = ecore_timer_add(0.5, timer_func, NULL); + ecore_main_loop_begin(); + ecore_shutdown(); + return 0; +} +@endcode + +In the previous example, we initialize our application and get the time at +which our program has started so we can calculate an offset. We set +up a timer to tick off in 0.5 seconds, and since it returns 1, will +keep ticking off every 0.5 seconds until it returns 0, or is deleted +by hand. An event handler is set up to call a function - exit_func(), +whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C +on the command line will cause such an event to happen). If this event +occurs it tells you what kind of exit signal was received, and asks +the main loop to quit when it is finished by calling +ecore_main_loop_quit(). + +The handles returned by ecore_timer_add() and ecore_event_handler_add() are +only stored here as an example. If you don't need to address the timer or +event handler again you don't need to store the result, so just call the +function, and don't assign the result to any variable. + +This program looks slightly more complex than needed to do these simple +things, but in principle, programs don't get any more complex. You add more +event handlers, for more events, will have more timers and such, BUT it all +follows the same principles as shown in this example. + +*/ + +/* +@page Ecore_Config_Page The Enlightened Property Library + +The Enlightened Property Library (Ecore_Config) is an adbstraction +from the complexities of writing your own configuration. It provides +many features using the Enlightenment 17 development libraries. + +To use the library, you: +@li Set the default values of your properties. +@li Load the configuration from a file. You must set the default values + first, so that the library knows the correct type of each argument. + +The following examples show how to use the Enlightened Property Library: +@li @link config_basic_example.c config_basic_example.c @endlink +@li @link config_listener_example.c config_listener_example.c @endlink + +*/ + +/** +@page X_Window_System_Page X Window System + +The Ecore library includes a wrapper for handling the X window system. +This page briefly explains what the X window system is and various terms +that are used. +*/ + +// EXAMPLES + +/** +@example ecore_args_example.c +Shows how to set and retrieve the program arguments. +*/ + +/** +@example ecore_event_handler_example.c +Shows how to use event handlers. +*/ + +/** +@example ecore_fd_handler_example.c +Shows how to use fd handlers. +*/ + +/** +@example ecore_timer_example.c +Demonstrates use of the ecore_timer. +*/ + +/* +@example ecore_config_basic_example.c +Provides an example of how to use the basic configuration functions. +See the file Ecore_Config.h for the full list of available functions. +*/ + +/* +@example ecore_config_listener_example.c +Shows how to set up a listener to listen for configuration changes. +*/ + +/** +@example ecore_x_window_example.c +Shows the basics of using the X Windows system through Ecore functions. +*/ + #ifndef _ECORE_H #define _ECORE_H @@ -146,7 +431,29 @@ extern "C" { ECORE_POLLER_CORE = 0 /**< The core poller interval */ }; typedef enum _Ecore_Poller_Type Ecore_Poller_Type; + + enum _Ecore_Pos_Map /* Position mappings */ + { + ECORE_POS_MAP_LINEAR, /**< Linear 0.0 -> 1.0 */ + ECORE_POS_MAP_ACCELERATE, /**< Start slow then speed up */ + ECORE_POS_MAP_DECELERATE, /**< Start fast then slow down */ + ECORE_POS_MAP_SINUSOIDAL, /**< Start slow, speed up then slow down at end */ + ECORE_POS_MAP_ACCELERATE_FACTOR, /**< Start slow then speed up, v1 being a power factor, 0.0 being linear, 1.0 being normal accelerate, 2.0 being much more pronounced accelerate (squared), 3.0 being cubed, etc. */ + ECORE_POS_MAP_DECELERATE_FACTOR, /**< Start fast then slow down, v1 being a power factor, 0.0 being linear, 1.0 being normal decelerate, 2.0 being much more pronounced decelerate (squared), 3.0 being cubed, etc. */ + ECORE_POS_MAP_SINUSOIDAL_FACTOR, /**< Start slow, speed up then slow down at end, v1 being a power factor, 0.0 being linear, 1.0 being normal sinusoidal, 2.0 being much more pronounced sinusoidal (squared), 3.0 being cubed, etc. */ + ECORE_POS_MAP_DIVISOR_INTERP, /**< Start at gradient * v1, interpolated via power of v2 curve */ + ECORE_POS_MAP_BOUNCE, /**< Start at 0.0 then "drop" like a ball bouncing to the ground at 1.0, and bounce v2 times, with decay factor of v1 */ + ECORE_POS_MAP_SPRING /**< Start at 0.0 then "wobble" like a sping rest position 1.0, and wobble v2 times, with decay factor of v1 */ + }; + typedef enum _Ecore_Pos_Map Ecore_Pos_Map; + enum _Ecore_Animator_Source /* Timing sources for animators */ + { + ECORE_ANIMATOR_SOURCE_TIMER, /**< The default system clock/timer based animator that ticks every "frametime" seconds */ + ECORE_ANIMATOR_SOURCE_CUSTOM /**< A custom animator trigger that you need to call ecore_animator_trigger() to make it tick */ + }; + typedef enum _Ecore_Animator_Source Ecore_Animator_Source; + typedef struct _Ecore_Exe Ecore_Exe; /**< A handle for spawned processes */ typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */ typedef struct _Ecore_Idler Ecore_Idler; /**< A handle for idlers */ @@ -218,10 +525,15 @@ extern "C" { typedef void (*Ecore_Thread_Notify_Cb) (void *data, Ecore_Thread *thread, void *msg_data); /** * @typedef Ecore_Task_Cb Ecore_Task_Cb - * A callback run for a task (timer, idler, poller, animater, etc) + * A callback run for a task (timer, idler, poller, animator, etc) */ typedef Eina_Bool (*Ecore_Task_Cb) (void *data); /** + * @typedef Ecore_Timeline_Cb Ecore_Timeline_Cb + * A callback run for a task (animators with runtimes) + */ + typedef Eina_Bool (*Ecore_Timeline_Cb) (void *data, double pos); + /** * @typedef Ecore_Cb Ecore_Cb * A generic callback called as a hook when a certain point in execution is reached. */ @@ -397,6 +709,7 @@ extern "C" { 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); @@ -473,6 +786,9 @@ extern "C" { 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); /** * @} @@ -542,6 +858,7 @@ extern "C" { 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); /** * @} @@ -554,12 +871,19 @@ extern "C" { */ EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data); + EAPI Ecore_Animator *ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data); EAPI void *ecore_animator_del(Ecore_Animator *animator); EAPI void ecore_animator_freeze(Ecore_Animator *animator); EAPI void ecore_animator_thaw(Ecore_Animator *animator); EAPI void ecore_animator_frametime_set(double frametime); EAPI double ecore_animator_frametime_get(void); - + EAPI double ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2); + EAPI void ecore_animator_source_set(Ecore_Animator_Source source); + EAPI Ecore_Animator_Source ecore_animator_source_get(void); + EAPI void ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data); + EAPI void ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data); + EAPI void ecore_animator_custom_tick(void); + /** * @} */ diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index ff17209..3e33e95 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -137,7 +137,7 @@ ecore_init(void) #if defined(GLIB_INTEGRATION_ALWAYS) if (_ecore_glib_always_integrate) ecore_main_loop_glib_integrate(); #endif - + return _ecore_init_count; shutdown_log_dom: diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c index c86026c..ad953f7 100644 --- a/src/lib/ecore/ecore_anim.c +++ b/src/lib/ecore/ecore_anim.c @@ -17,17 +17,121 @@ struct _Ecore_Animator Ecore_Task_Cb func; void *data; + double start, run; + Ecore_Timeline_Cb run_func; + void *run_data; + Eina_Bool delete_me : 1; Eina_Bool suspended : 1; }; +static Eina_Bool _ecore_animator_run(void *data); static Eina_Bool _ecore_animator(void *data); -static Ecore_Timer *timer = NULL; -static int animators_delete_me = 0; -static Ecore_Animator *animators = NULL; -static double animators_frametime = 1.0 / 30.0; +static int animators_delete_me = 0; +static Ecore_Animator *animators = NULL; +static double animators_frametime = 1.0 / 30.0; + +static Ecore_Animator_Source src = ECORE_ANIMATOR_SOURCE_TIMER; +static Ecore_Timer *timer = NULL; +static int ticking = 0; +static Ecore_Cb begin_tick_cb = NULL; +static const void *begin_tick_data = NULL; +static Ecore_Cb end_tick_cb = NULL; +static const void *end_tick_data = NULL; + +static void +_begin_tick(void) +{ + if (ticking) return; + ticking = 1; + switch (src) + { + case ECORE_ANIMATOR_SOURCE_TIMER: + if (!timer) + { + double t_loop = ecore_loop_time_get(); + double sync_0 = 0.0; + double d = -fmod(t_loop - sync_0, animators_frametime); + + timer = ecore_timer_loop_add(animators_frametime, + _ecore_animator, NULL); + ecore_timer_delay(timer, d); + } + break; + case ECORE_ANIMATOR_SOURCE_CUSTOM: + if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data); + break; + default: + break; + } +} + +static void +_end_tick(void) +{ + if (!ticking) return; + ticking = 0; + switch (src) + { + case ECORE_ANIMATOR_SOURCE_TIMER: + if (timer) + { + ecore_timer_del(timer); + timer = NULL; + } + break; + case ECORE_ANIMATOR_SOURCE_CUSTOM: + if (end_tick_cb) end_tick_cb((void *)end_tick_data); + break; + default: + break; + } +} + +static Eina_Bool +_do_tick(void) +{ + Ecore_Animator *animator; + + EINA_INLIST_FOREACH(animators, animator) + { + if (!animator->delete_me && !animator->suspended) + { + if (!animator->func(animator->data)) + { + animator->delete_me = EINA_TRUE; + animators_delete_me++; + } + } + } + if (animators_delete_me) + { + Ecore_Animator *l; + for (l = animators; l;) + { + animator = l; + l = (Ecore_Animator *) EINA_INLIST_GET(l)->next; + if (animator->delete_me) + { + animators = (Ecore_Animator *) + eina_inlist_remove(EINA_INLIST_GET(animators), + EINA_INLIST_GET(animator)); + ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE); + free(animator); + animators_delete_me--; + if (animators_delete_me == 0) break; + } + } + } + if (!animators) + { + _end_tick(); + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} /** * @addtogroup Ecore_Group Ecore - Main Loop and Job Functions. @@ -69,22 +173,181 @@ ecore_animator_add(Ecore_Task_Cb func, const void *data) animator->func = func; animator->data = (void *)data; animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); - if (!timer) + _begin_tick(); + return animator; +} + +/** + * Add a animator that runs for a limited time + * @param runtime The time to run in seconds + * @param func The function to call when it ticks off + * @param data The data to pass to the function + * @return A handle to the new animator + * + * This function is just like ecore_animator_add() except the animator only + * runs for a limited time specified in seconds by @p runtime. Once the runtime + * the animator has elapsed (animator finished) it will automatically be + * deleted. The callback function @p func can return ECORE_CALLBACK_RENEW to + * keep the animator running or ECORE_CALLBACK_CANCEL ro stop it and have + * it be deleted automatically at any time. + * + * The @p func will ALSO be passed a position parameter that will be in value + * from 0.0 to 1.0 to indicate where along the timeline (0.0 start, 1.0 end) + * the animator run is at. If the callback wishes not to have a linear + * transition it can "map" this value to one of several curves and mappings + * via ecore_animator_pos_map(). + * + * @since 1.1.0 + */ +EAPI Ecore_Animator * +ecore_animator_timeline_add(double runtime, Ecore_Timeline_Cb func, const void *data) +{ + Ecore_Animator *animator; + + if (runtime <= 0.0) runtime = 0.0; + animator = ecore_animator_add(_ecore_animator_run, NULL); + animator->data = animator; + animator->run_func = func; + animator->run_data = (void *)data; + animator->start = ecore_loop_time_get(); + animator->run = runtime; + return animator; +} + +static double +_pos_map_sin(double in) +{ + return eina_f32p32_double_to(eina_f32p32_sin(eina_f32p32_double_from(in))); +} + +static double +_pos_map_cos(double in) +{ + return eina_f32p32_double_to(eina_f32p32_cos(eina_f32p32_double_from(in))); +} + +static double +_pos_map_accel_factor(double pos, double v1) +{ + int i, fact = (int)v1; + double p, o1 = pos, o2 = pos, v; + p = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0)); + o2 = p; + for (i = 0; i < fact; i++) { - double t_loop = ecore_loop_time_get(); - double sync_0 = 0.0; - double d = -fmod(t_loop - sync_0, animators_frametime); + o1 = o2; + o2 = o2 * p; + } + v = v1 - (double)fact; + pos = (v * o2) + ((1.0 - v) * o1); + return pos; +} + +static double +_pos_map_pow(double pos, double divis, int p) +{ + double v = 1.0; + int i; + for (i = 0; i < p; i++) v *= pos; + return ((pos * divis) * (1.0 - v)) + (pos * v); +} + +static double +_pos_map_spring(double pos, int bounces, double decfac) +{ + int segnum, segpos, b1, b2; + double len, decay, decpos, p2; + if (bounces < 0) bounces = 0; + p2 = _pos_map_pow(pos, 0.5, 3); + len = (M_PI / 2.0) + ((double)bounces * M_PI); + segnum = (bounces * 2) + 1; + segpos = 2 * (((int)(p2 * segnum) + 1) / 2); + b1 = segpos; + b2 = segnum + 1; + if (b1 < 0) b1 = 0; + decpos = (double)b1 / (double)b2; + decay = _pos_map_accel_factor(1.0 - decpos, decfac); + return _pos_map_sin((M_PI / 2.0) + (p2 * len)) * decay; +} - timer = ecore_timer_loop_add(animators_frametime, _ecore_animator, NULL); - ecore_timer_delay(timer, d); +/** + * Maps an input position from 0.0 to 1.0 along a timeline to another position + * + * Takes an input position (0.0 to 1.0) and maps to a new position (normally + * between 0.0 and 1.0, but it may go above/below 0.0 or 1.0 to show that it + * has "overshot" the mark) using some interpolation (mapping) algorithm. + * + * You might normally use this like: + * @code + * double pos; // input position in a timeline from 0.0 to 1.0 + * double out; // output position after mapping + * int x1, y1, x2, y2; // x1 & y1 are start position, x2 & y2 are end position + * int x, y; // x & y are the calculated position + * + * out = ecore_animator_pos_map(pos, ECORE_POS_MAP_BOUNCE, 1.8, 7); + * x = (x1 * out) + (x2 * (1.0 - out)); + * y = (y1 * out) + (y2 * (1.0 - out)); + * move_my_object_to(myobject, x, y); + * @endcode + * + * @param pos The input position to map + * @param map The mapping to use + * @param v1 A parameter use by the mapping (pass 0.0 if not used) + * @param v2 A parameter use by the mapping (pass 0.0 if not used) + * @return The mapped value + * + * @since 1.1.0 + */ +EAPI double +ecore_animator_pos_map(double pos, Ecore_Pos_Map map, double v1, double v2) +{ + if (pos > 1.0) pos = 1.0; + else if (pos < 0.0) pos = 0.0; + switch (map) + { + case ECORE_POS_MAP_LINEAR: + return pos; + case ECORE_POS_MAP_ACCELERATE: + pos = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0)); + return pos; + case ECORE_POS_MAP_DECELERATE: + pos = _pos_map_sin((pos * M_PI) / 2.0); + return pos; + case ECORE_POS_MAP_SINUSOIDAL: + pos = (1.0 - _pos_map_cos(pos * M_PI)) / 2.0; + return pos; + case ECORE_POS_MAP_ACCELERATE_FACTOR: + pos = _pos_map_accel_factor(pos, v1); + return pos; + case ECORE_POS_MAP_DECELERATE_FACTOR: + pos = 1.0 - _pos_map_accel_factor(1.0 - pos, v1); + return pos; + case ECORE_POS_MAP_SINUSOIDAL_FACTOR: + if (pos < 0.5) pos = _pos_map_accel_factor(pos * 2.0, v1) / 2.0; + else pos = 1.0 - (_pos_map_accel_factor((1.0 - pos) * 2.0, v1) / 2.0); + return pos; + case ECORE_POS_MAP_DIVISOR_INTERP: + pos = _pos_map_pow(pos, v1, (int)v2); + return pos; + case ECORE_POS_MAP_BOUNCE: + pos = _pos_map_spring(pos, (int)v2, v1); + if (pos < 0.0) pos = -pos; + pos = 1.0 - pos; + return pos; + case ECORE_POS_MAP_SPRING: + pos = 1.0 - _pos_map_spring(pos, (int)v2, v1); + return pos; + default: + return pos; } - return animator; + return pos; + v2 = 0.0; } /** * Delete the specified animator from the animator list. * @param animator The animator to delete - * @return The data pointer set for the animator + * @return The data pointer set for the animator on add * * Delete the specified @p aqnimator from the set of animators that are executed * during main loop execution. This function returns the data parameter that @@ -104,6 +367,7 @@ ecore_animator_del(Ecore_Animator *animator) if (animator->delete_me) return animator->data; animator->delete_me = EINA_TRUE; animators_delete_me++; + if (animator->run_func) return animator->run_data; return animator->data; } @@ -119,13 +383,8 @@ ecore_animator_frametime_set(double frametime) if (frametime < 0.0) frametime = 0.0; if (animators_frametime == frametime) return; animators_frametime = frametime; - if (timer) - { - ecore_timer_del(timer); - timer = NULL; - } - if (animators) - timer = ecore_timer_add(animators_frametime, _ecore_animator, NULL); + _end_tick(); + if (animators) _begin_tick(); } /** @@ -180,14 +439,111 @@ ecore_animator_thaw(Ecore_Animator *animator) animator->suspended = EINA_FALSE; } +/** + * Set the source of animator ticks for the mainloop + * + * @param source The source of animator ticks to use + * + * This sets the source of animator ticks. When an animator is active the + * mainloop will "tick" over frame by frame calling all animators that are + * registered until none are. The mainloop will tick at a given rate based + * on the animator source. The default source is the system clock timer + * source - ECORE_ANIMATOR_SOURCE_TIMER. This source uses the system clock + * to tick over every N seconds (specified by ecore_animator_frametime_set(), + * with the default being 1/30th of a second unless set otherwise). You can + * set a custom tick source by setting the source to + * ECORE_ANIMATOR_SOURCE_CUSTOM and then drive it yourself based on some input + * tick source (like another application via ipc, some vertical blanking + * interrupt etc.) using 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 animator "tick" over 1 frame. + */ +EAPI void +ecore_animator_source_set(Ecore_Animator_Source source) +{ + src = source; + _end_tick(); + if (animators) _begin_tick(); +} + +/** + * Get the animator source currently set + * @return The current animator source + * + * This gets the current animator source. See ecore_animator_source_set() for + * more information. + */ +EAPI Ecore_Animator_Source +ecore_animator_source_get(void) +{ + return src; +} + +/** + * Set the function that begins a custom animator tick source + * + * @param func The function to call when ticking is to begin + * @param data The data passed to the tick begin function as its parameter + * + * 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 + * 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 + * is NULL then no function is called to begin custom ticking. + */ +EAPI void +ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, const void *data) +{ + begin_tick_cb = func; + begin_tick_data = data; + _end_tick(); + if (animators) _begin_tick(); +} + +/** + * Set the function that ends a custom animator tick source + * @param func The function to call when ticking is to end + * @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 + * 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(). + */ +EAPI void +ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, const void *data) +{ + end_tick_cb = func; + end_tick_data = data; + _end_tick(); + if (animators) _begin_tick(); +} + +/** + * Trigger a custom animator tick + * + * When animator source is set to ECORE_ANIMATOR_SOURCE_CUSTOM, then calling + * this function triggers a run of all animators currently registered with + * Ecore as this indicates a "frame tick" happened. This will do nothing + * if the animator source (set by ecore_animator_source_set() ) is not set + * to ECORE_ANIMATOR_SOURCE_CUSTOM. + */ +EAPI void +ecore_animator_custom_tick(void) +{ + if (src == ECORE_ANIMATOR_SOURCE_CUSTOM) _do_tick(); +} + void _ecore_animator_shutdown(void) { - if (timer) - { - ecore_timer_del(timer); - timer = NULL; - } + _end_tick(); while (animators) { Ecore_Animator *animator; @@ -200,44 +556,28 @@ _ecore_animator_shutdown(void) } static Eina_Bool -_ecore_animator(void *data __UNUSED__) +_ecore_animator_run(void *data) { - Ecore_Animator *animator; + Ecore_Animator *animator = data; + double pos = 0.0, t; + Eina_Bool run_ret; - EINA_INLIST_FOREACH(animators, animator) - { - if (!animator->delete_me && !animator->suspended) - { - if (!animator->func(animator->data)) - { - animator->delete_me = EINA_TRUE; - animators_delete_me++; - } - } - } - if (animators_delete_me) - { - Ecore_Animator *l; - for(l = animators; l;) - { - animator = l; - l = (Ecore_Animator *) EINA_INLIST_GET(l)->next; - if (animator->delete_me) - { - animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); - ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE); - free(animator); - animators_delete_me--; - if (animators_delete_me == 0) break; - } - } - } - if (!animators) + t = ecore_loop_time_get(); + if (animator->run > 0.0) { - timer = NULL; - return ECORE_CALLBACK_CANCEL; + pos = (t - animator->start) / animator->run; + if (pos > 1.0) pos = 1.0; + else if (pos < 0.0) pos = 0.0; } - return ECORE_CALLBACK_RENEW; + run_ret = animator->run_func(animator->run_data, pos); + if (t >= (animator->start + animator->run)) run_ret = EINA_FALSE; + return run_ret; +} + +static Eina_Bool +_ecore_animator(void *data __UNUSED__) +{ + return _do_tick(); } /** diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c index 54fdcb2..2231b6e 100644 --- a/src/lib/ecore/ecore_events.c +++ b/src/lib/ecore/ecore_events.c @@ -437,7 +437,7 @@ _ecore_event_exist(void) { Ecore_Event *e; EINA_INLIST_FOREACH(events, e) - if (!e->delete_me) return 1; + if (!e->delete_me) return 1; return 0; } diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c index aaed793..d5a626d 100644 --- a/src/lib/ecore/ecore_exe.c +++ b/src/lib/ecore/ecore_exe.c @@ -1134,6 +1134,28 @@ ecore_exe_data_get(const Ecore_Exe *exe) } /** + * Sets the data attached to the given process handle. + * @param exe The given process handle. + * @param data The pointer to attach + * @return The data pointer previously attached to @p exe with + * ecore_exe_run(), ecore_exe_pipe_run(), or ecore_exe_data_set() + * @since 1.1 + */ +EAPI void * +ecore_exe_data_set(Ecore_Exe *exe, void *data) +{ + void *ret; + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, __func__); + return NULL; + } + ret = exe->data; + exe->data = data; + return ret; +} + +/** * Retrieves the flags attached to the given process handle. * @param exe The given process handle. * @return The flags attached to @p exe. diff --git a/src/lib/ecore/ecore_exe_win32.c b/src/lib/ecore/ecore_exe_win32.c index 7f4435a..2d5f535 100644 --- a/src/lib/ecore/ecore_exe_win32.c +++ b/src/lib/ecore/ecore_exe_win32.c @@ -201,7 +201,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data) if (exe->flags & ECORE_EXE_PIPE_READ) if (!_ecore_exe_win32_pipes_set(exe)) goto free_exe; - + if (exe->flags & ECORE_EXE_PIPE_WRITE) if (!_ecore_exe_win32_pipes_set(exe)) goto close_pipes; @@ -685,7 +685,7 @@ _ecore_exe_win32_pipe_thread_generic_cb(void *data, Ecore_Exe_Flags flags) exe->pipe_error.data_buf = current_buf; exe->pipe_error.data_size = current_size; } - + event = ecore_exe_event_data_get(exe, flags); if (event) ecore_pipe_write(ecore_pipe, &event, sizeof(event)); @@ -948,7 +948,7 @@ _ecore_exe_close_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__) ecore_event_add(ECORE_EXE_EVENT_DEL, e, _ecore_exe_event_del_free, NULL); - + return 0; } diff --git a/src/lib/ecore/ecore_glib.c b/src/lib/ecore/ecore_glib.c index 739c05a..64440e5 100644 --- a/src/lib/ecore/ecore_glib.c +++ b/src/lib/ecore/ecore_glib.c @@ -23,14 +23,14 @@ static Eina_Bool _ecore_glib_fds_resize(size_t size) { void *tmp = realloc(_ecore_glib_fds, sizeof(GPollFD) * size); - + if (!tmp) { ERR("Could not realloc from %zu to %zu buckets.", _ecore_glib_fds_size, size); return EINA_FALSE; } - + _ecore_glib_fds = tmp; _ecore_glib_fds_size = size; return EINA_TRUE; @@ -45,11 +45,11 @@ _ecore_glib_context_query(GMainContext *ctx, int priority, int *p_timer) { if (!_ecore_glib_fds_resize(ECORE_GLIB_FDS_INITIAL)) return -1; } - + while (1) { size_t size; - + reqfds = g_main_context_query (ctx, priority, p_timer, _ecore_glib_fds, _ecore_glib_fds_size); if (reqfds <= (int)_ecore_glib_fds_size) break; @@ -74,7 +74,7 @@ _ecore_glib_context_poll_from(const GPollFD *pfds, int count, fd_set *rfds, fd_s { const GPollFD *itr = pfds, *itr_end = pfds + count; int glib_fds = -1; - + for (; itr < itr_end; itr++) { if (glib_fds < itr->fd) @@ -95,7 +95,7 @@ static int _ecore_glib_context_poll_to(GPollFD *pfds, int count, const fd_set *rfds, const fd_set *wfds, const fd_set *efds, int ready) { GPollFD *itr = pfds, *itr_end = pfds + count; - + for (; itr < itr_end && ready > 0; itr++) { itr->revents = 0; @@ -137,7 +137,7 @@ _ecore_glib_select__locked(GMainContext *ctx, int ecore_fds, fd_set *rfds, fd_se { glib_timeout.tv_sec = reqtimeout / 1000; glib_timeout.tv_usec = (reqtimeout % 1000) * 1000; - + if (!ecore_timeout || timercmp(ecore_timeout, &glib_timeout, >)) timeout = &glib_timeout; else @@ -203,7 +203,7 @@ _ecore_glib_shutdown(void) if (ecore_main_loop_select_func_get() == _ecore_glib_select) ecore_main_loop_select_func_set(_ecore_glib_select_original); - + if (_ecore_glib_fds) { free(_ecore_glib_fds); @@ -284,7 +284,7 @@ Eina_Bool _ecore_glib_always_integrate = 1; /** * Disable always integrating glib - * + * * If ecore is compiled with --enable-glib-integration-always (to always * call ecore_main_loop_glib_integrate() when ecore_init() is called), then * calling this before calling ecore_init() will disable the integration. diff --git a/src/lib/ecore/ecore_job.c b/src/lib/ecore/ecore_job.c index c9de10a..0ab34ce 100644 --- a/src/lib/ecore/ecore_job.c +++ b/src/lib/ecore/ecore_job.c @@ -63,7 +63,7 @@ EAPI Ecore_Job * ecore_job_add(Ecore_Cb func, const void *data) { Ecore_Job *job; - + if (!func) return NULL; job = calloc(1, sizeof(Ecore_Job)); @@ -89,7 +89,7 @@ EAPI void * ecore_job_del(Ecore_Job *job) { void *data; - + if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_JOB)) { ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB, @@ -114,7 +114,7 @@ static Eina_Bool _ecore_job_event_handler(void *data __UNUSED__, int type __UNUSED__, void *ev) { Ecore_Job *job; - + job = ev; job->func(job->data); return ECORE_CALLBACK_CANCEL; diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index fcbbc4f..a063916 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -30,6 +30,16 @@ # include #endif +#ifdef HAVE_ISFINITE +# define ECORE_FINITE(t) isfinite(t) +#else +# ifdef _MSC_VER +# define ECORE_FINITE(t) _finite(t) +# else +# define ECORE_FINITE(t) finite(t) +# endif +#endif + #define FIX_HZ 1 #ifdef FIX_HZ @@ -94,11 +104,15 @@ struct _Ecore_Win32_Handler #endif +#ifndef USE_G_MAIN_LOOP static int _ecore_main_select(double timeout); +#endif static void _ecore_main_prepare_handlers(void); static void _ecore_main_fd_handlers_cleanup(void); #ifndef _WIN32 +# ifndef USE_G_MAIN_LOOP static void _ecore_main_fd_handlers_bads_rem(void); +# endif #endif static void _ecore_main_fd_handlers_call(void); static int _ecore_main_fd_handlers_buf_call(void); @@ -113,7 +127,9 @@ 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; @@ -131,13 +147,15 @@ static Eina_Bool win32_handlers_delete_me = EINA_FALSE; #endif #ifdef _WIN32 -static Ecore_Select_Function main_loop_select = _ecore_main_win32_select; +Ecore_Select_Function main_loop_select = _ecore_main_win32_select; #else -static Ecore_Select_Function main_loop_select = select; +Ecore_Select_Function main_loop_select = select; #endif +#ifndef USE_G_MAIN_LOOP static double t1 = 0.0; static double t2 = 0.0; +#endif #ifdef HAVE_EPOLL static int epoll_fd = -1; @@ -414,7 +432,7 @@ static inline int _ecore_main_fdh_poll_mark_active(void) /* like we are about to enter main_loop_select in _ecore_main_select */ static gboolean -_ecore_main_gsource_prepare(GSource *source, gint *next_time) +_ecore_main_gsource_prepare(GSource *source __UNUSED__, gint *next_time) { double t = _ecore_timer_next_get(); gboolean running; @@ -425,7 +443,7 @@ _ecore_main_gsource_prepare(GSource *source, gint *next_time) if (!ecore_idling) { while (_ecore_timer_call(_ecore_time_loop_time)); - _ecore_timer_cleanup(); + _ecore_timer_cleanup(); /* when idling, busy loop checking the fds only */ if (!ecore_idling) _ecore_idle_enterer_call(); @@ -441,7 +459,7 @@ _ecore_main_gsource_prepare(GSource *source, gint *next_time) if (_ecore_timers_exists()) { double t = _ecore_timer_next_get(); - *next_time = (t / 1000.0); + *next_time = (t * 1000.0); } else *next_time = -1; @@ -461,14 +479,14 @@ _ecore_main_gsource_prepare(GSource *source, gint *next_time) } static gboolean -_ecore_main_gsource_check(GSource *source) +_ecore_main_gsource_check(GSource *source __UNUSED__) { INF("enter"); in_main_loop++; ecore_fds_ready = (_ecore_main_fdh_poll_mark_active() > 0); _ecore_main_fd_handlers_cleanup(); - + _ecore_time_loop_time = ecore_time_get(); _ecore_timer_enable_new(); @@ -480,20 +498,20 @@ _ecore_main_gsource_check(GSource *source) /* like we just came out of main_loop_select in _ecore_main_select */ static gboolean -_ecore_main_gsource_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) +_ecore_main_gsource_dispatch(GSource *source __UNUSED__, GSourceFunc callback __UNUSED__, gpointer user_data __UNUSED__) { gboolean events_ready, timers_ready, idlers_ready, signals_ready; double next_time = _ecore_timer_next_get(); events_ready = _ecore_event_exist(); - timers_ready = _ecore_timers_exists() && (0.0 <= next_time); + timers_ready = _ecore_timers_exists() && (0.0 >= next_time); idlers_ready = _ecore_idler_exist(); signals_ready = (_ecore_signal_count_get() > 0); in_main_loop++; INF("enter idling=%d fds=%d events=%d signals=%d timers=%d (next=%.2f) idlers=%d", ecore_idling, ecore_fds_ready, events_ready, signals_ready, - _ecore_timers_exists(), next_time, idlers_ready); + timers_ready, next_time, idlers_ready); if (ecore_idling && events_ready) { @@ -513,7 +531,7 @@ _ecore_main_gsource_dispatch(GSource *source, GSourceFunc callback, gpointer use _ecore_idler_call(); events_ready = _ecore_event_exist(); - timers_ready = _ecore_timers_exists() && (0.0 <= next_time); + timers_ready = _ecore_timers_exists() && (0.0 >= next_time); idlers_ready = _ecore_idler_exist(); if ((ecore_fds_ready || events_ready || timers_ready || idlers_ready || signals_ready)) @@ -544,7 +562,7 @@ _ecore_main_gsource_dispatch(GSource *source, GSourceFunc callback, gpointer use } static void -_ecore_main_gsource_finalize(GSource *source) +_ecore_main_gsource_finalize(GSource *source __UNUSED__) { INF("finalize"); } @@ -1067,6 +1085,7 @@ _ecore_main_prepare_handlers(void) } } +#ifndef USE_G_MAIN_LOOP static int _ecore_main_select(double timeout) { @@ -1079,7 +1098,7 @@ _ecore_main_select(double timeout) #endif t = NULL; - if ((!finite(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */ + if ((!ECORE_FINITE(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */ { tv.tv_sec = 0; tv.tv_usec = 0; @@ -1140,7 +1159,7 @@ _ecore_main_select(double timeout) if (_ecore_signal_count_get()) return -1; ret = main_loop_select(max_fd + 1, &rfds, &wfds, &exfds, t); - + _ecore_time_loop_time = ecore_time_get(); if (ret < 0) { @@ -1178,8 +1197,10 @@ _ecore_main_select(double timeout) } return 0; } +#endif #ifndef _WIN32 +# ifndef USE_G_MAIN_LOOP static void _ecore_main_fd_handlers_bads_rem(void) { @@ -1228,14 +1249,15 @@ _ecore_main_fd_handlers_bads_rem(void) } if (found == 0) { -# ifdef HAVE_GLIB +# ifdef HAVE_GLIB ERR("No bad fd found. Maybe a foreign fd from glib?"); -# else +# else ERR("No bad fd found. EEEK!"); -# endif +# endif } _ecore_main_fd_handlers_cleanup(); } +# endif #endif static void @@ -1404,7 +1426,6 @@ _ecore_main_loop_iterate_internal(int once_only) _ecore_idle_enterer_call(); have_event = 1; _ecore_main_select(0.0); - _ecore_time_loop_time = ecore_time_get(); _ecore_timer_enable_new(); goto process_events; } @@ -1418,7 +1439,6 @@ _ecore_main_loop_iterate_internal(int once_only) if (_ecore_signal_count_get() > 0) have_signal = 1; if (have_signal || have_event) { - _ecore_time_loop_time = ecore_time_get(); _ecore_timer_enable_new(); goto process_events; } @@ -1433,7 +1453,6 @@ _ecore_main_loop_iterate_internal(int once_only) { have_event = 1; _ecore_main_select(0.0); - _ecore_time_loop_time = ecore_time_get(); _ecore_timer_enable_new(); goto process_events; } @@ -1441,7 +1460,6 @@ _ecore_main_loop_iterate_internal(int once_only) { _ecore_idle_enterer_call(); in_main_loop--; - _ecore_time_loop_time = ecore_time_get(); _ecore_timer_enable_new(); return; } @@ -1457,7 +1475,6 @@ _ecore_main_loop_iterate_internal(int once_only) _ecore_timer_enable_new(); if (do_quit) { - _ecore_time_loop_time = ecore_time_get(); in_main_loop--; _ecore_timer_enable_new(); return; @@ -1480,11 +1497,11 @@ _ecore_main_loop_iterate_internal(int once_only) { for (;;) { + _ecore_time_loop_time = ecore_time_get(); if (!_ecore_idler_call()) goto start_loop; - if (_ecore_main_select(0.0) > 0) have_event = 1; + if (_ecore_main_select(0.0) > 0) break; if (_ecore_event_exist()) break; - if (_ecore_signal_count_get() > 0) have_signal = 1; - if (have_event || have_signal) break; + if (_ecore_signal_count_get() > 0) break; if (_ecore_timers_exists()) goto start_loop; if (do_quit) break; } @@ -1503,10 +1520,11 @@ _ecore_main_loop_iterate_internal(int once_only) { for (;;) { + _ecore_time_loop_time = ecore_time_get(); if (!_ecore_idler_call()) goto start_loop; - if (_ecore_main_select(0.0) > 0) have_event = 1; + if (_ecore_main_select(0.0) > 0) break; if (_ecore_event_exist()) break; - if (_ecore_signal_count_get() > 0) have_signal = 1; + if (_ecore_signal_count_get() > 0) break; if (have_event || have_signal) break; next_time = _ecore_timer_next_get(); if (next_time <= 0) break; @@ -1514,7 +1532,6 @@ _ecore_main_loop_iterate_internal(int once_only) } } } - _ecore_time_loop_time = ecore_time_get(); } if (_ecore_fps_debug) t1 = ecore_time_get(); /* we came out of our "wait state" so idle has exited */ diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c index ad537a6..3d5923e 100644 --- a/src/lib/ecore/ecore_pipe.c +++ b/src/lib/ecore/ecore_pipe.c @@ -5,6 +5,28 @@ #include #include #include +#include + +#ifdef HAVE_ISFINITE +# define ECORE_FINITE(t) isfinite(t) +#else +# ifdef _MSC_VER +# define ECORE_FINITE(t) _finite(t) +# else +# define ECORE_FINITE(t) finite(t) +# endif +#endif + +#define FIX_HZ 1 + +#ifdef FIX_HZ +# ifndef _MSC_VER +# include +# endif +# ifndef HZ +# define HZ 100 +# endif +#endif #ifdef HAVE_EVIL # include @@ -60,6 +82,7 @@ struct _Ecore_Pipe int handling; size_t already_read; void *passed_data; + int message; Eina_Bool delete_me : 1; }; @@ -368,6 +391,143 @@ ecore_pipe_read_close(Ecore_Pipe *p) } /** + * Stop monitoring if necessary the pipe for reading. See ecore_pipe_thaw() + * for monitoring it again. + * + * @param p The Ecore_Pipe object. + * @since 1.1 + */ +EAPI void +ecore_pipe_freeze(Ecore_Pipe *p) +{ + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_freeze"); + return; + } + if (p->fd_handler) + { + ecore_main_fd_handler_del(p->fd_handler); + p->fd_handler = NULL; + } +} + +/** + * Start monitoring again the pipe for reading. See ecore_pipe_freeze() for + * stopping the monitoring activity. This will not work if + * ecore_pipe_read_close() was previously called on the same pipe. + * + * @param p The Ecore_Pipe object. + * @since 1.1 + */ +EAPI void +ecore_pipe_thaw(Ecore_Pipe *p) +{ + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_thaw"); + return; + } + if (!p->fd_handler && p->fd_read != PIPE_FD_INVALID) + { + p->fd_handler = ecore_main_fd_handler_add(p->fd_read, + ECORE_FD_READ, + _ecore_pipe_read, + p, + NULL, NULL); + } +} + +/** + * @brief Wait from another thread on the read side of a pipe. + * + * @param p The pipe to watch on. + * @param message_count The minimal number of message to wait before exiting. + * @param wait The amount of time in second to wait before exiting. + * @return the number of message catched during that wait call. + * @since 1.1 + * + * Negative value for @p wait means infite wait. + */ +EAPI int +ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait) +{ + struct timeval tv, *t; + fd_set rset; + double end = 0.0; + double timeout; + int ret; + int total = 0; + + if (p->fd_read == PIPE_FD_INVALID) + return -1; + + FD_ZERO(&rset); + FD_SET(p->fd_read, &rset); + + if (wait >= 0.0) + end = ecore_time_get() + wait; + timeout = wait; + + while (message_count > 0 && (timeout > 0.0 || wait <= 0.0)) + { + if (wait >= 0.0) + { + /* finite() tests for NaN, too big, too small, and infinity. */ + if ((!ECORE_FINITE(timeout)) || (timeout == 0.0)) + { + tv.tv_sec = 0; + tv.tv_usec = 0; + } + else if (timeout > 0.0) + { + int sec, usec; +#ifdef FIX_HZ + timeout += (0.5 / HZ); + sec = (int)timeout; + usec = (int)((timeout - (double)sec) * 1000000); +#else + sec = (int)timeout; + usec = (int)((timeout - (double)sec) * 1000000); +#endif + tv.tv_sec = sec; + tv.tv_usec = usec; + } + t = &tv; + } + else + { + t = NULL; + } + + ret = main_loop_select(p->fd_read + 1, &rset, NULL, NULL, t); + + if (ret > 0) + { + _ecore_pipe_read(p, NULL); + message_count -= p->message; + total += p->message; + p->message = 0; + } + else if (ret == 0) + { + break; + } + else if (errno != EINTR) + { + close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + break; + } + + if (wait >= 0.0) + timeout = end - ecore_time_get(); + } + + return total; +} + +/** * Close the write end of an Ecore_Pipe object created with ecore_pipe_add(). * * @param p The Ecore_Pipe object. @@ -409,7 +569,7 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes) } if (p->delete_me) return EINA_FALSE; - + if (p->fd_write == PIPE_FD_INVALID) return EINA_FALSE; /* First write the len into the pipe */ @@ -454,7 +614,7 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes) ret = pipe_write(p->fd_write, ((unsigned char *)buffer) + already_written, nbytes - already_written); - + if (ret == (ssize_t)(nbytes - already_written)) return EINA_TRUE; else if (ret >= 0) @@ -511,7 +671,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) p = (Ecore_Pipe *)data; start_time = ecore_time_get(); - + p->handling++; for (i = 0; i < 16; i++) { @@ -547,7 +707,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) return ECORE_CALLBACK_CANCEL; } #ifndef _WIN32 - else if ((ret == PIPE_FD_ERROR) && + else if ((ret == PIPE_FD_ERROR) && ((errno == EINTR) || (errno == EAGAIN))) { _ecore_pipe_unhandle(p); @@ -585,7 +745,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) ret = pipe_read(p->fd_read, ((unsigned char *)p->passed_data) + p->already_read, p->len - p->already_read); - + /* catch the non error case first */ if (ret == (ssize_t)(p->len - p->already_read)) { @@ -596,6 +756,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) p->passed_data = NULL; p->already_read = 0; p->len = 0; + p->message++; } else if (ret >= 0) { @@ -614,7 +775,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) return ECORE_CALLBACK_CANCEL; } #ifndef _WIN32 - else if ((ret == PIPE_FD_ERROR) && + else if ((ret == PIPE_FD_ERROR) && ((errno == EINTR) || (errno == EAGAIN))) return ECORE_CALLBACK_RENEW; else @@ -643,7 +804,7 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__) } #endif } - + _ecore_pipe_unhandle(p); return ECORE_CALLBACK_RENEW; } diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h index 7e2afa0..a0a000b 100644 --- a/src/lib/ecore/ecore_private.h +++ b/src/lib/ecore/ecore_private.h @@ -198,5 +198,6 @@ void _ecore_main_loop_shutdown(void); extern int _ecore_fps_debug; extern double _ecore_time_loop_time; extern Eina_Bool _ecore_glib_always_integrate; +extern Ecore_Select_Function main_loop_select; #endif diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c index 4dc7381..5c62e33 100644 --- a/src/lib/ecore/ecore_thread.c +++ b/src/lib/ecore/ecore_thread.c @@ -93,6 +93,7 @@ int _ecore_thread_win32_join(win32_thread *x, void **res) CloseHandle(x->thread); } if (res) *res = x->val; + free(x); return 0; } @@ -168,7 +169,7 @@ typedef struct LONG readers_count; LONG writers_count; int readers; - int writers; + int writers; LK(mutex); CD(cond_read); CD(cond_write); @@ -677,7 +678,11 @@ _ecore_thread_worker(Ecore_Pthread_Data *pth) LKU(_ecore_pending_job_threads_mutex); /* Sleep a little to prevent premature death */ +#ifdef _WIN32 + Sleep(1); /* around 50ms */ +#else usleep(200); +#endif LKL(_ecore_pending_job_threads_mutex); if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback) @@ -781,10 +786,10 @@ _ecore_thread_shutdown(void) /* Improve emergency shutdown */ EINA_LIST_FREE(_ecore_active_job_threads, pth) { - Ecore_Pipe *p; + Ecore_Pipe *ep; PHA(pth->thread); - PHJ(pth->thread, p); + PHJ(pth->thread, ep); ecore_pipe_del(pth->p); } @@ -1737,33 +1742,34 @@ ecore_thread_global_data_del(const char *key) EAPI void * ecore_thread_global_data_wait(const char *key, double seconds) { - double time = 0; + double tm = 0; Ecore_Thread_Data *ret = NULL; + if (!key) return NULL; #ifdef EFL_HAVE_THREADS if (!_ecore_thread_global_hash) return NULL; if (seconds > 0) - time = ecore_time_get() + seconds; + tm = ecore_time_get() + seconds; while (1) { #ifndef _WIN32 struct timespec t = { 0, 0 }; - t.tv_sec = (long int)time; - t.tv_nsec = (long int)((time - (double)t.tv_sec) * 1000000000); + t.tv_sec = (long int)tm; + t.tv_nsec = (long int)((tm - (double)t.tv_sec) * 1000000000); #else struct timeval t = { 0, 0 }; - t.tv_sec = (long int)time; - t.tv_usec = (long int)((time - (double)t.tv_sec) * 1000000); + t.tv_sec = (long int)tm; + t.tv_usec = (long int)((tm - (double)t.tv_sec) * 1000000); #endif LRWKRL(_ecore_thread_global_hash_lock); ret = eina_hash_find(_ecore_thread_global_hash, key); LRWKU(_ecore_thread_global_hash_lock); - if ((ret) || (!seconds) || ((seconds > 0) && (time <= ecore_time_get()))) + if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get()))) break; LKL(_ecore_thread_global_hash_mutex); CDW(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex, &t); diff --git a/src/lib/ecore/ecore_time.c b/src/lib/ecore/ecore_time.c index 5926ca1..2bd5fa6 100644 --- a/src/lib/ecore/ecore_time.c +++ b/src/lib/ecore/ecore_time.c @@ -12,6 +12,10 @@ # include #endif +#if defined(__APPLE__) && defined(__MACH__) +# include +#endif + #include "Ecore.h" #include "ecore_private.h" @@ -19,6 +23,8 @@ #ifdef HAVE_CLOCK_GETTIME static clockid_t _ecore_time_clock_id = -1; +#elif defined(__APPLE__) && defined(__MACH__) +static double _ecore_time_clock_conversion = 1e-9; #endif double _ecore_time_loop_time = -1.0; @@ -66,12 +72,12 @@ ecore_time_get(void) } return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0); -#else -# ifdef HAVE_EVIL +#elif defined(HAVE_EVIL) return evil_time_get(); -# else +#elif defined(__APPLE__) && defined(__MACH__) + return _ecore_time_clock_conversion * (double) mach_absolute_time(); +#else return ecore_time_unix_get(); -# endif #endif } @@ -165,9 +171,22 @@ _ecore_time_init(void) } #else # ifndef HAVE_EVIL +# if defined(__APPLE__) && defined(__MACH__) + mach_timebase_info_data_t info; + kern_return_t err = mach_timebase_info(&info); + if (err == 0) + { + _ecore_time_clock_conversion = 1e-9 * (double) info.numer / (double) info.denom; + } + else + { + WRN("Unable to get timebase info. Fallback to nanoseconds."); + } +# else # warning "Your platform isn't supported yet" CRIT("Platform does not support clock_gettime. " "Fallback to unix time."); +# endif # endif #endif diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c index 606ccb5..b6ab05c 100644 --- a/src/lib/ecore/ecore_timer.c +++ b/src/lib/ecore/ecore_timer.c @@ -8,6 +8,12 @@ #include "Ecore.h" #include "ecore_private.h" +#ifdef WANT_ECORE_TIMER_DUMP +# include +# include +# define ECORE_TIMER_DEBUG_BT_NUM 64 + typedef void (*Ecore_Timer_Bt_Func) (); +#endif struct _Ecore_Timer { @@ -19,6 +25,11 @@ struct _Ecore_Timer Ecore_Task_Cb func; void *data; +#ifdef WANT_ECORE_TIMER_DUMP + Ecore_Timer_Bt_Func timer_bt[ECORE_TIMER_DEBUG_BT_NUM]; + int timer_bt_num; +#endif + int references; unsigned char delete_me : 1; unsigned char just_added : 1; @@ -27,6 +38,7 @@ struct _Ecore_Timer static void _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, void *data); +static int _ecore_timer_cmp(const void *d1, const void *d2); static int timers_added = 0; static int timers_delete_me = 0; @@ -129,6 +141,12 @@ ecore_timer_add(double in, Ecore_Task_Cb func, const void *data) if (!timer) return NULL; ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); now = ecore_time_get(); + +#ifdef WANT_ECORE_TIMER_DUMP + timer->timer_bt_num = backtrace((void**) (timer->timer_bt), + ECORE_TIMER_DEBUG_BT_NUM); +#endif + _ecore_timer_set(timer, now + in, in, func, (void *)data); return timer; } @@ -157,6 +175,12 @@ ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data) if (!timer) return NULL; ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); now = ecore_loop_time_get(); + +#ifdef WANT_ECORE_TIMER_DUMP + timer->timer_bt_num = backtrace((void**) (timer->timer_bt), + ECORE_TIMER_DEBUG_BT_NUM); +#endif + _ecore_timer_set(timer, now + in, in, func, (void *)data); return timer; } @@ -342,6 +366,59 @@ ecore_timer_thaw(Ecore_Timer *timer) _ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data); } +EAPI char * +ecore_timer_dump(void) +{ +#ifdef WANT_ECORE_TIMER_DUMP + Eina_Strbuf *result; + char *out; + Ecore_Timer *tm; + Eina_List *tmp = NULL; + int living_timer = 0; + int unknow_timer = 0; + + result = eina_strbuf_new(); + + EINA_INLIST_FOREACH(timers, tm) + tmp = eina_list_sorted_insert(tmp, _ecore_timer_cmp, tm); + + EINA_LIST_FREE(tmp, tm) + { + char **strings; + int j; + + if (!tm->frozen && !tm->delete_me) + living_timer++; + + strings = backtrace_symbols((void**) tm->timer_bt, tm->timer_bt_num); + if (tm->timer_bt_num <= 0 || strings == NULL) + { + unknow_timer++; + continue ; + } + + eina_strbuf_append_printf(result, "*** timer: %f ***\n", tm->in); + if (tm->frozen) + eina_strbuf_append(result, "FROZEN\n"); + if (tm->delete_me) + eina_strbuf_append(result, "DELETED\n"); + for (j = 0; j < tm->timer_bt_num; j++) + eina_strbuf_append_printf(result, "%s\n", strings[j]); + + free(strings); + } + + eina_strbuf_append_printf(result, "\n***\nThere is %i living timer.\nWe did lost track of %i timers.\n", living_timer, unknow_timer); + + out = eina_strbuf_string_steal(result); + eina_strbuf_free(result); + + return out; +#else + return NULL; +#endif +} + /** * @} */ @@ -601,3 +678,12 @@ _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, v } timers = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); } + +static int +_ecore_timer_cmp(const void *d1, const void *d2) +{ + const Ecore_Timer *t1 = d1; + const Ecore_Timer *t2 = d2; + + return (int) ((t1->in - t2->in) * 100); +} diff --git a/src/lib/ecore_con/.cvsignore b/src/lib/ecore_con/.cvsignore deleted file mode 100644 index 310b663..0000000 --- a/src/lib/ecore_con/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Ecore_Con.h -Makefile -Makefile.in -*.lo -libecore_con.la diff --git a/src/lib/ecore_con/Ecore_Con.h b/src/lib/ecore_con/Ecore_Con.h index 692d6c5..4d9460f 100644 --- a/src/lib/ecore_con/Ecore_Con.h +++ b/src/lib/ecore_con/Ecore_Con.h @@ -14,9 +14,13 @@ # undef EAPI #endif -#ifdef _MSC_VER -# ifdef BUILDING_DLL -# define EAPI __declspec(dllexport) +#ifdef _WIN32 +# ifdef EFL_ECORE_CON_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif # else # define EAPI __declspec(dllimport) # endif @@ -525,6 +529,10 @@ typedef enum _Ecore_Con_Url_Time EAPI int ecore_con_url_init(void); EAPI int ecore_con_url_shutdown(void); + +EAPI void ecore_con_url_pipeline_set(Eina_Bool enable); +EAPI Eina_Bool ecore_con_url_pipeline_get(void); + EAPI Ecore_Con_Url * ecore_con_url_new(const char *url); EAPI Ecore_Con_Url * ecore_con_url_custom_new(const char *url, const char *custom_request); diff --git a/src/lib/ecore_con/Makefile.am b/src/lib/ecore_con/Makefile.am index e2969bd..128c47c 100644 --- a/src/lib/ecore_con/Makefile.am +++ b/src/lib/ecore_con/Makefile.am @@ -5,6 +5,7 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src/lib/ecore_con \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_con \ +@EFL_ECORE_CON_BUILD@ \ @SSL_CFLAGS@ \ @CURL_CFLAGS@ \ @EINA_CFLAGS@ \ @@ -19,8 +20,13 @@ includesdir = $(includedir)/ecore-@VMAJ@ libecore_con_la_SOURCES = \ ecore_con.c \ ecore_con_ssl.c \ -ecore_con_url.c \ -ecore_con_local.c +ecore_con_url.c + +if ECORE_HAVE_WIN32 +libecore_con_la_SOURCES += ecore_con_local_win32.c +else +libecore_con_la_SOURCES += ecore_con_local.c +endif if HAVE_CARES libecore_con_la_SOURCES += ecore_con_ares.c diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 3131551..6450781 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -180,7 +180,7 @@ ecore_con_shutdown(void) { Eina_List *l, *l2; Ecore_Con_Server *svr; - + if (--_ecore_con_init_count != 0) return _ecore_con_init_count; @@ -351,8 +351,13 @@ ecore_con_server_add(Ecore_Con_Type compl_type, (type == ECORE_CON_LOCAL_SYSTEM) || (type == ECORE_CON_LOCAL_ABSTRACT)) /* Local */ +#ifdef _WIN32 + if (!ecore_con_local_listen(svr)) + goto error; +#else if (!ecore_con_local_listen(svr, _ecore_con_svr_tcp_handler, svr)) goto error; +#endif if ((type == ECORE_CON_REMOTE_TCP) || (type == ECORE_CON_REMOTE_NODELAY)) @@ -470,10 +475,17 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, (type == ECORE_CON_LOCAL_SYSTEM) || (type == ECORE_CON_LOCAL_ABSTRACT)) /* Local */ +#ifdef _WIN32 + if (!ecore_con_local_connect(svr, _ecore_con_cl_handler, + _ecore_con_event_server_add_free)) + goto + error; +#else if (!ecore_con_local_connect(svr, _ecore_con_cl_handler, svr, _ecore_con_event_server_add_free)) goto error; +#endif if ((type == ECORE_CON_REMOTE_TCP) || (type == ECORE_CON_REMOTE_NODELAY)) @@ -1191,23 +1203,28 @@ ecore_con_event_server_del(Ecore_Con_Server *svr) } void -ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num) +ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate) { Ecore_Con_Event_Server_Data *e; - + e = malloc(sizeof(Ecore_Con_Event_Server_Data)); EINA_SAFETY_ON_NULL_RETURN(e); - + svr->event_count++; e->server = svr; - e->data = malloc(num); - if (!e->data) + if (duplicate) { - ERR("alloc!"); - free(e); - return; + e->data = malloc(num); + if (!e->data) + { + ERR("alloc!"); + free(e); + return; + } + memcpy(e->data, buf, num); } - memcpy(e->data, buf, num); + else + e->data = buf; e->size = num; ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e, _ecore_con_event_server_data_free, NULL); @@ -1250,7 +1267,7 @@ ecore_con_event_client_del(Ecore_Con_Client *cl) } void -ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num) +ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate) { Ecore_Con_Event_Client_Data *e; e = malloc(sizeof(Ecore_Con_Event_Client_Data)); @@ -1260,15 +1277,19 @@ ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num) cl->event_count++; _ecore_con_cl_timer_update(cl); e->client = cl; - e->data = malloc(num); - if (!e->data) + if (duplicate) { - free(cl->client_addr); - free(cl); - return; + e->data = malloc(num); + if (!e->data) + { + free(cl->client_addr); + free(cl); + return; + } + memcpy(e->data, buf, num); } - - memcpy(e->data, buf, num); + else + e->data = buf; e->size = num; ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e, (Ecore_End_Cb)_ecore_con_event_client_data_free, cl->host_server); @@ -1349,6 +1370,10 @@ _ecore_con_server_free(Ecore_Con_Server *svr) } } +#ifdef _WIN32 + ecore_con_local_win32_server_del(svr); +#endif + if (svr->write_buf) free(svr->write_buf); @@ -1410,6 +1435,11 @@ _ecore_con_client_free(Ecore_Con_Client *cl) break; } } + +#ifdef _WIN32 + ecore_con_local_win32_client_del(cl); +#endif + if (cl->buf) free(cl->buf); @@ -1438,7 +1468,7 @@ _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); @@ -1514,13 +1544,13 @@ _ecore_con_cb_tcp_listen(void *data, 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; } - + lin.l_onoff = 1; lin.l_linger = 0; if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin, @@ -1529,7 +1559,7 @@ _ecore_con_cb_tcp_listen(void *data, ecore_con_event_server_error(svr, strerror(errno)); goto error; } - + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY) { int flag = 1; @@ -1932,8 +1962,7 @@ _ecore_con_svr_tcp_handler(void *data, Ecore_Con_Server *svr; Ecore_Con_Client *cl = NULL; unsigned char client_addr[256]; - unsigned int client_addr_len = sizeof(client_addr); - int new_fd; + unsigned int client_addr_len; svr = data; if (svr->dead) @@ -1947,42 +1976,46 @@ _ecore_con_svr_tcp_handler(void *data, return ECORE_CALLBACK_RENEW; /* a new client */ + + cl = calloc(1, sizeof(Ecore_Con_Client)); + if (!cl) + { + ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client"); + return ECORE_CALLBACK_RENEW; + } + cl->host_server = svr; + + client_addr_len = sizeof(client_addr); memset(&client_addr, 0, client_addr_len); - new_fd = accept(svr->fd, (struct sockaddr *)&client_addr, (socklen_t *)&client_addr_len); - if (new_fd < 0) + 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)); - return ECORE_CALLBACK_RENEW; + goto free_cl; } 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 error; - } - - cl = calloc(1, sizeof(Ecore_Con_Client)); - if (!cl) - { - ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client"); - goto error; + goto close_fd; } - cl->fd = new_fd; - cl->host_server = svr; - if (fcntl(new_fd, F_SETFL, O_NONBLOCK) < 0) + if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) { ecore_con_event_server_error(svr, strerror(errno)); - goto error; + goto close_fd; } - if (fcntl(new_fd, F_SETFD, FD_CLOEXEC) < 0) + if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) { ecore_con_event_server_error(svr, strerror(errno)); - goto error; + goto close_fd; } 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; + ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT); if (svr->type & ECORE_CON_SSL) @@ -1990,33 +2023,33 @@ _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 error; + goto del_handler; } 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"); - return ECORE_CALLBACK_RENEW; + goto del_handler; } cl->client_addr_len = client_addr_len; memcpy(cl->client_addr, &client_addr, client_addr_len); - + svr->clients = eina_list_append(svr->clients, cl); svr->client_count++; - + if ((!cl->delete_me) && (!cl->handshaking)) ecore_con_event_client_add(cl); - + return ECORE_CALLBACK_RENEW; -error: - if (cl && cl->fd_handler) - { - ecore_main_fd_handler_del(cl->fd_handler); - close(cl->fd); - free(cl); - } + del_handler: + ecore_main_fd_handler_del(cl->fd_handler); + close_fd: + close(cl->fd); + free_cl: + free(cl); + return ECORE_CALLBACK_RENEW; } @@ -2038,7 +2071,7 @@ _ecore_con_cl_read(Ecore_Con_Server *svr) if (!ecore_con_ssl_server_init(svr)) lost_server = EINA_FALSE; } - + if (!(svr->type & ECORE_CON_SSL)) { num = read(svr->fd, buf, sizeof(buf)); @@ -2055,9 +2088,9 @@ _ecore_con_cl_read(Ecore_Con_Server *svr) if (num >= 0) lost_server = EINA_FALSE; } - + if ((!svr->delete_me) && (num > 0)) - ecore_con_event_server_data(svr, buf, num); + ecore_con_event_server_data(svr, buf, num, EINA_TRUE); if (lost_server) _ecore_con_server_kill(svr); @@ -2143,7 +2176,7 @@ _ecore_con_cl_udp_handler(void *data, num = read(svr->fd, buf, READBUFSIZ); if ((!svr->delete_me) && (num > 0)) - ecore_con_event_server_data(svr, buf, num); + ecore_con_event_server_data(svr, buf, num, EINA_TRUE); if (num < 0 && (errno != EAGAIN) && (errno != EINTR)) { @@ -2226,7 +2259,7 @@ _ecore_con_svr_udp_handler(void *data, svr->client_count++; ecore_con_event_client_add(cl); - ecore_con_event_client_data(cl, buf, num); + ecore_con_event_client_data(cl, buf, num, EINA_TRUE); return ECORE_CALLBACK_RENEW; } @@ -2234,11 +2267,12 @@ _ecore_con_svr_udp_handler(void *data, static void _ecore_con_svr_cl_read(Ecore_Con_Client *cl) { - DBG("cl=%p", cl); int num = 0; Eina_Bool lost_client = EINA_TRUE; unsigned char buf[READBUFSIZ]; + DBG("cl=%p", cl); + if (cl->handshaking) { /* add an extra handshake attempt just before read, even though @@ -2268,7 +2302,7 @@ _ecore_con_svr_cl_read(Ecore_Con_Client *cl) } if ((!cl->delete_me) && (num > 0)) - ecore_con_event_client_data(cl, buf, num); + ecore_con_event_client_data(cl, buf, num, EINA_TRUE); if (lost_client) { @@ -2324,7 +2358,12 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) { int count, num; - if (!svr->write_buf) +#ifdef _WIN32 + if (ecore_con_local_win32_server_flush(svr)) + return; +#endif + + if (!svr->write_buf && svr->fd_handler) { ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); return; @@ -2374,7 +2413,7 @@ _ecore_con_server_flush(Ecore_Con_Server *svr) if (svr->fd_handler) ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); } - else if (count < num) + else if ((count < num) && svr->fd_handler) ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); } @@ -2383,7 +2422,12 @@ _ecore_con_client_flush(Ecore_Con_Client *cl) { int num, count = 0; - if (!cl->buf) +#ifdef _WIN32 + if (ecore_con_local_win32_client_flush(cl)) + return; +#endif + + if (!cl->buf && cl->fd_handler) { ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); return; @@ -2564,7 +2608,7 @@ _ecore_con_event_client_error_free(Ecore_Con_Server *svr, Ecore_Con_Event_Client _ecore_con_server_free(svr); if (e->error) free(e->error); free(e); - + } static void diff --git a/src/lib/ecore_con/ecore_con_ares.c b/src/lib/ecore_con/ecore_con_ares.c index 2dac118..f66ac09 100644 --- a/src/lib/ecore_con/ecore_con_ares.c +++ b/src/lib/ecore_con/ecore_con_ares.c @@ -68,8 +68,8 @@ static Eina_Bool _ecore_con_info_cares_timeout_cb(void *data); static void _ecore_con_info_cares_state_cb(void *data, ares_socket_t fd, - int read, - int write); + int readable, + int writable); static int _ecore_con_info_fds_search(const Ecore_Con_FD *fd1, const Ecore_Con_FD *fd2); @@ -78,7 +78,7 @@ int ecore_con_info_init(void) { struct ares_options opts; - + if (!info_init) { if (ares_library_init(ARES_LIB_INIT_ALL)) @@ -328,16 +328,16 @@ static Eina_Bool _ecore_con_info_cares_fd_cb(Ecore_Con_FD *ecf, Ecore_Fd_Handler *fd_handler) { - int read, write; + ares_socket_t read_fd, write_fd; - read = write = ARES_SOCKET_BAD; + read_fd = write_fd = ARES_SOCKET_BAD; if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) - read = ecf->fd; + read_fd = ecf->fd; if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) - write = ecf->fd; - - ares_process_fd(info_channel, read, write); + write_fd = ecf->fd; + + ares_process_fd(info_channel, read_fd, write_fd); return ECORE_CALLBACK_RENEW; } @@ -352,8 +352,8 @@ _ecore_con_info_fds_search(const Ecore_Con_FD *fd1, static void _ecore_con_info_cares_state_cb(void *data __UNUSED__, ares_socket_t fd, - int read, - int write) + int readable, + int writable) { int flags = 0; Ecore_Con_FD *search = NULL, *ecf = NULL; @@ -361,7 +361,7 @@ _ecore_con_info_cares_state_cb(void *data __UNUSED__, search = eina_list_search_unsorted(info_fds, (Eina_Compare_Cb)_ecore_con_info_fds_search, &ecf); - if (!(read | write)) + if (!(readable | writable)) { ares_process_fd(info_channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); if (search) @@ -387,8 +387,8 @@ _ecore_con_info_cares_state_cb(void *data __UNUSED__, info_fds = eina_list_append(info_fds, search); } - if (read) flags |= ECORE_FD_READ; - if (write) flags |= ECORE_FD_WRITE; + if (readable) flags |= ECORE_FD_READ; + if (writable) flags |= ECORE_FD_WRITE; ecore_main_fd_handler_active_set(search->handler, flags); } diff --git a/src/lib/ecore_con/ecore_con_info.c b/src/lib/ecore_con/ecore_con_info.c index 3cedb05..e20f788 100644 --- a/src/lib/ecore_con/ecore_con_info.c +++ b/src/lib/ecore_con/ecore_con_info.c @@ -327,7 +327,7 @@ static void _ecore_con_info_readdata(CB_Data *cbdata) { Ecore_Con_Info container; - Ecore_Con_Info *recv; + Ecore_Con_Info *recv_info; unsigned char *torecv; int torecv_len; @@ -348,22 +348,22 @@ _ecore_con_info_readdata(CB_Data *cbdata) if ((size > 0) && ((size_t)size == torecv_len - sizeof(Ecore_Con_Info))) { - recv = (Ecore_Con_Info *)torecv; + recv_info = (Ecore_Con_Info *)torecv; - recv->info.ai_addr = + recv_info->info.ai_addr = (struct sockaddr *)(torecv + sizeof(Ecore_Con_Info)); if ((size_t)torecv_len != - (sizeof(Ecore_Con_Info) + recv->info.ai_addrlen)) - recv->info.ai_canonname = (char *) - (torecv + sizeof(Ecore_Con_Info) + recv->info.ai_addrlen); + (sizeof(Ecore_Con_Info) + recv_info->info.ai_addrlen)) + recv_info->info.ai_canonname = (char *) + (torecv + sizeof(Ecore_Con_Info) + recv_info->info.ai_addrlen); else - recv->info.ai_canonname = NULL; + recv_info->info.ai_canonname = NULL; - recv->info.ai_next = NULL; + recv_info->info.ai_next = NULL; if (cbdata->data) { - cbdata->cb_done(cbdata->data, recv); + cbdata->cb_done(cbdata->data, recv_info); ecore_con_server_infos_del(cbdata->data, cbdata); } diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c index 658fdc8..9bfe4fe 100644 --- a/src/lib/ecore_con/ecore_con_local.c +++ b/src/lib/ecore_con/ecore_con_local.c @@ -21,10 +21,6 @@ # include #endif -#ifdef HAVE_EVIL -# include -#endif - #include #include diff --git a/src/lib/ecore_con/ecore_con_local_win32.c b/src/lib/ecore_con/ecore_con_local_win32.c new file mode 100644 index 0000000..ed634bb --- /dev/null +++ b/src/lib/ecore_con/ecore_con_local_win32.c @@ -0,0 +1,784 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include + +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +#define BUFSIZE 512 + + +static int _ecore_con_local_init_count = 0; + +int +ecore_con_local_init(void) +{ + if (++_ecore_con_local_init_count != 1) + return _ecore_con_local_init_count; + + return _ecore_con_local_init_count; +} + +int +ecore_con_local_shutdown(void) +{ + if (--_ecore_con_local_init_count != 0) + return _ecore_con_local_init_count; + + return _ecore_con_local_init_count; +} + + +static Eina_Bool +_ecore_con_local_win32_server_read_client_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Client *cl; + void *buf; + DWORD n; + Eina_Bool broken_pipe = EINA_FALSE; + + cl = (Ecore_Con_Client *)data; + + if (!ResetEvent(cl->host_server->event_read)) + return ECORE_CALLBACK_RENEW; + + buf = malloc(cl->host_server->nbr_bytes); + if (!buf) + return ECORE_CALLBACK_RENEW; + + if (ReadFile(cl->host_server->pipe, buf, cl->host_server->nbr_bytes, &n, NULL)) + { + if (!cl->delete_me) + ecore_con_event_client_data(cl, buf, cl->host_server->nbr_bytes, EINA_FALSE); + cl->host_server->want_write = 1; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + broken_pipe = EINA_TRUE; + } + + if (broken_pipe) + { +#if 0 + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_client_error(cl, msg); + free(msg); + } +#endif + if (!cl->delete_me) + ecore_con_event_client_del(cl); + cl->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + } + + if (cl->host_server->want_write) + ecore_con_local_win32_client_flush(cl); + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_con_local_win32_server_peek_client_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Client *cl; +#if 0 + char *msg; +#endif + + cl = (Ecore_Con_Client *)data; + + if (!ResetEvent(cl->host_server->event_peek)) + return ECORE_CALLBACK_RENEW; + +#if 0 + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(cl->host_server, msg); + free(msg); + } +#endif + if (!cl->host_server->delete_me) + ecore_con_event_server_del(cl->host_server); + cl->host_server->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_con_local_win32_client_peek_server_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Server *svr; +#if 0 + char *msg; +#endif + + svr = (Ecore_Con_Server *)data; + + if (!ResetEvent(svr->event_peek)) + return ECORE_CALLBACK_RENEW; +#if 0 + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(svr, msg); + free(msg); + } +#endif + if (!svr->delete_me) + ecore_con_event_server_del(svr); + svr->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_con_local_win32_client_read_server_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Server *svr; + void *buf; + DWORD n; + Eina_Bool broken_pipe = EINA_FALSE; + + svr = (Ecore_Con_Server *)data; + + if (!ResetEvent(svr->event_read)) + return ECORE_CALLBACK_RENEW; + + buf = malloc(svr->nbr_bytes); + if (!buf) + return ECORE_CALLBACK_RENEW; + + if (ReadFile(svr->pipe, buf, svr->nbr_bytes, &n, NULL)) + { + if (!svr->delete_me) + ecore_con_event_server_data(svr, buf, svr->nbr_bytes, EINA_FALSE); + svr->want_write = 1; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + broken_pipe = EINA_TRUE; + } + + if (broken_pipe) + { +#if 0 + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(svr, msg); + free(msg); + } +#endif + if (!svr->delete_me) + ecore_con_event_server_del(svr); + svr->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + } + + if (svr->want_write) + ecore_con_local_win32_server_flush(svr); + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +/* thread to read data sent by the server to the client */ +static unsigned int __stdcall +_ecore_con_local_win32_client_read_server_thread(void *data) +{ + Ecore_Con_Server *svr; + DWORD nbr_bytes = 0; + + svr = (Ecore_Con_Server *)data; + + svr->read_stopped = EINA_FALSE; + + while (!svr->read_stop) + { + if (PeekNamedPipe(svr->pipe, NULL, 0, NULL, &nbr_bytes, NULL)) + { + if (nbr_bytes <= 0) + continue; + + svr->nbr_bytes = nbr_bytes; + if (!SetEvent(svr->event_read)) + continue; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + { + if (!SetEvent(svr->event_peek)) + continue; + break; + } + } + } + + printf(" ### %s\n", __FUNCTION__); + svr->read_stopped = EINA_TRUE; + _endthreadex(0); + return 0; +} + +/* thread to read data sent by the client to the server */ +static unsigned int __stdcall +_ecore_con_local_win32_server_read_client_thread(void *data) +{ + Ecore_Con_Client *cl; + DWORD nbr_bytes = 0; + + cl = (Ecore_Con_Client *)data; + + cl->host_server->read_stopped = EINA_FALSE; + + while (!cl->host_server->read_stop) + { + if (PeekNamedPipe(cl->host_server->pipe, NULL, 0, NULL, &nbr_bytes, NULL)) + { + if (nbr_bytes <= 0) + continue; + + cl->host_server->nbr_bytes = nbr_bytes; + if (!SetEvent(cl->host_server->event_read)) + continue; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + { + if (!SetEvent(cl->host_server->event_peek)) + continue; + break; + } + } + } + + printf(" ### %s\n", __FUNCTION__); + cl->host_server->read_stopped = EINA_TRUE; + _endthreadex(0); + return 0; +} + +static Eina_Bool +_ecore_con_local_win32_client_add(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Client *cl = NULL; + Ecore_Con_Server *svr; + Ecore_Win32_Handler *handler_read; + Ecore_Win32_Handler *handler_peek; + + svr = (Ecore_Con_Server *)data; + + if (!svr->pipe) + return ECORE_CALLBACK_CANCEL; + + if (svr->dead) + return ECORE_CALLBACK_CANCEL; + + if (svr->delete_me) + return ECORE_CALLBACK_CANCEL; + + if ((svr->client_limit >= 0) && (!svr->reject_excess_clients) && + (svr->client_count >= (unsigned int)svr->client_limit)) + return ECORE_CALLBACK_CANCEL; + + cl = calloc(1, sizeof(Ecore_Con_Client)); + if (!cl) + { + ERR("allocation failed"); + return ECORE_CALLBACK_CANCEL; + } + + cl->host_server = svr; + ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT); + + cl->host_server->event_read = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!cl->host_server->event_read) + { + ERR("Can not create event read"); + goto free_cl; + } + + handler_read = ecore_main_win32_handler_add(cl->host_server->event_read, + _ecore_con_local_win32_server_read_client_handler, + cl); + if (!handler_read) + { + ERR("Can not create handler read"); + goto close_event_read; + } + + cl->host_server->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!cl->host_server->event_peek) + { + ERR("Can not create event peek"); + goto del_handler_read; + } + + handler_peek = ecore_main_win32_handler_add(cl->host_server->event_peek, + _ecore_con_local_win32_server_peek_client_handler, + cl); + if (!handler_peek) + { + ERR("Can not create handler peek"); + goto close_event_peek; + } + + cl->host_server->read_stopped = EINA_TRUE; + cl->host_server->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_server_read_client_thread, cl, CREATE_SUSPENDED, NULL); + if (!cl->host_server->thread_read) + { + ERR("Can not launch thread"); + goto del_handler_peek; + } + + svr->clients = eina_list_append(svr->clients, cl); + svr->client_count++; + + if (!cl->delete_me) + ecore_con_event_client_add(cl); + + ecore_main_win32_handler_del(wh); + + ResumeThread(cl->host_server->thread_read); + return ECORE_CALLBACK_DONE; + + del_handler_peek: + ecore_main_win32_handler_del(handler_peek); + close_event_peek: + CloseHandle(cl->host_server->event_peek); + del_handler_read: + ecore_main_win32_handler_del(handler_read); + close_event_read: + CloseHandle(cl->host_server->event_read); + free_cl: + free(cl); + + return ECORE_CALLBACK_CANCEL; +} + +static unsigned int __stdcall +_ecore_con_local_win32_listening(void *data) +{ + Ecore_Con_Server *svr; + BOOL res; + + svr = (Ecore_Con_Server *)data; + + while (1) + { + res = ConnectNamedPipe(svr->pipe, NULL); + if (!res) + { + ERR("Opening the connection to the client failed"); + CloseHandle(svr->pipe); + svr->pipe = NULL; + } + break; + } + + DBG("Client connected"); + + printf(" ### %s\n", __FUNCTION__); + _endthreadex(0); + return 0; +} + +Eina_Bool +ecore_con_local_listen(Ecore_Con_Server *svr) +{ + char buf[256]; + HANDLE thread_listening; + Ecore_Win32_Handler *handler; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + { + ERR("Your system does not support abstract sockets!"); + return EINA_FALSE; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) + snprintf(buf, sizeof(buf), "\\\\.\\pipe\\%s", svr->name); + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) + { + const char *computername; + + computername = getenv("CoMPUTERNAME"); + snprintf(buf, sizeof(buf), "\\\\%s\\pipe\\%s", computername, svr->name); + } + + svr->path = strdup(buf); + if (!svr->path) + { + ERR("Allocation failed"); + return EINA_FALSE; + } + + /* + * synchronuous + * block mode + * wait mode + */ + svr->pipe = CreateNamedPipe(svr->path, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + BUFSIZE, + BUFSIZE, + 5000, + NULL); + if (svr->pipe == INVALID_HANDLE_VALUE) + { + ERR("Creation of the named pipe failed"); + goto free_path; + } + + /* + * We use ConnectNamedPipe() to wait for a client to connect. + * As the function is blocking, to let the main loop continuing + * its iterations, we call ConnectNamedPipe() in a thread + */ + thread_listening = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_listening, svr, CREATE_SUSPENDED, NULL); + if (!thread_listening) + { + ERR("Creation of the listening thread failed"); + goto close_pipe; + } + + handler = ecore_main_win32_handler_add(thread_listening, + _ecore_con_local_win32_client_add, + svr); + if (!handler) + { + ERR("Creation of the client add handler failed"); + goto del_handler; + } + + svr->read_stopped = EINA_TRUE; + ResumeThread(thread_listening); + + return EINA_TRUE; + + del_handler: + ecore_main_win32_handler_del(handler); + close_pipe: + CloseHandle(svr->pipe); + free_path: + free(svr->path); + svr->path = NULL; + + return EINA_FALSE; +} + +void +ecore_con_local_win32_server_del(Ecore_Con_Server *svr) +{ + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + return; + + if (((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) && + ((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM)) + return; + + svr->read_stop = 1; + while (!svr->read_stopped) + Sleep(100); + + if (svr->event_peek) + CloseHandle(svr->event_peek); + svr->event_peek = NULL; + if (svr->event_read) + CloseHandle(svr->event_read); + svr->event_read = NULL; + free(svr->path); + svr->path = NULL; + if (svr->pipe) + CloseHandle(svr->pipe); + svr->pipe = NULL; +} + +void +ecore_con_local_win32_client_del(Ecore_Con_Client *cl) +{ + if ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + return; + + if (((cl->host_server->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) && + ((cl->host_server->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM)) + return; + + cl->host_server->read_stop = 1; + while (!cl->host_server->read_stopped) + Sleep(100); + + if (cl->host_server->event_peek) + CloseHandle(cl->host_server->event_peek); + cl->host_server->event_peek = NULL; + if (cl->host_server->event_read) + CloseHandle(cl->host_server->event_read); + cl->host_server->event_read = NULL; + free(cl->host_server->path); + cl->host_server->path = NULL; + if (cl->host_server->pipe) + CloseHandle(cl->host_server->pipe); + cl->host_server->pipe = NULL; +} + +Eina_Bool +ecore_con_local_connect(Ecore_Con_Server *svr, + Eina_Bool (*cb_done)(void *data, + Ecore_Fd_Handler *fd_handler), + void (*cb_free)(void *data, void *ev)) +{ + char buf[256]; + Ecore_Win32_Handler *handler_read; + Ecore_Win32_Handler *handler_peek; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + { + ERR("Your system does not support abstract sockets!"); + return EINA_FALSE; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) + snprintf(buf, sizeof(buf), "\\\\.\\pipe\\%s", svr->name); + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) + { + const char *computername; + + computername = getenv("COMPUTERNAME"); + snprintf(buf, sizeof(buf), "\\\\%s\\pipe\\%s", computername, svr->name); + } + + while (1) + { + svr->pipe = CreateFile(buf, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + NULL); + if (svr->pipe != INVALID_HANDLE_VALUE) + break; + + /* if pipe not busy, we exit */ + if (GetLastError() != ERROR_PIPE_BUSY) + { + ERR("Connection to a server failed"); + return EINA_FALSE; + } + + /* pipe busy, so we wait for it */ + if (!WaitNamedPipe(buf, NMPWAIT_WAIT_FOREVER)) + { + ERR("Can not wait for a server"); + goto close_pipe; + } + } + + svr->path = strdup(buf); + if (!svr->path) + { + ERR("Allocation failed"); + goto close_pipe; + } + + svr->event_read = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!svr->event_read) + { + ERR("Can not create event read"); + goto free_path; + } + + handler_read = ecore_main_win32_handler_add(svr->event_read, + _ecore_con_local_win32_client_read_server_handler, + svr); + if (!handler_read) + { + ERR("Can not create handler read"); + goto close_event_read; + } + + svr->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!svr->event_peek) + { + ERR("Can not create event peek"); + goto del_handler_read; + } + + handler_peek = ecore_main_win32_handler_add(svr->event_peek, + _ecore_con_local_win32_client_peek_server_handler, + svr); + if (!handler_peek) + { + ERR("Can not create handler peek"); + goto close_event_peek; + } + + svr->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_client_read_server_thread, svr, CREATE_SUSPENDED, NULL); + if (!svr->thread_read) + { + ERR("Can not launch thread"); + goto del_handler_peek; + } + + if (!svr->delete_me) + { + Ecore_Con_Event_Server_Add *e; + + e = calloc(1, sizeof(Ecore_Con_Event_Server_Add)); + if (e) + { + svr->event_count++; + e->server = svr; + ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e, + cb_free, NULL); + } + } + + ResumeThread(svr->thread_read); + + return EINA_TRUE; + + del_handler_peek: + ecore_main_win32_handler_del(handler_peek); + close_event_peek: + CloseHandle(svr->event_peek); + del_handler_read: + ecore_main_win32_handler_del(handler_read); + close_event_read: + CloseHandle(svr->event_read); + free_path: + free(svr->path); + svr->path = NULL; + close_pipe: + CloseHandle(svr->pipe); + + return EINA_FALSE; +} + +Eina_Bool +ecore_con_local_win32_server_flush(Ecore_Con_Server *svr) +{ + int num; + BOOL res; + DWORD written; + + /* This check should never be true */ + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + return EINA_TRUE; + + if (((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) && + ((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM)) + return EINA_FALSE; + + num = svr->write_buf_size - svr->write_buf_offset; + if (num <= 0) return EINA_TRUE; + + res = WriteFile(svr->pipe, svr->write_buf + svr->write_buf_offset, num, &written, NULL); + if (!res) + { + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(svr, msg); + free(msg); + } + if (!svr->delete_me) + ecore_con_event_server_del(svr); + svr->dead = EINA_TRUE; + } + + svr->write_buf_offset += written; + if (svr->write_buf_offset >= svr->write_buf_size) + { + svr->write_buf_size = 0; + svr->write_buf_offset = 0; + free(svr->write_buf); + svr->write_buf = NULL; + svr->want_write = 0; + } + else if (written < (DWORD)num) + svr->want_write = 1; + + return EINA_TRUE; +} + +Eina_Bool +ecore_con_local_win32_client_flush(Ecore_Con_Client *cl) +{ + Ecore_Con_Type type; + int num; + BOOL res; + DWORD written; + + type = cl->host_server->type & ECORE_CON_TYPE; + + /* This check should never be true */ + if (type == ECORE_CON_LOCAL_ABSTRACT) + return EINA_TRUE; + + if ((type != ECORE_CON_LOCAL_USER) && + (type != ECORE_CON_LOCAL_SYSTEM)) + return EINA_FALSE; + + num = cl->buf_size - cl->buf_offset; + if (num <= 0) return EINA_TRUE; + + res = WriteFile(cl->host_server->pipe, cl->buf + cl->buf_offset, num, &written, NULL); + if (!res) + { + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_client_error(cl, msg); + free(msg); + } + if (!cl->delete_me) + ecore_con_event_client_del(cl); + cl->dead = EINA_TRUE; + } + + cl->buf_offset += written; + if (cl->buf_offset >= cl->buf_size) + { + cl->buf_size = 0; + cl->buf_offset = 0; + free(cl->buf); + cl->buf = NULL; + cl->host_server->want_write = 0; + } + else if (written < (DWORD)num) + cl->host_server->want_write = 1; + + return EINA_TRUE; +} diff --git a/src/lib/ecore_con/ecore_con_private.h b/src/lib/ecore_con/ecore_con_private.h index 0574341..f484b2d 100644 --- a/src/lib/ecore_con/ecore_con_private.h +++ b/src/lib/ecore_con/ecore_con_private.h @@ -157,6 +157,16 @@ struct _Ecore_Con_Server Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */ Eina_Bool reject_excess_clients : 1; Eina_Bool delete_me : 1; +#ifdef _WIN32 + Eina_Bool want_write : 1; + Eina_Bool read_stop : 1; + Eina_Bool read_stopped : 1; + HANDLE pipe; + HANDLE thread_read; + HANDLE event_read; + HANDLE event_peek; + DWORD nbr_bytes; +#endif }; #ifdef HAVE_CURL @@ -200,9 +210,26 @@ struct _Ecore_Con_Lookup /* from ecore_con.c */ void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info); +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); +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); +/* from ecore_local_win32.c */ +#ifdef _WIN32 +Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr); +Eina_Bool ecore_con_local_connect(Ecore_Con_Server *svr, + Eina_Bool (*cb_done)(void *data, + Ecore_Fd_Handler *fd_handler), + void (*cb_free)(void *data, void *ev)); +Eina_Bool ecore_con_local_win32_server_flush(Ecore_Con_Server *svr); +Eina_Bool ecore_con_local_win32_client_flush(Ecore_Con_Client *cl); +void ecore_con_local_win32_server_del(Ecore_Con_Server *svr); +void ecore_con_local_win32_client_del(Ecore_Con_Client *cl); +#else /* from ecore_local.c */ int ecore_con_local_init(void); int ecore_con_local_shutdown(void); @@ -218,6 +245,8 @@ int ecore_con_local_listen(Ecore_Con_Server *svr, void *data, Ecore_Fd_Handler *fd_handler), void *data); +#endif + /* from ecore_con_info.c */ int ecore_con_info_init(void); int ecore_con_info_shutdown(void); diff --git a/src/lib/ecore_con/ecore_con_ssl.c b/src/lib/ecore_con/ecore_con_ssl.c index b36a74b..1b74999 100644 --- a/src/lib/ecore_con/ecore_con_ssl.c +++ b/src/lib/ecore_con/ecore_con_ssl.c @@ -23,13 +23,13 @@ static int _init_con_ssl_init_count = 0; -#if USE_GNUTLS -# ifdef EFL_HAVE_PTHREAD -#include +#ifdef USE_GNUTLS +# ifdef EINA_HAVE_THREADS GCRY_THREAD_OPTION_PTHREAD_IMPL; # endif static int _client_connected = 0; + # define SSL_SUFFIX(ssl_func) ssl_func ## _gnutls # define _ECORE_CON_SSL_AVAILABLE 1 @@ -49,9 +49,9 @@ static void _gnutls_print_errors(void *conn, int type, int ret) { char buf[1024]; - + if (!ret) return; - + snprintf(buf, sizeof(buf), "GNUTLS error: %s - %s", gnutls_strerror_name(ret), gnutls_strerror(ret)); if (type == ECORE_CON_EVENT_CLIENT_ERROR) ecore_con_event_client_error(conn, buf); @@ -129,7 +129,7 @@ _openssl_print_errors(void *conn, int type) ecore_con_event_client_error(conn, buf); else ecore_con_event_server_error(conn, buf); - + } while (1); } @@ -422,7 +422,7 @@ ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr, static Ecore_Con_Ssl_Error _ecore_con_ssl_init_gnutls(void) { -#ifdef EFL_HAVE_PTHREAD +#ifdef EINA_HAVE_THREADS if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread)) WRN("YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!"); #endif diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c index 5df6d98..c8db176 100644 --- a/src/lib/ecore_con/ecore_con_url.c +++ b/src/lib/ecore_con/ecore_con_url.c @@ -96,6 +96,7 @@ 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 @@ -242,6 +243,35 @@ ecore_con_url_shutdown(void) } /** + * Enable or disable HTTP 1.1 pipelining. + * @param enable EINA_TRUE will turn it on, EINA_FALSE will disable it. + */ +EAPI void +ecore_con_url_pipeline_set(Eina_Bool enable) +{ +#ifdef HAVE_CURL + if (enable) + curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 1); + else + curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 1); + pipelining = enable; +#endif +} + +/** + * Is HTTP 1.1 pipelining enable ? + * @return EINA_TRUE if it is enable. + */ +EAPI Eina_Bool +ecore_con_url_pipeline_get(void) +{ +#ifdef HAVE_CURL + return pipelining; +#endif + return EINA_FALSE; +} + +/** * Creates and initializes a new Ecore_Con_Url connection object. * * Creates and initializes a new Ecore_Con_Url connection object that can be @@ -415,17 +445,17 @@ ecore_con_url_free(Ecore_Con_Url *url_con) // 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); - + if (url_con->active) { 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)); } - + curl_easy_cleanup(url_con->curl_easy); } @@ -846,12 +876,12 @@ _ecore_con_url_send(Ecore_Con_Url *url_con, 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, data); curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length); } } - + switch (url_con->time_condition) { case ECORE_CON_URL_TIME_NONE: @@ -927,7 +957,7 @@ ecore_con_url_send(Ecore_Con_Url *url_con, * Sends a get request. * * @param url_con Connection object to perform a request on, previously created - * + * * @return #EINA_TRUE on success, #EINA_FALSE on error. * * @see ecore_con_url_custom_new() @@ -1441,19 +1471,19 @@ ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, /** * Set a custom CA to trust for SSL/TLS connections. - * + * * Specify the path of a file (in PEM format) containing one or more * CA certificate(s) to use for the validation of the server certificate. - * + * * This function can also disable CA validation if @p ca_path is @c NULL. * However, the server certificate still needs to be valid for the connection * to succeed (i.e., the certificate must concern the server the * connection is made to). - * + * * @param url_con Connection object that will use the custom CA. * @param ca_path Path to a CA certificate(s) file or @c NULL to disable * CA validation. - * + * * @return @c 0 on success. When cURL is used, non-zero return values * are equal to cURL error codes. */ @@ -1689,7 +1719,11 @@ _ecore_con_url_read_cb(void *ptr, return 0; } +#ifdef _WIN32 + INF("*** We read %Iu bytes from file", retcode); +#else INF("*** We read %zu bytes from file", retcode); +#endif return retcode; } diff --git a/src/lib/ecore_config/.cvsignore b/src/lib/ecore_config/.cvsignore deleted file mode 100644 index 59bc827..0000000 --- a/src/lib/ecore_config/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore_config.la -ecore_config_ipc_ecore.la -system.db diff --git a/src/lib/ecore_config/ecore_config.c b/src/lib/ecore_config/ecore_config.c index d8b587e..e81538e 100644 --- a/src/lib/ecore_config/ecore_config.c +++ b/src/lib/ecore_config/ecore_config.c @@ -205,7 +205,7 @@ _ecore_config_int_get(Ecore_Config_Prop *e) /** * Returns the specified property as a float. * @param key The property key. - * @return The float value of the property. The function returns 0.0 if the + * @return The float value of the property. The function returns 0.0 if the * property is not a float or is not set. * @ingroup Ecore_Config_Get_Group */ @@ -1185,7 +1185,7 @@ _ecore_config_struct_typed_add(const char *key, const char *name, const void *va ret = _ecore_config_struct_append(ecore_config_get(key), ecore_config_get(subkey)); free(subkey); - return ret; + return ret; } /** @@ -1250,7 +1250,7 @@ ecore_config_struct_argb_add(const char *key, const char *name, int a, int r, int g, int b) { long argb; - + __ecore_argb_to_long(a, r, g, b, &argb); return _ecore_config_struct_typed_add(key, name, &argb, ECORE_CONFIG_RGB); } @@ -1451,7 +1451,7 @@ ecore_config_deaf(const char *name, const char *key, for (p = NULL, l = e->listeners; l; p = l) { Ecore_Config_Listener_List *nl; - + nl = l->next; if ((name && !strcmp(l->name, name)) || (l->listener == listener)) { @@ -1672,7 +1672,7 @@ ecore_config_init(const char *name) Ecore_Config_Prop *list; _ecore_config_log_dom = eina_log_domain_register ("ecore_config", ECORE_CONFIG_DEFAULT_LOG_COLOR); - if(_ecore_config_log_dom < 0) + if(_ecore_config_log_dom < 0) { EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module."); return -1; @@ -1769,7 +1769,7 @@ _ecore_config_system_init_no_load(void) /* set up a simple default path */ ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes"); - + return ECORE_CONFIG_ERR_SUCC; } @@ -1789,7 +1789,7 @@ _ecore_config_system_load(void) { snprintf(buf, PATH_MAX, "%s/.e/config.eet", p); if (ecore_config_file_load(buf) != 0) { - /* even if this file (system.eet) doesn't exist we can + /* even if this file (system.eet) doesn't exist we can * continue without it as it isn't striclty necessary. */ ecore_config_file_load(PACKAGE_DATA_DIR "/system.eet"); diff --git a/src/lib/ecore_config/ecore_config_db.c b/src/lib/ecore_config/ecore_config_db.c index 458aae3..6238958 100644 --- a/src/lib/ecore_config/ecore_config_db.c +++ b/src/lib/ecore_config/ecore_config_db.c @@ -29,7 +29,7 @@ _ecore_config_db_open_read(const char *file) { Eet_File *ef; Ecore_Config_DB_File *db; - + eet_init(); db = malloc(sizeof(Ecore_Config_DB_File)); if (!db) return NULL; @@ -48,7 +48,7 @@ _ecore_config_db_open_write(const char *file) { Eet_File *ef; Ecore_Config_DB_File *db; - + eet_init(); db = malloc(sizeof(Ecore_Config_DB_File)); if (!db) return NULL; @@ -76,7 +76,7 @@ _ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret) char **keys; int key_count; int i; - + keys = eet_list(db->ef, (char*)"*", &key_count); if (!keys) { @@ -94,7 +94,7 @@ _ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key) { char *data; int size; - + data = eet_read(db->ef, (char*)key, &size); if (data) { @@ -119,7 +119,7 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key) char *data, *value; int size; Ecore_Config_Type type; - + data = eet_read(db->ef, (char*)key, &size); if (data) { @@ -143,11 +143,11 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key) free(data); return 0; } - + type = data[0]; value = data + l + 1; - switch (type) + switch (type) { case ECORE_CONFIG_INT: case ECORE_CONFIG_BLN: @@ -166,7 +166,7 @@ _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key) prev_locale = setlocale(LC_NUMERIC, "C"); tmp = atof(value); if (prev_locale) setlocale(LC_NUMERIC, prev_locale); - + ecore_config_typed_set(key, (void *)&tmp, type); break; } @@ -195,13 +195,13 @@ _ecore_config_db_key_data_get(Ecore_Config_DB_File *db, const char *key, int *si { char *data; int size; - + data = eet_read(db->ef, (char*)key, &size); if (data) { int l; char *dat; - + if (size <= 2) { free(data); @@ -235,10 +235,10 @@ _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e) char *val = NULL; char *r = NULL; int num; - + prev_locale = setlocale(LC_NUMERIC, "C"); - switch (e->type) + switch (e->type) { case ECORE_CONFIG_INT: esprintf(&val, "%i", _ecore_config_int_get(e)); @@ -249,7 +249,7 @@ _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e) case ECORE_CONFIG_FLT: esprintf(&val, "%16.16f", _ecore_config_float_get(e)); break; - case ECORE_CONFIG_STR: + case ECORE_CONFIG_STR: val = _ecore_config_string_get(e); break; case ECORE_CONFIG_THM: @@ -266,7 +266,7 @@ _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e) { setlocale(LC_NUMERIC, prev_locale); } - + if(val) { num = esprintf(&r, "%c%c%s%c", (char) e->type, 0, val, 0); @@ -283,7 +283,7 @@ _ecore_config_db_key_data_set(Ecore_Config_DB_File *db, const char *key, void *d { char *buf; int num; - + num = 1 + 1 + data_size + 1; buf = malloc(num); if (!buf) return; diff --git a/src/lib/ecore_config/ecore_config_extra.c b/src/lib/ecore_config/ecore_config_extra.c index 6d47c81..a134952 100644 --- a/src/lib/ecore_config/ecore_config_extra.c +++ b/src/lib/ecore_config/ecore_config_extra.c @@ -403,7 +403,7 @@ ecore_config_theme_search_path_get(void) * should be called @b after @ref ecore_config_load to allow a user to * override the default search path. * - * @param path The given + * @param path The given * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL * will be returned if @p path already exists in the search path. * @c ECORE_CONFIG_ERR_FAIL is returned if @p path is @c NULL. @@ -422,8 +422,8 @@ ecore_config_theme_search_path_append(const char *path) loc = strstr(search_path, path); len = strlen(path); search_len = strlen(search_path); - - if (!loc || (loc != search_path && *(loc - 1) != '|') || + + if (!loc || (loc != search_path && *(loc - 1) != '|') || (loc != (search_path + search_len - len) && *(loc + len - 1) != '|')) { new_search_path = malloc(search_len + len + 2); /* 2 = \0 + | */ @@ -477,9 +477,9 @@ ecore_config_theme_with_path_from_name_get(char *name) file = malloc(strlen(search_path_tmp) + strlen(name) + 6); /* 6 = / + .edj + \0 */ - snprintf(file, strlen(search_path_tmp) + strlen(name) + 6, + snprintf(file, strlen(search_path_tmp) + strlen(name) + 6, "%s/%s.edj", search_path_tmp, name); - + if (stat(file, &st) == 0) { free(search_path); @@ -582,7 +582,7 @@ ecore_config_parse_set(Ecore_Config_Prop * prop, char *arg, char *opt, { ecore_config_set(prop->key, arg); prop->flags |= ECORE_CONFIG_FLAG_CMDLN; - } + } return ECORE_CONFIG_PARSE_CONTINUE; } @@ -689,7 +689,7 @@ ecore_config_args_parse(void) callback = _ecore_config_arg_callbacks; while (callback) { - if ((callback->long_opt && + if ((callback->long_opt && !strcmp(long_opt, callback->long_opt))) { found = 1; @@ -697,7 +697,7 @@ ecore_config_args_parse(void) { callback->func(NULL, callback->data); } - else + else { if (!argv[++nextarg]) { diff --git a/src/lib/ecore_config/ecore_config_ipc_ecore.c b/src/lib/ecore_config/ecore_config_ipc_ecore.c index 688e3d7..b1622f3 100644 --- a/src/lib/ecore_config/ecore_config_ipc_ecore.c +++ b/src/lib/ecore_config/ecore_config_ipc_ecore.c @@ -57,7 +57,7 @@ _ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv __UNUSED__, long se int key_count, x; estring *s; int f; - char buf[PATH_MAX], *p; + char buf[PATH_MAX], *p; // char *data; UNUSED Ecore_Config_Type type; @@ -121,7 +121,7 @@ _ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv __UNUSED__, long se } free(keys); } - + return estring_disown(s); } diff --git a/src/lib/ecore_config/ecore_config_ipc_main.c b/src/lib/ecore_config/ecore_config_ipc_main.c index a8ecdc6..35bd783 100644 --- a/src/lib/ecore_config/ecore_config_ipc_main.c +++ b/src/lib/ecore_config/ecore_config_ipc_main.c @@ -269,7 +269,7 @@ _ecore_config_ipc_init(const char *pipe_name) if (!ipc_timer) ipc_timer = ecore_timer_add(100, _ecore_config_ipc_poll, NULL); - + return ret_srv; } /*****************************************************************************/ diff --git a/src/lib/ecore_config/ecore_config_storage.c b/src/lib/ecore_config/ecore_config_storage.c index b9034f3..d059645 100644 --- a/src/lib/ecore_config/ecore_config_storage.c +++ b/src/lib/ecore_config/ecore_config_storage.c @@ -83,7 +83,7 @@ ecore_config_file_load(const char *file) ERR("Cannot open database from file %s!", file); return ECORE_CONFIG_ERR_NODATA; } - key_count = 0; + key_count = 0; keys = _ecore_config_db_keys_get(db, &key_count); if (keys) { diff --git a/src/lib/ecore_directfb/.cvsignore b/src/lib/ecore_directfb/.cvsignore deleted file mode 100644 index ce9e988..0000000 --- a/src/lib/ecore_directfb/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -*.lo -libecore_directfb.la diff --git a/src/lib/ecore_evas/.cvsignore b/src/lib/ecore_evas/.cvsignore deleted file mode 100644 index 09980ae..0000000 --- a/src/lib/ecore_evas/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 0063480..abcca78 100755 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -350,6 +350,8 @@ EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee); EAPI Ecore_Window ecore_evas_window_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 Eina_Bool ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); EAPI Eina_Bool ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee); diff --git a/src/lib/ecore_evas/Makefile.am b/src/lib/ecore_evas/Makefile.am index a4eba85..946472b 100644 --- a/src/lib/ecore_evas/Makefile.am +++ b/src/lib/ecore_evas/Makefile.am @@ -42,14 +42,6 @@ ECORE_SDL_LIB = ECORE_SDL_LIBADD = endif -if BUILD_ECORE_COCOA -ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa -xobjective-c -ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la -else -ECORE_COCOA_INC = -ECORE_COCOA_LIB = -endif - if BUILD_ECORE_WINCE ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la @@ -73,7 +65,6 @@ $(ECORE_FB_INC) \ $(ECORE_DIRECTFB_INC) \ $(ECORE_WIN32_INC) \ $(ECORE_SDL_INC) \ -$(ECORE_COCOA_INC) \ $(ECORE_WINCE_INC) \ @EVAS_CFLAGS@ \ @XCB_CFLAGS@ \ @@ -95,7 +86,6 @@ ecore_evas_buffer.c \ ecore_evas_directfb.c \ ecore_evas_win32.c \ ecore_evas_sdl.c \ -ecore_evas_cocoa.c \ ecore_evas_wince.c libecore_evas_la_LIBADD = \ @@ -105,7 +95,6 @@ $(ECORE_DIRECTFB_LIB) \ $(ECORE_WIN32_LIB) \ $(ECORE_SDL_LIB) \ $(ECORE_SDL_LIBADD) \ -$(ECORE_COCOA_LIB) \ $(ECORE_WINCE_LIB) \ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ @@ -114,7 +103,7 @@ $(top_builddir)/src/lib/ecore/libecore.la \ @EINA_LIBS@ \ @EVIL_LIBS@ -libecore_evas_la_LDFLAGS = @cocoa_ldflags@ -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ EXTRA_DIST = \ ecore_evas_private.h diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 82e9395..f1479c8 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -33,7 +33,7 @@ _ecore_evas_idle_enter(void *data __UNUSED__) double t1 = 0.0; double t2 = 0.0; int rend = 0; - + if (!ecore_evases) return ECORE_CALLBACK_RENEW; if (_ecore_evas_fps_debug) { @@ -225,12 +225,12 @@ ecore_evas_init(void) ECORE_FD_READ, _ecore_evas_async_events_fd_handler, NULL, NULL, NULL); - - ecore_evas_idle_enterer = + + ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); - + return _ecore_evas_init_count; shutdown_ecore: @@ -832,12 +832,19 @@ ecore_evas_engine_name_get(const Ecore_Evas *ee) * Return the Ecore_Evas for this Evas * * @param e The Evas to get the Ecore_Evas from - * @return The Ecore_Evas that holds this Evas + * @return The Ecore_Evas that holds this Evas, or NULL if not hold by one. */ EAPI Ecore_Evas * ecore_evas_ecore_evas_get(const Evas *e) { - return evas_data_attach_get(e); + Ecore_Evas *ee = evas_data_attach_get(e); + if (!ee) return NULL; + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get"); + return NULL; + } + return ee; } /** @@ -2491,7 +2498,7 @@ ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn) "ecore_evas_withdrawn_set"); return; } - + IFC(ee, fn_withdrawn_set) (ee, withdrawn); IFE; } @@ -2530,7 +2537,7 @@ ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky) "ecore_evas_sticky_set"); return; } - + IFC(ee, fn_sticky_set) (ee, sticky); IFE; } @@ -2570,7 +2577,7 @@ ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) "ecore_evas_ignore_events_set"); return; } - + IFC(ee, fn_ignore_events_set) (ee, ignore); IFE; } @@ -2668,6 +2675,35 @@ ecore_evas_window_get(const Ecore_Evas *ee) return ee->prop.window; } +/** + * Get whole screen geometry associated with this Ecore_Evas. + * + * @param ee The Ecore_Evas whose window's to query container screen geometry. + * @param x where to return the horizontal offset value. May be NULL. + * @param y where to return the vertical offset value. May be NULL. + * @param w where to return the width value. May be NULL. + * @param h where to return the height value. May be NULL. + * + * @since 1.1 + */ +EAPI void +ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_screen_geometry_get"); + return; + } + + IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h); + IFE; +} + /* fps debug calls - for debugging how much time your app actually spends */ /* rendering graphics... :) */ @@ -2885,7 +2921,7 @@ _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timest void _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, - int x, int y, + int x, int y, double radius, double radius_x, double radius_y, double pressure, @@ -2895,28 +2931,28 @@ _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, { if (ee->rotation == 0) evas_event_feed_multi_move(ee->evas, device, - x, y, + x, y, radius, radius_x, radius_y, - pressure, + pressure, angle - ee->rotation, mx, my, timestamp, NULL); else if (ee->rotation == 90) evas_event_feed_multi_move(ee->evas, device, - ee->h - y - 1, x, + ee->h - y - 1, x, radius, radius_y, radius_x, - pressure, + pressure, angle - ee->rotation, ee->h - my - 1, mx, timestamp, NULL); else if (ee->rotation == 180) evas_event_feed_multi_move(ee->evas, device, - ee->w - x - 1, ee->h - y - 1, + ee->w - x - 1, ee->h - y - 1, radius, radius_x, radius_y, - pressure, + pressure, angle - ee->rotation, ee->w - mx - 1, ee->h - my - 1, timestamp, NULL); @@ -2925,7 +2961,7 @@ _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, y, ee->w - x - 1, radius, radius_y, radius_x, - pressure, + pressure, angle - ee->rotation, my, ee->w - mx - 1, timestamp, NULL); @@ -2933,7 +2969,7 @@ _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, void _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, - int x, int y, + int x, int y, double radius, double radius_x, double radius_y, double pressure, @@ -2944,28 +2980,28 @@ _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, { if (ee->rotation == 0) evas_event_feed_multi_down(ee->evas, device, - x, y, + x, y, radius, radius_x, radius_y, - pressure, + pressure, angle - ee->rotation, mx, my, flags, timestamp, NULL); else if (ee->rotation == 90) evas_event_feed_multi_down(ee->evas, device, - ee->h - y - 1, x, + ee->h - y - 1, x, radius, radius_y, radius_x, - pressure, + pressure, angle - ee->rotation, ee->h - my - 1, mx, flags, timestamp, NULL); else if (ee->rotation == 180) evas_event_feed_multi_down(ee->evas, device, - ee->w - x - 1, ee->h - y - 1, + ee->w - x - 1, ee->h - y - 1, radius, radius_x, radius_y, - pressure, + pressure, angle - ee->rotation, ee->w - mx - 1, ee->h - my - 1, flags, timestamp, NULL); @@ -2974,7 +3010,7 @@ _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, y, ee->w - x - 1, radius, radius_y, radius_x, - pressure, + pressure, angle - ee->rotation, my, ee->w - mx - 1, flags, timestamp, NULL); @@ -2982,7 +3018,7 @@ _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, - int x, int y, + int x, int y, double radius, double radius_x, double radius_y, double pressure, @@ -2993,28 +3029,28 @@ _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, { if (ee->rotation == 0) evas_event_feed_multi_up(ee->evas, device, - x, y, + x, y, radius, radius_x, radius_y, - pressure, + pressure, angle - ee->rotation, mx, my, flags, timestamp, NULL); else if (ee->rotation == 90) evas_event_feed_multi_up(ee->evas, device, - ee->h - y - 1, x, + ee->h - y - 1, x, radius, radius_y, radius_x, - pressure, + pressure, angle - ee->rotation, ee->h - my - 1, mx, flags, timestamp, NULL); else if (ee->rotation == 180) evas_event_feed_multi_up(ee->evas, device, - ee->w - x - 1, ee->h - y - 1, + ee->w - x - 1, ee->h - y - 1, radius, radius_x, radius_y, - pressure, + pressure, angle - ee->rotation, ee->w - mx - 1, ee->h - my - 1, flags, timestamp, NULL); @@ -3023,7 +3059,7 @@ _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, y, ee->w - x - 1, radius, radius_y, radius_x, - pressure, + pressure, angle - ee->rotation, my, ee->w - mx - 1, flags, timestamp, NULL); @@ -3031,7 +3067,7 @@ _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, /** * Get a list of all the ecore_evases. - * + * * The returned list of ecore evases is only valid until the canvases are * destroyed (and should not be cached for instance). * The list can be free by just deleting the list. @@ -3043,11 +3079,11 @@ ecore_evas_ecore_evas_list_get(void) { Ecore_Evas *ee; Eina_List *l = NULL; - + EINA_INLIST_FOREACH(ecore_evases, ee) { l = eina_list_append(l, ee); } - + return l; } diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c index 22f13bd..f66dfc8 100644 --- a/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/src/lib/ecore_evas/ecore_evas_buffer.c @@ -32,7 +32,7 @@ _ecore_evas_buffer_free(Ecore_Evas *ee) } else { - ee->engine.buffer.free_func(ee->engine.buffer.data, + ee->engine.buffer.free_func(ee->engine.buffer.data, ee->engine.buffer.pixels); } _ecore_evas_buffer_shutdown(); @@ -63,7 +63,7 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h) if (ee->engine.buffer.pixels) ee->engine.buffer.free_func(ee->engine.buffer.data, ee->engine.buffer.pixels); - ee->engine.buffer.pixels = + ee->engine.buffer.pixels = ee->engine.buffer.alloc_func(ee->engine.buffer.data, ee->w * ee->h * sizeof(int)); stride = ee->w * sizeof(int); @@ -140,22 +140,31 @@ _ecore_evas_buffer_render(Ecore_Evas *ee) static void _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) { - Evas_Coord xx, yy, fx, fy, fw, fh; + Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; - evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, NULL, NULL); + 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; - xx = (*x - xx) - fx; - while (xx < 0) xx += fw; - while (xx > fw) xx -= fw; - *x = (ee->w * xx) / fw; - if (fh < 1) fh = 1; - yy = (*y - yy) - fy; - while (yy < 0) yy += fh; - while (yy > fh) yy -= fh; - *y = (ee->h * yy) / fh; + + 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 @@ -306,41 +315,41 @@ _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(e, "Shift"); + evas_key_modifier_on(ee->evas, "Shift"); else - evas_key_modifier_off(e, "Shift"); + evas_key_modifier_off(ee->evas, "Shift"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) - evas_key_modifier_on(e, "Control"); + evas_key_modifier_on(ee->evas, "Control"); else - evas_key_modifier_off(e, "Control"); + evas_key_modifier_off(ee->evas, "Control"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) - evas_key_modifier_on(e, "Alt"); + evas_key_modifier_on(ee->evas, "Alt"); else - evas_key_modifier_off(e, "Alt"); + evas_key_modifier_off(ee->evas, "Alt"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) - evas_key_modifier_on(e, "Meta"); + evas_key_modifier_on(ee->evas, "Meta"); else - evas_key_modifier_off(e, "Meta"); + evas_key_modifier_off(ee->evas, "Meta"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) - evas_key_modifier_on(e, "Hyper"); + evas_key_modifier_on(ee->evas, "Hyper"); else - evas_key_modifier_off(e, "Hyper"); + evas_key_modifier_off(ee->evas, "Hyper"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) - evas_key_modifier_on(e, "Super"); + evas_key_modifier_on(ee->evas, "Super"); else - evas_key_modifier_off(e, "Super"); + evas_key_modifier_off(ee->evas, "Super"); if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) - evas_key_lock_on(e, "Scroll_Lock"); + evas_key_lock_on(ee->evas, "Scroll_Lock"); else - evas_key_lock_off(e, "Scroll_Lock"); + 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(e, "Num_Lock"); + evas_key_lock_on(ee->evas, "Num_Lock"); else - evas_key_lock_off(e, "Num_Lock"); + 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(e, "Caps_Lock"); + evas_key_lock_on(ee->evas, "Caps_Lock"); else - evas_key_lock_off(e, "Caps_Lock"); + evas_key_lock_off(ee->evas, "Caps_Lock"); evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); } @@ -353,41 +362,41 @@ _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(e, "Shift"); + evas_key_modifier_on(ee->evas, "Shift"); else - evas_key_modifier_off(e, "Shift"); + evas_key_modifier_off(ee->evas, "Shift"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) - evas_key_modifier_on(e, "Control"); + evas_key_modifier_on(ee->evas, "Control"); else - evas_key_modifier_off(e, "Control"); + evas_key_modifier_off(ee->evas, "Control"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) - evas_key_modifier_on(e, "Alt"); + evas_key_modifier_on(ee->evas, "Alt"); else - evas_key_modifier_off(e, "Alt"); + evas_key_modifier_off(ee->evas, "Alt"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) - evas_key_modifier_on(e, "Meta"); + evas_key_modifier_on(ee->evas, "Meta"); else - evas_key_modifier_off(e, "Meta"); + evas_key_modifier_off(ee->evas, "Meta"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) - evas_key_modifier_on(e, "Hyper"); + evas_key_modifier_on(ee->evas, "Hyper"); else - evas_key_modifier_off(e, "Hyper"); + evas_key_modifier_off(ee->evas, "Hyper"); if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) - evas_key_modifier_on(e, "Super"); + evas_key_modifier_on(ee->evas, "Super"); else - evas_key_modifier_off(e, "Super"); + evas_key_modifier_off(ee->evas, "Super"); if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) - evas_key_lock_on(e, "Scroll_Lock"); + evas_key_lock_on(ee->evas, "Scroll_Lock"); else - evas_key_lock_off(e, "Scroll_Lock"); + 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(e, "Num_Lock"); + evas_key_lock_on(ee->evas, "Num_Lock"); else - evas_key_lock_off(e, "Num_Lock"); + 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(e, "Caps_Lock"); + evas_key_lock_on(ee->evas, "Caps_Lock"); else - evas_key_lock_off(e, "Caps_Lock"); + evas_key_lock_off(ee->evas, "Caps_Lock"); evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); } @@ -481,8 +490,9 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = NULL, NULL, NULL, //transparent - - NULL // render + + NULL, // render + NULL // screen_geometry_get }; #endif @@ -560,7 +570,7 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i evas_output_size_set(ee->evas, w, h); evas_output_viewport_set(ee->evas, 0, 0, w, h); - ee->engine.buffer.pixels = + ee->engine.buffer.pixels = ee->engine.buffer.alloc_func (ee->engine.buffer.data, w * h * sizeof(int)); @@ -593,7 +603,7 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i ee->engine.func->fn_render = _ecore_evas_buffer_render; _ecore_evas_register(ee); - + return ee; #else return NULL; @@ -646,7 +656,7 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target) o = evas_object_image_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); - + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); _ecore_evas_buffer_init(); @@ -761,9 +771,9 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target) evas_key_lock_add(ee->evas, "Scroll_Lock"); 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/src/lib/ecore_evas/ecore_evas_directfb.c b/src/lib/ecore_evas/ecore_evas_directfb.c index 7bea20e..7b33293 100644 --- a/src/lib/ecore_evas/ecore_evas_directfb.c +++ b/src/lib/ecore_evas/ecore_evas_directfb.c @@ -69,7 +69,7 @@ static Ecore_Evas * _ecore_evas_directfb_match(DFBWindowID win) { Ecore_Evas *ee; - + ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win)); return ee; } @@ -485,8 +485,9 @@ static Ecore_Evas_Engine_Func _ecore_directfb_engine_func = NULL, /* ignore events */ NULL, /* alpha */ NULL, //transparent - - NULL // render + + NULL, // render + NULL // screen_geometry_get }; #endif @@ -546,10 +547,10 @@ ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); } } - + ee->engine.func->fn_render = _ecore_evas_directfb_render; _ecore_evas_register(ee); - + if (!ecore_evases_hash) ecore_evases_hash = eina_hash_string_superfast_new(NULL); eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c index df9f70f..579a5ea 100644 --- a/src/lib/ecore_evas/ecore_evas_fb.c +++ b/src/lib/ecore_evas/ecore_evas_fb.c @@ -87,10 +87,10 @@ _ecore_evas_fb_gain(void *data __UNUSED__) Eina_List *ll; Ecore_Fb_Input_Device *dev; - if (fb_ee) + if (fb_ee) { ee = fb_ee; - + ee->visible = 1; if ((ee->rotation == 90) || (ee->rotation == 270)) evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); @@ -290,7 +290,7 @@ _ecore_evas_fb_init(int w, int h) } } closedir(input_dir); - + if (!mouse_handled) { if (ecore_fb_ts_init()) @@ -571,8 +571,9 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func = NULL, NULL, NULL, //transparent - - NULL // render + + NULL, // render + NULL // screen_geometry_get }; #endif @@ -670,7 +671,7 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) ee->engine.func->fn_render = _ecore_evas_buffer_render; _ecore_evas_register(ee); fb_ee = ee; - + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); evas_focus_in(ee->evas); diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 52cff53..e8ddc5e 100755 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -186,6 +186,7 @@ struct _Ecore_Evas_Engine_Func void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); int (*fn_render) (Ecore_Evas *ee); + void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); }; struct _Ecore_Evas_Engine diff --git a/src/lib/ecore_evas/ecore_evas_sdl.c b/src/lib/ecore_evas/ecore_evas_sdl.c index 1d08322..1e34a2b 100644 --- a/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/src/lib/ecore_evas/ecore_evas_sdl.c @@ -163,10 +163,10 @@ _ecore_evas_sdl_init(int w __UNUSED__, int h __UNUSED__) #ifndef _WIN32 if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; #endif /* _WIN32 */ - // this is pretty bad: poller? and set poll time? pol time is meant to be + // this is pretty bad: poller? and set poll time? pol time is meant to be // adjustable for things like polling battery state, or amoutn of spare // memory etc. - // + // ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL); ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); #ifndef _WIN32 @@ -208,7 +208,7 @@ static void _ecore_evas_sdl_free(Ecore_Evas *ee) { if (sdl_ee == ee) sdl_ee = NULL; - + ecore_event_window_unregister(0); _ecore_evas_sdl_shutdown(); ecore_sdl_shutdown(); @@ -332,8 +332,9 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = NULL, NULL, NULL, //transparent - - NULL // render + + NULL, // render + NULL // screen_geometry_get }; static Ecore_Evas* @@ -437,9 +438,9 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu ee->engine.func->fn_render = _ecore_evas_sdl_render; _ecore_evas_register(ee); - + sdl_ee = ee; - + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); evas_focus_in(ee->evas); diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c index 6728784..bf1353a 100644 --- a/src/lib/ecore_evas/ecore_evas_win32.c +++ b/src/lib/ecore_evas/ecore_evas_win32.c @@ -93,7 +93,7 @@ _ecore_evas_win32_init(void) _ecore_evas_init_count++; if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; - + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL); ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL); ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL); @@ -924,8 +924,9 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func = NULL, /* _ecore_evas_x_ignore_events_set */ NULL, /* _ecore_evas_x_alpha_set */ NULL, //transparent - - NULL // render + + NULL, // render + NULL //screen_geometry_get }; #endif /* BUILD_ECORE_EVAS_WIN32 */ @@ -1175,7 +1176,7 @@ _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), (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); - + return ee; } diff --git a/src/lib/ecore_evas/ecore_evas_wince.c b/src/lib/ecore_evas/ecore_evas_wince.c index ef17bea..ba0fd88 100644 --- a/src/lib/ecore_evas/ecore_evas_wince.c +++ b/src/lib/ecore_evas/ecore_evas_wince.c @@ -91,7 +91,7 @@ _ecore_evas_wince_init(void) _ecore_evas_init_count++; if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; - + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_IN, _ecore_evas_wince_event_mouse_in, NULL); ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_OUT, _ecore_evas_wince_event_mouse_out, NULL); ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, _ecore_evas_wince_event_window_damage, NULL); @@ -720,8 +720,9 @@ static Ecore_Evas_Engine_Func _ecore_wince_engine_func = NULL, /* _ecore_evas_x_ignore_events_set */ NULL, /* _ecore_evas_x_alpha_set */ NULL, //transparent - - NULL // render + + NULL, // render + NULL // screen_geometry_get }; /* API */ diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c index f65e0b7..2c039ff 100755 --- a/src/lib/ecore_evas/ecore_evas_x.c +++ b/src/lib/ecore_evas/ecore_evas_x.c @@ -19,7 +19,7 @@ #ifndef HAVE_ECORE_X_XCB # undef BUILD_ECORE_EVAS_XRENDER_XCB # undef BUILD_ECORE_EVAS_SOFTWARE_XCB -#endif +#endif #include "ecore_evas_private.h" #include "Ecore_Evas.h" @@ -77,19 +77,19 @@ _ecore_evas_x_protocols_set(Ecore_Evas *ee) { Ecore_X_Atom protos[10]; int num = 0; - + if (ee->func.fn_delete_request) protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW; protos[num++] = ECORE_X_ATOM_NET_WM_PING; protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num); - + if (!ee->engine.x.netwm_sync_counter) ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0); //////// { unsigned int tmp = ee->engine.x.netwm_sync_counter; - ecore_x_window_prop_card32_set(ee->prop.window, + ecore_x_window_prop_card32_set(ee->prop.window, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, &tmp, 1); } @@ -166,7 +166,7 @@ _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, if (opt) { int op; - + for (op = 0; opt[op]; op++) { if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT) @@ -181,7 +181,7 @@ _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, } } } - + /* FIXME: this is inefficient as its 1 or more round trips */ screen = DefaultScreen(ecore_x_display_get()); if (ScreenCount(ecore_x_display_get()) > 1) @@ -212,13 +212,13 @@ _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, } einfo->info.display = ecore_x_display_get(); einfo->info.screen = screen; - + einfo->info.destination_alpha = argb; - + einfo->info.visual = einfo->func.best_visual_get(einfo); einfo->info.colormap = einfo->func.best_colormap_get(einfo); einfo->info.depth = einfo->func.best_depth_get(einfo); - + if ((!einfo->info.visual) || (!einfo->info.colormap) || @@ -231,7 +231,7 @@ _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, return 0; } } - + attr.backing_store = NotUseful; attr.override_redirect = override; attr.colormap = einfo->info.colormap; @@ -248,7 +248,7 @@ _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, win = XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, einfo->info.depth, InputOutput, einfo->info.visual, - CWBackingStore | CWColormap | CWBackPixmap | + CWBackingStore | CWColormap | CWBackPixmap | CWBorderPixel | CWBitGravity | CWEventMask | CWOverrideRedirect, &attr); einfo->info.drawable = win; @@ -283,7 +283,7 @@ _ecore_evas_x_render(Ecore_Evas *ee) (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) && (!ee->engine.x.sync_cancel)) return 0; - + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) { if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); @@ -429,9 +429,9 @@ _ecore_evas_x_render(Ecore_Evas *ee) ((ee->should_be_visible) && (ee->prop.override))) { updates = evas_render_updates(ee->evas); - if (updates) + if (updates) { - if (ee->shaped) + if (ee->shaped) { #ifdef EVAS_FRAME_QUEUING /* wait until ee->engine.x.mask being updated */ @@ -455,13 +455,13 @@ _ecore_evas_x_render(Ecore_Evas *ee) else evas_norender(ee->evas); if (ee->func.fn_post_render) ee->func.fn_post_render(ee); -/* +/* if (rend) { static int frames = 0; static double t0 = 0.0; double t, td; - + t = ecore_time_get(); frames++; if ((t - t0) > 1.0) @@ -1072,7 +1072,7 @@ _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void Ecore_Evas *ee; Ecore_X_Event_Window_Show *e; static int first_map_bug = -1; - + e = event; ee = ecore_event_window_match(e->win); if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ @@ -1533,7 +1533,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, else { int w, h; - + ecore_x_window_size_get(ee->prop.window, &w, &h); ecore_x_window_resize(ee->prop.window, h, w); if ((rotation == 0) || (rotation == 180)) @@ -1556,7 +1556,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, else { int w, h; - + ecore_x_window_size_get(ee->prop.window, &w, &h); if ((rotation == 0) || (rotation == 180)) { @@ -1596,7 +1596,7 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, ecore_x_current_time_get()); if (ee->func.fn_resize) ee->func.fn_resize(ee); - + if ((ee->rotation == 90) || (ee->rotation == 270)) evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); else @@ -2047,16 +2047,16 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) ecore_x_window_free(ee->prop.window); ecore_event_window_unregister(ee->prop.window); ee->prop.window = 0; - + einfo->info.destination_alpha = alpha; - + if (ee->engine.x.win_root != 0) { /* FIXME: round trip in ecore_x_window_argb_get */ if (ecore_x_window_argb_get(ee->engine.x.win_root)) { ee->prop.window = _ecore_evas_x_gl_window_new - (ee, ee->engine.x.win_root, + (ee, ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h, ee->prop.override, 1, NULL); } @@ -2068,14 +2068,14 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) } else ee->prop.window = _ecore_evas_x_gl_window_new - (ee, ee->engine.x.win_root, + (ee, ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h, ee->prop.override, ee->alpha, NULL); if (!ee->prop.window) { return; } -/* +/* if (ee->alpha) { if (ee->prop.override) @@ -2430,7 +2430,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) static void _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) { - if (((ee->transparent) && (transparent)) || + if (((ee->transparent) && (transparent)) || ((!ee->transparent) && (!transparent))) return; @@ -2449,7 +2449,7 @@ _ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); } evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); -#endif +#endif } } #endif /* BUILD_ECORE_EVAS_X11 */ @@ -2994,6 +2994,14 @@ _ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) } } +static void +_ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h); +} + int _ecore_evas_x_shutdown(void) { @@ -3061,8 +3069,9 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func = _ecore_evas_x_ignore_events_set, _ecore_evas_x_alpha_set, _ecore_evas_x_transparent_set, - - NULL // render + + NULL, // render + _ecore_evas_x_screen_geometry_get }; #endif /* BUILD_ECORE_EVAS_X11 */ @@ -3117,8 +3126,8 @@ _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUS } if (ee->engine.x.netwm_sync_set) { - ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter, - ee->engine.x.netwm_sync_val_hi, + ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter, + ee->engine.x.netwm_sync_val_hi, ee->engine.x.netwm_sync_val_lo); ee->engine.x.netwm_sync_set = 0; } @@ -3185,7 +3194,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, ee->engine.x.win_root = parent; ee->engine.x.screen_num = 0; - + if (parent != 0) { ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ @@ -3377,7 +3386,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, return NULL; } } - + ecore_x_icccm_hints_set(ee->prop.window, 1 /* accepts_focus */, ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, @@ -3552,8 +3561,8 @@ ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; ee->driver = "opengl_x11"; - ee->semi_sync = 0; // gl engine doesnt need to sync - its whole swaps - ee->no_comp_sync = 0; // gl engine doesnt need to sync - its whole swaps + ee->semi_sync = 0; // gl engine doesn't need to sync - its whole swaps +// ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps if (disp_name) ee->name = strdup(disp_name); if (w < 1) w = 1; @@ -3741,9 +3750,9 @@ EAPI void ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e)) { Evas_Engine_Info_GL_X11 *einfo; - + if (!(!strcmp(ee->driver, "opengl_x11"))) return; - + einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); if (einfo) { @@ -4632,7 +4641,7 @@ ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win) return; ee = NULL; win = 0; -#endif +#endif } EAPI Ecore_X_Window @@ -4643,7 +4652,7 @@ ecore_evas_x11_leader_get(Ecore_Evas *ee) #else return 0; ee = NULL; -#endif +#endif } EAPI void @@ -4658,10 +4667,10 @@ ecore_evas_x11_leader_default_set(Ecore_Evas *ee) #endif } +#ifdef BUILD_ECORE_EVAS_X11 static Eina_Bool _ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect) { -#ifdef BUILD_ECORE_EVAS_X11 if (!src_rect || !dst_rect) return 0; if (ee->rotation == 0) @@ -4698,10 +4707,8 @@ _ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle * } return 1; -#else - return 0; -#endif } +#endif EAPI void ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h) diff --git a/src/lib/ecore_fb/.cvsignore b/src/lib/ecore_fb/.cvsignore deleted file mode 100644 index 6ff5cc5..0000000 --- a/src/lib/ecore_fb/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore_fb.la diff --git a/src/lib/ecore_fb/ecore_fb.c b/src/lib/ecore_fb/ecore_fb.c index 53b379b..77071e3 100644 --- a/src/lib/ecore_fb/ecore_fb.c +++ b/src/lib/ecore_fb/ecore_fb.c @@ -42,10 +42,10 @@ ecore_fb_init(const char *name __UNUSED__) { if (++_ecore_fb_init_count != 1) return _ecore_fb_init_count; - + if (!ecore_fb_vt_init()) return --_ecore_fb_init_count; - + ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new(); ECORE_FB_EVENT_KEY_UP = ecore_event_type_new(); ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); @@ -68,7 +68,7 @@ ecore_fb_init(const char *name __UNUSED__) */ EAPI int ecore_fb_shutdown(void) -{ +{ if (--_ecore_fb_init_count != 0) return _ecore_fb_init_count; @@ -102,7 +102,7 @@ _ecore_fb_size_get(int *w, int *h) { struct fb_var_screeninfo fb_var; int fb; - + fb = open("/dev/fb0", O_RDWR); if (fb < 0) { diff --git a/src/lib/ecore_fb/ecore_fb_kbd.c b/src/lib/ecore_fb/ecore_fb_kbd.c index 8dcd29d..25d7aef 100644 --- a/src/lib/ecore_fb/ecore_fb_kbd.c +++ b/src/lib/ecore_fb/ecore_fb_kbd.c @@ -9,116 +9,116 @@ static const char *_ecore_fb_kbd_syms[128 * 6] = static const char *_ecore_fb_btn_syms[128] = { "0x00", - "Escape", - "F1", - "F2", - "F3", - "F4", - "Up", + "Escape", + "F1", + "F2", + "F3", + "F4", + "Up", "Right", - "Left", - "Down", - "Return", - "0x1b", - "0x1c", - "0x1d", + "Left", + "Down", + "Return", + "0x1b", + "0x1c", + "0x1d", "0x1e", "0x1f", - "0x20", - "0x21", - "0x22", - "0x23", - "0x24", - "0x25", - "0x26", + "0x20", + "0x21", + "0x22", + "0x23", + "0x24", + "0x25", + "0x26", "0x27", - "0x28", - "0x29", + "0x28", + "0x29", "0x2a", "0x2b", "0x2c", "0x2d", - "0x2e", - "0x2f", - "0x30", - "0x31", - "0x32", - "0x33", - "0x34", - "0x35", - "0x36", + "0x2e", + "0x2f", + "0x30", + "0x31", + "0x32", + "0x33", + "0x34", + "0x35", + "0x36", "0x37", - "0x38", - "0x39", + "0x38", + "0x39", "0x3a", "0x3b", "0x3c", "0x3d", - "0x3e", - "0x3f", - "0x40", - "0x41", - "0x42", - "0x43", - "0x44", - "0x45", - "0x46", + "0x3e", + "0x3f", + "0x40", + "0x41", + "0x42", + "0x43", + "0x44", + "0x45", + "0x46", "0x47", - "0x48", - "0x49", + "0x48", + "0x49", "0x4a", "0x4b", "0x4c", "0x4d", - "0x4e", - "0x4f", - "0x50", - "0x51", - "0x52", - "0x53", - "0x54", - "0x55", - "0x56", + "0x4e", + "0x4f", + "0x50", + "0x51", + "0x52", + "0x53", + "0x54", + "0x55", + "0x56", "0x57", - "0x58", - "0x59", + "0x58", + "0x59", "0x5a", "0x5b", "0x5c", "0x5d", - "0x5e", - "0x5f", - "0x60", - "0x61", - "0x62", - "0x63", - "0x64", - "0x65", - "0x66", + "0x5e", + "0x5f", + "0x60", + "0x61", + "0x62", + "0x63", + "0x64", + "0x65", + "0x66", "0x67", - "0x68", - "0x69", + "0x68", + "0x69", "0x6a", "0x6b", "0x6c", "0x6d", - "0x6e", - "0x6f", - "0x70", - "0x71", - "0x72", - "0x73", - "0x74", - "0x75", - "0x76", + "0x6e", + "0x6f", + "0x70", + "0x71", + "0x72", + "0x73", + "0x74", + "0x75", + "0x76", "0x77", - "0x78", - "0x79", + "0x78", + "0x79", "0x7a", "0x7b", "0x7c", "0x7d", - "0x7e", + "0x7e", "0x7f" }; static int _ecore_fb_kbd_fd = -1; @@ -130,7 +130,7 @@ static int _ecore_fb_lock = 0; static Ecore_Fd_Handler *_ecore_fb_kbd_fd_handler_handle = NULL; static Eina_Bool _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); -static void +static void _ecore_fb_event_free_key_down(void *data __UNUSED__, void *ev) { Ecore_Fb_Event_Key_Up *e; @@ -145,7 +145,7 @@ static void _ecore_fb_event_free_key_up(void *data __UNUSED__, void *ev) { Ecore_Fb_Event_Key_Up *e; - + e = ev; free(e->keyname); if (e->keysymbol) free(e->keysymbol); @@ -157,11 +157,11 @@ static Eina_Bool _ecore_fb_kbd_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) { int v = 0; - + do { unsigned char buf; - + v = read(_ecore_fb_kbd_fd, &buf, 1); if (v < 0) return EINA_TRUE; if (v < 1) return EINA_TRUE; @@ -170,13 +170,13 @@ _ecore_fb_kbd_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U /* DOWN */ int vt_switch = -1; Ecore_Fb_Event_Key_Down *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Key_Down)); if (!e) goto retry; if (_ecore_fb_kbd_fd == _ecore_fb_tty_fd) { int add = 0; - + if (_ecore_fb_shift) add = 1; else if (_ecore_fb_lock) add = 2; e->keyname = strdup(_ecore_fb_kbd_syms[(buf & 0x7f) * 6]); @@ -228,13 +228,13 @@ _ecore_fb_kbd_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U { /* UP */ Ecore_Fb_Event_Key_Up *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Key_Up)); if (!e) goto retry; if (_ecore_fb_kbd_fd == _ecore_fb_tty_fd) { int add = 0; - + if (_ecore_fb_shift) add = 1; else if (_ecore_fb_lock) add = 2; e->keyname = strdup(_ecore_fb_kbd_syms[(buf & 0x7f) * 6]); @@ -279,7 +279,7 @@ int ecore_fb_kbd_init(void) { int prev_flags; - + prev_flags = fcntl(_ecore_fb_kbd_fd, F_GETFL); fcntl(_ecore_fb_kbd_fd, F_SETFL, prev_flags | O_NONBLOCK); _ecore_fb_kbd_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_kbd_fd, @@ -293,7 +293,7 @@ ecore_fb_kbd_init(void) void ecore_fb_kbd_shutdown(void) { - if (_ecore_fb_kbd_fd_handler_handle) + if (_ecore_fb_kbd_fd_handler_handle) ecore_main_fd_handler_del(_ecore_fb_kbd_fd_handler_handle); if (_ecore_fb_kbd_fd >= 0) close(_ecore_fb_kbd_fd); _ecore_fb_kbd_fd = -1; diff --git a/src/lib/ecore_fb/ecore_fb_li.c b/src/lib/ecore_fb/ecore_fb_li.c index b25c28e..65e5f61 100644 --- a/src/lib/ecore_fb/ecore_fb_li.c +++ b/src/lib/ecore_fb/ecore_fb_li.c @@ -405,7 +405,7 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen) * @return The @ref Ecore_Fb_Input_Device object that has been opened. * * This function opens the input device named @p dev and returns the - * object for it, or returns @c NULL on failure. + * object for it, or returns @c NULL on failure. */ EAPI Ecore_Fb_Input_Device * ecore_fb_input_device_open(const char *dev) diff --git a/src/lib/ecore_fb/ecore_fb_ps2.c b/src/lib/ecore_fb/ecore_fb_ps2.c index e57da15..c43a71a 100644 --- a/src/lib/ecore_fb/ecore_fb_ps2.c +++ b/src/lib/ecore_fb/ecore_fb_ps2.c @@ -20,7 +20,7 @@ ecore_fb_ps2_init(void) { prev_flags = fcntl(_ecore_fb_ps2_fd, F_GETFL); fcntl(_ecore_fb_ps2_fd, F_SETFL, prev_flags | O_NONBLOCK); - _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ps2_fd, + _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ps2_fd, ECORE_FD_READ, _ecore_fb_ps2_fd_handler, NULL, NULL, NULL); if (!_ecore_fb_ts_fd_handler_handle) @@ -30,7 +30,7 @@ ecore_fb_ps2_init(void) } return 1; } - return 0; + return 0; } void @@ -47,7 +47,7 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U static double last_time = 0; static double last_last_time = 0; int v = 0; - + do { int x, y, button, i; @@ -56,7 +56,7 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U double t; static int did_double = 0; static int did_triple = 0; - + ptr = (char *)&(_ecore_fb_ps2_event); ptr += _ecore_fb_ps2_event_byte_count; num = sizeof(Ecore_Fb_Ps2_Event) - _ecore_fb_ps2_event_byte_count; @@ -85,7 +85,7 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U { /* MOVE: mouse is down and was */ Ecore_Fb_Event_Mouse_Move *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move)); if (!e) goto retry; e->x = x; @@ -95,13 +95,13 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U for (i = 1; i <= 3; i++) { int mask; - + mask = 1 << (i - 1); if (((button & mask)) && (!(prev_button & mask))) { /* DOWN: mouse is down, but was not now */ Ecore_Fb_Event_Mouse_Button_Down *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down)); if (!e) goto retry; e->x = x; @@ -132,7 +132,7 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U { /* UP: mouse was down, but is not now */ Ecore_Fb_Event_Mouse_Button_Up *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up)); if (!e) goto retry; e->x = x; @@ -155,7 +155,7 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U last_last_time = last_time; last_time = t; } - retry: + retry: prev_x = x; prev_y = y; prev_button = button; @@ -171,7 +171,7 @@ _ecore_fb_ps2_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __U /** * Sets the timeout for a double and triple clicks to be flagged. - * + * * This sets the time between clicks before the double_click flag is * set in a button down event. If 3 clicks occur within double this * time, the triple_click flag is also set. diff --git a/src/lib/ecore_fb/ecore_fb_ts.c b/src/lib/ecore_fb/ecore_fb_ts.c index caef71b..33b2d8c 100644 --- a/src/lib/ecore_fb/ecore_fb_ts.c +++ b/src/lib/ecore_fb/ecore_fb_ts.c @@ -22,7 +22,7 @@ struct _Ecore_Fb_Ts_Event unsigned short pressure; unsigned short x; unsigned short y; - unsigned short _unused; + unsigned short _unused; }; struct _Ecore_Fb_Ts_Calibrate @@ -84,13 +84,13 @@ ecore_fb_ts_init(void) { printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice ); _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */ - + if ( !_ecore_fb_tslib_tsdev ) { printf( "ECORE_FB: Can't ts_open (%s)\n", strerror( errno ) ); return 0; } - + if ( ts_config( _ecore_fb_tslib_tsdev ) ) { printf( "ECORE_FB: Can't ts_config (%s)\n", strerror( errno ) ); @@ -108,7 +108,7 @@ ecore_fb_ts_init(void) #endif if (_ecore_fb_ts_fd >= 0) { - _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ts_fd, + _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ts_fd, ECORE_FD_READ, _ecore_fb_ts_fd_handler, NULL, NULL, NULL); @@ -153,7 +153,7 @@ EAPI void ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int ytrans, int xyswap) { Ecore_Fb_Ts_Calibrate cal; - + if (_ecore_fb_ts_fd < 0) return; cal.xscale = xscale; cal.xtrans = xtrans; @@ -181,7 +181,7 @@ EAPI void ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int *ytrans, int *xyswap) { Ecore_Fb_Ts_Calibrate cal; - + if (_ecore_fb_ts_fd < 0) return; if (!_ecore_fb_ts_apply_cal) { @@ -204,7 +204,7 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN static double last_time = 0; static double last_last_time = 0; int v = 0; - + do { int x, y, pressure; @@ -245,14 +245,14 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN y = _ecore_fb_ts_event.y; } pressure = _ecore_fb_ts_event.pressure; -#endif +#endif /* add event to queue */ /* always add a move event */ if ((pressure) || (prev_pressure)) { /* MOVE: mouse is down and was */ Ecore_Fb_Event_Mouse_Move *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move)); if (!e) goto retry; e->x = x; @@ -263,7 +263,7 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN { /* DOWN: mouse is down, but was not now */ Ecore_Fb_Event_Mouse_Button_Down *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down)); if (!e) goto retry; e->x = x; @@ -294,7 +294,7 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN { /* UP: mouse was down, but is not now */ Ecore_Fb_Event_Mouse_Button_Up *e; - + e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up)); if (!e) goto retry; e->x = prev_x; @@ -316,7 +316,7 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN last_last_time = last_time; last_time = t; } -retry: +retry: prev_x = x; prev_y = y; prev_pressure = pressure; diff --git a/src/lib/ecore_fb/ecore_fb_vt.c b/src/lib/ecore_fb/ecore_fb_vt.c index ab94f83..3d76f14 100644 --- a/src/lib/ecore_fb/ecore_fb_vt.c +++ b/src/lib/ecore_fb/ecore_fb_vt.c @@ -42,7 +42,7 @@ static Eina_Bool _ecore_fb_signal_usr_handler(void *data __UNUSED__, int type __UNUSED__, void *ev) { Ecore_Event_Signal_User *e; - + e = (Ecore_Event_Signal_User *)ev; if (e->number == 1) { @@ -82,10 +82,10 @@ static int _ecore_fb_vt_setup(void) { char buf[64]; -// XXX: unused +// XXX: unused // struct termios tio; struct vt_mode new_vtmode; - + if (_ecore_fb_vt_current_vt != _ecore_fb_vt_prev_vt) { snprintf(buf, sizeof(buf), "/dev/tty%i", _ecore_fb_vt_current_vt); @@ -104,7 +104,7 @@ _ecore_fb_vt_setup(void) tcgetattr(_ecore_fb_vt_tty_fd, &_ecore_fb_tty_prev_tio_mode); ioctl(_ecore_fb_vt_tty_fd, KDGETMODE, &_ecore_fb_tty_prev_kd_mode); ioctl(_ecore_fb_vt_tty_fd, VT_GETMODE, &_ecore_fb_vt_prev_mode); - + if (ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { perror("[ecore_fb:vt_setup] can't set the mode to KD_GRAPHICS"); @@ -113,7 +113,7 @@ _ecore_fb_vt_setup(void) return 0; } ioctl(_ecore_fb_vt_tty_fd, KDGKBMODE, &_ecore_fb_tty_prev_mode); - + /* support of switching */ new_vtmode.mode = VT_PROCESS; new_vtmode.waitv = 0; @@ -132,7 +132,7 @@ _ecore_fb_vt_setup(void) NULL); /* What does this do? */ _ecore_fb_filter_handler = ecore_event_filter_add(_ecore_fb_event_filter_start, _ecore_fb_event_filter_filter, _ecore_fb_event_filter_end, NULL); - + usleep(40000); if (ioctl(_ecore_fb_vt_tty_fd, VT_ACTIVATE, _ecore_fb_vt_current_vt) < 0) { @@ -156,7 +156,7 @@ int ecore_fb_vt_init(void) { struct vt_stat vtstat; - + /* as root you can allocate another tty */ if (!geteuid()) _ecore_fb_vt_do_switch = 1; @@ -176,7 +176,7 @@ ecore_fb_vt_init(void) if (_ecore_fb_vt_do_switch) { int vtno; - + if ((ioctl(_ecore_fb_vt_tty0_fd, VT_OPENQRY, &vtno) < 0)) { printf("[ecore_fb:init] can't query for a vt\n"); @@ -214,10 +214,10 @@ ecore_fb_vt_shutdown(void) close(_ecore_fb_vt_tty_fd); _ecore_fb_vt_tty_fd = -1; } - + if (_ecore_fb_user_handler) ecore_event_handler_del(_ecore_fb_user_handler); _ecore_fb_user_handler = NULL; - + if (_ecore_fb_filter_handler) ecore_event_filter_del(_ecore_fb_filter_handler); _ecore_fb_filter_handler = NULL; } @@ -275,12 +275,12 @@ struct _Ecore_Fb_Filter_Data { int last_event_type; }; - + static void * _ecore_fb_event_filter_start(void *data __UNUSED__) { Ecore_Fb_Filter_Data *filter_data; - + filter_data = calloc(1, sizeof(Ecore_Fb_Filter_Data)); return filter_data; } @@ -289,7 +289,7 @@ static Eina_Bool _ecore_fb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__) { Ecore_Fb_Filter_Data *filter_data; - + filter_data = loop_data; if (!filter_data) return EINA_TRUE; if (type == ECORE_FB_EVENT_MOUSE_MOVE) @@ -308,7 +308,7 @@ static void _ecore_fb_event_filter_end(void *data __UNUSED__, void *loop_data) { Ecore_Fb_Filter_Data *filter_data; - + filter_data = loop_data; if (filter_data) free(filter_data); } diff --git a/src/lib/ecore_file/.cvsignore b/src/lib/ecore_file/.cvsignore deleted file mode 100644 index be74149..0000000 --- a/src/lib/ecore_file/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore_file.la diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index 906c652..e34fe21 100644 --- a/src/lib/ecore_file/ecore_file.c +++ b/src/lib/ecore_file/ecore_file.c @@ -47,6 +47,10 @@ ecore_file_init() { if (++_ecore_file_init_count != 1) return _ecore_file_init_count; + + if (!ecore_init()) + return --_ecore_file_init_count; + _ecore_file_log_dom = eina_log_domain_register ("ecore_file", ECORE_FILE_DEFAULT_LOG_COLOR); if(_ecore_file_log_dom < 0) @@ -99,8 +103,12 @@ ecore_file_shutdown() ecore_file_download_shutdown(); ecore_file_monitor_shutdown(); ecore_file_path_shutdown(); + eina_log_domain_unregister(_ecore_file_log_dom); _ecore_file_log_dom = -1; + + ecore_shutdown(); + return _ecore_file_init_count; } @@ -242,7 +250,7 @@ ecore_file_mkdirs(const char **dirs) * returns -1 if @p dirs or @p base are @c NULL, or if @p base is * empty ("\0"). It returns 0 is @p base is not a directory or * invalid, or if it can't be created. Otherwise if returns the number - * of suceesfully created directories. + * of suceesfully created directories. */ EAPI int ecore_file_mksubdirs(const char *base, const char **subdirs) @@ -451,9 +459,9 @@ _ecore_file_mkpath_if_not_exists(const char *path) * @param path The path to create * @return EINA_TRUE on success, EINA_FALSE otherwise. * - * This function create @p path and all the subdirectories it + * This function creates @p path and all the subdirectories it * contains. The separator is '/' or '\'. If @p path exists, this - * function returns EINA_TRUE immediatly. It returns EINA_TRUE on + * function returns EINA_TRUE immediately. It returns EINA_TRUE on * success, EINA_FALSE otherwise. */ EAPI Eina_Bool @@ -490,7 +498,7 @@ ecore_file_mkpath(const char *path) * and call ecore_file_mkpath(), hence on Windows, '\' must be * replaced by '/' before calling that function. This function * returns -1 if @p paths is @c NULL. Otherwise if returns the number - * of suceesfully created directories. + * of suceesfully created directories. */ EAPI int ecore_file_mkpaths(const char **paths) @@ -578,10 +586,10 @@ ecore_file_mv(const char *src, const char *dst) char *dir; dir = ecore_file_dir_get(dst); - // Since we can't directly rename, try to + // Since we can't directly rename, try to // copy to temp file in the dst directory // and then rename. - snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX", + snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX", dir, ecore_file_file_get(dst)); free(dir); fd = mkstemp(buf); @@ -1095,7 +1103,7 @@ ecore_file_dir_is_empty(const char *dir) return 0; } } - + closedir(dirp); return 1; } diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index ab8294a..043a797 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -191,13 +191,13 @@ _ecore_file_download(const char *url, * download using http and ftp protocols. If @p dst is ill-formed, or * if it already exists, the function returns EINA_FALSE. When the * download is complete, the callback @p completion_cb is called and - * @p data is passed to it. The @p status parameter of @p completion_cb + * @p data is passed to it. The @p status parameter of @p completion_cb * will be filled with the status of the download (200, 404,...). The * @p progress_cb is called during the download operation, each time a * packet is received or when CURL wants. It can be used to display the * percentage of the downloaded file. Return 0 from this callback, if provided, * to continue the operation or anything else to abort the download. The only - * operations that can be aborted are those with protocol 'http' or 'ftp'. In + * operations that can be aborted are those with protocol 'http' or 'ftp'. In * that case @p job_ret can be filled. It can be used with * ecore_file_download_abort() or ecore_file_download_abort_all() to * respectively abort one or all download operations. This function returns diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c index 255ca1b..c3533ad 100644 --- a/src/lib/ecore_file/ecore_file_monitor_inotify.c +++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c @@ -65,7 +65,7 @@ ecore_file_monitor_inotify_init(void) fd = inotify_init(); if (fd < 0) return 0; - + _fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler, NULL, NULL, NULL); if (!_fdh) @@ -113,7 +113,7 @@ ecore_file_monitor_inotify_add(const char *path, ecore_file_monitor_inotify_shutdown(); ecore_file_monitor_inotify_init(); } - + em = calloc(1, sizeof(Ecore_File_Monitor_Inotify)); if (!em) return NULL; @@ -284,19 +284,19 @@ _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask) static int _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path) { - int mask = - IN_ATTRIB | + int mask = + IN_ATTRIB | IN_CLOSE_WRITE | - IN_MOVED_FROM | + IN_MOVED_FROM | IN_MOVED_TO | - IN_DELETE | + IN_DELETE | IN_CREATE | IN_MODIFY | - IN_DELETE_SELF | + IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT; - - ECORE_FILE_MONITOR_INOTIFY(em)->wd = + + ECORE_FILE_MONITOR_INOTIFY(em)->wd = inotify_add_watch(ecore_main_fd_handler_fd_get(_fdh), path, mask); if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0) { diff --git a/src/lib/ecore_file/ecore_file_monitor_poll.c b/src/lib/ecore_file/ecore_file_monitor_poll.c index 9cab3c7..1f71b55 100644 --- a/src/lib/ecore_file/ecore_file_monitor_poll.c +++ b/src/lib/ecore_file/ecore_file_monitor_poll.c @@ -242,14 +242,14 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) { Ecore_File *f = l; char buf[PATH_MAX]; - int mtime; + int mt; Ecore_File_Event event; l = (Ecore_File *) EINA_INLIST_GET(l)->next; snprintf(buf, sizeof(buf), "%s/%s", em->path, f->name); - mtime = ecore_file_mod_time(buf); - if (mtime < f->mtime) + mt = ecore_file_mod_time(buf); + if (mt < f->mtime) { if (f->is_dir) event = ECORE_FILE_EVENT_DELETED_DIRECTORY; @@ -262,21 +262,21 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) free(f); _interval = ECORE_FILE_INTERVAL_MIN; } - else if ((mtime > f->mtime) && !(f->is_dir)) + else if ((mt > f->mtime) && !(f->is_dir)) { em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf); _interval = ECORE_FILE_INTERVAL_MIN; - f->mtime = mtime; + f->mtime = mt; } else - f->mtime = mtime; + f->mtime = mt; } /* Check for new files */ if (ECORE_FILE_MONITOR_POLL(em)->mtime < mtime) { Eina_List *files; - Eina_List *l; + Eina_List *fl; char *file; /* Files have been added or removed */ @@ -284,7 +284,7 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) if (files) { /* Are we a directory? We should check first, rather than rely on null here*/ - EINA_LIST_FOREACH(files, l, file) + EINA_LIST_FOREACH(files, fl, file) { Ecore_File *f; char buf[PATH_MAX]; diff --git a/src/lib/ecore_file/ecore_file_path.c b/src/lib/ecore_file/ecore_file_path.c index d6e5ea6..ade3bc6 100644 --- a/src/lib/ecore_file/ecore_file_path.c +++ b/src/lib/ecore_file/ecore_file_path.c @@ -119,7 +119,7 @@ ecore_file_path_dir_exists(const char *in_dir) * @return EINA_TRUE if the exe is in PATH and is executable, * EINA_FALSE otherwise. * - * + * * This function checks if @p exe exists in PATH and is executable. If * @p exe is @c NULL or is not executable, the function returns * EINA_FALSE, otherwise it returns EINA_TRUE. @@ -162,7 +162,7 @@ ecore_file_app_list(void) Eina_List *files; Eina_List *l; char buf[PATH_MAX], *dir, *exe; - + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) { files = ecore_file_ls(dir); diff --git a/src/lib/ecore_imf/.cvsignore b/src/lib/ecore_imf/.cvsignore deleted file mode 100644 index 09980ae..0000000 --- a/src/lib/ecore_imf/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h index 5e71c14..418abce 100644 --- a/src/lib/ecore_imf/Ecore_IMF.h +++ b/src/lib/ecore_imf/Ecore_IMF.h @@ -80,29 +80,6 @@ typedef enum typedef enum { - ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default 4x4 layout */ - ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */ - ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */ - ECORE_IMF_INPUT_PANEL_LAYOUT_URL, /**< URL layout */ - ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */ - 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_CUSTOM_1 = 100, /* Reserved for future use */ - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_2, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_3, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_4, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_5, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_6, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_7, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_8, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_9, - ECORE_IMF_INPUT_PANEL_LAYOUT_CUSTOM_10, - ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID -} Ecore_IMF_Input_Panel_Layout; - -typedef enum -{ ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ } Ecore_IMF_Input_Panel_Lang; @@ -240,6 +217,27 @@ typedef enum ECORE_IMF_PREEDIT_TYPE_SUB3 } Ecore_IMF_Preedit_Type; +typedef enum +{ + ECORE_IMF_AUTOCAPITAL_TYPE_NONE, + ECORE_IMF_AUTOCAPITAL_TYPE_WORD, + ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, + ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER +} Ecore_IMF_Autocapital_Type; + +typedef enum +{ + ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_URL, /**< URL layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */ + 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; + struct _Ecore_IMF_Event_Preedit_Start { Ecore_IMF_Context *ctx; @@ -453,6 +451,8 @@ struct _Ecore_IMF_Context_Class void (*input_panel_caps_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Caps_Mode mode); void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos); + void (*prediction_allow_set)(Ecore_IMF_Context *ctx, Eina_Bool prediction); + void (*autocapital_type_set)(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type); }; struct _Ecore_IMF_Context_Info @@ -506,6 +506,10 @@ 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_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); +EAPI Ecore_IMF_Autocapital_Type ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx); @@ -516,7 +520,7 @@ EAPI void ecore_imf_context_input_panel_layout_set(Ecor EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx); EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx); -EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const char * data, int len); +EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const char *data, int len); EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, char *data, int *len); EAPI void ecore_imf_context_input_panel_use_effect_set(Ecore_IMF_Context *ctx, Eina_Bool use_effect); EAPI Eina_Bool ecore_imf_context_input_panel_use_effect_get(Ecore_IMF_Context *ctx); diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index 1bda4fc..4b8e5bd 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c @@ -175,6 +175,15 @@ ecore_imf_context_add(const char *id) /* default use_preedit is EINA_TRUE, so let's make sure it's * set on the immodule */ ecore_imf_context_use_preedit_set(ctx, EINA_TRUE); + + /* default prediction is EINA_TRUE, so let's make sure it's + * set on the immodule */ +// ecore_imf_context_prediction_allow_set(ctx, EINA_TRUE); + + /* default autocapital type is SENTENCE type, so let's make sure it's + * set on the immodule */ +// ecore_imf_context_autocapital_type_set(ctx, ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE); + /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's * set on the immodule */ ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL); @@ -525,6 +534,96 @@ 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. + * + * @param ctx An #Ecore_IMF_Context. + * @param prediction Whether the IM context should allow to use the text prediction. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_prediction_allow_set"); + return; + } + + ctx->allow_prediction = prediction; + + if (ctx->klass->prediction_allow_set) + ctx->klass->prediction_allow_set(ctx, prediction); +} + +/** + * Get whether the IM context should allow to use the text prediction. + * + * @param ctx An #Ecore_IMF_Context. + * @return EINA_TRUE if it allows to use the text prediction, otherwise EINA_FALSE. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI Eina_Bool +ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_prediction_allow_get"); + return EINA_FALSE; + } + + return ctx->allow_prediction; +} + +/** + * Set the autocapitalization type on the immodule. + * + * @param ctx An #Ecore_IMF_Context. + * @param autocapital_type the autocapitalization type. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_autocapital_type_set"); + return; + } + + ctx->autocapital_type = autocapital_type; + + if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type); +} + +/** + * Get the autocapitalization type. + * + * @param ctx An #Ecore_IMF_Context. + * @return The autocapital type being used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI Ecore_IMF_Autocapital_Type +ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_autocapital_allow_get"); + return ECORE_IMF_AUTOCAPITAL_TYPE_NONE; + } + + return ctx->autocapital_type; +} + +/** * Set the callback to be used on get_surrounding request. * * This callback will be called when the Input Method Context @@ -950,7 +1049,7 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) } /** - * Show control panel. + * Ask the Input Method Context to show the control panel of using Input Method. * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_IMControl_Group @@ -970,7 +1069,7 @@ ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx) } /** - * Hide control panel. + * Ask the Input Method Context to hide the control panel of using Input Method. * * @param ctx An #Ecore_IMF_Context. * @ingroup Ecore_IMF_Context_IMControl_Group @@ -990,7 +1089,8 @@ ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx) } /** - * Set the language of input panel. + * Set the language of the input panel. + * This API can be used when you want to show the English keyboard. * * @param ctx An #Ecore_IMF_Context. * @param lang the language to be set to the input panel. @@ -1012,7 +1112,7 @@ ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_In } /** - * Get the language of input panel. + * Get the language of the input panel. * * See @ref ecore_imf_context_input_panel_language_set for more details. * diff --git a/src/lib/ecore_imf/ecore_imf_private.h b/src/lib/ecore_imf/ecore_imf_private.h index 82f3996..39a4fe2 100644 --- a/src/lib/ecore_imf/ecore_imf_private.h +++ b/src/lib/ecore_imf/ecore_imf_private.h @@ -45,17 +45,19 @@ struct _Ecore_IMF_Context int input_mode; void *window; void *client_canvas; - Ecore_IMF_Input_Panel_Layout input_panel_layout; - Ecore_IMF_Input_Panel_Lang input_panel_lang; - int use_effect; int input_panel_x; int input_panel_y; Ecore_IMF_Input_Panel_Orient input_panel_orient; Eina_Bool (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos); void *retrieve_surrounding_data; + Ecore_IMF_Autocapital_Type autocapital_type; + Ecore_IMF_Input_Panel_Layout input_panel_layout; + Ecore_IMF_Input_Panel_Lang input_panel_lang; Eina_List *callbacks; Eina_List *disabled_key_list; Eina_List *private_key_list; + Eina_Bool allow_prediction : 1; + Eina_Bool use_effect : 1; }; struct _Ecore_IMF_Module diff --git a/src/lib/ecore_imf_evas/.cvsignore b/src/lib/ecore_imf_evas/.cvsignore deleted file mode 100644 index 09980ae..0000000 --- a/src/lib/ecore_imf_evas/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/ecore_input/ecore_input.c b/src/lib/ecore_input/ecore_input.c index 22740bf..ce4c275 100644 --- a/src/lib/ecore_input/ecore_input.c +++ b/src/lib/ecore_input/ecore_input.c @@ -30,7 +30,7 @@ ecore_event_init(void) { if (++_ecore_event_init_count != 1) return _ecore_event_init_count; - + _ecore_input_log_dom = eina_log_domain_register ("ecore_input", ECORE_INPUT_DEFAULT_LOG_COLOR); if(_ecore_input_log_dom < 0) diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index 0f445a0..2ab8a7e 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c @@ -166,10 +166,10 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr { ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); if (press == ECORE_DOWN) - evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, + evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, e->timestamp, NULL); else - evas_event_feed_mouse_up(lookup->evas, e->buttons, flags, + evas_event_feed_mouse_up(lookup->evas, e->buttons, flags, e->timestamp, NULL); } else @@ -177,35 +177,35 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr if (press == ECORE_DOWN) { if (lookup->down_multi) - lookup->down_multi(lookup->window, e->multi.device, - e->x, e->y, e->multi.radius, - e->multi.radius_x, e->multi.radius_y, - e->multi.pressure, e->multi.angle, - e->multi.x, e->multi.y, flags, + lookup->down_multi(lookup->window, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, e->timestamp); else - evas_event_feed_multi_down(lookup->evas, e->multi.device, - e->x, e->y, e->multi.radius, - e->multi.radius_x, e->multi.radius_y, - e->multi.pressure, e->multi.angle, - e->multi.x, e->multi.y, flags, + evas_event_feed_multi_down(lookup->evas, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, e->timestamp, NULL); } else { if (lookup->up_multi) - lookup->up_multi(lookup->window, e->multi.device, - e->x, e->y, e->multi.radius, - e->multi.radius_x, e->multi.radius_y, - e->multi.pressure, e->multi.angle, - e->multi.x, e->multi.y, flags, + lookup->up_multi(lookup->window, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, e->timestamp); else - evas_event_feed_multi_up(lookup->evas, e->multi.device, - e->x, e->y, e->multi.radius, - e->multi.radius_x, e->multi.radius_y, - e->multi.pressure, e->multi.angle, - e->multi.x, e->multi.y, flags, + evas_event_feed_multi_up(lookup->evas, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, e->timestamp, NULL); } } @@ -227,23 +227,23 @@ ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *ev if (lookup->move_mouse) lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp); else - evas_event_feed_mouse_move(lookup->evas, e->x, e->y, e->timestamp, + evas_event_feed_mouse_move(lookup->evas, e->x, e->y, e->timestamp, NULL); } else { if (lookup->move_multi) - lookup->move_multi(lookup->window, e->multi.device, - e->x, e->y, e->multi.radius, - e->multi.radius_x, e->multi.radius_y, - e->multi.pressure, e->multi.angle, + lookup->move_multi(lookup->window, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, e->multi.x, e->multi.y, e->timestamp); else - evas_event_feed_multi_move(lookup->evas, e->multi.device, - e->x, e->y, e->multi.radius, - e->multi.radius_x, e->multi.radius_y, - e->multi.pressure, e->multi.angle, - e->multi.x, e->multi.y, e->timestamp, + evas_event_feed_multi_move(lookup->evas, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, e->timestamp, NULL); } return ECORE_CALLBACK_RENEW; @@ -371,14 +371,14 @@ ecore_event_evas_init(void) ecore_event_evas_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, ecore_event_evas_mouse_out, NULL); - + _window_hash = eina_hash_pointer_new(free); - + return _ecore_event_evas_init_count; - + shutdown_ecore: ecore_shutdown(); - + return --_ecore_event_evas_init_count; } @@ -386,10 +386,10 @@ EAPI int ecore_event_evas_shutdown(void) { size_t i; - + if (--_ecore_event_evas_init_count != 0) return _ecore_event_evas_init_count; - + eina_hash_free(_window_hash); _window_hash = NULL; for (i = 0; i < sizeof(ecore_event_evas_handlers) / sizeof(Ecore_Event_Handler *); i++) @@ -397,12 +397,12 @@ ecore_event_evas_shutdown(void) ecore_event_handler_del(ecore_event_evas_handlers[i]); ecore_event_evas_handlers[i] = NULL; } - + ecore_event_shutdown(); ecore_shutdown(); - + eina_log_domain_unregister(_ecore_input_evas_log_dom); _ecore_input_evas_log_dom = -1; - + return _ecore_event_evas_init_count; } diff --git a/src/lib/ecore_ipc/.cvsignore b/src/lib/ecore_ipc/.cvsignore deleted file mode 100644 index f98e6f6..0000000 --- a/src/lib/ecore_ipc/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Ecore_Ipc.h -Makefile -Makefile.in -ecore_ipc.lo -libecore_ipc.la diff --git a/src/lib/ecore_ipc/Ecore_Ipc.h b/src/lib/ecore_ipc/Ecore_Ipc.h index 000fca9..fa12b40 100644 --- a/src/lib/ecore_ipc/Ecore_Ipc.h +++ b/src/lib/ecore_ipc/Ecore_Ipc.h @@ -5,9 +5,13 @@ # undef EAPI #endif -#ifdef _MSC_VER -# ifdef BUILDING_DLL -# define EAPI __declspec(dllexport) +#ifdef _WIN32 +# ifdef EFL_ECORE_IPC_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif # else # define EAPI __declspec(dllimport) # endif @@ -31,11 +35,9 @@ #ifdef __cplusplus extern "C" { #endif - -#ifndef _ECORE_IPC_PRIVATE_H - typedef void Ecore_Ipc_Server; /**< An IPC connection handle */ - typedef void Ecore_Ipc_Client; /**< An IPC connection handle */ -#endif + +typedef struct _Ecore_Ipc_Server Ecore_Ipc_Server; /**< An IPC connection handle */ +typedef struct _Ecore_Ipc_Client Ecore_Ipc_Client; /**< An IPC connection handle */ /** * Macros used for generic data packing diff --git a/src/lib/ecore_ipc/Makefile.am b/src/lib/ecore_ipc/Makefile.am index 03b392d..9cbed43 100644 --- a/src/lib/ecore_ipc/Makefile.am +++ b/src/lib/ecore_ipc/Makefile.am @@ -7,7 +7,9 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/lib/ecore \ -I$(top_srcdir)/src/lib/ecore_con \ -I$(top_srcdir)/src/lib/ecore_ipc \ -@SSL_CFLAGS@ @EINA_CFLAGS@ +@EFL_ECORE_IPC_BUILD@ \ +@SSL_CFLAGS@ \ +@EINA_CFLAGS@ lib_LTLIBRARIES = libecore_ipc.la includes_HEADERS = Ecore_Ipc.h diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index 4024280..c9819e7 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -13,11 +13,18 @@ # include #endif -#include "Ecore.h" -#include "ecore_private.h" -#include "Ecore_Con.h" -#include "ecore_ipc_private.h" +#if USE_GNUTLS_OPENSSL +# include +#elif USE_OPENSSL +# include +#endif + +#include +#include +#include + #include "Ecore_Ipc.h" +#include "ecore_ipc_private.h" #define DLT_ZERO 0 #define DLT_ONE 1 diff --git a/src/lib/ecore_ipc/ecore_ipc_private.h b/src/lib/ecore_ipc/ecore_ipc_private.h index b46f62b..57f7849 100644 --- a/src/lib/ecore_ipc/ecore_ipc_private.h +++ b/src/lib/ecore_ipc/ecore_ipc_private.h @@ -34,20 +34,21 @@ extern int _ecore_ipc_log_dom; #endif #define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_ipc_log_dom, __VA_ARGS__) -#if USE_GNUTLS_OPENSSL -# include -#elif USE_OPENSSL -# include -#endif - #define ECORE_MAGIC_IPC_SERVER 0x87786556 #define ECORE_MAGIC_IPC_CLIENT 0x78875665 -typedef struct _Ecore_Ipc_Client Ecore_Ipc_Client; -typedef struct _Ecore_Ipc_Server Ecore_Ipc_Server; typedef struct _Ecore_Ipc_Msg_Head Ecore_Ipc_Msg_Head; +#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100) +# pragma pack(1) +# define ECORE_IPC_STRUCT_PACKED +#elif defined (__GNUC__) || (defined (__SUNPRO_C) && __SUNPRO_C >= 0x5100) +# define ECORE_IPC_STRUCT_PACKED __attribute__((packed)) +#else +# define ECORE_IPC_STRUCT_PACKED +#endif + #ifdef __sgi #pragma pack 4 #endif @@ -59,11 +60,7 @@ struct _Ecore_Ipc_Msg_Head int ref_to; int response; int size; -} -#ifdef _GNU_C_ -__attribute__ ((packed)); -#endif -; +} ECORE_IPC_STRUCT_PACKED; #ifdef __sgi #pragma pack 0 #endif diff --git a/src/lib/ecore_sdl/.cvsignore b/src/lib/ecore_sdl/.cvsignore deleted file mode 100644 index 09980ae..0000000 --- a/src/lib/ecore_sdl/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/ecore_win32/.cvsignore b/src/lib/ecore_win32/.cvsignore deleted file mode 100644 index 6607302..0000000 --- a/src/lib/ecore_win32/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.libs -.deps -Makefile -Makefile.in -*.lo -*.la diff --git a/src/lib/ecore_win32/Ecore_Win32.h b/src/lib/ecore_win32/Ecore_Win32.h index 9141335..bdfb1c8 100644 --- a/src/lib/ecore_win32/Ecore_Win32.h +++ b/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 occured */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long long time; /**< 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 occured */ + long time; /**< The time the event occurred */ }; /** @@ -266,8 +266,8 @@ struct _Ecore_Win32_Event_Window_Damage int x; /**< The x coordinate of the top left corner of the damaged region */ 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 occured */ - long time; /**< The time the event occured */ + int height; /**< The time the event occurred */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long time; /**< 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 occured */ + long time; /**< The time the event occurred */ }; /** diff --git a/src/lib/ecore_win32/ecore_win32.c b/src/lib/ecore_win32/ecore_win32.c index ef7187a..1c20e2f 100644 --- a/src/lib/ecore_win32/ecore_win32.c +++ b/src/lib/ecore_win32/ecore_win32.c @@ -121,7 +121,7 @@ _ecore_win32_window_procedure(HWND window, INF("left button up message"); - w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWL_USERDATA); + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); if (w->drag.dragging) { ReleaseCapture(); @@ -147,7 +147,7 @@ _ecore_win32_window_procedure(HWND window, INF("moue move message"); - w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWL_USERDATA); + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); if (w->drag.dragging) { @@ -416,7 +416,7 @@ _ecore_win32_window_procedure(HWND window, { Ecore_Win32_Window *w; - w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWL_USERDATA); + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); ecore_win32_window_geometry_get(w, NULL, NULL, &w->drag.w, &w->drag.h); @@ -438,7 +438,7 @@ _ecore_win32_window_procedure(HWND window, INF("sys command MOVE or SIZE window message : %dx%d", GET_X_LPARAM(data_param), GET_Y_LPARAM(data_param)); - w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWL_USERDATA); + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); w->drag.dragging = 1; return 0; } diff --git a/src/lib/ecore_win32/ecore_win32_cursor.c b/src/lib/ecore_win32/ecore_win32_cursor.c index e842259..9a5a7eb 100644 --- a/src/lib/ecore_win32/ecore_win32_cursor.c +++ b/src/lib/ecore_win32/ecore_win32_cursor.c @@ -216,7 +216,7 @@ ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor) * @param shape The pre-defined shape of the cursor. * @return The new cursor. * - * This funtion returns a pre-defined cursor with a specified + * This function returns a pre-defined cursor with a specified * @p shape. This cursor does not need to be freed, as it is loaded * from an existing resource. */ diff --git a/src/lib/ecore_win32/ecore_win32_event.c b/src/lib/ecore_win32/ecore_win32_event.c index 4d69654..55bbcc6 100644 --- a/src/lib/ecore_win32/ecore_win32_event.c +++ b/src/lib/ecore_win32/ecore_win32_event.c @@ -85,7 +85,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, } store_key: - e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); if (!e->window) { free(e); @@ -136,7 +136,7 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, } store_key: - e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); if (!e->window) { free(e); @@ -158,7 +158,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, INF("mouse button pressed"); - window = (Ecore_Win32_Window *)GetWindowLongPtr(msg->window, GWL_USERDATA); + window = (Ecore_Win32_Window *)GetWindowLongPtr(msg->window, GWLP_USERDATA); if (button > 3) { @@ -263,7 +263,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, INF("mouse button released"); - window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); { Ecore_Event_Mouse_Move *e; @@ -326,7 +326,7 @@ _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->event_window = e->window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); @@ -346,7 +346,7 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->event_window = e->window; e->x = msg->x; e->y = msg->y; @@ -364,7 +364,7 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) e = (Ecore_Win32_Event_Mouse_In *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_In)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->x = msg->x; e->y = msg->y; e->time = msg->time ; @@ -386,7 +386,7 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; - e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->event_window = e->window; e->x = msg->x; e->y = msg->y; @@ -404,7 +404,7 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) e = (Ecore_Win32_Event_Mouse_Out *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Out)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->x = msg->x; e->y = msg->y; e->time = msg->time; @@ -425,7 +425,7 @@ _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; _ecore_win32_event_last_time = e->time; @@ -443,7 +443,7 @@ _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; _ecore_win32_event_last_time = e->time; @@ -461,7 +461,7 @@ _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg) e = (Ecore_Win32_Event_Window_Damage *)calloc(1, sizeof(Ecore_Win32_Event_Window_Damage)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->x = msg->update.left; e->y = msg->update.top; @@ -483,7 +483,7 @@ _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; @@ -500,7 +500,7 @@ _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; @@ -518,7 +518,7 @@ _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg) e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; @@ -535,7 +535,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; @@ -562,8 +562,8 @@ _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg) return; } - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); - e->abovewin = (void *)GetWindowLongPtr(window_pos->hwndInsertAfter, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->abovewin = (void *)GetWindowLongPtr(window_pos->hwndInsertAfter, GWLP_USERDATA); e->x = wi.rcClient.left; e->y = wi.rcClient.top; e->width = wi.rcClient.right - wi.rcClient.left; @@ -587,7 +587,7 @@ _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg) e = calloc(1, sizeof(Ecore_Win32_Event_Window_Resize)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + 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; @@ -605,7 +605,7 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request)); if (!e) return; - e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->time = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c index 20edf81..9781faf 100644 --- a/src/lib/ecore_win32/ecore_win32_window.c +++ b/src/lib/ecore_win32/ecore_win32_window.c @@ -84,7 +84,7 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, x, y, rect.right - rect.left, rect.bottom - rect.top, - parent ? ((Ecore_Win32_Window *)parent)->window : NULL, + parent ? parent->window : NULL, NULL, _ecore_win32_instance, NULL); if (!w->window) { @@ -94,7 +94,8 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, } SetLastError(0); - if (!SetWindowLongPtr(w->window, GWL_USERDATA, (LONG_PTR)w) && (GetLastError() != 0)) + if (!SetWindowLongPtr(w->window, GWLP_USERDATA, (LONG_PTR)w) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); DestroyWindow(w->window); @@ -230,16 +231,14 @@ ecore_win32_window_override_new(Ecore_Win32_Window *parent, EAPI void ecore_win32_window_free(Ecore_Win32_Window *window) { - Ecore_Win32_Window *wnd = window; - if (!window) return; INF("destroying window"); - if (wnd->shape.mask) - free(wnd->shape.mask); + if (window->shape.mask) + free(window->shape.mask); - DestroyWindow(((Ecore_Win32_Window *)window)->window); + DestroyWindow(window->window); free(window); } @@ -256,7 +255,7 @@ ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) { if (!window) return NULL; - return ((Ecore_Win32_Window *)window)->window; + return window->window; } /* @@ -308,21 +307,19 @@ ecore_win32_window_move(Ecore_Win32_Window *window, int y) { RECT rect; - HWND w; /* FIXME: on fullscreen, should not move it */ if (!window) return; INF("moving window (%dx%d)", x, y); - w = ((Ecore_Win32_Window *)window)->window; - if (!GetWindowRect(w, &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); return; } - if (!MoveWindow(w, x, y, + if (!MoveWindow(window->window, x, y, rect.right - rect.left, rect.bottom - rect.top, TRUE)) @@ -348,7 +345,6 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, int height) { RECT rect; - Ecore_Win32_Window *w; DWORD style; int x; int y; @@ -360,12 +356,10 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, INF("resizing window (%dx%d)", width, height); - w = (Ecore_Win32_Window *)window; + minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width); + minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height); - minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)w->min_width); - minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)w->min_height); - - if (!GetWindowRect(w->window, &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); return; @@ -376,12 +370,12 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, rect.left = 0; rect.top = 0; if (width < minimal_width) width = minimal_width; - if (width > (int)w->max_width) width = w->max_width; + if (width > (int)window->max_width) width = window->max_width; if (height < minimal_height) height = minimal_height; - if (height > (int)w->max_height) height = w->max_height; + if (height > (int)window->max_height) height = window->max_height; rect.right = width; rect.bottom = height; - if (!(style = GetWindowLong(w->window, GWL_STYLE))) + if (!(style = GetWindowLong(window->window, GWL_STYLE))) { ERR("GetWindowLong() failed"); return; @@ -392,7 +386,7 @@ ecore_win32_window_resize(Ecore_Win32_Window *window, return; } - if (!MoveWindow(w->window, x, y, + if (!MoveWindow(window->window, x, y, rect.right - rect.left, rect.bottom - rect.top, TRUE)) @@ -422,7 +416,6 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window, int height) { RECT rect; - Ecore_Win32_Window *w; DWORD style; int minimal_width; int minimal_height; @@ -432,20 +425,18 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window, INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); - w = ((Ecore_Win32_Window *)window); - - minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)w->min_width); - minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)w->min_height); + minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width); + minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height); rect.left = 0; rect.top = 0; if (width < minimal_width) width = minimal_width; - if (width > (int)w->max_width) width = w->max_width; + if (width > (int)window->max_width) width = window->max_width; if (height < minimal_height) height = minimal_height; - if (height > (int)w->max_height) height = w->max_height; + if (height > (int)window->max_height) height = window->max_height; rect.right = width; rect.bottom = height; - if (!(style = GetWindowLong(w->window, GWL_STYLE))) + if (!(style = GetWindowLong(window->window, GWL_STYLE))) { ERR("GetWindowLong() failed"); return; @@ -456,7 +447,7 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window, return; } - if (!MoveWindow(w->window, x, y, + if (!MoveWindow(window->window, x, y, rect.right - rect.left, rect.bottom - rect.top, TRUE)) @@ -504,8 +495,7 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window, return; } - if (!GetClientRect(((Ecore_Win32_Window *)window)->window, - &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); @@ -520,8 +510,7 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window, w = rect.right - rect.left; h = rect.bottom - rect.top; - if (!GetWindowRect(((Ecore_Win32_Window *)window)->window, - &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); @@ -570,8 +559,7 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window, return; } - if (!GetClientRect(((Ecore_Win32_Window *)window)->window, - &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); @@ -599,14 +587,11 @@ ecore_win32_window_size_min_set(Ecore_Win32_Window *window, unsigned int min_width, unsigned int min_height) { - Ecore_Win32_Window *w; - if (!window) return; printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height); - w = (Ecore_Win32_Window *)window; - w->min_width = min_width; - w->min_height = min_height; + window->min_width = min_width; + window->min_height = min_height; } /** @@ -625,14 +610,11 @@ ecore_win32_window_size_min_get(Ecore_Win32_Window *window, unsigned int *min_width, unsigned int *min_height) { - Ecore_Win32_Window *w; - if (!window) return; - w = (Ecore_Win32_Window *)window; - printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, w->min_width, w->min_height); - if (min_width) *min_width = w->min_width; - if (min_height) *min_height = w->min_height; + printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, window->min_width, window->min_height); + if (min_width) *min_width = window->min_width; + if (min_height) *min_height = window->min_height; } /** @@ -651,14 +633,11 @@ ecore_win32_window_size_max_set(Ecore_Win32_Window *window, unsigned int max_width, unsigned int max_height) { - Ecore_Win32_Window *w; - if (!window) return; printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height); - w = (Ecore_Win32_Window *)window; - w->max_width = max_width; - w->max_height = max_height; + window->max_width = max_width; + window->max_height = max_height; } /** @@ -677,14 +656,11 @@ ecore_win32_window_size_max_get(Ecore_Win32_Window *window, unsigned int *max_width, unsigned int *max_height) { - Ecore_Win32_Window *w; - if (!window) return; - w = (Ecore_Win32_Window *)window; - printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, w->max_width, w->max_height); - if (max_width) *max_width = w->max_width; - if (max_height) *max_height = w->max_height; + printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, window->max_width, window->max_height); + if (max_width) *max_width = window->max_width; + if (max_height) *max_height = window->max_height; } /** @@ -703,14 +679,11 @@ ecore_win32_window_size_base_set(Ecore_Win32_Window *window, unsigned int base_width, unsigned int base_height) { - Ecore_Win32_Window *w; - printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height); if (!window) return; - w = (Ecore_Win32_Window *)window; - w->base_width = base_width; - w->base_height = base_height; + window->base_width = base_width; + window->base_height = base_height; } /** @@ -729,14 +702,11 @@ ecore_win32_window_size_base_get(Ecore_Win32_Window *window, unsigned int *base_width, unsigned int *base_height) { - Ecore_Win32_Window *w; - if (!window) return; - w = (Ecore_Win32_Window *)window; - printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, w->base_width, w->base_height); - if (base_width) *base_width = w->base_width; - if (base_height) *base_height = w->base_height; + printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, window->base_width, window->base_height); + if (base_width) *base_width = window->base_width; + if (base_height) *base_height = window->base_height; } /** @@ -755,14 +725,11 @@ ecore_win32_window_size_step_set(Ecore_Win32_Window *window, unsigned int step_width, unsigned int step_height) { - Ecore_Win32_Window *w; - printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height); if (!window) return; - w = (Ecore_Win32_Window *)window; - w->step_width = step_width; - w->step_height = step_height; + window->step_width = step_width; + window->step_height = step_height; } /** @@ -781,14 +748,11 @@ ecore_win32_window_size_step_get(Ecore_Win32_Window *window, unsigned int *step_width, unsigned int *step_height) { - Ecore_Win32_Window *w; - if (!window) return; - w = (Ecore_Win32_Window *)window; - printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, w->step_width, w->step_height); - if (step_width) *step_width = w->step_width; - if (step_height) *step_height = w->step_height; + printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, window->step_width, window->step_height); + if (step_width) *step_width = window->step_width; + if (step_height) *step_height = window->step_height; } EAPI void @@ -797,33 +761,30 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, unsigned short height, unsigned char *mask) { - Ecore_Win32_Window *wnd; - HRGN rgn; - int x; - int y; - OSVERSIONINFO version_info; + HRGN rgn; + int x; + int y; + OSVERSIONINFO version_info; if (!window) return; - wnd = (Ecore_Win32_Window *)window; - if (!mask) { - wnd->shape.enabled = 0; - if (wnd->shape.layered != 0) + window->shape.enabled = 0; + if (window->shape.layered != 0) { - wnd->shape.layered = 0; + window->shape.layered = 0; #if defined(WS_EX_LAYERED) SetLastError(0); - if (!SetWindowLongPtr(wnd->window, GWL_EXSTYLE, - GetWindowLong(wnd->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, + GetWindowLong(window->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } - if (!RedrawWindow(wnd->window, NULL, NULL, + if (!RedrawWindow(window->window, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN)) { ERR("RedrawWindow() failed"); @@ -832,7 +793,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, #endif } else - if (!SetWindowRgn(wnd->window, NULL, TRUE)) + if (!SetWindowRgn(window->window, NULL, TRUE)) { ERR("SetWindowRgn() failed"); } @@ -842,36 +803,36 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, if (width == 0 || height == 0) return; - wnd->shape.enabled = 1; + window->shape.enabled = 1; - if (width != wnd->shape.width || height != wnd->shape.height) + if (width != window->shape.width || height != window->shape.height) { - wnd->shape.width = width; - wnd->shape.height = height; - if (wnd->shape.mask) + window->shape.width = width; + window->shape.height = height; + if (window->shape.mask) { - free(wnd->shape.mask); - wnd->shape.mask = NULL; + free(window->shape.mask); + window->shape.mask = NULL; } - wnd->shape.mask = malloc(width * height); + window->shape.mask = malloc(width * height); } - memcpy(wnd->shape.mask, mask, width * height); + memcpy(window->shape.mask, mask, width * height); - wnd->shape.layered = 0; + window->shape.layered = 0; #if defined(WS_EX_LAYERED) version_info.dwOSVersionInfoSize = sizeof(version_info); if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5) { SetLastError(0); - if (!SetWindowLongPtr(wnd->window, GWL_EXSTYLE, - GetWindowLong(wnd->window, GWL_EXSTYLE) | WS_EX_LAYERED) && + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, + GetWindowLong(window->window, GWL_EXSTYLE) | WS_EX_LAYERED) && (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } - wnd->shape.layered = 1; + window->shape.layered = 1; return; } #endif @@ -922,7 +883,7 @@ ecore_win32_window_shape_set(Ecore_Win32_Window *window, return; } } - if (!SetWindowRgn(wnd->window, rgn, TRUE)) + if (!SetWindowRgn(window->window, rgn, TRUE)) { ERR("SetWindowRgn() failed"); } @@ -943,8 +904,8 @@ ecore_win32_window_show(Ecore_Win32_Window *window) INF("showing window"); - ShowWindow(((Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL); - if (!UpdateWindow(((Ecore_Win32_Window *)window)->window)) + ShowWindow(window->window, SW_SHOWNORMAL); + if (!UpdateWindow(window->window)) { ERR("UpdateWindow() failed"); } @@ -966,7 +927,7 @@ ecore_win32_window_hide(Ecore_Win32_Window *window) INF("hiding window"); - ShowWindow(((Ecore_Win32_Window *)window)->window, SW_HIDE); + ShowWindow(window->window, SW_HIDE); } /** @@ -984,7 +945,7 @@ ecore_win32_window_raise(Ecore_Win32_Window *window) INF("raising window"); - if (!SetWindowPos(((Ecore_Win32_Window *)window)->window, + if (!SetWindowPos(window->window, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)) { @@ -1007,7 +968,7 @@ ecore_win32_window_lower(Ecore_Win32_Window *window) INF("lowering window"); - if (!SetWindowPos(((Ecore_Win32_Window *)window)->window, + if (!SetWindowPos(window->window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)) { @@ -1035,7 +996,7 @@ ecore_win32_window_title_set(Ecore_Win32_Window *window, INF("setting window title"); - if (!SetWindowText(((Ecore_Win32_Window *)window)->window, title)) + if (!SetWindowText(window->window, title)) { ERR("SetWindowText() failed"); } @@ -1056,7 +1017,7 @@ ecore_win32_window_focus_set(Ecore_Win32_Window *window) INF("focusing window"); - if (!SetFocus(((Ecore_Win32_Window *)window)->window)) + if (!SetFocus(window->window)) { ERR("SetFocus() failed"); } @@ -1078,19 +1039,16 @@ EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window, Eina_Bool on) { - Ecore_Win32_Window *ew; - if (!window) return; - ew = (Ecore_Win32_Window *)window; - if (((ew->iconified) && (on)) || - ((!ew->iconified) && (!on))) + if (((window->iconified) && (on)) || + ((!window->iconified) && (!on))) return; INF("iconifying window: %s", on ? "yes" : "no"); - ShowWindow(ew->window, on ? SW_MINIMIZE : SW_RESTORE); - ew->iconified = on; + ShowWindow(window->window, on ? SW_MINIMIZE : SW_RESTORE); + window->iconified = on; } /** @@ -1111,30 +1069,26 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, { RECT rect; DWORD style; - Ecore_Win32_Window *ew; - HWND w; if (!window) return; - ew = (Ecore_Win32_Window *)window; - if (((ew->borderless) && (on)) || - ((!ew->borderless) && (!on))) + if (((window->borderless) && (on)) || + ((!window->borderless) && (!on))) return; INF("setting window without border: %s", on ? "yes" : "no"); - w = ew->window; - - style = GetWindowLong(w, GWL_STYLE); + style = GetWindowLong(window->window, GWL_STYLE); if (on) { - if (!GetClientRect(w, &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); return; } SetLastError(0); - if (!SetWindowLongPtr(w, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) && (GetLastError() != 0)) + if (!SetWindowLongPtr(window->window, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; @@ -1142,7 +1096,7 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, } else { - if (!GetWindowRect(w, &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); return; @@ -1154,13 +1108,14 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, return; } SetLastError(0); - if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0)) + if (!SetWindowLongPtr(window->window, GWL_STYLE, style) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } } - if (!SetWindowPos(w, HWND_TOPMOST, + if (!SetWindowPos(window->window, HWND_TOPMOST, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_FRAMECHANGED)) @@ -1168,7 +1123,8 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window, ERR("SetWindowPos() failed"); return; } - ew->borderless = on; + + window->borderless = on; } /** @@ -1187,51 +1143,49 @@ EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, Eina_Bool on) { - Ecore_Win32_Window *ew; - HWND w; - if (!window) return; - ew = (Ecore_Win32_Window *)window; - if (((ew->fullscreen) && (on)) || - ((!ew->fullscreen) && (!on))) + if (((window->fullscreen) && (on)) || + ((!window->fullscreen) && (!on))) return; INF("setting fullscreen: %s", on ? "yes" : "no"); - ew->fullscreen = !!on; - w = ew->window; + window->fullscreen = !!on; if (on) { DWORD style; - if (!GetWindowRect(w, &ew->rect)) + if (!GetWindowRect(window->window, &window->rect)) { ERR("GetWindowRect() failed"); return; } - if (!(ew->style = GetWindowLong(w, GWL_STYLE))) + if (!(window->style = GetWindowLong(window->window, GWL_STYLE))) { ERR("GetWindowLong() failed"); return; } - style = ew->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX; + style = window->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX; style |= WS_VISIBLE | WS_POPUP; SetLastError(0); - if (!SetWindowLongPtr(w, GWL_STYLE, style) && (GetLastError() != 0)) + if (!SetWindowLongPtr(window->window, GWL_STYLE, style) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } SetLastError(0); - if (!SetWindowLongPtr(w, GWL_EXSTYLE, WS_EX_TOPMOST) && (GetLastError() != 0)) + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, WS_EX_TOPMOST) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } - if (!SetWindowPos(w, HWND_TOPMOST, 0, 0, - GetSystemMetrics (SM_CXSCREEN), GetSystemMetrics (SM_CYSCREEN), + if (!SetWindowPos(window->window, HWND_TOPMOST, 0, 0, + GetSystemMetrics (SM_CXSCREEN), + GetSystemMetrics (SM_CYSCREEN), SWP_NOCOPYBITS | SWP_SHOWWINDOW)) { ERR("SetWindowPos() failed"); @@ -1241,22 +1195,24 @@ ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, else { SetLastError(0); - if (!SetWindowLongPtr(w, GWL_STYLE, ew->style) && (GetLastError() != 0)) + if (!SetWindowLongPtr(window->window, GWL_STYLE, window->style) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } SetLastError(0); - if (!SetWindowLongPtr(w, GWL_EXSTYLE, 0) && (GetLastError() != 0)) + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, 0) && + (GetLastError() != 0)) { ERR("SetWindowLongPtr() failed"); return; } - if (!SetWindowPos(w, HWND_NOTOPMOST, - ew->rect.left, - ew->rect.top, - ew->rect.right - ew->rect.left, - ew->rect.bottom - ew->rect.top, + if (!SetWindowPos(window->window, HWND_NOTOPMOST, + window->rect.left, + window->rect.top, + window->rect.right - window->rect.left, + window->rect.bottom - window->rect.top, SWP_NOCOPYBITS | SWP_SHOWWINDOW)) { ERR("SetWindowPos() failed"); @@ -1285,8 +1241,8 @@ ecore_win32_window_cursor_set(Ecore_Win32_Window *window, if (!window || !cursor) return; - if (!SetClassLongPtr(((Ecore_Win32_Window *)window)->window, - GCL_HCURSOR, (LONG_PTR)cursor)) + if (!SetClassLongPtr(window->window, + GCLP_HCURSOR, (LONG_PTR)cursor)) { ERR("SetClassLong() failed"); } @@ -1320,41 +1276,41 @@ ecore_win32_window_state_set(Ecore_Win32_Window *window, switch (state[i]) { case ECORE_WIN32_WINDOW_STATE_ICONIFIED: - ((Ecore_Win32_Window *)window)->state.iconified = 1; + window->state.iconified = 1; break; case ECORE_WIN32_WINDOW_STATE_MODAL: - ((Ecore_Win32_Window *)window)->state.modal = 1; + window->state.modal = 1; break; case ECORE_WIN32_WINDOW_STATE_STICKY: - ((Ecore_Win32_Window *)window)->state.sticky = 1; + window->state.sticky = 1; break; case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT: - ((Ecore_Win32_Window *)window)->state.maximized_vert = 1; + window->state.maximized_vert = 1; break; case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ: - ((Ecore_Win32_Window *)window)->state.maximized_horz = 1; + window->state.maximized_horz = 1; break; case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: - ((Ecore_Win32_Window *)window)->state.maximized_horz = 1; - ((Ecore_Win32_Window *)window)->state.maximized_vert = 1; + window->state.maximized_horz = 1; + window->state.maximized_vert = 1; break; case ECORE_WIN32_WINDOW_STATE_SHADED: - ((Ecore_Win32_Window *)window)->state.shaded = 1; + window->state.shaded = 1; break; case ECORE_WIN32_WINDOW_STATE_HIDDEN: - ((Ecore_Win32_Window *)window)->state.hidden = 1; + window->state.hidden = 1; break; case ECORE_WIN32_WINDOW_STATE_FULLSCREEN: - ((Ecore_Win32_Window *)window)->state.fullscreen = 1; + window->state.fullscreen = 1; break; case ECORE_WIN32_WINDOW_STATE_ABOVE: - ((Ecore_Win32_Window *)window)->state.above = 1; + window->state.above = 1; break; case ECORE_WIN32_WINDOW_STATE_BELOW: - ((Ecore_Win32_Window *)window)->state.below = 1; + window->state.below = 1; break; case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: - ((Ecore_Win32_Window *)window)->state.demands_attention = 1; + window->state.demands_attention = 1; break; case ECORE_WIN32_WINDOW_STATE_UNKNOWN: /* nothing to be done */ @@ -1381,30 +1337,24 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, Ecore_Win32_Window_State state, unsigned int set) { - Ecore_Win32_Window *ew; - HWND w; - if (!window) return; - ew = (Ecore_Win32_Window *)window; - w = ew->window; - INF("sending cursor state"); switch (state) { case ECORE_WIN32_WINDOW_STATE_ICONIFIED: - if (ew->state.iconified) + if (window->state.iconified) ecore_win32_window_iconified_set(window, set); break; case ECORE_WIN32_WINDOW_STATE_MODAL: - ew->state.modal = 1; + window->state.modal = 1; break; case ECORE_WIN32_WINDOW_STATE_STICKY: - ew->state.sticky = 1; + window->state.sticky = 1; break; case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT: - if (ew->state.maximized_vert) + if (window->state.maximized_vert) { RECT rect; int y; @@ -1419,13 +1369,13 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, y = rect.top; height = rect.bottom - rect.top; - if (!GetClientRect(w, &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); break; } - if (!MoveWindow(w, rect.left, y, + if (!MoveWindow(window->window, rect.left, y, rect.right - rect.left, height, TRUE)) @@ -1435,17 +1385,17 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, } break; case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ: - if (ew->state.maximized_horz) + if (window->state.maximized_horz) { RECT rect; - if (!GetClientRect(w, &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); break; } - if (!MoveWindow(w, 0, rect.top, + if (!MoveWindow(window->window, 0, rect.top, GetSystemMetrics(SM_CXSCREEN), rect.bottom - rect.top, TRUE)) @@ -1455,7 +1405,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, } break; case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: - if (ew->state.maximized_vert && ew->state.maximized_horz) + if (window->state.maximized_vert && window->state.maximized_horz) { RECT rect; @@ -1466,7 +1416,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, break; } - if (!MoveWindow(w, 0, 0, + if (!MoveWindow(window->window, 0, 0, GetSystemMetrics(SM_CXSCREEN), rect.bottom - rect.top, TRUE)) @@ -1476,18 +1426,18 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, } break; case ECORE_WIN32_WINDOW_STATE_SHADED: - ew->state.shaded = 1; + window->state.shaded = 1; break; case ECORE_WIN32_WINDOW_STATE_HIDDEN: - ew->state.hidden = 1; + window->state.hidden = 1; break; case ECORE_WIN32_WINDOW_STATE_FULLSCREEN: - if (ew->state.fullscreen) + if (window->state.fullscreen) ecore_win32_window_fullscreen_set(window, set); break; case ECORE_WIN32_WINDOW_STATE_ABOVE: - if (ew->state.above) - if (!SetWindowPos(w, HWND_TOP, + if (window->state.above) + if (!SetWindowPos(window->window, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) @@ -1496,8 +1446,8 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, } break; case ECORE_WIN32_WINDOW_STATE_BELOW: - if (ew->state.below) - if (!SetWindowPos(w, HWND_BOTTOM, + if (window->state.below) + if (!SetWindowPos(window->window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) @@ -1506,7 +1456,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, } break; case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: - ew->state.demands_attention = 1; + window->state.demands_attention = 1; break; case ECORE_WIN32_WINDOW_STATE_UNKNOWN: /* nothing to be done */ @@ -1518,7 +1468,7 @@ ecore_win32_window_state_request_send(Ecore_Win32_Window *window, * @brief Set the type of the given window. * * @param window The window to modify the type. - * @param type The new types. + * @param type The nwindow types. * * This function set the type of @p window to @p type. If * @p window is @c NULL, the function does nothing. @@ -1535,31 +1485,31 @@ ecore_win32_window_type_set(Ecore_Win32_Window *window, switch (type) { case ECORE_WIN32_WINDOW_TYPE_DESKTOP: - ((Ecore_Win32_Window *)window)->type.desktop = 1; + window->type.desktop = 1; break; case ECORE_WIN32_WINDOW_TYPE_DOCK: - ((Ecore_Win32_Window *)window)->type.dock = 1; + window->type.dock = 1; break; case ECORE_WIN32_WINDOW_TYPE_TOOLBAR: - ((Ecore_Win32_Window *)window)->type.toolbar = 1; + window->type.toolbar = 1; break; case ECORE_WIN32_WINDOW_TYPE_MENU: - ((Ecore_Win32_Window *)window)->type.menu = 1; + window->type.menu = 1; break; case ECORE_WIN32_WINDOW_TYPE_UTILITY: - ((Ecore_Win32_Window *)window)->type.utility = 1; + window->type.utility = 1; break; case ECORE_WIN32_WINDOW_TYPE_SPLASH: - ((Ecore_Win32_Window *)window)->type.splash = 1; + window->type.splash = 1; break; case ECORE_WIN32_WINDOW_TYPE_DIALOG: - ((Ecore_Win32_Window *)window)->type.dialog = 1; + window->type.dialog = 1; break; case ECORE_WIN32_WINDOW_TYPE_NORMAL: - ((Ecore_Win32_Window *)window)->type.normal = 1; + window->type.normal = 1; break; case ECORE_WIN32_WINDOW_TYPE_UNKNOWN: - ((Ecore_Win32_Window *)window)->type.normal = 1; + window->type.normal = 1; break; } } diff --git a/src/lib/ecore_wince/.cvsignore b/src/lib/ecore_wince/.cvsignore deleted file mode 100644 index 584f554..0000000 --- a/src/lib/ecore_wince/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.libs -.deps -Makefile -Makefile.in diff --git a/src/lib/ecore_wince/Ecore_WinCE.h b/src/lib/ecore_wince/Ecore_WinCE.h index 027c4b4..681b334 100644 --- a/src/lib/ecore_wince/Ecore_WinCE.h +++ b/src/lib/ecore_wince/Ecore_WinCE.h @@ -127,7 +127,7 @@ struct _Ecore_WinCE_Event_Mouse_In Ecore_WinCE_Window *window; /**< The window that received the event */ int x; /**< The x coordinate where the mouse entered */ int y; /**< The y coordinate where the mouse entered */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -139,7 +139,7 @@ struct _Ecore_WinCE_Event_Mouse_Out Ecore_WinCE_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 occured */ + long time; /**< The time the event occurred */ }; /** @@ -149,7 +149,7 @@ struct _Ecore_WinCE_Event_Mouse_Out struct _Ecore_WinCE_Event_Window_Focus_In { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -159,7 +159,7 @@ struct _Ecore_WinCE_Event_Window_Focus_In struct _Ecore_WinCE_Event_Window_Focus_Out { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -173,7 +173,7 @@ struct _Ecore_WinCE_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 height of the damaged region */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -183,7 +183,7 @@ struct _Ecore_WinCE_Event_Window_Damage struct _Ecore_WinCE_Event_Window_Create { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -193,7 +193,7 @@ struct _Ecore_WinCE_Event_Window_Create struct _Ecore_WinCE_Event_Window_Destroy { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -203,7 +203,7 @@ struct _Ecore_WinCE_Event_Window_Destroy struct _Ecore_WinCE_Event_Window_Hide { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -213,7 +213,7 @@ struct _Ecore_WinCE_Event_Window_Hide struct _Ecore_WinCE_Event_Window_Show { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; /** @@ -223,7 +223,7 @@ struct _Ecore_WinCE_Event_Window_Show struct _Ecore_WinCE_Event_Window_Delete_Request { Ecore_WinCE_Window *window; /**< The window that received the event */ - long time; /**< The time the event occured */ + long time; /**< The time the event occurred */ }; diff --git a/src/lib/ecore_wince/ecore_wince_window.c b/src/lib/ecore_wince/ecore_wince_window.c index 747667d..4e8b7b1 100644 --- a/src/lib/ecore_wince/ecore_wince_window.c +++ b/src/lib/ecore_wince/ecore_wince_window.c @@ -177,7 +177,7 @@ ecore_wince_window_free(Ecore_WinCE_Window *window) INF("destroying window"); - DestroyWindow(((Ecore_WinCE_Window *)window)->window); + DestroyWindow(window->window); free(window); } @@ -195,7 +195,7 @@ ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window) if (!window) return NULL; - return ((Ecore_WinCE_Window *)window)->window; + return window->window; } /** @@ -215,21 +215,19 @@ ecore_wince_window_move(Ecore_WinCE_Window *window, int y) { RECT rect; - HWND w; - if (!window || ((Ecore_WinCE_Window *)window)->fullscreen) + if (!window || window->fullscreen) return; INF("moving window (%dx%d)", x, y); - w = ((Ecore_WinCE_Window *)window)->window; - if (!GetWindowRect(w, &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); return; } - if (!MoveWindow(w, x, y, + if (!MoveWindow(window->window, x, y, rect.right - rect.left, rect.bottom - rect.top, TRUE)) @@ -254,20 +252,18 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window, int width, int height) { - RECT rect; - Ecore_WinCE_Window *w; - DWORD style; - DWORD exstyle; - int x; - int y; + RECT rect; + DWORD style; + DWORD exstyle; + int x; + int y; - if (!window || ((Ecore_WinCE_Window *)window)->fullscreen) + if (!window || window->fullscreen) return; INF("resizing window (%dx%d)", width, height); - w = (Ecore_WinCE_Window *)window; - if (!GetWindowRect(w->window, &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); return; @@ -279,12 +275,12 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window, rect.top = 0; rect.right = width; rect.bottom = height; - if (!(style = GetWindowLong(w->window, GWL_STYLE))) + if (!(style = GetWindowLong(window->window, GWL_STYLE))) { ERR("GetWindowLong() failed"); return; } - if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE))) + if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE))) { ERR("GetWindowLong() failed"); return; @@ -295,7 +291,7 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window, return; } - if (!MoveWindow(w->window, x, y, + if (!MoveWindow(window->window, x, y, rect.right - rect.left, rect.bottom - rect.top, FALSE)) @@ -325,26 +321,24 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window, int height) { RECT rect; - Ecore_WinCE_Window *w; DWORD style; DWORD exstyle; - if (!window || ((Ecore_WinCE_Window *)window)->fullscreen) + if (!window || window->fullscreen) return; INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); - w = ((Ecore_WinCE_Window *)window); rect.left = 0; rect.top = 0; rect.right = width; rect.bottom = height; - if (!(style = GetWindowLong(w->window, GWL_STYLE))) + if (!(style = GetWindowLong(window->window, GWL_STYLE))) { ERR("GetWindowLong() failed"); return; } - if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE))) + if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE))) { ERR("GetWindowLong() failed"); return; @@ -355,10 +349,10 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window, return; } - if (!MoveWindow(w->window, x, y, - rect.right - rect.left, - rect.bottom - rect.top, - TRUE)) + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + TRUE)) { ERR("MoveWindow() failed"); } @@ -379,16 +373,16 @@ ecore_wince_window_show(Ecore_WinCE_Window *window) INF("showing window"); - if (!ShowWindow(((Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL)) + if (!ShowWindow(window->window, SW_SHOWNORMAL)) { ERR("ShowWindow() failed"); return; } - if (!UpdateWindow(((Ecore_WinCE_Window *)window)->window)) + if (!UpdateWindow(window->window)) { ERR("UpdateWindow() failed"); } - if (!SendMessage(((Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 1, 0)) + if (!SendMessage(window->window, WM_SHOWWINDOW, 1, 0)) { ERR("SendMessage() failed"); } @@ -409,12 +403,12 @@ ecore_wince_window_hide(Ecore_WinCE_Window *window) INF("hiding window"); - if (!ShowWindow(((Ecore_WinCE_Window *)window)->window, SW_HIDE)) + if (!ShowWindow(window->window, SW_HIDE)) { ERR("ShowWindow() failed"); return; } - if (!SendMessage(((Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0)) + if (!SendMessage(window->window, WM_SHOWWINDOW, 0, 0)) { ERR("SendMessage() failed"); } @@ -445,7 +439,7 @@ ecore_wince_window_title_set(Ecore_WinCE_Window *window, wtitle = evil_char_to_wchar(title); if (!wtitle) return; - if (!SetWindowText(((Ecore_WinCE_Window *)window)->window, wtitle)) + if (!SetWindowText(window->window, wtitle)) { ERR("SetWindowText() failed"); } @@ -477,15 +471,12 @@ EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend) { - Ecore_WinCE_Window *w; - if (!window) return; INF("setting backend"); - w = (Ecore_WinCE_Window *)window; - w->backend = backend; + window->backend = backend; } /** @@ -503,15 +494,12 @@ ecore_wince_window_backend_set(Ecore_WinCE_Window *window, EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int)) { - Ecore_WinCE_Window *w; - if (!window) return; INF("setting suspend callback"); - w = (Ecore_WinCE_Window *)window; - w->suspend_cb = suspend_cb; + window->suspend_cb = suspend_cb; } /** @@ -529,15 +517,12 @@ ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)( EAPI void ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int)) { - Ecore_WinCE_Window *w; - if (!window) return; INF("setting resume callback"); - w = (Ecore_WinCE_Window *)window; - w->resume_cb = resume_cb; + window->resume_cb = resume_cb; } /** @@ -579,8 +564,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window, return; } - if (!GetClientRect(((Ecore_WinCE_Window *)window)->window, - &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); @@ -595,8 +579,7 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window, w = rect.right - rect.left; h = rect.bottom - rect.top; - if (!GetWindowRect(((Ecore_WinCE_Window *)window)->window, - &rect)) + if (!GetWindowRect(window->window, &rect)) { ERR("GetWindowRect() failed"); @@ -645,8 +628,7 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window, return; } - if (!GetClientRect(((Ecore_WinCE_Window *)window)->window, - &rect)) + if (!GetClientRect(window->window, &rect)) { ERR("GetClientRect() failed"); @@ -674,26 +656,22 @@ EAPI void ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, Eina_Bool on) { - Ecore_WinCE_Window *ew; - HWND w; - HWND task_bar; + HWND task_bar; if (!window) return; - ew = (Ecore_WinCE_Window *)window; - if (((ew->fullscreen) && (on)) || - ((!ew->fullscreen) && (!on))) + if (((window->fullscreen) && (on)) || + ((!window->fullscreen) && (!on))) return; INF("setting fullscreen: %s", on ? "yes" : "no"); - ew->fullscreen = !!on; - w = ew->window; + window->fullscreen = !!on; if (on) { /* save the position and size of the window */ - if (!GetWindowRect(w, &ew->rect)) + if (!GetWindowRect(window->window, &window->rect)) { ERR("GetWindowRect() failed"); return; @@ -715,15 +693,16 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, } /* style: visible + popup */ - if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE)) + if (!SetWindowLong(window->window, GWL_STYLE, WS_POPUP | WS_VISIBLE)) { INF("SetWindowLong() failed"); } /* resize window to fit the entire screen */ - if (!SetWindowPos(w, HWND_TOPMOST, + if (!SetWindowPos(window->window, HWND_TOPMOST, 0, 0, - GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) { INF("SetWindowPos() failed"); @@ -733,9 +712,10 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, * Call MoveWindow with the correct size and force painting. * Note that UpdateWindow (forcing repainting) is not sufficient */ - if (!MoveWindow(w, + if (!MoveWindow(window->window, 0, 0, - GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), TRUE)) { INF("MoveWindow() failed"); @@ -759,16 +739,16 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, } /* style: visible + caption + sysmenu */ - if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) + if (!SetWindowLong(window->window, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) { INF("SetWindowLong() failed"); } /* restaure the position and size of the window */ - if (!SetWindowPos(w, HWND_TOPMOST, - ew->rect.left, - ew->rect.top, - ew->rect.right - ew->rect.left, - ew->rect.bottom - ew->rect.top, + if (!SetWindowPos(window->window, HWND_TOPMOST, + window->rect.left, + window->rect.top, + window->rect.right - window->rect.left, + window->rect.bottom - window->rect.top, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) { INF("SetWindowLong() failed"); @@ -778,11 +758,11 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, * Call MoveWindow with the correct size and force painting. * Note that UpdateWindow (forcing repainting) is not sufficient */ - if (!MoveWindow(w, - ew->rect.left, - ew->rect.top, - ew->rect.right - ew->rect.left, - ew->rect.bottom - ew->rect.top, + if (!MoveWindow(window->window, + window->rect.left, + window->rect.top, + window->rect.right - window->rect.left, + window->rect.bottom - window->rect.top, TRUE)) { INF("MoveWindow() failed"); diff --git a/src/lib/ecore_x/.cvsignore b/src/lib/ecore_x/.cvsignore deleted file mode 100644 index 8728e80..0000000 --- a/src/lib/ecore_x/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore_x.la diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index e4eddbb..777041f 100755 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -207,6 +207,35 @@ typedef enum _Ecore_X_Render_Subpixel_Order { ECORE_X_RENDER_SUBPIXEL_ORDER_NONE = 5 } Ecore_X_Render_Subpixel_Order; +typedef enum _Ecore_X_Randr_Edid_Display_Interface_Type { + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_UNDEFINED, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DVI, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_A, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_B, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_MDDI, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT +} Ecore_X_Randr_Edid_Display_Interface_Type; + +typedef enum _Ecore_X_Randr_Edid_Display_Colorscheme { + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_MONOCHROME_GRAYSCALE = 0x00, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB = 0x08, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_NON_RGB = 0x10, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_UNDEFINED = 0x18, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4 = 0x444000, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4 = 0x444, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2 = 0x422 +} Ecore_X_Randr_Edid_Display_Colorscheme; + +typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio { + ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3 = 0x0, + ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9 = 0x1, + ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10 = 0x2, + ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4 = 0x4, + ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9 = 0x8 +} Ecore_X_Randr_Edid_Aspect_Ratio; + +#define ECORE_X_RANDR_EDID_UNKNOWN_VALUE -1 + #define ECORE_X_SELECTION_TARGET_TARGETS "TARGETS" #define ECORE_X_SELECTION_TARGET_TEXT "TEXT" #define ECORE_X_SELECTION_TARGET_COMPOUND_TEXT "COMPOUND_TEXT" @@ -216,12 +245,6 @@ typedef enum _Ecore_X_Render_Subpixel_Order { #define ECORE_X_DND_VERSION 5 -EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_COPY; -EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_MOVE; -EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_LINK; -EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_ASK; -EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE; - typedef enum _Ecore_X_Selection { ECORE_X_SELECTION_PRIMARY, ECORE_X_SELECTION_SECONDARY, @@ -1113,6 +1136,7 @@ EAPI Ecore_X_Display * ecore_x_display_get(void); EAPI Ecore_X_Connection * ecore_x_connection_get(void); EAPI int ecore_x_fd_get(void); EAPI Ecore_X_Screen * ecore_x_default_screen_get(void); +EAPI void ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h); EAPI void ecore_x_double_click_time_set(double t); EAPI double ecore_x_double_click_time_get(void); EAPI void ecore_x_flush(void); @@ -2685,6 +2709,10 @@ EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get( Ecore_X_Window root, int *num); EAPI Ecore_X_Randr_Output * + ecore_x_randr_window_outputs_get( + Ecore_X_Window window, + int *num); +EINA_DEPRECATED EAPI Ecore_X_Randr_Output * ecore_x_randr_current_output_get( Ecore_X_Window window, int *num); @@ -2816,6 +2844,225 @@ ecore_x_randr_output_crtc_set(Ecore_X_Window root, Ecore_X_Randr_Output output, const Ecore_X_Randr_Crtc crtc); +/* ecore_x_randr_12_edid.c */ + +/* + * @brief Validates the header from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if the header is valid. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_valid_header(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Checks whether a display's EDID has a valid checksum. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if the checksum is valid. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded version from raw EDID data. + * + * The return value has the minor version in the lowest 8 bits, and the major + * version in all the rest of the bits. i.e. + * + * minor = (version & 0x000000ff); + * major = (version & 0xffffff00) >> 8; + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded major and minor version encasuplated an int. + */ +EAPI int +ecore_x_randr_edid_version_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded manufacturer from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded manufacturer identifier. + */ +EAPI char * +ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded name from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded manufacturer identifier. + */ +EAPI char * +ecore_x_randr_edid_display_name_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded ASCII from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded ASCII display identifier. + */ +EAPI char * +ecore_x_randr_edid_display_ascii_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded serial identifier from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded serial identifier. + */ +EAPI char * +ecore_x_randr_edid_display_serial_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded model number from raw EDID data. + * + * The manufacturer ID table is necessary for a useful description. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded model number. + */ +EAPI int +ecore_x_randr_edid_model_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the manufacturer serial number from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded serial manufacturer serial number. + */ +EAPI int +ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the manufacturer model number from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The manufacturer's model number. + */ +EAPI int +ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS is supported in some way. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS Standby support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS Standby is supported. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS Suspend support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS Suspend is supported. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS Off support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS Off is supported. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the preferred aspect ratio from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The preferred aspect ratio. + */ +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the supported aspect ratios from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The supported aspect ratios. + */ +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the supported colorschemes from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The supported colorschemes. + */ +EAPI Ecore_X_Randr_Edid_Display_Colorscheme +ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the display type from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if the display is a digital one. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the display interface type from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The interface type. + */ +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 */ EAPI void ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, double level); @@ -3087,6 +3334,8 @@ EAPI Eina_Bool ecore_x_image_to_argb_convert(void *src, int sbpp, EAPI Eina_Bool ecore_x_input_multi_select(Ecore_X_Window win); +EAPI Eina_Bool ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win); + #ifdef __cplusplus } #endif // ifdef __cplusplus diff --git a/src/lib/ecore_x/xcb/.cvsignore b/src/lib/ecore_x/xcb/.cvsignore deleted file mode 100644 index 5fba3e8..0000000 --- a/src/lib/ecore_x/xcb/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore_x_xcb.la diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index a0519f8..c74e54c 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -784,6 +784,28 @@ ecore_x_default_screen_get(void) } /* ecore_x_default_screen_get */ /** + * Retrieves the size of an Ecore_X_Screen. + * @param screen the handle to the screen to query. + * @param w where to return the width. May be NULL. Returns 0 on errors. + * @param h where to return the height. May be NULL. Returns 0 on errors. + * @ingroup Ecore_X_Display_Attr_Group + * @see ecore_x_default_screen_get() + * + * @since 1.1 + */ +EAPI void +ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h) +{ + xcb_screen_t *s = (xcb_screen_t *)screen; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (w) *w = 0; + if (h) *h = 0; + if (!s) return; + if (w) *w = s->width_in_pixels; + if (h) *h = s->height_in_pixels; +} + +/** * Sets the timeout for a double and triple clicks to be flagged. * * This sets the time between clicks before the double_click flag is diff --git a/src/lib/ecore_x/xlib/.cvsignore b/src/lib/ecore_x/xlib/.cvsignore deleted file mode 100644 index 39b336e..0000000 --- a/src/lib/ecore_x/xlib/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -libecore_x_xlib.la diff --git a/src/lib/ecore_x/xlib/Makefile.am b/src/lib/ecore_x/xlib/Makefile.am index c75f4a5..1668c34 100644 --- a/src/lib/ecore_x/xlib/Makefile.am +++ b/src/lib/ecore_x/xlib/Makefile.am @@ -36,6 +36,7 @@ ecore_x_sync.c \ ecore_x_randr.c \ ecore_x_randr_11.c \ ecore_x_randr_12.c \ +ecore_x_randr_12_edid.c \ ecore_x_randr_13.c \ ecore_x_fixes.c \ ecore_x_damage.c \ @@ -62,6 +63,7 @@ ecore_x_atoms.c \ ecore_x_region.c \ ecore_x_image.c \ ecore_x_xi2.c \ +ecore_x_vsync.c \ ecore_x_randr.h libecore_x_xlib_la_LIBADD = \ @@ -81,7 +83,8 @@ libecore_x_xlib_la_LIBADD = \ @x_libs@ \ $(top_builddir)/src/lib/ecore/libecore.la \ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ -@EINA_LIBS@ +@EINA_LIBS@ \ +@dlopen_libs@ endif diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index dc3f0cf..066306c 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -744,7 +744,7 @@ ecore_x_fd_get(void) /** * Retrieves the Ecore_X_Screen handle used for the current X connection. * @return The current default screen. - * @ingroup Ecore_Xcb_Display_Attr_Group + * @ingroup Ecore_X_Display_Attr_Group */ EAPI Ecore_X_Screen * ecore_x_default_screen_get(void) @@ -754,6 +754,28 @@ ecore_x_default_screen_get(void) } /* ecore_x_default_screen_get */ /** + * Retrieves the size of an Ecore_X_Screen. + * @param screen the handle to the screen to query. + * @param w where to return the width. May be NULL. Returns 0 on errors. + * @param h where to return the height. May be NULL. Returns 0 on errors. + * @ingroup Ecore_X_Display_Attr_Group + * @see ecore_x_default_screen_get() + * + * @since 1.1 + */ +EAPI void +ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h) +{ + Screen *s = (Screen *)screen; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (w) *w = 0; + if (h) *h = 0; + if (!s) return; + if (w) *w = s->width; + if (h) *h = s->height; +} + +/** * Sets the timeout for a double and triple clicks to be flagged. * * This sets the time between clicks before the double_click flag is @@ -1518,7 +1540,7 @@ _ecore_x_window_grab_remove(Ecore_X_Window win) { int i, shuffle = 0; Window *t; - + if (_ecore_window_grabs_num > 0) { for (i = 0; i < _ecore_window_grabs_num; i++) @@ -1635,7 +1657,7 @@ _ecore_x_key_grab_remove(Ecore_X_Window win) { int i, shuffle = 0; Window *t; - + if (_ecore_key_grabs_num > 0) { for (i = 0; i < _ecore_key_grabs_num; i++) diff --git a/src/lib/ecore_x/xlib/ecore_x_composite.c b/src/lib/ecore_x/xlib/ecore_x_composite.c index 309ee3f..3e3d951 100755 --- a/src/lib/ecore_x/xlib/ecore_x_composite.c +++ b/src/lib/ecore_x/xlib/ecore_x_composite.c @@ -27,7 +27,7 @@ _ecore_x_composite_init(void) } # endif } -# endif +# endif } #endif } /* _ecore_x_composite_init */ diff --git a/src/lib/ecore_x/xlib/ecore_x_dnd.c b/src/lib/ecore_x/xlib/ecore_x_dnd.c index 0f1d8bb..f1e0d43 100644 --- a/src/lib/ecore_x/xlib/ecore_x_dnd.c +++ b/src/lib/ecore_x/xlib/ecore_x_dnd.c @@ -555,7 +555,7 @@ ecore_x_dnd_send_finished(void) _target->state = ECORE_X_DND_TARGET_IDLE; } /* ecore_x_dnd_send_finished */ -void +EAPI void ecore_x_dnd_source_action_set(Ecore_X_Atom action) { _source->action = action; diff --git a/src/lib/ecore_x/xlib/ecore_x_dpms.c b/src/lib/ecore_x/xlib/ecore_x_dpms.c index 47ffcbf..75046b7 100644 --- a/src/lib/ecore_x/xlib/ecore_x_dpms.c +++ b/src/lib/ecore_x/xlib/ecore_x_dpms.c @@ -141,7 +141,7 @@ ecore_x_dpms_timeouts_set(unsigned int standby, * @ingroup Ecore_X_DPMS_Group */ EAPI unsigned int -ecore_x_dpms_timeout_standby_get() +ecore_x_dpms_timeout_standby_get(void) { #ifdef ECORE_XDPMS unsigned short standby, suspend, off; @@ -161,7 +161,7 @@ ecore_x_dpms_timeout_standby_get() * @ingroup Ecore_X_DPMS_Group */ EAPI unsigned int -ecore_x_dpms_timeout_suspend_get() +ecore_x_dpms_timeout_suspend_get(void) { #ifdef ECORE_XDPMS unsigned short standby, suspend, off; @@ -181,7 +181,7 @@ ecore_x_dpms_timeout_suspend_get() * @ingroup Ecore_X_DPMS_Group */ EAPI unsigned int -ecore_x_dpms_timeout_off_get() +ecore_x_dpms_timeout_off_get(void) { #ifdef ECORE_XDPMS unsigned short standby, suspend, off; diff --git a/src/lib/ecore_x/xlib/ecore_x_e.c b/src/lib/ecore_x/xlib/ecore_x_e.c index f4375a1..2d7657f 100644 --- a/src/lib/ecore_x/xlib/ecore_x_e.c +++ b/src/lib/ecore_x/xlib/ecore_x_e.c @@ -684,7 +684,7 @@ ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, &priority, 1); } /* ecore_x_e_illume_quickpanel_priority_major_set */ -EAPI int +EAPI int ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win) { unsigned int val = 0; @@ -708,7 +708,7 @@ ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, &priority, 1); } /* ecore_x_e_illume_quickpanel_priority_minor_set */ -EAPI int +EAPI int ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win) { unsigned int val = 0; @@ -751,7 +751,7 @@ ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win) LOGFN(__FILE__, __LINE__, __FUNCTION__); ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, 1, 0, 0, 0, 0); } /* ecore_x_e_illume_quickpanel_position_update_send */ diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c index 3a8b2c0..fe8d1b6 100644 --- a/src/lib/ecore_x/xlib/ecore_x_events.c +++ b/src/lib/ecore_x/xlib/ecore_x_events.c @@ -398,7 +398,7 @@ _ecore_mouse_button(int event, if (event_window == window) { if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) - { + { if (((int)(timestamp - _ecore_x_mouse_down_last_time) <= (int)(1000 * _ecore_x_double_click_time)) && (window == _ecore_x_mouse_down_last_win) && @@ -413,7 +413,7 @@ _ecore_mouse_button(int event, _ecore_x_mouse_down_did_double = 0; _ecore_x_mouse_down_did_triple = 0; } - + if (((int)(timestamp - _ecore_x_mouse_down_last_last_time) <= (int)(2 * 1000 * _ecore_x_double_click_time)) && (window == _ecore_x_mouse_down_last_win) && @@ -437,12 +437,12 @@ _ecore_mouse_button(int event, if (_ecore_x_mouse_down_did_triple) e->triple_click = 1; } - + } - /* NB: Block commented out as _ecore_x_mouse_up_count appears to have - * no use. The variable is also commented out above. This code block is - * the only place that this variable is used, and appears to serve no + /* NB: Block commented out as _ecore_x_mouse_up_count appears to have + * no use. The variable is also commented out above. This code block is + * the only place that this variable is used, and appears to serve no * purpose. - dh if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN && !e->double_click @@ -1338,7 +1338,7 @@ _ecore_x_event_handle_selection_request(XEvent *xevent) { Ecore_X_Event_Selection_Request *e; Ecore_X_Selection_Intern *sd; - void *data; + void *data = NULL; int len; int typesize; @@ -1364,7 +1364,7 @@ _ecore_x_event_handle_selection_request(XEvent *xevent) si = _ecore_x_selection_get(xevent->xselectionrequest.selection); if (si->data) { - Ecore_X_Atom property; + Ecore_X_Atom property = None; Ecore_X_Atom type; /* Set up defaults for strings first */ @@ -1377,7 +1377,7 @@ _ecore_x_event_handle_selection_request(XEvent *xevent) &data, &len, &type, &typesize)) /* Refuse selection, conversion to requested target failed */ property = None; - else + else if (data) { /* FIXME: This does not properly handle large data transfers */ ecore_x_window_prop_property_set( @@ -1527,10 +1527,10 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Ecore_X_DND_Target *target; e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)); - if (!e) - return; + if (!e) return; LOGFN(__FILE__, __LINE__, __FUNCTION__); + target = _ecore_x_dnd_target_get(); target->state = ECORE_X_DND_TARGET_ENTERED; target->source = xevent->xclient.data.l[0]; @@ -1540,6 +1540,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) { WRN("DND: Requested version %d, we only support up to %d", target->version, ECORE_X_DND_VERSION); + free(e); return; } @@ -1558,6 +1559,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) { WRN( "DND: Could not fetch data type list from source window, aborting."); + free(e); return; } @@ -1603,21 +1605,21 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Ecore_X_DND_Target *target; LOGFN(__FILE__, __LINE__, __FUNCTION__); + target = _ecore_x_dnd_target_get(); if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || (target->win != xevent->xclient.window)) - return; + return; target->pos.x = xevent->xclient.data.l[2] >> 16; target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL; target->action = xevent->xclient.data.l[4]; /* Version 2 */ target->time = (target->version >= 1) ? - (Time)xevent->xclient.data.l[3] : CurrentTime; + (Time)xevent->xclient.data.l[3] : CurrentTime; e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); - if (!e) - return; + if (!e) return; e->win = target->win; e->source = target->source; @@ -1633,11 +1635,12 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Ecore_X_DND_Source *source; LOGFN(__FILE__, __LINE__, __FUNCTION__); + source = _ecore_x_dnd_source_get(); /* Make sure source/target match */ if ((source->win != xevent->xclient.window) || (source->dest != (Window)xevent->xclient.data.l[0])) - return; + return; source->await_status = 0; @@ -1652,8 +1655,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) source->accepted_action = xevent->xclient.data.l[4]; e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); - if (!e) - return; + if (!e) return; e->win = source->win; e->target = source->dest; @@ -1674,16 +1676,16 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Ecore_X_DND_Target *target; LOGFN(__FILE__, __LINE__, __FUNCTION__); + target = _ecore_x_dnd_target_get(); if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || (target->win != xevent->xclient.window)) - return; + return; target->state = ECORE_X_DND_TARGET_IDLE; e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave)); - if (!e) - return; + if (!e) return; e->win = xevent->xclient.window; e->source = (Window)xevent->xclient.data.l[0]; @@ -1696,18 +1698,18 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Ecore_X_DND_Target *target; LOGFN(__FILE__, __LINE__, __FUNCTION__); + target = _ecore_x_dnd_target_get(); /* Match source/target */ if ((target->source != (Window)xevent->xclient.data.l[0]) || (target->win != xevent->xclient.window)) - return; + return; target->time = (target->version >= 1) ? (Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time; e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop)); - if (!e) - return; + if (!e) return; e->win = target->win; e->source = target->source; @@ -1724,11 +1726,12 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Eina_Bool completed = EINA_TRUE; LOGFN(__FILE__, __LINE__, __FUNCTION__); + source = _ecore_x_dnd_source_get(); /* Match source/target */ if ((source->win != xevent->xclient.window) || (source->dest != (Window)xevent->xclient.data.l[0])) - return; + return; if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL)) { @@ -1747,8 +1750,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) } e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished)); - if (!e) - return; + if (!e) return; e->win = source->win; e->target = source->dest; @@ -1771,8 +1773,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent) Ecore_X_Event_Window_State_Request *e; e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); - if (!e) - return; + if (!e) return; e->win = xevent->xclient.window; if (xevent->xclient.data.l[0] == 0) @@ -1934,7 +1935,7 @@ void _ecore_x_event_handle_mapping_notify(XEvent *xevent) { Ecore_X_Event_Mapping_Change *e; - + _ecore_x_last_event_mouse_move = 0; XRefreshKeyboardMapping((XMappingEvent *)xevent); e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); diff --git a/src/lib/ecore_x/xlib/ecore_x_icccm.c b/src/lib/ecore_x/xlib/ecore_x_icccm.c index 9a0acd0..12fbf45 100644 --- a/src/lib/ecore_x/xlib/ecore_x_icccm.c +++ b/src/lib/ecore_x/xlib/ecore_x_icccm.c @@ -130,7 +130,7 @@ ecore_x_icccm_hints_set(Ecore_X_Window win, Ecore_X_Pixmap icon_pixmap, Ecore_X_Pixmap icon_mask, Ecore_X_Window icon_window, - Ecore_X_Window window_group, + Ecore_X_Window window_group, Eina_Bool is_urgent) { XWMHints *hints; diff --git a/src/lib/ecore_x/xlib/ecore_x_image.c b/src/lib/ecore_x/xlib/ecore_x_image.c index 10cdfd8..a81941f 100644 --- a/src/lib/ecore_x/xlib/ecore_x_image.c +++ b/src/lib/ecore_x/xlib/ecore_x_image.c @@ -293,7 +293,7 @@ ecore_x_image_put(Ecore_X_Image *im, gc = tgc; } if (!im->xim) _ecore_x_image_shm_create(im); - if (im->xim) + 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 */ @@ -315,7 +315,7 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im) { Visual *vis = im->vis; if (!im->xim) _ecore_x_image_shm_create(im); - if (((vis->class == TrueColor) || + if (((vis->class == TrueColor) || (vis->class == DirectColor)) && (im->depth >= 24) && (vis->red_mask == 0xff0000) && @@ -324,9 +324,9 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im) { #ifdef WORDS_BIGENDIAN if (im->xim->bitmap_bit_order == LSBFirst) return EINA_TRUE; -#else +#else if (im->xim->bitmap_bit_order == MSBFirst) return EINA_TRUE; -#endif +#endif } return EINA_FALSE; } @@ -360,7 +360,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, int mode = 0; sbpp *= 8; - + n = vis->map_entries; if ((n <= 256) && ((vis->class == PseudoColor) || @@ -382,14 +382,14 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, XQueryColors(_ecore_x_disp, c, cols, n); for (i = 0; i < n; i++) { - pal[i] = 0xff000000 | + pal[i] = 0xff000000 | ((cols[i].red >> 8) << 16) | ((cols[i].green >> 8) << 8 ) | ((cols[i].blue >> 8) ); } nret = n; } - else if ((vis->class == TrueColor) || + else if ((vis->class == TrueColor) || (vis->class == DirectColor)) { if ((vis->red_mask == 0x00ff0000) && @@ -434,7 +434,7 @@ ecore_x_image_to_argb_convert(void *src, int sbpp, unsigned int *s32; unsigned int *dp, *de; - dp = ((unsigned int *)(((unsigned char *)dst) + + dp = ((unsigned int *)(((unsigned char *)dst) + ((dy + row) * dbpl))) + dx; de = dp + w; switch (sbpp) diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c b/src/lib/ecore_x/xlib/ecore_x_randr.c index 9d406b1..9bc5e59 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr.c @@ -80,7 +80,7 @@ ecore_x_randr_version_get(void) { return Ecore_X_Randr_Unset; } -#else +#else return -1; #endif } diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/src/lib/ecore_x/xlib/ecore_x_randr_12.c index 99cfb69..5189100 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr_12.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr_12.c @@ -16,10 +16,9 @@ #define RANDR_1_2 ((1 << 16) | 2) -#define RANDR_VALIDATE_ROOT(screen, \ - root) ((screen = \ - XRRRootToScreen(_ecore_x_disp, \ - root)) != -1) +#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_PROPERTY_EDID "EDID" @@ -82,7 +81,7 @@ _ecore_x_randr_crtc_validate(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) int i; Eina_Bool ret = EINA_FALSE; - if ((crtc == Ecore_X_Randr_None) || + if ((crtc == Ecore_X_Randr_None) || (crtc == Ecore_X_Randr_Unset)) return ret; @@ -837,7 +836,7 @@ ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, } if (crtc_info) XRRFreeCrtcInfo(crtc_info); - + if (res) XRRFreeScreenResources(res); @@ -867,10 +866,10 @@ ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) } if (crtc_info) XRRFreeCrtcInfo(crtc_info); - + if (res) XRRFreeScreenResources(res); - + return ret; #else return Ecore_X_Randr_None; @@ -1496,10 +1495,8 @@ ecore_x_randr_output_crtc_get(Ecore_X_Window root, Ecore_X_Randr_Output output) * @param len length of returned c-string. * @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 output, - int *len) +EAPI char * +ecore_x_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output, int *len) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(NULL); @@ -1508,12 +1505,12 @@ ecore_x_randr_output_name_get(Ecore_X_Window root, char *ret = NULL; if ((output != Ecore_X_Randr_None) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) - && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) + && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) { /* - * Actually the bewow command is correct, but due to a bug in libXrandr - * it doesn't work. Therefor we stick with strlen(). + * Actually the below command is correct, but due to a bug in libXrandr + * it doesn't work. Therefore we stick with strlen(). * Replace the line below with the following once this bug is * fixed within libXrandr. * @@ -1541,11 +1538,8 @@ ecore_x_randr_output_name_get(Ecore_X_Window root, * @param w width of given mode in px * @param h height of given mode in px */ - EAPI void -ecore_x_randr_mode_size_get(Ecore_X_Window root, - Ecore_X_Randr_Mode mode, - int *w, - int *h) +EAPI void +ecore_x_randr_mode_size_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode, int *w, int *h) { #ifdef ECORE_XRANDR RANDR_CHECK_1_2_RET(); @@ -1553,8 +1547,8 @@ ecore_x_randr_mode_size_get(Ecore_X_Window root, int i; if ((mode != Ecore_X_Randr_None) - && (w || h) - && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + && (w || h) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) { for (i = 0; i < res->nmode; i++) { @@ -2086,3 +2080,103 @@ ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, #endif return EINA_FALSE; } + +/* + * @brief get the outputs, which display a certain window + * @param window window the displaying outputs shall be found for + * @param num the number of outputs displaying the window + * @return array of outputs that display a certain window. NULL if no outputs + * was found that displays the specified window. + */ + +EAPI Ecore_X_Randr_Output * +ecore_x_randr_window_outputs_get(Ecore_X_Window window, + int *num) +{ +#ifdef ECORE_XRANDR + Ecore_X_Window root; + Eina_Rectangle w_geo, c_geo; + Ecore_X_Randr_Crtc *crtcs; + Ecore_X_Randr_Mode mode; + Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; + Window tw; + int ncrtcs, noutputs, i, nret = 0, rx = 0, ry = 0; + + if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; + + ecore_x_window_geometry_get(window, + &w_geo.x, &w_geo.y, + &w_geo.w, &w_geo.h); + + root = ecore_x_window_root_get(window); + crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); + if (!crtcs) goto _ecore_x_randr_current_output_get_fail; + + /* now get window RELATIVE to root window - thats what matters. */ + XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw); + w_geo.x = rx; + w_geo.y = ry; + + 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); + } + } + free(crtcs); + + if (num) *num = nret; + return ret; + +_ecore_x_randr_current_output_get_fail: +#endif + if (num) *num = 0; + return NULL; +} + +/* + * @depricated bad naming. Use ecore_x_randr_window_outputs_get instead. + * @brief get the outputs, which display a certain window + * @param window window the displaying outputs shall be found for + * @param num the number of outputs displaying the window + * @return array of outputs that display a certain window. NULL if no outputs + * was found that displays the specified window. + */ + +EINA_DEPRECATED EAPI Ecore_X_Randr_Output * +ecore_x_randr_current_output_get(Ecore_X_Window window, + int *num) +{ + return ecore_x_randr_window_outputs_get(window, num); +} diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c b/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c new file mode 100644 index 0000000..baf58b8 --- /dev/null +++ b/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c @@ -0,0 +1,433 @@ +/* + * Copyright 2006-2009 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +/* Original Author: Adam Jackson */ +/* Heavily modified by: Leif Middelschulte */ + +#include "Ecore_X.h" + +/* TODO: + * - see other TODO's within this file. + */ + +#define ECORE_X_RANDR_EDID_VERSION_10 ((1 << 8) | 0) +#define ECORE_X_RANDR_EDID_VERSION_11 ((1 << 8) | 1) +#define ECORE_X_RANDR_EDID_VERSION_12 ((1 << 8) | 2) +#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3) +#define ECORE_X_RANDR_EDID_VERSION_14 ((1 << 8) | 4) + +#define _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER 0x08 +#define _ECORE_X_RANDR_EDID_OFFSET_TYPE 0x14 +#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12 +#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13 +#define _ECORE_X_RANDR_EDID_OFFSET_DPMS 0x18 +#define _ECORE_X_RANDR_EDID_OFFSET_COLORSPACE 0x18 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5 +#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED 15 +#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO 14 + +#define _ECORE_X_RANDR_EDID_MASK_DIGITAL 0x80 +#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_INTERFACE 0x0f +#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_TMDS_DFP_10 0x01 +#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS 0x18 +#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444 0x10 +#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422 0x08 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED 0xe0 +#define _ECORE_X_RANDR_EDID_MASK_DPMS 0xE0 +#define _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY 0x80 +#define _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND 0x40 +#define _ECORE_X_RANDR_EDID_MASK_DPMS_OFF 0x20 +#define _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE 0x0f +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3 0x80 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9 0x40 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10 0x20 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4 0x10 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9 0x08 + +#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13 + +typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred { + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3 = 0x00, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9 = 0x01, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10 = 0x02, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4 = 0x03, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9 = 0x04 +} Ecore_X_Randr_Edid_Aspect_Ratio_Preferred; + +/* Some convenience loops */ +#define _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, extension_block_iter) \ + for (extension_block_iter = edid; extension_block_iter < (edid + edid_length); extension_block_iter += 128) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \ + _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, cea_block_iter) \ + if (cea_block_iter[0] == 0x02) + +/* The following macro is to be used with caution as it inherits another loop. + * Therefore using a 'break;' statement will lead to continuation in the + * inherent 'Extension block'-loop. + */ +#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_DETAILED_BLOCK(edid, edid_length, cea_block_iter, detailed_block_iter) \ + _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \ + for (detailed_block_iter = cea_block_iter + cea_block_iter[2]; detailed_block_iter + 18 < cea_block_iter + 127; detailed_block_iter += 18) \ + if (detailed_block_iter[0]) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ + for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3*18)); block += 18) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \ + _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ + if ((block[0] == 0) && (block[1] == 0)) + +EAPI Eina_Bool +ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_length) +{ + const unsigned char header[] = + { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; + if (!edid) return EINA_FALSE; + if (edid_length < 8) return EINA_FALSE; + if (!memcmp(edid, header, 8)) return EINA_TRUE; + return EINA_FALSE; +} + +EAPI int +ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length) +{ + if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return ((edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) | + edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR]); + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI int +ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, unsigned long edid_length) +{ + if ((edid_length > 0x0b) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return (int)(edid[0x0a] + (edid[0x0b] << 8)); + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI int +ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, unsigned long edid_length) +{ + if ((edid_length > 0x0f) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return (int)(edid[0x0c] + (edid[0x0d] << 8) + + (edid[0x0e] << 16) + (edid[0x0f] << 24)); + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI char * +ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, unsigned long edid_length) +{ + if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + { + unsigned char *x; + char *name; + + x = (edid + _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER); + name = malloc(sizeof(char) * 4); + if (!name) return NULL; + name[0] = ((x[0] & 0x7c) >> 2) + '@'; + name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xe0) >> 5) + '@'; + name[2] = (x[1] & 0x1f) + '@'; + name[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] = 0; + return name; + } + return NULL; +} + +EAPI char * +ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc) + { + char *name, *p; + const char *edid_name; + + edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!name) return NULL; + strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = name; *p; p++) + { + if ((*p < ' ') || (*p > '~')) *p = 0; + } + return name; + } + } + return NULL; +} + +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) && + (block[10] == 0x04)) + { + Ecore_X_Randr_Edid_Aspect_Ratio_Preferred preferred_ratio = + (Ecore_X_Randr_Edid_Aspect_Ratio_Preferred) + ((block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED] & + _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED) >> 5); + switch (preferred_ratio) + { + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3; + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9; + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10; + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4; + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9; + default: + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + } + } + } + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, unsigned long edid_length) +{ + Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) && + (block[10] == 0x04)) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9; + } + } + return ret; +} + +EAPI char * +ecore_x_randr_edid_display_ascii_get(unsigned char *edid, unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe) + { + char *ascii, *p; + const char *edid_ascii = (const char*)block + + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + /* + * TODO: Two of these in a row, in the third and fourth slots, + * seems to be specified by SPWG: http://www.spwg.org/ + */ + ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!ascii) return NULL; + strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = ascii; *p; p++) + { + if ((*p < ' ') || (*p > '~')) *p = 0; + } + return ascii; + } + } + return NULL; +} + +EAPI char * +ecore_x_randr_edid_display_serial_get(unsigned char *edid, unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff) + { + char *serial, *p; + const char *edid_serial = (const char*)block + + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + /* + * TODO: Two of these in a row, in the third and fourth slots, + * seems to be specified by SPWG: http://www.spwg.org/ + */ + serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!serial) return NULL; + strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = serial; *p; p++) + { + if ((*p < ' ') || (*p > '~')) *p = 0; + } + return serial; + } + } + return NULL; +} + +EAPI Eina_Bool +ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, unsigned long edid_length) +{ + unsigned char *cea_block_iter = NULL; + char sum = 0; + int i; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid_length < 128) return EINA_FALSE; + + /* Check the EDID block itself */ + 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]; + } + if (sum) return EINA_FALSE; + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_available_get(unsigned char *edid, unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS)); +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) + return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY)); + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) + return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND)); + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) + return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS_OFF)); + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + return (!!(edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] & + _ECORE_X_RANDR_EDID_MASK_DIGITAL)); +} + +EAPI Ecore_X_Randr_Edid_Display_Colorscheme +ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, 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); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return colorscheme; + if (ecore_x_randr_edid_display_type_digital_get(edid, edid_length)) + { + colorscheme = ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & + _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444) + colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & + _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422) + colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2; + } + else + colorscheme = edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS; + return colorscheme; +} + +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_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return type; + type = edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] & + _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE; + if (type > ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT) + type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + return type; +} diff --git a/src/lib/ecore_x/xlib/ecore_x_screensaver.c b/src/lib/ecore_x/xlib/ecore_x_screensaver.c index 86232c8..d33b948 100644 --- a/src/lib/ecore_x/xlib/ecore_x_screensaver.c +++ b/src/lib/ecore_x/xlib/ecore_x_screensaver.c @@ -54,7 +54,7 @@ ecore_x_screensaver_idle_time_get(void) XFree(xss); return idle; -#else +#else return 0; #endif /* ifdef ECORE_XSS */ } /* ecore_x_screensaver_idle_time_get */ diff --git a/src/lib/ecore_x/xlib/ecore_x_sync.c b/src/lib/ecore_x/xlib/ecore_x_sync.c index 28276e5..bc2bb1f 100644 --- a/src/lib/ecore_x/xlib/ecore_x_sync.c +++ b/src/lib/ecore_x/xlib/ecore_x_sync.c @@ -118,7 +118,7 @@ EAPI void ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, int val) { XSyncValue v; - + LOGFN(__FILE__, __LINE__, __FUNCTION__); XSyncIntToValue(&v, val); XSyncSetCounter(_ecore_x_disp, counter, v); @@ -128,7 +128,7 @@ EAPI void ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, int val_hi, unsigned int val_lo) { XSyncValue v; - + LOGFN(__FILE__, __LINE__, __FUNCTION__); XSyncIntsToValue(&v, val_lo, val_hi); XSyncSetCounter(_ecore_x_disp, counter, v); diff --git a/src/lib/ecore_x/xlib/ecore_x_vsync.c b/src/lib/ecore_x/xlib/ecore_x_vsync.c new file mode 100644 index 0000000..53a9fb8 --- /dev/null +++ b/src/lib/ecore_x/xlib/ecore_x_vsync.c @@ -0,0 +1,327 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define ECORE_X_VSYNC_DRI2 1 + +#ifdef ECORE_X_VSYNC_DRI2 +// relevant header bits of dri/drm inlined here to avoid needing external +// headers to build +/// drm +typedef unsigned int drm_magic_t; + +typedef enum +{ + DRM_VBLANK_ABSOLUTE = 0x00000000, + DRM_VBLANK_RELATIVE = 0x00000001, + DRM_VBLANK_EVENT = 0x04000000, + DRM_VBLANK_FLIP = 0x08000000, + DRM_VBLANK_NEXTONMISS = 0x10000000, + DRM_VBLANK_SECONDARY = 0x20000000, + DRM_VBLANK_SIGNAL = 0x40000000 +} +drmVBlankSeqType; + +typedef struct _drmVBlankReq +{ + drmVBlankSeqType type; + unsigned int sequence; + unsigned long signal; +} drmVBlankReq; + +typedef struct _drmVBlankReply +{ + drmVBlankSeqType type; + unsigned int sequence; + long tval_sec; + long tval_usec; +} drmVBlankReply; + +typedef union _drmVBlank +{ + drmVBlankReq request; + drmVBlankReply reply; +} drmVBlank; + +#define DRM_EVENT_CONTEXT_VERSION 2 + +typedef struct _drmEventContext +{ + int version; + 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, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data); +} drmEventContext; + +static int (*sym_drmClose) (int fd) = NULL; +static int (*sym_drmGetMagic) (int fd, drm_magic_t * magic) = NULL; +static int (*sym_drmWaitVBlank) (int fd, drmVBlank *vbl) = NULL; +static int (*sym_drmHandleEvent) (int fd, drmEventContext *evctx) = NULL; + +//// dri + +static Bool (*sym_DRI2QueryExtension) (Display *display, int *eventBase, int *errorBase) = NULL; +static Bool (*sym_DRI2QueryVersion) (Display *display, 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, drm_magic_t magic) = NULL; + + +//// dri/drm data needed +static int dri2_event = 0; +static int dri2_error = 0; +static int dri2_major = 0; +static int dri2_minor = 0; +static char *device_name = 0; +static char *driver_name = 0; +static drm_magic_t drm_magic; + +static int drm_fd = -1; +static int drm_event_is_busy = 0; +static int drm_animators_interval = 1; +static drmEventContext drm_evctx; +static Ecore_Fd_Handler *dri_drm_fdh = NULL; + +static void *dri_lib = NULL; +static void *drm_lib = NULL; + +static Window dri_drm_vsync_root = 0; + +static void +_dri_drm_tick_schedule(void) +{ + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT; + vbl.request.sequence = drm_animators_interval; + vbl.request.signal = 0; + sym_drmWaitVBlank(drm_fd, &vbl); +} + +static void +_dri_drm_tick_begin(void *data __UNUSED__) +{ + drm_event_is_busy = 1; + _dri_drm_tick_schedule(); +} + +static void +_dri_drm_tick_end(void *data __UNUSED__) +{ + drm_event_is_busy = 0; +} + +static void +_dri_drm_vblank_handler(int fd __UNUSED__, unsigned int frame __UNUSED__, + unsigned int sec __UNUSED__, + unsigned int usec __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__, Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + sym_drmHandleEvent(drm_fd, &drm_evctx); + return ECORE_CALLBACK_RENEW; +} + +// yes. most evil. we dlopen libdrm and libGL etc. to manually find smbols +// so we can be as compatible as possible given the whole mess of the +// gl/dri/drm etc. world. and handle graceful failure at runtime not +// compile time +static int +_dri_drm_link(void) +{ + const char *drm_libs[] = + { + "libdrm.so.2", + "libdrm.so.1", + "libdrm.so.0", + "libdrm.so", + NULL, + }; + const char *dri_libs[] = + { + "libdri2.so.2", + "libdri2.so.1", + "libdri2.so.0", + "libdri2.so", + "libGL.so.4", + "libGL.so.3", + "libGL.so.2", + "libGL.so.1", + "libGL.so.0", + "libGL.so", + NULL, + }; + int i, fail; +#define SYM(lib, xx) \ + do { \ + sym_ ## xx = dlsym(lib, #xx); \ + if (!(sym_ ## xx)) { \ + fprintf(stderr, "%s\n", dlerror()); \ + fail = 1; \ + } \ + } while (0) + + if (dri_lib) return 1; + for (i = 0; drm_libs[i]; i++) + { + drm_lib = dlopen(drm_libs[i], RTLD_LOCAL | RTLD_LAZY); + if (drm_lib) + { + fail = 0; + SYM(drm_lib, drmClose); + SYM(drm_lib, drmWaitVBlank); + SYM(drm_lib, drmHandleEvent); + if (fail) + { + dlclose(drm_lib); + drm_lib = NULL; + } + else break; + } + } + if (!drm_lib) return 0; + for (i = 0; dri_libs[i]; i++) + { + dri_lib = dlopen(dri_libs[i], RTLD_LOCAL | RTLD_LAZY); + if (dri_lib) + { + fail = 0; + SYM(dri_lib, DRI2QueryExtension); + SYM(dri_lib, DRI2QueryVersion); + SYM(dri_lib, DRI2Connect); + SYM(dri_lib, DRI2Authenticate); + if (fail) + { + dlclose(dri_lib); + dri_lib = NULL; + } + else break; + } + } + if (!dri_lib) + { + dlclose(drm_lib); + drm_lib = NULL; + return 0; + } + return 1; +} + +static int +_dri_drm_init(void) +{ + if (!sym_DRI2QueryExtension(_ecore_x_disp, &dri2_event, &dri2_error)) + return 0; + if (!sym_DRI2QueryVersion(_ecore_x_disp, &dri2_major, &dri2_minor)) + return 0; + if (dri2_major < 2) + return 0; + if (!sym_DRI2Connect(_ecore_x_disp, dri_drm_vsync_root, &driver_name, &device_name)) + return 0; + drm_fd = open(device_name, O_RDWR); + if (drm_fd < 0) + return 0; + sym_drmGetMagic(drm_fd, &drm_magic); + if (!sym_DRI2Authenticate(_ecore_x_disp, dri_drm_vsync_root, drm_magic)) + { + close(drm_fd); + drm_fd = -1; + return 0; + } + memset(&drm_evctx, 0, sizeof(drm_evctx)); + drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; + drm_evctx.vblank_handler = _dri_drm_vblank_handler; + drm_evctx.page_flip_handler = NULL; + + dri_drm_fdh = ecore_main_fd_handler_add(drm_fd, ECORE_FD_READ, + _dri_drm_cb, NULL, NULL, NULL); + if (!dri_drm_fdh) + { + close(drm_fd); + drm_fd = -1; + return 0; + } + return 1; +} + +static void +_dri_drm_shutdown(void) +{ + if (drm_fd >= 0) + { + close(drm_fd); + drm_fd = -1; + } + if (dri_drm_fdh) + { + ecore_main_fd_handler_del(dri_drm_fdh); + dri_drm_fdh = NULL; + } +} +#endif + +EAPI Eina_Bool +ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win) +{ +#ifdef ECORE_X_VSYNC_DRI2 + Ecore_X_Window root; + + root = ecore_x_window_root_get(win); + if (root != dri_drm_vsync_root) + { + dri_drm_vsync_root = root; + if (dri_drm_vsync_root) + { + if (!_dri_drm_link()) + { + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + return EINA_FALSE; + } + _dri_drm_shutdown(); + if (!_dri_drm_init()) + { + dri_drm_vsync_root = 0; + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + return EINA_FALSE; + } + ecore_animator_custom_source_tick_begin_callback_set + (_dri_drm_tick_begin, NULL); + ecore_animator_custom_source_tick_end_callback_set + (_dri_drm_tick_end, NULL); + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); + } + else + { + if (drm_fd >= 0) + { + _dri_drm_shutdown(); + ecore_animator_custom_source_tick_begin_callback_set + (NULL, NULL); + ecore_animator_custom_source_tick_end_callback_set + (NULL, NULL); + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + } + } + } + return EINA_TRUE; +#else + return EINA_FALSE; + win = 0; +#endif +} diff --git a/src/lib/ecore_x/xlib/ecore_x_window.c b/src/lib/ecore_x/xlib/ecore_x_window.c index f8e730b..c5f3c35 100644 --- a/src/lib/ecore_x/xlib/ecore_x_window.c +++ b/src/lib/ecore_x/xlib/ecore_x_window.c @@ -308,7 +308,7 @@ ecore_x_window_free(Ecore_X_Window win) EAPI void ecore_x_window_ignore_set(Ecore_X_Window win, int ignore) { - int i, j; + int i, j, cnt; Ecore_X_Window *t; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -339,13 +339,14 @@ ecore_x_window_ignore_set(Ecore_X_Window win, int ignore) if (!ignore_list) return; - for (i = 0, j = 0; i < ignore_num; i++) + for (cnt = ignore_num, i = 0, j = 0; i < cnt; i++) { if (win != ignore_list[i]) - ignore_list[i] = ignore_list[j++]; + ignore_list[j++] = ignore_list[i]; else - ignore_num--; + ignore_num--; } + if (ignore_num <= 0) { free(ignore_list); @@ -1002,6 +1003,28 @@ _ecore_x_window_shadow_tree_find(Window base) return NULL; } /* _ecore_x_window_shadow_tree_find */ +static int +_inside_rects(Shadow *s, int x, int y, int bx, int by, Ecore_X_Rectangle *rects, int num) +{ + int i, inside; + + if (!rects) return 0; + inside = 0; + for (i = 0; i < num; i++) + { + if ((x >= s->x + bx + rects[i].x) && + (y >= s->y + by + rects[i].y) && + (x < (int)(s->x + bx + rects[i].width)) && + (y < (int)(s->y + by + rects[i].height))) + { + inside = 1; + break; + } + } + free(rects); + return inside; +} + static Window _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, @@ -1019,6 +1042,19 @@ _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, wy = s->y + by; if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h)))) return 0; + + /* FIXME: get shape */ + { + int num; + Ecore_X_Rectangle *rects; + + num = 0; + rects = ecore_x_window_shape_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + num = 0; + rects = ecore_x_window_shape_input_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + } if (s->children) { diff --git a/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/src/lib/ecore_x/xlib/ecore_x_window_shape.c index 7ffc39f..a8decf3 100755 --- a/src/lib/ecore_x/xlib/ecore_x_window_shape.c +++ b/src/lib/ecore_x/xlib/ecore_x_window_shape.c @@ -66,7 +66,7 @@ EAPI void ecore_x_window_shape_input_window_set(Ecore_X_Window win, Ecore_X_Window shape_win) { -#ifdef ShapeInput +#ifdef ShapeInput LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineShape(_ecore_x_disp, win, @@ -79,7 +79,7 @@ ecore_x_window_shape_input_window_set(Ecore_X_Window win, #else return; win = shape_win = 0; -#endif +#endif } /* ecore_x_window_shape_input_window_set */ EAPI void @@ -105,7 +105,7 @@ ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, int x, int y) { -#ifdef ShapeInput +#ifdef ShapeInput LOGFN(__FILE__, __LINE__, __FUNCTION__); XShapeCombineShape(_ecore_x_disp, win, @@ -118,7 +118,7 @@ ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, #else return; win = shape_win = x = y = 0; -#endif +#endif } /* ecore_x_window_shape_input_window_set_xy */ EAPI void @@ -173,7 +173,7 @@ ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, #else return; win = x = y = w = h = 0; -#endif +#endif } /* ecore_x_window_shape_input_rectangle_set */ EAPI void @@ -251,7 +251,7 @@ ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, #else return; win = rects = num = 0; -#endif +#endif } /* ecore_x_window_shape_input_rectangles_set */ EAPI void @@ -286,7 +286,7 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, int w, int h) { -#ifdef ShapeInput +#ifdef ShapeInput XRectangle rect; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -306,7 +306,7 @@ ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, #else return; win = x = y = w = h = 0; -#endif +#endif } /* ecore_x_window_shape_input_rectangle_subtract */ EAPI void @@ -359,7 +359,7 @@ ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, #else return; win = shape_win = x = y = 0; -#endif +#endif } /* ecore_x_window_shape_input_window_add_xy */ EAPI void @@ -394,7 +394,7 @@ ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, int w, int h) { -#ifdef ShapeInput +#ifdef ShapeInput XRectangle rect; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -414,7 +414,7 @@ ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, #else return; win = x = y = w = h = 0; -#endif +#endif } /* ecore_x_window_shape_input_rectangle_add */ EAPI void @@ -469,7 +469,7 @@ ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, #else return; win = x = y = w = h = 0; -#endif +#endif } /* ecore_x_window_shape_input_rectangle_clip */ EAPI void @@ -528,10 +528,10 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, rect[i].height = rects[i].height; } } - + XShapeCombineRectangles(_ecore_x_disp, win, - ShapeBounding, + ShapeInput, 0, 0, rect, @@ -542,7 +542,7 @@ ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, #else return; win = rects = num = 0; -#endif +#endif } /* ecore_x_window_shape_input_rectangles_add */ EAPI Ecore_X_Rectangle * @@ -585,9 +585,9 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret) EAPI Ecore_X_Rectangle * ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret) { + Ecore_X_Rectangle *rects = NULL; #ifdef ShapeInput XRectangle *rect; - Ecore_X_Rectangle *rects = NULL; int i, num = 0, ord; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -619,10 +619,24 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret) if (num_ret) *num_ret = num; return rects; #else + // have to return fake shape input rect of size of window + Window dw; + unsigned int di; + if (num_ret) *num_ret = 0; - return NULL; - win = 0; -#endif + rects = malloc(sizeof(Ecore_X_Rectangle)); + if (!rects) return NULL; + if (!XGetGeometry(_ecore_x_disp, win, &dw, + &(rects[0].x), &(rects[0].y), + &(rects[0].width), &(rects[0].height), + &di, &di)) + { + free(rects); + return NULL; + } + if (num_ret) *num_ret = 1; + return rects; +#endif } /* ecore_x_window_shape_input_rectangles_get */ EAPI void -- 2.7.4