Make evas quit barfing on gles11 and gles20
[profile/ivi/evas.git] / src / lib / canvas / evas_object_main.c
1 #include "evas_common.h"
2 #include "evas_private.h"
3
4 EVAS_MEMPOOL(_mp_obj);
5 EVAS_MEMPOOL(_mp_sh);
6
7 static Eina_Inlist *
8 get_layer_objects(Evas_Layer *l)
9 {
10    if ((!l) || (!l->objects)) return NULL;
11    return (EINA_INLIST_GET(l->objects));
12 }
13
14 /* evas internal stuff */
15 Evas_Object *
16 evas_object_new(Evas *e __UNUSED__)
17 {
18    Evas_Object *obj;
19
20    EVAS_MEMPOOL_INIT(_mp_obj, "evas_object", Evas_Object, 32, NULL);
21    obj = EVAS_MEMPOOL_ALLOC(_mp_obj, Evas_Object);
22    if (!obj) return NULL;
23    EVAS_MEMPOOL_PREP(_mp_obj, obj, Evas_Object);
24
25    obj->magic = MAGIC_OBJ;
26    obj->cur.scale = 1.0;
27    obj->prev.scale = 1.0;
28    obj->is_frame = EINA_FALSE;
29
30    return obj;
31 }
32
33 void
34 evas_object_change_reset(Evas_Object *obj)
35 {
36    obj->changed = EINA_FALSE;
37    obj->changed_move = EINA_FALSE;
38    obj->changed_color = EINA_FALSE;
39    obj->changed_map = EINA_FALSE;
40    obj->changed_pchange = EINA_FALSE;
41 }
42
43 void
44 evas_object_cur_prev(Evas_Object *obj)
45 {
46    if (!obj->prev.valid_map)
47      {
48         if (obj->prev.map != obj->cur.map)
49           evas_map_free(obj->prev.map);
50         if (obj->cache_map == obj->prev.map)
51           obj->cache_map = NULL;
52         obj->prev.map = NULL;
53      }
54
55    if (obj->cur.map != obj->prev.map)
56      {
57         if (obj->cache_map) evas_map_free(obj->cache_map);
58         obj->cache_map = obj->prev.map;
59      }
60    obj->prev = obj->cur;
61 }
62
63 void
64 evas_object_free(Evas_Object *obj, int clean_layer)
65 {
66    int was_smart_child = 0;
67
68 #if 0 // filtering disabled
69    evas_filter_free(obj);
70 #endif
71    if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL);
72    evas_object_map_set(obj, NULL);
73    if (obj->prev.map) evas_map_free(obj->prev.map);
74    if (obj->cache_map) evas_map_free(obj->cache_map);
75    if (obj->map.surface)
76      {
77         obj->layer->evas->engine.func->image_map_surface_free
78           (obj->layer->evas->engine.data.output,
79               obj->map.surface);
80         obj->map.surface = NULL;
81      }
82    evas_object_grabs_cleanup(obj);
83    evas_object_intercept_cleanup(obj);
84    if (obj->smart.parent) was_smart_child = 1;
85    evas_object_smart_cleanup(obj);
86    obj->func->free(obj);
87    if (!was_smart_child) evas_object_release(obj, clean_layer);
88    if (obj->clip.clipees)
89      eina_list_free(obj->clip.clipees);
90    evas_object_clip_changes_clean(obj);
91    evas_object_event_callback_all_del(obj);
92    evas_object_event_callback_cleanup(obj);
93    if (obj->spans)
94      {
95         free(obj->spans);
96         obj->spans = NULL;
97      }
98    while (obj->data.elements)
99      {
100         Evas_Data_Node *node;
101
102         node = obj->data.elements->data;
103         obj->data.elements = eina_list_remove(obj->data.elements, node);
104         free(node);
105      }
106    obj->magic = 0;
107    if (obj->size_hints)
108      {
109        EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
110      }
111    EVAS_MEMPOOL_FREE(_mp_obj, obj);
112 }
113
114 void
115 evas_object_change(Evas_Object *obj)
116 {
117    Eina_List *l;
118    Evas_Object *obj2;
119    Eina_Bool movch = EINA_FALSE;
120
121    if (obj->layer->evas->nochange) return;
122    obj->layer->evas->changed = EINA_TRUE;
123
124    if (obj->changed_move)
125      {
126         movch = EINA_TRUE;
127         obj->changed_move = EINA_FALSE;
128      }
129
130    if (obj->changed) return;
131
132    evas_render_object_recalc(obj);
133    /* set changed flag on all objects this one clips too */
134    if (!((movch) && (obj->is_static_clip)))
135      {
136         EINA_LIST_FOREACH(obj->clip.clipees, l, obj2)
137           evas_object_change(obj2);
138      }
139    EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2)
140      {
141         evas_object_change(obj2);
142      }
143    if (obj->smart.parent) evas_object_change(obj->smart.parent);
144 }
145
146 void
147 evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v)
148 {
149    if (obj->smart.smart) return;
150    if (is_v == was_v) return;
151    if (is_v)
152      {
153         evas_add_rect(rects,
154                       obj->cur.cache.clip.x,
155                       obj->cur.cache.clip.y,
156                       obj->cur.cache.clip.w,
157                       obj->cur.cache.clip.h);
158      }
159    else
160      {
161         evas_add_rect(rects,
162                       obj->prev.cache.clip.x,
163                       obj->prev.cache.clip.y,
164                       obj->prev.cache.clip.w,
165                       obj->prev.cache.clip.h);
166      }
167 }
168
169 void
170 evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj)
171 {
172    if (obj->smart.smart) return;
173    if (obj->cur.clipper == obj->prev.clipper) return;
174    if ((obj->cur.clipper) && (obj->prev.clipper))
175      {
176         /* get difference rects between clippers */
177         evas_rects_return_difference_rects(rects,
178                                            obj->cur.clipper->cur.cache.clip.x,
179                                            obj->cur.clipper->cur.cache.clip.y,
180                                            obj->cur.clipper->cur.cache.clip.w,
181                                            obj->cur.clipper->cur.cache.clip.h,
182                                            obj->prev.clipper->prev.cache.clip.x,
183                                            obj->prev.clipper->prev.cache.clip.y,
184                                            obj->prev.clipper->prev.cache.clip.w,
185                                            obj->prev.clipper->prev.cache.clip.h);
186      }
187    else if (obj->cur.clipper)
188      {
189         evas_rects_return_difference_rects(rects,
190                                            obj->cur.geometry.x,
191                                            obj->cur.geometry.y,
192                                            obj->cur.geometry.w,
193                                            obj->cur.geometry.h,
194 ////    rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x,
195 ////                                            obj->cur.cache.geometry.y,
196 ////                                            obj->cur.cache.geometry.w,
197 ////                                            obj->cur.cache.geometry.h,
198                                            obj->cur.clipper->cur.cache.clip.x,
199                                            obj->cur.clipper->cur.cache.clip.y,
200                                            obj->cur.clipper->cur.cache.clip.w,
201                                            obj->cur.clipper->cur.cache.clip.h);
202      }
203    else if (obj->prev.clipper)
204      {
205      evas_rects_return_difference_rects(rects,
206                                         obj->prev.geometry.x,
207                                         obj->prev.geometry.y,
208                                         obj->prev.geometry.w,
209                                         obj->prev.geometry.h,
210 ////    rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x,
211 ////                                            obj->prev.cache.geometry.y,
212 ////                                            obj->prev.cache.geometry.w,
213 ////                                            obj->prev.cache.geometry.h,
214                                         obj->prev.clipper->prev.cache.clip.x,
215                                         obj->prev.clipper->prev.cache.clip.y,
216                                         obj->prev.clipper->prev.cache.clip.w,
217                                         obj->prev.clipper->prev.cache.clip.h);
218      }
219 }
220
221 void
222 evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj)
223 {
224    evas_add_rect(rects,
225                  obj->cur.cache.clip.x,
226                  obj->cur.cache.clip.y,
227                  obj->cur.cache.clip.w,
228                  obj->cur.cache.clip.h);
229    evas_add_rect(rects,
230                  obj->prev.cache.clip.x,
231                  obj->prev.cache.clip.y,
232                  obj->prev.cache.clip.w,
233                  obj->prev.cache.clip.h);
234 /*
235         evas_add_rect(rects,
236                       obj->cur.geometry.x,
237                       obj->cur.geometry.y,
238                       obj->cur.geometry.w,
239                       obj->cur.geometry.h);
240 ////        obj->cur.cache.geometry.x,
241 ////        obj->cur.cache.geometry.y,
242 ////        obj->cur.cache.geometry.w,
243 ////        obj->cur.cache.geometry.h);
244         evas_add_rect(rects,
245                       obj->prev.geometry.x,
246                       obj->prev.geometry.y,
247                       obj->prev.geometry.w,
248                       obj->prev.geometry.h);
249 ////        obj->prev.cache.geometry.x,
250 ////        obj->prev.cache.geometry.y,
251 ////        obj->prev.cache.geometry.w,
252 ////        obj->prev.cache.geometry.h);
253 */
254 }
255
256 void
257 evas_object_clip_changes_clean(Evas_Object *obj)
258 {
259    Eina_Rectangle *r;
260
261    EINA_LIST_FREE(obj->clip.changes, r)
262      eina_rectangle_free(r);
263 }
264
265 void
266 evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v __UNUSED__)
267 {
268    Eina_Rectangle *r;
269    Evas_Object *clipper;
270    Eina_List *l;
271    unsigned int i;
272    Eina_Array_Iterator it;
273    int x, y, w, h;
274
275    if (obj->smart.smart) goto end;
276    /* FIXME: was_v isn't used... why? */
277    if (!obj->clip.clipees)
278      {
279         EINA_ARRAY_ITER_NEXT(rects, i, r, it)
280           {
281              /* get updates and clip to current clip */
282              x = r->x;
283              y = r->y;
284              w = r->w;
285              h = r->h;
286              RECTS_CLIP_TO_RECT(x, y, w, h,
287                                 obj->cur.cache.clip.x,
288                                 obj->cur.cache.clip.y,
289                                 obj->cur.cache.clip.w,
290                                 obj->cur.cache.clip.h);
291              if ((w > 0) && (h > 0))
292                obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
293                                                                       x, y, w, h);
294              /* get updates and clip to previous clip */
295              x = r->x;
296              y = r->y;
297              w = r->w;
298              h = r->h;
299              RECTS_CLIP_TO_RECT(x, y, w, h,
300                                 obj->prev.cache.clip.x,
301                                 obj->prev.cache.clip.y,
302                                 obj->prev.cache.clip.w,
303                                 obj->prev.cache.clip.h);
304              if ((w > 0) && (h > 0))
305                obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
306                                                                       x, y, w, h);
307           }
308         /* if the object is actually visible, take any parent clip changes */
309         if (is_v)
310           {
311              clipper = obj->cur.clipper;
312              while (clipper)
313                {
314                   EINA_LIST_FOREACH(clipper->clip.changes, l, r)
315                     {
316                        /* get updates and clip to current clip */
317                        x = r->x; y = r->y; w = r->w; h = r->h;
318                        RECTS_CLIP_TO_RECT(x, y, w, h,
319                                           obj->cur.cache.clip.x,
320                                           obj->cur.cache.clip.y,
321                                           obj->cur.cache.clip.w,
322                                           obj->cur.cache.clip.h);
323                        if ((w > 0) && (h > 0))
324                          obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
325                                                                                 x, y, w, h);
326                        /* get updates and clip to previous clip */
327                        x = r->x; y = r->y; w = r->w; h = r->h;
328                        RECTS_CLIP_TO_RECT(x, y, w, h,
329                                           obj->prev.cache.clip.x,
330                                           obj->prev.cache.clip.y,
331                                           obj->prev.cache.clip.w,
332                                           obj->prev.cache.clip.h);
333                        if ((w > 0) && (h > 0))
334                          obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
335                                                                                 x, y, w, h);
336                     }
337                   clipper = clipper->cur.clipper;
338                }
339           }
340      }
341    else
342      {
343         evas_object_clip_changes_clean(obj);
344         EINA_ARRAY_ITER_NEXT(rects, i, r, it)
345            obj->clip.changes = eina_list_append(obj->clip.changes, r);
346         eina_array_clean(rects);
347      }
348
349  end:
350    EINA_ARRAY_ITER_NEXT(rects, i, r, it)
351      eina_rectangle_free(r);
352    eina_array_clean(rects);
353 }
354
355 int
356 evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h)
357 {
358    if (obj->smart.smart && !obj->prev.map && !obj->prev.usemap) return 0;
359    /* assumes coords have been recalced */
360    if ((RECTS_INTERSECT(x, y, w, h,
361                         obj->prev.cache.clip.x,
362                         obj->prev.cache.clip.y,
363                         obj->prev.cache.clip.w,
364                         obj->prev.cache.clip.h)))
365      return 1;
366    return 0;
367 }
368
369 int
370 evas_object_was_opaque(Evas_Object *obj)
371 {
372    if (obj->smart.smart) return 0;
373    if (obj->prev.cache.clip.a == 255)
374      {
375         if (obj->func->was_opaque)
376           return obj->func->was_opaque(obj);
377         return 1;
378      }
379    return 0;
380 }
381
382 int
383 evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
384 {
385    if (obj->smart.smart) return 0;
386    if (obj->func->is_inside)
387      return obj->func->is_inside(obj, x, y);
388    return 0;
389 }
390
391 int
392 evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
393 {
394    if (obj->smart.smart) return 0;
395    if (obj->func->was_inside)
396      return obj->func->was_inside(obj, x, y);
397    return 0;
398 }
399 /* routines apps will call */
400
401 EAPI void
402 evas_object_ref(Evas_Object *obj)
403 {
404    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
405    return;
406    MAGIC_CHECK_END();
407    obj->ref++;
408 }
409
410 EAPI void
411 evas_object_unref(Evas_Object *obj)
412 {
413    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
414    return;
415    MAGIC_CHECK_END();
416    if (obj->ref == 0) return;
417    obj->ref--;
418    if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj);
419 }
420
421 EAPI int
422 evas_object_ref_get(const Evas_Object *obj)
423 {
424    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
425    return 0;
426    MAGIC_CHECK_END();
427    return obj->ref;
428 }
429
430 EAPI void
431 evas_object_del(Evas_Object *obj)
432 {
433    if (!obj) return;
434    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
435    return;
436    MAGIC_CHECK_END();
437
438    if (obj->delete_me) return;
439
440    if (obj->ref > 0)
441      {
442         obj->del_ref = EINA_TRUE;
443         return;
444      }
445
446    evas_object_hide(obj);
447    if (obj->focused)
448      {
449         obj->focused = EINA_FALSE;
450         obj->layer->evas->focused = NULL;
451         _evas_object_event_new();
452         evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter);
453         _evas_post_event_callback_call(obj->layer->evas);
454      }
455    _evas_object_event_new();
456    evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter);
457    _evas_post_event_callback_call(obj->layer->evas);
458    if (obj->mouse_grabbed > 0)
459       obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
460    if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
461       obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
462    obj->mouse_grabbed = 0;
463    obj->mouse_in = 0;
464    if (obj->name) evas_object_name_set(obj, NULL);
465    if (!obj->layer)
466      {
467         evas_object_free(obj, 1);
468         return;
469      }
470    evas_object_grabs_cleanup(obj);
471    while (obj->clip.clipees)
472      evas_object_clip_unset(obj->clip.clipees->data);
473    while (obj->proxy.proxies)
474      evas_object_image_source_unset(obj->proxy.proxies->data);
475    if (obj->cur.clipper) evas_object_clip_unset(obj);
476    evas_object_map_set(obj, NULL);
477    if (obj->smart.smart) evas_object_smart_del(obj);
478    _evas_object_event_new();
479    evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter);
480    _evas_post_event_callback_call(obj->layer->evas);
481    evas_object_smart_cleanup(obj);
482    obj->delete_me = 1;
483    evas_object_change(obj);
484 }
485
486 void
487 evas_object_update_bounding_box(Evas_Object *obj)
488 {
489    Eina_Bool propagate = EINA_FALSE;
490    Eina_Bool computeminmax = EINA_FALSE;
491    Evas_Coord x, y, w, h;
492    Evas_Coord px, py, pw, ph;
493    Eina_Bool noclip;
494
495    if (!obj->smart.parent) return ;
496    if (obj->child_has_map) return ; /* Disable bounding box computation for this object and its parent */
497    /* We could also remove object that are not visible from the bounding box, use the clipping information
498       to reduce the bounding of the object they are clipping, but for the moment this will do it's jobs */
499    noclip = !(obj->clip.clipees || obj->is_static_clip);
500
501    if (obj->smart.smart)
502      {
503         x = obj->cur.bounding_box.x;
504         y = obj->cur.bounding_box.y;
505         w = obj->cur.bounding_box.w;
506         h = obj->cur.bounding_box.h;
507         px = obj->prev.bounding_box.x;
508         py = obj->prev.bounding_box.y;
509         pw = obj->prev.bounding_box.w;
510         ph = obj->prev.bounding_box.h;
511      }
512    else
513      {
514         x = obj->cur.geometry.x;
515         y = obj->cur.geometry.y;
516         w = obj->cur.geometry.w;
517         h = obj->cur.geometry.h;
518         px = obj->prev.geometry.x;
519         py = obj->prev.geometry.y;
520         pw = obj->prev.geometry.w;
521         ph = obj->prev.geometry.h;
522      }
523
524    /* We are not yet trying to find the smallest bounding box, but we want to find a good approximation quickly.
525     * That's why we initialiaze min and max search to geometry of the parent object.
526     */
527
528    if (obj->smart.parent->cur.valid_bounding_box)
529      {
530         /* Update left limit */
531         if (noclip && x < obj->smart.parent->cur.bounding_box.x)
532           {
533              obj->smart.parent->cur.bounding_box.w += obj->smart.parent->cur.bounding_box.x - x;
534              obj->smart.parent->cur.bounding_box.x = x;
535              propagate = EINA_TRUE;
536           }
537         else if ((px == obj->smart.parent->prev.bounding_box.x && x > obj->smart.parent->cur.bounding_box.x)
538                  || (!noclip && x == obj->smart.parent->cur.bounding_box.x))
539           {
540              computeminmax = EINA_TRUE;
541           }
542
543         /* Update top limit */
544         if (noclip && y < obj->smart.parent->cur.bounding_box.y)
545           {
546              obj->smart.parent->cur.bounding_box.h += obj->smart.parent->cur.bounding_box.x - x;
547              obj->smart.parent->cur.bounding_box.y = y;
548              propagate = EINA_TRUE;
549           }
550         else if ((py == obj->smart.parent->prev.bounding_box.y && y  > obj->smart.parent->cur.bounding_box.y)
551                  || (!noclip && y == obj->smart.parent->cur.bounding_box.y))
552           {
553              computeminmax = EINA_TRUE;
554           }
555
556         /* Update right limit */
557         if (noclip && x + w > obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w)
558           {
559              obj->smart.parent->cur.bounding_box.w = x + w - obj->smart.parent->cur.bounding_box.x;
560              propagate = EINA_TRUE;
561           }
562         else if ((px + pw == obj->smart.parent->prev.bounding_box.x + obj->smart.parent->prev.bounding_box.w &&
563                   x + w < obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w)
564                  || (!noclip && x + w == obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w))
565           {
566              computeminmax = EINA_TRUE;
567           }
568
569         /* Update bottom limit */
570         if (noclip && y + h > obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h)
571           {
572              obj->smart.parent->cur.bounding_box.h = y + h - obj->smart.parent->cur.bounding_box.y;
573              propagate = EINA_TRUE;
574           }
575         else if ((py + ph == obj->smart.parent->prev.bounding_box.y + obj->smart.parent->prev.bounding_box.h &&
576                   y + h < obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h) ||
577                  (!noclip && y + h == obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h))
578           {
579              computeminmax = EINA_TRUE;
580           }
581
582         if (computeminmax)
583           {
584              evas_object_smart_need_bounding_box_update(obj->smart.parent);
585           }
586      }
587    else
588      {
589         if (noclip)
590           {
591              obj->smart.parent->cur.bounding_box.x = x;
592              obj->smart.parent->cur.bounding_box.y = y;
593              obj->smart.parent->cur.bounding_box.w = w;
594              obj->smart.parent->cur.bounding_box.h = h;
595              obj->smart.parent->cur.valid_bounding_box = EINA_TRUE;
596              propagate = EINA_TRUE;
597           }
598      }
599
600    if (propagate)
601      evas_object_update_bounding_box(obj->smart.parent);
602 }
603
604 EAPI void
605 evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
606 {
607    Evas *evas;
608    int is, was = 0, pass = 0, freeze = 0;
609    int nx = 0, ny = 0;
610
611    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
612    return;
613    MAGIC_CHECK_END();
614    if (obj->delete_me) return;
615
616    nx = x;
617    ny = y;
618
619    evas = obj->layer->evas;
620
621    if ((!obj->is_frame) && (obj != evas->framespace.clip))
622      {
623         if ((!obj->smart.parent) && (obj->smart.smart))
624           {
625              nx += evas->framespace.x;
626              ny += evas->framespace.y;
627           }
628      }
629
630    if (evas_object_intercept_call_move(obj, nx, ny)) return;
631
632    if (obj->doing.in_move > 0)
633      {
634         WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj);
635         return;
636      }
637
638    if ((obj->cur.geometry.x == nx) && (obj->cur.geometry.y == ny)) return;
639
640    if (obj->layer->evas->events_frozen <= 0)
641      {
642         pass = evas_event_passes_through(obj);
643         freeze = evas_event_freezes_through(obj);
644         if ((!pass) && (!freeze))
645           was = evas_object_is_in_output_rect(obj,
646                                               obj->layer->evas->pointer.x,
647                                               obj->layer->evas->pointer.y, 1, 1);
648      }
649    obj->doing.in_move++;
650
651    if (obj->smart.smart)
652      {
653         if (obj->smart.smart->smart_class->move)
654           obj->smart.smart->smart_class->move(obj, nx, ny);
655      }
656
657    obj->cur.geometry.x = nx;
658    obj->cur.geometry.y = ny;
659
660    evas_object_update_bounding_box(obj);
661
662 ////   obj->cur.cache.geometry.validity = 0;
663    obj->changed_move = EINA_TRUE;
664    evas_object_change(obj);
665    evas_object_clip_dirty(obj);
666    obj->doing.in_move--;
667    if (obj->layer->evas->events_frozen <= 0)
668      {
669         evas_object_recalc_clippees(obj);
670         if (!pass)
671           {
672              if (!obj->smart.smart)
673                {
674                   is = evas_object_is_in_output_rect(obj,
675                                                      obj->layer->evas->pointer.x,
676                                                      obj->layer->evas->pointer.y, 1, 1);
677                   if ((is ^ was) && obj->cur.visible)
678                     evas_event_feed_mouse_move(obj->layer->evas,
679                                                obj->layer->evas->pointer.x,
680                                                obj->layer->evas->pointer.y,
681                                                obj->layer->evas->last_timestamp,
682                                                NULL);
683                }
684           }
685      }
686    evas_object_inform_call_move(obj);
687 }
688
689 EAPI void
690 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
691 {
692    int is, was = 0, pass = 0, freeze =0;
693
694    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
695    return;
696    MAGIC_CHECK_END();
697    if (obj->delete_me) return;
698    if (w < 0) w = 0; if (h < 0) h = 0;
699
700    if (evas_object_intercept_call_resize(obj, w, h)) return;
701
702    if (obj->doing.in_resize > 0)
703      {
704         WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj);
705         return;
706      }
707
708    if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return;
709
710    if (obj->layer->evas->events_frozen <= 0)
711      {
712         pass = evas_event_passes_through(obj);
713         freeze = evas_event_freezes_through(obj);
714         if ((!pass) && (!freeze))
715           was = evas_object_is_in_output_rect(obj,
716                                               obj->layer->evas->pointer.x,
717                                               obj->layer->evas->pointer.y, 1, 1);
718      }
719    obj->doing.in_resize++;
720
721    if (obj->smart.smart)
722      {
723        if (obj->smart.smart->smart_class->resize)
724           obj->smart.smart->smart_class->resize(obj, w, h);
725      }
726
727    obj->cur.geometry.w = w;
728    obj->cur.geometry.h = h;
729
730    evas_object_update_bounding_box(obj);
731
732 ////   obj->cur.cache.geometry.validity = 0;
733    evas_object_change(obj);
734    evas_object_clip_dirty(obj);
735    obj->doing.in_resize--;
736    /* NB: evas_object_recalc_clippees was here previously ( < 08/07/2009) */
737    if (obj->layer->evas->events_frozen <= 0)
738      {
739         /* NB: If this creates glitches on screen then move to above position */
740         evas_object_recalc_clippees(obj);
741
742         //   if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
743         if (!pass)
744           {
745              if (!obj->smart.smart)
746                {
747                   is = evas_object_is_in_output_rect(obj,
748                                                      obj->layer->evas->pointer.x,
749                                                      obj->layer->evas->pointer.y, 1, 1);
750                   if ((is ^ was) && (obj->cur.visible))
751                     evas_event_feed_mouse_move(obj->layer->evas,
752                                                obj->layer->evas->pointer.x,
753                                                obj->layer->evas->pointer.y,
754                                                obj->layer->evas->last_timestamp,
755                                                NULL);
756                }
757           }
758      }
759    evas_object_inform_call_resize(obj);
760 }
761
762 EAPI void
763 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
764 {
765    Evas *evas;
766    int nx = 0, ny = 0;
767
768    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
769    if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
770    return;
771    MAGIC_CHECK_END();
772    if (obj->delete_me)
773      {
774         if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
775         return;
776      }
777
778    nx = obj->cur.geometry.x;
779    ny = obj->cur.geometry.y;
780
781    evas = obj->layer->evas;
782
783    if ((!obj->is_frame) && (obj != evas->framespace.clip))
784      {
785         if ((!obj->smart.parent) && (obj->smart.smart))
786           {
787              if (nx > 0) nx -= evas->framespace.x;
788              if (ny > 0) ny -= evas->framespace.y;
789           }
790      }
791
792    if (x) *x = nx;
793    if (y) *y = ny;
794    if (w) *w = obj->cur.geometry.w;
795    if (h) *h = obj->cur.geometry.h;
796 }
797
798 static void
799 _evas_object_size_hint_alloc(Evas_Object *obj)
800 {
801    if (obj->size_hints) return;
802
803    EVAS_MEMPOOL_INIT(_mp_sh, "evas_size_hints", Evas_Size_Hints, 32, );
804    obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints);
805    if (!obj->size_hints) return;
806    EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints);
807    obj->size_hints->max.w = -1;
808    obj->size_hints->max.h = -1;
809    obj->size_hints->align.x = 0.5;
810    obj->size_hints->align.y = 0.5;
811    obj->size_hints->dispmode = EVAS_DISPLAY_MODE_NONE;
812 }
813
814 EAPI Evas_Display_Mode
815 evas_object_size_hint_display_mode_get(const Evas_Object *obj)
816 {
817    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
818    return EVAS_DISPLAY_MODE_NONE;
819    MAGIC_CHECK_END();
820    if ((!obj->size_hints) || obj->delete_me)
821      return EVAS_DISPLAY_MODE_NONE;
822    return obj->size_hints->dispmode;
823 }
824
825 EAPI void
826 evas_object_size_hint_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode)
827 {
828    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
829    return;
830    MAGIC_CHECK_END();
831    if (obj->delete_me)
832      return;
833    _evas_object_size_hint_alloc(obj);
834    if (obj->size_hints->dispmode == dispmode) return;
835    obj->size_hints->dispmode = dispmode;
836
837    evas_object_inform_call_changed_size_hints(obj);
838 }
839
840 EAPI void
841 evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
842 {
843    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
844    if (w) *w = 0; if (h) *h = 0;
845    return;
846    MAGIC_CHECK_END();
847    if ((!obj->size_hints) || obj->delete_me)
848      {
849         if (w) *w = 0; if (h) *h = 0;
850         return;
851      }
852    if (w) *w = obj->size_hints->min.w;
853    if (h) *h = obj->size_hints->min.h;
854 }
855
856 EAPI void
857 evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
858 {
859    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
860    return;
861    MAGIC_CHECK_END();
862    if (obj->delete_me)
863      return;
864    _evas_object_size_hint_alloc(obj);
865    if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return;
866    obj->size_hints->min.w = w;
867    obj->size_hints->min.h = h;
868
869    evas_object_inform_call_changed_size_hints(obj);
870 }
871
872 EAPI void
873 evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
874 {
875    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
876    if (w) *w = -1; if (h) *h = -1;
877    return;
878    MAGIC_CHECK_END();
879    if ((!obj->size_hints) || obj->delete_me)
880      {
881         if (w) *w = -1; if (h) *h = -1;
882         return;
883      }
884    if (w) *w = obj->size_hints->max.w;
885    if (h) *h = obj->size_hints->max.h;
886 }
887
888 EAPI void
889 evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
890 {
891    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
892    return;
893    MAGIC_CHECK_END();
894    if (obj->delete_me)
895      return;
896    _evas_object_size_hint_alloc(obj);
897    if ((obj->size_hints->max.w == w) && (obj->size_hints->max.h == h)) return;
898    obj->size_hints->max.w = w;
899    obj->size_hints->max.h = h;
900
901    evas_object_inform_call_changed_size_hints(obj);
902 }
903
904 EAPI void
905 evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
906 {
907    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
908    if (w) *w = 0; if (h) *h = 0;
909    return;
910    MAGIC_CHECK_END();
911    if ((!obj->size_hints) || obj->delete_me)
912      {
913         if (w) *w = 0; if (h) *h = 0;
914         return;
915      }
916    if (w) *w = obj->size_hints->request.w;
917    if (h) *h = obj->size_hints->request.h;
918 }
919
920 EAPI void
921 evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
922 {
923    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
924    return;
925    MAGIC_CHECK_END();
926    if (obj->delete_me)
927      return;
928    _evas_object_size_hint_alloc(obj);
929    if ((obj->size_hints->request.w == w) && (obj->size_hints->request.h == h)) return;
930    obj->size_hints->request.w = w;
931    obj->size_hints->request.h = h;
932
933    evas_object_inform_call_changed_size_hints(obj);
934 }
935
936 EAPI void
937 evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
938 {
939    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
940    if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
941    if (w) *w = 0; if (h) *h = 0;
942    return;
943    MAGIC_CHECK_END();
944    if ((!obj->size_hints) || obj->delete_me)
945      {
946         if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
947         if (w) *w = 0; if (h) *h = 0;
948         return;
949      }
950    if (aspect) *aspect = obj->size_hints->aspect.mode;
951    if (w) *w = obj->size_hints->aspect.size.w;
952    if (h) *h = obj->size_hints->aspect.size.h;
953 }
954
955 EAPI void
956 evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
957 {
958    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
959    return;
960    MAGIC_CHECK_END();
961    if (obj->delete_me)
962      return;
963    _evas_object_size_hint_alloc(obj);
964    if ((obj->size_hints->aspect.mode == aspect) && (obj->size_hints->aspect.size.w == w) && (obj->size_hints->aspect.size.h == h)) return;
965    obj->size_hints->aspect.mode = aspect;
966    obj->size_hints->aspect.size.w = w;
967    obj->size_hints->aspect.size.h = h;
968
969    evas_object_inform_call_changed_size_hints(obj);
970 }
971
972 EAPI void
973 evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y)
974 {
975    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
976    if (x) *x = 0.5; if (y) *y = 0.5;
977    return;
978    MAGIC_CHECK_END();
979    if ((!obj->size_hints) || obj->delete_me)
980      {
981         if (x) *x = 0.5; if (y) *y = 0.5;
982         return;
983      }
984    if (x) *x = obj->size_hints->align.x;
985    if (y) *y = obj->size_hints->align.y;
986 }
987
988 EAPI void
989 evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
990 {
991    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
992    return;
993    MAGIC_CHECK_END();
994    if (obj->delete_me)
995      return;
996    _evas_object_size_hint_alloc(obj);
997    if ((obj->size_hints->align.x == x) && (obj->size_hints->align.y == y)) return;
998    obj->size_hints->align.x = x;
999    obj->size_hints->align.y = y;
1000
1001    evas_object_inform_call_changed_size_hints(obj);
1002 }
1003
1004 EAPI void
1005 evas_object_size_hint_weight_get(const Evas_Object *obj, double *x, double *y)
1006 {
1007    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1008    if (x) *x = 0.0; if (y) *y = 0.0;
1009    return;
1010    MAGIC_CHECK_END();
1011    if ((!obj->size_hints) || obj->delete_me)
1012      {
1013         if (x) *x = 0.0; if (y) *y = 0.0;
1014         return;
1015      }
1016    if (x) *x = obj->size_hints->weight.x;
1017    if (y) *y = obj->size_hints->weight.y;
1018 }
1019
1020 EAPI void
1021 evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
1022 {
1023    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1024    return;
1025    MAGIC_CHECK_END();
1026    if (obj->delete_me)
1027      return;
1028    _evas_object_size_hint_alloc(obj);
1029    if ((obj->size_hints->weight.x == x) && (obj->size_hints->weight.y == y)) return;
1030    obj->size_hints->weight.x = x;
1031    obj->size_hints->weight.y = y;
1032
1033    evas_object_inform_call_changed_size_hints(obj);
1034 }
1035
1036 EAPI void
1037 evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
1038 {
1039    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1040    if (l) *l = 0; if (r) *r = 0;
1041    if (t) *t = 0; if (b) *b = 0;
1042    return;
1043    MAGIC_CHECK_END();
1044    if ((!obj->size_hints) || obj->delete_me)
1045      {
1046         if (l) *l = 0; if (r) *r = 0;
1047         if (t) *t = 0; if (b) *b = 0;
1048         return;
1049      }
1050    if (l) *l = obj->size_hints->padding.l;
1051    if (r) *r = obj->size_hints->padding.r;
1052    if (t) *t = obj->size_hints->padding.t;
1053    if (b) *b = obj->size_hints->padding.b;
1054 }
1055
1056 EAPI void
1057 evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b)
1058 {
1059    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1060    return;
1061    MAGIC_CHECK_END();
1062    if (obj->delete_me)
1063      return;
1064    _evas_object_size_hint_alloc(obj);
1065    if ((obj->size_hints->padding.l == l) && (obj->size_hints->padding.r == r) && (obj->size_hints->padding.t == t) && (obj->size_hints->padding.b == b)) return;
1066    obj->size_hints->padding.l = l;
1067    obj->size_hints->padding.r = r;
1068    obj->size_hints->padding.t = t;
1069    obj->size_hints->padding.b = b;
1070
1071    evas_object_inform_call_changed_size_hints(obj);
1072 }
1073
1074 EAPI void
1075 evas_object_show(Evas_Object *obj)
1076 {
1077    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1078    return;
1079    MAGIC_CHECK_END();
1080    if (obj->delete_me) return;
1081    if (evas_object_intercept_call_show(obj)) return;
1082    if (obj->smart.smart)
1083      {
1084        if (obj->smart.smart->smart_class->show)
1085          obj->smart.smart->smart_class->show(obj);
1086      }
1087    if (obj->cur.visible)
1088      {
1089         return;
1090      }
1091    obj->cur.visible = 1;
1092    evas_object_change(obj);
1093    evas_object_clip_dirty(obj);
1094    if (obj->layer->evas->events_frozen <= 0)
1095      {
1096         evas_object_clip_across_clippees_check(obj);
1097         evas_object_recalc_clippees(obj);
1098         if ((!evas_event_passes_through(obj)) &&
1099             (!evas_event_freezes_through(obj)))
1100           {
1101              if (!obj->smart.smart)
1102                {
1103                   if (evas_object_is_in_output_rect(obj,
1104                                                     obj->layer->evas->pointer.x,
1105                                                     obj->layer->evas->pointer.y, 1, 1))
1106                     evas_event_feed_mouse_move(obj->layer->evas,
1107                                                obj->layer->evas->pointer.x,
1108                                                obj->layer->evas->pointer.y,
1109                                                obj->layer->evas->last_timestamp,
1110                                                NULL);
1111                }
1112           }
1113      }
1114    evas_object_inform_call_show(obj);
1115 }
1116
1117 EAPI void
1118 evas_object_hide(Evas_Object *obj)
1119 {
1120    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1121    return;
1122    MAGIC_CHECK_END();
1123    if (obj->delete_me) return;
1124    if (evas_object_intercept_call_hide(obj)) return;
1125    if (obj->smart.smart)
1126      {
1127        if (obj->smart.smart->smart_class->hide)
1128          obj->smart.smart->smart_class->hide(obj);
1129      }
1130    if (!obj->cur.visible)
1131      {
1132         return;
1133      }
1134    obj->cur.visible = 0;
1135    evas_object_change(obj);
1136    evas_object_clip_dirty(obj);
1137    if (obj->layer->evas->events_frozen <= 0)
1138      {
1139         evas_object_clip_across_clippees_check(obj);
1140         evas_object_recalc_clippees(obj);
1141         if ((!evas_event_passes_through(obj)) &&
1142             (!evas_event_freezes_through(obj)))
1143           {
1144              if ((!obj->smart.smart) ||
1145                  ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
1146                {
1147                   if (!obj->mouse_grabbed)
1148                     {
1149                        if (evas_object_is_in_output_rect(obj,
1150                                                          obj->layer->evas->pointer.x,
1151                                                          obj->layer->evas->pointer.y, 1, 1))
1152                           evas_event_feed_mouse_move(obj->layer->evas,
1153                                                      obj->layer->evas->pointer.x,
1154                                                      obj->layer->evas->pointer.y,
1155                                                      obj->layer->evas->last_timestamp,
1156                                                      NULL);
1157                     }
1158 /* this is at odds to handling events when an obj is moved out of the mouse
1159  * ore resized out or clipped out. if mouse is grabbed - regardless of
1160  * visibility, mouse move events should keep happening and mouse up.
1161  * for better or worse it's at least consistent.
1162                   if (obj->delete_me) return;
1163                   if (obj->mouse_grabbed > 0)
1164                     obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1165                   if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1166                     obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1167                   obj->mouse_grabbed = 0;
1168                   if (obj->layer->evas->events_frozen > 0)
1169                     {
1170                        obj->mouse_in = 0;
1171                        return;
1172                     }
1173                   if (obj->mouse_in)
1174                     {
1175                        Evas_Event_Mouse_Out ev;
1176
1177                        _evas_object_event_new();
1178
1179                        obj->mouse_in = 0;
1180                        ev.buttons = obj->layer->evas->pointer.button;
1181                        ev.output.x = obj->layer->evas->pointer.x;
1182                        ev.output.y = obj->layer->evas->pointer.y;
1183                        ev.canvas.x = obj->layer->evas->pointer.x;
1184                        ev.canvas.y = obj->layer->evas->pointer.y;
1185                        ev.data = NULL;
1186                        ev.modifiers = &(obj->layer->evas->modifiers);
1187                        ev.locks = &(obj->layer->evas->locks);
1188                        ev.timestamp = obj->layer->evas->last_timestamp;
1189                        ev.event_flags = EVAS_EVENT_FLAG_NONE;
1190                        evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
1191                        _evas_post_event_callback_call(obj->layer->evas);
1192                     }
1193  */
1194                }
1195           }
1196      }
1197    else
1198      {
1199 /*
1200         if (obj->mouse_grabbed > 0)
1201           obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1202         if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1203           obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1204         obj->mouse_grabbed = 0;
1205         obj->mouse_in = 0;
1206  */
1207      }
1208    evas_object_inform_call_hide(obj);
1209 }
1210
1211 EAPI Eina_Bool
1212 evas_object_visible_get(const Evas_Object *obj)
1213 {
1214    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1215    return 0;
1216    MAGIC_CHECK_END();
1217    if (obj->delete_me) return 0;
1218    return obj->cur.visible;
1219 }
1220
1221 EAPI void
1222 evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
1223 {
1224    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1225    return;
1226    MAGIC_CHECK_END();
1227    if (obj->delete_me) return;
1228    if (r > 255) r = 255; if (r < 0) r = 0;
1229    if (g > 255) g = 255; if (g < 0) g = 0;
1230    if (b > 255) b = 255; if (b < 0) b = 0;
1231    if (a > 255) a = 255; if (a < 0) a = 0;
1232    if (r > a)
1233      {
1234         r = a;
1235         ERR("Evas only handles pre multiplied colors!");
1236      }
1237    if (g > a)
1238      {
1239         g = a;
1240         ERR("Evas only handles pre multiplied colors!");
1241      }
1242    if (b > a)
1243      {
1244         b = a;
1245         ERR("Evas only handles pre multiplied colors!");
1246      }
1247
1248    if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return;
1249    if (obj->smart.smart)
1250      {
1251        if (obj->smart.smart->smart_class->color_set)
1252          obj->smart.smart->smart_class->color_set(obj, r, g, b, a);
1253      }
1254    if ((obj->cur.color.r == r) &&
1255        (obj->cur.color.g == g) &&
1256        (obj->cur.color.b == b) &&
1257        (obj->cur.color.a == a)) return;
1258    obj->cur.color.r = r;
1259    obj->cur.color.g = g;
1260    obj->cur.color.b = b;
1261    evas_object_clip_dirty(obj);
1262
1263    if ((obj->cur.color.a == 0) && (a == 0) && (obj->cur.render_op == EVAS_RENDER_BLEND)) return;
1264    obj->cur.color.a = a;
1265    obj->changed_color = EINA_TRUE;
1266    evas_object_change(obj);
1267 }
1268
1269 EAPI void
1270 evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
1271 {
1272    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1273    if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1274    return;
1275    MAGIC_CHECK_END();
1276    if (obj->delete_me)
1277      {
1278         if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1279         return;
1280      }
1281    if (r) *r = obj->cur.color.r;
1282    if (g) *g = obj->cur.color.g;
1283    if (b) *b = obj->cur.color.b;
1284    if (a) *a = obj->cur.color.a;
1285 }
1286
1287 EAPI void
1288 evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias)
1289 {
1290    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1291    return;
1292    MAGIC_CHECK_END();
1293    if (obj->delete_me) return;
1294    anti_alias = !!anti_alias;
1295    if (obj->cur.anti_alias == anti_alias)return;
1296    obj->cur.anti_alias = anti_alias;
1297    evas_object_change(obj);
1298 }
1299
1300 EAPI Eina_Bool
1301 evas_object_anti_alias_get(const Evas_Object *obj)
1302 {
1303    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1304    return 0;
1305    MAGIC_CHECK_END();
1306    if (obj->delete_me) return 0;
1307    return obj->cur.anti_alias;
1308 }
1309
1310 EAPI void
1311 evas_object_scale_set(Evas_Object *obj, double scale)
1312 {
1313    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1314    return;
1315    MAGIC_CHECK_END();
1316    if (obj->delete_me) return;
1317    if (obj->cur.scale == scale) return;
1318    obj->cur.scale = scale;
1319    evas_object_change(obj);
1320    if (obj->func->scale_update) obj->func->scale_update(obj);
1321 }
1322
1323 EAPI double
1324 evas_object_scale_get(const Evas_Object *obj)
1325 {
1326    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1327    return 0;
1328    MAGIC_CHECK_END();
1329    if (obj->delete_me) return 1.0;
1330    return obj->cur.scale;
1331 }
1332
1333 EAPI void
1334 evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op)
1335 {
1336    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1337    return;
1338    MAGIC_CHECK_END();
1339    if (obj->delete_me) return;
1340    if (obj->cur.render_op == render_op) return;
1341    obj->cur.render_op = render_op;
1342    evas_object_change(obj);
1343 }
1344
1345 EAPI Evas_Render_Op
1346 evas_object_render_op_get(const Evas_Object *obj)
1347 {
1348    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1349    return 0;
1350    MAGIC_CHECK_END();
1351    if (obj->delete_me) return EVAS_RENDER_BLEND;
1352    return obj->cur.render_op;
1353 }
1354
1355 EAPI Evas *
1356 evas_object_evas_get(const Evas_Object *obj)
1357 {
1358    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1359    return NULL;
1360    MAGIC_CHECK_END();
1361    if (obj->delete_me) return NULL;
1362    return obj->layer->evas;
1363 }
1364
1365 EAPI Evas_Object *
1366 evas_object_top_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1367 {
1368    Evas_Layer *lay;
1369    int xx, yy;
1370
1371    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1372    return NULL;
1373    MAGIC_CHECK_END();
1374    xx = x;
1375    yy = y;
1376 ////   xx = evas_coord_world_x_to_screen(e, x);
1377 ////   yy = evas_coord_world_y_to_screen(e, y);
1378    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1379      {
1380         Evas_Object *obj;
1381
1382         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1383           {
1384              if (obj->delete_me) continue;
1385              if ((!include_pass_events_objects) &&
1386                  (evas_event_passes_through(obj))) continue;
1387              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1388              evas_object_clip_recalc(obj);
1389              if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1390                  (!obj->clip.clipees))
1391                return obj;
1392           }
1393      }
1394    return NULL;
1395 }
1396
1397 EAPI Evas_Object *
1398 evas_object_top_at_pointer_get(const Evas *e)
1399 {
1400    return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, EINA_TRUE,
1401                                     EINA_TRUE);
1402 }
1403
1404 EAPI Evas_Object *
1405 evas_object_top_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1406 {
1407    Evas_Layer *lay;
1408    int xx, yy, ww, hh;
1409
1410    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1411    return NULL;
1412    MAGIC_CHECK_END();
1413    xx = x;
1414    yy = y;
1415    ww = w;
1416    hh = h;
1417 ////   xx = evas_coord_world_x_to_screen(e, x);
1418 ////   yy = evas_coord_world_y_to_screen(e, y);
1419 ////   ww = evas_coord_world_x_to_screen(e, w);
1420 ////   hh = evas_coord_world_y_to_screen(e, h);
1421    if (ww < 1) ww = 1;
1422    if (hh < 1) hh = 1;
1423    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1424      {
1425         Evas_Object *obj;
1426
1427         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1428           {
1429              if (obj->delete_me) continue;
1430              if ((!include_pass_events_objects) &&
1431                  (evas_event_passes_through(obj))) continue;
1432              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1433              evas_object_clip_recalc(obj);
1434              if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1435                  (!obj->clip.clipees))
1436                return obj;
1437           }
1438      }
1439    return NULL;
1440 }
1441
1442 EAPI Eina_List *
1443 evas_objects_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1444 {
1445    Eina_List *in = NULL;
1446    Evas_Layer *lay;
1447    int xx, yy;
1448
1449    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1450    return NULL;
1451    MAGIC_CHECK_END();
1452    xx = x;
1453    yy = y;
1454 ////   xx = evas_coord_world_x_to_screen(e, x);
1455 ////   yy = evas_coord_world_y_to_screen(e, y);
1456    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1457      {
1458         Evas_Object *obj;
1459
1460         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1461           {
1462              if (obj->delete_me) continue;
1463              if ((!include_pass_events_objects) &&
1464                  (evas_event_passes_through(obj))) continue;
1465              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1466              evas_object_clip_recalc(obj);
1467              if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1468                  (!obj->clip.clipees))
1469                in = eina_list_prepend(in, obj);
1470           }
1471      }
1472    return in;
1473 }
1474
1475 /**
1476  * Retrieves the objects in the given rectangle region
1477  * @param   e The given evas object.
1478  * @param   x The horizontal coordinate.
1479  * @param   y The vertical coordinate.
1480  * @param   w The width size.
1481  * @param   h The height size.
1482  * @param   include_pass_events_objects Boolean Flag to include or not pass events objects
1483  * @param   include_hidden_objects Boolean Flag to include or not hidden objects
1484  * @return  The list of evas object in the rectangle region.
1485  *
1486  */
1487 EAPI Eina_List *
1488 evas_objects_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1489 {
1490    Eina_List *in = NULL;
1491    Evas_Layer *lay;
1492    int xx, yy, ww, hh;
1493
1494    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1495    return NULL;
1496    MAGIC_CHECK_END();
1497    xx = x;
1498    yy = y;
1499    ww = w;
1500    hh = h;
1501 ////   xx = evas_coord_world_x_to_screen(e, x);
1502 ////   yy = evas_coord_world_y_to_screen(e, y);
1503 ////   ww = evas_coord_world_x_to_screen(e, w);
1504 ////   hh = evas_coord_world_y_to_screen(e, h);
1505    if (ww < 1) ww = 1;
1506    if (hh < 1) hh = 1;
1507    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1508      {
1509         Evas_Object *obj;
1510
1511         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1512           {
1513              if (obj->delete_me) continue;
1514              if ((!include_pass_events_objects) &&
1515                  (evas_event_passes_through(obj))) continue;
1516              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1517              evas_object_clip_recalc(obj);
1518              if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1519                  (!obj->clip.clipees))
1520                in = eina_list_prepend(in, obj);
1521           }
1522      }
1523    return in;
1524 }
1525
1526 EAPI const char *
1527 evas_object_type_get(const Evas_Object *obj)
1528 {
1529    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1530    return NULL;
1531    MAGIC_CHECK_END();
1532    if (obj->delete_me) return "";
1533    return obj->type;
1534 }
1535
1536 EAPI void
1537 evas_object_precise_is_inside_set(Evas_Object *obj, Eina_Bool precise)
1538 {
1539    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1540    return;
1541    MAGIC_CHECK_END();
1542    obj->precise_is_inside = precise;
1543 }
1544
1545 EAPI Eina_Bool
1546 evas_object_precise_is_inside_get(const Evas_Object *obj)
1547 {
1548    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1549    return 0;
1550    MAGIC_CHECK_END();
1551    return obj->precise_is_inside;
1552 }
1553
1554 EAPI void
1555 evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1556 {
1557    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1558    return;
1559    MAGIC_CHECK_END();
1560    obj->is_static_clip = is_static_clip;
1561 }
1562
1563 EAPI Eina_Bool
1564 evas_object_static_clip_get(const Evas_Object *obj)
1565 {
1566    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1567    return 0;
1568    MAGIC_CHECK_END();
1569    return obj->is_static_clip;
1570 }
1571
1572 EAPI void
1573 evas_object_is_frame_object_set(Evas_Object *obj, Eina_Bool is_frame)
1574 {
1575    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1576    return;
1577    MAGIC_CHECK_END();
1578    obj->is_frame = is_frame;
1579 }
1580
1581 EAPI Eina_Bool
1582 evas_object_is_frame_object_get(Evas_Object *obj)
1583 {
1584    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1585    return EINA_FALSE;
1586    MAGIC_CHECK_END();
1587    return obj->is_frame;
1588 }