Evas: Fix bugs in Wayland Engine(s) with regard to object geometry &
authordevilhorns <devilhorns@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 30 Jul 2012 09:52:33 +0000 (09:52 +0000)
committerdevilhorns <devilhorns@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 30 Jul 2012 09:52:33 +0000 (09:52 +0000)
position. Fix bug when clipping to viewport/framespace. These changes
fix Several buggers on Trac which related to the Wayland Engine(s).

Fix minor bug in evas_render where clipping for framespace would
not take into account the frame height and also move the frame clip to
the values specified in framespace (not viewport).

Fix buggers in evas_object_main which was causing objects (when created using
the wayland engines) to be an incorrect size & position (objects will now
be the same size/position in EFL Wayland as they are in X11).

Fix evas_object_geometry_get to return values based on where they were
moved (in relation to framespace). (These fixes are for the Wayland
Engines and do not affect X11).

Remove nw/nh from evas_object_resize (not needed variables anymore).

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@74565 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_main.c
src/lib/canvas/evas_render.c

index d20be57..c7e9aed 100644 (file)
@@ -595,11 +595,12 @@ evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
 
    if (!obj->is_frame)
      {
-        int fx, fy;
-
-        evas_output_framespace_get(obj->layer->evas, &fx, &fy, NULL, NULL);
-        if (!obj->smart.parent)
+        if ((!obj->smart.parent) && (obj->smart.smart))
           {
+             int fx, fy;
+
+             evas_output_framespace_get(obj->layer->evas, 
+                                        &fx, &fy, NULL, NULL);
              nx += fx;
              ny += fy;
           }
@@ -668,7 +669,6 @@ EAPI void
 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
 {
    int is, was = 0, pass = 0, freeze =0;
-   int nw = 0, nh = 0;
 
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    return;
@@ -676,23 +676,7 @@ evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
    if (obj->delete_me) return;
    if (w < 0) w = 0; if (h < 0) h = 0;
 
-   nw = w;
-   nh = h;
-   if (!obj->is_frame)
-     {
-        int fw, fh;
-
-        evas_output_framespace_get(obj->layer->evas, NULL, NULL, &fw, &fh);
-        if (!obj->smart.parent)
-          {
-             nw = w - fw;
-             nh = h - fh;
-             if (nw < 0) nw = 0;
-             if (nh < 0) nh = 0;
-          }
-     }
-
-   if (evas_object_intercept_call_resize(obj, nw, nh)) return;
+   if (evas_object_intercept_call_resize(obj, w, h)) return;
 
    if (obj->doing.in_resize > 0)
      {
@@ -700,7 +684,7 @@ evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
         return;
      }
 
-   if ((obj->cur.geometry.w == nw) && (obj->cur.geometry.h == nh)) return;
+   if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return;
 
    if (obj->layer->evas->events_frozen <= 0)
      {
@@ -716,11 +700,11 @@ evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
    if (obj->smart.smart)
      {
        if (obj->smart.smart->smart_class->resize)
-          obj->smart.smart->smart_class->resize(obj, nw, nh);
+          obj->smart.smart->smart_class->resize(obj, w, h);
      }
 
-   obj->cur.geometry.w = nw;
-   obj->cur.geometry.h = nh;
+   obj->cur.geometry.w = w;
+   obj->cur.geometry.h = h;
 
    evas_object_update_bounding_box(obj);
 
@@ -757,6 +741,8 @@ evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
 EAPI void
 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
 {
+   int nx = 0, ny = 0;
+
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
    return;
@@ -767,8 +753,30 @@ evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, E
         return;
      }
 
-   if (x) *x = obj->cur.geometry.x;
-   if (y) *y = obj->cur.geometry.y;
+   nx = obj->cur.geometry.x;
+   ny = obj->cur.geometry.y;
+
+   if (!obj->is_frame)
+     {
+        int fx, fy;
+
+        evas_output_framespace_get(obj->layer->evas, 
+                                   &fx, &fy, NULL, NULL);
+
+        if ((!obj->smart.parent) && (obj->smart.smart))
+          {
+             if (nx > 0) nx -= fx;
+             if (ny > 0) ny -= fy;
+          }
+        else if ((obj->smart.parent) && (!obj->smart.smart))
+          {
+             if (nx > 0) nx -= fx;
+             if (ny > 0) ny -= fy;
+          }
+     }
+
+   if (x) *x = nx;
+   if (y) *y = ny;
    if (w) *w = obj->cur.geometry.w;
    if (h) *h = obj->cur.geometry.h;
 }
index 9f82117..1db3d21 100644 (file)
@@ -1352,6 +1352,8 @@ evas_render_updates_internal(Evas *e,
         fy = e->viewport.y - e->framespace.y;
         fw = e->viewport.w + e->framespace.w;
         fh = e->viewport.h + e->framespace.h;
+        if (fx < 0) fx = 0;
+        if (fy < 0) fy = 0;
         e->engine.func->output_redraws_rect_add(e->engine.data.output,
                                                 fx, fy, fw, fh);
      }
@@ -1372,9 +1374,10 @@ evas_render_updates_internal(Evas *e,
              e->framespace.clip = evas_object_rectangle_add(e);
              evas_object_color_set(e->framespace.clip, 255, 255, 255, 255);
              evas_object_move(e->framespace.clip,
-                              e->framespace.x, e->viewport.y);
+                              e->framespace.x, e->framespace.y);
              evas_object_resize(e->framespace.clip,
-                                e->viewport.w - e->framespace.w, e->viewport.h);
+                                e->viewport.w - e->framespace.w, 
+                                e->viewport.h - e->framespace.h);
              evas_object_show(e->framespace.clip);
           }
         else
@@ -1382,9 +1385,11 @@ evas_render_updates_internal(Evas *e,
              /* master clip is already present. check for size changes in the 
               * viewport, and update master clip size if needed */
              if ((e->viewport.changed) || (e->output.changed))
-               evas_object_resize(e->framespace.clip,
-                                  e->viewport.w - e->framespace.w,
-                                  e->viewport.h);
+               {
+                  evas_object_resize(e->framespace.clip,
+                                     e->viewport.w - e->framespace.w,
+                                     e->viewport.h - e->framespace.h);
+               }
           }
 
         EINA_RECTANGLE_SET(&clip_rect,