Sangho Park <gouache95@gmail.com>
Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
PnB <Poor.NewBie@gmail.com>
+Daniel Juyung Seo <seojuyung2@gmail.com> <juyung.seo@samsung.com>
* 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).
+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_*()
(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/ ).
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
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])
# 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"
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"
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"
;;
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"
;;
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"
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
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
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)
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gettimeofday strlcpy)
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <math.h>
+ ]],
+ [[
+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
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],
ecore.pc
doc/ecore.dox
doc/Makefile
+doc/Doxyfile
src/Makefile
src/bin/Makefile
src/lib/Makefile
src/tests/Makefile
README
ecore.spec
+$po_makefile_in
])
-m4_ifdef([AM_GNU_GETTEXT], [AC_CONFIG_FILES([po/Makefile.in])])
-
AC_OUTPUT
echo
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"
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"
+++ /dev/null
-html
-latex
-man
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
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
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
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
-/**
-@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 <raster@rasterman.com>
-@author Tom Gilbert <tom@linuxbrit.co.uk>
-@author Burra <burra@colorado.edu>
-@author Chris Ross <chris@darkrock.co.uk>
-@author Term <term@twistedpath.org>
-@author Tilman Sauerbeck <tilman@code-monkey.de>
-@author Ibukun Olumuyiwa <ibukun@computer.org>
-@author Yuri <da2001@hotmail.ru>
-@author Nicholas Curran <quasar@bigblue.net.au>
-@author Howell Tam <pigeon@pigeond.net>
-@author Nathan Ingersoll <rbdpngn@users.sourceforge.net>
-@author Andrew Elcock <andy@elcock.org>
-@author Kim Woelders <kim@woelders.dk>
-@author Sebastian Dransfeld <sebastid@tango.flipp.net>
-@author Simon Poole <simon.armlinux@themalago.net>
-@author Jorge Luis Zapata Muga <jorgeluis.zapata@gmail.com>
-@author dan sinclair <zero@everburning.com>
-@author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
-@author David 'onefang' Seikel <onefang@gmail.com>
-@author Hisham 'CodeWarrior' Mardam Bey <hisham@hisham.cc>
-@author Brian 'rephorm' Mattern <rephorm@rephorm.com>
-@author Tim Horton <hortont424@gmail.com>
-@author Arnaud de Turckheim 'quarium' <quarium@gmail.com>
-@author Matt Barclay <mbarclay@gmail.com>
-@author Peter Wehrfritz <peter.wehrfritz@web.de>
-@author Albin "Lutin" Tonnerre <albin.tonnerre@gmail.com>
-@author Vincent Torri <vincent.torri@gmail.com>
-@author Lars Munch <lars@segv.dk>
-@author Andre Dieb <andre.dieb@gmail.com>
-@author Mathieu Taillefumier <mathieu.taillefumier@free.fr>
-@author Rui Miguel Silva Seabra <rms@1407.org>
-@author Samsung Electronics
-@author Samsung SAIT
-@author Nicolas Aguirre <aguirre.nicolas@gmail.com>
-@author Brett Nash <nash@nash.id.au>
-@author Mike Blumenkrantz <mike@zentific.com>
-@author Leif Middelschulte <leif.middelschulte@gmail.com>
-@author Mike McCormack <mj.mccormack@samsung.com>
-@author Sangho Park <gouache95@gmail.com>
-@author Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
-@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 <Ecore.h>
-
-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.h>
-
-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.
-*/
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-ecore_config
-ecore_evas_test
-ecore_test
-ecore_dbus_test
-ecore_dbus_hal_test
-ecore_dbus_receiver_test
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore.la
+/**
+@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 <raster@rasterman.com>
+@author Tom Gilbert <tom@linuxbrit.co.uk>
+@author Burra <burra@colorado.edu>
+@author Chris Ross <chris@darkrock.co.uk>
+@author Term <term@twistedpath.org>
+@author Tilman Sauerbeck <tilman@code-monkey.de>
+@author Ibukun Olumuyiwa <ibukun@computer.org>
+@author Yuri <da2001@hotmail.ru>
+@author Nicholas Curran <quasar@bigblue.net.au>
+@author Howell Tam <pigeon@pigeond.net>
+@author Nathan Ingersoll <rbdpngn@users.sourceforge.net>
+@author Andrew Elcock <andy@elcock.org>
+@author Kim Woelders <kim@woelders.dk>
+@author Sebastian Dransfeld <sebastid@tango.flipp.net>
+@author Simon Poole <simon.armlinux@themalago.net>
+@author Jorge Luis Zapata Muga <jorgeluis.zapata@gmail.com>
+@author dan sinclair <zero@everburning.com>
+@author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+@author David 'onefang' Seikel <onefang@gmail.com>
+@author Hisham 'CodeWarrior' Mardam Bey <hisham@hisham.cc>
+@author Brian 'rephorm' Mattern <rephorm@rephorm.com>
+@author Tim Horton <hortont424@gmail.com>
+@author Arnaud de Turckheim 'quarium' <quarium@gmail.com>
+@author Matt Barclay <mbarclay@gmail.com>
+@author Peter Wehrfritz <peter.wehrfritz@web.de>
+@author Albin "Lutin" Tonnerre <albin.tonnerre@gmail.com>
+@author Vincent Torri <vincent.torri@gmail.com>
+@author Lars Munch <lars@segv.dk>
+@author Andre Dieb <andre.dieb@gmail.com>
+@author Mathieu Taillefumier <mathieu.taillefumier@free.fr>
+@author Rui Miguel Silva Seabra <rms@1407.org>
+@author Samsung Electronics
+@author Samsung SAIT
+@author Nicolas Aguirre <aguirre.nicolas@gmail.com>
+@author Brett Nash <nash@nash.id.au>
+@author Mike Blumenkrantz <mike@zentific.com>
+@author Leif Middelschulte <leif.middelschulte@gmail.com>
+@author Mike McCormack <mj.mccormack@samsung.com>
+@author Sangho Park <gouache95@gmail.com>
+@author Jihoon Kim <jihoon48.kim@samsung.com> <imfine98@gmail.com>
+@author Daniel Juyung Seo <seojuyung2@gmail.com> <juyung.seo@samsung.com>
+@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 <Ecore.h>
+
+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.h>
+
+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
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 */
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.
*/
EAPI const char *ecore_exe_tag_get(const Ecore_Exe *exe);
EAPI const char *ecore_exe_cmd_get(const Ecore_Exe *exe);
EAPI void *ecore_exe_data_get(const Ecore_Exe *exe);
+ EAPI void *ecore_exe_data_set(Ecore_Exe *exe, void *data);
EAPI Ecore_Exe_Flags ecore_exe_flags_get(const Ecore_Exe *exe);
EAPI void ecore_exe_pause(Ecore_Exe *exe);
EAPI void ecore_exe_continue(Ecore_Exe *exe);
EAPI Eina_Bool ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes);
EAPI void ecore_pipe_write_close(Ecore_Pipe *p);
EAPI void ecore_pipe_read_close(Ecore_Pipe *p);
+ EAPI void ecore_pipe_thaw(Ecore_Pipe *p);
+ EAPI void ecore_pipe_freeze(Ecore_Pipe *p);
+ EAPI int ecore_pipe_wait(Ecore_Pipe *p, int message_count, double wait);
/**
* @}
EAPI double ecore_timer_pending_get(Ecore_Timer *timer);
EAPI double ecore_timer_precision_get(void);
EAPI void ecore_timer_precision_set(double precision);
+ EAPI char *ecore_timer_dump(void);
/**
* @}
*/
EAPI 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);
+
/**
* @}
*/
#if defined(GLIB_INTEGRATION_ALWAYS)
if (_ecore_glib_always_integrate) ecore_main_loop_glib_integrate();
#endif
-
+
return _ecore_init_count;
shutdown_log_dom:
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.
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
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;
}
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();
}
/**
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;
}
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();
}
/**
{
Ecore_Event *e;
EINA_INLIST_FOREACH(events, e)
- if (!e->delete_me) return 1;
+ if (!e->delete_me) return 1;
return 0;
}
}
/**
+ * 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.
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;
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));
ecore_event_add(ECORE_EXE_EVENT_DEL, e,
_ecore_exe_event_del_free, NULL);
-
+
return 0;
}
_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;
{
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;
{
const GPollFD *itr = pfds, *itr_end = pfds + count;
int glib_fds = -1;
-
+
for (; itr < itr_end; itr++)
{
if (glib_fds < itr->fd)
_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;
{
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
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);
/**
* 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.
ecore_job_add(Ecore_Cb func, const void *data)
{
Ecore_Job *job;
-
+
if (!func) return NULL;
job = calloc(1, sizeof(Ecore_Job));
ecore_job_del(Ecore_Job *job)
{
void *data;
-
+
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_JOB))
{
ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB,
_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;
# include <float.h>
#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
#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);
#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;
#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;
/* 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;
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();
if (_ecore_timers_exists())
{
double t = _ecore_timer_next_get();
- *next_time = (t / 1000.0);
+ *next_time = (t * 1000.0);
}
else
*next_time = -1;
}
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();
/* 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)
{
_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))
}
static void
-_ecore_main_gsource_finalize(GSource *source)
+_ecore_main_gsource_finalize(GSource *source __UNUSED__)
{
INF("finalize");
}
}
}
+#ifndef USE_G_MAIN_LOOP
static int
_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;
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)
{
}
return 0;
}
+#endif
#ifndef _WIN32
+# ifndef USE_G_MAIN_LOOP
static void
_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
_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;
}
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;
}
{
have_event = 1;
_ecore_main_select(0.0);
- _ecore_time_loop_time = ecore_time_get();
_ecore_timer_enable_new();
goto process_events;
}
{
_ecore_idle_enterer_call();
in_main_loop--;
- _ecore_time_loop_time = ecore_time_get();
_ecore_timer_enable_new();
return;
}
_ecore_timer_enable_new();
if (do_quit)
{
- _ecore_time_loop_time = ecore_time_get();
in_main_loop--;
_ecore_timer_enable_new();
return;
{
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;
}
{
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;
}
}
}
- _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 */
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+#include <math.h>
+
+#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 <sys/param.h>
+# endif
+# ifndef HZ
+# define HZ 100
+# endif
+#endif
#ifdef HAVE_EVIL
# include <Evil.h>
int handling;
size_t already_read;
void *passed_data;
+ int message;
Eina_Bool delete_me : 1;
};
}
/**
+ * 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.
}
if (p->delete_me) return EINA_FALSE;
-
+
if (p->fd_write == PIPE_FD_INVALID) return EINA_FALSE;
/* First write the len into the pipe */
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)
p = (Ecore_Pipe *)data;
start_time = ecore_time_get();
-
+
p->handling++;
for (i = 0; i < 16; i++)
{
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);
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))
{
p->passed_data = NULL;
p->already_read = 0;
p->len = 0;
+ p->message++;
}
else if (ret >= 0)
{
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
}
#endif
}
-
+
_ecore_pipe_unhandle(p);
return ECORE_CALLBACK_RENEW;
}
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
CloseHandle(x->thread);
}
if (res) *res = x->val;
+ free(x);
return 0;
}
LONG readers_count;
LONG writers_count;
int readers;
- int writers;
+ int writers;
LK(mutex);
CD(cond_read);
CD(cond_write);
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)
/* 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);
}
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);
# include <Evil.h>
#endif
+#if defined(__APPLE__) && defined(__MACH__)
+# include <mach/mach_time.h>
+#endif
+
#include "Ecore.h"
#include "ecore_private.h"
#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;
}
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
}
}
#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
#include "Ecore.h"
#include "ecore_private.h"
+#ifdef WANT_ECORE_TIMER_DUMP
+# include <string.h>
+# include <execinfo.h>
+# define ECORE_TIMER_DEBUG_BT_NUM 64
+ typedef void (*Ecore_Timer_Bt_Func) ();
+#endif
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;
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;
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;
}
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;
}
_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
+}
+
/**
* @}
*/
}
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);
+}
+++ /dev/null
-.deps
-.libs
-Ecore_Con.h
-Makefile
-Makefile.in
-*.lo
-libecore_con.la
# 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
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);
-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@ \
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
{
Eina_List *l, *l2;
Ecore_Con_Server *svr;
-
+
if (--_ecore_con_init_count != 0)
return _ecore_con_init_count;
(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))
(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))
}
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);
}
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));
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);
}
}
+#ifdef _WIN32
+ ecore_con_local_win32_server_del(svr);
+#endif
+
if (svr->write_buf)
free(svr->write_buf);
break;
}
}
+
+#ifdef _WIN32
+ ecore_con_local_win32_client_del(cl);
+#endif
+
if (cl->buf)
free(cl->buf);
{
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);
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,
ecore_con_event_server_error(svr, strerror(errno));
goto error;
}
-
+
if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY)
{
int flag = 1;
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)
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)
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;
}
if (!ecore_con_ssl_server_init(svr))
lost_server = EINA_FALSE;
}
-
+
if (!(svr->type & ECORE_CON_SSL))
{
num = read(svr->fd, buf, sizeof(buf));
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);
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))
{
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;
}
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
}
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)
{
{
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;
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);
}
{
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;
_ecore_con_server_free(svr);
if (e->error) free(e->error);
free(e);
-
+
}
static void
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);
ecore_con_info_init(void)
{
struct ares_options opts;
-
+
if (!info_init)
{
if (ares_library_init(ARES_LIB_INIT_ALL))
_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;
}
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;
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)
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);
}
_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;
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);
}
# include <ws2tcpip.h>
#endif
-#ifdef HAVE_EVIL
-# include <Evil.h>
-#endif
-
#include <Ecore.h>
#include <ecore_private.h>
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <process.h>
+
+#include <Evil.h>
+#include <Ecore.h>
+
+#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;
+}
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
/* 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);
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);
static int _init_con_ssl_init_count = 0;
-#if USE_GNUTLS
-# ifdef EFL_HAVE_PTHREAD
-#include <pthread.h>
+#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
_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);
ecore_con_event_client_error(conn, buf);
else
ecore_con_event_server_error(conn, buf);
-
+
} while (1);
}
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
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
}
/**
+ * 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
// 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);
}
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:
* 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()
/**
* 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.
*/
return 0;
}
+#ifdef _WIN32
+ INF("*** We read %Iu bytes from file", retcode);
+#else
INF("*** We read %zu bytes from file", retcode);
+#endif
return retcode;
}
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore_config.la
-ecore_config_ipc_ecore.la
-system.db
/**
* 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
*/
ret = _ecore_config_struct_append(ecore_config_get(key),
ecore_config_get(subkey));
free(subkey);
- return ret;
+ return ret;
}
/**
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);
}
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))
{
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;
/* set up a simple default path */
ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes");
-
+
return ECORE_CONFIG_ERR_SUCC;
}
{
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");
{
Eet_File *ef;
Ecore_Config_DB_File *db;
-
+
eet_init();
db = malloc(sizeof(Ecore_Config_DB_File));
if (!db) return NULL;
{
Eet_File *ef;
Ecore_Config_DB_File *db;
-
+
eet_init();
db = malloc(sizeof(Ecore_Config_DB_File));
if (!db) return NULL;
char **keys;
int key_count;
int i;
-
+
keys = eet_list(db->ef, (char*)"*", &key_count);
if (!keys)
{
{
char *data;
int size;
-
+
data = eet_read(db->ef, (char*)key, &size);
if (data)
{
char *data, *value;
int size;
Ecore_Config_Type type;
-
+
data = eet_read(db->ef, (char*)key, &size);
if (data)
{
free(data);
return 0;
}
-
+
type = data[0];
value = data + l + 1;
- switch (type)
+ switch (type)
{
case ECORE_CONFIG_INT:
case ECORE_CONFIG_BLN:
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;
}
{
char *data;
int size;
-
+
data = eet_read(db->ef, (char*)key, &size);
if (data)
{
int l;
char *dat;
-
+
if (size <= 2)
{
free(data);
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));
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:
{
setlocale(LC_NUMERIC, prev_locale);
}
-
+
if(val)
{
num = esprintf(&r, "%c%c%s%c", (char) e->type, 0, val, 0);
{
char *buf;
int num;
-
+
num = 1 + 1 + data_size + 1;
buf = malloc(num);
if (!buf) return;
* 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.
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 + | */
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);
{
ecore_config_set(prop->key, arg);
prop->flags |= ECORE_CONFIG_FLAG_CMDLN;
- }
+ }
return ECORE_CONFIG_PARSE_CONTINUE;
}
callback = _ecore_config_arg_callbacks;
while (callback)
{
- if ((callback->long_opt &&
+ if ((callback->long_opt &&
!strcmp(long_opt, callback->long_opt)))
{
found = 1;
{
callback->func(NULL, callback->data);
}
- else
+ else
{
if (!argv[++nextarg])
{
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;
}
free(keys);
}
-
+
return estring_disown(s);
}
if (!ipc_timer)
ipc_timer = ecore_timer_add(100, _ecore_config_ipc_poll, NULL);
-
+
return ret_srv;
}
/*****************************************************************************/
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)
{
+++ /dev/null
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-libecore_directfb.la
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
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);
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
$(ECORE_DIRECTFB_INC) \
$(ECORE_WIN32_INC) \
$(ECORE_SDL_INC) \
-$(ECORE_COCOA_INC) \
$(ECORE_WINCE_INC) \
@EVAS_CFLAGS@ \
@XCB_CFLAGS@ \
ecore_evas_directfb.c \
ecore_evas_win32.c \
ecore_evas_sdl.c \
-ecore_evas_cocoa.c \
ecore_evas_wince.c
libecore_evas_la_LIBADD = \
$(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 \
@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
double t1 = 0.0;
double t2 = 0.0;
int rend = 0;
-
+
if (!ecore_evases) return ECORE_CALLBACK_RENEW;
if (_ecore_evas_fps_debug)
{
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:
* 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;
}
/**
"ecore_evas_withdrawn_set");
return;
}
-
+
IFC(ee, fn_withdrawn_set) (ee, withdrawn);
IFE;
}
"ecore_evas_sticky_set");
return;
}
-
+
IFC(ee, fn_sticky_set) (ee, sticky);
IFE;
}
"ecore_evas_ignore_events_set");
return;
}
-
+
IFC(ee, fn_ignore_events_set) (ee, ignore);
IFE;
}
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... :) */
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,
{
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);
y, ee->w - x - 1,
radius,
radius_y, radius_x,
- pressure,
+ pressure,
angle - ee->rotation,
my, ee->w - mx - 1,
timestamp, NULL);
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,
{
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);
y, ee->w - x - 1,
radius,
radius_y, radius_x,
- pressure,
+ pressure,
angle - ee->rotation,
my, ee->w - mx - 1,
flags, timestamp, NULL);
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,
{
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);
y, ee->w - x - 1,
radius,
radius_y, radius_x,
- pressure,
+ pressure,
angle - ee->rotation,
my, ee->w - mx - 1,
flags, timestamp, NULL);
/**
* 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.
{
Ecore_Evas *ee;
Eina_List *l = NULL;
-
+
EINA_INLIST_FOREACH(ecore_evases, ee)
{
l = eina_list_append(l, ee);
}
-
+
return l;
}
}
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();
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);
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
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);
}
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);
}
NULL,
NULL,
NULL, //transparent
-
- NULL // render
+
+ NULL, // render
+ NULL // screen_geometry_get
};
#endif
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));
ee->engine.func->fn_render = _ecore_evas_buffer_render;
_ecore_evas_register(ee);
-
+
return ee;
#else
return NULL;
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();
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;
_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;
}
NULL, /* ignore events */
NULL, /* alpha */
NULL, //transparent
-
- NULL // render
+
+ NULL, // render
+ NULL // screen_geometry_get
};
#endif
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);
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);
}
}
closedir(input_dir);
-
+
if (!mouse_handled)
{
if (ecore_fb_ts_init())
NULL,
NULL,
NULL, //transparent
-
- NULL // render
+
+ NULL, // render
+ NULL // screen_geometry_get
};
#endif
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);
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
#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
_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();
NULL,
NULL,
NULL, //transparent
-
- NULL // render
+
+ NULL, // render
+ NULL // screen_geometry_get
};
static Ecore_Evas*
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);
_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);
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 */
(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;
}
_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);
NULL, /* _ecore_evas_x_ignore_events_set */
NULL, /* _ecore_evas_x_alpha_set */
NULL, //transparent
-
- NULL // render
+
+ NULL, // render
+ NULL // screen_geometry_get
};
/* API */
#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"
{
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);
}
if (opt)
{
int op;
-
+
for (op = 0; opt[op]; op++)
{
if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT)
}
}
}
-
+
/* FIXME: this is inefficient as its 1 or more round trips */
screen = DefaultScreen(ecore_x_display_get());
if (ScreenCount(ecore_x_display_get()) > 1)
}
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) ||
return 0;
}
}
-
+
attr.backing_store = NotUseful;
attr.override_redirect = override;
attr.colormap = einfo->info.colormap;
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;
(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);
((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 */
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)
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 */
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))
else
{
int w, h;
-
+
ecore_x_window_size_get(ee->prop.window, &w, &h);
if ((rotation == 0) || (rotation == 180))
{
_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
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);
}
}
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)
static void
_ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent)
{
- if (((ee->transparent) && (transparent)) ||
+ if (((ee->transparent) && (transparent)) ||
((!ee->transparent) && (!transparent)))
return;
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 */
}
}
+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)
{
_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 */
}
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;
}
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 # */
return NULL;
}
}
-
+
ecore_x_icccm_hints_set(ee->prop.window,
1 /* accepts_focus */,
ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */,
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;
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)
{
return;
ee = NULL;
win = 0;
-#endif
+#endif
}
EAPI Ecore_X_Window
#else
return 0;
ee = NULL;
-#endif
+#endif
}
EAPI void
#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)
}
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)
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore_fb.la
{
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();
*/
EAPI int
ecore_fb_shutdown(void)
-{
+{
if (--_ecore_fb_init_count != 0)
return _ecore_fb_init_count;
{
struct fb_var_screeninfo fb_var;
int fb;
-
+
fb = open("/dev/fb0", O_RDWR);
if (fb < 0)
{
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;
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;
_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);
_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;
/* 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]);
{
/* 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]);
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,
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;
* @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)
{
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)
}
return 1;
}
- return 0;
+ return 0;
}
void
static double last_time = 0;
static double last_last_time = 0;
int v = 0;
-
+
do
{
int x, y, button, i;
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;
{
/* 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;
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;
{
/* 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;
last_last_time = last_time;
last_time = t;
}
- retry:
+ retry:
prev_x = x;
prev_y = y;
prev_button = button;
/**
* 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.
unsigned short pressure;
unsigned short x;
unsigned short y;
- unsigned short _unused;
+ unsigned short _unused;
};
struct _Ecore_Fb_Ts_Calibrate
{
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 ) );
#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);
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;
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)
{
static double last_time = 0;
static double last_last_time = 0;
int v = 0;
-
+
do
{
int x, y, pressure;
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;
{
/* 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;
{
/* 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;
last_last_time = last_time;
last_time = t;
}
-retry:
+retry:
prev_x = x;
prev_y = y;
prev_pressure = pressure;
_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)
{
_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);
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");
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;
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)
{
ecore_fb_vt_init(void)
{
struct vt_stat vtstat;
-
+
/* as root you can allocate another tty */
if (!geteuid())
_ecore_fb_vt_do_switch = 1;
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");
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;
}
{
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;
}
_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)
_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);
}
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore_file.la
{
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)
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;
}
* 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)
* @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
* 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)
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);
return 0;
}
}
-
+
closedir(dirp);
return 1;
}
* 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
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)
ecore_file_monitor_inotify_shutdown();
ecore_file_monitor_inotify_init();
}
-
+
em = calloc(1, sizeof(Ecore_File_Monitor_Inotify));
if (!em) return NULL;
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)
{
{
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;
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 */
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];
* @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.
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);
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
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;
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;
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
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);
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);
/* 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);
}
/**
+ * 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
}
/**
- * 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
}
/**
- * 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
}
/**
- * 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.
}
/**
- * 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.
*
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
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
{
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)
{
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
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);
}
}
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;
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;
}
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++)
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;
}
+++ /dev/null
-.deps
-.libs
-Ecore_Ipc.h
-Makefile
-Makefile.in
-ecore_ipc.lo
-libecore_ipc.la
# 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
#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
-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
# include <winsock2.h>
#endif
-#include "Ecore.h"
-#include "ecore_private.h"
-#include "Ecore_Con.h"
-#include "ecore_ipc_private.h"
+#if USE_GNUTLS_OPENSSL
+# include <gnutls/openssl.h>
+#elif USE_OPENSSL
+# include <openssl/ssl.h>
+#endif
+
+#include <Ecore.h>
+#include <ecore_private.h>
+#include <Ecore_Con.h>
+
#include "Ecore_Ipc.h"
+#include "ecore_ipc_private.h"
#define DLT_ZERO 0
#define DLT_ONE 1
#endif
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_ipc_log_dom, __VA_ARGS__)
-#if USE_GNUTLS_OPENSSL
-# include <gnutls/openssl.h>
-#elif USE_OPENSSL
-# include <openssl/ssl.h>
-#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
int ref_to;
int response;
int size;
-}
-#ifdef _GNU_C_
-__attribute__ ((packed));
-#endif
-;
+} ECORE_IPC_STRUCT_PACKED;
#ifdef __sgi
#pragma pack 0
#endif
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
+++ /dev/null
-.libs
-.deps
-Makefile
-Makefile.in
-*.lo
-*.la
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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();
INF("moue move message");
- w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWL_USERDATA);
+ w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA);
if (w->drag.dragging)
{
{
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);
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;
}
* @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.
*/
}
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);
}
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);
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)
{
INF("mouse button released");
- window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA);
+ window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
{
Ecore_Event_Mouse_Move *e;
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);
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;
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 ;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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);
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)
{
}
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);
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);
}
{
if (!window) return NULL;
- return ((Ecore_Win32_Window *)window)->window;
+ return 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))
int height)
{
RECT rect;
- Ecore_Win32_Window *w;
DWORD style;
int x;
int y;
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;
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;
return;
}
- if (!MoveWindow(w->window, x, y,
+ if (!MoveWindow(window->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
TRUE))
int height)
{
RECT rect;
- Ecore_Win32_Window *w;
DWORD style;
int minimal_width;
int minimal_height;
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;
return;
}
- if (!MoveWindow(w->window, x, y,
+ if (!MoveWindow(window->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
TRUE))
return;
}
- if (!GetClientRect(((Ecore_Win32_Window *)window)->window,
- &rect))
+ if (!GetClientRect(window->window, &rect))
{
ERR("GetClientRect() failed");
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");
return;
}
- if (!GetClientRect(((Ecore_Win32_Window *)window)->window,
- &rect))
+ if (!GetClientRect(window->window, &rect))
{
ERR("GetClientRect() failed");
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;
}
/**
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;
}
/**
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;
}
/**
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;
}
/**
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;
}
/**
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;
}
/**
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;
}
/**
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
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");
#endif
}
else
- if (!SetWindowRgn(wnd->window, NULL, TRUE))
+ if (!SetWindowRgn(window->window, NULL, TRUE))
{
ERR("SetWindowRgn() failed");
}
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
return;
}
}
- if (!SetWindowRgn(wnd->window, rgn, TRUE))
+ if (!SetWindowRgn(window->window, rgn, TRUE))
{
ERR("SetWindowRgn() failed");
}
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");
}
INF("hiding window");
- ShowWindow(((Ecore_Win32_Window *)window)->window, SW_HIDE);
+ ShowWindow(window->window, SW_HIDE);
}
/**
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))
{
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))
{
INF("setting window title");
- if (!SetWindowText(((Ecore_Win32_Window *)window)->window, title))
+ if (!SetWindowText(window->window, title))
{
ERR("SetWindowText() failed");
}
INF("focusing window");
- if (!SetFocus(((Ecore_Win32_Window *)window)->window))
+ if (!SetFocus(window->window))
{
ERR("SetFocus() failed");
}
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;
}
/**
{
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;
}
else
{
- if (!GetWindowRect(w, &rect))
+ if (!GetWindowRect(window->window, &rect))
{
ERR("GetWindowRect() failed");
return;
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))
ERR("SetWindowPos() failed");
return;
}
- ew->borderless = on;
+
+ window->borderless = on;
}
/**
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");
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");
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");
}
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 */
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;
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))
}
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))
}
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;
break;
}
- if (!MoveWindow(w, 0, 0,
+ if (!MoveWindow(window->window, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
rect.bottom - rect.top,
TRUE))
}
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))
}
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))
}
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 */
* @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.
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;
}
}
+++ /dev/null
-.libs
-.deps
-Makefile
-Makefile.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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
/**
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 */
};
INF("destroying window");
- DestroyWindow(((Ecore_WinCE_Window *)window)->window);
+ DestroyWindow(window->window);
free(window);
}
if (!window)
return NULL;
- return ((Ecore_WinCE_Window *)window)->window;
+ return 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))
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;
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;
return;
}
- if (!MoveWindow(w->window, x, y,
+ if (!MoveWindow(window->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
FALSE))
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;
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");
}
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");
}
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");
}
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");
}
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;
}
/**
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;
}
/**
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;
}
/**
return;
}
- if (!GetClientRect(((Ecore_WinCE_Window *)window)->window,
- &rect))
+ if (!GetClientRect(window->window, &rect))
{
ERR("GetClientRect() failed");
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");
return;
}
- if (!GetClientRect(((Ecore_WinCE_Window *)window)->window,
- &rect))
+ if (!GetClientRect(window->window, &rect))
{
ERR("GetClientRect() failed");
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;
}
/* 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");
* 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");
}
/* 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");
* 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");
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore_x.la
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"
#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,
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);
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);
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);
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
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore_x_xcb.la
} /* 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
+++ /dev/null
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-libecore_x_xlib.la
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 \
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 = \
@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
/**
* 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)
} /* 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
{
int i, shuffle = 0;
Window *t;
-
+
if (_ecore_window_grabs_num > 0)
{
for (i = 0; i < _ecore_window_grabs_num; i++)
{
int i, shuffle = 0;
Window *t;
-
+
if (_ecore_key_grabs_num > 0)
{
for (i = 0; i < _ecore_key_grabs_num; i++)
}
# endif
}
-# endif
+# endif
}
#endif
} /* _ecore_x_composite_init */
_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;
* @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;
* @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;
* @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;
&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;
&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;
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 */
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) &&
_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) &&
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
{
Ecore_X_Event_Selection_Request *e;
Ecore_X_Selection_Intern *sd;
- void *data;
+ void *data = NULL;
int len;
int typesize;
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 */
&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(
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];
{
WRN("DND: Requested version %d, we only support up to %d",
target->version, ECORE_X_DND_VERSION);
+ free(e);
return;
}
{
WRN(
"DND: Could not fetch data type list from source window, aborting.");
+ free(e);
return;
}
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;
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;
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;
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];
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;
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))
{
}
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
- if (!e)
- return;
+ if (!e) return;
e->win = source->win;
e->target = source->dest;
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)
_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));
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;
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 */
{
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) &&
{
#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;
}
int mode = 0;
sbpp *= 8;
-
+
n = vis->map_entries;
if ((n <= 256) &&
((vis->class == PseudoColor) ||
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) &&
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)
{
return Ecore_X_Randr_Unset;
}
-#else
+#else
return -1;
#endif
}
#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"
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;
}
if (crtc_info)
XRRFreeCrtcInfo(crtc_info);
-
+
if (res)
XRRFreeScreenResources(res);
}
if (crtc_info)
XRRFreeCrtcInfo(crtc_info);
-
+
if (res)
XRRFreeScreenResources(res);
-
+
return ret;
#else
return Ecore_X_Randr_None;
* @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);
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.
*
* @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();
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++)
{
#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);
+}
--- /dev/null
+/*
+ * 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 <ajax@nwnk.net> */
+/* Heavily modified by: Leif Middelschulte <leif.middelschulte@gmail.com> */
+
+#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;
+}
XFree(xss);
return idle;
-#else
+#else
return 0;
#endif /* ifdef ECORE_XSS */
} /* ecore_x_screensaver_idle_time_get */
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);
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);
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* ifdef HAVE_CONFIG_H */
+
+#include "Ecore.h"
+#include "ecore_x_private.h"
+#include "Ecore_X.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#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
+}
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__);
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);
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,
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)
{
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,
#else
return;
win = shape_win = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_window_set */
EAPI void
int x,
int y)
{
-#ifdef ShapeInput
+#ifdef ShapeInput
LOGFN(__FILE__, __LINE__, __FUNCTION__);
XShapeCombineShape(_ecore_x_disp,
win,
#else
return;
win = shape_win = x = y = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_window_set_xy */
EAPI void
#else
return;
win = x = y = w = h = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_rectangle_set */
EAPI void
#else
return;
win = rects = num = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_rectangles_set */
EAPI void
int w,
int h)
{
-#ifdef ShapeInput
+#ifdef ShapeInput
XRectangle rect;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#else
return;
win = x = y = w = h = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_rectangle_subtract */
EAPI void
#else
return;
win = shape_win = x = y = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_window_add_xy */
EAPI void
int w,
int h)
{
-#ifdef ShapeInput
+#ifdef ShapeInput
XRectangle rect;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#else
return;
win = x = y = w = h = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_rectangle_add */
EAPI void
#else
return;
win = x = y = w = h = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_rectangle_clip */
EAPI void
rect[i].height = rects[i].height;
}
}
-
+
XShapeCombineRectangles(_ecore_x_disp,
win,
- ShapeBounding,
+ ShapeInput,
0,
0,
rect,
#else
return;
win = rects = num = 0;
-#endif
+#endif
} /* ecore_x_window_shape_input_rectangles_add */
EAPI Ecore_X_Rectangle *
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__);
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