diff options
Diffstat (limited to 'libraries/evas/src/lib/canvas/evas_object_main.c')
-rw-r--r-- | libraries/evas/src/lib/canvas/evas_object_main.c | 112 |
1 files changed, 88 insertions, 24 deletions
diff --git a/libraries/evas/src/lib/canvas/evas_object_main.c b/libraries/evas/src/lib/canvas/evas_object_main.c index 3eaded9..86ab498 100644 --- a/libraries/evas/src/lib/canvas/evas_object_main.c +++ b/libraries/evas/src/lib/canvas/evas_object_main.c | |||
@@ -25,6 +25,7 @@ evas_object_new(Evas *e __UNUSED__) | |||
25 | obj->magic = MAGIC_OBJ; | 25 | obj->magic = MAGIC_OBJ; |
26 | obj->cur.scale = 1.0; | 26 | obj->cur.scale = 1.0; |
27 | obj->prev.scale = 1.0; | 27 | obj->prev.scale = 1.0; |
28 | obj->is_frame = EINA_FALSE; | ||
28 | 29 | ||
29 | return obj; | 30 | return obj; |
30 | } | 31 | } |
@@ -99,7 +100,8 @@ evas_object_change(Evas_Object *obj) | |||
99 | /* set changed flag on all objects this one clips too */ | 100 | /* set changed flag on all objects this one clips too */ |
100 | if (!((movch) && (obj->is_static_clip))) | 101 | if (!((movch) && (obj->is_static_clip))) |
101 | { | 102 | { |
102 | EINA_LIST_FOREACH(obj->clip.clipees, l, obj2) evas_object_change(obj2); | 103 | EINA_LIST_FOREACH(obj->clip.clipees, l, obj2) |
104 | evas_object_change(obj2); | ||
103 | } | 105 | } |
104 | EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2) | 106 | EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2) |
105 | { | 107 | { |
@@ -111,8 +113,8 @@ evas_object_change(Evas_Object *obj) | |||
111 | void | 113 | void |
112 | evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v) | 114 | evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v) |
113 | { | 115 | { |
114 | if (obj->smart.smart) return ; | 116 | if (obj->smart.smart) return; |
115 | if (is_v == was_v) return ; | 117 | if (is_v == was_v) return; |
116 | if (is_v) | 118 | if (is_v) |
117 | { | 119 | { |
118 | evas_add_rect(rects, | 120 | evas_add_rect(rects, |
@@ -134,8 +136,8 @@ evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int i | |||
134 | void | 136 | void |
135 | evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj) | 137 | evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj) |
136 | { | 138 | { |
137 | if (obj->smart.smart) return ; | 139 | if (obj->smart.smart) return; |
138 | if (obj->cur.clipper == obj->prev.clipper) return ; | 140 | if (obj->cur.clipper == obj->prev.clipper) return; |
139 | if ((obj->cur.clipper) && (obj->prev.clipper)) | 141 | if ((obj->cur.clipper) && (obj->prev.clipper)) |
140 | { | 142 | { |
141 | /* get difference rects between clippers */ | 143 | /* get difference rects between clippers */ |
@@ -223,7 +225,8 @@ evas_object_clip_changes_clean(Evas_Object *obj) | |||
223 | { | 225 | { |
224 | Eina_Rectangle *r; | 226 | Eina_Rectangle *r; |
225 | 227 | ||
226 | EINA_LIST_FREE(obj->clip.changes, r) eina_rectangle_free(r); | 228 | EINA_LIST_FREE(obj->clip.changes, r) |
229 | eina_rectangle_free(r); | ||
227 | } | 230 | } |
228 | 231 | ||
229 | void | 232 | void |
@@ -408,11 +411,11 @@ evas_object_del(Evas_Object *obj) | |||
408 | obj->focused = 0; | 411 | obj->focused = 0; |
409 | obj->layer->evas->focused = NULL; | 412 | obj->layer->evas->focused = NULL; |
410 | _evas_object_event_new(); | 413 | _evas_object_event_new(); |
411 | evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL); | 414 | evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter); |
412 | _evas_post_event_callback_call(obj->layer->evas); | 415 | _evas_post_event_callback_call(obj->layer->evas); |
413 | } | 416 | } |
414 | _evas_object_event_new(); | 417 | _evas_object_event_new(); |
415 | evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL); | 418 | evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter); |
416 | _evas_post_event_callback_call(obj->layer->evas); | 419 | _evas_post_event_callback_call(obj->layer->evas); |
417 | if (obj->mouse_grabbed > 0) | 420 | if (obj->mouse_grabbed > 0) |
418 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; | 421 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; |
@@ -426,9 +429,6 @@ evas_object_del(Evas_Object *obj) | |||
426 | evas_object_free(obj, 1); | 429 | evas_object_free(obj, 1); |
427 | return; | 430 | return; |
428 | } | 431 | } |
429 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; | ||
430 | obj->mouse_grabbed = 0; | ||
431 | obj->mouse_in = 0; | ||
432 | evas_object_grabs_cleanup(obj); | 432 | evas_object_grabs_cleanup(obj); |
433 | while (obj->clip.clipees) | 433 | while (obj->clip.clipees) |
434 | evas_object_clip_unset(obj->clip.clipees->data); | 434 | evas_object_clip_unset(obj->clip.clipees->data); |
@@ -438,7 +438,7 @@ evas_object_del(Evas_Object *obj) | |||
438 | if (obj->smart.smart) evas_object_smart_del(obj); | 438 | if (obj->smart.smart) evas_object_smart_del(obj); |
439 | evas_object_map_set(obj, NULL); | 439 | evas_object_map_set(obj, NULL); |
440 | _evas_object_event_new(); | 440 | _evas_object_event_new(); |
441 | evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL); | 441 | evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter); |
442 | _evas_post_event_callback_call(obj->layer->evas); | 442 | _evas_post_event_callback_call(obj->layer->evas); |
443 | evas_object_smart_cleanup(obj); | 443 | evas_object_smart_cleanup(obj); |
444 | obj->delete_me = 1; | 444 | obj->delete_me = 1; |
@@ -449,18 +449,38 @@ EAPI void | |||
449 | evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) | 449 | evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) |
450 | { | 450 | { |
451 | int is, was = 0, pass = 0, freeze = 0; | 451 | int is, was = 0, pass = 0, freeze = 0; |
452 | int nx = 0, ny = 0; | ||
452 | 453 | ||
453 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | 454 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); |
454 | return; | 455 | return; |
455 | MAGIC_CHECK_END(); | 456 | MAGIC_CHECK_END(); |
456 | if (obj->delete_me) return; | 457 | if (obj->delete_me) return; |
457 | if (evas_object_intercept_call_move(obj, x, y)) return; | 458 | |
459 | nx = x; | ||
460 | ny = y; | ||
461 | |||
462 | if (!obj->is_frame) | ||
463 | { | ||
464 | int fx, fy; | ||
465 | |||
466 | evas_output_framespace_get(obj->layer->evas, &fx, &fy, NULL, NULL); | ||
467 | if (!obj->smart.parent) | ||
468 | { | ||
469 | nx += fx; | ||
470 | ny += fy; | ||
471 | } | ||
472 | } | ||
473 | |||
474 | if (evas_object_intercept_call_move(obj, nx, ny)) return; | ||
475 | |||
458 | if (obj->doing.in_move > 0) | 476 | if (obj->doing.in_move > 0) |
459 | { | 477 | { |
460 | WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj); | 478 | WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj); |
461 | return; | 479 | return; |
462 | } | 480 | } |
463 | if ((obj->cur.geometry.x == x) && (obj->cur.geometry.y == y)) return; | 481 | |
482 | if ((obj->cur.geometry.x == nx) && (obj->cur.geometry.y == ny)) return; | ||
483 | |||
464 | if (obj->layer->evas->events_frozen <= 0) | 484 | if (obj->layer->evas->events_frozen <= 0) |
465 | { | 485 | { |
466 | pass = evas_event_passes_through(obj); | 486 | pass = evas_event_passes_through(obj); |
@@ -471,13 +491,16 @@ evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) | |||
471 | obj->layer->evas->pointer.y, 1, 1); | 491 | obj->layer->evas->pointer.y, 1, 1); |
472 | } | 492 | } |
473 | obj->doing.in_move++; | 493 | obj->doing.in_move++; |
494 | |||
474 | if (obj->smart.smart) | 495 | if (obj->smart.smart) |
475 | { | 496 | { |
476 | if (obj->smart.smart->smart_class->move) | 497 | if (obj->smart.smart->smart_class->move) |
477 | obj->smart.smart->smart_class->move(obj, x, y); | 498 | obj->smart.smart->smart_class->move(obj, nx, ny); |
478 | } | 499 | } |
479 | obj->cur.geometry.x = x; | 500 | |
480 | obj->cur.geometry.y = y; | 501 | obj->cur.geometry.x = nx; |
502 | obj->cur.geometry.y = ny; | ||
503 | |||
481 | //// obj->cur.cache.geometry.validity = 0; | 504 | //// obj->cur.cache.geometry.validity = 0; |
482 | obj->changed_move = 1; | 505 | obj->changed_move = 1; |
483 | evas_object_change(obj); | 506 | evas_object_change(obj); |
@@ -509,19 +532,40 @@ EAPI void | |||
509 | evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | 532 | evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) |
510 | { | 533 | { |
511 | int is, was = 0, pass = 0, freeze =0; | 534 | int is, was = 0, pass = 0, freeze =0; |
535 | int nw = 0, nh = 0; | ||
512 | 536 | ||
513 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | 537 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); |
514 | return; | 538 | return; |
515 | MAGIC_CHECK_END(); | 539 | MAGIC_CHECK_END(); |
516 | if (obj->delete_me) return; | 540 | if (obj->delete_me) return; |
517 | if (w < 0) w = 0; if (h < 0) h = 0; | 541 | if (w < 0) w = 0; if (h < 0) h = 0; |
518 | if (evas_object_intercept_call_resize(obj, w, h)) return; | 542 | |
543 | nw = w; | ||
544 | nh = h; | ||
545 | if (!obj->is_frame) | ||
546 | { | ||
547 | int fw, fh; | ||
548 | |||
549 | evas_output_framespace_get(obj->layer->evas, NULL, NULL, &fw, &fh); | ||
550 | if (!obj->smart.parent) | ||
551 | { | ||
552 | nw = w - fw; | ||
553 | nh = h - fh; | ||
554 | if (nw < 0) nw = 0; | ||
555 | if (nh < 0) nh = 0; | ||
556 | } | ||
557 | } | ||
558 | |||
559 | if (evas_object_intercept_call_resize(obj, nw, nh)) return; | ||
560 | |||
519 | if (obj->doing.in_resize > 0) | 561 | if (obj->doing.in_resize > 0) |
520 | { | 562 | { |
521 | WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj); | 563 | WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj); |
522 | return; | 564 | return; |
523 | } | 565 | } |
524 | if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return; | 566 | |
567 | if ((obj->cur.geometry.w == nw) && (obj->cur.geometry.h == nh)) return; | ||
568 | |||
525 | if (obj->layer->evas->events_frozen <= 0) | 569 | if (obj->layer->evas->events_frozen <= 0) |
526 | { | 570 | { |
527 | pass = evas_event_passes_through(obj); | 571 | pass = evas_event_passes_through(obj); |
@@ -532,13 +576,16 @@ evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | |||
532 | obj->layer->evas->pointer.y, 1, 1); | 576 | obj->layer->evas->pointer.y, 1, 1); |
533 | } | 577 | } |
534 | obj->doing.in_resize++; | 578 | obj->doing.in_resize++; |
579 | |||
535 | if (obj->smart.smart) | 580 | if (obj->smart.smart) |
536 | { | 581 | { |
537 | if (obj->smart.smart->smart_class->resize) | 582 | if (obj->smart.smart->smart_class->resize) |
538 | obj->smart.smart->smart_class->resize(obj, w, h); | 583 | obj->smart.smart->smart_class->resize(obj, nw, nh); |
539 | } | 584 | } |
540 | obj->cur.geometry.w = w; | 585 | |
541 | obj->cur.geometry.h = h; | 586 | obj->cur.geometry.w = nw; |
587 | obj->cur.geometry.h = nh; | ||
588 | |||
542 | //// obj->cur.cache.geometry.validity = 0; | 589 | //// obj->cur.cache.geometry.validity = 0; |
543 | evas_object_change(obj); | 590 | evas_object_change(obj); |
544 | evas_object_clip_dirty(obj); | 591 | evas_object_clip_dirty(obj); |
@@ -581,6 +628,7 @@ evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, E | |||
581 | if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0; | 628 | if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0; |
582 | return; | 629 | return; |
583 | } | 630 | } |
631 | |||
584 | if (x) *x = obj->cur.geometry.x; | 632 | if (x) *x = obj->cur.geometry.x; |
585 | if (y) *y = obj->cur.geometry.y; | 633 | if (y) *y = obj->cur.geometry.y; |
586 | if (w) *w = obj->cur.geometry.w; | 634 | if (w) *w = obj->cur.geometry.w; |
@@ -1084,8 +1132,7 @@ evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op) | |||
1084 | return; | 1132 | return; |
1085 | MAGIC_CHECK_END(); | 1133 | MAGIC_CHECK_END(); |
1086 | if (obj->delete_me) return; | 1134 | if (obj->delete_me) return; |
1087 | if ((Evas_Render_Op)obj->cur.render_op == render_op) | 1135 | if (obj->cur.render_op == render_op) return; |
1088 | return; | ||
1089 | obj->cur.render_op = render_op; | 1136 | obj->cur.render_op = render_op; |
1090 | evas_object_change(obj); | 1137 | evas_object_change(obj); |
1091 | } | 1138 | } |
@@ -1317,3 +1364,20 @@ evas_object_static_clip_get(const Evas_Object *obj) | |||
1317 | return obj->is_static_clip; | 1364 | return obj->is_static_clip; |
1318 | } | 1365 | } |
1319 | 1366 | ||
1367 | EAPI void | ||
1368 | evas_object_is_frame_object_set(Evas_Object *obj, Eina_Bool is_frame) | ||
1369 | { | ||
1370 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1371 | return; | ||
1372 | MAGIC_CHECK_END(); | ||
1373 | obj->is_frame = is_frame; | ||
1374 | } | ||
1375 | |||
1376 | EAPI Eina_Bool | ||
1377 | evas_object_is_frame_object_get(Evas_Object *obj) | ||
1378 | { | ||
1379 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1380 | return EINA_FALSE; | ||
1381 | MAGIC_CHECK_END(); | ||
1382 | return obj->is_frame; | ||
1383 | } | ||