summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac5
-rw-r--r--src/bin/Makefile.am7
-rw-r--r--src/bin/engine_software_gdi.c296
-rw-r--r--src/bin/engine_software_gdi.h19
-rw-r--r--src/bin/main.c7
-rw-r--r--src/bin/main.h3
6 files changed, 336 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index a225259..8e284e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,10 @@ EXPEDITE_CHECK_ENGINE([software-xcb], [Software XCB], "yes")
41# XRender XCB 41# XRender XCB
42EXPEDITE_CHECK_ENGINE([xrender-xcb], [XRender XCB], "yes") 42EXPEDITE_CHECK_ENGINE([xrender-xcb], [XRender XCB], "yes")
43 43
44# GDI
45EXPEDITE_CHECK_ENGINE([software-gdi], [Software GDI], "yes", [gdi_libs="-lgdi32"])
46AC_SUBST(gdi_libs)
47
44# DirectDraw 48# DirectDraw
45EXPEDITE_CHECK_ENGINE([software-ddraw], [Software DirectDraw], "yes", [ddraw_libs="-lddraw -ldxguid -lgdi32"]) 49EXPEDITE_CHECK_ENGINE([software-ddraw], [Software DirectDraw], "yes", [ddraw_libs="-lddraw -ldxguid -lgdi32"])
46AC_SUBST(ddraw_libs) 50AC_SUBST(ddraw_libs)
@@ -209,6 +213,7 @@ echo " X Render X11.................: ${have_xrender_x11}"
209echo " Open GL X11..................: ${have_opengl_x11}" 213echo " Open GL X11..................: ${have_opengl_x11}"
210echo " Software XCB.................: ${have_software_xcb}" 214echo " Software XCB.................: ${have_software_xcb}"
211echo " X Render XCB.................: ${have_xrender_xcb}" 215echo " X Render XCB.................: ${have_xrender_xcb}"
216echo " Software GDI.................: ${have_software_gdi}"
212echo " Software DirectDraw..........: ${have_software_ddraw}" 217echo " Software DirectDraw..........: ${have_software_ddraw}"
213echo " Direct3D.....................: ${have_direct3d}" 218echo " Direct3D.....................: ${have_direct3d}"
214echo " Open GL Glew.................: ${have_opengl_glew}" 219echo " Open GL Glew.................: ${have_opengl_glew}"
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index f2a4b07..54b3ef2 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -78,7 +78,7 @@ poly_blend.c
78 78
79expedite_CFLAGS = @WIN32_CFLAGS@ 79expedite_CFLAGS = @WIN32_CFLAGS@
80expedite_CXXFLAGS = -fno-rtti -fno-exceptions 80expedite_CXXFLAGS = -fno-rtti -fno-exceptions
81expedite_LDADD = @EVAS_LIBS@ @SDL_LIBS@ @x_libs@ @ddraw_libs@ @ddraw_16_libs@ @d3d_libs@ @wince_16_libs@ @glew_libs@ @DIRECTFB_LIBS@ @XCB_LIBS@ @EVIL_LIBS@ @quartz_libs@ -lm 81expedite_LDADD = @EVAS_LIBS@ @SDL_LIBS@ @x_libs@ @gdi_libs@ @ddraw_libs@ @ddraw_16_libs@ @d3d_libs@ @wince_16_libs@ @glew_libs@ @DIRECTFB_LIBS@ @XCB_LIBS@ @EVIL_LIBS@ @quartz_libs@ -lm
82expedite_LDFLAGS = @lt_enable_auto_import@ 82expedite_LDFLAGS = @lt_enable_auto_import@
83 83
84if BUILD_SOFTWARE_X11 84if BUILD_SOFTWARE_X11
@@ -106,6 +106,11 @@ expedite_SOURCES += \
106engine_xrender_xcb.c engine_xrender_xcb.h 106engine_xrender_xcb.c engine_xrender_xcb.h
107endif 107endif
108 108
109if BUILD_SOFTWARE_GDI
110expedite_SOURCES += \
111engine_software_gdi.c engine_software_gdi.h
112endif
113
109if BUILD_SOFTWARE_DDRAW 114if BUILD_SOFTWARE_DDRAW
110expedite_SOURCES += \ 115expedite_SOURCES += \
111engine_software_ddraw.cpp engine_software_ddraw.h 116engine_software_ddraw.cpp engine_software_ddraw.h
diff --git a/src/bin/engine_software_gdi.c b/src/bin/engine_software_gdi.c
new file mode 100644
index 0000000..545446f
--- /dev/null
+++ b/src/bin/engine_software_gdi.c
@@ -0,0 +1,296 @@
1#include "main.h"
2
3#include <windowsx.h>
4#include <Evas_Engine_Software_Gdi.h>
5
6
7static HWND window;
8
9
10static LRESULT CALLBACK
11MainWndProc(HWND hwnd,
12 UINT uMsg,
13 WPARAM wParam,
14 LPARAM lParam)
15{
16 switch (uMsg)
17 {
18 case WM_CREATE:
19 return 0;
20 case WM_DESTROY:
21 PostQuitMessage(0);
22 return 0;
23 case WM_CLOSE:
24 PostQuitMessage(0);
25 return 0;
26 case WM_WINDOWPOSCHANGED: {
27 PAINTSTRUCT ps;
28 HDC hdc;
29
30 hdc = BeginPaint (window, &ps);
31 evas_damage_rectangle_add(evas,
32 ps.rcPaint.left, ps.rcPaint.top,
33 ps.rcPaint.right - ps.rcPaint.left,
34 ps.rcPaint.bottom - ps.rcPaint.top);
35 EndPaint(window, &ps);
36 return 0;
37 }
38 case WM_SIZING:
39 {
40 PRECT rect = (PRECT)lParam;
41
42 evas_output_viewport_set(evas, 0, 0,
43 rect->right - rect->left,
44 rect->bottom - rect->top);
45 evas_output_size_set(evas,
46 rect->right - rect->left,
47 rect->bottom - rect->top);
48 win_w = rect->right - rect->left;
49 win_h = rect->bottom - rect->top;
50 return 0;
51 }
52 case WM_RBUTTONDOWN:
53 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
54 evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
55 return 0;
56 case WM_LBUTTONDOWN:
57 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
58 evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
59 return 0;
60 case WM_LBUTTONUP:
61 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
62 evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
63 return 0;
64 case WM_RBUTTONUP:
65 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
66 evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
67 return 0;
68 case WM_MOUSEMOVE:
69 if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
70 evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
71 return 0;
72 case WM_MOUSELEAVE:
73 evas_event_feed_mouse_out(evas, 0, NULL);
74 return 0;
75 /* FIXME : can't find an event when the mouse is entering */
76 case WM_KEYDOWN:
77 case WM_SYSKEYDOWN: {
78 int key;
79
80 key = LOWORD(wParam);
81
82 if ((key == VK_SHIFT) ||
83 (key == VK_LSHIFT) ||
84 (key == VK_RSHIFT))
85 evas_key_modifier_on(evas, "Shift");
86 if ((key == VK_CONTROL) ||
87 (key == VK_LCONTROL) ||
88 (key == VK_RCONTROL))
89 evas_key_modifier_on(evas, "Control");
90 if ((key == VK_MENU) ||
91 (key == VK_LMENU) ||
92 (key == VK_RMENU))
93 evas_key_modifier_on(evas, "Alt");
94 if ((key == VK_LWIN) ||
95 (key == VK_RWIN))
96 evas_key_modifier_on(evas, "Super");
97
98 if (key == VK_CAPITAL)
99 {
100 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
101 evas_key_lock_off(evas, "Caps_Lock");
102 else
103 evas_key_lock_on(evas, "Caps_Lock");
104 }
105 if (key == VK_NUMLOCK)
106 {
107 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
108 evas_key_lock_off(evas, "Num_Lock");
109 else
110 evas_key_lock_on(evas, "Num_Lock");
111 }
112 if (key == VK_SCROLL)
113 {
114 if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
115 evas_key_lock_off(evas, "Scroll_Lock");
116 else
117 evas_key_lock_on(evas, "Scroll_Lock");
118 }
119 if (key == VK_ESCAPE)
120 evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
121 if (key == VK_RETURN)
122 evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
123 if (key == VK_LEFT)
124 evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
125 if (key == VK_RIGHT)
126 evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
127 if (key == 81)
128 evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
129 if (key == 113)
130 evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
131 return 0;
132 }
133 case WM_KEYUP:
134 case WM_SYSKEYUP: {
135 int key;
136
137 key = LOWORD(wParam);
138
139 if ((key == VK_SHIFT) ||
140 (key == VK_LSHIFT) ||
141 (key == VK_RSHIFT))
142 evas_key_modifier_off(evas, "Shift");
143 if ((key == VK_CONTROL) ||
144 (key == VK_LCONTROL) ||
145 (key == VK_RCONTROL))
146 evas_key_modifier_off(evas, "Control");
147 if ((key == VK_MENU) ||
148 (key == VK_LMENU) ||
149 (key == VK_RMENU))
150 evas_key_modifier_off(evas, "Alt");
151 if ((key == VK_LWIN) ||
152 (key == VK_RWIN))
153 evas_key_modifier_off(evas, "Super");
154 if (key == VK_ESCAPE)
155 evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
156 if (key == VK_RETURN)
157 evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
158 if (key == VK_LEFT)
159 evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
160 if (key == VK_RIGHT)
161 evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
162 if (key == 81)
163 evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
164 if (key == 113)
165 evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
166 return 0;
167 }
168 default:
169 return DefWindowProc(hwnd, uMsg, wParam, lParam);
170 }
171}
172
173int
174engine_software_gdi_args(int argc, char **argv)
175{
176 WNDCLASS wc;
177 RECT rect;
178 HINSTANCE instance;
179 HDC dc;
180 Evas_Engine_Info_Software_Gdi *einfo;
181 DWORD style;
182 DWORD exstyle;
183 int depth;
184 int i;
185 int ok = 0;
186
187 for (i = 1; i < argc; i++)
188 {
189 if ((!strcmp(argv[i], "-e")) && (i < (argc - 1)))
190 {
191 i++;
192 if (!strcmp(argv[i], "gdi")) ok = 1;
193 }
194 }
195 if (!ok) return 0;
196
197 instance = GetModuleHandle(NULL);
198 if (!instance) return 0;
199
200 wc.style = CS_HREDRAW | CS_VREDRAW;
201 wc.lpfnWndProc = MainWndProc;
202 wc.cbClsExtra = 0;
203 wc.cbWndExtra = 0;
204 wc.hInstance = instance;
205 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
206 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
207 wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
208 wc.lpszMenuName = NULL;
209 wc.lpszClassName = "Evas_Software_Gdi_Test";
210
211 if(!RegisterClass(&wc))
212 goto free_library;
213
214 style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
215 exstyle = 0;
216
217 rect.left = 0;
218 rect.top = 0;
219 rect.right = win_w;
220 rect.bottom = win_h;
221 AdjustWindowRectEx (&rect, style, FALSE, exstyle);
222
223 window = CreateWindowEx(exstyle,
224 "Evas_Software_Gdi_Test",
225 "Evas_Software_Gdi_Test",
226 style,
227 CW_USEDEFAULT, CW_USEDEFAULT,
228 rect.right - rect.left, rect.bottom - rect.top,
229 NULL, NULL, instance, NULL);
230 if (!window)
231 goto unregister_class;
232
233 /* make the window non resizable */
234 style = GetWindowLong(window, GWL_STYLE);
235 style &= ~WS_THICKFRAME;
236 if (!SetWindowLong(window, GWL_STYLE, style))
237 goto unregister_class;
238
239 dc = GetDC(NULL);
240 if (!dc)
241 goto destroy_window;
242
243 depth = GetDeviceCaps(dc, BITSPIXEL);
244 ReleaseDC(NULL, dc);
245
246 evas_output_method_set(evas, evas_render_method_lookup("software_gdi"));
247 einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(evas);
248 if (!einfo)
249 {
250 fprintf(stderr, "Evas does not support the Software GDI Engine\n");
251 goto destroy_window;
252 }
253
254 einfo->info.window = window;
255 einfo->info.mask = NULL;
256 einfo->info.depth = depth;
257 einfo->info.rotation = 0;
258 einfo->info.fullscreen = 0;
259 if (!evas_engine_info_set(evas, (Evas_Engine_Info *) einfo))
260 {
261 printf("Evas can not setup the informations of the Software GDI Engine\n");
262 goto destroy_window;
263 }
264
265 /* the second parameter is ignored, as it's the first call of ShowWindow */
266 ShowWindow(window, SW_SHOWDEFAULT);
267 UpdateWindow(window);
268
269 return 1;
270
271 destroy_window:
272 DestroyWindow(window);
273 unregister_class:
274 UnregisterClass("Evas_Software_Gdi_Test", instance);
275 free_library:
276 FreeLibrary(instance);
277
278 return 0;
279}
280
281void
282engine_software_gdi_loop(void)
283{
284 MSG msg;
285 int res;
286
287 again:
288 if (!PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
289 return;
290
291 res = GetMessage (&msg, NULL, 0, 0);
292 TranslateMessage (&msg);
293 DispatchMessage (&msg);
294
295 goto again;
296}
diff --git a/src/bin/engine_software_gdi.h b/src/bin/engine_software_gdi.h
new file mode 100644
index 0000000..c7e1695
--- /dev/null
+++ b/src/bin/engine_software_gdi.h
@@ -0,0 +1,19 @@
1#ifndef __ENGINE_SOFTWARE_GDI_H__
2#define __ENGINE_SOFTWARE_GDI_H__
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9
10int engine_software_gdi_args(int argc, char **argv);
11void engine_software_gdi_loop(void);
12
13
14#ifdef __cplusplus
15}
16#endif
17
18
19#endif /* __ENGINE_SOFTWARE_GDI_H__ */
diff --git a/src/bin/main.c b/src/bin/main.c
index ab42d19..d90211e 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1219,6 +1219,10 @@ _engine_args(int argc, char **argv)
1219 if (engine_xrender_xcb_args(argc, argv)) 1219 if (engine_xrender_xcb_args(argc, argv))
1220 loop_func = engine_xrender_xcb_loop; 1220 loop_func = engine_xrender_xcb_loop;
1221#endif 1221#endif
1222#if HAVE_EVAS_SOFTWARE_GDI
1223 if (engine_software_gdi_args(argc, argv))
1224 loop_func = engine_software_gdi_loop;
1225#endif
1222#if HAVE_EVAS_SOFTWARE_DDRAW 1226#if HAVE_EVAS_SOFTWARE_DDRAW
1223 if (engine_software_ddraw_args(argc, argv)) 1227 if (engine_software_ddraw_args(argc, argv))
1224 loop_func = engine_software_ddraw_loop; 1228 loop_func = engine_software_ddraw_loop;
@@ -1289,6 +1293,9 @@ _engine_args(int argc, char **argv)
1289#if HAVE_EVAS_XRENDER_XCB 1293#if HAVE_EVAS_XRENDER_XCB
1290 " xrxcb" 1294 " xrxcb"
1291#endif 1295#endif
1296#if HAVE_EVAS_SOFTWARE_GDI
1297 " gdi"
1298#endif
1292#if HAVE_EVAS_SOFTWARE_DDRAW 1299#if HAVE_EVAS_SOFTWARE_DDRAW
1293 " ddraw" 1300 " ddraw"
1294#endif 1301#endif
diff --git a/src/bin/main.h b/src/bin/main.h
index e0a35c1..f3b7a07 100644
--- a/src/bin/main.h
+++ b/src/bin/main.h
@@ -36,6 +36,9 @@
36#if HAVE_EVAS_XRENDER_X11 36#if HAVE_EVAS_XRENDER_X11
37#include "engine_xrender_xcb.h" 37#include "engine_xrender_xcb.h"
38#endif 38#endif
39#if HAVE_EVAS_SOFTWARE_GDI
40#include "engine_software_gdi.h"
41#endif
39#if HAVE_EVAS_SOFTWARE_DDRAW 42#if HAVE_EVAS_SOFTWARE_DDRAW
40#include "engine_software_ddraw.h" 43#include "engine_software_ddraw.h"
41#endif 44#endif