forked from enlightenment/efl
efl: remove Windows CE support
This commit is contained in:
parent
5080dc4dff
commit
9631585f24
|
@ -232,10 +232,6 @@ if HAVE_WIN32
|
|||
pkgconfig_DATA += pc/ecore-win32.pc
|
||||
endif
|
||||
|
||||
if HAVE_WINCE
|
||||
pkgconfig_DATA += pc/ecore-wince.pc
|
||||
endif
|
||||
|
||||
if HAVE_ECORE_X
|
||||
pkgconfig_DATA += pc/ecore-x.pc
|
||||
endif
|
||||
|
|
69
configure.ac
69
configure.ac
|
@ -160,13 +160,9 @@ AC_CANONICAL_HOST
|
|||
|
||||
# TODO: move me to m4 file that setups module/so related variables
|
||||
case "$host_os" in
|
||||
cegcc*)
|
||||
cegcc*|mingw32ce*)
|
||||
AC_MSG_ERROR([ceGCC compiler is not supported anymore. Exiting...])
|
||||
;;
|
||||
mingw32ce*)
|
||||
MODULE_ARCH="v"
|
||||
MODULE_EXT=".dll"
|
||||
;;
|
||||
mingw*)
|
||||
have_win32="yes"
|
||||
have_windows="yes"
|
||||
|
@ -189,17 +185,12 @@ AC_SUBST(EFL_VERSION_MAJOR)
|
|||
AC_SUBST(EFL_VERSION_MINOR)
|
||||
|
||||
have_systemd_pkg="no"
|
||||
have_wince="no"
|
||||
have_win32="no"
|
||||
have_windows="no"
|
||||
have_darwin="no"
|
||||
have_linux="no"
|
||||
have_ps3="no"
|
||||
case "$host_os" in
|
||||
mingw32ce*)
|
||||
have_wince="yes"
|
||||
have_windows="yes"
|
||||
;;
|
||||
mingw*|cygwin*)
|
||||
# TODO: check cygwin* here
|
||||
have_win32="yes"
|
||||
|
@ -226,7 +217,6 @@ AC_DEFINE_UNQUOTED([MODULE_ARCH], ["${MODULE_ARCH}"], ["Module architecture"])
|
|||
AC_DEFINE_UNQUOTED([SHARED_LIB_SUFFIX], ["${MODULE_EXT}"], [Suffix for shared objects])
|
||||
|
||||
# TODO: move me to m4 file that setups the windows related variables
|
||||
AM_CONDITIONAL([HAVE_WINCE], [test "x${have_wince}" = "xyes"])
|
||||
AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"])
|
||||
AM_CONDITIONAL([HAVE_WINDOWS], [test "x${have_windows}" = "xyes"])
|
||||
AM_CONDITIONAL([HAVE_PS3], [test "x${have_ps3}" = "xyes"])
|
||||
|
@ -680,14 +670,8 @@ EFL_SELECT_WINDOWS_VERSION
|
|||
|
||||
### Checks for libraries
|
||||
|
||||
EVIL_DLFCN_LIBS=""
|
||||
if test "${have_wince}" = "xyes"; then
|
||||
EFL_ADD_LIBS([EVIL], [-lws2])
|
||||
EVIL_DLFCN_LIBS="-ltoolhelp"
|
||||
else
|
||||
EFL_ADD_LIBS([EVIL], [-lole32 -lws2_32 -lsecur32 -luuid])
|
||||
EVIL_DLFCN_LIBS="-lpsapi"
|
||||
fi
|
||||
|
||||
AC_SUBST([EVIL_DLFCN_LIBS])
|
||||
|
||||
|
@ -1529,13 +1513,6 @@ if test "${want_wayland}" = "yes" && test "${want_egl}" = "yes" && test "${with_
|
|||
want_evas_engine_wayland_egl="yes"
|
||||
fi
|
||||
|
||||
if test "${have_wince}" = "yes"; then
|
||||
want_fontconfig="no"
|
||||
want_evas_image_loader_gif="no"
|
||||
want_evas_image_loader_tiff="no"
|
||||
want_evas_image_loader_webp="no"
|
||||
fi
|
||||
|
||||
if test "${want_lua_old}" = "yes"; then
|
||||
EFL_CHECK_LUA_OLD([EVAS])
|
||||
else
|
||||
|
@ -2381,11 +2358,7 @@ EFL_LIB_START([Ecore_Con])
|
|||
want_ecore_con_local_sockets="yes"
|
||||
want_ecore_con_abstract_sockets="yes"
|
||||
|
||||
if test "${have_wince}" = "yes"; then
|
||||
want_cares="no"
|
||||
want_ecore_con_local_sockets="no"
|
||||
want_ecore_con_abstract_sockets="no"
|
||||
elif test "${have_win32}" = "yes"; then
|
||||
if test "${have_win32}" = "yes"; then
|
||||
want_cares="yes"
|
||||
want_ecore_con_abstract_sockets="no"
|
||||
elif test "${have_darwin}" = "yes"; then
|
||||
|
@ -3042,37 +3015,6 @@ EFL_LIB_END([Ecore_Avahi])
|
|||
|
||||
#### End of Ecore_Avahi
|
||||
|
||||
#### Ecore_WinCE
|
||||
EFL_LIB_START_OPTIONAL([Ecore_WinCE], [test "${have_wince}" = "yes"])
|
||||
|
||||
### Additional options to configure
|
||||
|
||||
### Default values
|
||||
|
||||
### Checks for programs
|
||||
|
||||
### Checks for libraries
|
||||
EFL_PLATFORM_DEPEND([ECORE_WINCE], [evil])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WINCE], [ecore-input])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WINCE], [ecore])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WINCE], [eo])
|
||||
EFL_INTERNAL_DEPEND_PKG([ECORE_WINCE], [eina])
|
||||
|
||||
### Checks for header files
|
||||
|
||||
### Checks for types
|
||||
|
||||
### Checks for structures
|
||||
|
||||
### Checks for compiler characteristics
|
||||
|
||||
### Checks for linker characteristics
|
||||
|
||||
### Checks for library functions
|
||||
|
||||
EFL_LIB_END_OPTIONAL([Ecore_WinCE])
|
||||
#### End of Ecore_WinCE
|
||||
|
||||
|
||||
#### Ecore_X
|
||||
EFL_LIB_START_OPTIONAL([Ecore_X], [test "${want_x11_any}" = "yes"])
|
||||
|
@ -3369,10 +3311,6 @@ want_ecore_imf_xim="no"
|
|||
want_ecore_imf_scim="no"
|
||||
want_ecore_imf_ibus="no"
|
||||
want_ecore_imf_wayland="no"
|
||||
|
||||
if test "${have_wince}" = "yes"; then
|
||||
want_ecore_imf="no"
|
||||
else
|
||||
want_ecore_imf="yes"
|
||||
|
||||
if test "${have_windows}" = "no" && test "${have_darwin}" = "no"; then
|
||||
|
@ -3384,7 +3322,6 @@ else
|
|||
want_ecore_imf_wayland="yes"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
### Checks for programs
|
||||
|
||||
|
@ -4436,7 +4373,6 @@ pc/ecore-psl1ght.pc
|
|||
pc/ecore-sdl.pc
|
||||
pc/ecore-wayland.pc
|
||||
pc/ecore-win32.pc
|
||||
pc/ecore-wince.pc
|
||||
pc/ecore-x.pc
|
||||
pc/ecore-evas.pc
|
||||
pc/ecore-imf.pc
|
||||
|
@ -4591,7 +4527,6 @@ elif test "${have_darwin}" = "yes"; then
|
|||
echo "Ecore_Cocoa.....: $efl_lib_optional_ecore_cocoa"
|
||||
elif test "${have_windows}" = "yes"; then
|
||||
echo "Ecore_Win32.....: $have_win32"
|
||||
echo "Ecore_WinCE.....: $have_wince"
|
||||
fi
|
||||
echo "Ecore_Audio.....: ${efl_lib_optional_ecore_audio} (${features_ecore_audio})"
|
||||
echo "Ecore_Avahi.....: yes (${features_ecore_avahi})"
|
||||
|
|
|
@ -12,7 +12,7 @@ AC_DEFUN([EFL_SELECT_WINDOWS_VERSION],
|
|||
dnl configure option
|
||||
|
||||
AC_ARG_WITH([windows-version],
|
||||
[AC_HELP_STRING([--with-windows-version], [select the target Windows version (xp, vista, win7 or ce) @<:@default=xp@:>@])],
|
||||
[AC_HELP_STRING([--with-windows-version], [select the target Windows version (xp, vista or win7) @<:@default=xp@:>@])],
|
||||
[
|
||||
if test "x${with_windows_version}" = "xvista" ; then
|
||||
_winver="vista"
|
||||
|
@ -34,10 +34,6 @@ AC_MSG_CHECKING([which Windows version to target])
|
|||
AC_MSG_RESULT([${_winver}])
|
||||
|
||||
case "${_winver}" in
|
||||
ce)
|
||||
EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WCE=0x0420"
|
||||
_efl_windows_version="Windows CE"
|
||||
;;
|
||||
vista)
|
||||
EFL_WINDOWS_VERSION_CFLAGS="-D_WIN32_WINNT=0x0600"
|
||||
_efl_windows_version="Windows Vista"
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: ecore-wince
|
||||
Description: E core library, WinCE module
|
||||
Requires.private: @requirements_pc_ecore_wince@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lecore_wince
|
||||
Libs.private: @requirements_libs_ecore_wince@
|
||||
Cflags: -I${includedir}/efl-@VMAJ@ -I${includedir}/ecore-wince-@VMAJ@
|
|
@ -57,7 +57,6 @@ include Makefile_Ecore_Psl1ght.am
|
|||
include Makefile_Ecore_SDL.am
|
||||
include Makefile_Ecore_Wayland.am
|
||||
include Makefile_Ecore_Win32.am
|
||||
include Makefile_Ecore_WinCE.am
|
||||
include Makefile_Ecore_X.am
|
||||
include Makefile_Ecore_Audio.am
|
||||
include Makefile_Ecore_IMF.am
|
||||
|
|
|
@ -87,9 +87,6 @@ lib/ecore/ecore_private.h
|
|||
if HAVE_WIN32
|
||||
lib_ecore_libecore_la_SOURCES += lib/ecore/ecore_exe_win32.c
|
||||
else
|
||||
if HAVE_WINCE
|
||||
lib_ecore_libecore_la_SOURCES += lib/ecore/ecore_exe_wince.c
|
||||
else
|
||||
EXTRA_DIST += lib/ecore/ecore_exe_ps3.c
|
||||
#if ECORE_HAVE_PS3
|
||||
#libecore_la_SOURCES += ecore_exe_ps3.c
|
||||
|
@ -101,7 +98,6 @@ lib_ecore_libecore_la_SOURCES += lib/ecore/ecore_signal.c lib/ecore/ecore_exe.c
|
|||
#endif
|
||||
#endif
|
||||
endif
|
||||
endif
|
||||
|
||||
lib_ecore_libecore_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
if HAVE_WINCE
|
||||
|
||||
### Library
|
||||
|
||||
lib_LTLIBRARIES += lib/ecore_wince/libecore_wince.la
|
||||
|
||||
installed_ecorewincemainheadersdir = $(includedir)/ecore-wince-@VMAJ@
|
||||
dist_installed_ecorewincemainheaders_DATA = \
|
||||
lib/ecore_wince/Ecore_WinCE.h
|
||||
|
||||
lib_ecore_wince_libecore_wince_la_SOURCES = \
|
||||
lib/ecore_wince/ecore_wince.c \
|
||||
lib/ecore_wince/ecore_wince_event.c \
|
||||
lib/ecore_wince/ecore_wince_window.c \
|
||||
lib/ecore_wince/ecore_wince_private.h
|
||||
|
||||
lib_ecore_wince_libecore_wince_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_WINCE_CFLAGS@
|
||||
lib_ecore_wince_libecore_wince_la_LIBADD = @ECORE_WINCE_LIBS@
|
||||
lib_ecore_wince_libecore_wince_la_DEPENDENCIES = @ECORE_WINCE_INTERNAL_LIBS@
|
||||
lib_ecore_wince_libecore_wince_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
endif
|
|
@ -87,15 +87,11 @@ lib/eina/eina_inline_unicode.x
|
|||
# lib/eina/eina_model.h
|
||||
# lib/eina/eina_object.h
|
||||
|
||||
if HAVE_WINCE
|
||||
dist_installed_einaheaders_DATA += lib/eina/eina_inline_lock_wince.x
|
||||
else
|
||||
if HAVE_WIN32
|
||||
dist_installed_einaheaders_DATA += lib/eina/eina_inline_lock_win32.x
|
||||
else
|
||||
dist_installed_einaheaders_DATA += lib/eina/eina_inline_lock_posix.x
|
||||
endif
|
||||
endif
|
||||
|
||||
lib_eina_libeina_la_SOURCES = \
|
||||
lib/eina/eina_abi.c \
|
||||
|
|
|
@ -24,10 +24,6 @@ lib/evil/fnmatch.h \
|
|||
lib/evil/dirent.h \
|
||||
lib/evil/dlfcn.h
|
||||
|
||||
if HAVE_WINCE
|
||||
dist_install_evilheaders_DATA += lib/evil/mingw32ce/errno.h
|
||||
endif
|
||||
|
||||
evilmmanheadersdir = $(includedir)/evil-@VMAJ@/sys
|
||||
dist_evilmmanheaders_DATA = \
|
||||
lib/evil/sys/mman.h
|
||||
|
@ -39,6 +35,7 @@ lib/evil/evil_fnmatch.c \
|
|||
lib/evil/evil_fnmatch_list_of_states.c \
|
||||
lib/evil/evil_inet.c \
|
||||
lib/evil/evil_langinfo.c \
|
||||
lib/evil/evil_link_xp.cpp \
|
||||
lib/evil/evil_main.c \
|
||||
lib/evil/evil_mman.c \
|
||||
lib/evil/evil_pwd.c \
|
||||
|
@ -52,23 +49,11 @@ lib/evil/evil_uuid.c \
|
|||
lib/evil/evil_private.h \
|
||||
lib/evil/evil_fnmatch_private.h
|
||||
|
||||
if HAVE_WINCE
|
||||
lib_evil_libevil_la_SOURCES += lib/evil/evil_errno.c lib/evil/evil_link_ce.c
|
||||
else
|
||||
lib_evil_libevil_la_SOURCES += lib/evil/evil_link_xp.cpp
|
||||
endif
|
||||
|
||||
lib_evil_libevil_la_CFLAGS = @EVIL_CFLAGS@ @EVIL_CFLAGS_WRN@ -D__USE_MINGW_ANSI_STDIO
|
||||
lib_evil_libevil_la_CXXFLAGS = @EVIL_CXXFLAGS@ @EVIL_CFLAGS@
|
||||
lib_evil_libevil_la_LIBADD = @EVIL_LIBS@
|
||||
lib_evil_libevil_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
if HAVE_WINCE
|
||||
lib_evil_libevil_la_LINK = $(LINK) $(lib_evil_libevil_la_LDFLAGS)
|
||||
else
|
||||
lib_evil_libevil_la_LINK = $(CXXLINK) $(lib_evil_libevil_la_LDFLAGS)
|
||||
endif
|
||||
|
||||
# regex
|
||||
|
||||
dist_install_evilheaders_DATA += \
|
||||
|
@ -129,11 +114,7 @@ bin/evil/evil_test_print.h \
|
|||
bin/evil/evil_test_realpath.h \
|
||||
bin/evil/evil_test_util.h
|
||||
|
||||
if HAVE_WINCE
|
||||
bin_evil_evil_suite_SOURCES += bin/evil/memcpy_glibc_arm.S
|
||||
#else
|
||||
#suite_SOURCES += bin/evil/memcpy_glibc_i686.S # see EXTRA_DIST below!
|
||||
endif
|
||||
|
||||
bin_evil_evil_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EVIL_CFLAGS@
|
||||
bin_evil_evil_suite_LDADD = @USE_EVIL_LIBS@ @DL_LIBS@ -lm
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
|
||||
#define _(x) dgettext("ecore", x)
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# include <Evil.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EXOTIC
|
||||
# include <Exotic.h>
|
||||
#endif
|
||||
|
|
|
@ -1,315 +0,0 @@
|
|||
#ifndef __ECORE_WINCE_H__
|
||||
#define __ECORE_WINCE_H__
|
||||
|
||||
/*
|
||||
* DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
|
||||
* THE API MAY CHANGE.
|
||||
*/
|
||||
|
||||
#ifndef ECORE_WINCE_WIP_OSXCKQSD
|
||||
# warning "You are using a work in progress API. This API is not stable"
|
||||
# warning "and is subject to change. You use this at your own risk."
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef EFL_ECORE_WINCE_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI
|
||||
# endif /* ! DLL_EXPORT */
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif /* ! EFL_ECORE_WINCE_BUILD */
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 4
|
||||
# define EAPI __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
# else
|
||||
# define EAPI
|
||||
# endif
|
||||
#endif /* ! _WINCE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_WinCE_Group Ecore_WinCE library
|
||||
* @ingroup Ecore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Window
|
||||
* Abstract type for a window.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Mouse_In
|
||||
* Event sent when the mouse enters the window.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Mouse_In Ecore_WinCE_Event_Mouse_In;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Mouse_Out
|
||||
* Event sent when the mouse leaves the window.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Mouse_Out Ecore_WinCE_Event_Mouse_Out;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Focus_In
|
||||
* Event sent when the window gets the focus.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Focus_In Ecore_WinCE_Event_Window_Focus_In;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Focus_Out
|
||||
* Event sent when the window looses the focus.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Focus_Out Ecore_WinCE_Event_Window_Focus_Out;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Damage
|
||||
* Event sent when the window is damaged.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Damage Ecore_WinCE_Event_Window_Damage;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Create
|
||||
* Event sent when the window is created.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Create Ecore_WinCE_Event_Window_Create;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Destroy
|
||||
* Event sent when the window is destroyed.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Destroy Ecore_WinCE_Event_Window_Destroy;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Hide
|
||||
* Event sent when the window is hidden.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Hide Ecore_WinCE_Event_Window_Hide;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Show
|
||||
* Event sent when the window is shown.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Show Ecore_WinCE_Event_Window_Show;
|
||||
|
||||
/**
|
||||
* @typedef Ecore_WinCE_Event_Window_Delete_Request
|
||||
* Event sent when the window is deleted.
|
||||
*/
|
||||
typedef struct _Ecore_WinCE_Event_Window_Delete_Request Ecore_WinCE_Event_Window_Delete_Request;
|
||||
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Mouse_In
|
||||
* Event sent when the mouse enters the window.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Mouse_In
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
int x; /**< The x coordinate where the mouse entered */
|
||||
int y; /**< The y coordinate where the mouse entered */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Mouse_Out
|
||||
* Event sent when the mouse leaves the window.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Mouse_Out
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
int x; /**< The x coordinate where the mouse leaved */
|
||||
int y; /**< The y coordinate where the mouse leaved */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Focus_In
|
||||
* Event sent when the window gets the focus.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Focus_In
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Focus_Out
|
||||
* Event sent when the window looses the focus.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Focus_Out
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Damage
|
||||
* Event sent when the window is damaged.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Damage
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
int x; /**< The x coordinate of the top left corner of the damaged region */
|
||||
int y; /**< The y coordinate of the top left corner of the damaged region */
|
||||
int width; /**< The width of the damaged region */
|
||||
int height; /**< The height of the damaged region */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Create
|
||||
* Event sent when the window is created.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Create
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Destroy
|
||||
* Event sent when the window is destroyed.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Destroy
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Hide
|
||||
* Event sent when the window is hidden.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Hide
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Show
|
||||
* Event sent when the window is shown.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Show
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct _Ecore_WinCE_Event_Window_Delete_Request
|
||||
* Event sent when the window is deleted.
|
||||
*/
|
||||
struct _Ecore_WinCE_Event_Window_Delete_Request
|
||||
{
|
||||
Ecore_WinCE_Window *window; /**< The window that received the event */
|
||||
long time; /**< The time the event occurred */
|
||||
};
|
||||
|
||||
|
||||
EAPI extern int ECORE_WINCE_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_WinCE_Event_Mouse_In event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_WinCE_Event_Mouse_Out event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Focus_In event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Focus_Out event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the Ecore_WinCE_Event_Damage event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_CREATE; /**< Ecore_Event for the Ecore_WinCE_Event_Create event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the Ecore_WinCE_Event_Destroy event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_HIDE; /**< Ecore_Event for the Ecore_WinCE_Event_Hide event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_SHOW; /**< Ecore_Event for the Ecore_WinCE_Event_Show event */
|
||||
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Delete_Request event */
|
||||
|
||||
|
||||
/* Core */
|
||||
|
||||
EAPI int ecore_wince_init();
|
||||
EAPI int ecore_wince_shutdown();
|
||||
EAPI void ecore_wince_double_click_time_set(double t);
|
||||
EAPI double ecore_wince_double_click_time_get(void);
|
||||
EAPI long ecore_wince_current_time_get(void);
|
||||
|
||||
/* Window */
|
||||
|
||||
EAPI Ecore_WinCE_Window *ecore_wince_window_new(Ecore_WinCE_Window *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI void ecore_wince_window_free(Ecore_WinCE_Window *window);
|
||||
|
||||
EAPI void *ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window);
|
||||
|
||||
EAPI void ecore_wince_window_move(Ecore_WinCE_Window *window,
|
||||
int x,
|
||||
int y);
|
||||
|
||||
EAPI void ecore_wince_window_resize(Ecore_WinCE_Window *window,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI void ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
EAPI void ecore_wince_window_show(Ecore_WinCE_Window *window);
|
||||
|
||||
EAPI void ecore_wince_window_hide(Ecore_WinCE_Window *window);
|
||||
|
||||
EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window,
|
||||
const char *title);
|
||||
|
||||
EAPI void ecore_wince_window_focus(Ecore_WinCE_Window *window);
|
||||
|
||||
EAPI void *ecore_wince_window_focus_get(void);
|
||||
|
||||
EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend);
|
||||
|
||||
EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int));
|
||||
|
||||
EAPI void ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int));
|
||||
|
||||
EAPI void ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
EAPI void ecore_wince_window_size_get(Ecore_WinCE_Window *window,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
EAPI void ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
|
||||
Eina_Bool on);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ECORE_WINCE_H__ */
|
|
@ -1,400 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h> /* for printf */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_Input.h>
|
||||
|
||||
#include "Ecore_WinCE.h"
|
||||
#include "ecore_wince_private.h"
|
||||
|
||||
/*============================================================================*
|
||||
* Local *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @cond LOCAL
|
||||
*/
|
||||
|
||||
static int _ecore_wince_init_count = 0;
|
||||
|
||||
LRESULT CALLBACK
|
||||
_ecore_wince_window_procedure(HWND window,
|
||||
UINT message,
|
||||
WPARAM window_param,
|
||||
LPARAM data_param)
|
||||
{
|
||||
Ecore_WinCE_Callback_Data *data;
|
||||
POINTS pt;
|
||||
DWORD coord;
|
||||
|
||||
data = (Ecore_WinCE_Callback_Data *)malloc(sizeof(Ecore_WinCE_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 = GetTickCount();
|
||||
coord = GetMessagePos();
|
||||
pt = MAKEPOINTS(coord);
|
||||
data->x = pt.x;
|
||||
data->y = pt.y;
|
||||
|
||||
switch (data->message)
|
||||
{
|
||||
/* Keyboard input notifications */
|
||||
case WM_CHAR:
|
||||
_ecore_wince_event_handle_key_press(data, 0);
|
||||
break;
|
||||
case WM_HOTKEY:
|
||||
_ecore_wince_event_handle_key_press(data, 1);
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
_ecore_wince_event_handle_key_press(data, 1);
|
||||
break;
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
_ecore_wince_event_handle_key_release(data, 1);
|
||||
break;
|
||||
case WM_SETFOCUS:
|
||||
_ecore_wince_event_handle_focus_in(data);
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
_ecore_wince_event_handle_focus_out(data);
|
||||
break;
|
||||
/* Mouse input notifications */
|
||||
case WM_LBUTTONDOWN:
|
||||
_ecore_wince_event_handle_button_press(data, 1);
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
_ecore_wince_event_handle_button_release(data, 1);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
RECT rect;
|
||||
Ecore_WinCE_Window *w = NULL;
|
||||
|
||||
w = (Ecore_WinCE_Window *)GetWindowLong(window, GWL_USERDATA);
|
||||
|
||||
if (GetClientRect(window, &rect))
|
||||
{
|
||||
POINT pt;
|
||||
|
||||
INF("mouse in window");
|
||||
|
||||
pt.x = LOWORD(data_param);
|
||||
pt.y = HIWORD(data_param);
|
||||
if (!PtInRect(&rect, pt))
|
||||
{
|
||||
if (w->pointer_is_in)
|
||||
{
|
||||
w->pointer_is_in = 0;
|
||||
_ecore_wince_event_handle_leave_notify(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!w->pointer_is_in)
|
||||
{
|
||||
w->pointer_is_in = 1;
|
||||
_ecore_wince_event_handle_enter_notify(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("GetClientRect() failed");
|
||||
}
|
||||
_ecore_wince_event_handle_motion_notify(data);
|
||||
|
||||
break;
|
||||
}
|
||||
/* Window notifications */
|
||||
case WM_CREATE:
|
||||
_ecore_wince_event_handle_create_notify(data);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
_ecore_wince_event_handle_destroy_notify(data);
|
||||
break;
|
||||
case WM_SHOWWINDOW:
|
||||
if ((data->data_param == SW_OTHERUNZOOM) ||
|
||||
(data->data_param == SW_OTHERZOOM))
|
||||
break;
|
||||
|
||||
if (data->window_param)
|
||||
_ecore_wince_event_handle_map_notify(data);
|
||||
else
|
||||
_ecore_wince_event_handle_unmap_notify(data);
|
||||
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
_ecore_wince_event_handle_delete_request(data);
|
||||
break;
|
||||
/* GDI notifications */
|
||||
case WM_ERASEBKGND:
|
||||
return 1;
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT paint;
|
||||
|
||||
if (BeginPaint(window, &paint))
|
||||
{
|
||||
data->update = paint.rcPaint;
|
||||
_ecore_wince_event_handle_expose(data);
|
||||
EndPaint(window, &paint);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return DefWindowProc(window, message, window_param, data_param);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_wince_error_print_cb(const Eina_Log_Domain *d EINA_UNUSED,
|
||||
Eina_Log_Level level EINA_UNUSED,
|
||||
const char *file EINA_UNUSED,
|
||||
const char *fnc,
|
||||
int line,
|
||||
const char *fmt,
|
||||
void *data EINA_UNUSED,
|
||||
va_list args)
|
||||
{
|
||||
fprintf(stderr, "[%s:%d] ", fnc, line);
|
||||
vfprintf(stderr, fmt, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
*============================================================================*/
|
||||
|
||||
|
||||
double _ecore_wince_double_click_time = 0.25;
|
||||
long _ecore_wince_event_last_time = 0;
|
||||
Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL;
|
||||
HINSTANCE _ecore_wince_instance = NULL;
|
||||
int _ecore_wince_log_dom_global = -1;
|
||||
|
||||
int ECORE_WINCE_EVENT_MOUSE_IN = 0;
|
||||
int ECORE_WINCE_EVENT_MOUSE_OUT = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_DAMAGE = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_CREATE = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_DESTROY = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_SHOW = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_HIDE = 0;
|
||||
int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0;
|
||||
|
||||
/*============================================================================*
|
||||
* API *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_WinCE_Group Ecore_WinCE library
|
||||
*
|
||||
* Ecore_WinCE is a library that wraps Windows CE graphic functions
|
||||
* and integrate them nicely into the Ecore main loop.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialize the Ecore_WinCE library.
|
||||
*
|
||||
* @return 1 or greater on success, 0 on error.
|
||||
*
|
||||
* This function sets up the Windows CE graphic system. It returns 0 on
|
||||
* failure, otherwise it returns the number of times it has already been
|
||||
* called.
|
||||
*
|
||||
* When Ecore_WinCE is not used anymore, call ecore_wince_shutdown()
|
||||
* to shut down the Ecore_WinCE library.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_wince_init()
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
if (++_ecore_wince_init_count != 1)
|
||||
return _ecore_wince_init_count;
|
||||
|
||||
if (!eina_init())
|
||||
return --_ecore_wince_init_count;
|
||||
|
||||
eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL);
|
||||
_ecore_wince_log_dom_global = eina_log_domain_register
|
||||
("ecore_wince", ECORE_WINCE_DEFAULT_LOG_COLOR);
|
||||
if (_ecore_wince_log_dom_global < 0)
|
||||
{
|
||||
EINA_LOG_ERR("Ecore_WinCE: Could not register log domain");
|
||||
goto shutdown_eina;
|
||||
}
|
||||
|
||||
if (!ecore_event_init())
|
||||
{
|
||||
ERR("Ecore_WinCE: Could not init ecore_event");
|
||||
goto unregister_log_domain;
|
||||
}
|
||||
|
||||
_ecore_wince_instance = GetModuleHandle(NULL);
|
||||
if (!_ecore_wince_instance)
|
||||
{
|
||||
ERR("GetModuleHandle() failed");
|
||||
goto shutdown_ecore_event;
|
||||
}
|
||||
|
||||
memset (&wc, 0, sizeof (wc));
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = _ecore_wince_window_procedure;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = _ecore_wince_instance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||
wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = ECORE_WINCE_WINDOW_CLASS;
|
||||
|
||||
if(!RegisterClass(&wc))
|
||||
{
|
||||
ERR("RegisterClass() failed");
|
||||
goto free_library;
|
||||
}
|
||||
|
||||
if (!ECORE_WINCE_EVENT_MOUSE_IN)
|
||||
{
|
||||
ECORE_WINCE_EVENT_MOUSE_IN = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_MOUSE_OUT = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_CREATE = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_DESTROY = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_SHOW = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_HIDE = ecore_event_type_new();
|
||||
ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
|
||||
}
|
||||
|
||||
return _ecore_wince_init_count;
|
||||
|
||||
free_library:
|
||||
FreeLibrary(_ecore_wince_instance);
|
||||
shutdown_ecore_event:
|
||||
ecore_event_shutdown();
|
||||
unregister_log_domain:
|
||||
eina_log_domain_unregister(_ecore_wince_log_dom_global);
|
||||
shutdown_eina:
|
||||
eina_shutdown();
|
||||
|
||||
return --_ecore_wince_init_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shut down the Ecore_WinCE library.
|
||||
*
|
||||
* @return 0 when the library is completely shut down, 1 or
|
||||
* greater otherwise.
|
||||
*
|
||||
* This function shuts down the Ecore_WinCE library. It returns 0 when it has
|
||||
* been called the same number of times than ecore_wince_init(). In that case
|
||||
* it shuts down all the Windows CE graphic system.
|
||||
*/
|
||||
EAPI int
|
||||
ecore_wince_shutdown()
|
||||
{
|
||||
HWND task_bar;
|
||||
|
||||
if (--_ecore_wince_init_count != 0)
|
||||
return _ecore_wince_init_count;
|
||||
|
||||
/* force task bar to be shown (in case the application exits */
|
||||
/* while being fullscreen) */
|
||||
task_bar = FindWindow(L"HHTaskBar", NULL);
|
||||
if (task_bar)
|
||||
{
|
||||
ShowWindow(task_bar, SW_SHOW);
|
||||
EnableWindow(task_bar, TRUE);
|
||||
}
|
||||
|
||||
if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance))
|
||||
ERR("UnregisterClass() failed");
|
||||
|
||||
if (!FreeLibrary(_ecore_wince_instance))
|
||||
ERR("FreeLibrary() failed");
|
||||
|
||||
_ecore_wince_instance = NULL;
|
||||
|
||||
ecore_event_shutdown();
|
||||
eina_log_domain_unregister(_ecore_wince_log_dom_global);
|
||||
_ecore_wince_log_dom_global = -1;
|
||||
eina_shutdown();
|
||||
|
||||
return _ecore_wince_init_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the timeout for a double and triple clicks to be flagged.
|
||||
*
|
||||
* @param t The time in seconds.
|
||||
*
|
||||
* This function sets the time @p t 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.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_double_click_time_set(double t)
|
||||
{
|
||||
if (t < 0.0) t = 0.0;
|
||||
_ecore_wince_double_click_time = t;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve the double and triple click flag timeout.
|
||||
*
|
||||
* @return The timeout for double clicks in seconds.
|
||||
*
|
||||
* This function returns the double clicks in seconds. If
|
||||
* ecore_wince_double_click_time_set() has not been called, the
|
||||
* default value is returned. See ecore_wince_double_click_time_set()
|
||||
* for more informations.
|
||||
*/
|
||||
EAPI double
|
||||
ecore_wince_double_click_time_get(void)
|
||||
{
|
||||
return _ecore_wince_double_click_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the last event time.
|
||||
*
|
||||
* @return The last envent time.
|
||||
*
|
||||
* This function returns the last event time.
|
||||
*/
|
||||
EAPI long
|
||||
ecore_wince_current_time_get(void)
|
||||
{
|
||||
return _ecore_wince_event_last_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
|
@ -1,85 +0,0 @@
|
|||
#ifndef __ECORE_WINCE_PRIVATE_H__
|
||||
#define __ECORE_WINCE_PRIVATE_H__
|
||||
|
||||
|
||||
/* logging messages macros */
|
||||
extern int _ecore_wince_log_dom_global;
|
||||
|
||||
#ifdef ECORE_WINCE_DEFAULT_LOG_COLOR
|
||||
#undef ECORE_WINCE_DEFAULT_LOG_COLOR
|
||||
#endif
|
||||
#define ECORE_WINCE_DEFAULT_LOG_COLOR EINA_COLOR_LIGHTBLUE
|
||||
|
||||
#ifdef ERR
|
||||
# undef ERR
|
||||
#endif
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_wince_log_dom_global , __VA_ARGS__)
|
||||
#ifdef DBG
|
||||
# undef DBG
|
||||
#endif
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_wince_log_dom_global , __VA_ARGS__)
|
||||
#ifdef INF
|
||||
# undef INF
|
||||
#endif
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_ecore_wince_log_dom_global , __VA_ARGS__)
|
||||
|
||||
#define ECORE_WINCE_WINDOW_CLASS L"Ecore_WinCE_Window_Class"
|
||||
|
||||
|
||||
typedef struct _Ecore_WinCE_Callback_Data Ecore_WinCE_Callback_Data;
|
||||
|
||||
struct _Ecore_WinCE_Callback_Data
|
||||
{
|
||||
RECT update;
|
||||
HWND window;
|
||||
unsigned int message;
|
||||
WPARAM window_param;
|
||||
LPARAM data_param;
|
||||
long time;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
|
||||
typedef int (*ecore_wince_suspend_cb) (int);
|
||||
typedef int (*ecore_wince_resume_cb) (int);
|
||||
|
||||
|
||||
struct _Ecore_WinCE_Window
|
||||
{
|
||||
HWND window;
|
||||
|
||||
int backend;
|
||||
ecore_wince_suspend_cb suspend_cb;
|
||||
ecore_wince_resume_cb resume_cb;
|
||||
|
||||
RECT rect; /* used to go fullscreen to normal */
|
||||
|
||||
unsigned int pointer_is_in : 1;
|
||||
unsigned int fullscreen : 1;
|
||||
};
|
||||
|
||||
extern HINSTANCE _ecore_wince_instance;
|
||||
extern double _ecore_wince_double_click_time;
|
||||
extern long _ecore_wince_event_last_time;
|
||||
extern Ecore_WinCE_Window *_ecore_wince_event_last_window;
|
||||
|
||||
|
||||
void _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg, int is_keystroke);
|
||||
void _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg, int is_keystroke);
|
||||
void _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg, int button);
|
||||
void _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg, int button);
|
||||
void _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg);
|
||||
void _ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg);
|
||||
|
||||
|
||||
#endif /* __ECORE_WINCE_PRIVATE_H__ */
|
|
@ -1,827 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <Evil.h>
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Ecore_WinCE.h"
|
||||
#include "ecore_wince_private.h"
|
||||
|
||||
/*============================================================================*
|
||||
* Local *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @cond LOCAL
|
||||
*/
|
||||
|
||||
|
||||
typedef BOOL (__stdcall *UnregisterFunc1Proc)(UINT, UINT);
|
||||
|
||||
static int
|
||||
_ecore_wince_hardware_keys_register(HWND window)
|
||||
{
|
||||
HINSTANCE core_dll;
|
||||
UnregisterFunc1Proc unregister_fct;
|
||||
int i;
|
||||
|
||||
core_dll = LoadLibrary(L"coredll.dll");
|
||||
if (!core_dll)
|
||||
{
|
||||
ERR("LoadLibrary() failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1");
|
||||
if (!unregister_fct)
|
||||
{
|
||||
ERR("GetProcAddress() failed");
|
||||
FreeLibrary(core_dll);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0xc1; i <= 0xcf; i++)
|
||||
{
|
||||
unregister_fct(MOD_WIN, i);
|
||||
RegisterHotKey(window, i, MOD_WIN, i);
|
||||
}
|
||||
|
||||
FreeLibrary(core_dll);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
*============================================================================*/
|
||||
|
||||
/*============================================================================*
|
||||
* API *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @addtogroup Ecore_WinCE_Group Ecore_WinCE library
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Creates a new window.
|
||||
*
|
||||
* @param parent The parent window.
|
||||
* @param x The x coordinate of the top-left corner of the window.
|
||||
* @param y The y coordinate of the top-left corner of the window.
|
||||
* @param width The width of the window.
|
||||
* @param height The height of hte window.
|
||||
* @return A newly allocated window.
|
||||
*
|
||||
* This function creates a new window which parent is @p parent. @p width and
|
||||
* @p height are the size of the window content (the client part),
|
||||
* without the border and title bar. @p x and @p y are the system
|
||||
* coordinates of the top left cerner of the window (that is, of the
|
||||
* title bar). This function returns a newly created window on
|
||||
* success, and @c NULL on failure.
|
||||
*/
|
||||
EAPI Ecore_WinCE_Window *
|
||||
ecore_wince_window_new(Ecore_WinCE_Window *parent,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
Ecore_WinCE_Window *w;
|
||||
HWND window;
|
||||
RECT rect;
|
||||
|
||||
INF("creating window");
|
||||
|
||||
w = (Ecore_WinCE_Window *)calloc(1, sizeof(Ecore_WinCE_Window));
|
||||
if (!w)
|
||||
{
|
||||
ERR("malloc() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST))
|
||||
{
|
||||
ERR("AdjustWindowRectEx() failed");
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
window = CreateWindowEx(WS_EX_TOPMOST,
|
||||
ECORE_WINCE_WINDOW_CLASS,
|
||||
L"",
|
||||
WS_CAPTION | WS_SYSMENU | WS_VISIBLE,
|
||||
x, y,
|
||||
rect.right - rect.left, rect.bottom - rect.top,
|
||||
parent ? ((Ecore_WinCE_Window *)parent)->window : NULL,
|
||||
NULL, _ecore_wince_instance, NULL);
|
||||
if (!window)
|
||||
{
|
||||
ERR("CreateWindowEx() failed");
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_ecore_wince_hardware_keys_register(window))
|
||||
{
|
||||
ERR("_ecore_wince_hardware_keys_register() failed");
|
||||
DestroyWindow(window);
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
w->window = window;
|
||||
|
||||
SetLastError(0);
|
||||
if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
|
||||
{
|
||||
ERR("SetWindowLong() failed");
|
||||
DestroyWindow(window);
|
||||
free(w);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
w->pointer_is_in = 0;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Free the given window.
|
||||
*
|
||||
* @param window The window to free.
|
||||
*
|
||||
* This function frees @p window. If @p window is @c NULL, this
|
||||
* function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_free(Ecore_WinCE_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
INF("destroying window");
|
||||
|
||||
DestroyWindow(window->window);
|
||||
free(window);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the window HANDLE associated to the given window.
|
||||
*
|
||||
* @param window The window to retrieve the HANDLE from.
|
||||
*
|
||||
* This function returns the window HANDLE associated to @p window. If
|
||||
* @p window is @c NULL, this function returns @c NULL.
|
||||
*/
|
||||
EAPI void *
|
||||
ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window)
|
||||
{
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
return window->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move the given window to a given position.
|
||||
*
|
||||
* @param window The window to move.
|
||||
* @param x The x coordinate of the destination position.
|
||||
* @param y The y coordinate of the destination position.
|
||||
*
|
||||
* This function move @p window to the new position of coordinates @p x
|
||||
* and @p y. If @p window is @c NULL, or if it is fullscreen, or on
|
||||
* error, this function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_move(Ecore_WinCE_Window *window,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (!window || window->fullscreen)
|
||||
return;
|
||||
|
||||
INF("moving window (%dx%d)", x, y);
|
||||
|
||||
if (!GetWindowRect(window->window, &rect))
|
||||
{
|
||||
ERR("GetWindowRect() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MoveWindow(window->window, x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
TRUE))
|
||||
{
|
||||
ERR("MoveWindow() failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resize the given window to a given size.
|
||||
*
|
||||
* @param window The window to resize.
|
||||
* @param width The new width.
|
||||
* @param height The new height.
|
||||
*
|
||||
* This function resize @p window to the new @p width and @p height.
|
||||
* If @p window is @c NULL, or if it is fullscreen, or on error, this
|
||||
* function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_resize(Ecore_WinCE_Window *window,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
RECT rect;
|
||||
DWORD style;
|
||||
DWORD exstyle;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
if (!window || window->fullscreen)
|
||||
return;
|
||||
|
||||
INF("resizing window (%dx%d)", width, height);
|
||||
|
||||
if (!GetWindowRect(window->window, &rect))
|
||||
{
|
||||
ERR("GetWindowRect() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
if (!(style = GetWindowLong(window->window, GWL_STYLE)))
|
||||
{
|
||||
ERR("GetWindowLong() failed");
|
||||
return;
|
||||
}
|
||||
if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE)))
|
||||
{
|
||||
ERR("GetWindowLong() failed");
|
||||
return;
|
||||
}
|
||||
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
|
||||
{
|
||||
ERR("AdjustWindowRectEx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MoveWindow(window->window, x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
FALSE))
|
||||
{
|
||||
ERR("MoveWindow() failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move and resize the given window to a given position and size.
|
||||
*
|
||||
* @param window The window to move and resize.
|
||||
* @param x The x coordinate of the destination position.
|
||||
* @param y The x coordinate of the destination position.
|
||||
* @param width The new width.
|
||||
* @param height The new height.
|
||||
*
|
||||
* This function resize @p window to the new position of coordinates @p x
|
||||
* and @p y and the new @p width and @p height. If @p window is @c NULL,
|
||||
* or if it is fullscreen, or on error, this function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
RECT rect;
|
||||
DWORD style;
|
||||
DWORD exstyle;
|
||||
|
||||
if (!window || window->fullscreen)
|
||||
return;
|
||||
|
||||
INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height);
|
||||
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
if (!(style = GetWindowLong(window->window, GWL_STYLE)))
|
||||
{
|
||||
ERR("GetWindowLong() failed");
|
||||
return;
|
||||
}
|
||||
if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE)))
|
||||
{
|
||||
ERR("GetWindowLong() failed");
|
||||
return;
|
||||
}
|
||||
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
|
||||
{
|
||||
ERR("AdjustWindowRectEx() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MoveWindow(window->window, x, y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
TRUE))
|
||||
{
|
||||
ERR("MoveWindow() failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Show the given window.
|
||||
*
|
||||
* @param window The window to show.
|
||||
*
|
||||
* This function shows @p window. If @p window is @c NULL, or on
|
||||
* error, this function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_show(Ecore_WinCE_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
INF("showing window");
|
||||
|
||||
if (!ShowWindow(window->window, SW_SHOWNORMAL))
|
||||
{
|
||||
ERR("ShowWindow() failed");
|
||||
return;
|
||||
}
|
||||
if (!UpdateWindow(window->window))
|
||||
{
|
||||
ERR("UpdateWindow() failed");
|
||||
}
|
||||
if (!SendMessage(window->window, WM_SHOWWINDOW, 1, 0))
|
||||
{
|
||||
ERR("SendMessage() failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Hide the given window.
|
||||
*
|
||||
* @param window The window to show.
|
||||
*
|
||||
* This function hides @p window. If @p window is @c NULL, or on
|
||||
* error, this function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_hide(Ecore_WinCE_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
INF("hiding window");
|
||||
|
||||
if (!ShowWindow(window->window, SW_HIDE))
|
||||
{
|
||||
ERR("ShowWindow() failed");
|
||||
return;
|
||||
}
|
||||
if (!SendMessage(window->window, WM_SHOWWINDOW, 0, 0))
|
||||
{
|
||||
ERR("SendMessage() failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the title of the given window.
|
||||
*
|
||||
* @param window The window to set the title.
|
||||
* @param title The new title.
|
||||
*
|
||||
* This function sets the title of @p window to @p title. If @p window
|
||||
* is @c NULL, or if @p title is @c NULL or empty, or on error, this
|
||||
* function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_title_set(Ecore_WinCE_Window *window,
|
||||
const char *title)
|
||||
{
|
||||
wchar_t *wtitle;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
if (!title || !title[0]) return;
|
||||
|
||||
INF("setting window title");
|
||||
|
||||
wtitle = evil_char_to_wchar(title);
|
||||
if (!wtitle) return;
|
||||
|
||||
if (!SetWindowText(window->window, wtitle))
|
||||
{
|
||||
ERR("SetWindowText() failed");
|
||||
}
|
||||
free(wtitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the focus to the given window.
|
||||
*
|
||||
* @param window The window to give focus to.
|
||||
*
|
||||
* This function gives the focus to @p window. If @p window is
|
||||
* @c NULL, this function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_focus(Ecore_WinCE_Window *window)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
INF("focusing window");
|
||||
|
||||
if (!SetFocus(window->window))
|
||||
{
|
||||
ERR("SetFocus() failed");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the current focused window.
|
||||
*
|
||||
* @return The window that has focus.
|
||||
*
|
||||
* This function returns the window that has focus. If the calling
|
||||
* thread's message queue does not have an associated window with the
|
||||
* keyboard focus, the return value is @c NULL.
|
||||
*
|
||||
* @note Even if the returned value is @c NULL, another thread's queue
|
||||
* may be associated with a window that has the keyboard focus.
|
||||
*
|
||||
* @note The returned value is of type HWND.
|
||||
*/
|
||||
EAPI void *
|
||||
ecore_wince_window_focus_get(void)
|
||||
{
|
||||
HWND focused;
|
||||
|
||||
INF("getting focused window");
|
||||
|
||||
focused = GetFocus();
|
||||
if (!focused)
|
||||
{
|
||||
ERR("GetFocus() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return focused;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the graphic backend used for the given window.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param backend The backend.
|
||||
*
|
||||
* This function sets the graphic backend to use with @p window to
|
||||
* @p backend. If @p window if @c NULL, this function does nothing.
|
||||
*
|
||||
* The valid values for @p backend are
|
||||
*
|
||||
* @li 0: automatic choice of the backend.
|
||||
* @li 1: the framebuffer (fast but could be not well suported).
|
||||
* @li 2: GAPI (less fast but almost always supported).
|
||||
* @li 3: DirectDraw (less fast than GAPI but almost always
|
||||
* supported).
|
||||
* @li 4: GDI (the slowest but always supported).
|
||||
*
|
||||
* The @p backend is used only in Evas and Ecore_Evas. So this
|
||||
* function should not be called if Ecore_Evas is used.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_backend_set(Ecore_WinCE_Window *window,
|
||||
int backend)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
INF("setting backend");
|
||||
|
||||
window->backend = backend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the suspend callback used for the given window.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param suspend_cb The suspend callback.
|
||||
*
|
||||
* This function sets the suspend callback to use with @p window to
|
||||
* @p suspend_cb. If @p window if @c NULL, this function does nothing.
|
||||
*
|
||||
* The @p suspend_cb is used only in Evas and Ecore_Evas. So this
|
||||
* function should not be called if Ecore_Evas is used.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int))
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
INF("setting suspend callback");
|
||||
|
||||
window->suspend_cb = suspend_cb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the resume callback used for the given window.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param resume_cb The resume callback.
|
||||
*
|
||||
* This function sets the resume callback to use with @p window to
|
||||
* @p resume_cb. If @p window if @c NULL, this function does nothing.
|
||||
*
|
||||
* The @p resume_cb is used only in Evas and Ecore_Evas. So this
|
||||
* function should not be called if Ecore_Evas is used.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int))
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
INF("setting resume callback");
|
||||
|
||||
window->resume_cb = resume_cb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the geometry of the given window.
|
||||
*
|
||||
* @param window The window to retrieve the geometry from.
|
||||
* @param x The x coordinate of the position.
|
||||
* @param y The x coordinate of the position.
|
||||
* @param width The width.
|
||||
* @param height The height.
|
||||
*
|
||||
* This function retrieves the position and size of @p window. @p x,
|
||||
* @p y, @p width and @p height can be buffers that will be filled with
|
||||
* the corresponding values. If one of them is @c NULL, nothing will
|
||||
* be done for that parameter. If @p window is @c NULL, and if the
|
||||
* buffers are not @c NULL, they will be filled with respectively 0,
|
||||
* 0, the size of the screen and the height of the screen.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
RECT rect;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
INF("getting window geometry");
|
||||
|
||||
if (!window)
|
||||
{
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (width) *width = GetSystemMetrics(SM_CXSCREEN);
|
||||
if (height) *height = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetClientRect(window->window, &rect))
|
||||
{
|
||||
ERR("GetClientRect() failed");
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (width) *width = 0;
|
||||
if (height) *height = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
w = rect.right - rect.left;
|
||||
h = rect.bottom - rect.top;
|
||||
|
||||
if (!GetWindowRect(window->window, &rect))
|
||||
{
|
||||
ERR("GetWindowRect() failed");
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
if (width) *width = 0;
|
||||
if (height) *height = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (x) *x = rect.left;
|
||||
if (y) *y = rect.top;
|
||||
if (width) *width = w;
|
||||
if (height) *height = h;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the size of the given window.
|
||||
*
|
||||
* @param window The window to retrieve the size from.
|
||||
* @param width The width.
|
||||
* @param height The height.
|
||||
*
|
||||
* This function retrieves the size of @p window. @p width and
|
||||
* @p height can be buffers that will be filled with the corresponding
|
||||
* values. If one of them is @c NULL, nothing will be done for that
|
||||
* parameter. If @p window is @c NULL, and if the buffers are not
|
||||
* @c NULL, they will be filled with respectively the size of the screen
|
||||
* and the height of the screen.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_size_get(Ecore_WinCE_Window *window,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
INF("getting window size");
|
||||
|
||||
if (!window)
|
||||
{
|
||||
if (width) *width = GetSystemMetrics(SM_CXSCREEN);
|
||||
if (height) *height = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetClientRect(window->window, &rect))
|
||||
{
|
||||
ERR("GetClientRect() failed");
|
||||
|
||||
if (width) *width = 0;
|
||||
if (height) *height = 0;
|
||||
}
|
||||
|
||||
if (width) *width = rect.right - rect.left;
|
||||
if (height) *height = rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the given window to fullscreen.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param on @c EINA_TRUE for fullscreen mode, @c EINA_FALSE for windowed mode.
|
||||
*
|
||||
* This function set @p window to fullscreen or windowed mode. If @p on is set
|
||||
* to @c EINA_TRUE, the window will be fullscreen, if it is set to
|
||||
* @c EINA_FALSE, it will be windowed. If @p window is @c NULL or if the state
|
||||
* does not change (like setting to fullscreen while the window is already
|
||||
* fullscreen), this function does nothing.
|
||||
*/
|
||||
EAPI void
|
||||
ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
|
||||
Eina_Bool on)
|
||||
{
|
||||
HWND task_bar;
|
||||
|
||||
if (!window) return;
|
||||
|
||||
if (((window->fullscreen) && (on)) ||
|
||||
((!window->fullscreen) && (!on)))
|
||||
return;
|
||||
|
||||
INF("setting fullscreen: %s", on ? "yes" : "no");
|
||||
|
||||
window->fullscreen = !!on;
|
||||
|
||||
if (on)
|
||||
{
|
||||
/* save the position and size of the window */
|
||||
if (!GetWindowRect(window->window, &window->rect))
|
||||
{
|
||||
ERR("GetWindowRect() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* hide task bar */
|
||||
task_bar = FindWindow(L"HHTaskBar", NULL);
|
||||
if (!task_bar)
|
||||
{
|
||||
INF("FindWindow(): can not find task bar");
|
||||
}
|
||||
if (!ShowWindow(task_bar, SW_HIDE))
|
||||
{
|
||||
INF("ShowWindow(): task bar already hidden");
|
||||
}
|
||||
if (!EnableWindow(task_bar, FALSE))
|
||||
{
|
||||
INF("EnableWindow(): input already disabled");
|
||||
}
|
||||
|
||||
/* style: visible + popup */
|
||||
if (!SetWindowLong(window->window, GWL_STYLE, WS_POPUP | WS_VISIBLE))
|
||||
{
|
||||
INF("SetWindowLong() failed");
|
||||
}
|
||||
|
||||
/* resize window to fit the entire screen */
|
||||
if (!SetWindowPos(window->window, HWND_TOPMOST,
|
||||
0, 0,
|
||||
GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN),
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
|
||||
{
|
||||
INF("SetWindowPos() failed");
|
||||
}
|
||||
/*
|
||||
* It seems that SetWindowPos is not sufficient.
|
||||
* Call MoveWindow with the correct size and force painting.
|
||||
* Note that UpdateWindow (forcing repainting) is not sufficient
|
||||
*/
|
||||
if (!MoveWindow(window->window,
|
||||
0, 0,
|
||||
GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN),
|
||||
TRUE))
|
||||
{
|
||||
INF("MoveWindow() failed");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* show task bar */
|
||||
task_bar = FindWindow(L"HHTaskBar", NULL);
|
||||
if (!task_bar)
|
||||
{
|
||||
INF("FindWindow(): can not find task bar");
|
||||
}
|
||||
if (!ShowWindow(task_bar, SW_SHOW))
|
||||
{
|
||||
INF("ShowWindow(): task bar already visible");
|
||||
}
|
||||
if (!EnableWindow(task_bar, TRUE))
|
||||
{
|
||||
INF("EnableWindow(): input already enabled");
|
||||
}
|
||||
|
||||
/* style: visible + caption + sysmenu */
|
||||
if (!SetWindowLong(window->window, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE))
|
||||
{
|
||||
INF("SetWindowLong() failed");
|
||||
}
|
||||
/* restaure the position and size of the window */
|
||||
if (!SetWindowPos(window->window, HWND_TOPMOST,
|
||||
window->rect.left,
|
||||
window->rect.top,
|
||||
window->rect.right - window->rect.left,
|
||||
window->rect.bottom - window->rect.top,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
|
||||
{
|
||||
INF("SetWindowLong() failed");
|
||||
}
|
||||
/*
|
||||
* It seems that SetWindowPos is not sufficient.
|
||||
* Call MoveWindow with the correct size and force painting.
|
||||
* Note that UpdateWindow (forcing repainting) is not sufficient
|
||||
*/
|
||||
if (!MoveWindow(window->window,
|
||||
window->rect.left,
|
||||
window->rect.top,
|
||||
window->rect.right - window->rect.left,
|
||||
window->rect.bottom - window->rect.top,
|
||||
TRUE))
|
||||
{
|
||||
INF("MoveWindow() failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -1,261 +0,0 @@
|
|||
/* EINA - EFL data type library
|
||||
* Copyright (C) 2011 Vincent Torri
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library;
|
||||
* if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EINA_INLINE_LOCK_WIN32_X_
|
||||
#define EINA_INLINE_LOCK_WIN32_X_
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
EAPI extern Eina_Bool _threads_activated;
|
||||
EAPI extern Eina_Bool _eina_thread_tls_cb_register(Eina_TLS key, Eina_TLS_Delete_Cb cb);
|
||||
EAPI extern Eina_Bool _eina_thread_tls_cb_unregister(Eina_TLS key);
|
||||
EAPI extern Eina_Bool _eina_thread_tls_key_add(Eina_TLS key);
|
||||
|
||||
/** @privatesection @{ */
|
||||
typedef HANDLE Eina_Lock;
|
||||
typedef Eina_Lock Eina_Spinlock;
|
||||
typedef Eina_Lock Eina_RWLock;
|
||||
typedef DWORD Eina_TLS;
|
||||
typedef void * Eina_Semaphore;
|
||||
/** @} privatesection */
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_lock_new(Eina_Lock *mutex)
|
||||
{
|
||||
Eina_Lock m;
|
||||
|
||||
m = CreateMutex(NULL, FALSE, NULL);
|
||||
if (m) *mutex = m;
|
||||
return (m != NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
eina_lock_free(Eina_Lock *mutex)
|
||||
{
|
||||
CloseHandle(*mutex);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_lock_take(Eina_Lock *mutex)
|
||||
{
|
||||
DWORD res;
|
||||
|
||||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated) return EINA_LOCK_FAIL;
|
||||
#endif
|
||||
|
||||
res = WaitForSingleObject(*mutex, INFINITE);
|
||||
if ((res == WAIT_ABANDONED) || (res == WAIT_FAILED))
|
||||
return EINA_LOCK_FAIL;
|
||||
|
||||
return EINA_LOCK_SUCCEED;
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_lock_take_try(Eina_Lock *mutex)
|
||||
{
|
||||
return eina_lock_take(*mutex);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_lock_release(Eina_Lock *mutex)
|
||||
{
|
||||
#ifdef EINA_HAVE_ON_OFF_THREADS
|
||||
if (!_eina_threads_activated) return ;
|
||||
#endif
|
||||
|
||||
return ReleaseMutex(*mutex) ? EINA_LOCK_SUCCEED : EINA_LOCK_FAIL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
eina_lock_debug(const Eina_Lock *mutex)
|
||||
{
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
eina_condition_free(Eina_Condition *cond)
|
||||
{
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_wait(Eina_Condition *cond)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_timedwait(Eina_Condition *cond, double t)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_broadcast(Eina_Condition *cond)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_condition_signal(Eina_Condition *cond)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_rwlock_new(Eina_RWLock *mutex)
|
||||
{
|
||||
return eina_lock_new(mutex);
|
||||
}
|
||||
|
||||
static inline void
|
||||
eina_rwlock_free(Eina_RWLock *mutex)
|
||||
{
|
||||
return eina_lock_free(mutex);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_rwlock_take_read(Eina_RWLock *mutex)
|
||||
{
|
||||
return eina_lock_take(mutex);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_rwlock_take_write(Eina_RWLock *mutex)
|
||||
{
|
||||
return eina_lock_take(mutex);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_rwlock_release(Eina_RWLock *mutex)
|
||||
{
|
||||
return eina_lock_release(mutex);
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_tls_cb_new(Eina_TLS *key, Eina_TLS_Delete_Cb delete_cb)
|
||||
{
|
||||
if ((*key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
|
||||
return EINA_FALSE;
|
||||
if (delete_cb)
|
||||
{
|
||||
if (!_eina_thread_tls_cb_register(*key, delete_cb))
|
||||
{
|
||||
TlsFree(*key);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_tls_new(Eina_TLS *key)
|
||||
{
|
||||
return eina_tls_cb_new(key, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
eina_tls_free(Eina_TLS key)
|
||||
{
|
||||
_eina_thread_tls_cb_unregister(key);
|
||||
TlsFree(key);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
eina_tls_get(Eina_TLS key)
|
||||
{
|
||||
return (void*)TlsGetValue(key);
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_tls_set(Eina_TLS key, const void *data)
|
||||
{
|
||||
if (TlsSetValue(key, (LPVOID)data) == 0)
|
||||
return EINA_FALSE;
|
||||
_eina_thread_tls_key_add(key);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_semaphore_new(Eina_Semaphore *sem EINA_UNUSED,
|
||||
int count_init EINA_UNUSED)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_semaphore_free(Eina_Semaphore *sem EINA_UNUSED)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_semaphore_lock(Eina_Semaphore *sem EINA_UNUSED)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_semaphore_release(Eina_Semaphore *sem EINA_UNUSED,
|
||||
int count_release EINA_UNUSED)
|
||||
{
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_spinlock_new(Eina_Spinlock *spinlock)
|
||||
{
|
||||
return eina_lock_new(spinlock);
|
||||
}
|
||||
|
||||
static inline void
|
||||
eina_spinlock_free(Eina_Spinlock *spinlock)
|
||||
{
|
||||
eina_lock_free(spinlock);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_spinlock_take(Eina_Spinlock *spinlock)
|
||||
{
|
||||
return eina_lock_take(spinlock);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_spinlock_take_try(Eina_Spinlock *spinlock)
|
||||
{
|
||||
return eina_lock_take_try(spinlock);
|
||||
}
|
||||
|
||||
static inline Eina_Lock_Result
|
||||
eina_spinlock_release(Eina_Spinlock *spinlock)
|
||||
{
|
||||
return eina_lock_release(spinlock);
|
||||
}
|
||||
|
||||
#include "eina_inline_lock_barrier.x"
|
||||
|
||||
#endif
|
|
@ -106,9 +106,7 @@ typedef enum
|
|||
/** Type definition for deallocation callbacks for thread level sotrage data. A simple function pointer. */
|
||||
typedef void (*Eina_TLS_Delete_Cb)(void *ptr);
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# include "eina_inline_lock_wince.x"
|
||||
#elif defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
# include "eina_inline_lock_win32.x"
|
||||
#else
|
||||
# include "eina_inline_lock_posix.x"
|
||||
|
|
|
@ -427,10 +427,7 @@ eina_log_print_prefix_NOthreads_color_file_func(FILE *fp,
|
|||
int line)
|
||||
{
|
||||
DECLARE_LEVEL_NAME_COLOR(level);
|
||||
#ifdef _WIN32_WCE
|
||||
fprintf(fp, "%s<%u>:%s %s:%d %s() ", name, eina_log_pid_get(),
|
||||
d->domain_str, file, line, fnc);
|
||||
#elif _WIN32
|
||||
#ifdef _WIN32
|
||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
color);
|
||||
fprintf(fp, "%s", name);
|
||||
|
@ -468,10 +465,7 @@ eina_log_print_prefix_NOthreads_color_NOfile_func(FILE *fp,
|
|||
int line EINA_UNUSED)
|
||||
{
|
||||
DECLARE_LEVEL_NAME_COLOR(level);
|
||||
#ifdef _WIN32_WCE
|
||||
fprintf(fp, "%s<%u>:%s %s() ", name, eina_log_pid_get(), d->domain_str,
|
||||
fnc);
|
||||
#elif _WIN32
|
||||
#ifdef _WIN32
|
||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
color);
|
||||
fprintf(fp, "%s", name);
|
||||
|
@ -506,10 +500,7 @@ eina_log_print_prefix_NOthreads_color_file_NOfunc(FILE *fp,
|
|||
int line)
|
||||
{
|
||||
DECLARE_LEVEL_NAME_COLOR(level);
|
||||
#ifdef _WIN32_WCE
|
||||
fprintf(fp, "%s<%u>:%s %s:%d ", name, eina_log_pid_get(), d->domain_str,
|
||||
file, line);
|
||||
#elif _WIN32
|
||||
#ifdef _WIN32
|
||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
color);
|
||||
fprintf(fp, "%s", name);
|
||||
|
|
|
@ -117,7 +117,7 @@ static int _mt_enabled = 0;
|
|||
|
||||
#ifdef EFL_HAVE_THREADS
|
||||
EAPI int _eina_threads_debug = 0;
|
||||
# if !defined(_WIN32_WCE) && !defined(_WIN32)
|
||||
# if !defined(_WIN32)
|
||||
EAPI pthread_mutex_t _eina_tracking_lock;
|
||||
EAPI Eina_Inlist *_eina_tracking = NULL;
|
||||
# endif
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#include "evas_common_private.h"
|
||||
#include "evas_private.h"
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# undef remove
|
||||
#endif
|
||||
|
||||
#define MY_CLASS_NAME "Evas_Box"
|
||||
#define MY_CLASS_NAME_LEGACY "Evas_Object_Box"
|
||||
|
||||
|
|
|
@ -35,9 +35,7 @@ int
|
|||
evas_file_path_is_full_path(const char *path)
|
||||
{
|
||||
if (!path) return 0;
|
||||
#if defined _WIN32_WCE
|
||||
if (path[0] == '\\') return 1;
|
||||
#elif defined _WIN32
|
||||
#ifdef _WIN32
|
||||
if (evil_path_is_absolute(path)) return 1;
|
||||
#else
|
||||
if (path[0] == '/') return 1;
|
||||
|
|
|
@ -137,12 +137,6 @@ typedef SSIZE_T ssize_t;
|
|||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# ifndef offsetof
|
||||
# define offsetof(type, ident) ((size_t)&(((type*)0)->ident))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef unsigned long uid_t;
|
||||
typedef unsigned long gid_t;
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__MINGW32CE__) || defined(_MSC_VER)
|
||||
#ifdef _MSC_VER
|
||||
# include <limits.h>
|
||||
#endif /* __MINGW32CE__ || _MSC_VER */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
|
@ -14,11 +14,7 @@
|
|||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# include <tlhelp32.h> /* CreateToolhelp32Snapshot */
|
||||
#else
|
||||
#include <psapi.h> /* EnumProcessModules(Ex) */
|
||||
#endif
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_private.h"
|
||||
|
@ -141,26 +137,6 @@ dlsym(void *handle, const char *symbol)
|
|||
|
||||
if (handle == RTLD_DEFAULT)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
HANDLE snapshot;
|
||||
MODULEENTRY32 module;
|
||||
|
||||
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS |
|
||||
TH32CS_SNAPMODULE |
|
||||
TH32CS_GETALLMODS,
|
||||
0);
|
||||
if (!snapshot)
|
||||
return NULL;
|
||||
|
||||
module.dwSize = sizeof(module);
|
||||
if (Module32First(snapshot, &module))
|
||||
do {
|
||||
fp = GetProcAddress(module.hModule, new_symbol);
|
||||
if (fp) break;
|
||||
} while (Module32Next(snapshot, &module));
|
||||
|
||||
CloseToolhelp32Snapshot(snapshot);
|
||||
#else
|
||||
HMODULE modules[1024];
|
||||
DWORD needed;
|
||||
DWORD i;
|
||||
|
@ -175,7 +151,6 @@ dlsym(void *handle, const char *symbol)
|
|||
fp = GetProcAddress(modules[i], new_symbol);
|
||||
if (fp) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
fp = GetProcAddress(handle, new_symbol);
|
||||
|
@ -202,7 +177,6 @@ dladdr (const void *addr EVIL_UNUSED, Dl_info *info)
|
|||
if (!info)
|
||||
return 0;
|
||||
|
||||
#ifdef _WIN32_WINNT
|
||||
length = VirtualQuery(addr, &mbi, sizeof(mbi));
|
||||
if (!length)
|
||||
return 0;
|
||||
|
@ -216,11 +190,6 @@ dladdr (const void *addr EVIL_UNUSED, Dl_info *info)
|
|||
ret = GetModuleFileName((HMODULE)mbi.AllocationBase, (LPTSTR)&tpath, PATH_MAX);
|
||||
if (!ret)
|
||||
return 0;
|
||||
#else
|
||||
ret = GetModuleFileName(NULL, (LPTSTR)&tpath, PATH_MAX);
|
||||
if (!ret)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
path = evil_wchar_to_char(tpath);
|
||||
|
|
|
@ -26,12 +26,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# ifndef PATH_MAX
|
||||
# define PATH_MAX 260
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @file dlfcn.h
|
||||
|
@ -39,7 +33,7 @@ extern "C" {
|
|||
* @defgroup Evil_Dlfcn Functions that manage dynamic-link libraries.
|
||||
* @ingroup Evil
|
||||
*
|
||||
* This header provides functions to load and unload dynamic-link
|
||||
x * This header provides functions to load and unload dynamic-link
|
||||
* libaries, to get the address of a symbol, and to get diagnostic
|
||||
* information.
|
||||
*/
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Evil.h"
|
||||
#include "mingw32ce/errno.h"
|
||||
|
||||
|
||||
int errno = 0;
|
|
@ -15,11 +15,6 @@
|
|||
#include "Evil.h"
|
||||
|
||||
|
||||
#ifdef __MINGW32CE__
|
||||
# define _get_osfhandle(FILEDES) ((HANDLE)FILEDES)
|
||||
#endif /* __MINGW32CE__ */
|
||||
|
||||
|
||||
/*
|
||||
* port of fcntl function
|
||||
*
|
||||
|
@ -39,14 +34,12 @@ int fcntl(int fd, int cmd, ...)
|
|||
|
||||
if (cmd == F_GETFD)
|
||||
{
|
||||
#ifndef __MINGW32CE__
|
||||
DWORD flag;
|
||||
|
||||
if (!GetHandleInformation(h, &flag))
|
||||
return -1;
|
||||
|
||||
res = 0;
|
||||
#endif /* ! __MINGW32CE__ */
|
||||
}
|
||||
|
||||
if (cmd == F_SETFD)
|
||||
|
@ -56,10 +49,8 @@ int fcntl(int fd, int cmd, ...)
|
|||
flag = va_arg(va, long);
|
||||
if (flag == FD_CLOEXEC)
|
||||
{
|
||||
#ifndef __MINGW32CE__
|
||||
if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0))
|
||||
res = 0;
|
||||
#endif /* ! __MINGW32CE__ */
|
||||
}
|
||||
}
|
||||
else if (cmd == F_GETFL)
|
||||
|
@ -87,7 +78,6 @@ int fcntl(int fd, int cmd, ...)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifndef __MINGW32CE__
|
||||
else if ((cmd == F_SETLK) || (cmd == F_SETLKW))
|
||||
{
|
||||
struct flock *fl;
|
||||
|
@ -120,8 +110,6 @@ int fcntl(int fd, int cmd, ...)
|
|||
res = _locking(fd, _LK_UNLCK, fl->l_len);
|
||||
}
|
||||
|
||||
#endif /* ! __MINGW32CE__ */
|
||||
|
||||
va_end(va);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#include "Evil.h"
|
||||
|
||||
|
||||
#ifndef __MINGW32CE__
|
||||
|
||||
static char *
|
||||
replace(char *prev, char *value)
|
||||
{
|
||||
|
@ -49,5 +47,3 @@ nl_langinfo(nl_item index)
|
|||
|
||||
return nothing;
|
||||
}
|
||||
|
||||
#endif /* ! __MINGW32CE__ */
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#define __EVIL_LANGINFO_H__
|
||||
|
||||
|
||||
#ifndef __MINGW32CE__
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
|
||||
|
@ -35,7 +33,5 @@ enum {
|
|||
|
||||
EAPI char *nl_langinfo(nl_item index);
|
||||
|
||||
#endif /* __MINGW32CE__ */
|
||||
|
||||
|
||||
#endif /*__EVIL_LANGINFO_H__ */
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Symbolic links and directory related functions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* REMARK: Windows has no symbolic link. */
|
||||
/* Nevertheless, it can create and read .lnk files */
|
||||
|
||||
int
|
||||
symlink(const char *oldpath, const char *newpath)
|
||||
{
|
||||
wchar_t *w_oldpath;
|
||||
wchar_t *w_newpath;
|
||||
BOOL res;
|
||||
|
||||
w_oldpath = evil_char_to_wchar(oldpath);
|
||||
if (!w_oldpath)
|
||||
return -1;
|
||||
|
||||
w_newpath = evil_char_to_wchar(newpath);
|
||||
if (!w_newpath)
|
||||
{
|
||||
free(w_oldpath);
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = SHCreateShortcut(w_newpath, w_oldpath);
|
||||
if (!res)
|
||||
_evil_last_error_display(__FUNCTION__);
|
||||
|
||||
free(w_oldpath);
|
||||
free(w_newpath);
|
||||
|
||||
return res ? 0 : -1;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
readlink(const char *path, char *buf, size_t bufsiz)
|
||||
{
|
||||
wchar_t *w_path;
|
||||
wchar_t w_newpath[1024];
|
||||
char *newpath;
|
||||
size_t length;
|
||||
BOOL res;
|
||||
|
||||
w_path = evil_char_to_wchar(path);
|
||||
if (!w_path)
|
||||
return -1;
|
||||
|
||||
res = SHGetShortcutTarget(w_path, w_newpath, 1024);
|
||||
if (!res)
|
||||
_evil_last_error_display(__FUNCTION__);
|
||||
|
||||
free(w_path);
|
||||
|
||||
if (!res)
|
||||
return -1;
|
||||
|
||||
newpath = evil_wchar_to_char(w_newpath);
|
||||
if (!newpath)
|
||||
return -1;
|
||||
|
||||
/* That stupid SHGetShortcutTarget add " around the file name... */
|
||||
length = strlen(newpath) - 2;
|
||||
if (length > bufsiz)
|
||||
length = bufsiz;
|
||||
|
||||
memcpy(buf, newpath + 1, length);
|
||||
|
||||
free(newpath);
|
||||
|
||||
return length;
|
||||
}
|
|
@ -23,10 +23,6 @@
|
|||
#include "evil_util.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
#ifdef __MINGW32CE__
|
||||
# define _get_osfhandle(FILEDES) ((long)FILEDES)
|
||||
#endif /* __MINGW32CE__ */
|
||||
|
||||
|
||||
/***** API *****/
|
||||
|
||||
|
@ -38,54 +34,6 @@ mmap(void *addr EVIL_UNUSED,
|
|||
int flags,
|
||||
int fd,
|
||||
off_t offset)
|
||||
{
|
||||
OSVERSIONINFO os_version;
|
||||
|
||||
os_version.dwOSVersionInfoSize = sizeof(os_version);
|
||||
if (!GetVersionEx(&os_version))
|
||||
{
|
||||
char *str;
|
||||
|
||||
str = evil_last_error_get();
|
||||
fprintf(stderr, "[Evil] [mmap] GetVersionEx failed: %s\n", str);
|
||||
free(str);
|
||||
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_CE) &&
|
||||
(os_version.dwMajorVersion < 5))
|
||||
{
|
||||
void *data;
|
||||
size_t size;
|
||||
|
||||
data = malloc(len);
|
||||
if (!data)
|
||||
{
|
||||
fprintf (stderr, "[Evil] [mmap] malloc failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
size = read(fd, data, len);
|
||||
if (size != len)
|
||||
{
|
||||
fprintf (stderr, "[Evil] [mmap] read failed\n");
|
||||
free(data);
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
if (lseek(fd, 0, SEEK_SET) == -1)
|
||||
{
|
||||
fprintf (stderr, "[Evil] [mmap] lseek failed\n");
|
||||
free(data);
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
else
|
||||
#endif /* ! _WIN32_WCE */
|
||||
{
|
||||
HANDLE fm;
|
||||
DWORD protect = PAGE_NOACCESS;
|
||||
|
@ -183,37 +131,10 @@ mmap(void *addr EVIL_UNUSED,
|
|||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
munmap(void *addr,
|
||||
size_t len EVIL_UNUSED)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
OSVERSIONINFO os_version;
|
||||
|
||||
os_version.dwOSVersionInfoSize = sizeof(os_version);
|
||||
if (!GetVersionEx(&os_version))
|
||||
{
|
||||
char *str;
|
||||
|
||||
str = evil_last_error_get();
|
||||
fprintf(stderr, "[Evil] [munmap] GetVersionEx failed: %s\n", str);
|
||||
free(str);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_CE) &&
|
||||
(os_version.dwMajorVersion < 5))
|
||||
{
|
||||
if (addr && (addr != MAP_FAILED))
|
||||
free(addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
#endif /* ! _WIN32_WCE */
|
||||
{
|
||||
BOOL res;
|
||||
|
||||
|
@ -229,4 +150,3 @@ munmap(void *addr,
|
|||
|
||||
return (res == 0) ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,201 +5,8 @@
|
|||
#include "Evil.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
#undef fopen
|
||||
#undef rename
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/*
|
||||
* Error related functions
|
||||
*
|
||||
*/
|
||||
|
||||
void evil_perror (const char *s EVIL_UNUSED)
|
||||
{
|
||||
fprintf(stderr, "[Windows CE] error\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Stream related functions
|
||||
*
|
||||
*/
|
||||
|
||||
FILE *evil_fopen(const char *path, const char *mode)
|
||||
{
|
||||
FILE *f;
|
||||
char *filename;
|
||||
|
||||
if (!path || !*path)
|
||||
return NULL;
|
||||
|
||||
if ((*path != '\\') && (*path != '/'))
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int l1;
|
||||
int l2;
|
||||
|
||||
if (!evil_getcwd(buf, PATH_MAX))
|
||||
return NULL;
|
||||
|
||||
l1 = strlen(buf);
|
||||
l2 = strlen(path);
|
||||
filename = (char *)malloc(l1 + 1 + l2 + 1);
|
||||
if (!filename)
|
||||
return NULL;
|
||||
memcpy(filename, buf, l1);
|
||||
filename[l1] = '\\';
|
||||
memcpy(filename + l1 + 1, path, l2);
|
||||
filename[l1 + 1 + l2] = '\0';
|
||||
}
|
||||
else
|
||||
filename = _strdup(path);
|
||||
|
||||
EVIL_PATH_SEP_UNIX_TO_WIN32(filename);
|
||||
|
||||
printf ("fopen : %s\n", filename);
|
||||
|
||||
f = fopen(filename, mode);
|
||||
free(filename);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
void evil_rewind(FILE *stream)
|
||||
{
|
||||
fseek(stream, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
int evil_remove(const char *path)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path, &st) < 0) return -1;
|
||||
|
||||
if (S_ISDIR(st.st_mode))
|
||||
{
|
||||
if (rmdir(path) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S_ISREG(st.st_mode))
|
||||
{
|
||||
if (unlink(path) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
FILE *evil_fopen_native(const char *path, const char *mode)
|
||||
{
|
||||
HANDLE handle;
|
||||
char *filename;
|
||||
wchar_t *wfilename;
|
||||
DWORD acs = GENERIC_READ;
|
||||
DWORD creation;
|
||||
|
||||
if (!path || !*path || !mode || !*mode)
|
||||
return NULL;
|
||||
|
||||
if ((*path != '\\') && (*path != '/'))
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int l1;
|
||||
int l2;
|
||||
|
||||
if (!evil_getcwd(buf, PATH_MAX))
|
||||
return NULL;
|
||||
|
||||
l1 = strlen(buf);
|
||||
l2 = strlen(path);
|
||||
filename = (char *)malloc(l1 + 1 + l2 + 1);
|
||||
if (!filename)
|
||||
return NULL;
|
||||
memcpy(filename, buf, l1);
|
||||
filename[l1] = '\\';
|
||||
memcpy(filename + l1 + 1, path, l2);
|
||||
filename[l1 + 1 + l2] = '\0';
|
||||
}
|
||||
else
|
||||
filename = _strdup(path);
|
||||
|
||||
EVIL_PATH_SEP_UNIX_TO_WIN32(filename);
|
||||
printf ("fopen native : %s\n", filename);
|
||||
|
||||
wfilename = evil_char_to_wchar(filename);
|
||||
free(filename);
|
||||
|
||||
if (!wfilename)
|
||||
return NULL;
|
||||
|
||||
if (*mode == 'r')
|
||||
{
|
||||
acs = GENERIC_READ;
|
||||
creation = OPEN_EXISTING;
|
||||
}
|
||||
if (*mode == 'w')
|
||||
{
|
||||
acs = GENERIC_WRITE;
|
||||
creation = CREATE_ALWAYS;
|
||||
}
|
||||
|
||||
handle = CreateFile(wfilename,
|
||||
acs,
|
||||
0, NULL,
|
||||
creation,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
free(wfilename);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
_evil_last_error_display(__FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (FILE *)handle;
|
||||
}
|
||||
|
||||
size_t evil_fread_native(void* buffer, size_t size, size_t count, FILE* stream)
|
||||
{
|
||||
HANDLE handle;
|
||||
DWORD bytes_read;
|
||||
BOOL res;
|
||||
|
||||
if ((size == 0) || (count == 0))
|
||||
return 0;
|
||||
|
||||
handle = (HANDLE)stream;
|
||||
res = ReadFile(handle, buffer, size * count, &bytes_read, NULL);
|
||||
if (!res)
|
||||
{
|
||||
_evil_last_error_display(__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (bytes_read != size * count) ? 0 : bytes_read;
|
||||
}
|
||||
|
||||
int evil_fclose_native(FILE *stream)
|
||||
{
|
||||
if (!CloseHandle((HANDLE)stream))
|
||||
{
|
||||
_evil_last_error_display(__FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
int
|
||||
evil_rename(const char *src, const char* dst)
|
||||
{
|
||||
|
|
|
@ -28,180 +28,6 @@
|
|||
#define EVIL_PATH_SEP_WIN32_TO_UNIX(p) EVIL_PATH_SEP_SWAP(p, '\\', '/')
|
||||
#define EVIL_PATH_SEP_UNIX_TO_WIN32(p) EVIL_PATH_SEP_SWAP(p, '/', '\\')
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/*
|
||||
* Error related functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Print the given string to stderr.
|
||||
*
|
||||
* @param s The string to print.
|
||||
*
|
||||
* This function just printf the string @p s to stderr.
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI void evil_perror (const char *s);
|
||||
|
||||
/**
|
||||
* @def perror(s)
|
||||
*
|
||||
* Wrapper around evil_perror().
|
||||
*/
|
||||
# define perror(s) evil_perror(s)
|
||||
|
||||
/*
|
||||
* Stream related functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Emulate the fopen() function on Windows CE.
|
||||
*
|
||||
* @param path The file to open.
|
||||
* @param mode The mode.
|
||||
* @return A FILE pointer on success, @c NULL otherwise.
|
||||
*
|
||||
* This function emulates the fopen() function on Windows CE using the
|
||||
* Windows libc. The main problem is that the filesytem on Windows CE
|
||||
* is like on Sys V : the top level directory is beginning by '/' or
|
||||
* '\' and the full path must be calculated.. This function takes care
|
||||
* of this feature, and replace all the '/' by '/'. Otherwise, it
|
||||
* calls the Windows CE fopen() function once the filename has been
|
||||
* correctly set. If @p path is @c NULL or empty, this function
|
||||
* returns @c NULL. On success, this function returns a FILE stream,
|
||||
* @c NULL otherwise.
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI FILE *evil_fopen(const char *path, const char *mode);
|
||||
|
||||
/**
|
||||
* @def fopen(path, mode)
|
||||
*
|
||||
* Wrapper around evil_fopen().
|
||||
*/
|
||||
# define fopen(path, mode) evil_fopen(path, mode)
|
||||
|
||||
/**
|
||||
* @brief Emulate the rewind() function on Windows CE.
|
||||
*
|
||||
* @param stream The FILE stream.
|
||||
*
|
||||
* This function emulates the rewind() function on Windows CE by just
|
||||
* calling fseek().
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI void evil_rewind(FILE *stream);
|
||||
|
||||
/**
|
||||
* @def rewind(f)
|
||||
*
|
||||
* Wrapper around evil_rewind().
|
||||
*/
|
||||
# define rewind(f) evil_rewind(f)
|
||||
|
||||
/**
|
||||
* @brief Emulate the remove() function on Windows CE.
|
||||
*
|
||||
* @param path The path to remove.
|
||||
* @return 0 on success, -1 otherwise.
|
||||
*
|
||||
* This function emulates the remove() function on Windows CE. If
|
||||
* @p path is an empty directory, it removes it. If @p path is a file,
|
||||
* it deletes it. On success, 0 is returns, -1 otherwise.
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI int evil_remove(const char *path);
|
||||
|
||||
/**
|
||||
* @def remove(p)
|
||||
*
|
||||
* Wrapper around evil_remove().
|
||||
*/
|
||||
# define remove(p) evil_remove(p)
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/**
|
||||
* @brief Emulate the fopen() function on Windows CE using Windows API.
|
||||
*
|
||||
* @param path The file to open.
|
||||
* @param mode The mode.
|
||||
* @return A FILE pointer on success, @c NULL otherwise.
|
||||
*
|
||||
* This function emulates the fopen() function on Windows CE using the
|
||||
* Windows API and not the libc. It is similar to evil_fopen().
|
||||
*
|
||||
* @see evil_fopen()
|
||||
* @see evil_fread_native()
|
||||
* @see evil_fclose_native()
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI FILE *evil_fopen_native(const char *path, const char *mode);
|
||||
|
||||
/**
|
||||
* @brief Read the given stream on Windows CE using Windows API.
|
||||
*
|
||||
* @param buffer The buffer to store the data.
|
||||
* @param size The size of each element of data to read.
|
||||
* @param count The number of elements of data to read.
|
||||
* @param stream The stream to read.
|
||||
* @return The size read on success, 0 otherwise.
|
||||
*
|
||||
* This function read @p stream using the Windows API. It reads
|
||||
* @p size elements of data, each @ size bytes long. The data is
|
||||
* stored in the buffer @p buffer. On success, the size read is
|
||||
* returned, 0 otherwise.
|
||||
*
|
||||
* @see evil_fopen_native()
|
||||
* @see evil_fclose_native()
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI size_t evil_fread_native(void* buffer, size_t size, size_t count, FILE* stream);
|
||||
|
||||
/**
|
||||
* @brief Close the given stream on Windows CE using Windows API.
|
||||
*
|
||||
* @param stream The stream to close.
|
||||
* @return 0 on success, -1 otherwise.
|
||||
*
|
||||
* This function closes @p stream using the Windows API. On success, 0
|
||||
* is returned, -1 otherwise.
|
||||
*
|
||||
* @see evil_fopen_native()
|
||||
* @see evil_fread_native()
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI int evil_fclose_native(FILE *stream);
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Emulate the rename() function on Windows.
|
||||
|
|
|
@ -24,115 +24,16 @@
|
|||
/*
|
||||
* Environment variable related functions
|
||||
*
|
||||
* char *getenv (const char *name);
|
||||
* int putenv (const char *string);
|
||||
* int setenv (const char *name, const char *value, int overwrite);
|
||||
* void unsetenv (const char *name);
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
static char _evil_stdlib_getenv_buffer[PATH_MAX];
|
||||
|
||||
char *
|
||||
getenv(const char *name)
|
||||
{
|
||||
HKEY key;
|
||||
wchar_t *wname;
|
||||
LONG res;
|
||||
DWORD type;
|
||||
DWORD disposition;
|
||||
DWORD size = PATH_MAX;
|
||||
|
||||
if (!name || !*name)
|
||||
return NULL;
|
||||
|
||||
if ((res = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
||||
TEXT("Software\\Efl\\Environment"),
|
||||
0, NULL,
|
||||
REG_OPTION_VOLATILE,
|
||||
0, NULL,
|
||||
&key, &disposition)) != ERROR_SUCCESS)
|
||||
{
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wname = evil_char_to_wchar(name);
|
||||
if (!wname)
|
||||
{
|
||||
if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((res = RegQueryValueEx(key, wname,
|
||||
NULL, &type,
|
||||
(LPBYTE)&_evil_stdlib_getenv_buffer,
|
||||
&size)) != ERROR_SUCCESS)
|
||||
{
|
||||
if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
free(wname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free(wname);
|
||||
|
||||
if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
|
||||
{
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (_evil_stdlib_getenv_buffer[0] == '\0')
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
return _evil_stdlib_getenv_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
#ifdef __MINGW32CE__
|
||||
|
||||
int
|
||||
putenv(const char *string)
|
||||
{
|
||||
char *str;
|
||||
char *egal;
|
||||
char *name;
|
||||
char *value;
|
||||
|
||||
str = strdup(string);
|
||||
if (!str)
|
||||
return -1;
|
||||
egal = strchr(str, '=');
|
||||
if (!egal)
|
||||
return -1;
|
||||
|
||||
value = egal + 1;
|
||||
*egal = '\0';
|
||||
name = str;
|
||||
setenv(name, value, 1);
|
||||
free(str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __MINGW32CE__ */
|
||||
|
||||
|
||||
|
||||
int
|
||||
setenv(const char *name,
|
||||
const char *value,
|
||||
int overwrite)
|
||||
{
|
||||
#ifndef __MINGW32CE__
|
||||
|
||||
char *old_name;
|
||||
char *str;
|
||||
size_t length;
|
||||
|
@ -169,92 +70,6 @@ setenv(const char *name,
|
|||
free(str);
|
||||
|
||||
return res;
|
||||
|
||||
#else /* __MINGW32CE__ */
|
||||
|
||||
HKEY key;
|
||||
LONG res;
|
||||
DWORD disposition;
|
||||
wchar_t *wname;
|
||||
char *data;
|
||||
DWORD size;
|
||||
|
||||
if (!name || !*name)
|
||||
return -1;
|
||||
|
||||
/* if '=' is found, return an error */
|
||||
if (strchr (name, '='))
|
||||
return -1;
|
||||
|
||||
if ((res = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
|
||||
TEXT("Software\\Efl\\Environment"),
|
||||
0, NULL,
|
||||
REG_OPTION_VOLATILE,
|
||||
0, NULL,
|
||||
&key,
|
||||
&disposition)) != ERROR_SUCCESS)
|
||||
{
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* if name is already set and overwrite is 0, we exit with success */
|
||||
if (!overwrite && (disposition == REG_OPENED_EXISTING_KEY))
|
||||
return 0;
|
||||
|
||||
wname = evil_char_to_wchar(name);
|
||||
if (!wname)
|
||||
{
|
||||
if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (value)
|
||||
{
|
||||
size = strlen(value);
|
||||
data = malloc(sizeof(char) * (size + 1));
|
||||
if (!data)
|
||||
return -1;
|
||||
memcpy((void *)data, value, size);
|
||||
data[size] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 0;
|
||||
data = malloc(sizeof(char));
|
||||
if (!data)
|
||||
return -1;
|
||||
data[0] = '\0';
|
||||
}
|
||||
if (!data)
|
||||
return -1;
|
||||
|
||||
if ((res = RegSetValueEx(key,
|
||||
(LPCWSTR)wname,
|
||||
0, REG_SZ,
|
||||
(const BYTE *)data,
|
||||
size + 1)) != ERROR_SUCCESS)
|
||||
{
|
||||
free(wname);
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(data);
|
||||
free(wname);
|
||||
|
||||
if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
|
||||
{
|
||||
_evil_error_display(__FUNCTION__, res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
#endif /* ! __MINGW32CE__ */
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -370,26 +185,7 @@ mkstemps(char *__template, int suffixlen)
|
|||
|
||||
val = _mkstemp(suffix, val);
|
||||
|
||||
#ifndef __MINGW32CE__
|
||||
fd = _open(__template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
|
||||
#else /* ! __MINGW32CE__ */
|
||||
{
|
||||
FILE *f;
|
||||
wchar_t *wtemplate;
|
||||
|
||||
wtemplate = evil_char_to_wchar(__template);
|
||||
if (!wtemplate)
|
||||
return -1;
|
||||
f = _wfopen(wtemplate, L"rwb");
|
||||
free(wtemplate);
|
||||
if (!f)
|
||||
{
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
fd = (int)_fileno(f);
|
||||
}
|
||||
#endif /* __MINGW32CE__ */
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
}
|
||||
|
@ -407,7 +203,6 @@ mkstemp(char *__template)
|
|||
char *
|
||||
realpath(const char *file_name, char *resolved_name)
|
||||
{
|
||||
#ifndef __MINGW32CE__
|
||||
char *retname = NULL; /* we will return this, if we fail */
|
||||
|
||||
/* SUSv3 says we must set `errno = EINVAL', and return NULL,
|
||||
|
@ -471,29 +266,4 @@ realpath(const char *file_name, char *resolved_name)
|
|||
*/
|
||||
|
||||
return retname;
|
||||
#else
|
||||
char cwd[PATH_MAX];
|
||||
size_t l1;
|
||||
size_t l2;
|
||||
size_t l;
|
||||
|
||||
if (!file_name || !resolved_name)
|
||||
return NULL;
|
||||
|
||||
if (!getcwd(cwd, PATH_MAX))
|
||||
return NULL;
|
||||
|
||||
l1 = strlen(cwd);
|
||||
l2 = strlen(file_name);
|
||||
l = l1 + l2 + 2;
|
||||
|
||||
if (l > PATH_MAX)
|
||||
l = PATH_MAX - 1;
|
||||
memcpy(resolved_name, cwd, l1);
|
||||
resolved_name[l1] = '\\';
|
||||
memcpy(resolved_name + l1 + 1, file_name, l2);
|
||||
resolved_name[l] = '\0';
|
||||
|
||||
return resolved_name;
|
||||
#endif /* __MINGW32CE__ */
|
||||
}
|
||||
|
|
|
@ -19,60 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/**
|
||||
* @brief Retrieve the value of environment variables.
|
||||
*
|
||||
* @param name The name of the environment variable.
|
||||
* @return The value of the environment variable.
|
||||
*
|
||||
* This function searches the environment variable @p name if it
|
||||
* exists and return a pointer to the value of the environment
|
||||
* variable. If the specified environment variable cannot be found,
|
||||
* @c NULL is returned.
|
||||
*
|
||||
* The returned value may be overwritten by a subsequent call to
|
||||
* getenv(), setenv(), or unsetenv().
|
||||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*
|
||||
* @note On Windows CE, there is no environment variable. This is
|
||||
* faked by storing a value in a key in the base registry.
|
||||
*/
|
||||
EAPI char *getenv(const char *name);
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
#ifdef __MINGW32CE__
|
||||
|
||||
/**
|
||||
* @brief Set the value of environment variables.
|
||||
*
|
||||
* @param string A formatted string.
|
||||
* @return 0 in success, non-zero otherwise.
|
||||
*
|
||||
* This function uses @p string to set environment variable values.
|
||||
* @p string should point to a string of the form "name=value". This
|
||||
* function makes the value of the environment variable name equal to
|
||||
* value by altering an existing variable or creating a new one. In
|
||||
* either case, the string pointed to by @p string becomes part of the
|
||||
* environment, so altering @p string shall change the environment.
|
||||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*
|
||||
* @note On Windows CE, there is no environment variable. This is
|
||||
* faked by storing a value in a key in the base registry.
|
||||
*/
|
||||
EAPI int putenv(const char *string);
|
||||
|
||||
#endif /* __MINGW32CE__ */
|
||||
|
||||
/**
|
||||
* @brief Create, modify, or remove environment variables.
|
||||
*
|
||||
|
@ -92,10 +38,7 @@ EAPI int putenv(const char *string);
|
|||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
*
|
||||
* @note On Windows CE, there is no environment variable. This is
|
||||
* faked by storing a value in a key in the base registry.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int setenv(const char *name,
|
||||
const char *value,
|
||||
|
@ -114,10 +57,7 @@ EAPI int setenv(const char *name,
|
|||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE (not cegcc).
|
||||
*
|
||||
* @note On Windows CE, there is no environment variable. This is
|
||||
* faked by storing a value in a key in the base registry.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int unsetenv(const char *name);
|
||||
|
||||
|
@ -155,7 +95,7 @@ EAPI int unsetenv(const char *name);
|
|||
*
|
||||
* Conformity: Should follow BSD conformity.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int mkstemp(char *__template);
|
||||
|
||||
|
@ -204,7 +144,7 @@ EAPI int mkstemps(char *__template, int suffixlen);
|
|||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI char *realpath(const char *file_name, char *resolved_name);
|
||||
|
||||
|
|
|
@ -6,21 +6,6 @@
|
|||
#include "evil_private.h"
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/*
|
||||
* Error related functions
|
||||
*
|
||||
*/
|
||||
|
||||
char *strerror (int errnum EVIL_UNUSED)
|
||||
{
|
||||
return "[Windows CE] error\n";
|
||||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
/*
|
||||
* bit related functions
|
||||
*
|
||||
|
@ -42,37 +27,6 @@ int ffs(int i)
|
|||
return x;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/*
|
||||
* String manipulation related functions
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
strcoll (const char *s1, const char *s2)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
wchar_t *ws1;
|
||||
wchar_t *ws2;
|
||||
int res;
|
||||
|
||||
ws1 = evil_char_to_wchar(s1);
|
||||
ws2 = evil_char_to_wchar(s2);
|
||||
res = wcscmp(ws1, ws2);
|
||||
if (ws1) free(ws1);
|
||||
if (ws2) free(ws2);
|
||||
|
||||
return res;
|
||||
#else
|
||||
return strcmp(s1, s2);
|
||||
#endif /* ! UNICODE */
|
||||
}
|
||||
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
char *
|
||||
strrstr (const char *str, const char *substr)
|
||||
{
|
||||
|
|
|
@ -14,30 +14,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/*
|
||||
* Environment variable related functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return the static string "[Windows CE] error\n".
|
||||
*
|
||||
* @param errnum Unused parameter.
|
||||
* @return The static string "[Windows CE] error\n".
|
||||
*
|
||||
* This function just returns the static string "[Windows CE]
|
||||
* error\n".
|
||||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows CE (not cegcc).
|
||||
*/
|
||||
EAPI char *strerror (int errnum);
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
/*
|
||||
* bit related functions
|
||||
*
|
||||
|
@ -57,36 +33,11 @@ EAPI char *strerror (int errnum);
|
|||
*
|
||||
* Conformity: BSD
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE (not cegcc).
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int ffs(int i);
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/*
|
||||
* String manipulation related functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Compare two strings.
|
||||
*
|
||||
* @param s1 The first string to compare.
|
||||
* @param s2 The second string to compare.
|
||||
* @return < 0 if s1 < s2, >0 if s1 > s2, 0 otherwise.
|
||||
*
|
||||
* This function is exactly the same as strcmp(). No possible way to
|
||||
* achieve the behavior of strcoll() on Windows CE.
|
||||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI int strcoll (const char *s1, const char *s2);
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
/**
|
||||
* @brief Get the last substring occurence.
|
||||
*
|
||||
|
@ -100,7 +51,7 @@ EAPI int strcoll (const char *s1, const char *s2);
|
|||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI char *strrstr (const char *str, const char *substr);
|
||||
|
||||
|
@ -140,7 +91,7 @@ EAPI int strcasecmp(const char *s1, const char *s2);
|
|||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI char *strcasestr(const char *haystack, const char *needle);
|
||||
|
||||
|
|
|
@ -33,13 +33,3 @@ localtime_r(const time_t *timep, struct tm *result)
|
|||
}
|
||||
|
||||
#endif /* localtime_r */
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
void
|
||||
tzset(void)
|
||||
{
|
||||
/* does nothing... */
|
||||
}
|
||||
|
||||
#endif /* UNDER_CE */
|
||||
|
|
|
@ -38,21 +38,6 @@ EAPI struct tm *localtime_r(const time_t *timep, struct tm *result);
|
|||
|
||||
#endif /* localtime_r */
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
/**
|
||||
* @brief Stub implementation of tzset().
|
||||
*
|
||||
* This function does nothing.
|
||||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows CE.
|
||||
*/
|
||||
EAPI void tzset(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -85,7 +85,6 @@ evil_usleep(unsigned long usec)
|
|||
Sleep(usec / 1000);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -93,7 +92,6 @@ evil_usleep(unsigned long usec)
|
|||
*
|
||||
*/
|
||||
|
||||
#if defined (_MSC_VER) || defined (_WIN32_WCE)
|
||||
pid_t
|
||||
getpid(void)
|
||||
{
|
||||
|
@ -109,181 +107,9 @@ getpid(void)
|
|||
char *
|
||||
evil_getcwd(char *buffer, size_t size)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
wchar_t wpath[PATH_MAX];
|
||||
char *cpath;
|
||||
char *delim;
|
||||
DWORD ret = 0;
|
||||
|
||||
if (size <= 0)
|
||||
return NULL;
|
||||
|
||||
ret = GetModuleFileName(GetModuleHandle(NULL), (LPWSTR)&wpath, PATH_MAX);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
_evil_error_display(__FUNCTION__, ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cpath = evil_wchar_to_char(wpath);
|
||||
if (!cpath)
|
||||
return NULL;
|
||||
|
||||
if (strlen(cpath) >= (size - 1))
|
||||
{
|
||||
free(cpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
delim = strrchr(cpath, '\\');
|
||||
if (delim)
|
||||
*delim = '\0';
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
buffer = (char *)malloc(sizeof(char) * size);
|
||||
if (!buffer)
|
||||
{
|
||||
free(cpath);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(buffer, cpath);
|
||||
free(cpath);
|
||||
|
||||
return buffer;
|
||||
#else
|
||||
return _getcwd(buffer, (int)size);
|
||||
#endif /* ! _WIN32_WCE */
|
||||
}
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
int
|
||||
evil_stat(const char *file_name, struct stat *st)
|
||||
{
|
||||
SYSTEMTIME system_time;
|
||||
FILETIME local_time;
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE handle;
|
||||
char *f;
|
||||
wchar_t *file;
|
||||
int permission = 0;
|
||||
|
||||
if (!file_name || !*file_name)
|
||||
return -1;
|
||||
|
||||
f = strdup(file_name);
|
||||
if (!f)
|
||||
return -1;
|
||||
|
||||
EVIL_PATH_SEP_UNIX_TO_WIN32(f);
|
||||
|
||||
if (!strcmp(file_name, "\\"))
|
||||
{
|
||||
st->st_size = 1024;
|
||||
st->st_mode = S_IFDIR;
|
||||
permission = S_IREAD|S_IWRITE|S_IEXEC;
|
||||
|
||||
st->st_mode |= permission | (permission >> 3) | (permission >> 6);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*f != '\\')
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int l1;
|
||||
int l2;
|
||||
|
||||
evil_getcwd(buf, PATH_MAX);
|
||||
l1 = strlen(buf);
|
||||
l2 = strlen(file_name);
|
||||
tmp = (char *)malloc(l1 + 1 + l2 + 1);
|
||||
if (!tmp)
|
||||
return -1;
|
||||
memcpy(tmp, buf, l1);
|
||||
tmp[l1] = '\\';
|
||||
memcpy(tmp + l1 + 1, file_name, l2);
|
||||
tmp[l1 + 1 + l2] = '\0';
|
||||
file = evil_char_to_wchar(tmp);
|
||||
free(tmp);
|
||||
if (!file)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
file = evil_char_to_wchar(f);
|
||||
if (!file)
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(f);
|
||||
|
||||
handle = FindFirstFile(file, &data);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
free(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(file);
|
||||
|
||||
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
st->st_size = 1024;
|
||||
st->st_mode = S_IFDIR;
|
||||
st->st_nlink = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
st->st_size = data.nFileSizeLow;
|
||||
st->st_mode = S_IFREG;
|
||||
st->st_nlink = 1;
|
||||
}
|
||||
|
||||
permission |= S_IREAD;
|
||||
|
||||
if (!(data.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
permission |= S_IWRITE;
|
||||
|
||||
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
permission |= S_IEXEC;
|
||||
|
||||
st->st_mode |= permission | (permission >> 3) | (permission >> 6);
|
||||
|
||||
FileTimeToLocalFileTime(&data.ftLastWriteTime, &local_time);
|
||||
FileTimeToSystemTime(&local_time, &system_time);
|
||||
|
||||
st->st_mtime = _evil_systemtime_to_time(system_time);
|
||||
|
||||
FileTimeToLocalFileTime(&data.ftCreationTime, &local_time);
|
||||
FileTimeToSystemTime(&local_time, &system_time);
|
||||
|
||||
st->st_ctime = _evil_systemtime_to_time(system_time);
|
||||
|
||||
FileTimeToLocalFileTime(&data.ftLastAccessTime, &local_time);
|
||||
FileTimeToSystemTime(&local_time, &system_time);
|
||||
|
||||
st->st_atime = _evil_systemtime_to_time(system_time);
|
||||
|
||||
if(st->st_atime == 0)
|
||||
st->st_atime = st->st_mtime;
|
||||
if (st->st_ctime == 0)
|
||||
st->st_ctime = st->st_mtime;
|
||||
|
||||
st->st_rdev = 1;
|
||||
st->st_ino = 0;
|
||||
|
||||
FindClose(handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Sockets and pipe related functions
|
||||
|
@ -406,18 +232,3 @@ evil_pipe(int *fds)
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Exec related functions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
int execvp (const char *file EVIL_UNUSED, char *const argv[] EVIL_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* Conformity: Not appliclable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI double evil_time_get(void);
|
||||
|
||||
|
@ -54,7 +54,7 @@ EAPI double evil_time_get(void);
|
|||
*
|
||||
* Conformity: Not appliclable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int evil_gettimeofday(struct timeval * tp, void * tzp);
|
||||
|
||||
|
@ -77,7 +77,7 @@ EAPI int evil_gettimeofday(struct timeval * tp, void * tzp);
|
|||
*
|
||||
* Conformity: Not appliclable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int evil_usleep(unsigned long usec);
|
||||
|
||||
|
@ -88,14 +88,11 @@ EAPI int evil_usleep(unsigned long usec);
|
|||
*/
|
||||
#define usleep(usec) evil_usleep(usec);
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/*
|
||||
* Process identifer related functions
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined (_MSC_VER) || defined (_WIN32_WCE)
|
||||
/**
|
||||
* @brief Return the process identifier of the calling process.
|
||||
*
|
||||
|
@ -107,9 +104,10 @@ EAPI int evil_usleep(unsigned long usec);
|
|||
*
|
||||
* Conformity: Not appliclable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI pid_t getpid(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -139,7 +137,7 @@ EAPI pid_t getpid(void);
|
|||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int symlink(const char *oldpath, const char *newpath);
|
||||
|
||||
|
@ -164,7 +162,7 @@ EAPI int symlink(const char *oldpath, const char *newpath);
|
|||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz);
|
||||
|
||||
|
@ -174,35 +172,6 @@ EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz);
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/**
|
||||
* @brief Return information about a file.
|
||||
*
|
||||
* @param file_name The file to retrieve information from.
|
||||
* @param st Buffer to fill
|
||||
* @return 0 on success, -1 otherwise.
|
||||
*
|
||||
* This function retrieves information about the file named
|
||||
* @p file_name and fill the structure @p st. If the function
|
||||
* succeeds, 0 is returned, otherwise -1 is returned.
|
||||
*
|
||||
* Conformity: None.
|
||||
*
|
||||
* Supported OS: Windows CE (not cegcc).
|
||||
*/
|
||||
EAPI int evil_stat(const char *file_name, struct stat *st);
|
||||
|
||||
/**
|
||||
* @def stat(f,st)
|
||||
*
|
||||
* Wrapper around evil_stat().
|
||||
*/
|
||||
# define stat(f,st) evil_stat((f),(st))
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
/**
|
||||
* @brief Get the current directory.
|
||||
*
|
||||
|
@ -210,24 +179,11 @@ EAPI int evil_stat(const char *file_name, struct stat *st);
|
|||
* @param size Size of the buffer.
|
||||
* @return The current directory.
|
||||
*
|
||||
* On Windows desktop, use the _getcwd function in MSVCRT.
|
||||
*
|
||||
* On Windows CE, get the current directory by extracting the path
|
||||
* from the executable that is running and put the result in @p buffer
|
||||
* of length @p size. If @p size is less or equal than 0, return NULL.
|
||||
* If the current absolute path would require a buffer longer than
|
||||
* @p size elements, NULL is returned. If @p buffer is NULL, a buffer
|
||||
* of length @p size is allocated and is returned. If the allocation
|
||||
* fails, NULL is returned. On success, @p buffer is returned and
|
||||
* contains the current directory. The last '\' is not included.
|
||||
* If @p buffer is NULL, the returned value must be freed if not NULL.
|
||||
*
|
||||
* Specially usefull on WinCE where the current directory functionality
|
||||
* is not supported.
|
||||
* Use the _getcwd function in MSVCRT.
|
||||
*
|
||||
* Conformity: Almost POSIX.1 (no errno set)
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI char *evil_getcwd(char *buffer, size_t size);
|
||||
|
||||
|
@ -253,7 +209,7 @@ EAPI char *evil_getcwd(char *buffer, size_t size);
|
|||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int evil_sockets_init(void);
|
||||
|
||||
|
@ -264,7 +220,7 @@ EAPI int evil_sockets_init(void);
|
|||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI void evil_sockets_shutdown(void);
|
||||
|
||||
|
@ -280,7 +236,7 @@ EAPI void evil_sockets_shutdown(void);
|
|||
*
|
||||
* Conformity: Not applicable.
|
||||
*
|
||||
* Supported OS: Windows XP, Windows CE.
|
||||
* Supported OS: Windows XP.
|
||||
*/
|
||||
EAPI int evil_pipe(int *fds);
|
||||
|
||||
|
@ -292,33 +248,6 @@ EAPI int evil_pipe(int *fds);
|
|||
#define pipe(fds) evil_pipe(fds)
|
||||
|
||||
|
||||
/*
|
||||
* Exec related functions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
/**
|
||||
* @brief Replace the current process image with a new process image.
|
||||
*
|
||||
* @param file The file name of the file being executed.
|
||||
* @param argv A @c NULL terminated array of strings.
|
||||
* @return Always 1.
|
||||
*
|
||||
* This function does nothing and returns always 1. It is defined for
|
||||
* ecore_app only for native Windows CE code.
|
||||
*
|
||||
* Conformity: Not appliclable.
|
||||
*
|
||||
* Supported OS: Windows CE (not cegcc).
|
||||
*/
|
||||
EAPI int execvp( const char *file, char *const argv[]);
|
||||
|
||||
#endif /* _WIN32_WCE */
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -192,9 +192,6 @@ _evil_last_error_display(const char *fct)
|
|||
const char *
|
||||
evil_tmpdir_get(void)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
return "\\temp";
|
||||
#else
|
||||
char *tmpdir;
|
||||
|
||||
tmpdir = getenv("TMP");
|
||||
|
@ -204,15 +201,11 @@ evil_tmpdir_get(void)
|
|||
if (!tmpdir) tmpdir="C:\\";
|
||||
|
||||
return tmpdir;
|
||||
#endif /* ! _WIN32_WCE */
|
||||
}
|
||||
|
||||
const char *
|
||||
evil_homedir_get(void)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
return "\\my documents";
|
||||
#else
|
||||
char *homedir;
|
||||
|
||||
homedir = getenv("HOME");
|
||||
|
@ -221,7 +214,6 @@ evil_homedir_get(void)
|
|||
if (!homedir) homedir="C:\\";
|
||||
|
||||
return homedir;
|
||||
#endif /* ! _WIN32_WCE */
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -123,7 +123,7 @@ EAPI const char *evil_homedir_get(void);
|
|||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||
* Windows XP, Windows CE.
|
||||
* Windows XP.
|
||||
*
|
||||
* @since 1.7
|
||||
*
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#ifndef __MINGW32CE__
|
||||
/*
|
||||
* Defines the windows UUID IID_IPersistFile used for links in
|
||||
* evil. This is here since uuid.lib is a static only library and
|
||||
|
@ -8,5 +7,3 @@
|
|||
# define INITGUID
|
||||
# include <basetyps.h>
|
||||
DEFINE_OLEGUID(IID_IPersistFile, 0x0000010BL, 0, 0);
|
||||
|
||||
#endif /* ! __MINGW32CE__ */
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
#ifndef __EVIL_ERRNO_H__
|
||||
#define __EVIL_ERRNO_H__
|
||||
|
||||
#ifdef EAPI
|
||||
# undef EAPI
|
||||
#endif /* EAPI */
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef EFL_EVIL_BUILD
|
||||
# ifdef DLL_EXPORT
|
||||
# define EAPI __declspec(dllexport)
|
||||
# else
|
||||
# define EAPI
|
||||
# endif /* ! DLL_EXPORT */
|
||||
# else
|
||||
# define EAPI __declspec(dllimport)
|
||||
# endif /* ! EFL_EVIL_BUILD */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern EAPI int errno;
|
||||
|
||||
/* Fake values */
|
||||
#define E2BIG 1
|
||||
#define EACCES 2
|
||||
#define EAGAIN 3
|
||||
#define EBADF 4
|
||||
#define EBADMSG 5
|
||||
#define EBUSY 6
|
||||
#define ECANCELED 7
|
||||
#define ECHILD 9
|
||||
#define EDEADLK 10
|
||||
#define EDOM 11
|
||||
#define EEXIST 12
|
||||
#define EFAULT 13
|
||||
#define EFBIG 14
|
||||
#define EINPROGRESS 15
|
||||
#define EINTR 16
|
||||
#define EINVAL 17
|
||||
#define EIO 18
|
||||
#define EISDIR 19
|
||||
#define EMFILE 20
|
||||
#define EMLINK 21
|
||||
#define EMSGSIZE 22
|
||||
#define ENAMETOOLONG 23
|
||||
#define ENFILE 24
|
||||
#define ENODEV 25
|
||||
#define ENOENT 26
|
||||
#define ENOEXEC 27
|
||||
#define ENOLCK 28
|
||||
#define ENOMEM 29
|
||||
#define ENOSPC 30
|
||||
#define ENOSYS 31
|
||||
#define ENOTDIR 32
|
||||
#define ENOTEMPTY 33
|
||||
#define ENOTSUP 34
|
||||
#define ENOTTY 35
|
||||
#define ENXIO 36
|
||||
#define EPERM 37
|
||||
#define EPIPE 38
|
||||
#define ERANGE 39
|
||||
#define EROFS 40
|
||||
#define ESPIPE 41
|
||||
#define ESRCH 42
|
||||
#define ETIMEDOUT 43
|
||||
#define EXDEV 44
|
||||
#define EADDRINUSE 45
|
||||
#define EADDRNOTAVAIL 46
|
||||
#define EAFNOSUPPORT 47
|
||||
#define EALREADY 48
|
||||
#define ECONNABORTED 49
|
||||
#define ECONNREFUSED 50
|
||||
#define ECONNRESET 51
|
||||
#define EDESTADDRREQ 52
|
||||
#define EDQUOT 53
|
||||
#define EHOSTUNREACH 54
|
||||
#define EIDRM 55
|
||||
#define EILSEQ 56
|
||||
#define EISCONN 57
|
||||
#define ELOOP 58
|
||||
#define EMULTIHOP 59
|
||||
#define ENETDOWN 60
|
||||
#define ENETRESET 61
|
||||
#define ENETUNREACH 62
|
||||
#define ENOBUFS 63
|
||||
#define ENODATA 64
|
||||
#define ENOLINK 65
|
||||
#define ENOMSG 66
|
||||
#define ENOPROTOOPT 67
|
||||
#define ENOSR 68
|
||||
#define ENOSTR 69
|
||||
#define ENOTCONN 70
|
||||
#define ENOTSOCK 71
|
||||
#define EOPNOTSUPP 72
|
||||
#define EOVERFLOW 73
|
||||
#define EPROTO 74
|
||||
#define EPROTONOSUPPORT 75
|
||||
#define EPROTOTYPE 76
|
||||
#define ESTALE 77
|
||||
#define ETIME 78
|
||||
#define ETXTBSY 79
|
||||
#define EWOULDBLOCK 80
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __EVIL_ERRNO_H__ */
|
|
@ -10,14 +10,6 @@
|
|||
# include <Evil.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
# define E_FOPEN(file, mode) evil_fopen_native((file), (mode))
|
||||
# define E_FCLOSE(stream) evil_fclose_native(stream)
|
||||
#else
|
||||
# define E_FOPEN(file, mode) fopen((file), (mode))
|
||||
# define E_FCLOSE(stream) fclose(stream)
|
||||
#endif
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include "evas_private.h"
|
||||
|
||||
|
@ -43,7 +35,7 @@ save_image_png(RGBA_Image *im, const char *file, int do_compress, int interlace)
|
|||
if (!im || !im->image.data || !file)
|
||||
return 0;
|
||||
|
||||
f = E_FOPEN(file, "wb");
|
||||
f = fopen(file, "wb");
|
||||
if (!f) return 0;
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
@ -147,11 +139,11 @@ save_image_png(RGBA_Image *im, const char *file, int do_compress, int interlace)
|
|||
|
||||
if (im->cache_entry.flags.alpha)
|
||||
free(data);
|
||||
E_FCLOSE(f);
|
||||
fclose(f);
|
||||
return 1;
|
||||
|
||||
close_file:
|
||||
E_FCLOSE(f);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue