aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c')
-rw-r--r--libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c985
1 files changed, 985 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
new file mode 100644
index 0000000..e102cb7
--- /dev/null
+++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c
@@ -0,0 +1,985 @@
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_SOFTWARE_16_WINCE
10# define WIN32_LEAN_AND_MEAN
11# include <windows.h>
12# undef WIN32_LEAN_AND_MEAN
13# include <Ecore_WinCE.h>
14# include <ecore_wince_private.h>
15#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
16
17#include "ecore_evas_private.h"
18#include "Ecore_Evas.h"
19
20#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
21
22#define ECORE_EVAS_EVENT_COUNT 9
23
24static int _ecore_evas_init_count = 0;
25
26static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT];
27
28static Eina_Bool _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
29
30static Eina_Bool _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
31
32static Eina_Bool _ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
33
34static Eina_Bool _ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event);
35
36static Eina_Bool _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event);
37
38static Eina_Bool _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event);
39
40static Eina_Bool _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event);
41
42static Eina_Bool _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event);
43
44static Eina_Bool _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event);
45
46/* Private functions */
47
48static int
49_ecore_evas_wince_render(Ecore_Evas *ee)
50{
51 int rend = 0;
52 Eina_List *updates = NULL;
53 Eina_List *ll;
54 Ecore_Evas *ee2;
55
56 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
57 {
58 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
59 if (ee2->engine.func->fn_render)
60 rend |= ee2->engine.func->fn_render(ee2);
61 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
62 }
63
64 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
65 if (ee->prop.avoid_damage)
66 {
67 updates = evas_render_updates(ee->evas);
68 if (updates) evas_render_updates_free(updates);
69 }
70 else if ((ee->visible) ||
71 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
72 ((ee->should_be_visible) && (ee->prop.override)))
73 {
74 if (ee->shaped)
75 {
76 updates = evas_render_updates(ee->evas);
77 if (updates) evas_render_updates_free(updates);
78 }
79 else
80 {
81 updates = evas_render_updates(ee->evas);
82 if (updates) evas_render_updates_free(updates);
83 }
84 }
85 else
86 evas_norender(ee->evas);
87 if (updates) rend = 1;
88 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
89 return rend;
90}
91
92static int
93_ecore_evas_wince_init(void)
94{
95 _ecore_evas_init_count++;
96 if (_ecore_evas_init_count > 1)
97 return _ecore_evas_init_count;
98
99 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_IN, _ecore_evas_wince_event_mouse_in, NULL);
100 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_OUT, _ecore_evas_wince_event_mouse_out, NULL);
101 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, _ecore_evas_wince_event_window_focus_in, NULL);
102 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_wince_event_window_focus_out, NULL);
103 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, _ecore_evas_wince_event_window_damage, NULL);
104 ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, _ecore_evas_wince_event_window_destroy, NULL);
105 ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_SHOW, _ecore_evas_wince_event_window_show, NULL);
106 ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_HIDE, _ecore_evas_wince_event_window_hide, NULL);
107 ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_wince_event_window_delete_request, NULL);
108
109 ecore_event_evas_init();
110 return _ecore_evas_init_count;
111}
112
113int
114_ecore_evas_wince_shutdown(void)
115{
116 _ecore_evas_init_count--;
117 if (_ecore_evas_init_count == 0)
118 {
119 int i;
120
121 for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++)
122 ecore_event_handler_del(ecore_evas_event_handlers[i]);
123 ecore_event_evas_shutdown();
124 }
125
126 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
127
128 return _ecore_evas_init_count;
129}
130
131static Eina_Bool
132_ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
133{
134 Ecore_Evas *ee;
135 Ecore_WinCE_Event_Mouse_In *e;
136
137 INF("mouse in");
138
139 e = event;
140 ee = ecore_event_window_match((Ecore_Window)e->window);
141 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
142 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
143
144 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
145 /* FIXME to do */
146/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
147 evas_event_feed_mouse_in(ee->evas, e->time, NULL);
148 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
149
150 return 1;
151}
152
153static Eina_Bool
154_ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
155{
156 Ecore_Evas *ee;
157 Ecore_WinCE_Event_Mouse_Out *e;
158
159 INF("mouse out");
160
161 e = event;
162 ee = ecore_event_window_match((Ecore_Window)e->window);
163 if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
164 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
165
166 /* FIXME to do */
167/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
168 _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
169
170 evas_event_feed_mouse_out(ee->evas, e->time, NULL);
171 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
172 if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
173
174 return 1;
175}
176
177static Eina_Bool
178_ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
179{
180 Ecore_Evas *ee;
181 Ecore_WinCE_Event_Window_Focus_In *e;
182
183 e = event;
184 ee = ecore_event_window_match(e->window);
185 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
186 if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
187
188 ee->prop.focused = 1;
189 evas_focus_in(ee->evas);
190 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
191 return ECORE_CALLBACK_PASS_ON;
192}
193
194static Eina_Bool
195_ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event)
196{
197 Ecore_Evas *ee;
198 Ecore_WinCE_Event_Window_Focus_Out *e;
199
200 e = event;
201 ee = ecore_event_window_match(e->window);
202 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
203 if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
204
205 evas_focus_out(ee->evas);
206 ee->prop.focused = 0;
207 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
208 return ECORE_CALLBACK_PASS_ON;
209}
210
211static Eina_Bool
212_ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event)
213{
214 Ecore_Evas *ee;
215 Ecore_WinCE_Event_Window_Damage *e;
216
217 INF("window damage");
218
219 e = event;
220 ee = ecore_event_window_match((Ecore_Window)e->window);
221 if (!ee) return 1; /* pass on event */
222 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
223
224 if (ee->prop.avoid_damage)
225 {
226#warning [ECORE] [WINCE] No Region code
227 }
228 else
229 {
230 if (ee->rotation == 0)
231 evas_damage_rectangle_add(ee->evas,
232 e->x,
233 e->y,
234 e->width,
235 e->height);
236 else if (ee->rotation == 90)
237 evas_damage_rectangle_add(ee->evas,
238 ee->h - e->y - e->height,
239 e->x,
240 e->height,
241 e->width);
242 else if (ee->rotation == 180)
243 evas_damage_rectangle_add(ee->evas,
244 ee->w - e->x - e->width,
245 ee->h - e->y - e->height,
246 e->width,
247 e->height);
248 else if (ee->rotation == 270)
249 evas_damage_rectangle_add(ee->evas,
250 e->y,
251 ee->w - e->x - e->width,
252 e->height,
253 e->width);
254 }
255
256 return 1;
257}
258
259static Eina_Bool
260_ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event)
261{
262 Ecore_Evas *ee;
263 Ecore_WinCE_Event_Window_Destroy *e;
264
265 INF("window destroy");
266
267 e = event;
268 ee = ecore_event_window_match((Ecore_Window)e->window);
269 if (!ee) return 1; /* pass on event */
270 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
271 if (ee->func.fn_destroy) ee->func.fn_destroy(ee);
272 ecore_evas_free(ee);
273
274 return 1;
275}
276
277static Eina_Bool
278_ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event)
279{
280 Ecore_Evas *ee;
281 Ecore_WinCE_Event_Window_Show *e;
282
283 INF("window show");
284
285 e = event;
286 ee = ecore_event_window_match((Ecore_Window)e->window);
287 if (!ee) return 1; /* pass on event */
288 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
289 if (ee->visible) return 0; /* dont pass it on */
290 ee->visible = 1;
291 if (ee->func.fn_show) ee->func.fn_show(ee);
292
293 return 1;
294}
295
296static Eina_Bool
297_ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event)
298{
299 Ecore_Evas *ee;
300 Ecore_WinCE_Event_Window_Hide *e;
301
302 INF("window hide");
303
304 e = event;
305 ee = ecore_event_window_match((Ecore_Window)e->window);
306 if (!ee) return 1; /* pass on event */
307 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
308 if (!ee->visible) return 0; /* dont pass it on */
309 ee->visible = 0;
310 if (ee->func.fn_hide) ee->func.fn_hide(ee);
311
312 return 1;
313}
314
315static Eina_Bool
316_ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event)
317{
318 Ecore_Evas *ee;
319 Ecore_WinCE_Event_Window_Delete_Request *e;
320
321 INF("window delete request");
322
323 e = event;
324 ee = ecore_event_window_match((Ecore_Window)e->window);
325 if (!ee) return 1; /* pass on event */
326 if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1;
327 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
328
329 return 1;
330}
331
332
333/* Ecore_Evas interface */
334
335static void
336_ecore_evas_wince_free(Ecore_Evas *ee)
337{
338 INF("ecore evas free");
339
340 ecore_wince_window_free((Ecore_WinCE_Window *)ee->prop.window);
341 ecore_event_window_unregister(ee->prop.window);
342 _ecore_evas_wince_shutdown();
343 ecore_wince_shutdown();
344}
345
346static void
347_ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee,
348 void (*func) (Ecore_Evas *ee))
349{
350 ee->func.fn_delete_request = func;
351}
352
353static void
354_ecore_evas_wince_move(Ecore_Evas *ee, int x, int y)
355{
356 INF("ecore evas move (%dx%d)", x, y);
357 ee->req.x = x;
358 ee->req.y = y;
359
360 if ((x != ee->x) || (y != ee->y))
361 {
362 ee->x = x;
363 ee->y = y;
364 ecore_wince_window_move((Ecore_WinCE_Window *)ee->prop.window, x, y);
365 if (ee->func.fn_move) ee->func.fn_move(ee);
366 }
367}
368
369static void
370_ecore_evas_wince_resize(Ecore_Evas *ee, int width, int height)
371{
372 INF("ecore evas resize (%dx%d)", width, height);
373 ee->req.w = width;
374 ee->req.h = height;
375
376 if ((ee->w != width) || (ee->h != height))
377 {
378 ee->w = width;
379 ee->h = height;
380 ecore_wince_window_resize((Ecore_WinCE_Window *)ee->prop.window, width, height);
381 if ((ee->rotation == 90) || (ee->rotation == 270))
382 {
383 evas_output_size_set(ee->evas, ee->h, ee->w);
384 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
385 }
386 else
387 {
388 evas_output_size_set(ee->evas, ee->w, ee->h);
389 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
390 }
391 /* FIXME: damage and shape */
392
393 if (ee->func.fn_resize) ee->func.fn_resize(ee);
394 }
395}
396
397static void
398_ecore_evas_wince_move_resize(Ecore_Evas *ee, int x, int y, int width, int height)
399{
400 INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height);
401 ee->req.x = x;
402 ee->req.y = y;
403 ee->req.w = width;
404 ee->req.h = height;
405
406 if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y))
407 {
408 int change_size = 0;
409 int change_pos = 0;
410
411 if ((ee->w != width) || (ee->h != height)) change_size = 1;
412 if ((x != ee->x) || (y != ee->y)) change_pos = 1;
413
414 ee->x = x;
415 ee->y = y;
416 ee->w = width;
417 ee->h = height;
418 ecore_wince_window_move_resize((Ecore_WinCE_Window *)ee->prop.window, x, y, width, height);
419 if ((ee->rotation == 90) || (ee->rotation == 270))
420 {
421 evas_output_size_set(ee->evas, ee->h, ee->w);
422 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
423 }
424 else
425 {
426 evas_output_size_set(ee->evas, ee->w, ee->h);
427 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
428 }
429 /* FIXME: damage and shape */
430 if (change_pos)
431 {
432 if (ee->func.fn_move) ee->func.fn_move(ee);
433 }
434 if (change_size)
435 {
436 if (ee->func.fn_resize) ee->func.fn_resize(ee);
437 }
438 }
439}
440
441/* static void */
442/* _ecore_evas_wince_rotation_set(Ecore_Evas *ee, int rotation) */
443/* { */
444/* int rot_dif; */
445
446/* if (ee->rotation == rotation) return; */
447/* rot_dif = ee->rotation - rotation; */
448/* if (rot_dif < 0) rot_dif = -rot_dif; */
449/* if (!strcmp(ee->driver, "software_ddraw")) */
450/* { */
451/* Evas_Engine_Info_Software_16_WinCE *einfo; */
452
453/* einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); */
454/* if (!einfo) return; */
455/* if (rot_dif != 180) */
456/* { */
457/* int minw, minh, maxw, maxh, basew, baseh, stepw, steph; */
458
459/* einfo->info.rotation = rotation; */
460/* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
461/* if (!ee->prop.fullscreen) */
462/* { */
463/* ecore_wince_window_resize(ee->prop.window, ee->h, ee->w); */
464/* ee->expecting_resize.w = ee->h; */
465/* ee->expecting_resize.h = ee->w; */
466/* } */
467/* else */
468/* { */
469/* int w, h; */
470
471/* ecore_wince_window_size_get(ee->prop.window, &w, &h); */
472/* ecore_wince_window_resize(ee->prop.window, h, w); */
473/* if ((rotation == 0) || (rotation == 180)) */
474/* { */
475/* evas_output_size_set(ee->evas, ee->w, ee->h); */
476/* evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); */
477/* } */
478/* else */
479/* { */
480/* evas_output_size_set(ee->evas, ee->h, ee->w); */
481/* evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); */
482/* } */
483/* if (ee->func.fn_resize) ee->func.fn_resize(ee); */
484/* } */
485/* ecore_evas_size_min_get(ee, &minw, &minh); */
486/* ecore_evas_size_max_get(ee, &maxw, &maxh); */
487/* ecore_evas_size_base_get(ee, &basew, &baseh); */
488/* ecore_evas_size_step_get(ee, &stepw, &steph); */
489/* ee->rotation = rotation; */
490/* ecore_evas_size_min_set(ee, minh, minw); */
491/* ecore_evas_size_max_set(ee, maxh, maxw); */
492/* ecore_evas_size_base_set(ee, baseh, basew); */
493/* ecore_evas_size_step_set(ee, steph, stepw); */
494/* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */
495/* ecore_wince_current_time_get()); */
496/* } */
497/* else */
498/* { */
499/* einfo->info.rotation = rotation; */
500/* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */
501/* ee->rotation = rotation; */
502/* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */
503/* ecore_wince_current_time_get()); */
504/* if (ee->func.fn_resize) ee->func.fn_resize(ee); */
505/* } */
506/* if ((ee->rotation == 90) || (ee->rotation == 270)) */
507/* evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); */
508/* else */
509/* evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); */
510/* } */
511/* } */
512
513static void
514_ecore_evas_wince_show(Ecore_Evas *ee)
515{
516 INF("ecore evas show");
517
518 ee->should_be_visible = 1;
519 if (ee->prop.avoid_damage)
520 _ecore_evas_wince_render(ee);
521 ecore_wince_window_show((Ecore_WinCE_Window *)ee->prop.window);
522/* if (ee->prop.fullscreen) */
523/* ecore_wince_window_focus(ee->prop.window); */
524}
525
526static void
527_ecore_evas_wince_hide(Ecore_Evas *ee)
528{
529 INF("ecore evas hide");
530
531 ecore_wince_window_hide((Ecore_WinCE_Window *)ee->prop.window);
532 ee->should_be_visible = 0;
533}
534
535/* static void */
536/* _ecore_evas_wince_raise(Ecore_Evas *ee) */
537/* { */
538/* if (!ee->prop.fullscreen) */
539/* ecore_wince_window_raise(ee->prop.window); */
540/* else */
541/* ecore_wince_window_raise(ee->prop.window); */
542/* } */
543
544/* static void */
545/* _ecore_evas_wince_lower(Ecore_Evas *ee) */
546/* { */
547/* if (!ee->prop.fullscreen) */
548/* ecore_wince_window_lower(ee->prop.window); */
549/* else */
550/* ecore_wince_window_lower(ee->prop.window); */
551/* } */
552
553static void
554_ecore_evas_wince_title_set(Ecore_Evas *ee, const char *title)
555{
556 INF("ecore evas title set");
557
558 if (ee->prop.title) free(ee->prop.title);
559 ee->prop.title = NULL;
560 if (title) ee->prop.title = strdup(title);
561 ecore_wince_window_title_set((Ecore_WinCE_Window *)ee->prop.window, ee->prop.title);
562}
563
564/* static void */
565/* _ecore_evas_wince_size_min_set(Ecore_Evas *ee, int width, int height) */
566/* { */
567/* if (width < 0) width = 0; */
568/* if (height < 0) height = 0; */
569/* if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; */
570/* ee->prop.min.w = width; */
571/* ee->prop.min.h = height; */
572/* ecore_wince_window_size_min_set(ee->prop.window, width, height); */
573/* } */
574
575/* static void */
576/* _ecore_evas_wince_size_max_set(Ecore_Evas *ee, int width, int height) */
577/* { */
578/* if (width < 0) width = 0; */
579/* if (height < 0) height = 0; */
580/* if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; */
581/* ee->prop.max.w = width; */
582/* ee->prop.max.h = height; */
583/* ecore_wince_window_size_max_set(ee->prop.window, width, height); */
584/* } */
585
586/* static void */
587/* _ecore_evas_wince_size_base_set(Ecore_Evas *ee, int width, int height) */
588/* { */
589/* if (width < 0) width = 0; */
590/* if (height < 0) height = 0; */
591/* if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; */
592/* ee->prop.base.w = width; */
593/* ee->prop.base.h = height; */
594/* ecore_wince_window_size_base_set(ee->prop.window, width, height); */
595/* } */
596
597/* static void */
598/* _ecore_evas_wince_size_step_set(Ecore_Evas *ee, int width, int height) */
599/* { */
600/* if (width < 1) width = 1; */
601/* if (height < 1) height = 1; */
602/* if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; */
603/* ee->prop.step.w = width; */
604/* ee->prop.step.h = height; */
605/* ecore_wince_window_size_step_set(ee->prop.window, width, height); */
606/* } */
607
608static void
609_ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
610{
611#if 0
612 int x, y;
613
614 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
615
616 if (obj == NULL)
617 {
618 ee->prop.cursor.object = NULL;
619 ee->prop.cursor.layer = 0;
620 ee->prop.cursor.hot.x = 0;
621 ee->prop.cursor.hot.y = 0;
622 ecore_wince_window_cursor_show(ee->prop.window, 1);
623 return;
624 }
625
626 ee->prop.cursor.object = obj;
627 ee->prop.cursor.layer = layer;
628 ee->prop.cursor.hot.x = hot_x;
629 ee->prop.cursor.hot.y = hot_y;
630
631 ecore_wince_window_cursor_show(ee->prop.window, 0);
632
633 evas_pointer_output_xy_get(ee->evas, &x, &y);
634 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
635 evas_object_move(ee->prop.cursor.object,
636 x - ee->prop.cursor.hot.x,
637 y - ee->prop.cursor.hot.y);
638 evas_object_pass_events_set(ee->prop.cursor.object, 1);
639 if (evas_pointer_inside_get(ee->evas))
640 evas_object_show(ee->prop.cursor.object);
641#endif
642}
643
644/* static void */
645/* _ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__) */
646/* { */
647/* ecore_wince_window_focus_set(ee->prop.window); */
648/* } */
649
650/* static void */
651/* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */
652/* { */
653/* /\* if (((ee->prop.borderless) && (on)) || *\/ */
654/* /\* ((!ee->prop.borderless) && (!on))) return; *\/ */
655/* ee->prop.iconified = on; */
656/* ecore_wince_window_iconified_set(ee->prop.window, ee->prop.iconified); */
657/* } */
658
659/* static void */
660/* _ecore_evas_wince_borderless_set(Ecore_Evas *ee, int on) */
661/* { */
662/* if (((ee->prop.borderless) && (on)) || */
663/* ((!ee->prop.borderless) && (!on))) return; */
664/* ee->prop.borderless = on; */
665/* ecore_wince_window_borderless_set(ee->prop.window, ee->prop.borderless); */
666/* } */
667
668static void
669_ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on)
670{
671 Evas_Engine_Info_Software_16_WinCE *einfo;
672 struct _Ecore_WinCE_Window *window;
673
674 INF("ecore evas fullscreen set");
675
676 if ((ee->engine.wince.state.fullscreen && on) ||
677 (!ee->engine.wince.state.fullscreen && !on))
678 return;
679
680 ee->engine.wince.state.fullscreen = on;
681 ee->prop.fullscreen = on;
682
683 window = (struct _Ecore_WinCE_Window *)ee->prop.window;
684
685 if (on != 0)
686 {
687/* ecore_win32_window_shape_set(ee->engine.win32.window, 0, 0, NULL); */
688 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on);
689 ee->w = GetSystemMetrics(SM_CXSCREEN);
690 ee->h = GetSystemMetrics(SM_CYSCREEN);
691 ee->req.w = ee->w;
692 ee->req.h = ee->h;
693 evas_output_size_set(ee->evas, ee->w, ee->h);
694 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
695 }
696 else
697 {
698 int w;
699 int h;
700
701 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on);
702 ecore_wince_window_size_get((Ecore_WinCE_Window *)ee->prop.window, &w, &h);
703 ee->w = w;
704 ee->h = h;
705 ee->req.w = ee->w;
706 ee->req.h = ee->h;
707 evas_output_size_set(ee->evas, ee->w, ee->h);
708 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
709/* ecore_win32_window_shape_set(window, */
710/* window->shape.width, */
711/* window->shape.height, */
712/* window->shape.mask); */
713 }
714
715 einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ecore_evas_get(ee));
716 if (einfo)
717 {
718 einfo->info.fullscreen = !!on;
719/* einfo->info.layered = window->shape.layered; */
720 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
721 {
722 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
723 }
724 }
725}
726
727static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
728{
729 _ecore_evas_wince_free,
730 NULL,
731 NULL,
732 NULL,
733 NULL,
734 _ecore_evas_wince_callback_delete_request_set,
735 NULL,
736 NULL,
737 NULL,
738 NULL,
739 NULL,
740 NULL,
741 NULL,
742 NULL,
743 NULL,
744 _ecore_evas_wince_move,
745 NULL,
746 _ecore_evas_wince_resize,
747 _ecore_evas_wince_move_resize,
748 NULL, //_ecore_evas_wince_rotation_set,
749 NULL, /* _ecore_evas_x_shaped_set */
750 _ecore_evas_wince_show,
751 _ecore_evas_wince_hide,
752 NULL, //_ecore_evas_wince_raise,
753 NULL, //_ecore_evas_wince_lower,
754 NULL, //_ecore_evas_wince_activate,
755 _ecore_evas_wince_title_set,
756 NULL, /* _ecore_evas_x_name_class_set */
757 NULL, //_ecore_evas_wince_size_min_set,
758 NULL, //_ecore_evas_wince_size_max_set,
759 NULL, //_ecore_evas_wince_size_base_set,
760 NULL, //_ecore_evas_wince_size_step_set,
761 _ecore_evas_wince_cursor_set,
762 NULL, /* _ecore_evas_x_layer_set */
763 NULL, //_ecore_evas_wince_focus_set,
764 NULL, //_ecore_evas_wince_iconified_set,
765 NULL, //_ecore_evas_wince_borderless_set,
766 NULL, /* _ecore_evas_x_override_set */
767 NULL,
768 _ecore_evas_wince_fullscreen_set,
769 NULL, /* _ecore_evas_x_avoid_damage_set */
770 NULL, /* _ecore_evas_x_withdrawn_set */
771 NULL, /* _ecore_evas_x_sticky_set */
772 NULL, /* _ecore_evas_x_ignore_events_set */
773 NULL, /* _ecore_evas_x_alpha_set */
774 NULL, //transparent
775
776 NULL, // render
777 NULL // screen_geometry_get
778};
779
780/* API */
781
782static Ecore_Evas *
783ecore_evas_software_wince_new_internal(int backend,
784 Ecore_WinCE_Window *parent,
785 int x,
786 int y,
787 int width,
788 int height,
789 int fullscreen)
790{
791 Evas_Engine_Info_Software_16_WinCE *einfo;
792 Ecore_Evas *ee;
793 int rmethod;
794
795 rmethod = evas_render_method_lookup("software_16_wince");
796 if (!rmethod)
797 return NULL;
798
799 if (!ecore_wince_init())
800 return NULL;
801
802 ee = calloc(1, sizeof(Ecore_Evas));
803 if (!ee)
804 {
805 ecore_wince_shutdown();
806 return NULL;
807 }
808
809 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
810
811 if (!_ecore_evas_wince_init())
812 {
813 free(ee);
814 ecore_wince_shutdown();
815 return NULL;
816 }
817
818 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wince_engine_func;
819
820 ee->driver = "software_16_wince";
821
822 if (width < 1) width = 1;
823 if (height < 1) height = 1;
824 ee->x = x;
825 ee->y = y;
826 ee->w = width;
827 ee->h = height;
828 ee->req.x = ee->x;
829 ee->req.y = ee->y;
830 ee->req.w = ee->w;
831 ee->req.h = ee->h;
832
833 ee->prop.max.w = 32767;
834 ee->prop.max.h = 32767;
835 ee->prop.layer = 4;
836 ee->prop.request_pos = 0;
837 ee->prop.sticky = 0;
838 /* FIXME: sticky to add */
839
840 ee->prop.window = (Ecore_Window)ecore_wince_window_new((Ecore_WinCE_Window *)parent, x, y, width, height);
841 if (!ee->prop.window)
842 {
843 _ecore_evas_wince_shutdown();
844 free(ee);
845 ecore_wince_shutdown();
846 return NULL;
847 }
848
849 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, fullscreen);
850
851 /* init evas here */
852 ee->evas = evas_new();
853 evas_data_attach_set(ee->evas, ee);
854 evas_output_method_set(ee->evas, rmethod);
855 evas_output_size_set(ee->evas, width, height);
856 evas_output_viewport_set(ee->evas, 0, 0, width, height);
857
858 einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas);
859 if (einfo)
860 {
861 /* FIXME: REDRAW_DEBUG missing for now */
862 einfo->info.window = ((struct _Ecore_WinCE_Window *)ee->prop.window)->window;
863 einfo->info.width = width;
864 einfo->info.height = height;
865 einfo->info.backend = backend;
866 einfo->info.rotation = 0;
867 einfo->info.fullscreen = fullscreen;
868 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
869 {
870 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
871 _ecore_evas_wince_shutdown();
872 free(ee);
873 ecore_wince_shutdown();
874 return NULL;
875 }
876
877 ecore_wince_window_backend_set((Ecore_WinCE_Window *)ee->prop.window, backend);
878 ecore_wince_window_suspend_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.suspend);
879 ecore_wince_window_resume_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.resume);
880 }
881 else
882 {
883 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
884 _ecore_evas_wince_shutdown();
885 free(ee);
886 ecore_wince_shutdown();
887 return NULL;
888 }
889
890 ee->engine.func->fn_render = _ecore_evas_wince_render;
891 _ecore_evas_register(ee);
892 ecore_event_window_register(ee->prop.window, ee, ee->evas,
893 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
894 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
895 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
896 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
897 evas_focus_in(ee->evas);
898
899 return ee;
900}
901
902#else
903
904static Ecore_Evas *
905ecore_evas_software_wince_new_internal(int backend __UNUSED__,
906 Ecore_WinCE_Window *parent __UNUSED__,
907 int x __UNUSED__,
908 int y __UNUSED__,
909 int width __UNUSED__,
910 int height __UNUSED__,
911 int fullscreen __UNUSED__)
912{
913 return NULL;
914}
915
916#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
917
918
919EAPI Ecore_Evas *
920ecore_evas_software_wince_new(Ecore_WinCE_Window *parent,
921 int x,
922 int y,
923 int width,
924 int height)
925{
926 return ecore_evas_software_wince_new_internal(0, parent, x, y, width, height, 1);
927}
928
929EAPI Ecore_Evas *
930ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent,
931 int x,
932 int y,
933 int width,
934 int height)
935{
936 return ecore_evas_software_wince_new_internal(1, parent, x, y, width, height, 1);
937}
938
939EAPI Ecore_Evas *
940ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent,
941 int x,
942 int y,
943 int width,
944 int height)
945{
946 return ecore_evas_software_wince_new_internal(2, parent, x, y, width, height, 1);
947}
948
949EAPI Ecore_Evas *
950ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent,
951 int x,
952 int y,
953 int width,
954 int height)
955{
956 return ecore_evas_software_wince_new_internal(3, parent, x, y, width, height, 1);
957}
958
959EAPI Ecore_Evas *
960ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent,
961 int x,
962 int y,
963 int width,
964 int height)
965{
966 return ecore_evas_software_wince_new_internal(4, parent, x, y, width, height, 0);
967}
968
969#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
970
971EAPI Ecore_WinCE_Window *
972ecore_evas_software_wince_window_get(const Ecore_Evas *ee)
973{
974 return (Ecore_WinCE_Window *) ecore_evas_window_get(ee);
975}
976
977#else
978
979EAPI Ecore_WinCE_Window *
980ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__)
981{
982 return NULL;
983}
984
985#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */