diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c | 1452 |
1 files changed, 0 insertions, 1452 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c deleted file mode 100644 index 32132b3..0000000 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ /dev/null | |||
@@ -1,1452 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> /* for NULL */ | ||
6 | |||
7 | #include <Ecore.h> | ||
8 | #include "ecore_private.h" | ||
9 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
10 | # define WIN32_LEAN_AND_MEAN | ||
11 | # include <windows.h> | ||
12 | # undef WIN32_LEAN_AND_MEAN | ||
13 | # include <Ecore_Win32.h> | ||
14 | # include <ecore_win32_private.h> | ||
15 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
16 | |||
17 | #include "ecore_evas_private.h" | ||
18 | #include "Ecore_Evas.h" | ||
19 | |||
20 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
21 | |||
22 | #define ECORE_EVAS_EVENT_COUNT 10 | ||
23 | |||
24 | static int _ecore_evas_init_count = 0; | ||
25 | |||
26 | static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT]; | ||
27 | |||
28 | static Eina_Bool _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
29 | |||
30 | static Eina_Bool _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
31 | |||
32 | static Eina_Bool _ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
33 | |||
34 | static Eina_Bool _ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
35 | |||
36 | static Eina_Bool _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
37 | |||
38 | static Eina_Bool _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
39 | |||
40 | static Eina_Bool _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
41 | |||
42 | static Eina_Bool _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
43 | |||
44 | static Eina_Bool _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
45 | |||
46 | static Eina_Bool _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
47 | |||
48 | /* Private functions */ | ||
49 | |||
50 | static int | ||
51 | _ecore_evas_win32_render(Ecore_Evas *ee) | ||
52 | { | ||
53 | int rend = 0; | ||
54 | Eina_List *updates = NULL; | ||
55 | Eina_List *ll; | ||
56 | Ecore_Evas *ee2; | ||
57 | |||
58 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
59 | { | ||
60 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
61 | if (ee2->engine.func->fn_render) | ||
62 | rend |= ee2->engine.func->fn_render(ee2); | ||
63 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
64 | } | ||
65 | |||
66 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
67 | if (ee->prop.avoid_damage) | ||
68 | { | ||
69 | updates = evas_render_updates(ee->evas); | ||
70 | if (updates) evas_render_updates_free(updates); | ||
71 | } | ||
72 | else if ((ee->visible) || | ||
73 | ((ee->should_be_visible) && (ee->prop.fullscreen)) || | ||
74 | ((ee->should_be_visible) && (ee->prop.override))) | ||
75 | { | ||
76 | if (ee->shaped) | ||
77 | { | ||
78 | updates = evas_render_updates(ee->evas); | ||
79 | if (updates) evas_render_updates_free(updates); | ||
80 | } | ||
81 | else | ||
82 | { | ||
83 | updates = evas_render_updates(ee->evas); | ||
84 | if (updates) evas_render_updates_free(updates); | ||
85 | } | ||
86 | } | ||
87 | else | ||
88 | evas_norender(ee->evas); | ||
89 | if (updates) rend = 1; | ||
90 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
91 | return rend; | ||
92 | } | ||
93 | |||
94 | static int | ||
95 | _ecore_evas_win32_init(void) | ||
96 | { | ||
97 | _ecore_evas_init_count++; | ||
98 | if (_ecore_evas_init_count > 1) | ||
99 | return _ecore_evas_init_count; | ||
100 | |||
101 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL); | ||
102 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL); | ||
103 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, _ecore_evas_win32_event_window_focus_in, NULL); | ||
104 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_win32_event_window_focus_out, NULL); | ||
105 | ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL); | ||
106 | ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, _ecore_evas_win32_event_window_destroy, NULL); | ||
107 | ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_SHOW, _ecore_evas_win32_event_window_show, NULL); | ||
108 | ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_HIDE, _ecore_evas_win32_event_window_hide, NULL); | ||
109 | ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, _ecore_evas_win32_event_window_configure, NULL); | ||
110 | ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_win32_event_window_delete_request, NULL); | ||
111 | |||
112 | ecore_event_evas_init(); | ||
113 | return _ecore_evas_init_count; | ||
114 | } | ||
115 | |||
116 | int | ||
117 | _ecore_evas_win32_shutdown(void) | ||
118 | { | ||
119 | _ecore_evas_init_count--; | ||
120 | if (_ecore_evas_init_count == 0) | ||
121 | { | ||
122 | int i; | ||
123 | |||
124 | for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++) | ||
125 | ecore_event_handler_del(ecore_evas_event_handlers[i]); | ||
126 | ecore_event_evas_shutdown(); | ||
127 | } | ||
128 | |||
129 | if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; | ||
130 | |||
131 | return _ecore_evas_init_count; | ||
132 | } | ||
133 | |||
134 | static Eina_Bool | ||
135 | _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
136 | { | ||
137 | Ecore_Evas *ee; | ||
138 | Ecore_Win32_Event_Mouse_In *e; | ||
139 | |||
140 | INF("mouse in"); | ||
141 | |||
142 | e = event; | ||
143 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
144 | if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ | ||
145 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
146 | |||
147 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
148 | /* FIXME to do */ | ||
149 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | ||
150 | evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL); | ||
151 | evas_focus_in(ee->evas); | ||
152 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); | ||
153 | |||
154 | return 1; | ||
155 | } | ||
156 | |||
157 | static Eina_Bool | ||
158 | _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
159 | { | ||
160 | Ecore_Evas *ee; | ||
161 | Ecore_Win32_Event_Mouse_Out *e; | ||
162 | |||
163 | INF("mouse out"); | ||
164 | |||
165 | e = event; | ||
166 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
167 | if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ | ||
168 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
169 | |||
170 | /* FIXME to do */ | ||
171 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | ||
172 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); | ||
173 | |||
174 | evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL); | ||
175 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
176 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
177 | |||
178 | return 1; | ||
179 | } | ||
180 | |||
181 | static Eina_Bool | ||
182 | _ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
183 | { | ||
184 | Ecore_Evas *ee; | ||
185 | Ecore_Win32_Event_Window_Focus_In *e; | ||
186 | |||
187 | e = event; | ||
188 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
189 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
190 | if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
191 | |||
192 | ee->prop.focused = 1; | ||
193 | evas_focus_in(ee->evas); | ||
194 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
195 | return ECORE_CALLBACK_PASS_ON; | ||
196 | } | ||
197 | |||
198 | static Eina_Bool | ||
199 | _ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
200 | { | ||
201 | Ecore_Evas *ee; | ||
202 | Ecore_Win32_Event_Window_Focus_Out *e; | ||
203 | |||
204 | e = event; | ||
205 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
206 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
207 | if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
208 | |||
209 | evas_focus_out(ee->evas); | ||
210 | ee->prop.focused = 0; | ||
211 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
212 | return ECORE_CALLBACK_PASS_ON; | ||
213 | } | ||
214 | |||
215 | static Eina_Bool | ||
216 | _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
217 | { | ||
218 | Ecore_Evas *ee; | ||
219 | Ecore_Win32_Event_Window_Damage *e; | ||
220 | |||
221 | INF("window damage"); | ||
222 | |||
223 | e = event; | ||
224 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
225 | if (!ee) return 1; /* pass on event */ | ||
226 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
227 | |||
228 | if (ee->prop.avoid_damage) | ||
229 | { | ||
230 | #ifdef _MSC_VER | ||
231 | # pragma message ("[ECORE] [WIN32] No Region code") | ||
232 | #else | ||
233 | # warning [ECORE] [WIN32] No Region code | ||
234 | #endif /* ! _MSC_VER */ | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | if (ee->rotation == 0) | ||
239 | evas_damage_rectangle_add(ee->evas, | ||
240 | e->x, | ||
241 | e->y, | ||
242 | e->width, | ||
243 | e->height); | ||
244 | else if (ee->rotation == 90) | ||
245 | evas_damage_rectangle_add(ee->evas, | ||
246 | ee->h - e->y - e->height, | ||
247 | e->x, | ||
248 | e->height, | ||
249 | e->width); | ||
250 | else if (ee->rotation == 180) | ||
251 | evas_damage_rectangle_add(ee->evas, | ||
252 | ee->w - e->x - e->width, | ||
253 | ee->h - e->y - e->height, | ||
254 | e->width, | ||
255 | e->height); | ||
256 | else if (ee->rotation == 270) | ||
257 | evas_damage_rectangle_add(ee->evas, | ||
258 | e->y, | ||
259 | ee->w - e->x - e->width, | ||
260 | e->height, | ||
261 | e->width); | ||
262 | } | ||
263 | |||
264 | return 1; | ||
265 | } | ||
266 | |||
267 | static Eina_Bool | ||
268 | _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
269 | { | ||
270 | Ecore_Evas *ee; | ||
271 | Ecore_Win32_Event_Window_Destroy *e; | ||
272 | |||
273 | INF("window destroy"); | ||
274 | |||
275 | e = event; | ||
276 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
277 | if (!ee) return 1; /* pass on event */ | ||
278 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
279 | if (ee->func.fn_destroy) ee->func.fn_destroy(ee); | ||
280 | ecore_evas_free(ee); | ||
281 | |||
282 | return 1; | ||
283 | } | ||
284 | |||
285 | static Eina_Bool | ||
286 | _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
287 | { | ||
288 | Ecore_Evas *ee; | ||
289 | Ecore_Win32_Event_Window_Show *e; | ||
290 | |||
291 | INF("window show"); | ||
292 | |||
293 | e = event; | ||
294 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
295 | if (!ee) return 1; /* pass on event */ | ||
296 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
297 | if (ee->visible) return 0; /* dont pass it on */ | ||
298 | ee->visible = 1; | ||
299 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
300 | |||
301 | return 1; | ||
302 | } | ||
303 | |||
304 | static Eina_Bool | ||
305 | _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
306 | { | ||
307 | Ecore_Evas *ee; | ||
308 | Ecore_Win32_Event_Window_Hide *e; | ||
309 | |||
310 | INF("window hide"); | ||
311 | |||
312 | e = event; | ||
313 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
314 | if (!ee) return 1; /* pass on event */ | ||
315 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
316 | if (!ee->visible) return 0; /* dont pass it on */ | ||
317 | ee->visible = 0; | ||
318 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
319 | |||
320 | return 1; | ||
321 | } | ||
322 | |||
323 | static Eina_Bool | ||
324 | _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
325 | { | ||
326 | Ecore_Evas *ee; | ||
327 | Ecore_Win32_Event_Window_Configure *e; | ||
328 | |||
329 | INF("window configure"); | ||
330 | |||
331 | e = event; | ||
332 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
333 | if (!ee) return 1; /* pass on event */ | ||
334 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
335 | |||
336 | if ((ee->x != e->x) || (ee->y != e->y)) | ||
337 | { | ||
338 | ee->x = e->x; | ||
339 | ee->y = e->y; | ||
340 | ee->req.x = ee->x; | ||
341 | ee->req.y = ee->y; | ||
342 | |||
343 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
344 | } | ||
345 | |||
346 | if ((ee->w != e->width) || (ee->h != e->height)) | ||
347 | { | ||
348 | ee->w = e->width; | ||
349 | ee->h = e->height; | ||
350 | ee->req.w = ee->w; | ||
351 | ee->req.h = ee->h; | ||
352 | |||
353 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
354 | { | ||
355 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
356 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
361 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
362 | } | ||
363 | if (ee->prop.avoid_damage) | ||
364 | { | ||
365 | int pdam; | ||
366 | |||
367 | pdam = ecore_evas_avoid_damage_get(ee); | ||
368 | ecore_evas_avoid_damage_set(ee, 0); | ||
369 | ecore_evas_avoid_damage_set(ee, pdam); | ||
370 | } | ||
371 | /* if (ee->shaped) */ | ||
372 | /* _ecore_evas_win32_region_border_resize(ee); */ | ||
373 | if ((ee->expecting_resize.w > 0) && | ||
374 | (ee->expecting_resize.h > 0)) | ||
375 | { | ||
376 | if ((ee->expecting_resize.w == ee->w) && | ||
377 | (ee->expecting_resize.h == ee->h)) | ||
378 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
379 | ecore_win32_current_time_get()); | ||
380 | ee->expecting_resize.w = 0; | ||
381 | ee->expecting_resize.h = 0; | ||
382 | } | ||
383 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
384 | } | ||
385 | |||
386 | return 1; | ||
387 | } | ||
388 | |||
389 | static Eina_Bool | ||
390 | _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
391 | { | ||
392 | Ecore_Evas *ee; | ||
393 | Ecore_Win32_Event_Window_Delete_Request *e; | ||
394 | |||
395 | INF("window delete request"); | ||
396 | |||
397 | e = event; | ||
398 | ee = ecore_event_window_match((Ecore_Window)e->window); | ||
399 | if (!ee) return 1; /* pass on event */ | ||
400 | if ((Ecore_Window)e->window != ee->prop.window) return 1; | ||
401 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
402 | |||
403 | INF(" * ee event delete\n"); | ||
404 | return 1; | ||
405 | } | ||
406 | |||
407 | |||
408 | /* Ecore_Evas interface */ | ||
409 | |||
410 | static void | ||
411 | _ecore_evas_win32_free(Ecore_Evas *ee) | ||
412 | { | ||
413 | INF("ecore evas free"); | ||
414 | |||
415 | ecore_win32_window_free((struct _Ecore_Win32_Window *)ee->prop.window); | ||
416 | ecore_event_window_unregister(ee->prop.window); | ||
417 | _ecore_evas_win32_shutdown(); | ||
418 | ecore_win32_shutdown(); | ||
419 | } | ||
420 | |||
421 | static void | ||
422 | _ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee, | ||
423 | Ecore_Evas_Event_Cb func) | ||
424 | { | ||
425 | ee->func.fn_delete_request = func; | ||
426 | } | ||
427 | |||
428 | static void | ||
429 | _ecore_evas_win32_move(Ecore_Evas *ee, int x, int y) | ||
430 | { | ||
431 | INF("ecore evas move (%dx%d)", x, y); | ||
432 | ee->req.x = x; | ||
433 | ee->req.y = y; | ||
434 | |||
435 | if ((x != ee->x) || (y != ee->y)) | ||
436 | { | ||
437 | ee->x = x; | ||
438 | ee->y = y; | ||
439 | ecore_win32_window_move((struct _Ecore_Win32_Window *)ee->prop.window, | ||
440 | x, y); | ||
441 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
442 | } | ||
443 | } | ||
444 | |||
445 | static void | ||
446 | _ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height) | ||
447 | { | ||
448 | INF("ecore evas resize (%dx%d)", width, height); | ||
449 | ee->req.w = width; | ||
450 | ee->req.h = height; | ||
451 | |||
452 | if ((ee->w != width) || (ee->h != height)) | ||
453 | { | ||
454 | ee->w = width; | ||
455 | ee->h = height; | ||
456 | ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
457 | width, height); | ||
458 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
459 | { | ||
460 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
461 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
462 | } | ||
463 | else | ||
464 | { | ||
465 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
466 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
467 | } | ||
468 | if (ee->prop.avoid_damage) | ||
469 | { | ||
470 | int pdam; | ||
471 | |||
472 | pdam = ecore_evas_avoid_damage_get(ee); | ||
473 | ecore_evas_avoid_damage_set(ee, 0); | ||
474 | ecore_evas_avoid_damage_set(ee, pdam); | ||
475 | } | ||
476 | /* if ((ee->shaped) || (ee->alpha)) */ | ||
477 | /* _ecore_evas_win32_region_border_resize(ee); */ | ||
478 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
479 | } | ||
480 | } | ||
481 | |||
482 | static void | ||
483 | _ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int height) | ||
484 | { | ||
485 | INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height); | ||
486 | ee->req.x = x; | ||
487 | ee->req.y = y; | ||
488 | ee->req.w = width; | ||
489 | ee->req.h = height; | ||
490 | |||
491 | if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y)) | ||
492 | { | ||
493 | int change_size = 0; | ||
494 | int change_pos = 0; | ||
495 | |||
496 | if ((ee->w != width) || (ee->h != height)) change_size = 1; | ||
497 | if ((x != ee->x) || (y != ee->y)) change_pos = 1; | ||
498 | |||
499 | ee->x = x; | ||
500 | ee->y = y; | ||
501 | ee->w = width; | ||
502 | ee->h = height; | ||
503 | ecore_win32_window_move_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
504 | x, y, width, height); | ||
505 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
506 | { | ||
507 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
508 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
509 | } | ||
510 | else | ||
511 | { | ||
512 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
513 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
514 | } | ||
515 | if (ee->prop.avoid_damage) | ||
516 | { | ||
517 | int pdam; | ||
518 | |||
519 | pdam = ecore_evas_avoid_damage_get(ee); | ||
520 | ecore_evas_avoid_damage_set(ee, 0); | ||
521 | ecore_evas_avoid_damage_set(ee, pdam); | ||
522 | } | ||
523 | /* if ((ee->shaped) || (ee->alpha)) */ | ||
524 | /* _ecore_evas_win32_region_border_resize(ee); */ | ||
525 | if (change_pos) | ||
526 | { | ||
527 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
528 | } | ||
529 | if (change_size) | ||
530 | { | ||
531 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
532 | } | ||
533 | } | ||
534 | } | ||
535 | |||
536 | static void | ||
537 | _ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation) | ||
538 | { | ||
539 | int rot_dif; | ||
540 | |||
541 | rot_dif = ee->rotation - rotation; | ||
542 | if (rot_dif < 0) rot_dif = -rot_dif; | ||
543 | |||
544 | if (rot_dif != 180) | ||
545 | { | ||
546 | int minw, minh, maxw, maxh, basew, baseh, stepw, steph; | ||
547 | |||
548 | if (!ee->prop.fullscreen) | ||
549 | { | ||
550 | ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
551 | ee->h, ee->w); | ||
552 | ee->expecting_resize.w = ee->h; | ||
553 | ee->expecting_resize.h = ee->w; | ||
554 | } | ||
555 | else | ||
556 | { | ||
557 | int w, h; | ||
558 | |||
559 | ecore_win32_window_size_get((struct _Ecore_Win32_Window *)ee->prop.window, | ||
560 | &w, &h); | ||
561 | ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, | ||
562 | h, w); | ||
563 | if ((rotation == 0) || (rotation == 180)) | ||
564 | { | ||
565 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
566 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
567 | } | ||
568 | else | ||
569 | { | ||
570 | evas_output_size_set(ee->evas, ee->h, ee->w); | ||
571 | evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); | ||
572 | } | ||
573 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
574 | } | ||
575 | ecore_evas_size_min_get(ee, &minw, &minh); | ||
576 | ecore_evas_size_max_get(ee, &maxw, &maxh); | ||
577 | ecore_evas_size_base_get(ee, &basew, &baseh); | ||
578 | ecore_evas_size_step_get(ee, &stepw, &steph); | ||
579 | ee->rotation = rotation; | ||
580 | ecore_evas_size_min_set(ee, minh, minw); | ||
581 | ecore_evas_size_max_set(ee, maxh, maxw); | ||
582 | ecore_evas_size_base_set(ee, baseh, basew); | ||
583 | ecore_evas_size_step_set(ee, steph, stepw); | ||
584 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
585 | ecore_win32_current_time_get()); | ||
586 | } | ||
587 | else | ||
588 | { | ||
589 | ee->rotation = rotation; | ||
590 | _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, | ||
591 | ecore_win32_current_time_get()); | ||
592 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
593 | } | ||
594 | |||
595 | if ((ee->rotation == 90) || (ee->rotation == 270)) | ||
596 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); | ||
597 | else | ||
598 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
599 | } | ||
600 | |||
601 | static void | ||
602 | _ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation, int resize) | ||
603 | { | ||
604 | INF("ecore evas rotation: %s", rotation ? "yes" : "no"); | ||
605 | |||
606 | if (ee->rotation == rotation) return; | ||
607 | |||
608 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
609 | if (!strcmp(ee->driver, "software_gdi")) | ||
610 | { | ||
611 | Evas_Engine_Info_Software_Gdi *einfo; | ||
612 | |||
613 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
614 | if (!einfo) return; | ||
615 | einfo->info.rotation = rotation; | ||
616 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
617 | { | ||
618 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
619 | } | ||
620 | _ecore_evas_win32_rotation_set_internal(ee, rotation); | ||
621 | } | ||
622 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
623 | |||
624 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
625 | if (!strcmp(ee->driver, "software_ddraw")) | ||
626 | { | ||
627 | Evas_Engine_Info_Software_DDraw *einfo; | ||
628 | |||
629 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); | ||
630 | if (!einfo) return; | ||
631 | einfo->info.rotation = rotation; | ||
632 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
633 | { | ||
634 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
635 | } | ||
636 | _ecore_evas_win32_rotation_set_internal(ee, rotation); | ||
637 | } | ||
638 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
639 | } | ||
640 | |||
641 | static void | ||
642 | _ecore_evas_win32_shaped_set(Ecore_Evas *ee, int shaped) | ||
643 | { | ||
644 | if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) | ||
645 | return; | ||
646 | |||
647 | if (!strcmp(ee->driver, "software_ddraw")) return; | ||
648 | |||
649 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
650 | if (!strcmp(ee->driver, "software_gdi")) | ||
651 | { | ||
652 | Evas_Engine_Info_Software_Gdi *einfo; | ||
653 | |||
654 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
655 | ee->shaped = shaped; | ||
656 | if (einfo) | ||
657 | { | ||
658 | ee->engine.win32.state.region = ee->shaped; | ||
659 | einfo->info.region = ee->engine.win32.state.region; | ||
660 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
661 | { | ||
662 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
663 | } | ||
664 | if (ee->shaped) | ||
665 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
666 | } | ||
667 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
668 | } | ||
669 | } | ||
670 | |||
671 | static void | ||
672 | _ecore_evas_win32_show(Ecore_Evas *ee) | ||
673 | { | ||
674 | INF("ecore evas show"); | ||
675 | |||
676 | ee->should_be_visible = 1; | ||
677 | if (ee->prop.avoid_damage) | ||
678 | _ecore_evas_win32_render(ee); | ||
679 | ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window); | ||
680 | /* if (ee->prop.fullscreen) */ | ||
681 | /* ecore_win32_window_focus(ee->prop.window); */ | ||
682 | } | ||
683 | |||
684 | static void | ||
685 | _ecore_evas_win32_hide(Ecore_Evas *ee) | ||
686 | { | ||
687 | INF("ecore evas hide"); | ||
688 | |||
689 | ecore_win32_window_hide((struct _Ecore_Win32_Window *)ee->prop.window); | ||
690 | ee->should_be_visible = 0; | ||
691 | } | ||
692 | |||
693 | static void | ||
694 | _ecore_evas_win32_raise(Ecore_Evas *ee) | ||
695 | { | ||
696 | INF("ecore evas raise"); | ||
697 | |||
698 | if (!ee->prop.fullscreen) | ||
699 | ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); | ||
700 | else | ||
701 | ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); | ||
702 | } | ||
703 | |||
704 | static void | ||
705 | _ecore_evas_win32_lower(Ecore_Evas *ee) | ||
706 | { | ||
707 | INF("ecore evas lower"); | ||
708 | |||
709 | if (!ee->prop.fullscreen) | ||
710 | ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); | ||
711 | else | ||
712 | ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); | ||
713 | } | ||
714 | |||
715 | static void | ||
716 | _ecore_evas_win32_activate(Ecore_Evas *ee) | ||
717 | { | ||
718 | INF("ecore evas activate"); | ||
719 | |||
720 | ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window); | ||
721 | } | ||
722 | |||
723 | static void | ||
724 | _ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title) | ||
725 | { | ||
726 | INF("ecore evas title set"); | ||
727 | |||
728 | if (ee->prop.title) free(ee->prop.title); | ||
729 | ee->prop.title = NULL; | ||
730 | if (title) ee->prop.title = strdup(title); | ||
731 | ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
732 | ee->prop.title); | ||
733 | } | ||
734 | |||
735 | static void | ||
736 | _ecore_evas_win32_size_min_set(Ecore_Evas *ee, int width, int height) | ||
737 | { | ||
738 | if (width < 0) width = 0; | ||
739 | if (height < 0) height = 0; | ||
740 | if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; | ||
741 | ee->prop.min.w = width; | ||
742 | ee->prop.min.h = height; | ||
743 | ecore_win32_window_size_min_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
744 | width, height); | ||
745 | } | ||
746 | |||
747 | static void | ||
748 | _ecore_evas_win32_size_max_set(Ecore_Evas *ee, int width, int height) | ||
749 | { | ||
750 | if (width < 0) width = 0; | ||
751 | if (height < 0) height = 0; | ||
752 | if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; | ||
753 | ee->prop.max.w = width; | ||
754 | ee->prop.max.h = height; | ||
755 | ecore_win32_window_size_max_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
756 | width, height); | ||
757 | } | ||
758 | |||
759 | static void | ||
760 | _ecore_evas_win32_size_base_set(Ecore_Evas *ee, int width, int height) | ||
761 | { | ||
762 | if (width < 0) width = 0; | ||
763 | if (height < 0) height = 0; | ||
764 | if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; | ||
765 | ee->prop.base.w = width; | ||
766 | ee->prop.base.h = height; | ||
767 | ecore_win32_window_size_base_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
768 | width, height); | ||
769 | } | ||
770 | |||
771 | static void | ||
772 | _ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height) | ||
773 | { | ||
774 | if (width < 1) width = 1; | ||
775 | if (height < 1) height = 1; | ||
776 | if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; | ||
777 | ee->prop.step.w = width; | ||
778 | ee->prop.step.h = height; | ||
779 | ecore_win32_window_size_step_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
780 | width, height); | ||
781 | } | ||
782 | |||
783 | static void | ||
784 | _ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
785 | { | ||
786 | #if 0 | ||
787 | int x, y; | ||
788 | |||
789 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
790 | |||
791 | if (obj == NULL) | ||
792 | { | ||
793 | ee->prop.cursor.object = NULL; | ||
794 | ee->prop.cursor.layer = 0; | ||
795 | ee->prop.cursor.hot.x = 0; | ||
796 | ee->prop.cursor.hot.y = 0; | ||
797 | ecore_win32_window_cursor_show(ee->prop.window, 1); | ||
798 | return; | ||
799 | } | ||
800 | |||
801 | ee->prop.cursor.object = obj; | ||
802 | ee->prop.cursor.layer = layer; | ||
803 | ee->prop.cursor.hot.x = hot_x; | ||
804 | ee->prop.cursor.hot.y = hot_y; | ||
805 | |||
806 | ecore_win32_window_cursor_show(ee->prop.window, 0); | ||
807 | |||
808 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
809 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
810 | evas_object_move(ee->prop.cursor.object, | ||
811 | x - ee->prop.cursor.hot.x, | ||
812 | y - ee->prop.cursor.hot.y); | ||
813 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
814 | if (evas_pointer_inside_get(ee->evas)) | ||
815 | evas_object_show(ee->prop.cursor.object); | ||
816 | #endif | ||
817 | } | ||
818 | |||
819 | static void | ||
820 | _ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__) | ||
821 | { | ||
822 | ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window); | ||
823 | } | ||
824 | |||
825 | static void | ||
826 | _ecore_evas_win32_iconified_set(Ecore_Evas *ee, int on) | ||
827 | { | ||
828 | /* if (((ee->prop.borderless) && (on)) || */ | ||
829 | /* ((!ee->prop.borderless) && (!on))) return; */ | ||
830 | ee->prop.iconified = on; | ||
831 | ecore_win32_window_iconified_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
832 | ee->prop.iconified); | ||
833 | } | ||
834 | |||
835 | static void | ||
836 | _ecore_evas_win32_borderless_set(Ecore_Evas *ee, int on) | ||
837 | { | ||
838 | if (((ee->prop.borderless) && (on)) || | ||
839 | ((!ee->prop.borderless) && (!on))) return; | ||
840 | ee->prop.borderless = on; | ||
841 | ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
842 | ee->prop.borderless); | ||
843 | |||
844 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
845 | if (!strcmp(ee->driver, "software_gdi")) | ||
846 | { | ||
847 | Evas_Engine_Info_Software_Gdi *einfo; | ||
848 | |||
849 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
850 | if (einfo) | ||
851 | { | ||
852 | einfo->info.borderless = ee->prop.borderless; | ||
853 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
854 | { | ||
855 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
856 | } | ||
857 | if (ee->prop.borderless) | ||
858 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
859 | } | ||
860 | } | ||
861 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
862 | } | ||
863 | |||
864 | static void | ||
865 | _ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) | ||
866 | { | ||
867 | struct _Ecore_Win32_Window *window; | ||
868 | |||
869 | INF("ecore evas fullscreen set"); | ||
870 | |||
871 | if ((ee->engine.win32.state.fullscreen && on) || | ||
872 | (!ee->engine.win32.state.fullscreen && !on)) | ||
873 | return; | ||
874 | |||
875 | ee->engine.win32.state.fullscreen = on; | ||
876 | ee->prop.fullscreen = on; | ||
877 | |||
878 | window = (struct _Ecore_Win32_Window *)ee->prop.window; | ||
879 | |||
880 | if (on != 0) | ||
881 | { | ||
882 | ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
883 | on); | ||
884 | } | ||
885 | else | ||
886 | { | ||
887 | ecore_win32_window_fullscreen_set(window, on); | ||
888 | } | ||
889 | |||
890 | /* Nothing to be done for the GDI backend at the evas level */ | ||
891 | |||
892 | #ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW | ||
893 | if (strcmp(ee->driver, "software_ddraw") == 0) | ||
894 | { | ||
895 | Evas_Engine_Info_Software_DDraw *einfo; | ||
896 | |||
897 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); | ||
898 | if (einfo) | ||
899 | { | ||
900 | einfo->info.fullscreen = !!on; | ||
901 | /* einfo->info.layered = window->shape.layered; */ | ||
902 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
903 | { | ||
904 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
905 | } | ||
906 | } | ||
907 | } | ||
908 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
909 | |||
910 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
911 | if (strcmp(ee->driver, "direct3d") == 0) | ||
912 | { | ||
913 | Evas_Engine_Info_Direct3D *einfo; | ||
914 | |||
915 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); | ||
916 | if (einfo) | ||
917 | { | ||
918 | einfo->info.fullscreen = !!on; | ||
919 | einfo->info.layered = window->shape.layered; | ||
920 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
921 | { | ||
922 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
923 | } | ||
924 | } | ||
925 | } | ||
926 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
927 | } | ||
928 | |||
929 | |||
930 | static Ecore_Evas_Engine_Func _ecore_win32_engine_func = | ||
931 | { | ||
932 | _ecore_evas_win32_free, | ||
933 | NULL, | ||
934 | NULL, | ||
935 | NULL, | ||
936 | NULL, | ||
937 | _ecore_evas_win32_callback_delete_request_set, | ||
938 | NULL, | ||
939 | NULL, | ||
940 | NULL, | ||
941 | NULL, | ||
942 | NULL, | ||
943 | NULL, | ||
944 | NULL, | ||
945 | NULL, | ||
946 | NULL, | ||
947 | _ecore_evas_win32_move, | ||
948 | NULL, | ||
949 | _ecore_evas_win32_resize, | ||
950 | _ecore_evas_win32_move_resize, | ||
951 | _ecore_evas_win32_rotation_set, | ||
952 | _ecore_evas_win32_shaped_set, | ||
953 | _ecore_evas_win32_show, | ||
954 | _ecore_evas_win32_hide, | ||
955 | _ecore_evas_win32_raise, | ||
956 | _ecore_evas_win32_lower, | ||
957 | _ecore_evas_win32_activate, | ||
958 | _ecore_evas_win32_title_set, | ||
959 | NULL, /* _ecore_evas_x_name_class_set */ | ||
960 | _ecore_evas_win32_size_min_set, | ||
961 | _ecore_evas_win32_size_max_set, | ||
962 | _ecore_evas_win32_size_base_set, | ||
963 | _ecore_evas_win32_size_step_set, | ||
964 | _ecore_evas_win32_cursor_set, | ||
965 | NULL, /* _ecore_evas_x_layer_set */ | ||
966 | _ecore_evas_win32_focus_set, | ||
967 | _ecore_evas_win32_iconified_set, | ||
968 | _ecore_evas_win32_borderless_set, | ||
969 | NULL, /* _ecore_evas_x_override_set */ | ||
970 | NULL, | ||
971 | _ecore_evas_win32_fullscreen_set, | ||
972 | NULL, /* _ecore_evas_x_avoid_damage_set */ | ||
973 | NULL, /* _ecore_evas_x_withdrawn_set */ | ||
974 | NULL, /* _ecore_evas_x_sticky_set */ | ||
975 | NULL, /* _ecore_evas_x_ignore_events_set */ | ||
976 | NULL, /* _ecore_evas_x_alpha_set */ | ||
977 | NULL, //transparent | ||
978 | |||
979 | NULL, | ||
980 | NULL, | ||
981 | NULL, | ||
982 | NULL, | ||
983 | NULL, | ||
984 | NULL, | ||
985 | |||
986 | NULL, // render | ||
987 | NULL //screen_geometry_get | ||
988 | }; | ||
989 | |||
990 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
991 | |||
992 | /* API */ | ||
993 | |||
994 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
995 | static int | ||
996 | _ecore_evas_engine_software_gdi_init(Ecore_Evas *ee) | ||
997 | { | ||
998 | Evas_Engine_Info_Software_Gdi *einfo; | ||
999 | const char *driver; | ||
1000 | int rmethod; | ||
1001 | |||
1002 | driver = "software_gdi"; | ||
1003 | |||
1004 | rmethod = evas_render_method_lookup(driver); | ||
1005 | if (!rmethod) | ||
1006 | return 0; | ||
1007 | |||
1008 | ee->driver = driver; | ||
1009 | evas_output_method_set(ee->evas, rmethod); | ||
1010 | |||
1011 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
1012 | if (einfo) | ||
1013 | { | ||
1014 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1015 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1016 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1017 | einfo->info.rotation = 0; | ||
1018 | einfo->info.borderless = 0; | ||
1019 | einfo->info.fullscreen = 0; | ||
1020 | einfo->info.region = 0; | ||
1021 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1022 | { | ||
1023 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1024 | return 0; | ||
1025 | } | ||
1026 | } | ||
1027 | else | ||
1028 | { | ||
1029 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1030 | return 0; | ||
1031 | } | ||
1032 | |||
1033 | return 1; | ||
1034 | } | ||
1035 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1036 | |||
1037 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1038 | static int | ||
1039 | _ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee) | ||
1040 | { | ||
1041 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1042 | const char *driver; | ||
1043 | int rmethod; | ||
1044 | |||
1045 | driver = "software_ddraw"; | ||
1046 | |||
1047 | rmethod = evas_render_method_lookup(driver); | ||
1048 | if (!rmethod) | ||
1049 | return 0; | ||
1050 | |||
1051 | ee->driver = driver; | ||
1052 | evas_output_method_set(ee->evas, rmethod); | ||
1053 | |||
1054 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); | ||
1055 | if (einfo) | ||
1056 | { | ||
1057 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1058 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1059 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1060 | einfo->info.rotation = 0; | ||
1061 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1062 | { | ||
1063 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1064 | return 0; | ||
1065 | } | ||
1066 | } | ||
1067 | else | ||
1068 | { | ||
1069 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1070 | return 0; | ||
1071 | } | ||
1072 | |||
1073 | return 1; | ||
1074 | } | ||
1075 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1076 | |||
1077 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1078 | static int | ||
1079 | _ecore_evas_engine_direct3d_init(Ecore_Evas *ee) | ||
1080 | { | ||
1081 | Evas_Engine_Info_Direct3D *einfo; | ||
1082 | const char *driver; | ||
1083 | int rmethod; | ||
1084 | |||
1085 | driver = "direct3d"; | ||
1086 | |||
1087 | rmethod = evas_render_method_lookup(driver); | ||
1088 | if (!rmethod) | ||
1089 | return 0; | ||
1090 | |||
1091 | ee->driver = driver; | ||
1092 | evas_output_method_set(ee->evas, rmethod); | ||
1093 | |||
1094 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ee->evas); | ||
1095 | if (einfo) | ||
1096 | { | ||
1097 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1098 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1099 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1100 | einfo->info.rotation = 0; | ||
1101 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1102 | { | ||
1103 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1104 | return 0; | ||
1105 | } | ||
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1110 | return 0; | ||
1111 | } | ||
1112 | |||
1113 | return 1; | ||
1114 | } | ||
1115 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
1116 | |||
1117 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1118 | static int | ||
1119 | _ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee) | ||
1120 | { | ||
1121 | Evas_Engine_Info_GL_Glew *einfo; | ||
1122 | const char *driver; | ||
1123 | int rmethod; | ||
1124 | |||
1125 | driver = "gl_glew"; | ||
1126 | |||
1127 | rmethod = evas_render_method_lookup(driver); | ||
1128 | if (!rmethod) | ||
1129 | return 0; | ||
1130 | |||
1131 | ee->driver = driver; | ||
1132 | evas_output_method_set(ee->evas, rmethod); | ||
1133 | |||
1134 | einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(ee->evas); | ||
1135 | if (einfo) | ||
1136 | { | ||
1137 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1138 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1139 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1140 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1141 | { | ||
1142 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1143 | return 0; | ||
1144 | } | ||
1145 | } | ||
1146 | else | ||
1147 | { | ||
1148 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1149 | return 0; | ||
1150 | } | ||
1151 | |||
1152 | return 1; | ||
1153 | } | ||
1154 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1155 | |||
1156 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1157 | static int | ||
1158 | _ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee) | ||
1159 | { | ||
1160 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1161 | const char *driver; | ||
1162 | int rmethod; | ||
1163 | |||
1164 | driver = "software_16_ddraw"; | ||
1165 | |||
1166 | rmethod = evas_render_method_lookup(driver); | ||
1167 | if (!rmethod) | ||
1168 | return 0; | ||
1169 | |||
1170 | ee->driver = driver; | ||
1171 | evas_output_method_set(ee->evas, rmethod); | ||
1172 | |||
1173 | if (ecore_win32_screen_depth_get() != 16) | ||
1174 | return 0; | ||
1175 | |||
1176 | einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(ee->evas); | ||
1177 | if (einfo) | ||
1178 | { | ||
1179 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1180 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1181 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1182 | einfo->info.rotation = 0; | ||
1183 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1184 | { | ||
1185 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1186 | return 0; | ||
1187 | } | ||
1188 | } | ||
1189 | else | ||
1190 | { | ||
1191 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1192 | return 0; | ||
1193 | } | ||
1194 | |||
1195 | return 1; | ||
1196 | } | ||
1197 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1198 | |||
1199 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1200 | static Ecore_Evas * | ||
1201 | _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), | ||
1202 | Ecore_Win32_Window *parent, | ||
1203 | int x, | ||
1204 | int y, | ||
1205 | int width, | ||
1206 | int height) | ||
1207 | { | ||
1208 | Ecore_Evas *ee; | ||
1209 | |||
1210 | if (!ecore_win32_init()) | ||
1211 | return NULL; | ||
1212 | |||
1213 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1214 | if (!ee) | ||
1215 | return NULL; | ||
1216 | |||
1217 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1218 | |||
1219 | _ecore_evas_win32_init(); | ||
1220 | |||
1221 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_win32_engine_func; | ||
1222 | |||
1223 | if (width < 1) width = 1; | ||
1224 | if (height < 1) height = 1; | ||
1225 | ee->x = x; | ||
1226 | ee->y = y; | ||
1227 | ee->w = width; | ||
1228 | ee->h = height; | ||
1229 | ee->req.x = ee->x; | ||
1230 | ee->req.y = ee->y; | ||
1231 | ee->req.w = ee->w; | ||
1232 | ee->req.h = ee->h; | ||
1233 | |||
1234 | ee->prop.max.w = 32767; | ||
1235 | ee->prop.max.h = 32767; | ||
1236 | ee->prop.layer = 4; | ||
1237 | ee->prop.request_pos = 0; | ||
1238 | ee->prop.sticky = 0; | ||
1239 | /* FIXME: sticky to add */ | ||
1240 | ee->prop.window = 0; | ||
1241 | |||
1242 | /* init evas here */ | ||
1243 | ee->evas = evas_new(); | ||
1244 | evas_data_attach_set(ee->evas, ee); | ||
1245 | evas_output_size_set(ee->evas, width, height); | ||
1246 | evas_output_viewport_set(ee->evas, 0, 0, width, height); | ||
1247 | |||
1248 | ee->engine.win32.parent = parent; | ||
1249 | ee->prop.window = (Ecore_Window)ecore_win32_window_new(parent, x, y, width, height); | ||
1250 | if (!ee->prop.window) | ||
1251 | { | ||
1252 | _ecore_evas_win32_shutdown(); | ||
1253 | free(ee); | ||
1254 | return NULL; | ||
1255 | } | ||
1256 | |||
1257 | if (!_ecore_evas_engine_init(ee)) | ||
1258 | { | ||
1259 | _ecore_evas_win32_shutdown(); | ||
1260 | free(ee); | ||
1261 | return NULL; | ||
1262 | } | ||
1263 | |||
1264 | ee->engine.func->fn_render = _ecore_evas_win32_render; | ||
1265 | _ecore_evas_register(ee); | ||
1266 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1267 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1268 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1269 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1270 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1271 | |||
1272 | return ee; | ||
1273 | } | ||
1274 | |||
1275 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
1276 | |||
1277 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
1278 | |||
1279 | EAPI Ecore_Evas * | ||
1280 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, | ||
1281 | int x, | ||
1282 | int y, | ||
1283 | int width, | ||
1284 | int height) | ||
1285 | { | ||
1286 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_gdi_init, | ||
1287 | parent, | ||
1288 | x, | ||
1289 | y, | ||
1290 | width, | ||
1291 | height); | ||
1292 | } | ||
1293 | |||
1294 | #else | ||
1295 | |||
1296 | EAPI Ecore_Evas * | ||
1297 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1298 | int x __UNUSED__, | ||
1299 | int y __UNUSED__, | ||
1300 | int width __UNUSED__, | ||
1301 | int height __UNUSED__) | ||
1302 | { | ||
1303 | return NULL; | ||
1304 | } | ||
1305 | |||
1306 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1307 | |||
1308 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1309 | |||
1310 | EAPI Ecore_Evas * | ||
1311 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, | ||
1312 | int x, | ||
1313 | int y, | ||
1314 | int width, | ||
1315 | int height) | ||
1316 | { | ||
1317 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_ddraw_init, | ||
1318 | parent, | ||
1319 | x, | ||
1320 | y, | ||
1321 | width, | ||
1322 | height); | ||
1323 | } | ||
1324 | |||
1325 | #else | ||
1326 | |||
1327 | EAPI Ecore_Evas * | ||
1328 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1329 | int x __UNUSED__, | ||
1330 | int y __UNUSED__, | ||
1331 | int width __UNUSED__, | ||
1332 | int height __UNUSED__) | ||
1333 | { | ||
1334 | return NULL; | ||
1335 | } | ||
1336 | |||
1337 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1338 | |||
1339 | |||
1340 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1341 | |||
1342 | EAPI Ecore_Evas * | ||
1343 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, | ||
1344 | int x, | ||
1345 | int y, | ||
1346 | int width, | ||
1347 | int height) | ||
1348 | { | ||
1349 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_16_ddraw_init, | ||
1350 | parent, | ||
1351 | x, | ||
1352 | y, | ||
1353 | width, | ||
1354 | height); | ||
1355 | } | ||
1356 | |||
1357 | #else | ||
1358 | |||
1359 | EAPI Ecore_Evas * | ||
1360 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1361 | int x __UNUSED__, | ||
1362 | int y __UNUSED__, | ||
1363 | int width __UNUSED__, | ||
1364 | int height __UNUSED__) | ||
1365 | { | ||
1366 | return NULL; | ||
1367 | } | ||
1368 | |||
1369 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1370 | |||
1371 | |||
1372 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1373 | |||
1374 | EAPI Ecore_Evas * | ||
1375 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent, | ||
1376 | int x, | ||
1377 | int y, | ||
1378 | int width, | ||
1379 | int height) | ||
1380 | { | ||
1381 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_direct3d_init, | ||
1382 | parent, | ||
1383 | x, | ||
1384 | y, | ||
1385 | width, | ||
1386 | height); | ||
1387 | } | ||
1388 | |||
1389 | #else | ||
1390 | |||
1391 | EAPI Ecore_Evas * | ||
1392 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1393 | int x __UNUSED__, | ||
1394 | int y __UNUSED__, | ||
1395 | int width __UNUSED__, | ||
1396 | int height __UNUSED__) | ||
1397 | { | ||
1398 | return NULL; | ||
1399 | } | ||
1400 | |||
1401 | #endif /* ! BUILD_ECORE_EVAS_DIRECT3D */ | ||
1402 | |||
1403 | |||
1404 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1405 | |||
1406 | EAPI Ecore_Evas * | ||
1407 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, | ||
1408 | int x, | ||
1409 | int y, | ||
1410 | int width, | ||
1411 | int height) | ||
1412 | { | ||
1413 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_opengl_glew_init, | ||
1414 | parent, | ||
1415 | x, | ||
1416 | y, | ||
1417 | width, | ||
1418 | height); | ||
1419 | } | ||
1420 | |||
1421 | #else | ||
1422 | |||
1423 | EAPI Ecore_Evas * | ||
1424 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1425 | int x __UNUSED__, | ||
1426 | int y __UNUSED__, | ||
1427 | int width __UNUSED__, | ||
1428 | int height __UNUSED__) | ||
1429 | { | ||
1430 | return NULL; | ||
1431 | } | ||
1432 | |||
1433 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1434 | |||
1435 | |||
1436 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1437 | |||
1438 | EAPI Ecore_Win32_Window * | ||
1439 | ecore_evas_win32_window_get(const Ecore_Evas *ee) | ||
1440 | { | ||
1441 | return (Ecore_Win32_Window *) ecore_evas_window_get(ee); | ||
1442 | } | ||
1443 | |||
1444 | #else | ||
1445 | |||
1446 | EAPI Ecore_Win32_Window * | ||
1447 | ecore_evas_win32_window_get(const Ecore_Evas *ee __UNUSED__) | ||
1448 | { | ||
1449 | return NULL; | ||
1450 | } | ||
1451 | |||
1452 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||