forked from enlightenment/efl
add windows support to ecore. ecore_evas is ported too (directdraw and direct3d. No opengl yet). It needs to be tested a lot, though. Remove some trailing spaces here and there. Replace WIN32 with _WIN32
SVN revision: 31513
This commit is contained in:
parent
1bd182b2f1
commit
50432552c8
|
@ -21,6 +21,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
|
|||
ecore-job.pc \
|
||||
ecore-txt.pc \
|
||||
ecore-x.pc \
|
||||
ecore-win32.pc \
|
||||
ecore-sdl.pc \
|
||||
ecore.pc
|
||||
|
||||
|
@ -40,6 +41,7 @@ EXTRA_DIST = AUTHORS COPYING COPYING-PLAIN ecore.c.in gendoc ecore.supp \
|
|||
ecore-job.pc.in \
|
||||
ecore-txt.pc.in \
|
||||
ecore-x.pc.in \
|
||||
ecore-win32.pc.in \
|
||||
ecore-sdl.pc.in \
|
||||
ecore.spec.in ecore.spec \
|
||||
debian/changelog \
|
||||
|
@ -105,6 +107,11 @@ if BUILD_ECORE_X
|
|||
px = ecore-x.pc
|
||||
endif
|
||||
|
||||
if BUILD_ECORE_WIN32
|
||||
pwin32 = ecore-win32.pc
|
||||
endif
|
||||
|
||||
|
||||
if BUILD_ECORE_SDL
|
||||
psdl = ecore-sdl.pc
|
||||
endif
|
||||
|
@ -116,4 +123,5 @@ endif
|
|||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = \
|
||||
ecore.pc $(pcon) $(pconfig) $(pdfb) $(pevas) \
|
||||
$(pfb) $(pfile) $(pdesktop) $(pipc) $(pjob) $(ptxt) $(px) $(psdl)
|
||||
$(pfb) $(pfile) $(pdesktop) $(pipc) $(pjob) $(ptxt) \
|
||||
$(px) $(pwin32) $(psdl)
|
||||
|
|
|
@ -17,7 +17,7 @@ AC_CHECK_SIZEOF(long, 4)
|
|||
AM_ENABLE_SHARED
|
||||
AM_PROG_LIBTOOL
|
||||
AC_C___ATTRIBUTE__
|
||||
|
||||
|
||||
if test "x${bindir}" = 'xNONE'; then
|
||||
if test "x${prefix}" = "xNONE"; then
|
||||
PACKAGE_BIN_DIR="${ac_default_prefix}/bin"
|
||||
|
@ -28,7 +28,7 @@ else
|
|||
PACKAGE_BIN_DIR="${bindir}"
|
||||
fi
|
||||
AC_SUBST(PACKAGE_BIN_DIR)
|
||||
|
||||
|
||||
if test "x${libdir}" = 'xNONE'; then
|
||||
if test "x${prefix}" = "xNONE"; then
|
||||
PACKAGE_LIB_DIR="${ac_default_prefix}/lib"
|
||||
|
@ -72,6 +72,7 @@ requirements_ecore_ipc=""
|
|||
requirements_ecore_job=""
|
||||
requirements_ecore_txt=""
|
||||
requirements_ecore_x=""
|
||||
requirements_ecore_win32=""
|
||||
requirements_ecore_sdl=""
|
||||
|
||||
dnl The first call to PKG_CHECK_MODULES is done conditionally,
|
||||
|
@ -115,7 +116,7 @@ if test "x$have_iconv" = "xno" ; then
|
|||
have_iconv="yes"
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
if test "x$have_iconv" != "xyes"; then
|
||||
AC_CHECK_LIB(iconv, iconv,
|
||||
[
|
||||
|
@ -285,7 +286,7 @@ if test "x$have_ecore_x" = "xyes"; then
|
|||
|
||||
AC_SUBST(Xcursor_cflags)
|
||||
AC_SUBST(Xcursor_libs)
|
||||
|
||||
|
||||
ECORE_CHECK_X_EXTENSION([Xdamage], [Xdamage.h], [Xdamage], [XDamageSubtract])
|
||||
ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xdpms], [DPMSQueryExtension])
|
||||
if test "x$use_xdpms" = "xno" ; then
|
||||
|
@ -303,6 +304,31 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(ddraw.h,
|
||||
[ have_ddraw="yes"
|
||||
AC_DEFINE(HAVE_DIRECTDRAW, 1, [Build Ecore_Win32 with DirectDraw Code])
|
||||
ddraw_libs="-lddraw -ldxguid" ],
|
||||
[ have_ddraw="no" ]
|
||||
)
|
||||
AC_SUBST(ddraw_libs)
|
||||
|
||||
AC_CHECK_HEADERS(d3d9.h d3dx9.h,
|
||||
[ have_direct3d="yes"
|
||||
AC_DEFINE(HAVE_DIRECT3D, 1, [Build Ecore_Win32 with Direct3D Code])
|
||||
direct3d_libs="-ld3d9 -ld3dx9d" ],
|
||||
[ have_direct3d="no" ]
|
||||
)
|
||||
AC_SUBST(direct3d_libs)
|
||||
|
||||
have_win32="no"
|
||||
if test "x${have_ddraw}" = "xyes" -o "x${have_direct3d}" = "xyes"; then
|
||||
have_win32="yes"
|
||||
fi
|
||||
|
||||
ECORE_CHECK_MODULE([Win32], [no], [$have_win32],
|
||||
[ecore_win32_libs="$ecore_win32_libs $ddraw_libs $direct3d_libs"])
|
||||
|
||||
|
||||
ECORE_CHECK_MODULE([Job], [yes])
|
||||
|
||||
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
|
||||
|
@ -462,7 +488,7 @@ AC_MSG_CHECKING(whether ecore_evas DirectFB support is to be built)
|
|||
AC_ARG_ENABLE(ecore-evas-dfb,
|
||||
[ --disable-ecore-evas-dfb disable DirectFB in the ecore_evas module],
|
||||
[
|
||||
if test "x$enableval" = "xno" ; then
|
||||
if test "x$enableval" = "xno" ; then
|
||||
want_ecore_evas_dfb=no
|
||||
else
|
||||
want_ecore_evas_dfb=yes
|
||||
|
@ -496,10 +522,10 @@ want_ecore_evas_fb="no";
|
|||
have_ecore_evas_fb="no";
|
||||
|
||||
AC_MSG_CHECKING(whether ecore_evas fb support is to be built)
|
||||
AC_ARG_ENABLE(ecore-evas-fb,
|
||||
AC_ARG_ENABLE(ecore-evas-fb,
|
||||
[ --enable-ecore-evas-fb enable fb in the ecore_evas module],
|
||||
[
|
||||
if test x"$enableval" = x"yes" ; then
|
||||
if test x"$enableval" = x"yes" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
want_ecore_evas_fb="yes"
|
||||
else
|
||||
|
@ -582,10 +608,10 @@ want_ecore_evas_buffer="yes";
|
|||
have_ecore_evas_buffer="no";
|
||||
|
||||
AC_MSG_CHECKING(whether ecore_evas buffer support is to be built)
|
||||
AC_ARG_ENABLE(ecore-evas-buffer,
|
||||
AC_ARG_ENABLE(ecore-evas-buffer,
|
||||
[ --disable-ecore-evas-buffer disable buffer in the ecore_evas module],
|
||||
[
|
||||
if test x"$enableval" = x"yes" ; then
|
||||
if test x"$enableval" = x"yes" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
@ -672,10 +698,10 @@ use_curl="yes"
|
|||
if test "x$have_ecore_file" = "xyes"; then
|
||||
dnl We need to check if the right inotify version is accessible
|
||||
AC_MSG_CHECKING(whether inotify is to be used for filemonitoring)
|
||||
AC_ARG_ENABLE(inotify,
|
||||
AC_ARG_ENABLE(inotify,
|
||||
[ --disable-inotify disable inotify in the ecore_file module],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
@ -685,7 +711,7 @@ if test "x$have_ecore_file" = "xyes"; then
|
|||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
dnl It's hard to find a good test on how to check the correct
|
||||
dnl inotify version. They changed the headers a lot.
|
||||
dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls
|
||||
|
@ -708,16 +734,16 @@ if test "x$have_ecore_file" = "xyes"; then
|
|||
], [
|
||||
use_inotify="no"
|
||||
]
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
#AC_MSG_CHECKING(whether FAM is to be used for filemonitoring)
|
||||
#AC_ARG_ENABLE(fam,
|
||||
#AC_ARG_ENABLE(fam,
|
||||
# [ --enable-fam enable fam in the ecore_file module],
|
||||
# [
|
||||
# if test "$enableval" = "yes"; then
|
||||
# if test "$enableval" = "yes"; then
|
||||
# AC_MSG_RESULT(yes)
|
||||
# use_fam="yes"
|
||||
# else
|
||||
|
@ -727,7 +753,7 @@ if test "x$have_ecore_file" = "xyes"; then
|
|||
# AC_MSG_RESULT(no)
|
||||
# ]
|
||||
#)
|
||||
|
||||
|
||||
fam_libs=""
|
||||
#if test "x$use_fam" = "xyes"; then
|
||||
# AC_CHECK_LIB(fam, FAMOpen,
|
||||
|
@ -740,12 +766,12 @@ if test "x$have_ecore_file" = "xyes"; then
|
|||
# ]
|
||||
# )
|
||||
#fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether polling is to be used for filemonitoring)
|
||||
AC_ARG_ENABLE(poll,
|
||||
AC_ARG_ENABLE(poll,
|
||||
[ --disable-poll disable poll in the ecore_file module],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
@ -755,27 +781,27 @@ if test "x$have_ecore_file" = "xyes"; then
|
|||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
if test "x$use_poll" = "xyes"; then
|
||||
AC_DEFINE(HAVE_POLL, 1, [ File monitoring with polling ])
|
||||
fi
|
||||
|
||||
|
||||
use_curl="yes"
|
||||
AC_MSG_CHECKING(whether CURL is to be used for file download)
|
||||
AC_ARG_ENABLE(curl,
|
||||
AC_ARG_ENABLE(curl,
|
||||
[ --disable-curl disable curl in the ecore_file module],
|
||||
[
|
||||
if test "$enableval" = "yes"; then
|
||||
if test "$enableval" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
use_curl="no"
|
||||
use_curl="no"
|
||||
fi
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
if test "x$use_curl" = "xyes"; then
|
||||
PKG_CHECK_MODULES(CURL, libcurl,
|
||||
[
|
||||
|
@ -837,6 +863,7 @@ ecore-ipc.pc
|
|||
ecore-job.pc
|
||||
ecore-txt.pc
|
||||
ecore-x.pc
|
||||
ecore-win32.pc
|
||||
ecore-sdl.pc
|
||||
ecore.pc
|
||||
src/Makefile
|
||||
|
@ -855,6 +882,7 @@ src/lib/ecore_config/Makefile
|
|||
src/lib/ecore_file/Makefile
|
||||
src/lib/ecore_desktop/Makefile
|
||||
src/lib/ecore_directfb/Makefile
|
||||
src/lib/ecore_win32/Makefile
|
||||
README
|
||||
ecore.spec
|
||||
debian/changelog
|
||||
|
@ -873,13 +901,15 @@ echo " Ecore_X (XCB backend)........: $have_ecore_x_xcb (Xprint: $have_ecore_x_
|
|||
else
|
||||
echo " Ecore_X (Xlib backend).......: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_xprint) (Xinerama: $use_xinerama) (Xrandr: $use_xrandr) (Xscreensaver: $use_xss) (Xrender: $use_xrender) (Xfixes: $use_xfixes) (Xdamage: $use_xdamage) (Xdpms: $use_xdpms)"
|
||||
fi
|
||||
echo " Ecore_Win32..................: $have_ecore_win32 (DirectDraw: ${have_ddraw}) (Direct3D: ${have_direct3d})"
|
||||
|
||||
echo " Ecore_FB.....................: $have_ecore_fb"
|
||||
echo " Ecore_DFB....................: $have_ecore_directfb"
|
||||
echo " Ecore_SDL....................: $have_ecore_sdl"
|
||||
echo " Ecore_Evas...................: $have_ecore_evas"
|
||||
echo " Ecore_Evas GL Support........: $have_ecore_evas_gl"
|
||||
echo " Ecore_Evas XRender Support...: $have_ecore_evas_xrender"
|
||||
echo " Ecore_Evas X11 16bpp Support.: $have_ecore_evas_16_x11"
|
||||
echo " Ecore_Evas X11 16bpp Support.: $have_ecore_evas_x11_16"
|
||||
echo " Ecore_Evas FB Support........: $have_ecore_evas_fb"
|
||||
echo " Ecore_Evas SDL Support.......: $have_ecore_evas_sdl"
|
||||
echo " Ecore_Evas DFB Support.......: $have_ecore_evas_dfb"
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: ecore-win32
|
||||
Description: E core library, Win32 module
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lecore_win32
|
||||
Libs.private: @ddraw_libs@ @direct3d_libs@
|
||||
Cflags: -I${includedir}
|
|
@ -7,6 +7,7 @@ ecore_fb \
|
|||
ecore_directfb \
|
||||
ecore_con \
|
||||
ecore_x \
|
||||
ecore_win32 \
|
||||
ecore_sdl \
|
||||
ecore_ipc \
|
||||
ecore_evas \
|
||||
|
|
|
@ -74,7 +74,7 @@ extern "C" {
|
|||
EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */
|
||||
EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */
|
||||
|
||||
#ifndef _ECORE_PRIVATE_H
|
||||
#ifndef _ECORE_PRIVATE_H
|
||||
enum _Ecore_Fd_Handler_Flags
|
||||
{
|
||||
ECORE_FD_READ = 1, /**< Fd Read mask */
|
||||
|
@ -82,7 +82,7 @@ extern "C" {
|
|||
ECORE_FD_ERROR = 4 /**< Fd Error mask */
|
||||
};
|
||||
typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
|
||||
|
||||
|
||||
enum _Ecore_Exe_Flags /* flags for executing a child with its stdin and/or stdout piped back */
|
||||
{
|
||||
|
||||
|
@ -96,8 +96,8 @@ extern "C" {
|
|||
ECORE_EXE_USE_SH = 128 /**< Use /bin/sh to run the command. */
|
||||
};
|
||||
typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef void Ecore_Exe; /**< A handle for spawned processes */
|
||||
#endif
|
||||
typedef void Ecore_Timer; /**< A handle for timers */
|
||||
|
@ -120,7 +120,7 @@ extern "C" {
|
|||
typedef struct _Ecore_Exe_Event_Data_Line Ecore_Exe_Event_Data_Line; /**< Lines from a child process */
|
||||
typedef struct _Ecore_Exe_Event_Data Ecore_Exe_Event_Data; /**< Data from a child process */
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
#endif
|
||||
|
||||
struct _Ecore_Event_Signal_User /** User signal event */
|
||||
|
@ -128,20 +128,20 @@ extern "C" {
|
|||
int number; /**< The signal number. Either 1 or 2 */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct _Ecore_Event_Signal_Hup /** Hup signal event */
|
||||
{
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
struct _Ecore_Event_Signal_Exit /** Exit request event */
|
||||
{
|
||||
int interrupt : 1; /**< Set if the exit request was an interrupt signal*/
|
||||
|
@ -149,7 +149,7 @@ extern "C" {
|
|||
int terminate : 1; /**< Set if the exit request was a terminate singal */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
@ -158,7 +158,7 @@ extern "C" {
|
|||
{
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
@ -167,12 +167,12 @@ extern "C" {
|
|||
{
|
||||
int num; /**< The realtime signal's number */
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
struct _Ecore_Exe_Event_Add /** Process add event */
|
||||
{
|
||||
Ecore_Exe *exe; /**< The handle to the added process */
|
||||
|
@ -205,10 +205,10 @@ extern "C" {
|
|||
Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
EAPI int ecore_init(void);
|
||||
EAPI int ecore_shutdown(void);
|
||||
|
||||
|
||||
EAPI void ecore_app_args_set(int argc, const char **argv);
|
||||
EAPI void ecore_app_args_get(int *argc, char ***argv);
|
||||
EAPI void ecore_app_restart(void);
|
||||
|
@ -222,9 +222,9 @@ extern "C" {
|
|||
EAPI void *ecore_event_filter_del(Ecore_Event_Filter *ef);
|
||||
EAPI int ecore_event_current_type_get(void);
|
||||
EAPI void *ecore_event_current_event_get(void);
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
EAPI Ecore_Exe *ecore_exe_run(const char *exe_cmd, const void *data);
|
||||
EAPI Ecore_Exe *ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data);
|
||||
EAPI int ecore_exe_send(Ecore_Exe *exe, void *data, int size);
|
||||
|
@ -245,10 +245,10 @@ extern "C" {
|
|||
EAPI void ecore_exe_signal(Ecore_Exe *exe, int num);
|
||||
EAPI void ecore_exe_hup(Ecore_Exe *exe);
|
||||
#endif
|
||||
|
||||
|
||||
EAPI Ecore_Idler *ecore_idler_add(int (*func) (void *data), const void *data);
|
||||
EAPI void *ecore_idler_del(Ecore_Idler *idler);
|
||||
|
||||
|
||||
EAPI Ecore_Idle_Enterer *ecore_idle_enterer_add(int (*func) (void *data), const void *data);
|
||||
EAPI void *ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer);
|
||||
|
||||
|
@ -264,18 +264,18 @@ extern "C" {
|
|||
EAPI int ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler);
|
||||
EAPI int ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
|
||||
EAPI void ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags);
|
||||
|
||||
|
||||
EAPI double ecore_time_get(void);
|
||||
|
||||
|
||||
EAPI Ecore_Timer *ecore_timer_add(double in, int (*func) (void *data), const void *data);
|
||||
EAPI void *ecore_timer_del(Ecore_Timer *timer);
|
||||
EAPI void ecore_timer_interval_set(Ecore_Timer *timer, double in);
|
||||
|
||||
|
||||
EAPI Ecore_Animator *ecore_animator_add(int (*func) (void *data), const void *data);
|
||||
EAPI void *ecore_animator_del(Ecore_Animator *animator);
|
||||
EAPI void ecore_animator_frametime_set(double frametime);
|
||||
EAPI double ecore_animator_frametime_get(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#include <locale.h>
|
||||
#ifndef WIN32
|
||||
#include <langinfo.h>
|
||||
#endif /* WIN32 */
|
||||
#ifndef _WIN32
|
||||
# include <langinfo.h>
|
||||
#endif /* _WIN32 */
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore.h"
|
||||
|
||||
static const char *_ecore_magic_string_get(Ecore_Magic m);
|
||||
static int _ecore_init_count = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
int _ecore_fps_debug = 0;
|
||||
#endif
|
||||
|
||||
|
@ -17,23 +17,23 @@ int _ecore_fps_debug = 0;
|
|||
*/
|
||||
|
||||
#ifndef CODESET
|
||||
#define CODESET "INVALID"
|
||||
# define CODESET "INVALID"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set up connections, signal handlers, sockets etc.
|
||||
* @return 1 or greater on success, 0 otherwise
|
||||
*
|
||||
*
|
||||
* This function sets up all singal handlers and the basic event loop. If it
|
||||
* succeeds, 1 will be returned, otherwise 0 will be returned.
|
||||
*
|
||||
*
|
||||
* @code
|
||||
* #include <Ecore.h>
|
||||
*
|
||||
*
|
||||
* int main(int argc, char **argv)
|
||||
* {
|
||||
* if (!ecore_init())
|
||||
* {
|
||||
* {
|
||||
* printf("ERROR: Cannot init Ecore!\n");
|
||||
* return -1;
|
||||
* }
|
||||
|
@ -53,8 +53,8 @@ ecore_init(void)
|
|||
{
|
||||
printf("WARNING: not a utf8 locale!\n");
|
||||
}
|
||||
*/
|
||||
#ifndef WIN32
|
||||
*/
|
||||
#ifndef _WIN32
|
||||
if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
|
||||
if (_ecore_fps_debug) _ecore_fps_debug_init();
|
||||
_ecore_signal_init();
|
||||
|
@ -67,11 +67,11 @@ ecore_init(void)
|
|||
|
||||
/**
|
||||
* Shut down connections, signal handlers sockets etc.
|
||||
*
|
||||
*
|
||||
* This function shuts down all things set up in ecore_init() and cleans up all
|
||||
* event queues, handlers, filters, timers, idlers, idle enterers/exiters
|
||||
* etc. set up after ecore_init() was called.
|
||||
*
|
||||
*
|
||||
* Do not call this function from any callback that may be called from the main
|
||||
* loop, as the main loop will then fall over and not function properly.
|
||||
*/
|
||||
|
@ -81,11 +81,11 @@ ecore_shutdown(void)
|
|||
if (--_ecore_init_count)
|
||||
return _ecore_init_count;
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
|
||||
#endif
|
||||
_ecore_animator_shutdown();
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
_ecore_exe_shutdown();
|
||||
#endif
|
||||
_ecore_idle_enterer_shutdown();
|
||||
|
@ -94,7 +94,7 @@ ecore_shutdown(void)
|
|||
_ecore_timer_shutdown();
|
||||
_ecore_event_shutdown();
|
||||
_ecore_main_shutdown();
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
_ecore_signal_shutdown();
|
||||
#endif
|
||||
|
||||
|
@ -104,7 +104,7 @@ ecore_shutdown(void)
|
|||
EAPI void
|
||||
_ecore_magic_fail(void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname)
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"\n"
|
||||
"*** ECORE ERROR: Ecore Magic Check Failed!!!\n"
|
||||
"*** IN FUNCTION: %s()\n", fname);
|
||||
|
@ -118,7 +118,7 @@ _ecore_magic_fail(void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname)
|
|||
" Supplied: %08x - %s\n",
|
||||
(unsigned int)req_m, _ecore_magic_string_get(req_m),
|
||||
(unsigned int)m, _ecore_magic_string_get(m));
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"*** NAUGHTY PROGRAMMER!!!\n"
|
||||
"*** SPANK SPANK SPANK!!!\n"
|
||||
"*** Now go fix your code. Tut tut tut!\n"
|
||||
|
@ -164,7 +164,7 @@ _ecore_magic_string_get(Ecore_Magic m)
|
|||
return "<UNKNOWN>";
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
/* fps debug calls - for debugging how much time your app actually spends */
|
||||
/* "running" (and the inverse being time spent running)... this does not */
|
||||
/* account for other apps and multitasking... */
|
||||
|
@ -177,7 +177,7 @@ void
|
|||
_ecore_fps_debug_init(void)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
|
||||
_ecore_fps_debug_init_count++;
|
||||
if (_ecore_fps_debug_init_count > 1) return;
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_fps_debug-%i", (int)getpid());
|
||||
|
@ -190,7 +190,7 @@ _ecore_fps_debug_init(void)
|
|||
if (_ecore_fps_debug_fd >= 0)
|
||||
{
|
||||
unsigned int zero = 0;
|
||||
|
||||
|
||||
write(_ecore_fps_debug_fd, &zero, sizeof(unsigned int));
|
||||
_ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int),
|
||||
PROT_READ | PROT_WRITE,
|
||||
|
@ -207,7 +207,7 @@ _ecore_fps_debug_shutdown(void)
|
|||
if (_ecore_fps_debug_fd >= 0)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_fps_debug-%i", (int)getpid());
|
||||
unlink(buf);
|
||||
if (_ecore_fps_runtime_mmap)
|
||||
|
@ -223,11 +223,11 @@ _ecore_fps_debug_shutdown(void)
|
|||
void
|
||||
_ecore_fps_debug_runtime_add(double t)
|
||||
{
|
||||
if ((_ecore_fps_debug_fd >= 0) &&
|
||||
if ((_ecore_fps_debug_fd >= 0) &&
|
||||
(_ecore_fps_runtime_mmap))
|
||||
{
|
||||
unsigned int tm;
|
||||
|
||||
|
||||
tm = (unsigned int)(t * 1000000.0);
|
||||
/* i know its not 100% theoretically guaranteed, but i'd say a write */
|
||||
/* of an int could be considered atomic for all practical purposes */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <errno.h>
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
# include <sys/wait.h>
|
||||
#endif /* HAVE_SYS_WAIT_H */
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
|
||||
/* TODO: Something to let people build a command line and does auto escaping -
|
||||
*
|
||||
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
* cmd = ecore_exe_comand_parameter_append(cmd, "firefox");
|
||||
* cmd = ecore_exe_comand_parameter_append(cmd, "http://www.foo.com/bar.html?baz=yes");
|
||||
* each parameter appended is one argument, and it gets escaped, quoted, and
|
||||
* each parameter appended is one argument, and it gets escaped, quoted, and
|
||||
* appended with a preceeding space. The first is the command off course.
|
||||
*/
|
||||
|
||||
|
@ -262,12 +262,12 @@ ecore_exe_run(const char *exe_cmd, const void *data)
|
|||
* This function does the same thing as ecore_exe_run(), but also makes the
|
||||
* standard in and/or out as wel las stderr from the child process available
|
||||
* for reading or writing. To write use ecore_exe_send(). To read listen to
|
||||
* ECORE_EXE_EVENT_DATA or ECORE_EXE_EVENT_ERROR events (set up handlers).
|
||||
* Ecore may buffer read and error data until a newline character if asked
|
||||
* for with the @p flags. All data will be included in the events (newlines
|
||||
* will be replaced with NULLS if line buffered). ECORE_EXE_EVENT_DATA events
|
||||
* will only happen if the process is run with ECORE_EXE_PIPE_READ enabled
|
||||
* in the flags. The same with the error version. Writing will only be
|
||||
* ECORE_EXE_EVENT_DATA or ECORE_EXE_EVENT_ERROR events (set up handlers).
|
||||
* Ecore may buffer read and error data until a newline character if asked
|
||||
* for with the @p flags. All data will be included in the events (newlines
|
||||
* will be replaced with NULLS if line buffered). ECORE_EXE_EVENT_DATA events
|
||||
* will only happen if the process is run with ECORE_EXE_PIPE_READ enabled
|
||||
* in the flags. The same with the error version. Writing will only be
|
||||
* allowed with ECORE_EXE_PIPE_WRITE enabled in the flags.
|
||||
*
|
||||
* @param exe_cmd The command to run with @c /bin/sh.
|
||||
|
@ -532,11 +532,11 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
|||
|
||||
/**
|
||||
* Sends data to the given child process which it recieves on stdin.
|
||||
*
|
||||
*
|
||||
* This function writes to a child processes standard in, with unlimited
|
||||
* buffering. This call will never block. It may fail if the system runs out
|
||||
* of memory.
|
||||
*
|
||||
*
|
||||
* @param exe The child process to send to
|
||||
* @param data The data to send
|
||||
* @param size The size of the data to send, in bytes
|
||||
|
@ -564,7 +564,7 @@ ecore_exe_send(Ecore_Exe * exe, void *data, int size)
|
|||
|
||||
/**
|
||||
* The stdin of the given child process will close when the write buffer is empty.
|
||||
*
|
||||
*
|
||||
* @param exe The child process
|
||||
* @ingroup Ecore_Exe_Basic_Group
|
||||
*/
|
||||
|
@ -608,17 +608,17 @@ ecore_exe_auto_limits_set(Ecore_Exe * exe, int start_bytes, int end_bytes,
|
|||
*
|
||||
* capture stderr & stdout internally
|
||||
*
|
||||
* raster and onefang keep moving the goal posts on this one. It started out as
|
||||
* raster and onefang keep moving the goal posts on this one. It started out as
|
||||
* "show users the error output if an exe fails" and is rapidly approaching
|
||||
* "alternative method of getting the data, poll vs event driven". Some serious
|
||||
* thinking needs to be applied to this. Do we really want to go that far? If
|
||||
* so, we should change the names. The basic design will probably remain the
|
||||
* same which ever way we go. The constant goal post moving is probably due to
|
||||
* generic design methods leading to feature creep as we inspired each other to
|
||||
* more generic designs. It does seem like the closer we get to poll driven,
|
||||
* more generic designs. It does seem like the closer we get to poll driven,
|
||||
* the more issues and corner cases there are.
|
||||
*
|
||||
* Instead of doing the usual register an event handler thing, we are ecore_exe,
|
||||
* Instead of doing the usual register an event handler thing, we are ecore_exe,
|
||||
* we can take some short cuts. Don't send the events, just leave the exe buffers
|
||||
* as is until the user asks for them, then return the event.
|
||||
*
|
||||
|
@ -648,7 +648,7 @@ ecore_exe_auto_limits_set(Ecore_Exe * exe, int start_bytes, int end_bytes,
|
|||
* Gets the auto pipe data for the given process handle
|
||||
*
|
||||
* @param exe The given process handle.
|
||||
* @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR?
|
||||
* @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR?
|
||||
* @ingroup Ecore_Exe_Basic_Group
|
||||
*/
|
||||
EAPI Ecore_Exe_Event_Data *
|
||||
|
@ -801,7 +801,7 @@ ecore_exe_tag_set(Ecore_Exe * exe, const char *tag)
|
|||
* free it as it just returns the internal pointer value. This value is only
|
||||
* valid as long as the @p exe is valid or until the tag is set to something
|
||||
* else on this @p exe.
|
||||
*
|
||||
*
|
||||
* @param exe The given process handle.
|
||||
* @return The string attached to @p exe.
|
||||
* @ingroup Ecore_Exe_Basic_Group
|
||||
|
@ -846,7 +846,7 @@ ecore_exe_free(Ecore_Exe * exe)
|
|||
if (exe->doomsday_clock)
|
||||
{
|
||||
struct _ecore_exe_dead_exe *dead;
|
||||
|
||||
|
||||
ecore_timer_del(exe->doomsday_clock);
|
||||
exe->doomsday_clock = NULL;
|
||||
dead = exe->doomsday_clock_dead;
|
||||
|
@ -876,7 +876,7 @@ ecore_exe_free(Ecore_Exe * exe)
|
|||
IF_FREE(exe->read_data_buf);
|
||||
IF_FREE(exe->error_data_buf);
|
||||
IF_FREE(exe->cmd);
|
||||
|
||||
|
||||
exes = _ecore_list2_remove(exes, exe);
|
||||
ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE);
|
||||
IF_FREE(exe->tag);
|
||||
|
@ -1090,22 +1090,22 @@ _ecore_exe_is_it_alive(pid_t pid)
|
|||
{
|
||||
Ecore_Exe *exe = NULL;
|
||||
|
||||
/* FIXME: There is no nice, safe, OS independant way to tell if a
|
||||
/* FIXME: There is no nice, safe, OS independant way to tell if a
|
||||
* particular PID is still alive. I have written code to do so
|
||||
* for my urunlevel busybox applet (http://urunlevel.sourceforge.net/),
|
||||
* for my urunlevel busybox applet (http://urunlevel.sourceforge.net/),
|
||||
* but it's for linux only, and still not guaranteed.
|
||||
*
|
||||
* So for now, we just check that a valid Ecore_Exe structure
|
||||
* So for now, we just check that a valid Ecore_Exe structure
|
||||
* exists for it. Even that is not a guarantee, as the structure
|
||||
* can be freed without killing the process.
|
||||
*
|
||||
* I think we can safely put exe's into two categories, those users
|
||||
* that care about the life of the exe, and the run and forget type.
|
||||
* The run and forget type starts up the exe, then free's the
|
||||
* Ecore_Exe structure straight away. They can never call any of
|
||||
* The run and forget type starts up the exe, then free's the
|
||||
* Ecore_Exe structure straight away. They can never call any of
|
||||
* the functions that can call this, so we don't worry about them.
|
||||
*
|
||||
* Those user's that care about the life of exe's will keep the
|
||||
* Those user's that care about the life of exe's will keep the
|
||||
* Ecore_Exe structure around, terminate them eventually, or
|
||||
* register for exit events. For these ones the assumption
|
||||
* that valid Ecore_Exe struct == live exe is almost valid.
|
||||
|
@ -1259,7 +1259,7 @@ _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags)
|
|||
|
||||
if (!(buf = strdup(exe_cmd)))
|
||||
return;
|
||||
|
||||
|
||||
token = strtok(buf, " \t\n\v");
|
||||
use_sh = 0;
|
||||
if (!(args = (char **)calloc(num_tokens + 1, sizeof(char *))))
|
||||
|
@ -1276,7 +1276,7 @@ _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags)
|
|||
args[num_tokens] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setsid();
|
||||
if ((flags & ECORE_EXE_USE_SH))
|
||||
{
|
||||
|
@ -1423,8 +1423,8 @@ _ecore_exe_data_generic_handler(void *data, Ecore_Fd_Handler * fd_handler,
|
|||
("There are %d bytes left unsent from the dead exe %s.\n",
|
||||
exe->error_data_size, exe->cmd);
|
||||
}
|
||||
/* Thought about this a bit. If the exe has actually
|
||||
* died, this won't do any harm as it must have died
|
||||
/* Thought about this a bit. If the exe has actually
|
||||
* died, this won't do any harm as it must have died
|
||||
* recently and the pid has not had a chance to recycle.
|
||||
* It is also a paranoid catchall, coz the usual ecore_signal
|
||||
* mechenism should kick in. But let's give it a good
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
@ -8,7 +8,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define FIX_HZ 1
|
||||
#define FIX_HZ 1
|
||||
|
||||
#ifdef FIX_HZ
|
||||
#include <sys/param.h>
|
||||
|
@ -46,7 +46,7 @@ static double t2 = 0.0;
|
|||
* concurrency. A properly written, event-driven program using this
|
||||
* kind of programming does not need threads. It makes the program very
|
||||
* robust and easy to follow.
|
||||
*
|
||||
*
|
||||
* Here is an example of simple program and its basic event loop flow:
|
||||
* @image html prog_flow.png
|
||||
*
|
||||
|
@ -104,9 +104,9 @@ ecore_main_loop_quit(void)
|
|||
* @p func will be called during the execution of @ref ecore_main_loop_begin
|
||||
* when the file descriptor is available for reading, or writing, or both.
|
||||
*
|
||||
* Normally the return value from the @p func is "zero means this handler is
|
||||
* Normally the return value from the @p func is "zero means this handler is
|
||||
* finished and can be deleted" as is usual for handler callbacks. However,
|
||||
* if the @p buf_func is supplied, then the return value from the @p func is "non
|
||||
* if the @p buf_func is supplied, then the return value from the @p func is "non
|
||||
* zero means the handler should be called again in a tight loop".
|
||||
*
|
||||
* @p buf_func is called during event loop handling to check if data that has
|
||||
|
@ -166,7 +166,7 @@ ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_del");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, void (*
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_prepare_callback_set");
|
||||
return;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_fd_get");
|
||||
return -1;
|
||||
}
|
||||
|
@ -219,10 +219,10 @@ EAPI int
|
|||
ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_active_get");
|
||||
return 0;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ _ecore_main_shutdown(void)
|
|||
while (fd_handlers)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = fd_handlers;
|
||||
fd_handlers = _ecore_list2_remove(fd_handlers, fdh);
|
||||
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
|
||||
|
@ -298,10 +298,10 @@ _ecore_main_select(double timeout)
|
|||
timeout += (0.5 / HZ);
|
||||
sec = (int)timeout;
|
||||
usec = (int)((timeout - (double)sec) * 1000000);
|
||||
#else
|
||||
#else
|
||||
sec = (int)timeout;
|
||||
usec = (int)((timeout - (double)sec) * 1000000);
|
||||
#endif
|
||||
#endif
|
||||
tv.tv_sec = sec;
|
||||
tv.tv_usec = usec;
|
||||
t = &tv;
|
||||
|
@ -315,7 +315,7 @@ _ecore_main_select(double timeout)
|
|||
for (l = (Ecore_List2 *)fd_handlers; l; l = l->next)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
|
||||
if (!fdh->delete_me && fdh->prep_func)
|
||||
|
@ -324,7 +324,7 @@ _ecore_main_select(double timeout)
|
|||
for (l = (Ecore_List2 *)fd_handlers; l; l = l->next)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
if (fdh->flags & ECORE_FD_READ)
|
||||
{
|
||||
|
@ -342,7 +342,7 @@ _ecore_main_select(double timeout)
|
|||
if (fdh->fd > max_fd) max_fd = fdh->fd;
|
||||
}
|
||||
}
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_signal_count_get()) return -1;
|
||||
#endif
|
||||
ret = select(max_fd + 1, &rfds, &wfds, &exfds, t);
|
||||
|
@ -355,7 +355,7 @@ _ecore_main_select(double timeout)
|
|||
for (l = (Ecore_List2 *)fd_handlers; l; l = l->next)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
if (!fdh->delete_me)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ _ecore_main_select(double timeout)
|
|||
}
|
||||
}
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -377,12 +377,12 @@ static void
|
|||
_ecore_main_fd_handlers_cleanup(void)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
|
||||
|
||||
if (!fd_handlers_delete_me) return;
|
||||
for (l = (Ecore_List2 *)fd_handlers; l;)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
l = l->next;
|
||||
if (fdh->delete_me)
|
||||
|
@ -399,16 +399,16 @@ static void
|
|||
_ecore_main_fd_handlers_call(void)
|
||||
{
|
||||
Ecore_List2 *l;
|
||||
|
||||
|
||||
for (l = (Ecore_List2 *)fd_handlers; l; l = l->next)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
if (!fdh->delete_me)
|
||||
{
|
||||
if ((fdh->read_active) ||
|
||||
(fdh->write_active) ||
|
||||
if ((fdh->read_active) ||
|
||||
(fdh->write_active) ||
|
||||
(fdh->error_active))
|
||||
{
|
||||
if (!fdh->func(fdh->data, fdh))
|
||||
|
@ -429,12 +429,12 @@ _ecore_main_fd_handlers_buf_call(void)
|
|||
{
|
||||
Ecore_List2 *l;
|
||||
int ret;
|
||||
|
||||
|
||||
ret = 0;
|
||||
for (l = (Ecore_List2 *)fd_handlers; l; l = l->next)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
|
||||
fdh = (Ecore_Fd_Handler *)l;
|
||||
if (!fdh->delete_me)
|
||||
{
|
||||
|
@ -454,29 +454,32 @@ _ecore_main_fd_handlers_buf_call(void)
|
|||
static void
|
||||
_ecore_main_loop_iterate_internal(int once_only)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MSG msg;
|
||||
#endif
|
||||
double next_time;
|
||||
int have_event = 0;
|
||||
int have_signal;
|
||||
|
||||
|
||||
in_main_loop++;
|
||||
/* expire any timers */
|
||||
{
|
||||
double now;
|
||||
|
||||
|
||||
now = ecore_time_get();
|
||||
while (_ecore_timer_call(now));
|
||||
_ecore_timer_cleanup();
|
||||
}
|
||||
/* any timers re-added as a result of these are allowed to go */
|
||||
_ecore_timer_enable_new();
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
/* process signals into events .... */
|
||||
while (_ecore_signal_count_get()) _ecore_signal_call();
|
||||
#endif
|
||||
if (_ecore_event_exist())
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
have_event = 1;
|
||||
have_signal = 1;
|
||||
ret = _ecore_main_select(0);
|
||||
|
@ -493,7 +496,7 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
ret = _ecore_main_select(0);
|
||||
|
||||
if (ret > 0) have_event = 1;
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
#endif
|
||||
|
||||
|
@ -507,7 +510,7 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
if (_ecore_event_exist())
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
have_event = 1;
|
||||
have_signal = 1;
|
||||
ret = _ecore_main_select(0);
|
||||
|
@ -519,8 +522,8 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
in_main_loop--;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#ifndef _WIN32
|
||||
if (_ecore_fps_debug)
|
||||
{
|
||||
t2 = ecore_time_get();
|
||||
|
@ -529,7 +532,7 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
}
|
||||
#endif
|
||||
start_loop:
|
||||
if (do_quit)
|
||||
if (do_quit)
|
||||
{
|
||||
in_main_loop--;
|
||||
return;
|
||||
|
@ -538,7 +541,7 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
{
|
||||
/* init flags */
|
||||
have_event = have_signal = 0;
|
||||
next_time = _ecore_timer_next_get();
|
||||
next_time = _ecore_timer_next_get();
|
||||
/* no timers */
|
||||
if (next_time < 0)
|
||||
{
|
||||
|
@ -546,10 +549,10 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
if (!_ecore_idler_exist())
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
ret = _ecore_main_select(-1);
|
||||
if (ret > 0) have_event = 1;
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
#endif
|
||||
}
|
||||
|
@ -559,12 +562,12 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
for (;;)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
if (!_ecore_idler_call()) goto start_loop;
|
||||
if (_ecore_event_exist()) break;
|
||||
ret = _ecore_main_select(0);
|
||||
if (ret > 0) have_event = 1;
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
#endif
|
||||
if (have_event || have_signal) break;
|
||||
|
@ -581,10 +584,10 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
if (!_ecore_idler_exist())
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
ret = _ecore_main_select(next_time);
|
||||
if (ret > 0) have_event = 1;
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
#endif
|
||||
}
|
||||
|
@ -595,12 +598,12 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
{
|
||||
double cur_time, t;
|
||||
int ret;
|
||||
|
||||
|
||||
if (!_ecore_idler_call()) goto start_loop;
|
||||
if (_ecore_event_exist()) break;
|
||||
ret = _ecore_main_select(0);
|
||||
if (ret > 0) have_event = 1;
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
#endif
|
||||
if ((have_event) || (have_signal)) break;
|
||||
|
@ -614,7 +617,7 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
if (_ecore_fps_debug)
|
||||
{
|
||||
t1 = ecore_time_get();
|
||||
|
@ -630,16 +633,23 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
if (have_event) _ecore_main_fd_handlers_call();
|
||||
do
|
||||
{
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
/* process signals into events .... */
|
||||
while (_ecore_signal_count_get()) _ecore_signal_call();
|
||||
#endif
|
||||
|
||||
|
||||
/* handle events ... */
|
||||
_ecore_event_call();
|
||||
_ecore_event_call();
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
}
|
||||
while (_ecore_main_fd_handlers_buf_call());
|
||||
#ifdef _WIN32
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
#endif
|
||||
if (once_only) _ecore_idle_enterer_call();
|
||||
in_main_loop--;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
# include <dlfcn.h>
|
||||
# include "ecore_private.h"
|
||||
# include "Ecore_Data.h"
|
||||
|
|
|
@ -13,16 +13,16 @@
|
|||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/mman.h>
|
||||
#ifndef _WIN32
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef EAPI
|
||||
#undef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
# ifdef BUILDING_DLL
|
||||
|
@ -50,29 +50,29 @@
|
|||
#endif
|
||||
|
||||
#if HAVE___ATTRIBUTE__
|
||||
#define __UNUSED__ __attribute__((unused))
|
||||
# define __UNUSED__ __attribute__((unused))
|
||||
#else
|
||||
#define __UNUSED__
|
||||
# define __UNUSED__
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
# define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) (((x) > (y)) ? (y) : (x))
|
||||
# define MIN(x, y) (((x) > (y)) ? (y) : (x))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef ABS
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
# define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
|
||||
# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
|
||||
#endif
|
||||
|
||||
#define READBUFSIZ 65536
|
||||
|
@ -115,7 +115,7 @@ inline void ecore_print_warning(const char *function, const char *sparam);
|
|||
ecore_print_warning(__FUNCTION__, sparam); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
|
||||
#undef CHECK_PARAM_POINTER
|
||||
#define CHECK_PARAM_POINTER(sparam, param) \
|
||||
if (!(param)) \
|
||||
|
@ -168,14 +168,14 @@ enum _Ecore_Exe_Flags
|
|||
*
|
||||
* Document that the exe must be respawnable, in other words, there is no
|
||||
* state that it cannot regenerate by just killing it and starting it again.
|
||||
* This includes state that the user code knows about, as the respawn is
|
||||
* transparent to that code. On the other hand, maybe a respawn event might
|
||||
* be useful, or maybe resend the currently non existant add event. For
|
||||
* This includes state that the user code knows about, as the respawn is
|
||||
* transparent to that code. On the other hand, maybe a respawn event might
|
||||
* be useful, or maybe resend the currently non existant add event. For
|
||||
* consistancy with ecore_con, an add event is good anyway.
|
||||
*
|
||||
* The Ecore_exe structure is reused for respawning, so that the (opaque)
|
||||
* pointer held by the user remains valid. This means that the Ecore_Exe
|
||||
* init and del functions may need to be split into two parts each to avoid
|
||||
* init and del functions may need to be split into two parts each to avoid
|
||||
* duplicating code - common code part, and the rest. This implies that
|
||||
* the unchanging members mentioned next should NEVER change.
|
||||
*
|
||||
|
@ -212,17 +212,17 @@ enum _Ecore_Exe_Flags
|
|||
* close_write - state that must be regenerated, zap it
|
||||
*
|
||||
* There is the problem that an exe that fell over and needs respawning
|
||||
* might keep falling over, keep needing to be respawned, and tie up system
|
||||
* resources with the constant respawning. An exponentially increasing
|
||||
* might keep falling over, keep needing to be respawned, and tie up system
|
||||
* resources with the constant respawning. An exponentially increasing
|
||||
* timeout (with maximum timeout) between respawns should take care of that.
|
||||
* Although this is not a "contention for a resource" problem, the exe falling
|
||||
* over may be, so a random element added to the timeout may help, and won't
|
||||
* hurt. The user code may need to be informed that a timeout is in progress.
|
||||
* Although this is not a "contention for a resource" problem, the exe falling
|
||||
* over may be, so a random element added to the timeout may help, and won't
|
||||
* hurt. The user code may need to be informed that a timeout is in progress.
|
||||
*/
|
||||
};
|
||||
typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
typedef struct _Ecore_Exe Ecore_Exe;
|
||||
#endif
|
||||
typedef struct _Ecore_Timer Ecore_Timer;
|
||||
|
@ -235,7 +235,7 @@ typedef struct _Ecore_Event_Filter Ecore_Event_Filter;
|
|||
typedef struct _Ecore_Event Ecore_Event;
|
||||
typedef struct _Ecore_Animator Ecore_Animator;
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
struct _Ecore_Exe
|
||||
{
|
||||
Ecore_List2 __list_data;
|
||||
|
@ -248,8 +248,8 @@ struct _Ecore_Exe
|
|||
Ecore_Fd_Handler *write_fd_handler; /* the fd_handler to handle write to child - if this was used, or NULL if not */
|
||||
Ecore_Fd_Handler *read_fd_handler; /* the fd_handler to handle read from child - if this was used, or NULL if not */
|
||||
Ecore_Fd_Handler *error_fd_handler; /* the fd_handler to handle errors from child - if this was used, or NULL if not */
|
||||
void *write_data_buf; /* a data buffer for data to write to the child -
|
||||
* realloced as needed for more data and flushed when the fd handler says writes are possible
|
||||
void *write_data_buf; /* a data buffer for data to write to the child -
|
||||
* realloced as needed for more data and flushed when the fd handler says writes are possible
|
||||
*/
|
||||
int write_data_size; /* the size in bytes of the data buffer */
|
||||
int write_data_offset; /* the offset in bytes in the data buffer */
|
||||
|
@ -289,7 +289,7 @@ struct _Ecore_Idler
|
|||
Ecore_List2 __list_data;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
int (*func) (void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
@ -298,7 +298,7 @@ struct _Ecore_Idle_Enterer
|
|||
Ecore_List2 __list_data;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
int (*func) (void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
@ -307,7 +307,7 @@ struct _Ecore_Idle_Exiter
|
|||
Ecore_List2 __list_data;
|
||||
ECORE_MAGIC;
|
||||
int delete_me : 1;
|
||||
int (*func) (void *data);
|
||||
int (*func) (void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
@ -376,7 +376,7 @@ struct _Ecore_Animator
|
|||
EAPI void _ecore_magic_fail(void *d, Ecore_Magic m, Ecore_Magic req_m, const char *fname);
|
||||
|
||||
void _ecore_timer_shutdown(void);
|
||||
void _ecore_timer_cleanup(void);
|
||||
void _ecore_timer_cleanup(void);
|
||||
void _ecore_timer_enable_new(void);
|
||||
double _ecore_timer_next_get(void);
|
||||
int _ecore_timer_call(double when);
|
||||
|
@ -394,7 +394,7 @@ void _ecore_idle_exiter_call(void);
|
|||
int _ecore_idle_exiter_exist(void);
|
||||
|
||||
void _ecore_event_shutdown(void);
|
||||
int _ecore_event_exist(void);
|
||||
int _ecore_event_exist(void);
|
||||
Ecore_Event *_ecore_event_add(int type, void *ev, void (*func_free) (void *data, void *ev), void *data);
|
||||
void *_ecore_event_del(Ecore_Event *event);
|
||||
void _ecore_event_call(void);
|
||||
|
@ -406,13 +406,13 @@ void *_ecore_event_signal_power_new(void);
|
|||
void *_ecore_event_signal_realtime_new(void);
|
||||
|
||||
void _ecore_main_shutdown(void);
|
||||
|
||||
|
||||
void _ecore_signal_shutdown(void);
|
||||
void _ecore_signal_init(void);
|
||||
int _ecore_signal_count_get(void);
|
||||
void _ecore_signal_call(void);
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
void _ecore_exe_init(void);
|
||||
void _ecore_exe_shutdown(void);
|
||||
Ecore_Exe *_ecore_exe_find(pid_t pid);
|
||||
|
@ -421,7 +421,7 @@ void _ecore_exe_event_del_free(void *data, void *ev);
|
|||
#endif
|
||||
|
||||
void _ecore_animator_shutdown(void);
|
||||
|
||||
|
||||
|
||||
EAPI void *_ecore_list2_append (void *in_list, void *in_item);
|
||||
EAPI void *_ecore_list2_prepend (void *in_list, void *in_item);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo);
|
||||
|
||||
static void _ecore_signal_callback_set(int sig, Signal_Handler func);
|
||||
static void _ecore_signal_callback_set(int sig, Signal_Handler func);
|
||||
static void _ecore_signal_callback_ignore(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigchld(int sig, siginfo_t *si, void *foo);
|
||||
static void _ecore_signal_callback_sigusr1(int sig, siginfo_t *si, void *foo);
|
||||
|
@ -66,7 +66,7 @@ _ecore_signal_shutdown(void)
|
|||
#ifdef SIGRTMIN
|
||||
int i, num = SIGRTMAX - SIGRTMIN;
|
||||
#endif
|
||||
|
||||
|
||||
_ecore_signal_callback_set(SIGPIPE, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGALRM, (Signal_Handler) SIG_DFL);
|
||||
_ecore_signal_callback_set(SIGCHLD, (Signal_Handler) SIG_DFL);
|
||||
|
@ -136,7 +136,7 @@ _ecore_signal_init(void)
|
|||
|
||||
sigrt_info = calloc(1, sizeof(siginfo_t) * num);
|
||||
assert(sigrt_info);
|
||||
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
_ecore_signal_callback_set(SIGRTMIN + i, _ecore_signal_callback_sigrt);
|
||||
#endif
|
||||
|
@ -154,18 +154,18 @@ _ecore_signal_call(void)
|
|||
#ifdef SIGRTMIN
|
||||
int i, num = SIGRTMAX - SIGRTMIN;
|
||||
#endif
|
||||
|
||||
|
||||
while (sigchld_count > 0)
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
|
||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
|
||||
|
||||
/* FIXME: If this process is set respawn, respawn with a suitable backoff
|
||||
* period for those that need too much respawning.
|
||||
* period for those that need too much respawning.
|
||||
*/
|
||||
e = _ecore_exe_event_del_new();
|
||||
if (e)
|
||||
|
@ -182,10 +182,10 @@ _ecore_signal_call(void)
|
|||
}
|
||||
e->pid = pid;
|
||||
e->exe = _ecore_exe_find(pid);
|
||||
|
||||
|
||||
if (sigchld_info.si_signo)
|
||||
e->data = sigchld_info; /* No need to clone this. */
|
||||
|
||||
|
||||
if ((e->exe) && (e->exe->flags & (ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR)))
|
||||
{
|
||||
/* We want to report the Last Words of the exe, so delay this event.
|
||||
|
@ -196,17 +196,17 @@ _ecore_signal_call(void)
|
|||
* 3 There are Last Words, they are ready to be read.
|
||||
*
|
||||
* For 1 we don't want to delay, for 3 we want to delay.
|
||||
* 2 is the problem. If we check for data now and there
|
||||
* 2 is the problem. If we check for data now and there
|
||||
* is none, then there is no way to differentiate 1 and 2.
|
||||
* If we don't delay, we may loose data, but if we do delay,
|
||||
* If we don't delay, we may loose data, but if we do delay,
|
||||
* there may not be data and the exit event never gets sent.
|
||||
*
|
||||
* Any way you look at it, there has to be some time passed
|
||||
*
|
||||
* Any way you look at it, there has to be some time passed
|
||||
* before the exit event gets sent. So the strategy here is
|
||||
* to setup a timer event that will send the exit event after
|
||||
* an arbitrary, but brief, time.
|
||||
*
|
||||
* This is probably paranoid, for the less paraniod, we could
|
||||
* This is probably paranoid, for the less paraniod, we could
|
||||
* check to see for Last Words, and only delay if there are any.
|
||||
* This has it's own set of problems.
|
||||
*/
|
||||
|
@ -215,7 +215,7 @@ _ecore_signal_call(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_exe_event_del_free, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -226,15 +226,15 @@ _ecore_signal_call(void)
|
|||
while (sigusr1_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_User *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_user_new();
|
||||
if (e)
|
||||
{
|
||||
e->number = 1;
|
||||
|
||||
if (sigusr1_info.si_signo)
|
||||
e->data = sigusr1_info;
|
||||
|
||||
e->data = sigusr1_info;
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
|
||||
}
|
||||
sigusr1_count--;
|
||||
|
@ -243,15 +243,15 @@ _ecore_signal_call(void)
|
|||
while (sigusr2_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_User *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_user_new();
|
||||
if (e)
|
||||
{
|
||||
e->number = 2;
|
||||
|
||||
|
||||
if (sigusr2_info.si_signo)
|
||||
e->data = sigusr2_info;
|
||||
|
||||
e->data = sigusr2_info;
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
|
||||
}
|
||||
sigusr2_count--;
|
||||
|
@ -260,13 +260,13 @@ _ecore_signal_call(void)
|
|||
while (sighup_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_Hup *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_hup_new();
|
||||
if (e)
|
||||
{
|
||||
if (sighup_info.si_signo)
|
||||
e->data = sighup_info;
|
||||
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, NULL, NULL);
|
||||
}
|
||||
sighup_count--;
|
||||
|
@ -275,7 +275,7 @@ _ecore_signal_call(void)
|
|||
while (sigquit_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ _ecore_signal_call(void)
|
|||
|
||||
if (sigquit_info.si_signo)
|
||||
e->data = sigquit_info;
|
||||
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sigquit_count--;
|
||||
|
@ -292,15 +292,15 @@ _ecore_signal_call(void)
|
|||
while (sigint_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->interrupt = 1;
|
||||
|
||||
|
||||
if (sigint_info.si_signo)
|
||||
e->data = sigint_info;
|
||||
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sigint_count--;
|
||||
|
@ -309,15 +309,15 @@ _ecore_signal_call(void)
|
|||
while (sigterm_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->terminate = 1;
|
||||
|
||||
|
||||
if (sigterm_info.si_signo)
|
||||
e->data = sigterm_info;
|
||||
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sigterm_count--;
|
||||
|
@ -327,13 +327,13 @@ _ecore_signal_call(void)
|
|||
while (sigpwr_count > 0)
|
||||
{
|
||||
Ecore_Event_Signal_Power *e;
|
||||
|
||||
|
||||
e = _ecore_event_signal_power_new();
|
||||
if (e)
|
||||
{
|
||||
if (sigpwr_info.si_signo)
|
||||
e->data = sigpwr_info;
|
||||
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_POWER, e, NULL, NULL);
|
||||
}
|
||||
sigpwr_count--;
|
||||
|
@ -347,17 +347,17 @@ _ecore_signal_call(void)
|
|||
while (sigrt_count[i] > 0)
|
||||
{
|
||||
Ecore_Event_Signal_Realtime *e;
|
||||
|
||||
|
||||
if ((e = _ecore_event_signal_realtime_new()))
|
||||
{
|
||||
e->num = i;
|
||||
|
||||
|
||||
if (sigrt_info[i].si_signo)
|
||||
e->data = sigrt_info[i];
|
||||
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_REALTIME, e, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
sigrt_count[i]--;
|
||||
sig_count--;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ _ecore_signal_callback_set(int sig, Signal_Handler func)
|
|||
sa.sa_sigaction = func;
|
||||
sa.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(sig, &sa, NULL);
|
||||
sigaction(sig, &sa, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -388,7 +388,7 @@ _ecore_signal_callback_sigchld(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
sigchld_info = *si;
|
||||
else
|
||||
sigchld_info.si_signo = 0;
|
||||
|
||||
|
||||
sigchld_count++;
|
||||
sig_count++;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ _ecore_signal_callback_sigusr1(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
sigusr1_info = *si;
|
||||
else
|
||||
sigusr1_info.si_signo = 0;
|
||||
|
||||
|
||||
sigusr1_count++;
|
||||
sig_count++;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ _ecore_signal_callback_sigusr2(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
sigusr2_info = *si;
|
||||
else
|
||||
sigusr2_info.si_signo = 0;
|
||||
|
||||
|
||||
sigusr2_count++;
|
||||
sig_count++;
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ _ecore_signal_callback_sighup(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
sighup_info = *si;
|
||||
else
|
||||
sighup_info.si_signo = 0;
|
||||
|
||||
|
||||
sighup_count++;
|
||||
sig_count++;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ _ecore_signal_callback_sigpwr(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
sigpwr_info = *si;
|
||||
else
|
||||
sigpwr_info.si_signo = 0;
|
||||
|
||||
|
||||
sigpwr_count++;
|
||||
sig_count++;
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ _ecore_signal_callback_sigrt(int sig, siginfo_t *si, void *foo __UNUSED__)
|
|||
sigrt_info[sig - SIGRTMIN] = *si;
|
||||
else
|
||||
sigrt_info[sig - SIGRTMIN].si_signo = 0;
|
||||
|
||||
|
||||
sigrt_count[sig - SIGRTMIN]++;
|
||||
sig_count++;
|
||||
}
|
||||
|
@ -497,12 +497,12 @@ static int
|
|||
_ecore_signal_exe_exit_delay(void *data)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
|
||||
|
||||
e = data;
|
||||
if (e)
|
||||
{
|
||||
e->exe->doomsday_clock = NULL;
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_exe_event_del_free, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1,31 +1,9 @@
|
|||
#include <sys/time.h>
|
||||
#ifdef WIN32
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
#include "ecore_private.h"
|
||||
#include "Ecore.h"
|
||||
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
#ifdef WIN32
|
||||
|
||||
static int
|
||||
gettimeofday(struct timeval *tv, void *unused)
|
||||
{
|
||||
struct _timeb t;
|
||||
|
||||
if (!tv) return -1;
|
||||
|
||||
_ftime (&t);
|
||||
|
||||
tv->tv_sec = t.time;
|
||||
tv->tv_usec = t.millitm * 1000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#else
|
||||
# error "Your platform isn't supported yet"
|
||||
#endif
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include "Ecore.h"
|
||||
|
||||
/**
|
||||
* Retrieves the current system time as a floating point value in seconds.
|
||||
|
@ -35,8 +13,16 @@ gettimeofday(struct timeval *tv, void *unused)
|
|||
EAPI double
|
||||
ecore_time_get(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (double)GetTickCount() / 1000.0;
|
||||
#else
|
||||
# ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval timev;
|
||||
|
||||
gettimeofday(&timev, NULL);
|
||||
return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
||||
# else
|
||||
# error "Your platform isn't supported yet"
|
||||
# endif
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#elif WIN32
|
||||
#include <winsock.h>
|
||||
#elif _WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
static void _ecore_con_cb_dns_lookup(void *data, struct hostent *he);
|
||||
|
@ -110,7 +110,7 @@ ecore_con_shutdown(void)
|
|||
ecore_con_dns_shutdown();
|
||||
|
||||
ecore_shutdown();
|
||||
|
||||
|
||||
return init_count;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
struct sockaddr_un socket_unix;
|
||||
struct linger lin;
|
||||
char buf[4096];
|
||||
|
||||
|
||||
if (port < 0) return NULL;
|
||||
/* local user socket: FILE: ~/.ecore/[name]/[port] */
|
||||
/* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
|
||||
|
@ -171,7 +171,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
/* unset the SSL flag for the following checks */
|
||||
type &= ~ECORE_CON_USE_SSL;
|
||||
#endif
|
||||
|
||||
|
||||
if ((type == ECORE_CON_LOCAL_USER) ||
|
||||
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
||||
(type == ECORE_CON_LOCAL_ABSTRACT))
|
||||
|
@ -180,7 +180,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
struct stat st;
|
||||
mode_t pmode, mask;
|
||||
int socket_unix_len;
|
||||
|
||||
|
||||
if (!name) goto error;
|
||||
mask =
|
||||
S_IRGRP | S_IWGRP | S_IXGRP |
|
||||
|
@ -223,19 +223,19 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
}
|
||||
if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0)
|
||||
{
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
}
|
||||
if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0)
|
||||
{
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
}
|
||||
lin.l_onoff = 1;
|
||||
lin.l_linger = 0;
|
||||
if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, &lin, sizeof(struct linger)) < 0)
|
||||
{
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
}
|
||||
socket_unix.sun_family = AF_UNIX;
|
||||
|
@ -245,11 +245,11 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
/* . is a placeholder */
|
||||
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
||||
/* first char null indicates abstract namespace */
|
||||
socket_unix.sun_path[0] = '\0';
|
||||
socket_unix.sun_path[0] = '\0';
|
||||
socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
|
||||
#else
|
||||
fprintf(stderr, "Your system does not support abstract sockets!\n");
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
#endif
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
}
|
||||
if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
|
||||
{
|
||||
if (connect(svr->fd, (struct sockaddr *)&socket_unix,
|
||||
if (connect(svr->fd, (struct sockaddr *)&socket_unix,
|
||||
socket_unix_len) < 0)
|
||||
{
|
||||
if ((type == ECORE_CON_LOCAL_USER) ||
|
||||
|
@ -269,7 +269,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
if (unlink(buf) < 0)
|
||||
{
|
||||
umask(pmode);
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
goto start;
|
||||
|
@ -277,24 +277,24 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
else
|
||||
{
|
||||
umask(pmode);
|
||||
goto error;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (listen(svr->fd, 4096) < 0)
|
||||
{
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
}
|
||||
svr->path = strdup(buf);
|
||||
if (!svr->path)
|
||||
{
|
||||
umask(pmode);
|
||||
umask(pmode);
|
||||
goto error;
|
||||
}
|
||||
svr->fd_handler = ecore_main_fd_handler_add(svr->fd,
|
||||
|
@ -338,14 +338,14 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
/* SSLv3 gives *weird* results on my box, don't use it yet */
|
||||
if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
|
||||
goto error;
|
||||
|
||||
|
||||
if (!(svr->ssl = SSL_new(svr->ssl_ctx)))
|
||||
goto error;
|
||||
|
||||
|
||||
SSL_set_fd(svr->ssl, svr->fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
svr->name = strdup(name);
|
||||
if (!svr->name) goto error;
|
||||
svr->type = type;
|
||||
|
@ -357,9 +357,9 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
|||
svr->clients = ecore_list_new();
|
||||
svr->ppid = getpid();
|
||||
ecore_list_append(servers, svr);
|
||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
||||
return svr;
|
||||
|
||||
|
||||
error:
|
||||
if (svr->name) free(svr->name);
|
||||
if (svr->path) free(svr->path);
|
||||
|
@ -420,7 +420,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
|||
/* remote system socket: TCP/IP: [name]:[port] */
|
||||
svr = calloc(1, sizeof(Ecore_Con_Server));
|
||||
if (!svr) return NULL;
|
||||
|
||||
|
||||
type = compl_type;
|
||||
#if USE_OPENSSL
|
||||
/* unset the SSL flag for the following checks */
|
||||
|
@ -434,7 +434,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
|||
{
|
||||
const char *homedir;
|
||||
int socket_unix_len;
|
||||
|
||||
|
||||
if (type == ECORE_CON_LOCAL_USER)
|
||||
{
|
||||
homedir = getenv("HOME");
|
||||
|
@ -497,12 +497,12 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
|||
_ecore_con_cl_handler, svr,
|
||||
NULL, NULL);
|
||||
if (!svr->fd_handler) goto error;
|
||||
|
||||
|
||||
if (!svr->delete_me)
|
||||
{
|
||||
/* we got our server! */
|
||||
Ecore_Con_Event_Server_Add *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Server_Add));
|
||||
if (e)
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
|||
svr->client_limit = -1;
|
||||
svr->clients = ecore_list_new();
|
||||
ecore_list_append(servers, svr);
|
||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
|
||||
|
||||
if (type == ECORE_CON_REMOTE_SYSTEM)
|
||||
{
|
||||
|
@ -533,7 +533,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
|||
}
|
||||
|
||||
return svr;
|
||||
|
||||
|
||||
error:
|
||||
if (svr->name) free(svr->name);
|
||||
if (svr->path) free(svr->path);
|
||||
|
@ -597,7 +597,7 @@ ecore_con_server_data_get(Ecore_Con_Server *svr)
|
|||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
|
||||
"ecore_con_server_data_get");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return svr->data;
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ ecore_con_server_connected_get(Ecore_Con_Server *svr)
|
|||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
|
||||
"ecore_con_server_connected_get");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (svr->connecting) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ ecore_con_server_clients_get(Ecore_Con_Server *svr)
|
|||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
|
||||
"ecore_con_server_clients_get");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return svr->clients;
|
||||
}
|
||||
|
||||
|
@ -656,7 +656,7 @@ ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size)
|
|||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
|
||||
"ecore_con_server_send");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (svr->dead) return 0;
|
||||
if (!data) return 0;
|
||||
if (size < 1) return 0;
|
||||
|
@ -665,7 +665,7 @@ ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size)
|
|||
if (svr->write_buf)
|
||||
{
|
||||
unsigned char *newbuf;
|
||||
|
||||
|
||||
newbuf = realloc(svr->write_buf, svr->write_buf_size + size);
|
||||
if (newbuf) svr->write_buf = newbuf;
|
||||
else return 0;
|
||||
|
@ -692,7 +692,7 @@ ecore_con_server_send(Ecore_Con_Server *svr, const void *data, int size)
|
|||
* Only clients subsequently trying to connect will be affected.
|
||||
* @param svr The given server.
|
||||
* @param client_limit The maximum number of clients to handle
|
||||
* concurrently. -1 means unlimited (default). 0
|
||||
* concurrently. -1 means unlimited (default). 0
|
||||
* effectively disables the server.
|
||||
* @param reject_excess_clients Set to 1 to automatically disconnect
|
||||
* excess clients as soon as they connect if you are
|
||||
|
@ -712,14 +712,14 @@ ecore_con_server_client_limit_set(Ecore_Con_Server *svr, int client_limit, char
|
|||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER,
|
||||
"ecore_con_server_client_limit_set");
|
||||
return;
|
||||
}
|
||||
}
|
||||
svr->client_limit = client_limit;
|
||||
svr->reject_excess_clients = reject_excess_clients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the IP address of a server that has been connected to.
|
||||
*
|
||||
*
|
||||
* @param svr The given server.
|
||||
* @return A pointer to an internal string that contains the IP address of
|
||||
* the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
|
||||
|
@ -741,7 +741,7 @@ ecore_con_server_ip_get(Ecore_Con_Server *svr)
|
|||
|
||||
/**
|
||||
* Flushes all pending data to the given server. Will return when done.
|
||||
*
|
||||
*
|
||||
* @param svr The given server.
|
||||
* @ingroup Ecore_Con_Server_Group
|
||||
*/
|
||||
|
@ -780,7 +780,7 @@ ecore_con_client_send(Ecore_Con_Client *cl, void *data, int size)
|
|||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
|
||||
"ecore_con_client_send");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (cl->dead) return 0;
|
||||
if (!data) return 0;
|
||||
if (size < 1) return 0;
|
||||
|
@ -789,7 +789,7 @@ ecore_con_client_send(Ecore_Con_Client *cl, void *data, int size)
|
|||
if (cl->buf)
|
||||
{
|
||||
unsigned char *newbuf;
|
||||
|
||||
|
||||
newbuf = realloc(cl->buf, cl->buf_size + size);
|
||||
if (newbuf) cl->buf = newbuf;
|
||||
else return 0;
|
||||
|
@ -805,11 +805,11 @@ ecore_con_client_send(Ecore_Con_Client *cl, void *data, int size)
|
|||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the server representing the socket the client has
|
||||
* connected to.
|
||||
* @param cl The given client.
|
||||
* @param cl The given client.
|
||||
* @return The server that the client connected to.
|
||||
* @ingroup Ecore_Con_Client_Group
|
||||
*/
|
||||
|
@ -821,7 +821,7 @@ ecore_con_client_server_get(Ecore_Con_Client *cl)
|
|||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
|
||||
"ecore_con_client_server_get");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return cl->server;
|
||||
}
|
||||
|
||||
|
@ -835,13 +835,13 @@ EAPI void *
|
|||
ecore_con_client_del(Ecore_Con_Client *cl)
|
||||
{
|
||||
void *data;
|
||||
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT,
|
||||
"ecore_con_client_del");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
data = cl->data;
|
||||
cl->data = NULL;
|
||||
cl->delete_me = 1;
|
||||
|
@ -900,7 +900,7 @@ ecore_con_client_data_get(Ecore_Con_Client *cl)
|
|||
|
||||
/**
|
||||
* Gets the IP address of a cleint that has connected.
|
||||
*
|
||||
*
|
||||
* @param cl The given client.
|
||||
* @return A pointer to an internal string that contains the IP address of
|
||||
* the connected client in the form "XXX.YYY.ZZZ.AAA" IP notation.
|
||||
|
@ -922,7 +922,7 @@ ecore_con_client_ip_get(Ecore_Con_Client *cl)
|
|||
|
||||
/**
|
||||
* Flushes all pending data to the given client. Will return when done.
|
||||
*
|
||||
*
|
||||
* @param cl The given client.
|
||||
* @ingroup Ecore_Con_Client_Group
|
||||
*/
|
||||
|
@ -950,15 +950,15 @@ ecore_con_ssl_available_get(void)
|
|||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_con_server_free(Ecore_Con_Server *svr)
|
||||
{
|
||||
double t_start, t;
|
||||
|
||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE);
|
||||
|
||||
ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE);
|
||||
t_start = ecore_time_get();
|
||||
while ((svr->write_buf) && (!svr->dead))
|
||||
{
|
||||
|
@ -998,8 +998,8 @@ static void
|
|||
_ecore_con_client_free(Ecore_Con_Client *cl)
|
||||
{
|
||||
double t_start, t;
|
||||
|
||||
ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
|
||||
|
||||
ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
|
||||
t_start = ecore_time_get();
|
||||
while ((cl->buf) && (!cl->dead))
|
||||
{
|
||||
|
@ -1028,7 +1028,7 @@ _ecore_con_svr_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
int new_fd;
|
||||
struct sockaddr_in incoming;
|
||||
size_t size_in;
|
||||
|
||||
|
||||
svr = data;
|
||||
if (svr->dead) return 1;
|
||||
if (svr->delete_me) return 1;
|
||||
|
@ -1044,7 +1044,7 @@ _ecore_con_svr_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
Ecore_Con_Client *cl;
|
||||
char buf[64];
|
||||
uint32_t ip;
|
||||
|
||||
|
||||
if ((svr->client_limit >= 0) && (svr->reject_excess_clients))
|
||||
{
|
||||
close(new_fd);
|
||||
|
@ -1063,7 +1063,7 @@ _ecore_con_svr_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
cl->server = svr;
|
||||
cl->fd_handler = ecore_main_fd_handler_add(cl->fd,
|
||||
ECORE_FD_READ,
|
||||
_ecore_con_svr_cl_handler,
|
||||
_ecore_con_svr_cl_handler,
|
||||
cl, NULL, NULL);
|
||||
ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT);
|
||||
ecore_list_append(svr->clients, cl);
|
||||
|
@ -1081,7 +1081,7 @@ _ecore_con_svr_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
if (!cl->delete_me)
|
||||
{
|
||||
Ecore_Con_Event_Client_Add *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Client_Add));
|
||||
if (e)
|
||||
{
|
||||
|
@ -1111,11 +1111,11 @@ svr_try_connect_ssl(Ecore_Con_Server *svr)
|
|||
SSL_load_error_strings();
|
||||
}
|
||||
ssl_init_count++;
|
||||
|
||||
|
||||
res = SSL_connect(svr->ssl);
|
||||
if (res == 1) return 1;
|
||||
ssl_err = SSL_get_error(svr->ssl, res);
|
||||
|
||||
|
||||
if (ssl_err == SSL_ERROR_NONE) return 1;
|
||||
if (ssl_err == SSL_ERROR_WANT_READ) flag = ECORE_FD_READ;
|
||||
else if (ssl_err == SSL_ERROR_WANT_WRITE) flag = ECORE_FD_WRITE;
|
||||
|
@ -1134,7 +1134,7 @@ kill_server(Ecore_Con_Server *svr)
|
|||
if (!svr->delete_me)
|
||||
{
|
||||
Ecore_Con_Event_Server_Del *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Server_Del));
|
||||
if (e)
|
||||
{
|
||||
|
@ -1144,7 +1144,7 @@ kill_server(Ecore_Con_Server *svr)
|
|||
_ecore_con_event_server_del_free, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
svr->dead = 1;
|
||||
if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
|
||||
svr->fd_handler = NULL;
|
||||
|
@ -1169,9 +1169,9 @@ _ecore_con_cb_dns_lookup(void *data, struct hostent *he)
|
|||
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) goto error;
|
||||
socket_addr.sin_family = AF_INET;
|
||||
socket_addr.sin_port = htons(svr->port);
|
||||
memcpy((struct in_addr *)&socket_addr.sin_addr,
|
||||
memcpy((struct in_addr *)&socket_addr.sin_addr,
|
||||
he->h_addr, sizeof(struct in_addr));
|
||||
if (connect(svr->fd, (struct sockaddr *)&socket_addr, sizeof(struct sockaddr_in)) < 0)
|
||||
if (connect(svr->fd, (struct sockaddr *)&socket_addr, sizeof(struct sockaddr_in)) < 0)
|
||||
{
|
||||
if (errno != EINPROGRESS)
|
||||
goto error;
|
||||
|
@ -1210,10 +1210,10 @@ _ecore_con_cb_dns_lookup(void *data, struct hostent *he)
|
|||
/* SSLv3 gives *weird* results on my box, don't use it yet */
|
||||
if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
|
||||
goto error;
|
||||
|
||||
|
||||
if (!(svr->ssl = SSL_new(svr->ssl_ctx)))
|
||||
goto error;
|
||||
|
||||
|
||||
SSL_set_fd(svr->ssl, svr->fd);
|
||||
}
|
||||
#endif
|
||||
|
@ -1232,7 +1232,7 @@ svr_try_connect_plain(Ecore_Con_Server *svr)
|
|||
|
||||
if (getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, &so_err, &size) < 0)
|
||||
so_err = -1;
|
||||
|
||||
|
||||
if (so_err != 0)
|
||||
{
|
||||
/* we lost our server! */
|
||||
|
@ -1244,7 +1244,7 @@ svr_try_connect_plain(Ecore_Con_Server *svr)
|
|||
{
|
||||
/* we got our server! */
|
||||
Ecore_Con_Event_Server_Add *e;
|
||||
|
||||
|
||||
svr->connecting = 0;
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Server_Add));
|
||||
if (e)
|
||||
|
@ -1295,7 +1295,7 @@ _ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
#if USE_OPENSSL
|
||||
int ssl_err = SSL_ERROR_NONE;
|
||||
#endif
|
||||
|
||||
|
||||
svr = data;
|
||||
if (svr->dead) return 1;
|
||||
if (svr->delete_me) return 1;
|
||||
|
@ -1319,13 +1319,13 @@ _ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
#endif
|
||||
if ((num = read(svr->fd, buf, READBUFSIZ)) < 1)
|
||||
{
|
||||
lost_server = ((errno == EIO) ||
|
||||
lost_server = ((errno == EIO) ||
|
||||
(errno == EBADF) ||
|
||||
(errno == EPIPE) ||
|
||||
(errno == EPIPE) ||
|
||||
(errno == EINVAL) ||
|
||||
(errno == ENOSPC) ||
|
||||
(errno == ENOSPC) ||
|
||||
(num == 0));
|
||||
/* is num == 0 is right - when the server closes us
|
||||
/* is num == 0 is right - when the server closes us
|
||||
* off we will get this (as this is called when select
|
||||
* tells us there is data to read!)
|
||||
*/
|
||||
|
@ -1346,12 +1346,12 @@ _ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
#endif
|
||||
if (num < 1)
|
||||
{
|
||||
if (inbuf)
|
||||
if (inbuf)
|
||||
{
|
||||
if (!svr->delete_me)
|
||||
{
|
||||
Ecore_Con_Event_Server_Data *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Server_Data));
|
||||
if (e)
|
||||
{
|
||||
|
@ -1406,7 +1406,7 @@ static int
|
|||
_ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
Ecore_Con_Client *cl;
|
||||
|
||||
|
||||
cl = data;
|
||||
if (cl->dead) return 1;
|
||||
if (cl->delete_me) return 1;
|
||||
|
@ -1414,22 +1414,22 @@ _ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
{
|
||||
unsigned char *inbuf = NULL;
|
||||
int inbuf_num = 0;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
char buf[65536];
|
||||
int num;
|
||||
|
||||
|
||||
errno = 0;
|
||||
num = read(cl->fd, buf, 65536);
|
||||
if (num < 1)
|
||||
{
|
||||
if (inbuf)
|
||||
if (inbuf)
|
||||
{
|
||||
if (!cl->delete_me)
|
||||
{
|
||||
Ecore_Con_Event_Client_Data *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Client_Data));
|
||||
if (e)
|
||||
{
|
||||
|
@ -1443,27 +1443,27 @@ _ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((errno == EIO) || (errno == EBADF) ||
|
||||
(errno == EPIPE) || (errno == EINVAL) ||
|
||||
if ((errno == EIO) || (errno == EBADF) ||
|
||||
(errno == EPIPE) || (errno == EINVAL) ||
|
||||
(errno == ENOSPC) || (num == 0)/* is num == 0 right? */)
|
||||
{
|
||||
if (!cl->delete_me)
|
||||
{
|
||||
/* we lost our client! */
|
||||
Ecore_Con_Event_Client_Del *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
|
||||
if (e)
|
||||
{
|
||||
cl->event_count++;
|
||||
e->client = cl;
|
||||
ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
|
||||
ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
|
||||
_ecore_con_event_client_del_free,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
cl->dead = 1;
|
||||
if (cl->fd_handler)
|
||||
if (cl->fd_handler)
|
||||
ecore_main_fd_handler_del(cl->fd_handler);
|
||||
cl->fd_handler = NULL;
|
||||
}
|
||||
|
@ -1498,7 +1498,7 @@ _ecore_con_server_flush(Ecore_Con_Server *svr)
|
|||
*/
|
||||
if (svr->write_buf_size == svr->write_buf_offset)
|
||||
return;
|
||||
|
||||
|
||||
num = svr->write_buf_size - svr->write_buf_offset;
|
||||
#if USE_OPENSSL
|
||||
if (!svr->ssl)
|
||||
|
@ -1511,10 +1511,10 @@ _ecore_con_server_flush(Ecore_Con_Server *svr)
|
|||
errno == ENOSPC);
|
||||
#if USE_OPENSSL
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
count = SSL_write(svr->ssl, svr->write_buf + svr->write_buf_offset, num);
|
||||
|
||||
|
||||
if (count < 1)
|
||||
{
|
||||
ssl_err = SSL_get_error(svr->ssl, count);
|
||||
|
@ -1545,7 +1545,7 @@ _ecore_con_server_flush(Ecore_Con_Server *svr)
|
|||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
svr->write_buf_offset += count;
|
||||
if (svr->write_buf_offset >= svr->write_buf_size)
|
||||
{
|
||||
|
@ -1575,7 +1575,7 @@ _ecore_con_client_flush(Ecore_Con_Client *cl)
|
|||
{
|
||||
/* we lost our client! */
|
||||
Ecore_Con_Event_Client_Del *e;
|
||||
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
|
||||
if (e)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* - iconfication api needs to work
|
||||
* - maximization api needs to work
|
||||
* - document all calls
|
||||
*
|
||||
*
|
||||
* later:
|
||||
* - buffer back-end that renders to an evas_image_object ???
|
||||
* - qt back-end ???
|
||||
|
@ -53,6 +53,7 @@ extern "C" {
|
|||
#define HAVE_ECORE_EVAS_GL 1
|
||||
#define HAVE_ECORE_EVAS_X11_16 1
|
||||
#define HAVE_ECORE_EVAS_DIRECTFB 1
|
||||
#define HAVE_ECORE_EVAS_WIN32 1
|
||||
|
||||
typedef enum _Ecore_Evas_Engine_Type
|
||||
{
|
||||
|
@ -63,6 +64,8 @@ typedef enum _Ecore_Evas_Engine_Type
|
|||
ECORE_EVAS_ENGINE_XRENDER_X11,
|
||||
ECORE_EVAS_ENGINE_DIRECTFB,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_X11_16,
|
||||
ECORE_EVAS_ENGINE_SOFTWARE_DDRAW,
|
||||
ECORE_EVAS_ENGINE_DIRECT3D,
|
||||
ECORE_EVAS_ENGINE_SDL
|
||||
} Ecore_Evas_Engine_Type;
|
||||
|
||||
|
@ -70,12 +73,16 @@ typedef enum _Ecore_Evas_Engine_Type
|
|||
#define _ECORE_X_WINDOW_PREDEF
|
||||
typedef unsigned int Ecore_X_Window;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _ECORE_DIRECTFB_H
|
||||
#define _ECORE_DIRECTFB_WINDOW_PREDEF
|
||||
typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __ECORE_WIN32_H__
|
||||
typedef void Ecore_Win32_Window;
|
||||
#endif
|
||||
|
||||
#ifndef _ECORE_EVAS_PRIVATE_H
|
||||
/* basic data types */
|
||||
typedef struct _Ecore_Evas Ecore_Evas;
|
||||
|
@ -84,7 +91,7 @@ typedef struct _Ecore_Evas Ecore_Evas;
|
|||
/* module setup/shutdown calls */
|
||||
|
||||
EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);
|
||||
|
||||
|
||||
EAPI int ecore_evas_init(void);
|
||||
EAPI int ecore_evas_shutdown(void);
|
||||
|
||||
|
@ -95,7 +102,7 @@ EAPI Ecore_X_Window ecore_evas_software_x11_subwindow_get(Ecore_Evas *ee);
|
|||
EAPI void ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, int on);
|
||||
EAPI int ecore_evas_software_x11_direct_resize_get(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
|
||||
|
||||
|
||||
EAPI Ecore_Evas *ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
|
||||
EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(Ecore_Evas *ee);
|
||||
EAPI Ecore_X_Window ecore_evas_gl_x11_subwindow_get(Ecore_Evas *ee);
|
||||
|
@ -124,9 +131,21 @@ EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(Ecore_Evas *ee);
|
|||
|
||||
EAPI Ecore_Evas *ecore_evas_buffer_new(int w, int h);
|
||||
EAPI const int *ecore_evas_buffer_pixels_get(Ecore_Evas *ee);
|
||||
|
||||
|
||||
EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target);
|
||||
|
||||
EAPI Ecore_Evas *ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI Ecore_Evas *ecore_evas_direct3d_new(Ecore_Win32_Window *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI Ecore_Evas *ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha);
|
||||
|
||||
/* generic manipulation calls */
|
||||
|
@ -161,10 +180,10 @@ EAPI int ecore_evas_shaped_get(Ecore_Evas *ee);
|
|||
EAPI void ecore_evas_alpha_set(Ecore_Evas *ee, int alpha);
|
||||
EAPI int ecore_evas_alpha_get(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_show(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_hide(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_hide(Ecore_Evas *ee);
|
||||
EAPI int ecore_evas_visibility_get(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_raise(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_lower(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_lower(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t);
|
||||
EAPI const char *ecore_evas_title_get(Ecore_Evas *ee);
|
||||
EAPI void ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
|
||||
|
|
|
@ -30,6 +30,16 @@ ECORE_DIRECTFB_LIB =
|
|||
ECORE_DIRECTFB_LDF =
|
||||
endif
|
||||
|
||||
if BUILD_ECORE_WIN32
|
||||
ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32
|
||||
ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la
|
||||
ECORE_WIN32_LDF = -L$(top_builddir)/src/lib/ecore_win32/.libs
|
||||
else
|
||||
ECORE_WIN32_INC =
|
||||
ECORE_WIN32_LIB =
|
||||
ECORE_WIN32_LDF =
|
||||
endif
|
||||
|
||||
if BUILD_ECORE_SDL
|
||||
ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl
|
||||
ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la
|
||||
|
@ -48,6 +58,7 @@ INCLUDES = \
|
|||
$(ECORE_X_INC) \
|
||||
$(ECORE_FB_INC) \
|
||||
$(ECORE_DIRECTFB_INC) \
|
||||
$(ECORE_WIN32_INC) \
|
||||
$(ECORE_SDL_INC) \
|
||||
@EVAS_CFLAGS@ \
|
||||
@XCB_CFLAGS@
|
||||
|
@ -56,6 +67,7 @@ libecore_evas_la_LDFLAGS = -version-info 1:0:0 \
|
|||
$(ECORE_X_LDF) \
|
||||
$(ECORE_FB_LDF) \
|
||||
$(ECORE_DIRECTFB_LDF) \
|
||||
$(ECORE_WIN32_LDF) \
|
||||
$(ECORE_SDL_LDF) \
|
||||
-L$(top_builddir)/src/lib/ecore/.libs
|
||||
|
||||
|
@ -72,21 +84,25 @@ ecore_evas_x.c \
|
|||
ecore_evas_fb.c \
|
||||
ecore_evas_buffer.c \
|
||||
ecore_evas_directfb.c \
|
||||
ecore_evas_win32.c \
|
||||
ecore_evas_sdl.c
|
||||
|
||||
libecore_evas_la_LIBADD = \
|
||||
$(ECORE_X_LIB) \
|
||||
$(ECORE_FB_LIB) \
|
||||
$(ECORE_DIRECTFB_LIB) \
|
||||
$(ECORE_WIN32_LIB) \
|
||||
$(ECORE_SDL_LIB) \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||
@EVAS_LIBS@ \
|
||||
@XCB_LIBS@
|
||||
@XCB_LIBS@ \
|
||||
@create_shared_lib@
|
||||
|
||||
libecore_evas_la_DEPENDENCIES = \
|
||||
$(ECORE_X_LIB) \
|
||||
$(ECORE_FB_LIB) \
|
||||
$(ECORE_DIRECTFB_LIB) \
|
||||
$(ECORE_WIN32_LIB) \
|
||||
$(ECORE_SDL_LIB) \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la
|
||||
|
||||
|
@ -99,4 +115,5 @@ ecore_evas_x.c \
|
|||
ecore_evas_fb.c \
|
||||
ecore_evas_buffer.c \
|
||||
ecore_evas_directfb.c \
|
||||
ecore_evas_win32.c \
|
||||
ecore_evas_sdl.c
|
||||
|
|
|
@ -10,7 +10,7 @@ static int _ecore_evas_init_count = 0;
|
|||
* Query if a particular renginering engine target has support
|
||||
* @param engine The engine to check support for
|
||||
* @return 1 if the particualr engine is supported, 0 if it is not
|
||||
*
|
||||
*
|
||||
* Query if engine @param engine is supported by ecore_evas. 1 is returned if
|
||||
* it is, and 0 is returned if it is not supported.
|
||||
*/
|
||||
|
@ -24,42 +24,42 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
|
|||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case ECORE_EVAS_ENGINE_SOFTWARE_FB:
|
||||
#ifdef BUILD_ECORE_EVAS_FB
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case ECORE_EVAS_ENGINE_GL_X11:
|
||||
#ifdef BUILD_ECORE_EVAS_GL
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case ECORE_EVAS_ENGINE_XRENDER_X11:
|
||||
#ifdef BUILD_ECORE_EVAS_XRENDER
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case ECORE_EVAS_ENGINE_SOFTWARE_X11_16:
|
||||
#ifdef BUILD_ECORE_EVAS_X11_16
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER:
|
||||
#ifdef BUILD_ECORE_EVAS_BUFFER
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
case ECORE_EVAS_ENGINE_DIRECTFB:
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
|
@ -83,7 +83,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
|
|||
/**
|
||||
* Init the Evas system.
|
||||
* @return greater than 0 on success, 0 on failure
|
||||
*
|
||||
*
|
||||
* Set up the Evas wrapper system.
|
||||
*/
|
||||
EAPI int
|
||||
|
@ -97,7 +97,7 @@ ecore_evas_init(void)
|
|||
/**
|
||||
* Shut down the Evas system.
|
||||
* @return 0 if ecore evas is fully shut down, or > 0 if it still needs to be shut down
|
||||
*
|
||||
*
|
||||
* This closes the Evas system down.
|
||||
*/
|
||||
EAPI int
|
||||
|
@ -118,7 +118,7 @@ ecore_evas_shutdown(void)
|
|||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
while (_ecore_evas_directfb_shutdown());
|
||||
#endif
|
||||
evas_shutdown();
|
||||
evas_shutdown();
|
||||
}
|
||||
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
|
||||
return _ecore_evas_init_count;
|
||||
|
@ -126,7 +126,7 @@ ecore_evas_shutdown(void)
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -140,7 +140,7 @@ ecore_evas_ecore_evas_get(Evas *e)
|
|||
* Free an Ecore_Evas
|
||||
* @param ee The Ecore_Evas to free
|
||||
*
|
||||
* This frees up any memory used by the Ecore_Evas.
|
||||
* This frees up any memory used by the Ecore_Evas.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_evas_free(Ecore_Evas *ee)
|
||||
|
@ -165,7 +165,7 @@ ecore_evas_free(Ecore_Evas *ee)
|
|||
*
|
||||
* @returns NULL on error or no data found, A pointer to the user data on
|
||||
* success.
|
||||
*
|
||||
*
|
||||
* @see ecore_evas_data_set
|
||||
*/
|
||||
EAPI void *
|
||||
|
@ -209,7 +209,7 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
|
|||
}
|
||||
|
||||
if (!key) return;
|
||||
|
||||
|
||||
ee->data = evas_hash_del(ee->data, key, NULL);
|
||||
if (data)
|
||||
ee->data = evas_hash_add(ee->data, key, data);
|
||||
|
@ -219,10 +219,10 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
|
|||
#define IFE return;}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas resize events.
|
||||
* Set a callback for Ecore_Evas resize events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee is resized.
|
||||
*/
|
||||
|
@ -241,10 +241,10 @@ ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas move events.
|
||||
* Set a callback for Ecore_Evas move events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee is moved.
|
||||
*/
|
||||
|
@ -263,10 +263,10 @@ ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas show events.
|
||||
* Set a callback for Ecore_Evas show events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee is shown.
|
||||
*/
|
||||
|
@ -285,10 +285,10 @@ ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas hide events.
|
||||
* Set a callback for Ecore_Evas hide events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee is hidden.
|
||||
*/
|
||||
|
@ -307,10 +307,10 @@ ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas delete request events.
|
||||
* Set a callback for Ecore_Evas delete request events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee gets a delete request.
|
||||
*/
|
||||
|
@ -329,10 +329,10 @@ ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas destroy events.
|
||||
* Set a callback for Ecore_Evas destroy events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee is destroyed.
|
||||
*/
|
||||
|
@ -351,10 +351,10 @@ ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas focus in events.
|
||||
* Set a callback for Ecore_Evas focus in events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee gets focus.
|
||||
*/
|
||||
|
@ -373,10 +373,10 @@ ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas focus out events.
|
||||
* Set a callback for Ecore_Evas focus out events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee loses focus.
|
||||
*/
|
||||
|
@ -398,7 +398,7 @@ ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
* Set a callback for Ecore_Evas sticky events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee becomes sticky.
|
||||
*/
|
||||
|
@ -420,7 +420,7 @@ ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
* Set a callback for Ecore_Evas un-sticky events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever @p ee becomes un-sticky.
|
||||
*/
|
||||
|
@ -439,10 +439,10 @@ ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas mouse in events.
|
||||
* Set a callback for Ecore_Evas mouse in events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever the mouse enters @p ee.
|
||||
*/
|
||||
|
@ -461,10 +461,10 @@ ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas mouse out events.
|
||||
* Set a callback for Ecore_Evas mouse out events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called whenever the mouse leaves @p ee.
|
||||
*/
|
||||
|
@ -483,10 +483,10 @@ ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas mouse pre render events.
|
||||
* Set a callback for Ecore_Evas mouse pre render events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called just before the evas in @p ee is rendered.
|
||||
*/
|
||||
|
@ -505,10 +505,10 @@ ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
/**
|
||||
* Set a callback for Ecore_Evas mouse post render events.
|
||||
* Set a callback for Ecore_Evas mouse post render events.
|
||||
* @param ee The Ecore_Evas to set callbacks on
|
||||
* @param func The function to call
|
||||
|
||||
|
||||
* A call to this function will set a callback on an Ecore_Evas, causing
|
||||
* @p func to be called just after the evas in @p ee is rendered.
|
||||
*/
|
||||
|
@ -527,10 +527,10 @@ ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an Ecore_Evas's Evas
|
||||
* Get an Ecore_Evas's Evas
|
||||
* @param ee The Ecore_Evas whose Evas you wish to get
|
||||
* @return The Evas wrapped by @p ee
|
||||
*
|
||||
*
|
||||
* This function returns the Evas contained within @p ee.
|
||||
*/
|
||||
EAPI Evas *
|
||||
|
@ -740,7 +740,7 @@ ecore_evas_rotation_get(Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
/**
|
||||
* Set whether an Ecore_Evas is shaped or not.
|
||||
* Set whether an Ecore_Evas is shaped or not.
|
||||
* @param ee The Ecore_Evas to shape
|
||||
* @param shaped 1 to shape, 0 to not
|
||||
*
|
||||
|
@ -784,7 +784,7 @@ ecore_evas_shaped_get(Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
/**
|
||||
* Set whether an Ecore_Evas has an alpha channel or not.
|
||||
* Set whether an Ecore_Evas has an alpha channel or not.
|
||||
* @param ee The Ecore_Evas to shape
|
||||
* @param alpha 1 to enable the alpha channel, 0 to disable it
|
||||
*
|
||||
|
@ -829,7 +829,7 @@ ecore_evas_alpha_get(Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
/**
|
||||
* Show an Ecore_Evas' window
|
||||
* Show an Ecore_Evas' window
|
||||
* @param ee The Ecore_Evas to show.
|
||||
*
|
||||
* This function makes @p ee visible.
|
||||
|
@ -848,7 +848,7 @@ ecore_evas_show(Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
/**
|
||||
* Hide an Ecore_Evas' window
|
||||
* Hide an Ecore_Evas' window
|
||||
* @param ee The Ecore_Evas to show.
|
||||
*
|
||||
* This function makes @p ee hidden.
|
||||
|
@ -927,7 +927,7 @@ ecore_evas_lower(Ecore_Evas *ee)
|
|||
* Set the title of an Ecore_Evas' window
|
||||
* @param ee The Ecore_Evas whose title you wish to set.
|
||||
* @param t The title
|
||||
*
|
||||
*
|
||||
* This function sets the title of @p ee to @p t.
|
||||
*/
|
||||
EAPI void
|
||||
|
@ -1253,7 +1253,7 @@ ecore_evas_size_step_get(Ecore_Evas *ee, int *w, int *h)
|
|||
* @param layer
|
||||
* @param hot_x The x coordinate of the cursor's hot spot
|
||||
* @param hot_y The y coordinate of the cursor's hot spot
|
||||
*
|
||||
*
|
||||
* This function makes the mouse cursor over @p ee be the image specified by
|
||||
* @p file. The actual point within the image that the mouse is at is specified
|
||||
* by @p hot_x and @p hot_y, which are coordinates with respect to the top left
|
||||
|
@ -1568,12 +1568,12 @@ ecore_evas_fullscreen_get(Ecore_Evas *ee)
|
|||
return ee->prop.fullscreen ? 1:0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not an Ecore_Evas' window should avoid damage
|
||||
/**
|
||||
* Set whether or not an Ecore_Evas' window should avoid damage
|
||||
*
|
||||
* @param ee The Ecore_Evas
|
||||
* @param on 1 to avoid damage, 0 to not
|
||||
*
|
||||
*
|
||||
* This function causes @p ee to be drawn to a pixmap to avoid recalculations.
|
||||
* On expose events it will copy from the pixmap to the window.
|
||||
*/
|
||||
|
@ -1623,7 +1623,7 @@ ecore_evas_withdrawn_set(Ecore_Evas *ee, int withdrawn)
|
|||
"ecore_evas_withdrawn_set");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IFC(ee, fn_withdrawn_set) (ee, withdrawn);
|
||||
IFE;
|
||||
}
|
||||
|
@ -1662,14 +1662,14 @@ ecore_evas_sticky_set(Ecore_Evas *ee, int sticky)
|
|||
"ecore_evas_sticky_set");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IFC(ee, fn_sticky_set) (ee, sticky);
|
||||
IFE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sticky state of an Ecore_Evas' window.
|
||||
*
|
||||
*
|
||||
* @param ee The Ecore_Evas whose window's sticky state is returned.
|
||||
* @return The Ecore_Evas window's sticky state.
|
||||
*
|
||||
|
@ -1702,14 +1702,14 @@ ecore_evas_ignore_events_set(Ecore_Evas *ee, int ignore)
|
|||
"ecore_evas_ignore_events_set");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IFC(ee, fn_ignore_events_set) (ee, ignore);
|
||||
IFE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ignore state of an Ecore_Evas' window.
|
||||
*
|
||||
*
|
||||
* @param ee The Ecore_Evas whose window's ignore events state is returned.
|
||||
* @return The Ecore_Evas window's ignore state.
|
||||
*
|
||||
|
@ -1726,7 +1726,7 @@ ecore_evas_ignore_events_get(Ecore_Evas *ee)
|
|||
return ee->ignore_events ? 1 : 0;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
/* fps debug calls - for debugging how much time your app actually spends */
|
||||
/* rendering graphics... :) */
|
||||
|
||||
|
@ -1738,7 +1738,7 @@ void
|
|||
_ecore_evas_fps_debug_init(void)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
|
||||
_ecore_evas_fps_debug_init_count++;
|
||||
if (_ecore_evas_fps_debug_init_count > 1) return;
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
|
||||
|
@ -1751,7 +1751,7 @@ _ecore_evas_fps_debug_init(void)
|
|||
if (_ecore_evas_fps_debug_fd >= 0)
|
||||
{
|
||||
unsigned int zero = 0;
|
||||
|
||||
|
||||
write(_ecore_evas_fps_debug_fd, &zero, sizeof(unsigned int));
|
||||
_ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int),
|
||||
PROT_READ | PROT_WRITE,
|
||||
|
@ -1768,7 +1768,7 @@ _ecore_evas_fps_debug_shutdown(void)
|
|||
if (_ecore_evas_fps_debug_fd >= 0)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid());
|
||||
unlink(buf);
|
||||
if (_ecore_evas_fps_rendertime_mmap)
|
||||
|
@ -1784,11 +1784,11 @@ _ecore_evas_fps_debug_shutdown(void)
|
|||
void
|
||||
_ecore_evas_fps_debug_rendertime_add(double t)
|
||||
{
|
||||
if ((_ecore_evas_fps_debug_fd >= 0) &&
|
||||
if ((_ecore_evas_fps_debug_fd >= 0) &&
|
||||
(_ecore_evas_fps_rendertime_mmap))
|
||||
{
|
||||
unsigned int tm;
|
||||
|
||||
|
||||
tm = (unsigned int)(t * 1000000.0);
|
||||
/* i know its not 100% theoretically guaranteed, but i'd say a write */
|
||||
/* of an int could be considered atomic for all practical purposes */
|
||||
|
@ -1836,7 +1836,7 @@ static int
|
|||
_ecore_evas_cb_idle_flush(void *data)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
|
||||
ee = (Ecore_Evas *)data;
|
||||
evas_render_idle_flush(ee->evas);
|
||||
ee->engine.idle_flush_timer = NULL;
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#ifdef BUILD_ECORE_EVAS_BUFFER
|
||||
static int _ecore_evas_init_count = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
static int _ecore_evas_fps_debug = 0;
|
||||
#endif /* _WIN32 */
|
||||
|
||||
static Ecore_Evas *ecore_evases = NULL;
|
||||
|
||||
|
@ -24,20 +26,22 @@ _ecore_evas_buffer_init(void)
|
|||
{
|
||||
_ecore_evas_init_count++;
|
||||
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
|
||||
#ifndef _WIN32
|
||||
if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
|
||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
|
||||
#endif /* _WIN32 */
|
||||
return _ecore_evas_init_count;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_buffer_free(Ecore_Evas *ee)
|
||||
{
|
||||
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
|
||||
ecore_evases = _ecore_list2_remove(ecore_evases, ee);
|
||||
_ecore_evas_buffer_shutdown();
|
||||
if (ee->engine.buffer.image)
|
||||
{
|
||||
Ecore_Evas *ee2;
|
||||
|
||||
|
||||
ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent");
|
||||
evas_object_del(ee->engine.buffer.image);
|
||||
ee2->sub_ecore_evas = evas_list_remove(ee2->sub_ecore_evas, ee);
|
||||
|
@ -50,7 +54,7 @@ static void
|
|||
_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
|
||||
{
|
||||
Evas_Engine_Info_Buffer *einfo;
|
||||
|
||||
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
if ((w == ee->w) && (h == ee->h)) return;
|
||||
|
@ -69,7 +73,7 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
|
|||
if (ee->engine.buffer.pixels) free(ee->engine.buffer.pixels);
|
||||
ee->engine.buffer.pixels = malloc(ee->w * ee->h * sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
|
||||
if (einfo)
|
||||
{
|
||||
|
@ -82,9 +86,9 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
|
|||
einfo->info.func.free_update_region = NULL;
|
||||
evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo);
|
||||
}
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
if (ee->func.fn_resize) ee->func.fn_resize(ee);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_ecore_evas_buffer_shutdown(void)
|
||||
{
|
||||
|
@ -95,7 +99,9 @@ _ecore_evas_buffer_shutdown(void)
|
|||
{
|
||||
_ecore_evas_free((Ecore_Evas *)ecore_evases);
|
||||
}
|
||||
#ifndef _WIN32
|
||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
|
||||
return _ecore_evas_init_count;
|
||||
|
@ -109,7 +115,7 @@ _ecore_evas_buffer_render(Ecore_Evas *ee)
|
|||
for (ll = ee->sub_ecore_evas; ll; ll = ll->next)
|
||||
{
|
||||
Ecore_Evas *ee2;
|
||||
|
||||
|
||||
ee2 = ll->data;
|
||||
if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
|
||||
_ecore_evas_buffer_render(ee2);
|
||||
|
@ -119,7 +125,7 @@ _ecore_evas_buffer_render(Ecore_Evas *ee)
|
|||
if (ee->engine.buffer.image)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
|
||||
evas_object_image_size_get(ee->engine.buffer.image, &w, &h);
|
||||
if ((w != ee->w) || (h != ee->h))
|
||||
_ecore_evas_resize(ee, w, h);
|
||||
|
@ -128,9 +134,9 @@ _ecore_evas_buffer_render(Ecore_Evas *ee)
|
|||
if (ee->engine.buffer.image)
|
||||
{
|
||||
for (l = updates; l; l = l->next)
|
||||
{
|
||||
{
|
||||
Evas_Rectangle *r;
|
||||
|
||||
|
||||
r = l->data;
|
||||
if (ee->engine.buffer.image)
|
||||
evas_object_image_data_update_add(ee->engine.buffer.image,
|
||||
|
@ -144,16 +150,16 @@ 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_object_geometry_get(ee->engine.buffer.image, &xx, &yy, NULL, NULL);
|
||||
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;
|
||||
|
@ -166,7 +172,7 @@ _ecore_evas_buffer_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj
|
|||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Mouse_In *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
|
||||
|
@ -177,7 +183,7 @@ _ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj
|
|||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Mouse_Out *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
|
||||
|
@ -186,9 +192,9 @@ _ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj
|
|||
static void
|
||||
_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Mouse_Down *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
|
||||
|
@ -199,7 +205,7 @@ _ecore_evas_buffer_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj
|
|||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Mouse_Up *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
|
||||
|
@ -211,7 +217,7 @@ _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *ob
|
|||
Ecore_Evas *ee;
|
||||
Evas_Event_Mouse_Move *ev;
|
||||
Evas_Coord x, y;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
x = ev->cur.canvas.x;
|
||||
|
@ -225,7 +231,7 @@ _ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *o
|
|||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Mouse_Wheel *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
|
||||
|
@ -235,7 +241,7 @@ static void
|
|||
_ecore_evas_buffer_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
|
||||
ee = data;
|
||||
if (ee->driver) _ecore_evas_free(ee);
|
||||
}
|
||||
|
@ -245,7 +251,7 @@ _ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__,
|
|||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Key_Down *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
|
||||
|
@ -292,7 +298,7 @@ _ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, v
|
|||
{
|
||||
Ecore_Evas *ee;
|
||||
Evas_Event_Key_Up *ev;
|
||||
|
||||
|
||||
ee = data;
|
||||
ev = event_info;
|
||||
if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
|
||||
|
@ -338,7 +344,7 @@ static void
|
|||
_ecore_evas_buffer_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
|
||||
ee = data;
|
||||
ee->prop.focused = 1;
|
||||
if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
|
||||
|
@ -348,7 +354,7 @@ static void
|
|||
_ecore_evas_buffer_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
|
||||
ee = data;
|
||||
ee->prop.focused = 0;
|
||||
if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
|
||||
|
@ -358,7 +364,7 @@ static void
|
|||
_ecore_evas_buffer_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
|
||||
ee = data;
|
||||
ee->visible = 1;
|
||||
if (ee->func.fn_show) ee->func.fn_show(ee);
|
||||
|
@ -368,7 +374,7 @@ static void
|
|||
_ecore_evas_buffer_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
||||
|
||||
ee = data;
|
||||
ee->visible = 0;
|
||||
if (ee->func.fn_hide) ee->func.fn_hide(ee);
|
||||
|
@ -442,11 +448,11 @@ ecore_evas_buffer_new(int w, int h)
|
|||
if (!ee) return NULL;
|
||||
|
||||
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
||||
|
||||
|
||||
_ecore_evas_buffer_init();
|
||||
|
||||
|
||||
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
|
||||
|
||||
|
||||
ee->driver = "buffer";
|
||||
|
||||
if (w < 1) w = 1;
|
||||
|
@ -466,16 +472,16 @@ ecore_evas_buffer_new(int w, int h)
|
|||
ee->prop.fullscreen = 0;
|
||||
ee->prop.withdrawn = 0;
|
||||
ee->prop.sticky = 0;
|
||||
|
||||
|
||||
/* init evas here */
|
||||
ee->evas = evas_new();
|
||||
evas_data_attach_set(ee->evas, ee);
|
||||
evas_output_method_set(ee->evas, rmethod);
|
||||
evas_output_size_set(ee->evas, w, h);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
||||
|
||||
|
||||
ee->engine.buffer.pixels = malloc(w * h * sizeof(int));
|
||||
|
||||
|
||||
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
|
||||
if (einfo)
|
||||
{
|
||||
|
@ -497,14 +503,14 @@ ecore_evas_buffer_new(int w, int h)
|
|||
evas_key_lock_add(ee->evas, "Caps_Lock");
|
||||
evas_key_lock_add(ee->evas, "Num_Lock");
|
||||
evas_key_lock_add(ee->evas, "Scroll_Lock");
|
||||
|
||||
|
||||
evas_event_feed_mouse_in(ee->evas, 0, NULL);
|
||||
|
||||
ecore_evases = _ecore_list2_prepend(ecore_evases, ee);
|
||||
return ee;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI const int *
|
||||
|
@ -515,7 +521,7 @@ ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
|
|||
return ee->engine.buffer.pixels;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
@ -534,13 +540,13 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
|
|||
if (!ee) return NULL;
|
||||
|
||||
o = evas_object_image_add(ee_target->evas);
|
||||
|
||||
|
||||
ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
|
||||
|
||||
|
||||
_ecore_evas_buffer_init();
|
||||
|
||||
|
||||
ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func;
|
||||
|
||||
|
||||
ee->driver = "buffer";
|
||||
|
||||
w = 1;
|
||||
|
@ -560,14 +566,14 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
|
|||
ee->prop.fullscreen = 0;
|
||||
ee->prop.withdrawn = 0;
|
||||
ee->prop.sticky = 0;
|
||||
|
||||
|
||||
/* init evas here */
|
||||
ee->evas = evas_new();
|
||||
evas_data_attach_set(ee->evas, ee);
|
||||
evas_output_method_set(ee->evas, rmethod);
|
||||
evas_output_size_set(ee->evas, w, h);
|
||||
evas_output_viewport_set(ee->evas, 0, 0, w, h);
|
||||
|
||||
|
||||
ee->engine.buffer.image = o;
|
||||
evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee);
|
||||
evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target);
|
||||
|
@ -635,10 +641,10 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
|
|||
evas_key_lock_add(ee->evas, "Caps_Lock");
|
||||
evas_key_lock_add(ee->evas, "Num_Lock");
|
||||
evas_key_lock_add(ee->evas, "Scroll_Lock");
|
||||
|
||||
|
||||
ee_target->sub_ecore_evas = evas_list_append(ee_target->sub_ecore_evas, ee);
|
||||
return o;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/mman.h>
|
||||
#ifndef _WIN32
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include <Evas.h>
|
||||
|
@ -52,15 +52,25 @@
|
|||
# endif /* HAVE_ECORE_X_XCB */
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_FB
|
||||
#include <Evas_Engine_FB.h>
|
||||
# include <Evas_Engine_FB.h>
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||
#include <Evas_Engine_DirectFB.h>
|
||||
#include "Ecore_DirectFB.h"
|
||||
# include <Evas_Engine_DirectFB.h>
|
||||
# include "Ecore_DirectFB.h"
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_BUFFER
|
||||
#include <Evas_Engine_Buffer.h>
|
||||
# include <Evas_Engine_Buffer.h>
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_WIN32
|
||||
# include "Ecore_Win32.h"
|
||||
# ifdef HAVE_DIRECTDRAW
|
||||
# include <Evas_Engine_Software_DDraw.h>
|
||||
# endif
|
||||
# ifdef HAVE_DIRECT3D
|
||||
# include <Evas_Engine_Direct3D.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#define IDLE_FLUSH_TIME 0.5
|
||||
|
||||
|
@ -70,7 +80,7 @@ typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func;
|
|||
|
||||
struct _Ecore_Evas_Engine_Func
|
||||
{
|
||||
void (*fn_free) (Ecore_Evas *ee);
|
||||
void (*fn_free) (Ecore_Evas *ee);
|
||||
void (*fn_callback_resize_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_move_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_show_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
|
@ -82,7 +92,7 @@ struct _Ecore_Evas_Engine_Func
|
|||
void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_sticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_unsticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_unsticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_pre_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_callback_post_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
|
||||
void (*fn_move) (Ecore_Evas *ee, int x, int y);
|
||||
|
@ -119,7 +129,7 @@ struct _Ecore_Evas_Engine_Func
|
|||
struct _Ecore_Evas_Engine
|
||||
{
|
||||
Ecore_Evas_Engine_Func *func;
|
||||
|
||||
|
||||
#ifdef BUILD_ECORE_X
|
||||
struct {
|
||||
Ecore_X_Window win_root;
|
||||
|
@ -150,7 +160,7 @@ struct _Ecore_Evas_Engine
|
|||
unsigned char below : 1;
|
||||
} state;
|
||||
} x;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_EVAS_FB
|
||||
struct {
|
||||
int real_w;
|
||||
|
@ -168,9 +178,16 @@ struct _Ecore_Evas_Engine
|
|||
Ecore_DirectFB_Window *window;
|
||||
} directfb;
|
||||
#endif
|
||||
#ifdef BUILD_ECORE_WIN32
|
||||
struct {
|
||||
Ecore_Win32_Window *parent;
|
||||
Ecore_Win32_Window *window;
|
||||
} win32;
|
||||
#endif
|
||||
|
||||
Ecore_Timer *idle_flush_timer;
|
||||
};
|
||||
|
||||
|
||||
struct _Ecore_Evas
|
||||
{
|
||||
Ecore_List __list_data;
|
||||
|
@ -194,7 +211,7 @@ struct _Ecore_Evas
|
|||
struct {
|
||||
int w, h;
|
||||
} expecting_resize;
|
||||
|
||||
|
||||
struct {
|
||||
char *title;
|
||||
char *name;
|
||||
|
@ -202,8 +219,8 @@ struct _Ecore_Evas
|
|||
struct {
|
||||
int w, h;
|
||||
} min,
|
||||
max,
|
||||
base,
|
||||
max,
|
||||
base,
|
||||
step;
|
||||
struct {
|
||||
Evas_Object *object;
|
||||
|
@ -225,7 +242,7 @@ struct _Ecore_Evas
|
|||
char sticky : 1;
|
||||
char request_pos : 1;
|
||||
} prop;
|
||||
|
||||
|
||||
struct {
|
||||
void (*fn_resize) (Ecore_Evas *ee);
|
||||
void (*fn_move) (Ecore_Evas *ee);
|
||||
|
@ -236,13 +253,13 @@ struct _Ecore_Evas
|
|||
void (*fn_focus_in) (Ecore_Evas *ee);
|
||||
void (*fn_focus_out) (Ecore_Evas *ee);
|
||||
void (*fn_sticky) (Ecore_Evas *ee);
|
||||
void (*fn_unsticky) (Ecore_Evas *ee);
|
||||
void (*fn_unsticky) (Ecore_Evas *ee);
|
||||
void (*fn_mouse_in) (Ecore_Evas *ee);
|
||||
void (*fn_mouse_out) (Ecore_Evas *ee);
|
||||
void (*fn_pre_render) (Ecore_Evas *ee);
|
||||
void (*fn_post_render) (Ecore_Evas *ee);
|
||||
} func;
|
||||
|
||||
|
||||
Ecore_Evas_Engine engine;
|
||||
Evas_List *sub_ecore_evas;
|
||||
|
||||
|
@ -268,5 +285,5 @@ void _ecore_evas_fps_debug_shutdown(void);
|
|||
void _ecore_evas_fps_debug_rendertime_add(double t);
|
||||
void _ecore_evas_free(Ecore_Evas *ee);
|
||||
void _ecore_evas_idle_timeout_update(Ecore_Evas *ee);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
/* static Ecore_List *ecore_evas_input_devices = NULL; */
|
||||
|
||||
static int _ecore_evas_init_count = 0;
|
||||
#ifndef _WIN32
|
||||
static int _ecore_evas_fps_debug = 0;
|
||||
#endif /* _WIN32 */
|
||||
static Ecore_Evas *ecore_evases = NULL;
|
||||
static Ecore_Event_Handler *ecore_evas_event_handlers[10] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
|
@ -216,10 +218,12 @@ _ecore_evas_idle_enter(void *data __UNUSED__)
|
|||
double t1 = 0.;
|
||||
double t2 = 0.;
|
||||
|
||||
#ifndef _WIN32
|
||||
if (_ecore_evas_fps_debug)
|
||||
{
|
||||
t1 = ecore_time_get();
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
for (l = (Ecore_List2 *)ecore_evases; l; l = l->next)
|
||||
{
|
||||
Ecore_Evas *ee;
|
||||
|
@ -236,11 +240,13 @@ _ecore_evas_idle_enter(void *data __UNUSED__)
|
|||
else
|
||||
evas_norender(ee->evas);
|
||||
}
|
||||
#ifndef _WIN32
|
||||
if (_ecore_evas_fps_debug)
|
||||
{
|
||||
t2 = ecore_time_get();
|
||||
_ecore_evas_fps_debug_rendertime_add(t2 - t1);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -258,10 +264,14 @@ _ecore_evas_sdl_init(int w, int h)
|
|||
_ecore_evas_init_count++;
|
||||
if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
|
||||
|
||||
#ifndef _WIN32
|
||||
if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1;
|
||||
#endif /* _WIN32 */
|
||||
ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL);
|
||||
ecore_evas_event = ecore_timer_add(0.008, _ecore_evas_sdl_event, NULL);
|
||||
#ifndef _WIN32
|
||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_KEY_DOWN, _ecore_evas_sdl_event_key_down, NULL);
|
||||
ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_KEY_UP, _ecore_evas_sdl_event_key_up, NULL);
|
||||
|
@ -292,7 +302,9 @@ _ecore_evas_sdl_shutdown(void)
|
|||
ecore_evas_idle_enterer = NULL;
|
||||
ecore_timer_del(ecore_evas_event);
|
||||
ecore_evas_event = NULL;
|
||||
#ifndef _WIN32
|
||||
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
|
||||
return _ecore_evas_init_count;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,8 +7,8 @@
|
|||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#elif WIN32
|
||||
#include <winsock.h>
|
||||
#elif _WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#define DLT_ZERO 0
|
||||
|
@ -33,7 +33,7 @@ EAPI unsigned short
|
|||
_ecore_ipc_swap_16(unsigned short v)
|
||||
{
|
||||
unsigned char *s, t;
|
||||
|
||||
|
||||
s = (unsigned char *)(&v);
|
||||
t = s[0]; s[0] = s[1]; s[1] = t;
|
||||
return v;
|
||||
|
@ -43,7 +43,7 @@ EAPI unsigned int
|
|||
_ecore_ipc_swap_32(unsigned int v)
|
||||
{
|
||||
unsigned char *s, t;
|
||||
|
||||
|
||||
s = (unsigned char *)(&v);
|
||||
t = s[0]; s[0] = s[3]; s[3] = t;
|
||||
t = s[1]; s[1] = s[2]; s[2] = t;
|
||||
|
@ -54,7 +54,7 @@ EAPI unsigned long long
|
|||
_ecore_ipc_swap_64(unsigned long long v)
|
||||
{
|
||||
unsigned char *s, t;
|
||||
|
||||
|
||||
s = (unsigned char *)(&v);
|
||||
t = s[0]; s[0] = s[7]; s[7] = t;
|
||||
t = s[1]; s[1] = s[6]; s[6] = t;
|
||||
|
@ -223,7 +223,7 @@ static void _ecore_ipc_event_client_data_free(void *data, void *ev);
|
|||
static void _ecore_ipc_event_server_add_free(void *data, void *ev);
|
||||
static void _ecore_ipc_event_server_del_free(void *data, void *ev);
|
||||
static void _ecore_ipc_event_server_data_free(void *data, void *ev);
|
||||
|
||||
|
||||
EAPI int ECORE_IPC_EVENT_CLIENT_ADD = 0;
|
||||
EAPI int ECORE_IPC_EVENT_CLIENT_DEL = 0;
|
||||
EAPI int ECORE_IPC_EVENT_SERVER_ADD = 0;
|
||||
|
@ -275,7 +275,7 @@ ecore_ipc_init(void)
|
|||
_ecore_ipc_event_client_data, NULL);
|
||||
handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
|
||||
_ecore_ipc_event_server_data, NULL);
|
||||
return init_count;
|
||||
return init_count;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +327,7 @@ ecore_ipc_server_add(Ecore_Ipc_Type compl_type, const char *name, int port, cons
|
|||
Ecore_Ipc_Server *svr;
|
||||
Ecore_Ipc_Type type;
|
||||
Ecore_Con_Type extra = 0;
|
||||
|
||||
|
||||
svr = calloc(1, sizeof(Ecore_Ipc_Server));
|
||||
if (!svr) return NULL;
|
||||
type = compl_type;
|
||||
|
@ -385,7 +385,7 @@ ecore_ipc_server_connect(Ecore_Ipc_Type compl_type, char *name, int port, const
|
|||
Ecore_Ipc_Server *svr;
|
||||
Ecore_Ipc_Type type;
|
||||
Ecore_Con_Type extra = 0;
|
||||
|
||||
|
||||
svr = calloc(1, sizeof(Ecore_Ipc_Server));
|
||||
if (!svr) return NULL;
|
||||
type = compl_type;
|
||||
|
@ -439,7 +439,7 @@ ecore_ipc_server_del(Ecore_Ipc_Server *svr)
|
|||
svr->data = NULL;
|
||||
svr->delete_me = 1;
|
||||
if (svr->event_count == 0)
|
||||
{
|
||||
{
|
||||
while (svr->clients)
|
||||
ecore_ipc_client_del((Ecore_Ipc_Client *)svr->clients);
|
||||
ecore_con_server_del(svr->server);
|
||||
|
@ -564,7 +564,7 @@ ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int
|
|||
int ret;
|
||||
int *head, md = 0, d, s;
|
||||
unsigned char dat[sizeof(Ecore_Ipc_Msg_Head)];
|
||||
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER,
|
||||
|
@ -635,7 +635,7 @@ ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char
|
|||
|
||||
/**
|
||||
* Sets the max data payload size for an Ipc message in bytes
|
||||
*
|
||||
*
|
||||
* @param svr The given server.
|
||||
* @param size The maximum data payload size in bytes.
|
||||
* @ingroup Ecore_Ipc_Server_Group
|
||||
|
@ -654,7 +654,7 @@ ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *svr, int size)
|
|||
|
||||
/**
|
||||
* Gets the max data payload size for an Ipc message in bytes
|
||||
*
|
||||
*
|
||||
* @param svr The given server.
|
||||
* @return The maximum data payload in bytes.
|
||||
* @ingroup Ecore_Ipc_Server_Group
|
||||
|
@ -673,7 +673,7 @@ ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *svr)
|
|||
|
||||
/**
|
||||
* Gets the IP address of a server that has been connected to.
|
||||
*
|
||||
*
|
||||
* @param svr The given server.
|
||||
* @return A pointer to an internal string that contains the IP address of
|
||||
* the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
|
||||
|
@ -772,7 +772,7 @@ ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int r
|
|||
int ret;
|
||||
int *head, md = 0, d, s;
|
||||
unsigned char dat[sizeof(Ecore_Ipc_Msg_Head)];
|
||||
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
|
||||
|
@ -837,7 +837,7 @@ ecore_ipc_client_del(Ecore_Ipc_Client *cl)
|
|||
{
|
||||
void *data;
|
||||
Ecore_Ipc_Server *svr;
|
||||
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
|
||||
|
@ -867,7 +867,7 @@ ecore_ipc_client_del(Ecore_Ipc_Client *cl)
|
|||
*/
|
||||
EAPI void
|
||||
ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data)
|
||||
{
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
|
||||
|
@ -875,7 +875,7 @@ ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data)
|
|||
return;
|
||||
}
|
||||
cl->data = (void *)data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the data that has been associated with the given IPC client.
|
||||
|
@ -885,7 +885,7 @@ ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data)
|
|||
*/
|
||||
EAPI void *
|
||||
ecore_ipc_client_data_get(Ecore_Ipc_Client *cl)
|
||||
{
|
||||
{
|
||||
if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT,
|
||||
|
@ -897,7 +897,7 @@ ecore_ipc_client_data_get(Ecore_Ipc_Client *cl)
|
|||
|
||||
/**
|
||||
* Sets the max data payload size for an Ipc message in bytes
|
||||
*
|
||||
*
|
||||
* @param client The given client.
|
||||
* @param size The maximum data payload size in bytes.
|
||||
* @ingroup Ecore_Ipc_Client_Group
|
||||
|
@ -916,7 +916,7 @@ ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size)
|
|||
|
||||
/**
|
||||
* Sets the max data payload size for an Ipc message in bytes
|
||||
*
|
||||
*
|
||||
* @param cl The given client.
|
||||
* @param size The maximum data payload size in bytes.
|
||||
* @ingroup Ecore_Ipc_Client_Group
|
||||
|
@ -935,7 +935,7 @@ ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl)
|
|||
|
||||
/**
|
||||
* Gets the IP address of a client that has been connected to.
|
||||
*
|
||||
*
|
||||
* @param cl The given client.
|
||||
* @return A pointer to an internal string that contains the IP address of
|
||||
* the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
|
||||
|
@ -957,7 +957,7 @@ ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl)
|
|||
|
||||
/**
|
||||
* Flushes all pending data to the given client. Will return when done.
|
||||
*
|
||||
*
|
||||
* @param cl The given client.
|
||||
* @ingroup Ecore_Ipc_Client_Group
|
||||
*/
|
||||
|
@ -989,14 +989,14 @@ static int
|
|||
_ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Con_Event_Client_Add *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
||||
/* handling code here */
|
||||
{
|
||||
Ecore_Ipc_Client *cl;
|
||||
Ecore_Ipc_Server *svr;
|
||||
|
||||
|
||||
cl = calloc(1, sizeof(Ecore_Ipc_Client));
|
||||
if (!cl) return 0;
|
||||
svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client));
|
||||
|
@ -1009,7 +1009,7 @@ _ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
if (!cl->delete_me)
|
||||
{
|
||||
Ecore_Ipc_Event_Client_Add *e2;
|
||||
|
||||
|
||||
e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Add));
|
||||
if (e2)
|
||||
{
|
||||
|
@ -1027,13 +1027,13 @@ static int
|
|||
_ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Con_Event_Client_Del *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1;
|
||||
/* handling code here */
|
||||
{
|
||||
Ecore_Ipc_Client *cl;
|
||||
|
||||
|
||||
cl = ecore_con_client_data_get(e->client);
|
||||
{
|
||||
Ecore_Ipc_Event_Client_Del *e2;
|
||||
|
@ -1063,18 +1063,18 @@ static int
|
|||
_ecore_ipc_event_server_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Con_Event_Server_Add *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
||||
/* handling code here */
|
||||
{
|
||||
Ecore_Ipc_Server *svr;
|
||||
|
||||
|
||||
svr = ecore_con_server_data_get(e->server);
|
||||
if (!svr->delete_me)
|
||||
{
|
||||
Ecore_Ipc_Event_Server_Add *e2;
|
||||
|
||||
|
||||
e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Add));
|
||||
if (e2)
|
||||
{
|
||||
|
@ -1092,18 +1092,18 @@ static int
|
|||
_ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Con_Event_Server_Del *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1;
|
||||
/* handling code here */
|
||||
{
|
||||
Ecore_Ipc_Server *svr;
|
||||
|
||||
|
||||
svr = ecore_con_server_data_get(e->server);
|
||||
if (!svr->delete_me)
|
||||
{
|
||||
Ecore_Ipc_Event_Server_Del *e2;
|
||||
|
||||
|
||||
e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Del));
|
||||
if (e2)
|
||||
{
|
||||
|
@ -1171,9 +1171,9 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
Ecore_Ipc_Msg_Head msg;
|
||||
int offset = 0;
|
||||
unsigned char *buf;
|
||||
|
||||
|
||||
cl = ecore_con_client_data_get(e->client);
|
||||
|
||||
|
||||
if (!cl->buf)
|
||||
{
|
||||
cl->buf_size = e->size;
|
||||
|
@ -1200,7 +1200,7 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
{
|
||||
int s, md, d = 0, head;
|
||||
unsigned char *dd;
|
||||
|
||||
|
||||
dd = (unsigned char *)&head;
|
||||
dd[0] = *(cl->buf + offset + 0);
|
||||
dd[1] = *(cl->buf + offset + 1);
|
||||
|
@ -1220,7 +1220,7 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
if (offset > 0) goto scroll;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
s = 4;
|
||||
CLDEC(0, major);
|
||||
CLDEC(1, minor);
|
||||
|
@ -1235,7 +1235,7 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
Ecore_Ipc_Event_Client_Data *e2;
|
||||
Ecore_Ipc_Server *svr;
|
||||
int max, max2;
|
||||
|
||||
|
||||
buf = NULL;
|
||||
svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client));
|
||||
max = svr->max_buf_size;
|
||||
|
@ -1363,9 +1363,9 @@ _ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
Ecore_Ipc_Msg_Head msg;
|
||||
int offset = 0;
|
||||
unsigned char *buf;
|
||||
|
||||
|
||||
svr = ecore_con_server_data_get(e->server);
|
||||
|
||||
|
||||
if (!svr->buf)
|
||||
{
|
||||
svr->buf_size = e->size;
|
||||
|
@ -1392,7 +1392,7 @@ _ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
{
|
||||
int s, md, d = 0, head;
|
||||
unsigned char *dd;
|
||||
|
||||
|
||||
dd = (unsigned char *)&head;
|
||||
dd[0] = *(svr->buf + offset + 0);
|
||||
dd[1] = *(svr->buf + offset + 1);
|
||||
|
@ -1412,7 +1412,7 @@ _ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
if (offset > 0) goto scroll;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
s = 4;
|
||||
SVDEC(0, major);
|
||||
SVDEC(1, minor);
|
||||
|
@ -1426,7 +1426,7 @@ _ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void
|
|||
{
|
||||
Ecore_Ipc_Event_Server_Data *e2;
|
||||
int max;
|
||||
|
||||
|
||||
buf = NULL;
|
||||
max = svr->max_buf_size;
|
||||
if ((max < 0) || (msg.size <= max))
|
||||
|
@ -1494,7 +1494,7 @@ static void
|
|||
_ecore_ipc_event_client_add_free(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Ipc_Event_Client_Add *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
e->client->event_count--;
|
||||
if ((e->client->event_count == 0) && (e->client->delete_me))
|
||||
|
@ -1506,7 +1506,7 @@ static void
|
|||
_ecore_ipc_event_client_del_free(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Ipc_Event_Client_Del *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
e->client->event_count--;
|
||||
if ((e->client->event_count == 0) && (e->client->delete_me))
|
||||
|
@ -1518,7 +1518,7 @@ static void
|
|||
_ecore_ipc_event_client_data_free(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Ipc_Event_Client_Data *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
e->client->event_count--;
|
||||
if (e->data) free(e->data);
|
||||
|
@ -1531,7 +1531,7 @@ static void
|
|||
_ecore_ipc_event_server_add_free(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Ipc_Event_Server_Add *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
e->server->event_count--;
|
||||
if ((e->server->event_count == 0) && (e->server->delete_me))
|
||||
|
@ -1543,7 +1543,7 @@ static void
|
|||
_ecore_ipc_event_server_del_free(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Ipc_Event_Server_Add *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
e->server->event_count--;
|
||||
if ((e->server->event_count == 0) && (e->server->delete_me))
|
||||
|
@ -1555,7 +1555,7 @@ static void
|
|||
_ecore_ipc_event_server_data_free(void *data __UNUSED__, void *ev)
|
||||
{
|
||||
Ecore_Ipc_Event_Server_Data *e;
|
||||
|
||||
|
||||
e = ev;
|
||||
if (e->data) free(e->data);
|
||||
e->server->event_count--;
|
||||
|
|
|
@ -20,7 +20,7 @@ Ecore_Sdl_Keys.h
|
|||
|
||||
libecore_sdl_la_LIBADD = \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la \
|
||||
@sdl_libs@
|
||||
@sdl_libs@ @create_shared_lib@
|
||||
|
||||
libecore_sdl_la_DEPENDENCIES = \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la
|
||||
|
|
|
@ -0,0 +1,292 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#ifndef __ECORE_WIN32_H__
|
||||
#define __ECORE_WIN32_H__
|
||||
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
# ifdef BUILDING_DLL
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 4
|
||||
# define EAPI __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef void Ecore_Win32_Window;
|
||||
typedef void Ecore_Win32_DDraw_Object;
|
||||
typedef void Ecore_Win32_DDraw_Surface;
|
||||
typedef void Ecore_Win32_Direct3D_Object;
|
||||
typedef void Ecore_Win32_Direct3D_Device;
|
||||
typedef void Ecore_Win32_Direct3D_Sprite;
|
||||
typedef void Ecore_Win32_Direct3D_Texture;
|
||||
|
||||
/* Events */
|
||||
|
||||
typedef struct _Ecore_Win32_Event_Key_Down Ecore_Win32_Event_Key_Down;
|
||||
typedef struct _Ecore_Win32_Event_Key_Up Ecore_Win32_Event_Key_Up;
|
||||
typedef struct _Ecore_Win32_Event_Mouse_Button_Down Ecore_Win32_Event_Mouse_Button_Down;
|
||||
typedef struct _Ecore_Win32_Event_Mouse_Button_Up Ecore_Win32_Event_Mouse_Button_Up;
|
||||
typedef struct _Ecore_Win32_Event_Mouse_Move Ecore_Win32_Event_Mouse_Move;
|
||||
typedef struct _Ecore_Win32_Event_Mouse_In Ecore_Win32_Event_Mouse_In;
|
||||
typedef struct _Ecore_Win32_Event_Mouse_Out Ecore_Win32_Event_Mouse_Out;
|
||||
typedef struct _Ecore_Win32_Event_Window_Focus_In Ecore_Win32_Event_Window_Focus_In;
|
||||
typedef struct _Ecore_Win32_Event_Window_Focus_Out Ecore_Win32_Event_Window_Focus_Out;
|
||||
typedef struct _Ecore_Win32_Event_Window_Damage Ecore_Win32_Event_Window_Damage;
|
||||
typedef struct _Ecore_Win32_Event_Window_Destroy Ecore_Win32_Event_Window_Destroy;
|
||||
typedef struct _Ecore_Win32_Event_Window_Hide Ecore_Win32_Event_Window_Hide;
|
||||
typedef struct _Ecore_Win32_Event_Window_Show Ecore_Win32_Event_Window_Show;
|
||||
typedef struct _Ecore_Win32_Event_Window_Delete Ecore_Win32_Event_Window_Delete;
|
||||
|
||||
struct _Ecore_Win32_Event_Key_Down
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
char *keyname;
|
||||
char *keysymbol;
|
||||
char *keycompose;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Key_Up
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
char *keyname;
|
||||
char *keysymbol;
|
||||
char *keycompose;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Mouse_Button_Down
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
int button;
|
||||
int x;
|
||||
int y;
|
||||
double time;
|
||||
unsigned int double_click : 1;
|
||||
unsigned int triple_click : 1;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Mouse_Button_Up
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
int button;
|
||||
int x;
|
||||
int y;
|
||||
double time;
|
||||
unsigned int double_click : 1;
|
||||
unsigned int triple_click : 1;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Mouse_Move
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
int x;
|
||||
int y;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Mouse_In
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
int x;
|
||||
int y;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Mouse_Out
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
int x;
|
||||
int y;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Focus_In
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Focus_Out
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Damage
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Destroy
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Hide
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Show
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
double time;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Event_Window_Delete
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
double time;
|
||||
};
|
||||
|
||||
EAPI extern int ECORE_WIN32_EVENT_KEY_DOWN;
|
||||
EAPI extern int ECORE_WIN32_EVENT_KEY_UP;
|
||||
EAPI extern int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN;
|
||||
EAPI extern int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP;
|
||||
EAPI extern int ECORE_WIN32_EVENT_MOUSE_MOVE;
|
||||
EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN;
|
||||
EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_DESTROY;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_HIDE;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW;
|
||||
EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE;
|
||||
|
||||
|
||||
/* Core */
|
||||
EAPI int ecore_win32_init();
|
||||
EAPI int ecore_win32_shutdown();
|
||||
EAPI double ecore_win32_current_time_get(void);
|
||||
EAPI void ecore_win32_message_loop_begin (void);
|
||||
|
||||
/* Window */
|
||||
|
||||
EAPI Ecore_Win32_Window *ecore_win32_window_new(Ecore_Win32_Window *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI void ecore_win32_window_del(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_window_move(Ecore_Win32_Window *window,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
EAPI void ecore_win32_window_resize(Ecore_Win32_Window *window,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI void ecore_win32_window_move_resize(Ecore_Win32_Window *window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
EAPI void ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
|
||||
int min_width,
|
||||
int min_height);
|
||||
|
||||
EAPI void ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
|
||||
int max_width,
|
||||
int max_height);
|
||||
|
||||
EAPI void ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
|
||||
int base_width,
|
||||
int base_height);
|
||||
|
||||
EAPI void ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
|
||||
int step_width,
|
||||
int step_height);
|
||||
|
||||
EAPI void ecore_win32_window_show(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_window_hide(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_window_raise(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_window_lower(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window,
|
||||
const char *title);
|
||||
|
||||
EAPI void ecore_win32_window_focus_set(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
|
||||
int on);
|
||||
|
||||
EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
|
||||
int on);
|
||||
|
||||
EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
|
||||
int on);
|
||||
|
||||
/* DirectDraw */
|
||||
|
||||
EAPI int ecore_win32_ddraw_init(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_DDraw_Object *ecore_win32_ddraw_object_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_DDraw_Surface *ecore_win32_ddraw_surface_primary_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_DDraw_Surface *ecore_win32_ddraw_surface_back_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI int ecore_win32_ddraw_depth_get(Ecore_Win32_Window *window);
|
||||
|
||||
/* Direct3D */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
EAPI int ecore_win32_direct3d_init(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI void ecore_win32_direct3d_shutdown(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Object *ecore_win32_direct3d_object_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Device *ecore_win32_direct3d_device_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Sprite *ecore_win32_direct3d_sprite_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Texture *ecore_win32_direct3d_texture_get(Ecore_Win32_Window *window);
|
||||
|
||||
EAPI int ecore_win32_direct3d_depth_get(Ecore_Win32_Window *window);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ECORE_WIN32_H__ */
|
|
@ -0,0 +1,40 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir)/src/lib/ecore \
|
||||
-I$(top_builddir)/src/lib/ecore
|
||||
|
||||
libecore_win32_la_LDFLAGS = \
|
||||
-version-info 1:0:0 \
|
||||
-L$(top_builddir)/src/lib/ecore/.libs
|
||||
|
||||
|
||||
if BUILD_ECORE_WIN32
|
||||
|
||||
lib_LTLIBRARIES = libecore_win32.la
|
||||
include_HEADERS = \
|
||||
Ecore_Win32.h
|
||||
|
||||
libecore_win32_la_SOURCES = \
|
||||
ecore_win32.c \
|
||||
ecore_win32_direct3d.cpp \
|
||||
ecore_win32_ddraw.c \
|
||||
ecore_win32_event.c \
|
||||
ecore_win32_window.c \
|
||||
ecore_win32_private.h
|
||||
|
||||
libecore_win32_la_LIBADD = \
|
||||
@ddraw_libs@ @direct3d_libs@ \
|
||||
@create_shared_lib@ -lwsock32 \
|
||||
$(top_builddir)/src/lib/ecore/libecore.la
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
Ecore_Win32.h \
|
||||
ecore_win32.c \
|
||||
ecore_win32_direct3d.cpp \
|
||||
ecore_win32_ddraw.c \
|
||||
ecore_win32_event.c \
|
||||
ecore_win32_window.c \
|
||||
ecore_win32_private.h
|
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_win32_private.h"
|
||||
|
||||
|
||||
/*
|
||||
<raster> hmmm
|
||||
<raster> yeah window's way of doing eventys is very different
|
||||
<raster> not select + timeout
|
||||
<raster> to doa timeout u need to queue up a timed message
|
||||
<raster> for timers
|
||||
<raster> etc.
|
||||
*/
|
||||
|
||||
/* typedef LRESULT CALLBACK _ecore_win32_event_callback(HWND, UINT, WPARAM, LPARAM); */
|
||||
|
||||
Ecore_List *_ecore_win32_windows_list = NULL;
|
||||
HINSTANCE _ecore_win32_instance = NULL;
|
||||
double _ecore_win32_double_click_time = 0.25;
|
||||
double _ecore_win32_event_last_time = 0.0;
|
||||
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
|
||||
|
||||
static int _ecore_win32_init_count = 0;
|
||||
|
||||
|
||||
LRESULT CALLBACK
|
||||
_ecore_win32_window_procedure(HWND window,
|
||||
UINT message,
|
||||
WPARAM window_param,
|
||||
LPARAM data_param)
|
||||
{
|
||||
Ecore_Win32_Callback_Data *data;
|
||||
POINTS pt;
|
||||
DWORD coord;
|
||||
|
||||
data = (Ecore_Win32_Callback_Data *)malloc(sizeof(Ecore_Win32_Callback_Data));
|
||||
if (!data) return DefWindowProc(window, message, window_param, data_param);
|
||||
|
||||
data->window = window;
|
||||
data->message = message;
|
||||
data->window_param = window_param;
|
||||
data->data_param = data_param;
|
||||
data->time = GetMessageTime();
|
||||
coord = GetMessagePos();
|
||||
pt = MAKEPOINTS(coord);
|
||||
data->x = pt.x;
|
||||
data->y = pt.y;
|
||||
|
||||
switch (data->message)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
printf (" * ecore message : keystroke down\n");
|
||||
_ecore_win32_event_handle_key_press(data, 1);
|
||||
return 0;
|
||||
case WM_CHAR:
|
||||
_ecore_win32_event_handle_key_press(data, 0);
|
||||
return 0;
|
||||
case WM_KEYUP:
|
||||
printf (" * ecore message : keystroke up\n");
|
||||
_ecore_win32_event_handle_key_release(data, 1);
|
||||
return 0;
|
||||
case WM_LBUTTONDOWN:
|
||||
printf (" * ecore message : lbuttondown\n");
|
||||
_ecore_win32_event_handle_button_press(data, 1);
|
||||
return 0;
|
||||
case WM_MBUTTONDOWN:
|
||||
printf (" * ecore message : mbuttondown\n");
|
||||
_ecore_win32_event_handle_button_press(data, 2);
|
||||
return 0;
|
||||
case WM_RBUTTONDOWN:
|
||||
printf (" * ecore message : rbuttondown\n");
|
||||
_ecore_win32_event_handle_button_press(data, 3);
|
||||
return 0;
|
||||
case WM_LBUTTONUP:
|
||||
printf (" * ecore message : lbuttonup\n");
|
||||
_ecore_win32_event_handle_button_release(data, 1);
|
||||
return 0;
|
||||
case WM_MBUTTONUP:
|
||||
printf (" * ecore message : mbuttonup\n");
|
||||
_ecore_win32_event_handle_button_release(data, 2);
|
||||
return 0;
|
||||
case WM_RBUTTONUP:
|
||||
printf (" * ecore message : rbuttonup\n");
|
||||
_ecore_win32_event_handle_button_release(data, 3);
|
||||
return 0;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
RECT rect;
|
||||
struct _Ecore_Win32_Window *w = NULL;
|
||||
|
||||
ecore_list_first_goto(_ecore_win32_windows_list);
|
||||
while ((w = ecore_list_next(_ecore_win32_windows_list)))
|
||||
{
|
||||
if (w->window == window)
|
||||
{
|
||||
ecore_list_remove(_ecore_win32_windows_list);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetClientRect(window, &rect))
|
||||
{
|
||||
POINT pt;
|
||||
|
||||
pt.x = GET_X_LPARAM(data_param);
|
||||
pt.y = GET_Y_LPARAM(data_param);
|
||||
if (!PtInRect(&rect, pt))
|
||||
{
|
||||
if (w->pointer_is_in)
|
||||
{
|
||||
w->pointer_is_in = 0;
|
||||
_ecore_win32_event_handle_leave_notify(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!w->pointer_is_in)
|
||||
{
|
||||
w->pointer_is_in = 1;
|
||||
_ecore_win32_event_handle_enter_notify(data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
_ecore_win32_event_handle_motion_notify(data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
printf (" * ecore message : destroy\n");
|
||||
_ecore_win32_event_handle_destroy_notify(data);
|
||||
return 0;
|
||||
case WM_SHOWWINDOW:
|
||||
printf (" * ecore message : show\n");
|
||||
if ((data->data_param == SW_OTHERUNZOOM) ||
|
||||
(data->data_param == SW_OTHERUNZOOM))
|
||||
return 0;
|
||||
|
||||
if (data->window_param)
|
||||
_ecore_win32_event_handle_map_notify(data);
|
||||
else
|
||||
_ecore_win32_event_handle_unmap_notify(data);
|
||||
|
||||
return 0;
|
||||
case WM_PAINT:
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
printf (" * ecore message : paint\n");
|
||||
if (GetUpdateRect(window, &rect, FALSE))
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
hdc = BeginPaint(window, &ps);
|
||||
EndPaint(window, &ps);
|
||||
printf ("%ld %ld %ld %ld\n",
|
||||
rect.left,
|
||||
rect.top,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top);
|
||||
data->update = rect;
|
||||
_ecore_win32_event_handle_expose(data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
printf (" * ecore message : close\n");
|
||||
_ecore_win32_event_handle_delete(data);
|
||||
return 0;
|
||||
case WM_SETFOCUS:
|
||||
printf (" * ecore message : focus in\n");
|
||||
_ecore_win32_event_handle_focus_in(data);
|
||||
return 0;
|
||||
case WM_KILLFOCUS:
|
||||
printf (" * ecore message : focus out\n");
|
||||
_ecore_win32_event_handle_focus_out(data);
|
||||
return 0;
|
||||
default:
|
||||
return DefWindowProc(window, message, window_param, data_param);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
Events:
|
||||
|
||||
x * key down
|
||||
* key sys down
|
||||
x * key up
|
||||
* key sys up
|
||||
x * mouse button down left
|
||||
x * mouse button down middle
|
||||
x * mouse button down right
|
||||
x * mouse button up left
|
||||
x * mouse button up middle
|
||||
x * mouse button up right
|
||||
* mouse move (contains enter)
|
||||
* mouse leave
|
||||
* focus in
|
||||
* focus out
|
||||
* expose
|
||||
* create
|
||||
* destroy
|
||||
* resize
|
||||
|
||||
*/
|
||||
|
||||
EAPI int ECORE_WIN32_EVENT_KEY_DOWN = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_KEY_UP = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_MOUSE_MOVE = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_MOUSE_IN = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_MOUSE_OUT = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_DESTROY = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_SHOW = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_HIDE = 0;
|
||||
EAPI int ECORE_WIN32_EVENT_WINDOW_DELETE = 0;
|
||||
|
||||
|
||||
EAPI int
|
||||
ecore_win32_init()
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
if (_ecore_win32_init_count > 0)
|
||||
{
|
||||
_ecore_win32_init_count++;
|
||||
return _ecore_win32_init_count;
|
||||
}
|
||||
|
||||
_ecore_win32_instance = GetModuleHandle(0);
|
||||
if (!_ecore_win32_instance)
|
||||
return 0;
|
||||
|
||||
memset (&wc, 0, sizeof (WNDCLASS));
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = _ecore_win32_window_procedure;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = _ecore_win32_instance;
|
||||
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = ECORE_WIN32_WINDOW_CLASS;
|
||||
|
||||
if(!RegisterClass(&wc))
|
||||
{
|
||||
UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
|
||||
FreeLibrary(_ecore_win32_instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ecore_win32_windows_list = ecore_list_new();
|
||||
if (!_ecore_win32_windows_list)
|
||||
{
|
||||
UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
|
||||
FreeLibrary(_ecore_win32_instance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ECORE_WIN32_EVENT_KEY_DOWN)
|
||||
{
|
||||
ECORE_WIN32_EVENT_KEY_DOWN = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_KEY_UP = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_DESTROY = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_SHOW = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_HIDE = ecore_event_type_new();
|
||||
ECORE_WIN32_EVENT_WINDOW_DELETE = ecore_event_type_new();
|
||||
}
|
||||
|
||||
_ecore_win32_init_count++;
|
||||
|
||||
return _ecore_win32_init_count;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_win32_shutdown()
|
||||
{
|
||||
_ecore_win32_init_count++;
|
||||
if (_ecore_win32_init_count > 0) return _ecore_win32_init_count;
|
||||
if (!_ecore_win32_instance) return _ecore_win32_init_count;
|
||||
|
||||
ecore_list_destroy(_ecore_win32_windows_list);
|
||||
|
||||
UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
|
||||
FreeLibrary(_ecore_win32_instance);
|
||||
_ecore_win32_instance = NULL;
|
||||
|
||||
if (_ecore_win32_init_count < 0) _ecore_win32_init_count = 0;
|
||||
|
||||
return _ecore_win32_init_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param t The time in seconds
|
||||
*/
|
||||
EAPI void
|
||||
ecore_win32_double_click_time_set(double t)
|
||||
{
|
||||
if (t < 0.0) t = 0.0;
|
||||
_ecore_win32_double_click_time = t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the double and triple click flag timeout.
|
||||
*
|
||||
* See @ref ecore_win32_double_click_time_set for more information.
|
||||
*
|
||||
* @return The timeout for double clicks in seconds.
|
||||
*/
|
||||
EAPI double
|
||||
ecore_win32_double_click_time_get(void)
|
||||
{
|
||||
return _ecore_win32_double_click_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last event time
|
||||
*/
|
||||
EAPI double
|
||||
ecore_win32_current_time_get(void)
|
||||
{
|
||||
return _ecore_win32_event_last_time;
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ecore_win32_private.h"
|
||||
#include "Ecore_Win32.h"
|
||||
|
||||
|
||||
EAPI int
|
||||
ecore_win32_ddraw_init(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
DDPIXELFORMAT pixel_format;
|
||||
RECT rect;
|
||||
DDSURFACEDESC2 *sd;
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window)
|
||||
return 0;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
|
||||
if (FAILED(DirectDrawCreateEx(0, (void **)&w->ddraw.object,
|
||||
&IID_IDirectDraw7, NULL)))
|
||||
return 0;
|
||||
|
||||
if (FAILED(IDirectDraw7_SetCooperativeLevel(w->ddraw.object,
|
||||
w->window, DDSCL_NORMAL)))
|
||||
goto no_coop_level;
|
||||
|
||||
if (FAILED(IDirectDraw7_CreateClipper(w->ddraw.object, 0,
|
||||
&w->ddraw.clipper, NULL)))
|
||||
goto no_clipper;
|
||||
|
||||
if (FAILED(IDirectDrawClipper_SetHWnd(w->ddraw.clipper, 0, w->window)))
|
||||
goto no_clipper_set_window;
|
||||
|
||||
memset (&surface_desc, 0, sizeof (surface_desc));
|
||||
surface_desc.dwSize = sizeof (surface_desc);
|
||||
surface_desc.dwFlags = DDSD_CAPS;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
/* Hack to cleanly remove a warning */
|
||||
sd = &surface_desc;
|
||||
if (FAILED(IDirectDraw7_CreateSurface(w->ddraw.object,
|
||||
(DDSURFACEDESC *)sd,
|
||||
&w->ddraw.surface_primary,
|
||||
NULL)))
|
||||
goto no_primary_surf;
|
||||
|
||||
if (FAILED(IDirectDrawSurface7_SetClipper(w->ddraw.surface_primary,
|
||||
w->ddraw.clipper)))
|
||||
goto no_primary_surf_set_clipper;
|
||||
|
||||
if (!GetClientRect(w->window, &rect))
|
||||
goto no_get_client;
|
||||
|
||||
memset (&surface_desc, 0, sizeof (surface_desc));
|
||||
surface_desc.dwSize = sizeof (surface_desc);
|
||||
surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
surface_desc.dwWidth = rect.right - rect.left;
|
||||
surface_desc.dwHeight = rect.bottom - rect.top;
|
||||
|
||||
/* Hack to cleanly remove a warning */
|
||||
sd = &surface_desc;
|
||||
if (FAILED(IDirectDraw7_CreateSurface(w->ddraw.object,
|
||||
(DDSURFACEDESC *)sd,
|
||||
&w->ddraw.surface_back,
|
||||
NULL)))
|
||||
goto no_back_surf;
|
||||
|
||||
ZeroMemory(&pixel_format, sizeof(pixel_format));
|
||||
pixel_format.dwSize = sizeof(pixel_format);
|
||||
|
||||
if (FAILED(IDirectDrawSurface7_GetPixelFormat(w->ddraw.surface_primary,
|
||||
&pixel_format)))
|
||||
goto no_get_pix_fmt;
|
||||
|
||||
w->ddraw.depth = pixel_format.dwRGBBitCount;
|
||||
|
||||
return 1;
|
||||
|
||||
no_get_pix_fmt:
|
||||
/* no need to release the back surface. the next call free its memory */
|
||||
no_back_surf:
|
||||
no_get_client:
|
||||
no_primary_surf_set_clipper:
|
||||
IDirectDrawSurface7_Release(w->ddraw.surface_primary);
|
||||
no_primary_surf:
|
||||
no_clipper_set_window:
|
||||
IDirectDrawClipper_Release(w->ddraw.clipper);
|
||||
no_clipper:
|
||||
no_coop_level:
|
||||
IDirectDraw7_Release(w->ddraw.object);
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
|
||||
if (w->ddraw.surface_primary)
|
||||
IDirectDrawSurface7_Release(w->ddraw.surface_primary);
|
||||
|
||||
/* no need to release the back surface. the previous call free its memory */
|
||||
|
||||
if (w->ddraw.clipper)
|
||||
IDirectDrawClipper_Release(w->ddraw.clipper);
|
||||
|
||||
if (w->ddraw.object)
|
||||
IDirectDraw7_Release(w->ddraw.object);
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_DDraw_Object *
|
||||
ecore_win32_ddraw_object_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.object;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_DDraw_Surface *
|
||||
ecore_win32_ddraw_surface_primary_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.surface_primary;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_DDraw_Surface *
|
||||
ecore_win32_ddraw_surface_back_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.surface_back;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_win32_ddraw_depth_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.depth;
|
||||
#else
|
||||
return 0;
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ecore_win32_private.h"
|
||||
#include "Ecore_Win32.h"
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
EAPI int
|
||||
ecore_win32_direct3d_init(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
D3DPRESENT_PARAMETERS pp;
|
||||
D3DDISPLAYMODE dm;
|
||||
D3DSURFACE_DESC sd;
|
||||
D3DCAPS9 caps;
|
||||
RECT rect;
|
||||
struct _Ecore_Win32_Window *w;
|
||||
DWORD flag;
|
||||
|
||||
if (!window)
|
||||
return 0;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
|
||||
w->d3d.object = Direct3DCreate9 (D3D_SDK_VERSION);
|
||||
if (!w->d3d.object)
|
||||
return 0;
|
||||
|
||||
if (FAILED (w->d3d.object->GetAdapterDisplayMode (D3DADAPTER_DEFAULT,
|
||||
&dm)))
|
||||
goto no_get_adapter;
|
||||
|
||||
if (FAILED (w->d3d.object->GetDeviceCaps (D3DADAPTER_DEFAULT,
|
||||
D3DDEVTYPE_HAL,
|
||||
&caps)))
|
||||
goto no_caps;
|
||||
|
||||
if (!GetClientRect(w->window, &rect))
|
||||
goto no_get_client;
|
||||
|
||||
flag = (caps.VertexProcessingCaps != 0)
|
||||
? D3DCREATE_HARDWARE_VERTEXPROCESSING
|
||||
: D3DCREATE_SOFTWARE_VERTEXPROCESSING;
|
||||
|
||||
ZeroMemory(&pp, sizeof(pp));
|
||||
pp.BackBufferWidth = rect.right - rect.left;
|
||||
pp.BackBufferHeight = rect.bottom - rect.top;
|
||||
pp.BackBufferFormat = dm.Format;
|
||||
pp.BackBufferCount = 1;
|
||||
pp.MultiSampleType = D3DMULTISAMPLE_NONE;
|
||||
pp.MultiSampleQuality = 0;
|
||||
pp.SwapEffect = D3DSWAPEFFECT_FLIP;
|
||||
pp.hDeviceWindow = w->window;
|
||||
pp.Windowed = TRUE;
|
||||
pp.EnableAutoDepthStencil = FALSE;
|
||||
pp.FullScreen_RefreshRateInHz = 0;
|
||||
pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
|
||||
if (FAILED(w->d3d.object->CreateDevice (D3DADAPTER_DEFAULT,
|
||||
D3DDEVTYPE_HAL,
|
||||
w->window,
|
||||
flag,
|
||||
&pp,
|
||||
&w->d3d.device)))
|
||||
goto no_device;
|
||||
|
||||
if (FAILED (D3DXCreateSprite (w->d3d.device, &w->d3d.sprite)))
|
||||
goto no_sprite;
|
||||
|
||||
if (FAILED (w->d3d.device->CreateTexture (rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
1,
|
||||
D3DUSAGE_DYNAMIC,
|
||||
dm.Format,
|
||||
D3DPOOL_DEFAULT,
|
||||
&w->d3d.texture, NULL)))
|
||||
goto no_texture;
|
||||
|
||||
if (FAILED (w->d3d.texture->GetLevelDesc (0, &sd)))
|
||||
goto no_level_desc;
|
||||
|
||||
switch (sd.Format) {
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
w->d3d.depth = 32;
|
||||
break;
|
||||
case D3DFMT_R5G6B5:
|
||||
w->d3d.depth = 16;
|
||||
break;
|
||||
default:
|
||||
goto no_supported_depth;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
no_supported_depth:
|
||||
no_level_desc:
|
||||
w->d3d.texture->Release();
|
||||
no_texture:
|
||||
w->d3d.sprite->Release();
|
||||
no_sprite:
|
||||
w->d3d.device->Release();
|
||||
no_device:
|
||||
no_get_client:
|
||||
no_caps:
|
||||
no_get_adapter:
|
||||
w->d3d.object->Release();
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_direct3d_shutdown(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
|
||||
if (w->d3d.texture)
|
||||
w->d3d.texture->Release();
|
||||
|
||||
if (w->d3d.sprite)
|
||||
w->d3d.sprite->Release();
|
||||
|
||||
if (w->d3d.device)
|
||||
w->d3d.device->Release();
|
||||
|
||||
if (w->d3d.object)
|
||||
w->d3d.object->Release();
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Object *
|
||||
ecore_win32_direct3d_object_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
return ((struct _Ecore_Win32_Window *)window)->d3d.object;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Device *
|
||||
ecore_win32_direct3d_device_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
return ((struct _Ecore_Win32_Window *)window)->d3d.device;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Sprite *
|
||||
ecore_win32_direct3d_sprite_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
return ((struct _Ecore_Win32_Window *)window)->d3d.sprite;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
}
|
||||
|
||||
EAPI Ecore_Win32_Direct3D_Texture *
|
||||
ecore_win32_direct3d_texture_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
return ((struct _Ecore_Win32_Window *)window)->d3d.texture;
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_win32_direct3d_depth_get(Ecore_Win32_Window *window)
|
||||
{
|
||||
#ifdef HAVE_DIRECT3D
|
||||
return ((struct _Ecore_Win32_Window *)window)->d3d.depth;
|
||||
#else
|
||||
return 0;
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,776 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
#include "ecore_win32_private.h"
|
||||
|
||||
|
||||
static Ecore_Win32_Window *_ecore_win32_mouse_down_last_window = NULL;
|
||||
static Ecore_Win32_Window *_ecore_win32_mouse_down_last_last_window = NULL;
|
||||
static double _ecore_win32_mouse_down_last_time = 0;
|
||||
static double _ecore_win32_mouse_down_last_last_time = 0;
|
||||
static int _ecore_win32_mouse_down_did_triple = 0;
|
||||
static int _ecore_win32_mouse_up_count = 0;
|
||||
|
||||
static void
|
||||
_ecore_win32_event_free_key_down(void *data,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Win32_Event_Key_Down *e;
|
||||
|
||||
e = ev;
|
||||
if (e->keyname) free(e->keyname);
|
||||
if (e->keysymbol) free(e->keysymbol);
|
||||
if (e->keycompose) free(e->keycompose);
|
||||
free(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_win32_event_free_key_up(void *data,
|
||||
void *ev)
|
||||
{
|
||||
Ecore_Win32_Event_Key_Up *e;
|
||||
|
||||
e = ev;
|
||||
if (e->keyname) free(e->keyname);
|
||||
if (e->keysymbol) free(e->keysymbol);
|
||||
if (e->keycompose) free(e->keycompose);
|
||||
free(e);
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_win32_event_keystroke_get(int key,
|
||||
char **keyname,
|
||||
char **keysymbol,
|
||||
char **keycompose)
|
||||
{
|
||||
char *kn;
|
||||
char *ks;
|
||||
char *kc;
|
||||
|
||||
*keyname = NULL;
|
||||
*keysymbol = NULL;
|
||||
*keycompose = NULL;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
/* Keystroke */
|
||||
case VK_PRIOR:
|
||||
kn = "KP_Prior";
|
||||
ks = "KP_Prior";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_NEXT:
|
||||
kn = "KP_Next";
|
||||
ks = "KP_Next";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_END:
|
||||
kn = "KP_End";
|
||||
ks = "KP_End";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_HOME:
|
||||
kn = "KP_Home";
|
||||
ks = "KP_Home";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_LEFT:
|
||||
kn = "KP_Left";
|
||||
ks = "KP_Left";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_UP:
|
||||
kn = "KP_Up";
|
||||
ks = "KP_Up";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
kn = "KP_Right";
|
||||
ks = "KP_Right";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_DOWN:
|
||||
kn = "KP_Down";
|
||||
ks = "KP_Down";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_INSERT:
|
||||
kn = "KP_Insert";
|
||||
ks = "KP_Insert";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_DELETE:
|
||||
kn = "KP_Delete";
|
||||
ks = "KP_Delete";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F1:
|
||||
kn = "F1";
|
||||
ks = "F1";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F2:
|
||||
kn = "F2";
|
||||
ks = "F2";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F3:
|
||||
kn = "F3";
|
||||
ks = "F3";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F4:
|
||||
kn = "F4";
|
||||
ks = "F4";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F5:
|
||||
kn = "F5";
|
||||
ks = "F5";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F6:
|
||||
kn = "F6";
|
||||
ks = "F6";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F7:
|
||||
kn = "F7";
|
||||
ks = "F7";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F8:
|
||||
kn = "F8";
|
||||
ks = "F8";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F9:
|
||||
kn = "F9";
|
||||
ks = "F9";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F10:
|
||||
kn = "F10";
|
||||
ks = "F10";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F11:
|
||||
kn = "F11";
|
||||
ks = "F11";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F12:
|
||||
kn = "F12";
|
||||
ks = "F12";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F13:
|
||||
kn = "F13";
|
||||
ks = "F13";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F14:
|
||||
kn = "F14";
|
||||
ks = "F14";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F15:
|
||||
kn = "F15";
|
||||
ks = "F15";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F16:
|
||||
kn = "F16";
|
||||
ks = "F16";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F17:
|
||||
kn = "F17";
|
||||
ks = "F17";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F18:
|
||||
kn = "F18";
|
||||
ks = "F18";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F19:
|
||||
kn = "F19";
|
||||
ks = "F19";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F20:
|
||||
kn = "F20";
|
||||
ks = "F20";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F21:
|
||||
kn = "F21";
|
||||
ks = "F21";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F22:
|
||||
kn = "F22";
|
||||
ks = "F22";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F23:
|
||||
kn = "F23";
|
||||
ks = "F23";
|
||||
kc = "";
|
||||
break;
|
||||
case VK_F24:
|
||||
kn = "F24";
|
||||
ks = "F24";
|
||||
kc = "";
|
||||
break;
|
||||
default:
|
||||
/* other non keystroke characters */
|
||||
return 0;
|
||||
}
|
||||
*keyname = strdup(kn);
|
||||
if (!*keyname) return 0;
|
||||
*keysymbol = strdup(ks);
|
||||
if (!*keysymbol)
|
||||
{
|
||||
free(*keyname);
|
||||
*keyname = NULL;
|
||||
return 0;
|
||||
}
|
||||
*keycompose = strdup(kc);
|
||||
if (!*keycompose)
|
||||
{
|
||||
free(*keyname);
|
||||
free(*keysymbol);
|
||||
*keyname = NULL;
|
||||
*keysymbol = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_ecore_win32_event_char_get(int key,
|
||||
char **keyname,
|
||||
char **keysymbol,
|
||||
char **keycompose)
|
||||
{
|
||||
char kn[32];
|
||||
char ks[32];
|
||||
char *kc;
|
||||
|
||||
*keyname = NULL;
|
||||
*keysymbol = NULL;
|
||||
*keycompose = NULL;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case VK_BACK:
|
||||
strncpy(kn, "Backspace", 32);
|
||||
strncpy(ks, "Backspace", 32);
|
||||
kc = "";
|
||||
break;
|
||||
case VK_TAB:
|
||||
strncpy(kn, "Tab", 32);
|
||||
strncpy(ks, "Tab", 32);
|
||||
kc = "";
|
||||
break;
|
||||
case 0x0a:
|
||||
/* Line feed (Shift + Enter) */
|
||||
strncpy(kn, "LineFeed", 32);
|
||||
strncpy(ks, "LineFeed", 32);
|
||||
kc = "";
|
||||
break;
|
||||
case VK_RETURN:
|
||||
strncpy(kn, "Return", 32);
|
||||
strncpy(ks, "Return", 32);
|
||||
kc = "";
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
strncpy(kn, "Escape", 32);
|
||||
strncpy(ks, "Escape", 32);
|
||||
kc = "";
|
||||
break;
|
||||
default:
|
||||
/* displayable characters */
|
||||
printf (" * key : %d\n", key);
|
||||
kn[0] = (TCHAR)key;
|
||||
kn[1] = '\0';
|
||||
ks[0] = (TCHAR)key;
|
||||
ks[1] = '\0';
|
||||
kc = "";
|
||||
break;
|
||||
}
|
||||
*keyname = strdup(kn);
|
||||
if (!*keyname) return 0;
|
||||
*keysymbol = strdup(ks);
|
||||
if (!*keysymbol)
|
||||
{
|
||||
free(*keyname);
|
||||
*keyname = NULL;
|
||||
return 0;
|
||||
}
|
||||
*keycompose = strdup(kc);
|
||||
if (!*keycompose)
|
||||
{
|
||||
free(*keyname);
|
||||
free(*keysymbol);
|
||||
*keyname = NULL;
|
||||
*keysymbol = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Ecore_Win32_Window *
|
||||
_ecore_win32_event_window_get(HWND window)
|
||||
{
|
||||
Ecore_Win32_Window *w = NULL;
|
||||
|
||||
ecore_list_first_goto(_ecore_win32_windows_list);
|
||||
while ((w = ecore_list_next(_ecore_win32_windows_list)))
|
||||
{
|
||||
if (((struct _Ecore_Win32_Window *)w)->window == window)
|
||||
return w;
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke)
|
||||
{
|
||||
Ecore_Win32_Event_Key_Down *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Key_Down *)malloc(sizeof(Ecore_Win32_Event_Key_Down));
|
||||
if (!e) return;
|
||||
|
||||
if (is_keystroke)
|
||||
{
|
||||
if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param),
|
||||
&e->keyname,
|
||||
&e->keysymbol,
|
||||
&e->keycompose))
|
||||
{
|
||||
free(e);
|
||||
return;
|
||||
}
|
||||
goto store_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_ecore_win32_event_char_get(LOWORD(msg->window_param),
|
||||
&e->keyname,
|
||||
&e->keysymbol,
|
||||
&e->keycompose))
|
||||
{
|
||||
free(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
store_key:
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, int is_keystroke)
|
||||
{
|
||||
Ecore_Win32_Event_Key_Up *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Key_Up *)calloc(1, sizeof(Ecore_Win32_Event_Key_Up));
|
||||
if (!e) return;
|
||||
|
||||
if (is_keystroke)
|
||||
{
|
||||
if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param),
|
||||
&e->keyname,
|
||||
&e->keysymbol,
|
||||
&e->keycompose))
|
||||
{
|
||||
free(e);
|
||||
return;
|
||||
}
|
||||
goto store_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_ecore_win32_event_char_get(LOWORD(msg->window_param),
|
||||
&e->keyname,
|
||||
&e->keysymbol,
|
||||
&e->keycompose))
|
||||
{
|
||||
free(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
store_key:
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
|
||||
int button)
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
|
||||
window = _ecore_win32_event_window_get(msg->window);
|
||||
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Move *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move));
|
||||
if (!e) return;
|
||||
|
||||
e->window = window;
|
||||
e->x = GET_X_LPARAM(msg->data_param);
|
||||
e->y = GET_Y_LPARAM(msg->data_param);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
_ecore_win32_event_last_window = e->window;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Button_Down *e;
|
||||
|
||||
if (_ecore_win32_mouse_down_did_triple)
|
||||
{
|
||||
_ecore_win32_mouse_down_last_window = NULL;
|
||||
_ecore_win32_mouse_down_last_last_window = NULL;
|
||||
_ecore_win32_mouse_down_last_time = 0.0;
|
||||
_ecore_win32_mouse_down_last_last_time = 0.0;
|
||||
}
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Button_Down *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Button_Down));
|
||||
if (!e) return;
|
||||
|
||||
e->window = window;
|
||||
e->button = button;
|
||||
e->x = GET_X_LPARAM(msg->data_param);
|
||||
e->y = GET_Y_LPARAM(msg->data_param);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
if (((e->time - _ecore_win32_mouse_down_last_time) <= _ecore_win32_double_click_time) &&
|
||||
(e->window == _ecore_win32_mouse_down_last_window))
|
||||
e->double_click = 1;
|
||||
|
||||
if (((e->time - _ecore_win32_mouse_down_last_last_time) <= (2.0 * _ecore_win32_double_click_time)) &&
|
||||
(e->window == _ecore_win32_mouse_down_last_window) &&
|
||||
(e->window == _ecore_win32_mouse_down_last_last_window))
|
||||
{
|
||||
e->triple_click = 1;
|
||||
_ecore_win32_mouse_down_did_triple = 1;
|
||||
}
|
||||
else
|
||||
_ecore_win32_mouse_down_did_triple = 0;
|
||||
|
||||
if (!e->double_click && !e->triple_click)
|
||||
_ecore_win32_mouse_up_count = 0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
_ecore_win32_event_last_window = e->window;
|
||||
|
||||
if (!_ecore_win32_mouse_down_did_triple)
|
||||
{
|
||||
_ecore_win32_mouse_down_last_last_window = _ecore_win32_mouse_down_last_window;
|
||||
_ecore_win32_mouse_down_last_window = e->window;
|
||||
_ecore_win32_mouse_down_last_last_time = _ecore_win32_mouse_down_last_time;
|
||||
_ecore_win32_mouse_down_last_time = e->time;
|
||||
}
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
|
||||
}
|
||||
printf (" * ecore event button press\n");
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
|
||||
int button)
|
||||
{
|
||||
Ecore_Win32_Window *window;
|
||||
|
||||
window = _ecore_win32_event_window_get(msg->window);
|
||||
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Move *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move));
|
||||
if (!e) return;
|
||||
|
||||
e->window = window;
|
||||
e->x = GET_X_LPARAM(msg->data_param);
|
||||
e->y = GET_Y_LPARAM(msg->data_param);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
_ecore_win32_event_last_window = e->window;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Button_Up *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Button_Up *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Button_Up));
|
||||
if (!e) return;
|
||||
|
||||
e->window = window;
|
||||
e->button = button;
|
||||
e->x = GET_X_LPARAM(msg->data_param);
|
||||
e->y = GET_Y_LPARAM(msg->data_param);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_mouse_up_count++;
|
||||
|
||||
if ((_ecore_win32_mouse_up_count >= 2) &&
|
||||
((e->time - _ecore_win32_mouse_down_last_time) <= _ecore_win32_double_click_time) &&
|
||||
(e->window == _ecore_win32_mouse_down_last_window))
|
||||
e->double_click = 1;
|
||||
|
||||
if ((_ecore_win32_mouse_up_count >= 3) &&
|
||||
((e->time - _ecore_win32_mouse_down_last_last_time) <= (2.0 * _ecore_win32_double_click_time)) &&
|
||||
(e->window == _ecore_win32_mouse_down_last_window) &&
|
||||
(e->window == _ecore_win32_mouse_down_last_last_window))
|
||||
e->triple_click = 1;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
_ecore_win32_event_last_window = e->window;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
|
||||
}
|
||||
|
||||
Ecore_Win32_Event_Mouse_Button_Up *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Button_Up *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Button_Up));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->button = button;
|
||||
e->x = GET_X_LPARAM(msg->data_param);
|
||||
e->y = GET_Y_LPARAM(msg->data_param);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
|
||||
printf (" * ecore event button release\n");
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Move *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->x = GET_X_LPARAM(msg->data_param);
|
||||
e->y = GET_Y_LPARAM(msg->data_param);
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Move *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->x = msg->x;
|
||||
e->y = msg->y;
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
_ecore_win32_event_last_window = e->window;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_In *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_In *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_In));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->x = msg->x;
|
||||
e->y = msg->y;
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Move *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Move));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->x = msg->x;
|
||||
e->y = msg->y;
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
_ecore_win32_event_last_window = e->window;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_MOVE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
{
|
||||
Ecore_Win32_Event_Mouse_Out *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Mouse_Out *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Out));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->x = msg->x;
|
||||
e->y = msg->y;
|
||||
e->time = (double)msg->time / 1000.0;
|
||||
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Focus_In *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Focus_Out *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
_ecore_win32_event_last_time = e->time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Damage *e;
|
||||
|
||||
e = (Ecore_Win32_Event_Window_Damage *)calloc(1, sizeof(Ecore_Win32_Event_Window_Damage));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
|
||||
e->x = msg->update.left;
|
||||
e->y = msg->update.top;
|
||||
e->width = msg->update.right - msg->update.left;
|
||||
e->height = msg->update.bottom - msg->update.top;
|
||||
printf (" * ecore : event expose %d %d\n", e->width, e->height);
|
||||
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Destroy *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Show *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Hide *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_win32_event_handle_delete(Ecore_Win32_Callback_Data *msg)
|
||||
{
|
||||
Ecore_Win32_Event_Window_Delete *e;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete));
|
||||
if (!e) return;
|
||||
|
||||
e->window = _ecore_win32_event_window_get(msg->window);
|
||||
e->time = _ecore_win32_event_last_time;
|
||||
|
||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE, e, NULL, NULL);
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#ifndef __ECORE_WIN32_PRIVATE_H__
|
||||
#define __ECORE_WIN32_PRIVATE_H__
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddraw.h>
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
|
||||
#include <Ecore_Data.h>
|
||||
|
||||
#include "Ecore_Win32.h"
|
||||
|
||||
|
||||
#define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class"
|
||||
|
||||
|
||||
typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data;
|
||||
|
||||
struct _Ecore_Win32_Callback_Data
|
||||
{
|
||||
RECT update;
|
||||
HWND window;
|
||||
unsigned int message;
|
||||
WPARAM window_param;
|
||||
LPARAM data_param;
|
||||
long time;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct _Ecore_Win32_Window
|
||||
{
|
||||
HWND window;
|
||||
|
||||
#ifdef HAVE_DIRECTDRAW
|
||||
struct {
|
||||
LPDIRECTDRAW object;
|
||||
LPDIRECTDRAWSURFACE surface_primary;
|
||||
LPDIRECTDRAWSURFACE surface_back;
|
||||
LPDIRECTDRAWCLIPPER clipper;
|
||||
int depth;
|
||||
} ddraw;
|
||||
#endif /* HAVE_DIRECTDRAW */
|
||||
|
||||
#ifdef HAVE_DIRECT3D
|
||||
struct {
|
||||
LPDIRECT3D9 object;
|
||||
LPDIRECT3DDEVICE9 device;
|
||||
LPD3DXSPRITE sprite;
|
||||
LPDIRECT3DTEXTURE9 texture;
|
||||
int depth;
|
||||
} d3d;
|
||||
#endif /* HAVE_DIRECT3D */
|
||||
|
||||
DWORD style; /* used to go fullscreen to normal */
|
||||
RECT rect; /* used to go fullscreen to normal */
|
||||
|
||||
unsigned int min_width;
|
||||
unsigned int min_height;
|
||||
unsigned int max_width;
|
||||
unsigned int max_height;
|
||||
unsigned int base_width;
|
||||
unsigned int base_height;
|
||||
unsigned int step_width;
|
||||
unsigned int step_height;
|
||||
|
||||
unsigned int pointer_is_in : 1;
|
||||
unsigned int borderless : 1;
|
||||
unsigned int iconified : 1;
|
||||
unsigned int fullscreen : 1;
|
||||
};
|
||||
|
||||
|
||||
extern Ecore_List *_ecore_win32_windows_list;
|
||||
extern HINSTANCE _ecore_win32_instance;
|
||||
extern double _ecore_win32_double_click_time;
|
||||
extern double _ecore_win32_event_last_time;
|
||||
extern Ecore_Win32_Window *_ecore_win32_event_last_window;
|
||||
|
||||
|
||||
char *_ecore_win32_hwnd_str_get(HWND window);
|
||||
|
||||
void _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke);
|
||||
void _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg, int is_keystroke);
|
||||
void _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, int button);
|
||||
void _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, int button);
|
||||
void _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg);
|
||||
void _ecore_win32_event_handle_delete(Ecore_Win32_Callback_Data *msg);
|
||||
|
||||
|
||||
#endif /* __ECORE_WIN32_PRIVATE_H__ */
|
|
@ -0,0 +1,480 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "ecore_win32_private.h"
|
||||
|
||||
|
||||
typedef enum _Ecore_Win32_Window_Z_Order Ecore_Win32_Window_Z_Order;
|
||||
enum _Ecore_Win32_Window_Z_Order
|
||||
{
|
||||
ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM,
|
||||
ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST,
|
||||
ECORE_WIN32_WINDOW_Z_ORDER_TOP,
|
||||
ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST
|
||||
};
|
||||
|
||||
|
||||
EAPI Ecore_Win32_Window *
|
||||
ecore_win32_window_new(Ecore_Win32_Window *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
RECT rect;
|
||||
struct _Ecore_Win32_Window *w;
|
||||
int minimal_width;
|
||||
int minimal_height;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)calloc(1, sizeof(struct _Ecore_Win32_Window));
|
||||
if (!w)
|
||||
return NULL;
|
||||
|
||||
printf (" * ecore : new debut : %d %d %d\n",
|
||||
width, height, GetSystemMetrics(SM_CXMIN));
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
if (!AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE))
|
||||
{
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
printf (" * ecore : new debut : %ld %d\n",
|
||||
rect.right - rect.left, GetSystemMetrics(SM_CXMIN));
|
||||
|
||||
minimal_width = GetSystemMetrics(SM_CXMIN);
|
||||
minimal_height = GetSystemMetrics(SM_CYMIN);
|
||||
if (((rect.right - rect.left) < minimal_width) ||
|
||||
((rect.bottom - rect.top) < minimal_height))
|
||||
{
|
||||
printf ("[Ecore] [Win32] ERROR !!\n");
|
||||
printf (" Wrong size %ld\n", rect.right - rect.left);
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
w->window = CreateWindow(ECORE_WIN32_WINDOW_CLASS, "",
|
||||
WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
|
||||
x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
parent ? ((struct _Ecore_Win32_Window *)parent)->window : NULL,
|
||||
NULL, _ecore_win32_instance, NULL);
|
||||
if (!w->window)
|
||||
{
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ecore_list_append(_ecore_win32_windows_list, w) == FALSE)
|
||||
{
|
||||
ecore_win32_ddraw_shutdown(w);
|
||||
DestroyWindow(w->window);
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
w->min_width = width;
|
||||
w->min_height = height;
|
||||
w->max_width = width;
|
||||
w->max_height = height;
|
||||
w->base_width = 0;
|
||||
w->base_height = 0;
|
||||
w->step_width = 1;
|
||||
w->step_height = 1;
|
||||
|
||||
w->pointer_is_in = 0;
|
||||
w->borderless = 0;
|
||||
w->iconified = 0;
|
||||
w->fullscreen = 0;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_del(Ecore_Win32_Window *window)
|
||||
{
|
||||
Ecore_Win32_Window *w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
ecore_list_first_goto(_ecore_win32_windows_list);
|
||||
while ((w = ecore_list_next(_ecore_win32_windows_list)))
|
||||
{
|
||||
if (w == window)
|
||||
{
|
||||
ecore_list_remove(_ecore_win32_windows_list);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ecore_list_remove(_ecore_win32_windows_list);
|
||||
|
||||
ecore_win32_ddraw_shutdown(window);
|
||||
DestroyWindow(((struct _Ecore_Win32_Window *)window)->window);
|
||||
free(window);
|
||||
}
|
||||
|
||||
/*
|
||||
EAPI void
|
||||
ecore_win32_window_configure(Ecore_Win32_Window *window,
|
||||
Ecore_Win32_Window_Z_Order order,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
HWND w;
|
||||
|
||||
switch (order)
|
||||
{
|
||||
case ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM:
|
||||
w = HWND_BOTTOM;
|
||||
break;
|
||||
case ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST:
|
||||
w = HWND_NOTOPMOST;
|
||||
break;
|
||||
case ECORE_WIN32_WINDOW_Z_ORDER_TOP:
|
||||
w = HWND_TOP;
|
||||
break;
|
||||
case ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST:
|
||||
w = HWND_TOPMOST;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
SetWindowPos((struct _Ecore_Win32_Window *)window->window, w, x, y, width, height, ???);
|
||||
}
|
||||
*/
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_move(Ecore_Win32_Window *window,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
RECT rect;
|
||||
HWND w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = ((struct _Ecore_Win32_Window *)window)->window;
|
||||
if (!GetWindowRect(w, &rect))
|
||||
return;
|
||||
|
||||
MoveWindow(w, x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_resize(Ecore_Win32_Window *window,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
RECT rect;
|
||||
struct _Ecore_Win32_Window *w;
|
||||
DWORD style;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
if (!GetWindowRect(w->window, &rect)) return;
|
||||
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
if (width < w->min_width) width = w->min_width;
|
||||
if (width > w->max_width) width = w->max_width;
|
||||
if (height < w->min_height) height = w->min_height;
|
||||
if (height > w->max_height) height = w->max_height;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
style = GetWindowLong(w->window, GWL_STYLE);
|
||||
if (!AdjustWindowRect(&rect, style, FALSE))
|
||||
return;
|
||||
|
||||
MoveWindow(w->window, x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_move_resize(Ecore_Win32_Window *window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
RECT rect;
|
||||
struct _Ecore_Win32_Window *w;
|
||||
DWORD style;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = ((struct _Ecore_Win32_Window *)window);
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
if (width < w->min_width) width = w->min_width;
|
||||
if (width > w->max_width) width = w->max_width;
|
||||
if (height < w->min_height) height = w->min_height;
|
||||
if (height > w->max_height) height = w->max_height;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
style = GetWindowLong(w->window, GWL_STYLE);
|
||||
if (!AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE))
|
||||
return;
|
||||
|
||||
MoveWindow(w->window, x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_size_get(Ecore_Win32_Window *window,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
|
||||
&rect))
|
||||
{
|
||||
if (width) *width = 0;
|
||||
if (height) *height = 0;
|
||||
}
|
||||
|
||||
if (width) *width = rect.right - rect.left;
|
||||
if (height) *height = rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
|
||||
int min_width,
|
||||
int min_height)
|
||||
{
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
w->min_width = min_width;
|
||||
w->min_height = min_height;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
|
||||
int max_width,
|
||||
int max_height)
|
||||
{
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
w->max_width = max_width;
|
||||
w->max_height = max_height;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
|
||||
int base_width,
|
||||
int base_height)
|
||||
{
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
w->base_width = base_width;
|
||||
w->base_height = base_height;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
|
||||
int step_width,
|
||||
int step_height)
|
||||
{
|
||||
struct _Ecore_Win32_Window *w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
w = (struct _Ecore_Win32_Window *)window;
|
||||
w->step_width = step_width;
|
||||
w->step_height = step_height;
|
||||
}
|
||||
|
||||
/* TODO: ecore_win32_window_shaped_set */
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_show(Ecore_Win32_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL);
|
||||
UpdateWindow(((struct _Ecore_Win32_Window *)window)->window);
|
||||
}
|
||||
|
||||
/* FIXME: seems to block the taskbar */
|
||||
EAPI void
|
||||
ecore_win32_window_hide(Ecore_Win32_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_raise(Ecore_Win32_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
|
||||
HWND_TOP, 0, 0, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_lower(Ecore_Win32_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
|
||||
HWND_BOTTOM, 0, 0, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_title_set(Ecore_Win32_Window *window,
|
||||
const char *title)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
if (!title || !title[0]) return;
|
||||
|
||||
SetWindowText(((struct _Ecore_Win32_Window *)window)->window, title);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_focus_set(Ecore_Win32_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
SetFocus(((struct _Ecore_Win32_Window *)window)->window);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
|
||||
int on)
|
||||
{
|
||||
struct _Ecore_Win32_Window *ew;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
ew = (struct _Ecore_Win32_Window *)window;
|
||||
if (((ew->iconified) && (on)) ||
|
||||
((!ew->iconified) && (!on)))
|
||||
return;
|
||||
|
||||
if (on)
|
||||
{
|
||||
ShowWindow(ew->window,
|
||||
SW_MINIMIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(ew->window,
|
||||
SW_RESTORE);
|
||||
}
|
||||
ew->iconified = on;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
|
||||
int on)
|
||||
{
|
||||
RECT rect;
|
||||
DWORD style;
|
||||
struct _Ecore_Win32_Window *ew;
|
||||
HWND w;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
ew = (struct _Ecore_Win32_Window *)window;
|
||||
if (((ew->borderless) && (on)) ||
|
||||
((!ew->borderless) && (!on)))
|
||||
return;
|
||||
|
||||
w = ew->window;
|
||||
|
||||
style = GetWindowLong(w, GWL_STYLE);
|
||||
if (on)
|
||||
{
|
||||
if (!GetClientRect(w, &rect)) return;
|
||||
SetWindowLong(w, GWL_STYLE, style & ~WS_CAPTION);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GetWindowRect(w, &rect)) return;
|
||||
style |= WS_CAPTION;
|
||||
AdjustWindowRect (&rect, style, FALSE);
|
||||
SetWindowLong(w, GWL_STYLE, style);
|
||||
}
|
||||
SetWindowPos(w, HWND_TOPMOST,
|
||||
rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOMOVE | SWP_FRAMECHANGED);
|
||||
ew->borderless = on;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
|
||||
int on)
|
||||
{
|
||||
struct _Ecore_Win32_Window *ew;
|
||||
HWND w;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
ew = (struct _Ecore_Win32_Window *)window;
|
||||
if (((ew->fullscreen) && (on)) ||
|
||||
((!ew->fullscreen) && (!on)))
|
||||
return;
|
||||
|
||||
w = ew->window;
|
||||
|
||||
if (on)
|
||||
{
|
||||
if (!GetWindowRect(w, &ew->rect)) return;
|
||||
width = GetSystemMetrics (SM_CXSCREEN);
|
||||
height = GetSystemMetrics (SM_CYSCREEN);
|
||||
ew->style = GetWindowLong(w, GWL_STYLE);
|
||||
SetWindowLong(w, GWL_STYLE, (ew->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
|
||||
SetWindowPos(w, HWND_TOP, 0, 0, width, height,
|
||||
SWP_NOCOPYBITS | SWP_SHOWWINDOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong(w, GWL_STYLE, ew->style);
|
||||
SetWindowPos(w, HWND_NOTOPMOST,
|
||||
ew->rect.left,
|
||||
ew->rect.top,
|
||||
ew->rect.right - ew->rect.left,
|
||||
ew->rect.bottom - ew->rect.right,
|
||||
SWP_NOCOPYBITS | SWP_SHOWWINDOW);
|
||||
}
|
||||
ew->fullscreen = on;
|
||||
}
|
Loading…
Reference in New Issue