forked from enlightenment/efl
parent
89ae5535c4
commit
d787b6dec9
|
@ -48,6 +48,7 @@ requirements_ecore_job=""
|
||||||
requirements_ecore_txt=""
|
requirements_ecore_txt=""
|
||||||
requirements_ecore_x=""
|
requirements_ecore_x=""
|
||||||
requirements_ecore_win32=""
|
requirements_ecore_win32=""
|
||||||
|
requirements_ecore_wince=""
|
||||||
requirements_ecore_sdl=""
|
requirements_ecore_sdl=""
|
||||||
|
|
||||||
dnl The first call to PKG_CHECK_MODULES is done conditionally,
|
dnl The first call to PKG_CHECK_MODULES is done conditionally,
|
||||||
|
@ -76,8 +77,9 @@ case "$host_os" in
|
||||||
AC_DEFINE(HAVE_SYS_MMAN_H, 1, [Define to 1 if you have the <sys/mman.h> header file.])
|
AC_DEFINE(HAVE_SYS_MMAN_H, 1, [Define to 1 if you have the <sys/mman.h> header file.])
|
||||||
AC_DEFINE(HAVE_SYS_TIME_H, 1, [Define to 1 if you have the <sys/time.h> header file.])
|
AC_DEFINE(HAVE_SYS_TIME_H, 1, [Define to 1 if you have the <sys/time.h> header file.])
|
||||||
if test "$host_os" = "cegcc" ; then
|
if test "$host_os" = "cegcc" ; then
|
||||||
|
AC_DEFINE(EFL_ECORE_WINCE_BUILD, 1, [Define to mention that ecore WinCE is built.])
|
||||||
WIN32_CFLAGS="-mwin32"
|
WIN32_CFLAGS="-mwin32"
|
||||||
WIN32_LIBS="-lws2"
|
WIN32_LIBS="-lws2 -laygshell"
|
||||||
lt_enable_auto_import="-Wl,--enable-auto-import"
|
lt_enable_auto_import="-Wl,--enable-auto-import"
|
||||||
else
|
else
|
||||||
WIN32_LIBS="-lws2_32"
|
WIN32_LIBS="-lws2_32"
|
||||||
|
@ -555,6 +557,40 @@ if test "x${have_ecore_win32}" = "xyes" -a "x${have_direct3d}" = "xyes"; then
|
||||||
AC_DEFINE(BUILD_ECORE_EVAS_DIRECT3D, 1, [Support for Direct3D Engine in Ecore_Evas])
|
AC_DEFINE(BUILD_ECORE_EVAS_DIRECT3D, 1, [Support for Direct3D Engine in Ecore_Evas])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ECORE_CHECK_MODULE([WinCE], [no])
|
||||||
|
|
||||||
|
if test "x$have_ecore_wince" = "xyes"; then
|
||||||
|
requirements_ecore_evas="$requirements_ecore_evas ecore-wince"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl ecore_evas_wince
|
||||||
|
have_ecore_evas_software_16_wince="no"
|
||||||
|
if test "x$have_ecore_software_16_wince" = "xyes" -a "x$have_ecore_evas" = "xyes"; then
|
||||||
|
want_ecore_evas_wince=yes
|
||||||
|
AC_ARG_ENABLE(ecore-evas-software-16-wince,
|
||||||
|
AC_HELP_STRING(
|
||||||
|
[--enable-ecore-evas-software-16-wince],
|
||||||
|
[enable WinCE support in the ecore_evas module.]
|
||||||
|
),
|
||||||
|
[ want_ecore_evas_wince=$enableval ]
|
||||||
|
)
|
||||||
|
AC_MSG_CHECKING(whether ecore_evas WinCE support is to be built)
|
||||||
|
AC_MSG_RESULT($want_ecore_evas_wince)
|
||||||
|
|
||||||
|
if test "x$want_ecore_evas_wince" = "xyes"; then
|
||||||
|
PKG_CHECK_MODULES(EVAS_SOFTWARE_16_WINCE, evas-software-16-wince, [
|
||||||
|
AC_DEFINE(BUILD_ECORE_EVAS_SOFTWARE_16_WINCE, 1, [Support for WinCE Engine in Ecore_Evas])
|
||||||
|
have_ecore_evas_software_16_wince="yes";
|
||||||
|
], [
|
||||||
|
have_ecore_evas_software_16_wince="no";
|
||||||
|
])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$have_ecore_evas_software_16_wince" = "xyes"; then
|
||||||
|
requirements_ecore_evas="$requirements_ecore_evas ecore-wince"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
dnl ecore_dfb
|
dnl ecore_dfb
|
||||||
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
|
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
|
||||||
[ have_directfb="yes" ],
|
[ have_directfb="yes" ],
|
||||||
|
@ -818,6 +854,7 @@ ecore-txt.pc
|
||||||
ecore-x.pc
|
ecore-x.pc
|
||||||
ecore-win32.pc
|
ecore-win32.pc
|
||||||
ecore-sdl.pc
|
ecore-sdl.pc
|
||||||
|
ecore-wince.pc
|
||||||
ecore.pc
|
ecore.pc
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/bin/Makefile
|
src/bin/Makefile
|
||||||
|
@ -838,6 +875,7 @@ src/lib/ecore_file/Makefile
|
||||||
src/lib/ecore_desktop/Makefile
|
src/lib/ecore_desktop/Makefile
|
||||||
src/lib/ecore_directfb/Makefile
|
src/lib/ecore_directfb/Makefile
|
||||||
src/lib/ecore_win32/Makefile
|
src/lib/ecore_win32/Makefile
|
||||||
|
src/lib/ecore_wince/Makefile
|
||||||
README
|
README
|
||||||
ecore.spec
|
ecore.spec
|
||||||
])
|
])
|
||||||
|
@ -865,6 +903,7 @@ echo " Ecore_Evas XRender Support...: $have_ecore_evas_xrender"
|
||||||
echo " Ecore_Evas X11 16bpp Support.: $have_ecore_evas_x11_16"
|
echo " Ecore_Evas X11 16bpp Support.: $have_ecore_evas_x11_16"
|
||||||
|
|
||||||
echo " Ecore_Win32..................: $have_ecore_win32 (DirectDraw: ${have_ddraw}) (16bpp DirectDraw: ${have_ddraw_16}) (Direct3D: ${have_direct3d}) (OpenGL Glew: ${have_opengl_glew})"
|
echo " Ecore_Win32..................: $have_ecore_win32 (DirectDraw: ${have_ddraw}) (16bpp DirectDraw: ${have_ddraw_16}) (Direct3D: ${have_direct3d}) (OpenGL Glew: ${have_opengl_glew})"
|
||||||
|
echo " Ecore_WinCE..................: $have_ecore_wince"
|
||||||
echo " Ecore_DFB....................: $have_ecore_directfb"
|
echo " Ecore_DFB....................: $have_ecore_directfb"
|
||||||
echo " Ecore_Evas DFB Support.......: $have_ecore_evas_dfb"
|
echo " Ecore_Evas DFB Support.......: $have_ecore_evas_dfb"
|
||||||
echo " Ecore_FB.....................: $have_ecore_fb"
|
echo " Ecore_FB.....................: $have_ecore_fb"
|
||||||
|
@ -872,6 +911,7 @@ echo " Ecore_Evas FB Support........: $have_ecore_evas_fb"
|
||||||
echo " Ecore_SDL....................: $have_ecore_sdl"
|
echo " Ecore_SDL....................: $have_ecore_sdl"
|
||||||
echo " Ecore_Evas SDL Support.......: $have_ecore_evas_sdl"
|
echo " Ecore_Evas SDL Support.......: $have_ecore_evas_sdl"
|
||||||
echo " Ecore_Evas Buffer Support....: $have_ecore_evas_buffer"
|
echo " Ecore_Evas Buffer Support....: $have_ecore_evas_buffer"
|
||||||
|
echo " Ecore_Evas WinCE Support.....: $have_ecore_evas_wince"
|
||||||
|
|
||||||
echo " Ecore_File...................: $have_ecore_file (Inotify: $have_inotify) (Poll: $have_poll) (CURL: $have_curl)"
|
echo " Ecore_File...................: $have_ecore_file (Inotify: $have_inotify) (Poll: $have_poll) (CURL: $have_curl)"
|
||||||
echo " Ecore_Desktop................: $have_ecore_desktop"
|
echo " Ecore_Desktop................: $have_ecore_desktop"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: ecore-wince
|
||||||
|
Description: E core library, WinCE module
|
||||||
|
Version: @VERSION@
|
||||||
|
Libs: -L${libdir} -lecore_wince
|
||||||
|
Libs.private: @WIN32_LIBS@
|
||||||
|
Cflags: -I${includedir}
|
|
@ -8,6 +8,7 @@ ecore_directfb \
|
||||||
ecore_con \
|
ecore_con \
|
||||||
ecore_x \
|
ecore_x \
|
||||||
ecore_win32 \
|
ecore_win32 \
|
||||||
|
ecore_wince \
|
||||||
ecore_sdl \
|
ecore_sdl \
|
||||||
ecore_ipc \
|
ecore_ipc \
|
||||||
ecore_evas \
|
ecore_evas \
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ECORE_WINCE_H__
|
||||||
|
#define __ECORE_WINCE_H__
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef EAPI
|
||||||
|
# undef EAPI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WINCE
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
typedef void Ecore_WinCE_Window;
|
||||||
|
|
||||||
|
|
||||||
|
/* Events */
|
||||||
|
|
||||||
|
typedef struct _Ecore_WinCE_Event_Key_Down Ecore_WinCE_Event_Key_Down;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Key_Up Ecore_WinCE_Event_Key_Up;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Focus_In Ecore_WinCE_Event_Window_Focus_In;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Focus_Out Ecore_WinCE_Event_Window_Focus_Out;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Damage Ecore_WinCE_Event_Window_Damage;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Create Ecore_WinCE_Event_Window_Create;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Destroy Ecore_WinCE_Event_Window_Destroy;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Hide Ecore_WinCE_Event_Window_Hide;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Show Ecore_WinCE_Event_Window_Show;
|
||||||
|
typedef struct _Ecore_WinCE_Event_Window_Delete_Request Ecore_WinCE_Event_Window_Delete_Request;
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Key_Down
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
char *keyname;
|
||||||
|
char *keysymbol;
|
||||||
|
char *keycompose;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Key_Up
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
char *keyname;
|
||||||
|
char *keysymbol;
|
||||||
|
char *keycompose;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Focus_In
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Focus_Out
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Damage
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Create
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Destroy
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Hide
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Show
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Event_Window_Delete_Request
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *window;
|
||||||
|
double time;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_KEY_DOWN;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_KEY_UP;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DAMAGE;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_CREATE;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DESTROY;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_HIDE;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_SHOW;
|
||||||
|
EAPI extern int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST;
|
||||||
|
|
||||||
|
|
||||||
|
/* Core */
|
||||||
|
|
||||||
|
EAPI int ecore_wince_init();
|
||||||
|
EAPI int ecore_wince_shutdown();
|
||||||
|
EAPI double ecore_wince_current_time_get(void);
|
||||||
|
EAPI void ecore_wince_message_loop_begin (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_del(Ecore_WinCE_Window *window);
|
||||||
|
|
||||||
|
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_suspend_set(Ecore_WinCE_Window *window, int (*suspend)(void));
|
||||||
|
|
||||||
|
EAPI void ecore_wince_window_resume_set(Ecore_WinCE_Window *window, int (*resume)(void));
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ECORE_WINCE_H__ */
|
|
@ -0,0 +1,31 @@
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
AM_CPPFLAGS = \
|
||||||
|
-I$(top_srcdir)/src/lib/ecore \
|
||||||
|
-I$(top_builddir)/src/lib/ecore
|
||||||
|
|
||||||
|
AM_CFLAGS = @WIN32_CFLAGS@
|
||||||
|
|
||||||
|
|
||||||
|
if BUILD_ECORE_WINCE
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libecore_wince.la
|
||||||
|
|
||||||
|
include_HEADERS = \
|
||||||
|
Ecore_WinCE.h
|
||||||
|
|
||||||
|
libecore_wince_la_SOURCES = \
|
||||||
|
ecore_wince.c \
|
||||||
|
ecore_wince_event.c \
|
||||||
|
ecore_wince_window.c
|
||||||
|
|
||||||
|
libecore_wince_la_LIBADD = \
|
||||||
|
@WIN32_LIBS@ \
|
||||||
|
$(top_builddir)/src/lib/ecore/libecore.la
|
||||||
|
|
||||||
|
libecore_wince_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -version-info @version_info@
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
ecore_wince_private.h
|
|
@ -0,0 +1,217 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h> /* for printf */
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_WinCE.h"
|
||||||
|
#include "ecore_wince_private.h"
|
||||||
|
|
||||||
|
|
||||||
|
/***** Global declarations *****/
|
||||||
|
|
||||||
|
double _ecore_wince_event_last_time = 0.0;
|
||||||
|
|
||||||
|
HINSTANCE _ecore_wince_instance = NULL;
|
||||||
|
|
||||||
|
EAPI int ECORE_WINCE_EVENT_KEY_DOWN = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_KEY_UP = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_DAMAGE = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_CREATE = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_DESTROY = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_SHOW = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_HIDE = 0;
|
||||||
|
EAPI int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private declarations *****/
|
||||||
|
|
||||||
|
static int _ecore_wince_init_count = 0;
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CALLBACK _ecore_wince_window_procedure(HWND window,
|
||||||
|
UINT message,
|
||||||
|
WPARAM window_param,
|
||||||
|
LPARAM data_param);
|
||||||
|
|
||||||
|
|
||||||
|
/***** API *****/
|
||||||
|
|
||||||
|
int
|
||||||
|
ecore_wince_init()
|
||||||
|
{
|
||||||
|
WNDCLASS wc;
|
||||||
|
|
||||||
|
if (_ecore_wince_init_count > 0)
|
||||||
|
{
|
||||||
|
_ecore_wince_init_count++;
|
||||||
|
return _ecore_wince_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ecore_wince_instance = GetModuleHandle(NULL);
|
||||||
|
if (!_ecore_wince_instance)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
FreeLibrary(_ecore_wince_instance);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ECORE_WINCE_EVENT_KEY_DOWN)
|
||||||
|
{
|
||||||
|
ECORE_WINCE_EVENT_KEY_DOWN = ecore_event_type_new();
|
||||||
|
ECORE_WINCE_EVENT_KEY_UP = 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
_ecore_wince_init_count++;
|
||||||
|
|
||||||
|
return _ecore_wince_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ecore_wince_shutdown()
|
||||||
|
{
|
||||||
|
_ecore_wince_init_count++;
|
||||||
|
if (_ecore_wince_init_count > 0) return _ecore_wince_init_count;
|
||||||
|
if (!_ecore_wince_instance) return _ecore_wince_init_count;
|
||||||
|
|
||||||
|
UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance);
|
||||||
|
FreeLibrary(_ecore_wince_instance);
|
||||||
|
_ecore_wince_instance = NULL;
|
||||||
|
|
||||||
|
if (_ecore_wince_init_count < 0) _ecore_wince_init_count = 0;
|
||||||
|
|
||||||
|
return _ecore_wince_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private functions definitions *****/
|
||||||
|
|
||||||
|
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_HOTKEY:
|
||||||
|
printf (" * ecore message : keystroke down (hotkey)\n");
|
||||||
|
_ecore_wince_event_handle_key_press(data);
|
||||||
|
return 0;
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
printf (" * ecore message : keystroke down\n");
|
||||||
|
_ecore_wince_event_handle_key_press(data);
|
||||||
|
return 0;
|
||||||
|
case WM_KEYUP:
|
||||||
|
printf (" * ecore message : keystroke up\n");
|
||||||
|
_ecore_wince_event_handle_key_release(data);
|
||||||
|
return 0;
|
||||||
|
case WM_SETFOCUS:
|
||||||
|
printf (" * ecore message : focus in\n");
|
||||||
|
_ecore_wince_event_handle_focus_in(data);
|
||||||
|
return 0;
|
||||||
|
case WM_KILLFOCUS:
|
||||||
|
printf (" * ecore message : focus out\n");
|
||||||
|
_ecore_wince_event_handle_focus_out(data);
|
||||||
|
return 0;
|
||||||
|
/* Window notifications */
|
||||||
|
case WM_CREATE:
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(window, &rect);
|
||||||
|
printf (" *** ecore message : create %ld %ld\n",
|
||||||
|
rect.right - rect.left, rect.bottom - rect.top);
|
||||||
|
}
|
||||||
|
_ecore_wince_event_handle_create_notify(data);
|
||||||
|
return 0;
|
||||||
|
case WM_DESTROY:
|
||||||
|
printf (" * ecore message : destroy\n");
|
||||||
|
_ecore_wince_event_handle_destroy_notify(data);
|
||||||
|
return 0;
|
||||||
|
case WM_SHOWWINDOW:
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(window, &rect);
|
||||||
|
printf (" *** ecore message : show %ld %ld\n",
|
||||||
|
rect.right - rect.left, rect.bottom - rect.top);
|
||||||
|
}
|
||||||
|
if ((data->data_param == SW_OTHERUNZOOM) ||
|
||||||
|
(data->data_param == SW_OTHERUNZOOM))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (data->window_param)
|
||||||
|
_ecore_wince_event_handle_map_notify(data);
|
||||||
|
else
|
||||||
|
_ecore_wince_event_handle_unmap_notify(data);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
case WM_CLOSE:
|
||||||
|
printf (" * ecore message : close\n");
|
||||||
|
_ecore_wince_event_handle_delete_request(data);
|
||||||
|
return 0;
|
||||||
|
/* GDI notifications */
|
||||||
|
case WM_PAINT:
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
ValidateRect(window, NULL);
|
||||||
|
if (GetUpdateRect(window, &rect, FALSE))
|
||||||
|
{
|
||||||
|
data->update = rect;
|
||||||
|
_ecore_wince_event_handle_expose(data);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return DefWindowProc(window, message, window_param, data_param);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,597 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h> /* for printf */
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_WinCE.h"
|
||||||
|
#include "ecore_wince_private.h"
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private declarations *****/
|
||||||
|
|
||||||
|
static void _ecore_wince_event_free_key_down(void *data,
|
||||||
|
void *ev);
|
||||||
|
|
||||||
|
static void _ecore_wince_event_free_key_up(void *data,
|
||||||
|
void *ev);
|
||||||
|
|
||||||
|
static int _ecore_wince_event_keystroke_get(int key,
|
||||||
|
char **keyname,
|
||||||
|
char **keysymbol,
|
||||||
|
char **keycompose);
|
||||||
|
|
||||||
|
static int _ecore_wince_event_char_get(int key,
|
||||||
|
char **keyname,
|
||||||
|
char **keysymbol,
|
||||||
|
char **keycompose);
|
||||||
|
|
||||||
|
|
||||||
|
/***** Global functions *****/
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Key_Down *e;
|
||||||
|
|
||||||
|
e = (Ecore_WinCE_Event_Key_Down *)malloc(sizeof(Ecore_WinCE_Event_Key_Down));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
|
||||||
|
&e->keyname,
|
||||||
|
&e->keysymbol,
|
||||||
|
&e->keycompose))
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e->time = (double)msg->time / 1000.0;
|
||||||
|
|
||||||
|
_ecore_wince_event_last_time = e->time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_KEY_DOWN, e, _ecore_wince_event_free_key_down, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Key_Up *e;
|
||||||
|
|
||||||
|
e = (Ecore_WinCE_Event_Key_Up *)calloc(1, sizeof(Ecore_WinCE_Event_Key_Up));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param),
|
||||||
|
&e->keyname,
|
||||||
|
&e->keysymbol,
|
||||||
|
&e->keycompose))
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e->time = (double)msg->time / 1000.0;
|
||||||
|
|
||||||
|
_ecore_wince_event_last_time = e->time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_KEY_UP, e, _ecore_wince_event_free_key_up, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Focus_In *e;
|
||||||
|
struct _Ecore_WinCE_Window *window;
|
||||||
|
|
||||||
|
e = (Ecore_WinCE_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_In));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->resume)
|
||||||
|
window->resume();
|
||||||
|
|
||||||
|
e->window = window;
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
_ecore_wince_event_last_time = e->time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Focus_Out *e;
|
||||||
|
struct _Ecore_WinCE_Window *window;
|
||||||
|
|
||||||
|
e = (Ecore_WinCE_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_Out));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (window->suspend)
|
||||||
|
window->suspend();
|
||||||
|
|
||||||
|
e->window = window;
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
_ecore_wince_event_last_time = e->time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Damage *e;
|
||||||
|
|
||||||
|
e = (Ecore_WinCE_Event_Window_Damage *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Damage));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->x = msg->update.left;
|
||||||
|
e->y = msg->update.top;
|
||||||
|
e->width = msg->update.right - msg->update.left;
|
||||||
|
e->height = msg->update.bottom - msg->update.top;
|
||||||
|
printf (" * ecore : event expose %d %d\n", e->width, e->height);
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Create *e;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Create));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_CREATE, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Destroy *e;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Destroy));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
/* if (e->window == _ecore_wince_event_last_window) _ecore_wince_event_last_window = NULL; */
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Show *e;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Show));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_SHOW, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Hide *e;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Hide));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_HIDE, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Window_Delete_Request *e;
|
||||||
|
|
||||||
|
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Delete_Request));
|
||||||
|
if (!e) return;
|
||||||
|
|
||||||
|
e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
|
||||||
|
if (!e->window)
|
||||||
|
{
|
||||||
|
free(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e->time = _ecore_wince_event_last_time;
|
||||||
|
|
||||||
|
ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private functions definitions *****/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_wince_event_free_key_down(void *data,
|
||||||
|
void *ev)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Key_Down *e;
|
||||||
|
|
||||||
|
e = ev;
|
||||||
|
if (e->keyname) free(e->keyname);
|
||||||
|
if (e->keysymbol) free(e->keysymbol);
|
||||||
|
if (e->keycompose) free(e->keycompose);
|
||||||
|
free(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_wince_event_free_key_up(void *data,
|
||||||
|
void *ev)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Event_Key_Up *e;
|
||||||
|
|
||||||
|
e = ev;
|
||||||
|
if (e->keyname) free(e->keyname);
|
||||||
|
if (e->keysymbol) free(e->keysymbol);
|
||||||
|
if (e->keycompose) free(e->keycompose);
|
||||||
|
free(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_ecore_wince_event_keystroke_get(int key,
|
||||||
|
char **keyname,
|
||||||
|
char **keysymbol,
|
||||||
|
char **keycompose)
|
||||||
|
{
|
||||||
|
char *kn;
|
||||||
|
char *ks;
|
||||||
|
char *kc;
|
||||||
|
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
*keycompose = NULL;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
/* Keystroke */
|
||||||
|
case VK_PRIOR:
|
||||||
|
kn = "KP_Prior";
|
||||||
|
ks = "KP_Prior";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_NEXT:
|
||||||
|
kn = "KP_Next";
|
||||||
|
ks = "KP_Next";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_END:
|
||||||
|
kn = "KP_End";
|
||||||
|
ks = "KP_End";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_HOME:
|
||||||
|
kn = "KP_Home";
|
||||||
|
ks = "KP_Home";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_LEFT:
|
||||||
|
kn = "KP_Left";
|
||||||
|
ks = "KP_Left";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_UP:
|
||||||
|
kn = "KP_Up";
|
||||||
|
ks = "KP_Up";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_RIGHT:
|
||||||
|
kn = "KP_Right";
|
||||||
|
ks = "KP_Right";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_DOWN:
|
||||||
|
kn = "KP_Down";
|
||||||
|
ks = "KP_Down";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_INSERT:
|
||||||
|
kn = "KP_Insert";
|
||||||
|
ks = "KP_Insert";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_DELETE:
|
||||||
|
kn = "KP_Delete";
|
||||||
|
ks = "KP_Delete";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F1:
|
||||||
|
kn = "F1";
|
||||||
|
ks = "F1";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F2:
|
||||||
|
kn = "F2";
|
||||||
|
ks = "F2";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F3:
|
||||||
|
kn = "F3";
|
||||||
|
ks = "F3";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F4:
|
||||||
|
kn = "F4";
|
||||||
|
ks = "F4";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F5:
|
||||||
|
kn = "F5";
|
||||||
|
ks = "F5";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F6:
|
||||||
|
kn = "F6";
|
||||||
|
ks = "F6";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F7:
|
||||||
|
kn = "F7";
|
||||||
|
ks = "F7";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F8:
|
||||||
|
kn = "F8";
|
||||||
|
ks = "F8";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F9:
|
||||||
|
kn = "F9";
|
||||||
|
ks = "F9";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F10:
|
||||||
|
kn = "F10";
|
||||||
|
ks = "F10";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F11:
|
||||||
|
kn = "F11";
|
||||||
|
ks = "F11";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F12:
|
||||||
|
kn = "F12";
|
||||||
|
ks = "F12";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F13:
|
||||||
|
kn = "F13";
|
||||||
|
ks = "F13";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F14:
|
||||||
|
kn = "F14";
|
||||||
|
ks = "F14";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F15:
|
||||||
|
kn = "F15";
|
||||||
|
ks = "F15";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F16:
|
||||||
|
kn = "F16";
|
||||||
|
ks = "F16";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F17:
|
||||||
|
kn = "F17";
|
||||||
|
ks = "F17";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F18:
|
||||||
|
kn = "F18";
|
||||||
|
ks = "F18";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F19:
|
||||||
|
kn = "F19";
|
||||||
|
ks = "F19";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F20:
|
||||||
|
kn = "F20";
|
||||||
|
ks = "F20";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F21:
|
||||||
|
kn = "F21";
|
||||||
|
ks = "F21";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F22:
|
||||||
|
kn = "F22";
|
||||||
|
ks = "F22";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F23:
|
||||||
|
kn = "F23";
|
||||||
|
ks = "F23";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F24:
|
||||||
|
kn = "F24";
|
||||||
|
ks = "F24";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* other non keystroke characters */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*keyname = strdup(kn);
|
||||||
|
if (!*keyname) return 0;
|
||||||
|
*keysymbol = strdup(ks);
|
||||||
|
if (!*keysymbol)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
*keyname = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*keycompose = strdup(kc);
|
||||||
|
if (!*keycompose)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
free(*keysymbol);
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_ecore_wince_event_char_get(int key,
|
||||||
|
char **keyname,
|
||||||
|
char **keysymbol,
|
||||||
|
char **keycompose)
|
||||||
|
{
|
||||||
|
char kn[32];
|
||||||
|
char ks[32];
|
||||||
|
char *kc;
|
||||||
|
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
*keycompose = NULL;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case VK_APP3:
|
||||||
|
case VK_BACK:
|
||||||
|
strncpy(kn, "Backspace", 32);
|
||||||
|
strncpy(ks, "Backspace", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_APP4:
|
||||||
|
case VK_TAB:
|
||||||
|
strncpy(kn, "Tab", 32);
|
||||||
|
strncpy(ks, "Tab", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_APP5:
|
||||||
|
case 0x0a:
|
||||||
|
/* Line feed (Shift + Enter) */
|
||||||
|
strncpy(kn, "LineFeed", 32);
|
||||||
|
strncpy(ks, "LineFeed", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_APP2:
|
||||||
|
case VK_RETURN:
|
||||||
|
strncpy(kn, "Return", 32);
|
||||||
|
strncpy(ks, "Return", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_APP1:
|
||||||
|
case VK_ESCAPE:
|
||||||
|
strncpy(kn, "Escape", 32);
|
||||||
|
strncpy(ks, "Escape", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* displayable characters */
|
||||||
|
printf (" * key : %d\n", key);
|
||||||
|
kn[0] = (TCHAR)key;
|
||||||
|
kn[1] = '\0';
|
||||||
|
ks[0] = (TCHAR)key;
|
||||||
|
ks[1] = '\0';
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*keyname = strdup(kn);
|
||||||
|
if (!*keyname) return 0;
|
||||||
|
*keysymbol = strdup(ks);
|
||||||
|
if (!*keysymbol)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
*keyname = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*keycompose = strdup(kc);
|
||||||
|
if (!*keycompose)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
free(*keysymbol);
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ECORE_WINCE_PRIVATE_H__
|
||||||
|
#define __ECORE_WINCE_PRIVATE_H__
|
||||||
|
|
||||||
|
|
||||||
|
#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) (void);
|
||||||
|
typedef int (*ecore_wince_resume) (void);
|
||||||
|
|
||||||
|
|
||||||
|
struct _Ecore_WinCE_Window
|
||||||
|
{
|
||||||
|
HWND window;
|
||||||
|
|
||||||
|
ecore_wince_suspend suspend;
|
||||||
|
ecore_wince_resume resume;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern double _ecore_wince_event_last_time;
|
||||||
|
|
||||||
|
extern HINSTANCE _ecore_wince_instance;
|
||||||
|
|
||||||
|
|
||||||
|
void _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg);
|
||||||
|
void _ecore_wince_event_handle_key_release(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__ */
|
|
@ -0,0 +1,189 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h> /* for printf */
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
#include <aygshell.h>
|
||||||
|
|
||||||
|
#include "Ecore_WinCE.h"
|
||||||
|
#include "ecore_wince_private.h"
|
||||||
|
|
||||||
|
char *
|
||||||
|
_wchar_to_char(const wchar_t *text)
|
||||||
|
{
|
||||||
|
char * atext;
|
||||||
|
int size;
|
||||||
|
int asize;
|
||||||
|
|
||||||
|
size = wcslen(text) + 1;
|
||||||
|
|
||||||
|
asize = WideCharToMultiByte(CP_ACP, 0, text, size, NULL, 0, NULL, NULL);
|
||||||
|
if (asize == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
atext = (char*)malloc((asize + 1) * sizeof(char));
|
||||||
|
|
||||||
|
if (atext)
|
||||||
|
if (!WideCharToMultiByte(CP_ACP, 0, text, size, atext, asize, NULL, NULL))
|
||||||
|
return NULL;
|
||||||
|
atext[asize] = '\0';
|
||||||
|
|
||||||
|
return atext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Private declarations *****/
|
||||||
|
|
||||||
|
typedef BOOL (__stdcall *UnregisterFunc1Proc)(UINT, UINT);
|
||||||
|
|
||||||
|
static int _ecore_wince_hardware_keys_register(HWND window);
|
||||||
|
|
||||||
|
|
||||||
|
/***** API *****/
|
||||||
|
|
||||||
|
Ecore_WinCE_Window *
|
||||||
|
ecore_wince_window_new(Ecore_WinCE_Window *parent,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height)
|
||||||
|
{
|
||||||
|
struct _Ecore_WinCE_Window *w;
|
||||||
|
HWND window;
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
w = (struct _Ecore_WinCE_Window *)calloc(1, sizeof(struct _Ecore_WinCE_Window));
|
||||||
|
if (!w)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
SetRect(&rect, 0, 0,
|
||||||
|
GetSystemMetrics(SM_CXSCREEN),
|
||||||
|
GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
|
||||||
|
window = CreateWindowEx(WS_EX_TOPMOST,
|
||||||
|
ECORE_WINCE_WINDOW_CLASS,
|
||||||
|
L"",
|
||||||
|
WS_VISIBLE | WS_POPUP,
|
||||||
|
rect.left, rect.top,
|
||||||
|
rect.right - rect.left,
|
||||||
|
rect.bottom - rect.top,
|
||||||
|
parent ? ((struct _Ecore_WinCE_Window *)parent)->window : NULL,
|
||||||
|
NULL, _ecore_wince_instance, NULL);
|
||||||
|
if (!window)
|
||||||
|
{
|
||||||
|
free(w);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHFullScreen(window,
|
||||||
|
SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
|
||||||
|
|
||||||
|
if (!_ecore_wince_hardware_keys_register(window))
|
||||||
|
{
|
||||||
|
DestroyWindow(window);
|
||||||
|
free(w);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
w->window = window;
|
||||||
|
|
||||||
|
if (!SetWindowLong(window, GWL_USERDATA, (LONG)w))
|
||||||
|
{
|
||||||
|
DestroyWindow(window);
|
||||||
|
free(w);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_wince_window_del(Ecore_WinCE_Window *window)
|
||||||
|
{
|
||||||
|
Ecore_WinCE_Window *w;
|
||||||
|
|
||||||
|
if (!window) return;
|
||||||
|
|
||||||
|
DestroyWindow(((struct _Ecore_WinCE_Window *)window)->window);
|
||||||
|
free(window);
|
||||||
|
fprintf (stderr, "ecore_wince_window_del\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_wince_window_show(Ecore_WinCE_Window *window)
|
||||||
|
{
|
||||||
|
if (!window) return;
|
||||||
|
|
||||||
|
fprintf (stderr, " ** ecore_wince_window_show %p\n", window);
|
||||||
|
ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL);
|
||||||
|
UpdateWindow(((struct _Ecore_WinCE_Window *)window)->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_wince_window_hide(Ecore_WinCE_Window *window)
|
||||||
|
{
|
||||||
|
if (!window) return;
|
||||||
|
|
||||||
|
fprintf (stderr, " ** ecore_wince_window_hide %p\n", window);
|
||||||
|
ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_wince_window_suspend_set(Ecore_WinCE_Window *window, int (*suspend)(void))
|
||||||
|
{
|
||||||
|
struct _Ecore_WinCE_Window *w;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
w = (struct _Ecore_WinCE_Window *)window;
|
||||||
|
w->suspend = suspend;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_wince_window_resume_set(Ecore_WinCE_Window *window, int (*resume)(void))
|
||||||
|
{
|
||||||
|
struct _Ecore_WinCE_Window *w;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
w = (struct _Ecore_WinCE_Window *)window;
|
||||||
|
w->resume = resume;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private functions definitions *****/
|
||||||
|
|
||||||
|
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)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1");
|
||||||
|
if (!unregister_fct)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue