bu5hm4n pushed a commit to branch master.

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

commit f5e4403164bc1630d506cac0606bb5332c365f72
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Tue Sep 6 16:31:13 2016 +0200

    tiling: place popup on the current active zone
    
    Otherwise the popup will be where you are not looking at.
    
    This patch adds a new function to e_comp_object where you can pass the
    zone where you want to place the e_comp_object on.
    
    ref T4499
---
 src/bin/e_comp_object.c           | 14 +++++++++++---
 src/bin/e_comp_object.h           |  1 +
 src/modules/tiling/e_mod_tiling.c | 23 ++++++++++++++++++++++-
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
index 32b4756..9cee12c 100644
--- a/src/bin/e_comp_object.c
+++ b/src/bin/e_comp_object.c
@@ -3043,14 +3043,12 @@ e_comp_object_util_zone_get(Evas_Object *obj)
 }
 
 E_API void
-e_comp_object_util_center(Evas_Object *obj)
+e_comp_object_util_center_on_zone(Evas_Object *obj, E_Zone *zone)
 {
    int x, y, w, h, ow, oh;
-   E_Zone *zone;
 
    SOFT_ENTRY();
 
-   zone = e_comp_object_util_zone_get(obj);
    EINA_SAFETY_ON_NULL_RETURN(zone);
    e_zone_useful_geometry_get(zone, &x, &y, &w, &h);
    if (cw && (cw->ec->changes.size || cw->ec->new_client))
@@ -3063,6 +3061,16 @@ e_comp_object_util_center(Evas_Object *obj)
 }
 
 E_API void
+e_comp_object_util_center(Evas_Object *obj)
+{
+   E_Zone *zone;
+
+   zone = e_comp_object_util_zone_get(obj);
+
+   e_comp_object_util_center_on_zone(obj, zone);
+}
+
+E_API void
 e_comp_object_util_center_on(Evas_Object *obj, Evas_Object *on)
 {
    int x, y, w, h, ow, oh;
diff --git a/src/bin/e_comp_object.h b/src/bin/e_comp_object.h
index f108b3b..1701ace 100644
--- a/src/bin/e_comp_object.h
+++ b/src/bin/e_comp_object.h
@@ -54,6 +54,7 @@ E_API Eina_Bool e_comp_object_util_autoclose_on_escape(void 
*d EINA_UNUSED, Ecor
 E_API void e_comp_object_util_autoclose(Evas_Object *obj, 
E_Comp_Object_Autoclose_Cb del_cb, E_Comp_Object_Key_Cb cb, const void *data);
 E_API void e_comp_object_util_center(Evas_Object *obj);
 E_API void e_comp_object_util_center_on(Evas_Object *obj, Evas_Object *on);
+E_API void e_comp_object_util_center_on_zone(Evas_Object *obj, E_Zone *zone);
 E_API void e_comp_object_util_center_pos_get(Evas_Object *obj, int *x, int *y);
 E_API void e_comp_object_util_fullscreen(Evas_Object *obj);
 E_API Eina_Bool e_comp_object_frame_allowed(Evas_Object *obj);
diff --git a/src/modules/tiling/e_mod_tiling.c 
b/src/modules/tiling/e_mod_tiling.c
index 3b3565e..d83aa28 100644
--- a/src/modules/tiling/e_mod_tiling.c
+++ b/src/modules/tiling/e_mod_tiling.c
@@ -96,6 +96,7 @@ static struct tiling_mod_main_g
         Evas_Object *comp_obj;
         Evas_Object *obj;
         Ecore_Timer *timer;
+        E_Desk *desk;
    } split_popup;
 } _G =
 {
@@ -844,6 +845,7 @@ _split_type_popup_timer_del_cb(void *data EINA_UNUSED)
    _G.split_popup.comp_obj = NULL;
    _G.split_popup.obj = NULL;
    _G.split_popup.timer = NULL;
+   _G.split_popup.desk = NULL;
 
    return EINA_FALSE;
 }
@@ -853,8 +855,19 @@ _tiling_split_type_changed_popup(void)
 {
    Evas_Object *comp_obj = _G.split_popup.comp_obj;
    Evas_Object *o = _G.split_popup.obj;
+   E_Desk *desk = NULL;
 
    /* If this is not NULL, the rest isn't either. */
+
+   /* check for the current desk we have */
+   if (e_client_focused_get())
+     {
+        E_Client *c;
+
+        c = e_client_focused_get();
+        desk = c->desk;
+     }
+
    if (!o)
      {
         _G.split_popup.obj = o = edje_object_add(e_comp->evas);
@@ -864,7 +877,12 @@ _tiling_split_type_changed_popup(void)
         evas_object_resize(o, TILING_POPUP_SIZE, TILING_POPUP_SIZE);
 
         _G.split_popup.comp_obj = comp_obj = e_comp_object_util_add(o, 
E_COMP_OBJECT_TYPE_POPUP);
-        e_comp_object_util_center(comp_obj);
+
+        if (desk)
+          e_comp_object_util_center_on_zone(comp_obj, e_zone_current_get());
+        else
+          e_comp_object_util_center(comp_obj);
+        _G.split_popup.desk = desk;
         evas_object_layer_set(comp_obj, E_LAYER_POPUP);
         evas_object_pass_events_set(comp_obj, EINA_TRUE);
 
@@ -874,9 +892,12 @@ _tiling_split_type_changed_popup(void)
      }
    else
      {
+        if (desk != _G.split_popup.desk)
+          e_comp_object_util_center_on_zone(comp_obj, e_zone_current_get());
         ecore_timer_reset(_G.split_popup.timer);
      }
 
+
    _edje_tiling_icon_set(o);
 }
 

-- 


Reply via email to