Windows: remove Evil dependency, general cleanup for Windows
Test Plan: compilation and execution Reviewers: raster Differential Revision: https://phab.enlightenment.org/D12039
This commit is contained in:
parent
d6a3eb3dec
commit
7c4bebe47e
69
configure.ac
69
configure.ac
|
@ -10,7 +10,7 @@ AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CANONICAL_BUILD
|
AC_CANONICAL_BUILD
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.6 dist-bzip2])
|
AM_INIT_AUTOMAKE([1.6 dist-xz])
|
||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
|
@ -18,36 +18,10 @@ PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
### Checks for programs
|
### Checks for programs
|
||||||
|
|
||||||
AC_ISC_POSIX
|
|
||||||
m4_ifdef([AC_PROG_OBJC],
|
|
||||||
[
|
|
||||||
AC_PROG_OBJC
|
|
||||||
_AM_DEPENDENCIES(OBJC)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
AC_CHECK_TOOL([OBJC], [gcc])
|
|
||||||
AC_SUBST([OBJC])
|
|
||||||
AC_SUBST([OBJCFLAGS])
|
|
||||||
]
|
|
||||||
)
|
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
||||||
LT_PROG_RC
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for libraries
|
### Checks for libraries
|
||||||
|
|
||||||
# Evil library for compilation on Windows
|
|
||||||
|
|
||||||
case "$host_os" in
|
|
||||||
mingw32*)
|
|
||||||
PKG_CHECK_MODULES([EVIL], [evil >= 1.7.99])
|
|
||||||
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# EFL dependencies
|
# EFL dependencies
|
||||||
efl_version="1.23.0"
|
efl_version="1.23.0"
|
||||||
requirement_expedite=" \
|
requirement_expedite=" \
|
||||||
|
@ -66,20 +40,14 @@ PKG_CHECK_MODULES([EFL], [${requirement_expedite}])
|
||||||
EFL_ENABLE_EO_API_SUPPORT
|
EFL_ENABLE_EO_API_SUPPORT
|
||||||
EFL_ENABLE_BETA_API_SUPPORT
|
EFL_ENABLE_BETA_API_SUPPORT
|
||||||
|
|
||||||
|
|
||||||
### Checks for header files
|
### Checks for header files
|
||||||
|
|
||||||
|
|
||||||
### Checks for types
|
### Checks for types
|
||||||
|
|
||||||
|
|
||||||
### Checks for structures
|
### Checks for structures
|
||||||
|
|
||||||
|
|
||||||
### Checks for compiler characteristics
|
### Checks for compiler characteristics
|
||||||
|
|
||||||
AC_HEADER_STDC
|
|
||||||
AC_C_CONST
|
|
||||||
AC_PROG_CC_C99
|
AC_PROG_CC_C99
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
AC_C___ATTRIBUTE__
|
AC_C___ATTRIBUTE__
|
||||||
|
@ -88,43 +56,8 @@ if test "x${ac_cv_prog_cc_c99}" = "xno" ; then
|
||||||
AC_MSG_ERROR([expedite requires a c99-capable compiler])
|
AC_MSG_ERROR([expedite requires a c99-capable compiler])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
WIN32_CFLAGS=""
|
|
||||||
case "$host_os" in
|
|
||||||
cegcc*)
|
|
||||||
WIN32_CFLAGS="-mwin32"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_SUBST(WIN32_CFLAGS)
|
|
||||||
|
|
||||||
EXPEDITE_CXXFLAGS=""
|
|
||||||
AC_LANG_PUSH([C++])
|
|
||||||
CXXFLAGS_save="${CXXFLAGS}"
|
|
||||||
CXXFLAGS="${CXXFLAGS} -fno-rtti -fno-exceptions"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([[]])],
|
|
||||||
[have_cxx_flags="yes"],
|
|
||||||
[have_cxx_flags="no"])
|
|
||||||
AC_MSG_CHECKING([whether the compiler supports -fno-rtti -fno-exceptions])
|
|
||||||
AC_MSG_RESULT([${have_cxx_flags}])
|
|
||||||
CXXFLAGS="${CXXFLAGS_save}"
|
|
||||||
if test "x${have_cxx_flags}" = "xyes" ; then
|
|
||||||
EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions"
|
|
||||||
fi
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
AC_SUBST(EXPEDITE_CXXFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for linker characteristics
|
### Checks for linker characteristics
|
||||||
|
|
||||||
lt_enable_auto_import=""
|
|
||||||
case "$host_os" in
|
|
||||||
mingw* | cegcc*)
|
|
||||||
lt_enable_auto_import="-Wl,--enable-auto-import"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
AC_SUBST(lt_enable_auto_import)
|
|
||||||
|
|
||||||
|
|
||||||
### Checks for library functions
|
### Checks for library functions
|
||||||
|
|
||||||
AC_CHECK_FUNCS([sync])
|
AC_CHECK_FUNCS([sync])
|
||||||
|
|
|
@ -6,8 +6,7 @@ AM_CPPFLAGS = \
|
||||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
||||||
@EFL_CFLAGS@ \
|
@EFL_CFLAGS@
|
||||||
@EVIL_CFLAGS@
|
|
||||||
|
|
||||||
bin_PROGRAMS = expedite
|
bin_PROGRAMS = expedite
|
||||||
bin_SCRIPTS = expedite-cmp
|
bin_SCRIPTS = expedite-cmp
|
||||||
|
@ -140,12 +139,6 @@ snapshot_widgets_file_icons.c
|
||||||
# image_mask_14.c \
|
# image_mask_14.c \
|
||||||
# image_mask_15.c
|
# image_mask_15.c
|
||||||
|
|
||||||
expedite_CFLAGS = @WIN32_CFLAGS@
|
expedite_LDADD = @EFL_LIBS@ -lm
|
||||||
expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@
|
|
||||||
expedite_LDADD = @EFL_LIBS@ @EVIL_LIBS@ -lm
|
|
||||||
expedite_LDFLAGS = @lt_enable_auto_import@
|
|
||||||
|
|
||||||
.rc.lo:
|
|
||||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@
|
|
||||||
|
|
||||||
EXTRA_DIST = $(bin_SCRIPTS)
|
EXTRA_DIST = $(bin_SCRIPTS)
|
||||||
|
|
|
@ -1,288 +0,0 @@
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
#include <windowsx.h>
|
|
||||||
#include <Evas_Engine_Direct3D.h>
|
|
||||||
|
|
||||||
|
|
||||||
static HWND window;
|
|
||||||
static HINSTANCE instance;
|
|
||||||
|
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
|
||||||
MainWndProc(HWND hwnd,
|
|
||||||
UINT uMsg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_CREATE:
|
|
||||||
return 0;
|
|
||||||
case WM_DESTROY:
|
|
||||||
PostQuitMessage(0);
|
|
||||||
return 0;
|
|
||||||
case WM_CLOSE:
|
|
||||||
PostQuitMessage(0);
|
|
||||||
return 0;
|
|
||||||
case WM_PAINT: {
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
hdc = BeginPaint (window, &ps);
|
|
||||||
evas_damage_rectangle_add(evas,
|
|
||||||
ps.rcPaint.left, ps.rcPaint.top,
|
|
||||||
ps.rcPaint.right - ps.rcPaint.left,
|
|
||||||
ps.rcPaint.bottom - ps.rcPaint.top);
|
|
||||||
EndPaint(window, &ps);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case WM_SIZING:
|
|
||||||
{
|
|
||||||
PRECT rect = (PRECT)lParam;
|
|
||||||
|
|
||||||
evas_output_viewport_set(evas, 0, 0,
|
|
||||||
rect->right - rect->left,
|
|
||||||
rect->bottom - rect->top);
|
|
||||||
evas_output_size_set(evas,
|
|
||||||
rect->right - rect->left,
|
|
||||||
rect->bottom - rect->top);
|
|
||||||
win_w = rect->right - rect->left;
|
|
||||||
win_h = rect->bottom - rect->top;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case WM_RBUTTONDOWN:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_LBUTTONDOWN:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_LBUTTONUP:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_RBUTTONUP:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_MOUSELEAVE:
|
|
||||||
evas_event_feed_mouse_out(evas, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
/* FIXME : can't find an event when the mouse is entering */
|
|
||||||
case WM_KEYDOWN:
|
|
||||||
case WM_SYSKEYDOWN: {
|
|
||||||
int key;
|
|
||||||
|
|
||||||
key = LOWORD(wParam);
|
|
||||||
|
|
||||||
if ((key == VK_SHIFT) ||
|
|
||||||
(key == VK_LSHIFT) ||
|
|
||||||
(key == VK_RSHIFT))
|
|
||||||
evas_key_modifier_on(evas, "Shift");
|
|
||||||
if ((key == VK_CONTROL) ||
|
|
||||||
(key == VK_LCONTROL) ||
|
|
||||||
(key == VK_RCONTROL))
|
|
||||||
evas_key_modifier_on(evas, "Control");
|
|
||||||
if ((key == VK_MENU) ||
|
|
||||||
(key == VK_LMENU) ||
|
|
||||||
(key == VK_RMENU))
|
|
||||||
evas_key_modifier_on(evas, "Alt");
|
|
||||||
if ((key == VK_LWIN) ||
|
|
||||||
(key == VK_RWIN))
|
|
||||||
evas_key_modifier_on(evas, "Super");
|
|
||||||
|
|
||||||
if (key == VK_CAPITAL)
|
|
||||||
{
|
|
||||||
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
|
|
||||||
evas_key_lock_off(evas, "Caps_Lock");
|
|
||||||
else
|
|
||||||
evas_key_lock_on(evas, "Caps_Lock");
|
|
||||||
}
|
|
||||||
if (key == VK_NUMLOCK)
|
|
||||||
{
|
|
||||||
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
|
|
||||||
evas_key_lock_off(evas, "Num_Lock");
|
|
||||||
else
|
|
||||||
evas_key_lock_on(evas, "Num_Lock");
|
|
||||||
}
|
|
||||||
if (key == VK_SCROLL)
|
|
||||||
{
|
|
||||||
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
|
|
||||||
evas_key_lock_off(evas, "Scroll_Lock");
|
|
||||||
else
|
|
||||||
evas_key_lock_on(evas, "Scroll_Lock");
|
|
||||||
}
|
|
||||||
if (key == VK_ESCAPE)
|
|
||||||
evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RETURN)
|
|
||||||
evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_LEFT)
|
|
||||||
evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RIGHT)
|
|
||||||
evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 81)
|
|
||||||
evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 113)
|
|
||||||
evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case WM_KEYUP:
|
|
||||||
case WM_SYSKEYUP: {
|
|
||||||
int key;
|
|
||||||
|
|
||||||
key = LOWORD(wParam);
|
|
||||||
|
|
||||||
if ((key == VK_SHIFT) ||
|
|
||||||
(key == VK_LSHIFT) ||
|
|
||||||
(key == VK_RSHIFT))
|
|
||||||
evas_key_modifier_off(evas, "Shift");
|
|
||||||
if ((key == VK_CONTROL) ||
|
|
||||||
(key == VK_LCONTROL) ||
|
|
||||||
(key == VK_RCONTROL))
|
|
||||||
evas_key_modifier_off(evas, "Control");
|
|
||||||
if ((key == VK_MENU) ||
|
|
||||||
(key == VK_LMENU) ||
|
|
||||||
(key == VK_RMENU))
|
|
||||||
evas_key_modifier_off(evas, "Alt");
|
|
||||||
if ((key == VK_LWIN) ||
|
|
||||||
(key == VK_RWIN))
|
|
||||||
evas_key_modifier_off(evas, "Super");
|
|
||||||
if (key == VK_ESCAPE)
|
|
||||||
evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RETURN)
|
|
||||||
evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_LEFT)
|
|
||||||
evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RIGHT)
|
|
||||||
evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 81)
|
|
||||||
evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 113)
|
|
||||||
evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
engine_direct3d_args(const char *engine, int width, int height)
|
|
||||||
{
|
|
||||||
WNDCLASS wc;
|
|
||||||
RECT rect;
|
|
||||||
HDC dc;
|
|
||||||
MSG msg;
|
|
||||||
Evas_Engine_Info_Direct3D *einfo;
|
|
||||||
DWORD style;
|
|
||||||
int depth;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
instance = GetModuleHandle(NULL);
|
|
||||||
if (!instance) return EINA_FALSE;
|
|
||||||
|
|
||||||
wc.style = 0;
|
|
||||||
wc.lpfnWndProc = MainWndProc;
|
|
||||||
wc.cbClsExtra = 0;
|
|
||||||
wc.cbWndExtra = 0;
|
|
||||||
wc.hInstance = instance;
|
|
||||||
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
|
|
||||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
||||||
wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
|
|
||||||
wc.lpszMenuName = NULL;
|
|
||||||
wc.lpszClassName = "Evas_Direct3D_Test";
|
|
||||||
|
|
||||||
if(!RegisterClass(&wc))
|
|
||||||
goto free_library;
|
|
||||||
|
|
||||||
rect.left = 0;
|
|
||||||
rect.top = 0;
|
|
||||||
rect.right = width;
|
|
||||||
rect.bottom = height;
|
|
||||||
AdjustWindowRect (&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE);
|
|
||||||
|
|
||||||
window = CreateWindowEx(0,
|
|
||||||
"Evas_Direct3D_Test",
|
|
||||||
"Evas_Direct3D_Test",
|
|
||||||
WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
rect.right - rect.left, rect.bottom - rect.top,
|
|
||||||
NULL, NULL, instance, NULL);
|
|
||||||
if (!window)
|
|
||||||
goto unregister_class;
|
|
||||||
|
|
||||||
/* make the window non resizable */
|
|
||||||
style = GetWindowLong(window, GWL_STYLE);
|
|
||||||
style &= ~WS_THICKFRAME;
|
|
||||||
if (!SetWindowLong(window, GWL_STYLE, style))
|
|
||||||
goto unregister_class;
|
|
||||||
|
|
||||||
dc = GetDC(NULL);
|
|
||||||
if (!dc)
|
|
||||||
goto destroy_window;
|
|
||||||
|
|
||||||
depth = GetDeviceCaps(dc, BITSPIXEL);
|
|
||||||
ReleaseDC(NULL, dc);
|
|
||||||
|
|
||||||
evas_output_method_set(evas, evas_render_method_lookup("direct3d"));
|
|
||||||
einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(evas);
|
|
||||||
if (!einfo)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Evas does not support the Direct3D Engine\n");
|
|
||||||
goto destroy_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
einfo->info.window = window;
|
|
||||||
einfo->info.depth = depth;
|
|
||||||
einfo->info.rotation = 0;
|
|
||||||
if (!evas_engine_info_set(evas, (Evas_Engine_Info *)einfo))
|
|
||||||
{
|
|
||||||
printf("Evas can not setup the informations of the Direct3D Engine\n");
|
|
||||||
goto destroy_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the second parameter is ignored, as it's the first call of ShowWindow */
|
|
||||||
ShowWindow(window, SW_SHOWDEFAULT);
|
|
||||||
UpdateWindow(window);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
|
|
||||||
destroy_window:
|
|
||||||
DestroyWindow(window);
|
|
||||||
unregister_class:
|
|
||||||
UnregisterClass("Evas_Direct3D_Test", instance);
|
|
||||||
free_library:
|
|
||||||
FreeLibrary(instance);
|
|
||||||
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
engine_direct3d_loop(void)
|
|
||||||
{
|
|
||||||
MSG msg;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
again:
|
|
||||||
if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
res = GetMessage (&msg, NULL, 0, 0);
|
|
||||||
TranslateMessage (&msg);
|
|
||||||
DispatchMessage (&msg);
|
|
||||||
|
|
||||||
goto again;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
engine_direct3d_shutdown(void)
|
|
||||||
{
|
|
||||||
DestroyWindow(window);
|
|
||||||
UnregisterClass("Evas_Direct3D_Test", instance);
|
|
||||||
FreeLibrary(instance);
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
HI_RES_AWARE CEUX {1}
|
|
|
@ -1,291 +0,0 @@
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
#include <windowsx.h>
|
|
||||||
#include <Evas_Engine_Software_DDraw.h>
|
|
||||||
|
|
||||||
|
|
||||||
static HWND window;
|
|
||||||
static HINSTANCE instance;
|
|
||||||
|
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
|
||||||
MainWndProc(HWND hwnd,
|
|
||||||
UINT uMsg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_CREATE:
|
|
||||||
return 0;
|
|
||||||
case WM_DESTROY:
|
|
||||||
PostQuitMessage(0);
|
|
||||||
return 0;
|
|
||||||
case WM_CLOSE:
|
|
||||||
PostQuitMessage(0);
|
|
||||||
return 0;
|
|
||||||
case WM_WINDOWPOSCHANGED: {
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
hdc = BeginPaint (window, &ps);
|
|
||||||
evas_damage_rectangle_add(evas,
|
|
||||||
ps.rcPaint.left, ps.rcPaint.top,
|
|
||||||
ps.rcPaint.right - ps.rcPaint.left,
|
|
||||||
ps.rcPaint.bottom - ps.rcPaint.top);
|
|
||||||
EndPaint(window, &ps);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case WM_SIZING:
|
|
||||||
{
|
|
||||||
PRECT rect = (PRECT)lParam;
|
|
||||||
|
|
||||||
evas_output_viewport_set(evas, 0, 0,
|
|
||||||
rect->right - rect->left,
|
|
||||||
rect->bottom - rect->top);
|
|
||||||
evas_output_size_set(evas,
|
|
||||||
rect->right - rect->left,
|
|
||||||
rect->bottom - rect->top);
|
|
||||||
win_w = rect->right - rect->left;
|
|
||||||
win_h = rect->bottom - rect->top;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case WM_RBUTTONDOWN:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_LBUTTONDOWN:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_LBUTTONUP:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_RBUTTONUP:
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
|
|
||||||
evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
|
|
||||||
return 0;
|
|
||||||
case WM_MOUSELEAVE:
|
|
||||||
evas_event_feed_mouse_out(evas, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
/* FIXME : can't find an event when the mouse is entering */
|
|
||||||
case WM_KEYDOWN:
|
|
||||||
case WM_SYSKEYDOWN: {
|
|
||||||
int key;
|
|
||||||
|
|
||||||
key = LOWORD(wParam);
|
|
||||||
|
|
||||||
if ((key == VK_SHIFT) ||
|
|
||||||
(key == VK_LSHIFT) ||
|
|
||||||
(key == VK_RSHIFT))
|
|
||||||
evas_key_modifier_on(evas, "Shift");
|
|
||||||
if ((key == VK_CONTROL) ||
|
|
||||||
(key == VK_LCONTROL) ||
|
|
||||||
(key == VK_RCONTROL))
|
|
||||||
evas_key_modifier_on(evas, "Control");
|
|
||||||
if ((key == VK_MENU) ||
|
|
||||||
(key == VK_LMENU) ||
|
|
||||||
(key == VK_RMENU))
|
|
||||||
evas_key_modifier_on(evas, "Alt");
|
|
||||||
if ((key == VK_LWIN) ||
|
|
||||||
(key == VK_RWIN))
|
|
||||||
evas_key_modifier_on(evas, "Super");
|
|
||||||
|
|
||||||
if (key == VK_CAPITAL)
|
|
||||||
{
|
|
||||||
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
|
|
||||||
evas_key_lock_off(evas, "Caps_Lock");
|
|
||||||
else
|
|
||||||
evas_key_lock_on(evas, "Caps_Lock");
|
|
||||||
}
|
|
||||||
if (key == VK_NUMLOCK)
|
|
||||||
{
|
|
||||||
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
|
|
||||||
evas_key_lock_off(evas, "Num_Lock");
|
|
||||||
else
|
|
||||||
evas_key_lock_on(evas, "Num_Lock");
|
|
||||||
}
|
|
||||||
if (key == VK_SCROLL)
|
|
||||||
{
|
|
||||||
if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
|
|
||||||
evas_key_lock_off(evas, "Scroll_Lock");
|
|
||||||
else
|
|
||||||
evas_key_lock_on(evas, "Scroll_Lock");
|
|
||||||
}
|
|
||||||
if (key == VK_ESCAPE)
|
|
||||||
evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RETURN)
|
|
||||||
evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_LEFT)
|
|
||||||
evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RIGHT)
|
|
||||||
evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 81)
|
|
||||||
evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 113)
|
|
||||||
evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case WM_KEYUP:
|
|
||||||
case WM_SYSKEYUP: {
|
|
||||||
int key;
|
|
||||||
|
|
||||||
key = LOWORD(wParam);
|
|
||||||
|
|
||||||
if ((key == VK_SHIFT) ||
|
|
||||||
(key == VK_LSHIFT) ||
|
|
||||||
(key == VK_RSHIFT))
|
|
||||||
evas_key_modifier_off(evas, "Shift");
|
|
||||||
if ((key == VK_CONTROL) ||
|
|
||||||
(key == VK_LCONTROL) ||
|
|
||||||
(key == VK_RCONTROL))
|
|
||||||
evas_key_modifier_off(evas, "Control");
|
|
||||||
if ((key == VK_MENU) ||
|
|
||||||
(key == VK_LMENU) ||
|
|
||||||
(key == VK_RMENU))
|
|
||||||
evas_key_modifier_off(evas, "Alt");
|
|
||||||
if ((key == VK_LWIN) ||
|
|
||||||
(key == VK_RWIN))
|
|
||||||
evas_key_modifier_off(evas, "Super");
|
|
||||||
if (key == VK_ESCAPE)
|
|
||||||
evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RETURN)
|
|
||||||
evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_LEFT)
|
|
||||||
evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
|
|
||||||
if (key == VK_RIGHT)
|
|
||||||
evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 81)
|
|
||||||
evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
|
|
||||||
if (key == 113)
|
|
||||||
evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
engine_software_ddraw_args(const char *engine, int width, int height)
|
|
||||||
{
|
|
||||||
WNDCLASS wc;
|
|
||||||
RECT rect;
|
|
||||||
HDC dc;
|
|
||||||
Evas_Engine_Info_Software_DDraw *einfo;
|
|
||||||
DWORD style;
|
|
||||||
DWORD exstyle;
|
|
||||||
int depth;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
instance = GetModuleHandle(NULL);
|
|
||||||
if (!instance) return 0;
|
|
||||||
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
|
||||||
wc.lpfnWndProc = MainWndProc;
|
|
||||||
wc.cbClsExtra = 0;
|
|
||||||
wc.cbWndExtra = 0;
|
|
||||||
wc.hInstance = instance;
|
|
||||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
|
||||||
wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
|
|
||||||
wc.lpszMenuName = NULL;
|
|
||||||
wc.lpszClassName = "Evas_Software_DDraw_Test";
|
|
||||||
|
|
||||||
if(!RegisterClass(&wc))
|
|
||||||
goto free_library;
|
|
||||||
|
|
||||||
style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
|
|
||||||
exstyle = 0;
|
|
||||||
|
|
||||||
rect.left = 0;
|
|
||||||
rect.top = 0;
|
|
||||||
rect.right = width;
|
|
||||||
rect.bottom = height;
|
|
||||||
AdjustWindowRectEx (&rect, style, FALSE, exstyle);
|
|
||||||
|
|
||||||
window = CreateWindowEx(exstyle,
|
|
||||||
"Evas_Software_DDraw_Test",
|
|
||||||
"Evas_Software_DDraw_Test",
|
|
||||||
style,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
rect.right - rect.left, rect.bottom - rect.top,
|
|
||||||
NULL, NULL, instance, NULL);
|
|
||||||
if (!window)
|
|
||||||
goto unregister_class;
|
|
||||||
|
|
||||||
/* make the window non resizable */
|
|
||||||
style = GetWindowLong(window, GWL_STYLE);
|
|
||||||
style &= ~WS_THICKFRAME;
|
|
||||||
if (!SetWindowLong(window, GWL_STYLE, style))
|
|
||||||
goto destroy_window;
|
|
||||||
|
|
||||||
dc = GetDC(NULL);
|
|
||||||
if (!dc)
|
|
||||||
goto destroy_window;
|
|
||||||
|
|
||||||
depth = GetDeviceCaps(dc, BITSPIXEL);
|
|
||||||
ReleaseDC(NULL, dc);
|
|
||||||
|
|
||||||
evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
|
|
||||||
einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(evas);
|
|
||||||
if (!einfo)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Evas does not support the Software DirectDraw Engine\n");
|
|
||||||
goto destroy_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
einfo->info.window = window;
|
|
||||||
einfo->info.depth = depth;
|
|
||||||
einfo->info.rotation = 0;
|
|
||||||
if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
|
|
||||||
{
|
|
||||||
printf("Evas can not setup the informations of the Software DirectDraw Engine\n");
|
|
||||||
goto destroy_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the second parameter is ignored, as it's the first call of ShowWindow */
|
|
||||||
ShowWindow(window, SW_SHOWDEFAULT);
|
|
||||||
UpdateWindow(window);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
destroy_window:
|
|
||||||
DestroyWindow(window);
|
|
||||||
unregister_class:
|
|
||||||
UnregisterClass("Evas_Software_DDraw_Test", instance);
|
|
||||||
free_library:
|
|
||||||
FreeLibrary(instance);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
engine_software_ddraw_loop(void)
|
|
||||||
{
|
|
||||||
MSG msg;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
again:
|
|
||||||
if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
res = GetMessage (&msg, NULL, 0, 0);
|
|
||||||
TranslateMessage (&msg);
|
|
||||||
DispatchMessage (&msg);
|
|
||||||
|
|
||||||
goto again;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
engine_software_ddraw_shutdown(void)
|
|
||||||
{
|
|
||||||
DestroyWindow(window);
|
|
||||||
UnregisterClass("Evas_Software_DDraw_Test", instance);
|
|
||||||
FreeLibrary(instance);
|
|
||||||
}
|
|
|
@ -20,14 +20,6 @@
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
# include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_EVIL
|
|
||||||
# include <Evil.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue