summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2020-07-07 13:39:31 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-07-07 13:39:31 +0100
commit7c4bebe47e1f6a7dfee8d370e53bbc61e47025e0 (patch)
tree84ab6189a5ff8af223a66da338a2864f014e405b
parentd6a3eb3dec95730074bcd64df66261072bfc9111 (diff)
Windows: remove Evil dependency, general cleanup for Windows
Test Plan: compilation and execution Reviewers: raster Differential Revision: https://phab.enlightenment.org/D12039
-rw-r--r--configure.ac69
-rw-r--r--src/bin/Makefile.am11
-rw-r--r--src/bin/engine_direct3d.cpp288
-rw-r--r--src/bin/engine_software_16_wince.rc1
-rw-r--r--src/bin/engine_software_ddraw.cpp291
-rw-r--r--src/bin/main.h8
6 files changed, 3 insertions, 665 deletions
diff --git a/configure.ac b/configure.ac
index e22bdd8..b63a19a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@ AC_CONFIG_HEADERS([config.h])
10AC_CANONICAL_BUILD 10AC_CANONICAL_BUILD
11AC_CANONICAL_HOST 11AC_CANONICAL_HOST
12 12
13AM_INIT_AUTOMAKE([1.6 dist-bzip2]) 13AM_INIT_AUTOMAKE([1.6 dist-xz])
14m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 14m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
15 15
16PKG_PROG_PKG_CONFIG 16PKG_PROG_PKG_CONFIG
@@ -18,36 +18,10 @@ PKG_PROG_PKG_CONFIG
18 18
19### Checks for programs 19### Checks for programs
20 20
21AC_ISC_POSIX
22m4_ifdef([AC_PROG_OBJC],
23 [
24 AC_PROG_OBJC
25 _AM_DEPENDENCIES(OBJC)
26 ],
27 [
28 AC_CHECK_TOOL([OBJC], [gcc])
29 AC_SUBST([OBJC])
30 AC_SUBST([OBJCFLAGS])
31 ]
32)
33AC_PROG_CXX
34AC_PROG_CC 21AC_PROG_CC
35 22
36LT_PROG_RC
37
38
39
40### Checks for libraries 23### Checks for libraries
41 24
42# Evil library for compilation on Windows
43
44case "$host_os" in
45 mingw32*)
46 PKG_CHECK_MODULES([EVIL], [evil >= 1.7.99])
47 AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
48 ;;
49esac
50
51# EFL dependencies 25# EFL dependencies
52efl_version="1.23.0" 26efl_version="1.23.0"
53requirement_expedite=" \ 27requirement_expedite=" \
@@ -66,20 +40,14 @@ PKG_CHECK_MODULES([EFL], [${requirement_expedite}])
66EFL_ENABLE_EO_API_SUPPORT 40EFL_ENABLE_EO_API_SUPPORT
67EFL_ENABLE_BETA_API_SUPPORT 41EFL_ENABLE_BETA_API_SUPPORT
68 42
69
70### Checks for header files 43### Checks for header files
71 44
72
73### Checks for types 45### Checks for types
74 46
75
76### Checks for structures 47### Checks for structures
77 48
78
79### Checks for compiler characteristics 49### Checks for compiler characteristics
80 50
81AC_HEADER_STDC
82AC_C_CONST
83AC_PROG_CC_C99 51AC_PROG_CC_C99
84AM_PROG_CC_C_O 52AM_PROG_CC_C_O
85AC_C___ATTRIBUTE__ 53AC_C___ATTRIBUTE__
@@ -88,43 +56,8 @@ if test "x${ac_cv_prog_cc_c99}" = "xno" ; then
88 AC_MSG_ERROR([expedite requires a c99-capable compiler]) 56 AC_MSG_ERROR([expedite requires a c99-capable compiler])
89fi 57fi
90 58
91WIN32_CFLAGS=""
92case "$host_os" in
93 cegcc*)
94 WIN32_CFLAGS="-mwin32"
95 ;;
96esac
97AC_SUBST(WIN32_CFLAGS)
98
99EXPEDITE_CXXFLAGS=""
100AC_LANG_PUSH([C++])
101CXXFLAGS_save="${CXXFLAGS}"
102CXXFLAGS="${CXXFLAGS} -fno-rtti -fno-exceptions"
103AC_LINK_IFELSE(
104 [AC_LANG_PROGRAM([[]])],
105 [have_cxx_flags="yes"],
106 [have_cxx_flags="no"])
107AC_MSG_CHECKING([whether the compiler supports -fno-rtti -fno-exceptions])
108AC_MSG_RESULT([${have_cxx_flags}])
109CXXFLAGS="${CXXFLAGS_save}"
110if test "x${have_cxx_flags}" = "xyes" ; then
111 EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions"
112fi
113AC_LANG_POP([C++])
114AC_SUBST(EXPEDITE_CXXFLAGS)
115
116
117### Checks for linker characteristics 59### Checks for linker characteristics
118 60
119lt_enable_auto_import=""
120case "$host_os" in
121 mingw* | cegcc*)
122 lt_enable_auto_import="-Wl,--enable-auto-import"
123 ;;
124esac
125AC_SUBST(lt_enable_auto_import)
126
127
128### Checks for library functions 61### Checks for library functions
129 62
130AC_CHECK_FUNCS([sync]) 63AC_CHECK_FUNCS([sync])
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 2aee821..47fab63 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -6,8 +6,7 @@ AM_CPPFLAGS = \
6-DPACKAGE_BIN_DIR=\"$(bindir)\" \ 6-DPACKAGE_BIN_DIR=\"$(bindir)\" \
7-DPACKAGE_LIB_DIR=\"$(libdir)\" \ 7-DPACKAGE_LIB_DIR=\"$(libdir)\" \
8-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ 8-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
9@EFL_CFLAGS@ \ 9@EFL_CFLAGS@
10@EVIL_CFLAGS@
11 10
12bin_PROGRAMS = expedite 11bin_PROGRAMS = expedite
13bin_SCRIPTS = expedite-cmp 12bin_SCRIPTS = expedite-cmp
@@ -140,12 +139,6 @@ snapshot_widgets_file_icons.c
140# image_mask_14.c \ 139# image_mask_14.c \
141# image_mask_15.c 140# image_mask_15.c
142 141
143expedite_CFLAGS = @WIN32_CFLAGS@ 142expedite_LDADD = @EFL_LIBS@ -lm
144expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@
145expedite_LDADD = @EFL_LIBS@ @EVIL_LIBS@ -lm
146expedite_LDFLAGS = @lt_enable_auto_import@
147
148.rc.lo:
149 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) $< -o $@
150 143
151EXTRA_DIST = $(bin_SCRIPTS) 144EXTRA_DIST = $(bin_SCRIPTS)
diff --git a/src/bin/engine_direct3d.cpp b/src/bin/engine_direct3d.cpp
deleted file mode 100644
index 1e3b4ab..0000000
--- a/src/bin/engine_direct3d.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
1#include "main.h"
2
3#include <windowsx.h>
4#include <Evas_Engine_Direct3D.h>
5
6
7static HWND window;
8static HINSTANCE instance;
9
10
11static LRESULT CALLBACK
12MainWndProc(HWND hwnd,
13 UINT uMsg,
14 WPARAM wParam,
15 LPARAM lParam)
16{
17 switch (uMsg)
18 {
19 case WM_CREATE:
20 return 0;
21 case WM_DESTROY:
22 PostQuitMessage(0);
23 return 0;
24 case WM_CLOSE:
25 PostQuitMessage(0);
26 return 0;
27 case WM_PAINT: {
28 PAINTSTRUCT ps;
29 HDC hdc;
30
31 hdc = BeginPaint (window, &ps);
32 evas_damage_rectangle_add(evas,
33 ps.rcPaint.left, ps.rcPaint.top,
34 ps.rcPaint.right - ps.rcPaint.left,
35 ps.rcPaint.bottom - ps.rcPaint.top);
36 EndPaint(window, &ps);
37 return 0;
38 }
39 case WM_SIZING:
40 {
41 PRECT rect = (PRECT)lParam;
42
43 evas_output_viewport_set(evas, 0, 0,
44 rect->right - rect->left,
45 rect->bottom - rect->top);
46 evas_output_size_set(evas,
47 rect->right - rect->left,
48 rect->bottom - rect->top);
49 win_w = rect->right - rect->left;
50 win_h = rect->bottom - rect->top;
51 return 0;
52 }
53 case WM_RBUTTONDOWN:
54 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
55 evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
56 return 0;
57 case WM_LBUTTONDOWN:
58 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
59 evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
60 return 0;
61 case WM_LBUTTONUP:
62 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
63 evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
64 return 0;
65 case WM_RBUTTONUP:
66 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
67 evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
68 return 0;
69 case WM_MOUSEMOVE:
70 if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
71 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
72 return 0;
73 case WM_MOUSELEAVE:
74 evas_event_feed_mouse_out(evas, 0, NULL);
75 return 0;
76 /* FIXME : can't find an event when the mouse is entering */
77 case WM_KEYDOWN:
78 case WM_SYSKEYDOWN: {
79 int key;
80
81 key = LOWORD(wParam);
82
83 if ((key == VK_SHIFT) ||
84 (key == VK_LSHIFT) ||
85 (key == VK_RSHIFT))
86 evas_key_modifier_on(evas, "Shift");
87 if ((key == VK_CONTROL) ||
88 (key == VK_LCONTROL) ||
89 (key == VK_RCONTROL))
90 evas_key_modifier_on(evas, "Control");
91 if ((key == VK_MENU) ||
92 (key == VK_LMENU) ||
93 (key == VK_RMENU))
94 evas_key_modifier_on(evas, "Alt");
95 if ((key == VK_LWIN) ||
96 (key == VK_RWIN))
97 evas_key_modifier_on(evas, "Super");
98
99 if (key == VK_CAPITAL)
100 {
101 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
102 evas_key_lock_off(evas, "Caps_Lock");
103 else
104 evas_key_lock_on(evas, "Caps_Lock");
105 }
106 if (key == VK_NUMLOCK)
107 {
108 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
109 evas_key_lock_off(evas, "Num_Lock");
110 else
111 evas_key_lock_on(evas, "Num_Lock");
112 }
113 if (key == VK_SCROLL)
114 {
115 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
116 evas_key_lock_off(evas, "Scroll_Lock");
117 else
118 evas_key_lock_on(evas, "Scroll_Lock");
119 }
120 if (key == VK_ESCAPE)
121 evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
122 if (key == VK_RETURN)
123 evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
124 if (key == VK_LEFT)
125 evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
126 if (key == VK_RIGHT)
127 evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
128 if (key == 81)
129 evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
130 if (key == 113)
131 evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
132 return 0;
133 }
134 case WM_KEYUP:
135 case WM_SYSKEYUP: {
136 int key;
137
138 key = LOWORD(wParam);
139
140 if ((key == VK_SHIFT) ||
141 (key == VK_LSHIFT) ||
142 (key == VK_RSHIFT))
143 evas_key_modifier_off(evas, "Shift");
144 if ((key == VK_CONTROL) ||
145 (key == VK_LCONTROL) ||
146 (key == VK_RCONTROL))
147 evas_key_modifier_off(evas, "Control");
148 if ((key == VK_MENU) ||
149 (key == VK_LMENU) ||
150 (key == VK_RMENU))
151 evas_key_modifier_off(evas, "Alt");
152 if ((key == VK_LWIN) ||
153 (key == VK_RWIN))
154 evas_key_modifier_off(evas, "Super");
155 if (key == VK_ESCAPE)
156 evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
157 if (key == VK_RETURN)
158 evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
159 if (key == VK_LEFT)
160 evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
161 if (key == VK_RIGHT)
162 evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
163 if (key == 81)
164 evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
165 if (key == 113)
166 evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
167 return 0;
168 }
169 default:
170 return DefWindowProc(hwnd, uMsg, wParam, lParam);
171 }
172}
173
174Eina_Bool
175engine_direct3d_args(const char *engine, int width, int height)
176{
177 WNDCLASS wc;
178 RECT rect;
179 HDC dc;
180 MSG msg;
181 Evas_Engine_Info_Direct3D *einfo;
182 DWORD style;
183 int depth;
184 int i;
185
186 instance = GetModuleHandle(NULL);
187 if (!instance) return EINA_FALSE;
188
189 wc.style = 0;
190 wc.lpfnWndProc = MainWndProc;
191 wc.cbClsExtra = 0;
192 wc.cbWndExtra = 0;
193 wc.hInstance = instance;
194 wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
195 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
196 wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
197 wc.lpszMenuName = NULL;
198 wc.lpszClassName = "Evas_Direct3D_Test";
199
200 if(!RegisterClass(&wc))
201 goto free_library;
202
203 rect.left = 0;
204 rect.top = 0;
205 rect.right = width;
206 rect.bottom = height;
207 AdjustWindowRect (&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE);
208
209 window = CreateWindowEx(0,
210 "Evas_Direct3D_Test",
211 "Evas_Direct3D_Test",
212 WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
213 CW_USEDEFAULT, CW_USEDEFAULT,
214 rect.right - rect.left, rect.bottom - rect.top,
215 NULL, NULL, instance, NULL);
216 if (!window)
217 goto unregister_class;
218
219 /* make the window non resizable */
220 style = GetWindowLong(window, GWL_STYLE);
221 style &= ~WS_THICKFRAME;
222 if (!SetWindowLong(window, GWL_STYLE, style))
223 goto unregister_class;
224
225 dc = GetDC(NULL);
226 if (!dc)
227 goto destroy_window;
228
229 depth = GetDeviceCaps(dc, BITSPIXEL);
230 ReleaseDC(NULL, dc);
231
232 evas_output_method_set(evas, evas_render_method_lookup("direct3d"));
233 einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(evas);
234 if (!einfo)
235 {
236 fprintf(stderr, "Evas does not support the Direct3D Engine\n");
237 goto destroy_window;
238 }
239
240 einfo->info.window = window;
241 einfo->info.depth = depth;
242 einfo->info.rotation = 0;
243 if (!evas_engine_info_set(evas, (Evas_Engine_Info *)einfo))
244 {
245 printf("Evas can not setup the informations of the Direct3D Engine\n");
246 goto destroy_window;
247 }
248
249 /* the second parameter is ignored, as it's the first call of ShowWindow */
250 ShowWindow(window, SW_SHOWDEFAULT);
251 UpdateWindow(window);
252
253 return EINA_TRUE;
254
255 destroy_window:
256 DestroyWindow(window);
257 unregister_class:
258 UnregisterClass("Evas_Direct3D_Test", instance);
259 free_library:
260 FreeLibrary(instance);
261
262 return EINA_FALSE;
263}
264
265void
266engine_direct3d_loop(void)
267{
268 MSG msg;
269 int res;
270
271 again:
272 if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
273 return;
274
275 res = GetMessage (&msg, NULL, 0, 0);
276 TranslateMessage (&msg);
277 DispatchMessage (&msg);
278
279 goto again;
280}
281
282void
283engine_direct3d_shutdown(void)
284{
285 DestroyWindow(window);
286 UnregisterClass("Evas_Direct3D_Test", instance);
287 FreeLibrary(instance);
288}
diff --git a/src/bin/engine_software_16_wince.rc b/src/bin/engine_software_16_wince.rc
deleted file mode 100644
index 2a185cd..0000000
--- a/src/bin/engine_software_16_wince.rc
+++ /dev/null
@@ -1 +0,0 @@
1HI_RES_AWARE CEUX {1}
diff --git a/src/bin/engine_software_ddraw.cpp b/src/bin/engine_software_ddraw.cpp
deleted file mode 100644
index c5ceb95..0000000
--- a/src/bin/engine_software_ddraw.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
1#include "main.h"
2
3#include <windowsx.h>
4#include <Evas_Engine_Software_DDraw.h>
5
6
7static HWND window;
8static HINSTANCE instance;
9
10
11static LRESULT CALLBACK
12MainWndProc(HWND hwnd,
13 UINT uMsg,
14 WPARAM wParam,
15 LPARAM lParam)
16{
17 switch (uMsg)
18 {
19 case WM_CREATE:
20 return 0;
21 case WM_DESTROY:
22 PostQuitMessage(0);
23 return 0;
24 case WM_CLOSE:
25 PostQuitMessage(0);
26 return 0;
27 case WM_WINDOWPOSCHANGED: {
28 PAINTSTRUCT ps;
29 HDC hdc;
30
31 hdc = BeginPaint (window, &ps);
32 evas_damage_rectangle_add(evas,
33 ps.rcPaint.left, ps.rcPaint.top,
34 ps.rcPaint.right - ps.rcPaint.left,
35 ps.rcPaint.bottom - ps.rcPaint.top);
36 EndPaint(window, &ps);
37 return 0;
38 }
39 case WM_SIZING:
40 {
41 PRECT rect = (PRECT)lParam;
42
43 evas_output_viewport_set(evas, 0, 0,
44 rect->right - rect->left,
45 rect->bottom - rect->top);
46 evas_output_size_set(evas,
47 rect->right - rect->left,
48 rect->bottom - rect->top);
49 win_w = rect->right - rect->left;
50 win_h = rect->bottom - rect->top;
51 return 0;
52 }
53 case WM_RBUTTONDOWN:
54 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
55 evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
56 return 0;
57 case WM_LBUTTONDOWN:
58 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
59 evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
60 return 0;
61 case WM_LBUTTONUP:
62 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
63 evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
64 return 0;
65 case WM_RBUTTONUP:
66 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
67 evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
68 return 0;
69 case WM_MOUSEMOVE:
70 if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
71 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
72 return 0;
73 case WM_MOUSELEAVE:
74 evas_event_feed_mouse_out(evas, 0, NULL);
75 return 0;
76 /* FIXME : can't find an event when the mouse is entering */
77 case WM_KEYDOWN:
78 case WM_SYSKEYDOWN: {
79 int key;
80
81 key = LOWORD(wParam);
82
83 if ((key == VK_SHIFT) ||
84 (key == VK_LSHIFT) ||
85 (key == VK_RSHIFT))
86 evas_key_modifier_on(evas, "Shift");
87 if ((key == VK_CONTROL) ||
88 (key == VK_LCONTROL) ||
89 (key == VK_RCONTROL))
90 evas_key_modifier_on(evas, "Control");
91 if ((key == VK_MENU) ||
92 (key == VK_LMENU) ||
93 (key == VK_RMENU))
94 evas_key_modifier_on(evas, "Alt");
95 if ((key == VK_LWIN) ||
96 (key == VK_RWIN))
97 evas_key_modifier_on(evas, "Super");
98
99 if (key == VK_CAPITAL)
100 {
101 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
102 evas_key_lock_off(evas, "Caps_Lock");
103 else
104 evas_key_lock_on(evas, "Caps_Lock");
105 }
106 if (key == VK_NUMLOCK)
107 {
108 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
109 evas_key_lock_off(evas, "Num_Lock");
110 else
111 evas_key_lock_on(evas, "Num_Lock");
112 }
113 if (key == VK_SCROLL)
114 {
115 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
116 evas_key_lock_off(evas, "Scroll_Lock");
117 else
118 evas_key_lock_on(evas, "Scroll_Lock");
119 }
120 if (key == VK_ESCAPE)
121 evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
122 if (key == VK_RETURN)
123 evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
124 if (key == VK_LEFT)
125 evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
126 if (key == VK_RIGHT)
127 evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
128 if (key == 81)
129 evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
130 if (key == 113)
131 evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
132 return 0;
133 }
134 case WM_KEYUP:
135 case WM_SYSKEYUP: {
136 int key;
137
138 key = LOWORD(wParam);
139
140 if ((key == VK_SHIFT) ||
141 (key == VK_LSHIFT) ||
142 (key == VK_RSHIFT))
143 evas_key_modifier_off(evas, "Shift");
144 if ((key == VK_CONTROL) ||
145 (key == VK_LCONTROL) ||
146 (key == VK_RCONTROL))
147 evas_key_modifier_off(evas, "Control");
148 if ((key == VK_MENU) ||
149 (key == VK_LMENU) ||
150 (key == VK_RMENU))
151 evas_key_modifier_off(evas, "Alt");
152 if ((key == VK_LWIN) ||
153 (key == VK_RWIN))
154 evas_key_modifier_off(evas, "Super");
155 if (key == VK_ESCAPE)
156 evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
157 if (key == VK_RETURN)
158 evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
159 if (key == VK_LEFT)
160 evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
161 if (key == VK_RIGHT)
162 evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
163 if (key == 81)
164 evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
165 if (key == 113)
166 evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
167 return 0;
168 }
169 default:
170 return DefWindowProc(hwnd, uMsg, wParam, lParam);
171 }
172}
173
174Eina_Bool
175engine_software_ddraw_args(const char *engine, int width, int height)
176{
177 WNDCLASS wc;
178 RECT rect;
179 HDC dc;
180 Evas_Engine_Info_Software_DDraw *einfo;
181 DWORD style;
182 DWORD exstyle;
183 int depth;
184 int i;
185
186 instance = GetModuleHandle(NULL);
187 if (!instance) return 0;
188
189 wc.style = CS_HREDRAW | CS_VREDRAW;
190 wc.lpfnWndProc = MainWndProc;
191 wc.cbClsExtra = 0;
192 wc.cbWndExtra = 0;
193 wc.hInstance = instance;
194 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
195 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
196 wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
197 wc.lpszMenuName = NULL;
198 wc.lpszClassName = "Evas_Software_DDraw_Test";
199
200 if(!RegisterClass(&wc))
201 goto free_library;
202
203 style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
204 exstyle = 0;
205
206 rect.left = 0;
207 rect.top = 0;
208 rect.right = width;
209 rect.bottom = height;
210 AdjustWindowRectEx (&rect, style, FALSE, exstyle);
211
212 window = CreateWindowEx(exstyle,
213 "Evas_Software_DDraw_Test",
214 "Evas_Software_DDraw_Test",
215 style,
216 CW_USEDEFAULT, CW_USEDEFAULT,
217 rect.right - rect.left, rect.bottom - rect.top,
218 NULL, NULL, instance, NULL);
219 if (!window)
220 goto unregister_class;
221
222 /* make the window non resizable */
223 style = GetWindowLong(window, GWL_STYLE);
224 style &= ~WS_THICKFRAME;
225 if (!SetWindowLong(window, GWL_STYLE, style))
226 goto destroy_window;
227
228 dc = GetDC(NULL);
229 if (!dc)
230 goto destroy_window;
231
232 depth = GetDeviceCaps(dc, BITSPIXEL);
233 ReleaseDC(NULL, dc);
234
235 evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
236 einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(evas);
237 if (!einfo)
238 {
239 fprintf(stderr, "Evas does not support the Software DirectDraw Engine\n");
240 goto destroy_window;
241 }
242
243 einfo->info.window = window;
244 einfo->info.depth = depth;
245 einfo->info.rotation = 0;
246 if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
247 {
248 printf("Evas can not setup the informations of the Software DirectDraw Engine\n");
249 goto destroy_window;
250 }
251
252 /* the second parameter is ignored, as it's the first call of ShowWindow */
253 ShowWindow(window, SW_SHOWDEFAULT);
254 UpdateWindow(window);
255
256 return 1;
257
258 destroy_window:
259 DestroyWindow(window);
260 unregister_class:
261 UnregisterClass("Evas_Software_DDraw_Test", instance);
262 free_library:
263 FreeLibrary(instance);
264
265 return 0;
266}
267
268void
269engine_software_ddraw_loop(void)
270{
271 MSG msg;
272 int res;
273
274 again:
275 if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
276 return;
277
278 res = GetMessage (&msg, NULL, 0, 0);
279 TranslateMessage (&msg);
280 DispatchMessage (&msg);
281
282 goto again;
283}
284
285void
286engine_software_ddraw_shutdown(void)
287{
288 DestroyWindow(window);
289 UnregisterClass("Evas_Software_DDraw_Test", instance);
290 FreeLibrary(instance);
291}
diff --git a/src/bin/main.h b/src/bin/main.h
index 3db08c7..4457d26 100644
--- a/src/bin/main.h
+++ b/src/bin/main.h
@@ -20,14 +20,6 @@
20# include <sys/time.h> 20# include <sys/time.h>
21#endif 21#endif
22 22
23#ifdef _WIN32
24# include <windows.h>
25#endif
26
27#ifdef HAVE_EVIL
28# include <Evil.h>
29#endif
30
31#include <Evas.h> 23#include <Evas.h>
32#include <Ecore.h> 24#include <Ecore.h>
33 25