devilhorns pushed a commit to branch master.

commit 6e0075aa0491003ea717a248dea9886e99cc489b
Author: Chris Michael <[email protected]>
Date:   Tue Apr 30 14:46:21 2013 +0100

    Check for valid engine resize function before calling it.
    In the window_configure callback, reduce duplicated/not needed code.
    Account for rotation when getting new size during common_rotation_set.
    Reduce duplicated code in ecore_evas_wl_resize function and just call
    the _common_resize function (as that already has most of this code).
    
    Fix issue of Segfault on elm app closing:
      - During hide we need to call evas_sync to make sure the async
        render has flushed out everything that is pending.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 .../engines/wayland/ecore_evas_wayland_common.c    | 86 ++++++++++------------
 1 file changed, 39 insertions(+), 47 deletions(-)

diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 6c8d525..63c3790 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -163,7 +163,6 @@ _ecore_evas_wl_common_cb_window_configure(void *data 
EINA_UNUSED, int type EINA_
 {
    Ecore_Evas *ee;
    Ecore_Wl_Event_Window_Configure *ev;
-   Ecore_Evas_Engine_Wl_Data *wdata;
    int nw = 0, nh = 0;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -176,7 +175,8 @@ _ecore_evas_wl_common_cb_window_configure(void *data 
EINA_UNUSED, int type EINA_
    if (ee->prop.fullscreen)
      {
         _ecore_evas_wl_common_move(ee, ev->x, ev->y);
-        ee->engine.func->fn_resize(ee, ev->w, ev->h);
+        if (ee->engine.func->fn_resize) 
+          ee->engine.func->fn_resize(ee, ev->w, ev->h);
 
         return ECORE_CALLBACK_PASS_ON;
      }
@@ -185,7 +185,7 @@ _ecore_evas_wl_common_cb_window_configure(void *data 
EINA_UNUSED, int type EINA_
      {
         ee->req.x = ee->x;
         ee->req.y = ee->y;
-        if (ee->func.fn_move) ee->func.fn_move(ee);
+        _ecore_evas_wl_common_move(ee, ev->x, ev->y);
      }
 
    nw = ev->w;
@@ -220,34 +220,6 @@ _ecore_evas_wl_common_cb_window_configure(void *data 
EINA_UNUSED, int type EINA_
         ee->w = nw;
         ee->h = nh;
         if (ee->func.fn_resize) ee->func.fn_resize(ee);
-
-        if ((ee->rotation == 90) || (ee->rotation == 270))
-          {
-             evas_output_size_set(ee->evas, ev->h, ev->w);
-             evas_output_viewport_set(ee->evas, 0, 0, ev->h, ev->w);
-          }
-        else
-          {
-             evas_output_size_set(ee->evas, ev->w, ev->h);
-             evas_output_viewport_set(ee->evas, 0, 0, ev->w, ev->h);
-          }
-
-        wdata = ee->engine.data;
-
-        if (wdata->win)
-          {
-             Ecore_Wl_Window *win;
-
-             win = wdata->win;
-
-             win->server_allocation = win->allocation;
-             ecore_wl_window_update_size(wdata->win, ev->w, ev->h);
-
-             _ecore_evas_wayland_resize(ee, win->edges);
-          }
-
-        if (wdata->frame)
-          evas_object_resize(wdata->frame, ev->w, ev->h);
      }
 
    return ECORE_CALLBACK_PASS_ON;
@@ -274,38 +246,46 @@ _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int 
rotation, int resize)
              if (!ee->prop.fullscreen)
                {
                   int fw, fh;
+
                   evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
+
                   if ((rotation == 0) || (rotation == 180))
                     {
-                       ecore_wl_window_resize(wdata->win, ee->h + fw, ee->w + 
fh, 0);
-                       ecore_wl_window_update_size(wdata->win, ee->h + fw, 
ee->w + fh);
-                    }
-                  else
-                    {
-                       ecore_wl_window_resize(wdata->win, ee->h + fh, ee->w + 
fw, 0);
-                       ecore_wl_window_update_size(wdata->win, ee->h + fh, 
ee->w + fw);
-                    }
-                  if ((ee->rotation == 0) || (ee->rotation == 180))
-                    {
+                       ecore_wl_window_resize(wdata->win, ee->h + fw, 
+                                              ee->w + fh, 0);
+                       ecore_wl_window_update_size(wdata->win, ee->h + fw, 
+                                                   ee->w + fh);
+
                        evas_output_size_set(ee->evas, ee->w + fw, ee->h + fh);
-                       evas_output_viewport_set(ee->evas, 0, 0, ee->w + fw, 
ee->h + fh);
+                       evas_output_viewport_set(ee->evas, 0, 0, ee->w + fw, 
+                                                ee->h + fh);
                     }
                   else
                     {
+                       ecore_wl_window_resize(wdata->win, ee->h + fh, 
+                                              ee->w + fw, 0);
+                       ecore_wl_window_update_size(wdata->win, ee->h + fh, 
+                                                   ee->w + fw);
+
                        evas_output_size_set(ee->evas, ee->h + fw, ee->w + fh);
-                       evas_output_viewport_set(ee->evas, 0, 0, ee->h + fw, 
ee->w + fh);
+                       evas_output_viewport_set(ee->evas, 0, 0, ee->h + fw, 
+                                                ee->w + fh);
                     }
                }
              else
                {
                   evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
-                  evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, 
ee->req.h);
+                  evas_output_viewport_set(ee->evas, 0, 0, 
+                                           ee->req.w, ee->req.h);
+
                   if (ee->func.fn_resize) ee->func.fn_resize(ee);
                }
+
              if ((ee->rotation == 90) || (ee->rotation == 270))
                evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
              else
                evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
+
              ww = ee->h;
              hh = ee->w;
              ee->w = ww;
@@ -325,7 +305,9 @@ _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int 
rotation, int resize)
                   evas_output_size_set(ee->evas, ee->h, ee->w);
                   evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
                }
+
              if (ee->func.fn_resize) ee->func.fn_resize(ee);
+
              if ((ee->rotation == 90) || (ee->rotation == 270))
                evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
              else
@@ -461,8 +443,17 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
         else if (h > ee->prop.max.h) h = ee->prop.max.h;
 
         evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
-        w += fw;
-        h += fh;
+
+        if ((ee->rotation == 90) || (ee->rotation == 270))
+          {
+             w += fh;
+             h += fw;
+          }
+        else
+          {
+             w += fw;
+             h += fh;
+          }
      }
 
    if ((ee->w != w) || (ee->h != h))
@@ -470,6 +461,8 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
         ee->w = w;
         ee->h = h;
 
+        /* evas_sync(ee->evas); */
+
         if ((ee->rotation == 90) || (ee->rotation == 270))
           {
              evas_output_size_set(ee->evas, h, w);
@@ -588,7 +581,6 @@ _ecore_evas_wl_common_move(Ecore_Evas *ee, int x, int y)
 static void
 _border_size_eval(Evas_Object *obj EINA_UNUSED, EE_Wl_Smart_Data *sd)
 {
-
    /* top border */
    if (sd->border[0])
      {

-- 

------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1

Reply via email to