diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c | 1451 |
1 files changed, 1451 insertions, 0 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 new file mode 100644 index 0000000..2ca7cb0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c | |||
@@ -0,0 +1,1451 @@ | |||
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->time, NULL); | ||
151 | evas_focus_in(ee->evas); | ||
152 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
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->time); | ||
173 | |||
174 | evas_event_feed_mouse_out(ee->evas, e->time, 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 | void (*func) (Ecore_Evas *ee)) | ||
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_set((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_set((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_shape_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
883 | 0, 0, NULL); | ||
884 | ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, | ||
885 | on); | ||
886 | } | ||
887 | else | ||
888 | { | ||
889 | ecore_win32_window_fullscreen_set(window, on); | ||
890 | ecore_win32_window_shape_set(window, | ||
891 | window->shape.width, | ||
892 | window->shape.height, | ||
893 | window->shape.mask); | ||
894 | } | ||
895 | |||
896 | /* Nothing to be done for the GDI backend at the evas level */ | ||
897 | |||
898 | #ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW | ||
899 | if (strcmp(ee->driver, "software_ddraw") == 0) | ||
900 | { | ||
901 | Evas_Engine_Info_Software_DDraw *einfo; | ||
902 | |||
903 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); | ||
904 | if (einfo) | ||
905 | { | ||
906 | einfo->info.fullscreen = !!on; | ||
907 | /* einfo->info.layered = window->shape.layered; */ | ||
908 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
909 | { | ||
910 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
911 | } | ||
912 | } | ||
913 | } | ||
914 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
915 | |||
916 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
917 | if (strcmp(ee->driver, "direct3d") == 0) | ||
918 | { | ||
919 | Evas_Engine_Info_Direct3D *einfo; | ||
920 | |||
921 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); | ||
922 | if (einfo) | ||
923 | { | ||
924 | einfo->info.fullscreen = !!on; | ||
925 | einfo->info.layered = window->shape.layered; | ||
926 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
927 | { | ||
928 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
929 | } | ||
930 | } | ||
931 | } | ||
932 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
933 | } | ||
934 | |||
935 | |||
936 | static Ecore_Evas_Engine_Func _ecore_win32_engine_func = | ||
937 | { | ||
938 | _ecore_evas_win32_free, | ||
939 | NULL, | ||
940 | NULL, | ||
941 | NULL, | ||
942 | NULL, | ||
943 | _ecore_evas_win32_callback_delete_request_set, | ||
944 | NULL, | ||
945 | NULL, | ||
946 | NULL, | ||
947 | NULL, | ||
948 | NULL, | ||
949 | NULL, | ||
950 | NULL, | ||
951 | NULL, | ||
952 | NULL, | ||
953 | _ecore_evas_win32_move, | ||
954 | NULL, | ||
955 | _ecore_evas_win32_resize, | ||
956 | _ecore_evas_win32_move_resize, | ||
957 | _ecore_evas_win32_rotation_set, | ||
958 | _ecore_evas_win32_shaped_set, | ||
959 | _ecore_evas_win32_show, | ||
960 | _ecore_evas_win32_hide, | ||
961 | _ecore_evas_win32_raise, | ||
962 | _ecore_evas_win32_lower, | ||
963 | _ecore_evas_win32_activate, | ||
964 | _ecore_evas_win32_title_set, | ||
965 | NULL, /* _ecore_evas_x_name_class_set */ | ||
966 | _ecore_evas_win32_size_min_set, | ||
967 | _ecore_evas_win32_size_max_set, | ||
968 | _ecore_evas_win32_size_base_set, | ||
969 | _ecore_evas_win32_size_step_set, | ||
970 | _ecore_evas_win32_cursor_set, | ||
971 | NULL, /* _ecore_evas_x_layer_set */ | ||
972 | _ecore_evas_win32_focus_set, | ||
973 | _ecore_evas_win32_iconified_set, | ||
974 | _ecore_evas_win32_borderless_set, | ||
975 | NULL, /* _ecore_evas_x_override_set */ | ||
976 | NULL, | ||
977 | _ecore_evas_win32_fullscreen_set, | ||
978 | NULL, /* _ecore_evas_x_avoid_damage_set */ | ||
979 | NULL, /* _ecore_evas_x_withdrawn_set */ | ||
980 | NULL, /* _ecore_evas_x_sticky_set */ | ||
981 | NULL, /* _ecore_evas_x_ignore_events_set */ | ||
982 | NULL, /* _ecore_evas_x_alpha_set */ | ||
983 | NULL, //transparent | ||
984 | |||
985 | NULL, // render | ||
986 | NULL //screen_geometry_get | ||
987 | }; | ||
988 | |||
989 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
990 | |||
991 | /* API */ | ||
992 | |||
993 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
994 | static int | ||
995 | _ecore_evas_engine_software_gdi_init(Ecore_Evas *ee) | ||
996 | { | ||
997 | Evas_Engine_Info_Software_Gdi *einfo; | ||
998 | const char *driver; | ||
999 | int rmethod; | ||
1000 | |||
1001 | driver = "software_gdi"; | ||
1002 | |||
1003 | rmethod = evas_render_method_lookup(driver); | ||
1004 | if (!rmethod) | ||
1005 | return 0; | ||
1006 | |||
1007 | ee->driver = driver; | ||
1008 | evas_output_method_set(ee->evas, rmethod); | ||
1009 | |||
1010 | einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); | ||
1011 | if (einfo) | ||
1012 | { | ||
1013 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1014 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1015 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1016 | einfo->info.rotation = 0; | ||
1017 | einfo->info.borderless = 0; | ||
1018 | einfo->info.fullscreen = 0; | ||
1019 | einfo->info.region = 0; | ||
1020 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1021 | { | ||
1022 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1023 | return 0; | ||
1024 | } | ||
1025 | } | ||
1026 | else | ||
1027 | { | ||
1028 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1029 | return 0; | ||
1030 | } | ||
1031 | |||
1032 | return 1; | ||
1033 | } | ||
1034 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1035 | |||
1036 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1037 | static int | ||
1038 | _ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee) | ||
1039 | { | ||
1040 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1041 | const char *driver; | ||
1042 | int rmethod; | ||
1043 | |||
1044 | driver = "software_ddraw"; | ||
1045 | |||
1046 | rmethod = evas_render_method_lookup(driver); | ||
1047 | if (!rmethod) | ||
1048 | return 0; | ||
1049 | |||
1050 | ee->driver = driver; | ||
1051 | evas_output_method_set(ee->evas, rmethod); | ||
1052 | |||
1053 | einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); | ||
1054 | if (einfo) | ||
1055 | { | ||
1056 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1057 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1058 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1059 | einfo->info.rotation = 0; | ||
1060 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1061 | { | ||
1062 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1063 | return 0; | ||
1064 | } | ||
1065 | } | ||
1066 | else | ||
1067 | { | ||
1068 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1069 | return 0; | ||
1070 | } | ||
1071 | |||
1072 | return 1; | ||
1073 | } | ||
1074 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1075 | |||
1076 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1077 | static int | ||
1078 | _ecore_evas_engine_direct3d_init(Ecore_Evas *ee) | ||
1079 | { | ||
1080 | Evas_Engine_Info_Direct3D *einfo; | ||
1081 | const char *driver; | ||
1082 | int rmethod; | ||
1083 | |||
1084 | driver = "direct3d"; | ||
1085 | |||
1086 | rmethod = evas_render_method_lookup(driver); | ||
1087 | if (!rmethod) | ||
1088 | return 0; | ||
1089 | |||
1090 | ee->driver = driver; | ||
1091 | evas_output_method_set(ee->evas, rmethod); | ||
1092 | |||
1093 | einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ee->evas); | ||
1094 | if (einfo) | ||
1095 | { | ||
1096 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1097 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1098 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1099 | einfo->info.rotation = 0; | ||
1100 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1101 | { | ||
1102 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1103 | return 0; | ||
1104 | } | ||
1105 | } | ||
1106 | else | ||
1107 | { | ||
1108 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1109 | return 0; | ||
1110 | } | ||
1111 | |||
1112 | return 1; | ||
1113 | } | ||
1114 | #endif /* BUILD_ECORE_EVAS_DIRECT3D */ | ||
1115 | |||
1116 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1117 | static int | ||
1118 | _ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee) | ||
1119 | { | ||
1120 | Evas_Engine_Info_GL_Glew *einfo; | ||
1121 | const char *driver; | ||
1122 | int rmethod; | ||
1123 | |||
1124 | driver = "gl_glew"; | ||
1125 | |||
1126 | rmethod = evas_render_method_lookup(driver); | ||
1127 | if (!rmethod) | ||
1128 | return 0; | ||
1129 | |||
1130 | ee->driver = driver; | ||
1131 | evas_output_method_set(ee->evas, rmethod); | ||
1132 | |||
1133 | einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(ee->evas); | ||
1134 | if (einfo) | ||
1135 | { | ||
1136 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1137 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1138 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1139 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1140 | { | ||
1141 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1142 | return 0; | ||
1143 | } | ||
1144 | } | ||
1145 | else | ||
1146 | { | ||
1147 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1148 | return 0; | ||
1149 | } | ||
1150 | |||
1151 | return 1; | ||
1152 | } | ||
1153 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1154 | |||
1155 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1156 | static int | ||
1157 | _ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee) | ||
1158 | { | ||
1159 | Evas_Engine_Info_Software_DDraw *einfo; | ||
1160 | const char *driver; | ||
1161 | int rmethod; | ||
1162 | |||
1163 | driver = "software_16_ddraw"; | ||
1164 | |||
1165 | rmethod = evas_render_method_lookup(driver); | ||
1166 | if (!rmethod) | ||
1167 | return 0; | ||
1168 | |||
1169 | ee->driver = driver; | ||
1170 | evas_output_method_set(ee->evas, rmethod); | ||
1171 | |||
1172 | if (ecore_win32_screen_depth_get() != 16) | ||
1173 | return 0; | ||
1174 | |||
1175 | einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(ee->evas); | ||
1176 | if (einfo) | ||
1177 | { | ||
1178 | /* FIXME: REDRAW_DEBUG missing for now */ | ||
1179 | einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; | ||
1180 | einfo->info.depth = ecore_win32_screen_depth_get(); | ||
1181 | einfo->info.rotation = 0; | ||
1182 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1183 | { | ||
1184 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1185 | return 0; | ||
1186 | } | ||
1187 | } | ||
1188 | else | ||
1189 | { | ||
1190 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
1191 | return 0; | ||
1192 | } | ||
1193 | |||
1194 | return 1; | ||
1195 | } | ||
1196 | #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1197 | |||
1198 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1199 | static Ecore_Evas * | ||
1200 | _ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), | ||
1201 | Ecore_Win32_Window *parent, | ||
1202 | int x, | ||
1203 | int y, | ||
1204 | int width, | ||
1205 | int height) | ||
1206 | { | ||
1207 | Ecore_Evas *ee; | ||
1208 | |||
1209 | if (!ecore_win32_init()) | ||
1210 | return NULL; | ||
1211 | |||
1212 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1213 | if (!ee) | ||
1214 | return NULL; | ||
1215 | |||
1216 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1217 | |||
1218 | _ecore_evas_win32_init(); | ||
1219 | |||
1220 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_win32_engine_func; | ||
1221 | |||
1222 | if (width < 1) width = 1; | ||
1223 | if (height < 1) height = 1; | ||
1224 | ee->x = x; | ||
1225 | ee->y = y; | ||
1226 | ee->w = width; | ||
1227 | ee->h = height; | ||
1228 | ee->req.x = ee->x; | ||
1229 | ee->req.y = ee->y; | ||
1230 | ee->req.w = ee->w; | ||
1231 | ee->req.h = ee->h; | ||
1232 | |||
1233 | ee->prop.max.w = 32767; | ||
1234 | ee->prop.max.h = 32767; | ||
1235 | ee->prop.layer = 4; | ||
1236 | ee->prop.request_pos = 0; | ||
1237 | ee->prop.sticky = 0; | ||
1238 | /* FIXME: sticky to add */ | ||
1239 | ee->prop.window = 0; | ||
1240 | |||
1241 | /* init evas here */ | ||
1242 | ee->evas = evas_new(); | ||
1243 | evas_data_attach_set(ee->evas, ee); | ||
1244 | evas_output_size_set(ee->evas, width, height); | ||
1245 | evas_output_viewport_set(ee->evas, 0, 0, width, height); | ||
1246 | |||
1247 | ee->engine.win32.parent = parent; | ||
1248 | ee->prop.window = (Ecore_Window)ecore_win32_window_new(parent, x, y, width, height); | ||
1249 | if (!ee->prop.window) | ||
1250 | { | ||
1251 | _ecore_evas_win32_shutdown(); | ||
1252 | free(ee); | ||
1253 | return NULL; | ||
1254 | } | ||
1255 | |||
1256 | if (!_ecore_evas_engine_init(ee)) | ||
1257 | { | ||
1258 | _ecore_evas_win32_shutdown(); | ||
1259 | free(ee); | ||
1260 | return NULL; | ||
1261 | } | ||
1262 | |||
1263 | ee->engine.func->fn_render = _ecore_evas_win32_render; | ||
1264 | _ecore_evas_register(ee); | ||
1265 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
1266 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
1267 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
1268 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
1269 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
1270 | |||
1271 | return ee; | ||
1272 | } | ||
1273 | |||
1274 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||
1275 | |||
1276 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | ||
1277 | |||
1278 | EAPI Ecore_Evas * | ||
1279 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, | ||
1280 | int x, | ||
1281 | int y, | ||
1282 | int width, | ||
1283 | int height) | ||
1284 | { | ||
1285 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_gdi_init, | ||
1286 | parent, | ||
1287 | x, | ||
1288 | y, | ||
1289 | width, | ||
1290 | height); | ||
1291 | } | ||
1292 | |||
1293 | #else | ||
1294 | |||
1295 | EAPI Ecore_Evas * | ||
1296 | ecore_evas_software_gdi_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1297 | int x __UNUSED__, | ||
1298 | int y __UNUSED__, | ||
1299 | int width __UNUSED__, | ||
1300 | int height __UNUSED__) | ||
1301 | { | ||
1302 | return NULL; | ||
1303 | } | ||
1304 | |||
1305 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_GDI */ | ||
1306 | |||
1307 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW | ||
1308 | |||
1309 | EAPI Ecore_Evas * | ||
1310 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, | ||
1311 | int x, | ||
1312 | int y, | ||
1313 | int width, | ||
1314 | int height) | ||
1315 | { | ||
1316 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_ddraw_init, | ||
1317 | parent, | ||
1318 | x, | ||
1319 | y, | ||
1320 | width, | ||
1321 | height); | ||
1322 | } | ||
1323 | |||
1324 | #else | ||
1325 | |||
1326 | EAPI Ecore_Evas * | ||
1327 | ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1328 | int x __UNUSED__, | ||
1329 | int y __UNUSED__, | ||
1330 | int width __UNUSED__, | ||
1331 | int height __UNUSED__) | ||
1332 | { | ||
1333 | return NULL; | ||
1334 | } | ||
1335 | |||
1336 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ | ||
1337 | |||
1338 | |||
1339 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW | ||
1340 | |||
1341 | EAPI Ecore_Evas * | ||
1342 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, | ||
1343 | int x, | ||
1344 | int y, | ||
1345 | int width, | ||
1346 | int height) | ||
1347 | { | ||
1348 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_16_ddraw_init, | ||
1349 | parent, | ||
1350 | x, | ||
1351 | y, | ||
1352 | width, | ||
1353 | height); | ||
1354 | } | ||
1355 | |||
1356 | #else | ||
1357 | |||
1358 | EAPI Ecore_Evas * | ||
1359 | ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1360 | int x __UNUSED__, | ||
1361 | int y __UNUSED__, | ||
1362 | int width __UNUSED__, | ||
1363 | int height __UNUSED__) | ||
1364 | { | ||
1365 | return NULL; | ||
1366 | } | ||
1367 | |||
1368 | #endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ | ||
1369 | |||
1370 | |||
1371 | #ifdef BUILD_ECORE_EVAS_DIRECT3D | ||
1372 | |||
1373 | EAPI Ecore_Evas * | ||
1374 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent, | ||
1375 | int x, | ||
1376 | int y, | ||
1377 | int width, | ||
1378 | int height) | ||
1379 | { | ||
1380 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_direct3d_init, | ||
1381 | parent, | ||
1382 | x, | ||
1383 | y, | ||
1384 | width, | ||
1385 | height); | ||
1386 | } | ||
1387 | |||
1388 | #else | ||
1389 | |||
1390 | EAPI Ecore_Evas * | ||
1391 | ecore_evas_direct3d_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1392 | int x __UNUSED__, | ||
1393 | int y __UNUSED__, | ||
1394 | int width __UNUSED__, | ||
1395 | int height __UNUSED__) | ||
1396 | { | ||
1397 | return NULL; | ||
1398 | } | ||
1399 | |||
1400 | #endif /* ! BUILD_ECORE_EVAS_DIRECT3D */ | ||
1401 | |||
1402 | |||
1403 | #ifdef BUILD_ECORE_EVAS_OPENGL_GLEW | ||
1404 | |||
1405 | EAPI Ecore_Evas * | ||
1406 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, | ||
1407 | int x, | ||
1408 | int y, | ||
1409 | int width, | ||
1410 | int height) | ||
1411 | { | ||
1412 | return _ecore_evas_win32_new_internal(_ecore_evas_engine_opengl_glew_init, | ||
1413 | parent, | ||
1414 | x, | ||
1415 | y, | ||
1416 | width, | ||
1417 | height); | ||
1418 | } | ||
1419 | |||
1420 | #else | ||
1421 | |||
1422 | EAPI Ecore_Evas * | ||
1423 | ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__, | ||
1424 | int x __UNUSED__, | ||
1425 | int y __UNUSED__, | ||
1426 | int width __UNUSED__, | ||
1427 | int height __UNUSED__) | ||
1428 | { | ||
1429 | return NULL; | ||
1430 | } | ||
1431 | |||
1432 | #endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ | ||
1433 | |||
1434 | |||
1435 | #ifdef BUILD_ECORE_EVAS_WIN32 | ||
1436 | |||
1437 | EAPI Ecore_Win32_Window * | ||
1438 | ecore_evas_win32_window_get(const Ecore_Evas *ee) | ||
1439 | { | ||
1440 | return (Ecore_Win32_Window *) ecore_evas_window_get(ee); | ||
1441 | } | ||
1442 | |||
1443 | #else | ||
1444 | |||
1445 | EAPI Ecore_Win32_Window * | ||
1446 | ecore_evas_win32_window_get(const Ecore_Evas *ee __UNUSED__) | ||
1447 | { | ||
1448 | return NULL; | ||
1449 | } | ||
1450 | |||
1451 | #endif /* BUILD_ECORE_EVAS_WIN32 */ | ||