summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-10-15 13:02:39 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-10-15 13:02:39 +0000
commit890e35cb11e8a9e0e130f302925c50207c726c65 (patch)
tree10bbc382e8b44740dbbb671c56ab02e8142ff8de /legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c
parent27ae7e7cdb6e5470e4213be634dcc78d04f4f041 (diff)
16bpp ecore-evas support gone now its gone in evas.
SVN revision: 77998
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c1006
1 files changed, 30 insertions, 976 deletions
diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c
index fe0054af40..c2499c7f10 100644
--- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c
+++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_wince.c
@@ -6,1008 +6,62 @@
6 6
7#include <Ecore.h> 7#include <Ecore.h>
8#include "ecore_private.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 9
17#include "ecore_evas_private.h" 10#include "ecore_evas_private.h"
18#include "Ecore_Evas.h" 11#include "Ecore_Evas.h"
19 12
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 Ecore_Evas_Event_Cb func)
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
644static void
645_ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__)
646{
647 ecore_wince_window_focus(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 void
728_ecore_evas_wince_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi)
729{
730 HDC dc;
731
732 dc = GetDC(NULL);
733 if (!dc)
734 {
735 if (xdpi) *xdpi = 0;
736 if (ydpi) *ydpi = 0;
737 return;
738 }
739
740 if (xdpi) *xdpi = GetDeviceCaps(dc, LOGPIXELSX);
741 if (ydpi) *ydpi = GetDeviceCaps(dc, LOGPIXELSY);
742
743 ReleaseDC(NULL, dc);
744}
745
746static Ecore_Evas_Engine_Func _ecore_wince_engine_func =
747{
748 _ecore_evas_wince_free,
749 NULL,
750 NULL,
751 NULL,
752 NULL,
753 _ecore_evas_wince_callback_delete_request_set,
754 NULL,
755 NULL,
756 NULL,
757 NULL,
758 NULL,
759 NULL,
760 NULL,
761 NULL,
762 NULL,
763 _ecore_evas_wince_move,
764 NULL,
765 _ecore_evas_wince_resize,
766 _ecore_evas_wince_move_resize,
767 NULL, //_ecore_evas_wince_rotation_set,
768 NULL, /* _ecore_evas_x_shaped_set */
769 _ecore_evas_wince_show,
770 _ecore_evas_wince_hide,
771 NULL, //_ecore_evas_wince_raise,
772 NULL, //_ecore_evas_wince_lower,
773 NULL, //_ecore_evas_wince_activate,
774 _ecore_evas_wince_title_set,
775 NULL, /* _ecore_evas_x_name_class_set */
776 NULL, //_ecore_evas_wince_size_min_set,
777 NULL, //_ecore_evas_wince_size_max_set,
778 NULL, //_ecore_evas_wince_size_base_set,
779 NULL, //_ecore_evas_wince_size_step_set,
780 _ecore_evas_wince_cursor_set,
781 NULL, /* _ecore_evas_x_layer_set */
782 _ecore_evas_wince_focus_set,
783 NULL, //_ecore_evas_wince_iconified_set,
784 NULL, //_ecore_evas_wince_borderless_set,
785 NULL, /* _ecore_evas_x_override_set */
786 NULL,
787 _ecore_evas_wince_fullscreen_set,
788 NULL, /* _ecore_evas_x_avoid_damage_set */
789 NULL, /* _ecore_evas_x_withdrawn_set */
790 NULL, /* _ecore_evas_x_sticky_set */
791 NULL, /* _ecore_evas_x_ignore_events_set */
792 NULL, /* _ecore_evas_x_alpha_set */
793 NULL, //transparent
794 NULL, // profiles_set
795
796 NULL,
797 NULL,
798 NULL,
799 NULL,
800 NULL,
801 NULL,
802
803 NULL, // render
804 NULL, // screen_geometry_get
805 _ecore_evas_wince_screen_dpi_get
806};
807
808/* API */
809
810static Ecore_Evas *
811ecore_evas_software_wince_new_internal(int backend,
812 Ecore_WinCE_Window *parent,
813 int x,
814 int y,
815 int width,
816 int height,
817 int fullscreen)
818{
819 Evas_Engine_Info_Software_16_WinCE *einfo;
820 Ecore_Evas *ee;
821 int rmethod;
822
823 rmethod = evas_render_method_lookup("software_16_wince");
824 if (!rmethod)
825 return NULL;
826
827 if (!ecore_wince_init())
828 return NULL;
829
830 ee = calloc(1, sizeof(Ecore_Evas));
831 if (!ee)
832 {
833 ecore_wince_shutdown();
834 return NULL;
835 }
836
837 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
838
839 if (!_ecore_evas_wince_init())
840 {
841 free(ee);
842 ecore_wince_shutdown();
843 return NULL;
844 }
845
846 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wince_engine_func;
847
848 ee->driver = "software_16_wince";
849
850 if (width < 1) width = 1;
851 if (height < 1) height = 1;
852 ee->x = x;
853 ee->y = y;
854 ee->w = width;
855 ee->h = height;
856 ee->req.x = ee->x;
857 ee->req.y = ee->y;
858 ee->req.w = ee->w;
859 ee->req.h = ee->h;
860
861 ee->prop.max.w = 32767;
862 ee->prop.max.h = 32767;
863 ee->prop.layer = 4;
864 ee->prop.request_pos = 0;
865 ee->prop.sticky = 0;
866 /* FIXME: sticky to add */
867
868 ee->prop.window = (Ecore_Window)ecore_wince_window_new((Ecore_WinCE_Window *)parent, x, y, width, height);
869 if (!ee->prop.window)
870 {
871 _ecore_evas_wince_shutdown();
872 free(ee);
873 ecore_wince_shutdown();
874 return NULL;
875 }
876
877 ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, fullscreen);
878
879 /* init evas here */
880 ee->evas = evas_new();
881 evas_data_attach_set(ee->evas, ee);
882 evas_output_method_set(ee->evas, rmethod);
883 evas_output_size_set(ee->evas, width, height);
884 evas_output_viewport_set(ee->evas, 0, 0, width, height);
885
886 einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas);
887 if (einfo)
888 {
889 /* FIXME: REDRAW_DEBUG missing for now */
890 einfo->info.window = ((struct _Ecore_WinCE_Window *)ee->prop.window)->window;
891 einfo->info.width = width;
892 einfo->info.height = height;
893 einfo->info.backend = backend;
894 einfo->info.rotation = 0;
895 einfo->info.fullscreen = fullscreen;
896 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
897 {
898 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
899 _ecore_evas_wince_shutdown();
900 free(ee);
901 ecore_wince_shutdown();
902 return NULL;
903 }
904
905 ecore_wince_window_backend_set((Ecore_WinCE_Window *)ee->prop.window, backend);
906 ecore_wince_window_suspend_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.suspend);
907 ecore_wince_window_resume_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.resume);
908 }
909 else
910 {
911 ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver);
912 _ecore_evas_wince_shutdown();
913 free(ee);
914 ecore_wince_shutdown();
915 return NULL;
916 }
917
918 ee->engine.func->fn_render = _ecore_evas_wince_render;
919 _ecore_evas_register(ee);
920 ecore_event_window_register(ee->prop.window, ee, ee->evas,
921 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
922 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
923 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
924 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
925 evas_focus_in(ee->evas);
926
927 return ee;
928}
929
930#else
931
932static Ecore_Evas *
933ecore_evas_software_wince_new_internal(int backend __UNUSED__,
934 Ecore_WinCE_Window *parent __UNUSED__,
935 int x __UNUSED__,
936 int y __UNUSED__,
937 int width __UNUSED__,
938 int height __UNUSED__,
939 int fullscreen __UNUSED__)
940{
941 return NULL;
942}
943
944#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */
945
946
947EAPI Ecore_Evas * 13EAPI Ecore_Evas *
948ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, 14ecore_evas_software_wince_new(Ecore_WinCE_Window *parent __UNUSED__,
949 int x, 15 int x __UNUSED__,
950 int y, 16 int y __UNUSED__,
951 int width, 17 int width __UNUSED__,
952 int height) 18 int height __UNUSED__)
953{ 19{
954 return ecore_evas_software_wince_new_internal(0, parent, x, y, width, height, 1); 20 return NULL;
955} 21}
956 22
957EAPI Ecore_Evas * 23EAPI Ecore_Evas *
958ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, 24ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent __UNUSED__,
959 int x, 25 int x __UNUSED__,
960 int y, 26 int y __UNUSED__,
961 int width, 27 int width __UNUSED__,
962 int height) 28 int height __UNUSED__)
963{ 29{
964 return ecore_evas_software_wince_new_internal(1, parent, x, y, width, height, 1); 30 return NULL;
965} 31}
966 32
967EAPI Ecore_Evas * 33EAPI Ecore_Evas *
968ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, 34ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent __UNUSED__,
969 int x, 35 int x __UNUSED__,
970 int y, 36 int y __UNUSED__,
971 int width, 37 int width __UNUSED__,
972 int height) 38 int height __UNUSED__)
973{ 39{
974 return ecore_evas_software_wince_new_internal(2, parent, x, y, width, height, 1); 40 return NULL;
975} 41}
976 42
977EAPI Ecore_Evas * 43EAPI Ecore_Evas *
978ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, 44ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent __UNUSED__,
979 int x, 45 int x __UNUSED__,
980 int y, 46 int y __UNUSED__,
981 int width, 47 int width __UNUSED__,
982 int height) 48 int height __UNUSED__)
983{ 49{
984 return ecore_evas_software_wince_new_internal(3, parent, x, y, width, height, 1); 50 return NULL;
985} 51}
986 52
987EAPI Ecore_Evas * 53EAPI Ecore_Evas *
988ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, 54ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent __UNUSED__,
989 int x, 55 int x __UNUSED__,
990 int y, 56 int y __UNUSED__,
991 int width, 57 int width __UNUSED__,
992 int height) 58 int height __UNUSED__)
993{
994 return ecore_evas_software_wince_new_internal(4, parent, x, y, width, height, 0);
995}
996
997#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
998
999EAPI Ecore_WinCE_Window *
1000ecore_evas_software_wince_window_get(const Ecore_Evas *ee)
1001{ 59{
1002 return (Ecore_WinCE_Window *) ecore_evas_window_get(ee); 60 return NULL;
1003} 61}
1004 62
1005#else
1006
1007EAPI Ecore_WinCE_Window * 63EAPI Ecore_WinCE_Window *
1008ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__) 64ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__)
1009{ 65{
1010 return NULL; 66 return NULL;
1011} 67}
1012
1013#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */