discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=82a4dbda8da921f7efde000b967f1ec62a2249ad

commit 82a4dbda8da921f7efde000b967f1ec62a2249ad
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Tue Mar 8 12:31:10 2016 -0500

    enforce accurate resizing/orienting when changing the location of a bryce
---
 src/bin/e_bryce.c        | 28 +++++++++++++++++++++++-----
 src/bin/e_bryce_editor.c |  5 ++++-
 src/bin/e_gadget.c       | 10 +++++-----
 3 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/src/bin/e_bryce.c b/src/bin/e_bryce.c
index 8348063..d3aba88 100644
--- a/src/bin/e_bryce.c
+++ b/src/bin/e_bryce.c
@@ -731,6 +731,14 @@ _bryce_gadget_popup(void *data, Evas_Object *obj 
EINA_UNUSED, void *event_info)
 }
 
 static void
+_bryce_site_anchor(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+   Bryce *b = data;
+
+   e_bryce_orient(b->bryce, e_gadget_site_orient_get(obj), 
e_gadget_site_anchor_get(obj));
+}
+
+static void
 _bryce_orient(Bryce *b)
 {
    char buf[1024];
@@ -748,6 +756,11 @@ _bryce_orient(Bryce *b)
      elm_layout_signal_emit(b->layout, "e,state,orient,horizontal", "e");
    else
      elm_layout_signal_emit(b->layout, "e,state,orient,vertical", "e");
+   evas_object_event_callback_add(b->site, EVAS_CALLBACK_CHANGED_SIZE_HINTS, 
_bryce_site_hints, b);
+   evas_object_smart_callback_add(b->site, "gadget_site_anchor", 
_bryce_site_anchor, b);
+   evas_object_smart_callback_add(b->site, "gadget_site_style_menu", 
_bryce_style_menu, b);
+   evas_object_smart_callback_add(b->site, "gadget_site_owner_menu", 
_bryce_owner_menu, b);
+   evas_object_smart_callback_add(b->site, "gadget_site_popup", 
_bryce_gadget_popup, b);
 }
 
 static void
@@ -801,11 +814,6 @@ _bryce_create(Bryce *b, Evas_Object *parent)
    evas_object_event_callback_add(bryce, EVAS_CALLBACK_MOUSE_DOWN, 
_bryce_mouse_down, b);
    evas_object_event_callback_add(bryce, EVAS_CALLBACK_MOUSE_UP, 
_bryce_mouse_up, b);
    evas_object_event_callback_add(bryce, EVAS_CALLBACK_MOUSE_WHEEL, 
_bryce_mouse_wheel, b);
-   evas_object_event_callback_add(b->site, EVAS_CALLBACK_CHANGED_SIZE_HINTS, 
_bryce_site_hints, b);
-
-   evas_object_smart_callback_add(b->site, "gadget_site_style_menu", 
_bryce_style_menu, b);
-   evas_object_smart_callback_add(b->site, "gadget_site_owner_menu", 
_bryce_owner_menu, b);
-   evas_object_smart_callback_add(b->site, "gadget_site_popup", 
_bryce_gadget_popup, b);
 
    zone_clip = e_comp_zone_number_get(b->zone)->bg_clip_object;
    evas_object_clip_set(bryce, zone_clip);
@@ -912,10 +920,20 @@ e_bryce_add(Evas_Object *parent, const char *name, 
E_Gadget_Site_Orient orient,
 E_API void
 e_bryce_orient(Evas_Object *bryce, E_Gadget_Site_Orient orient, 
E_Gadget_Site_Anchor an)
 {
+   int w, h;
+   E_Gadget_Site_Orient prev;
+
    BRYCE_GET(bryce);
+   if ((b->orient == orient) && (b->anchor == an)) return;
+   prev = b->orient;
    b->orient = orient;
    b->anchor = an;
+   evas_object_geometry_get(bryce, NULL, NULL, &w, &h);
    _bryce_orient(b);
+   if (prev == orient)
+     _bryce_autosize(b);
+   else
+     evas_object_resize(bryce, h, w);
 }
 
 E_API Evas_Object *
diff --git a/src/bin/e_bryce_editor.c b/src/bin/e_bryce_editor.c
index 4c13149..b07173a 100644
--- a/src/bin/e_bryce_editor.c
+++ b/src/bin/e_bryce_editor.c
@@ -77,7 +77,10 @@ _editor_bryce_add(Evas_Object *obj)
           gravity = E_GADGET_SITE_GRAVITY_BOTTOM;
      }
    if (b)
-     site = e_bryce_site_get(b);
+     {
+        e_bryce_orient(b, bi->orient, bi->anchor);
+        site = e_bryce_site_get(b);
+     }
    else
      {
         b = e_bryce_add(e_comp->elm, buf, bi->orient, bi->anchor);
diff --git a/src/bin/e_gadget.c b/src/bin/e_gadget.c
index e41f542..bb70ca2 100644
--- a/src/bin/e_gadget.c
+++ b/src/bin/e_gadget.c
@@ -1175,8 +1175,12 @@ _site_util_add(E_Gadget_Site_Orient orient, const char 
*name, Eina_Bool autoadd)
    zgs = E_NEW(E_Gadget_Site, 1);
 
    zgs->name = eina_stringshare_add(name);
-   zgs->orient = orient;
    zgs->autoadd = autoadd;
+
+   if (name)
+     sites->sites = eina_list_append(sites->sites, zgs);
+out:
+   zgs->orient = orient;
    switch (orient)
      {
       case E_GADGET_SITE_ORIENT_HORIZONTAL:
@@ -1187,10 +1191,6 @@ _site_util_add(E_Gadget_Site_Orient orient, const char 
*name, Eina_Bool autoadd)
         break;
       default: break;
      }
-
-   if (name)
-     sites->sites = eina_list_append(sites->sites, zgs);
-out:
    if (autoadd)
      {
         parent = evas_object_name_find(e_comp->evas, name);

-- 


Reply via email to