discomfitor pushed a commit to branch enlightenment-0.20.

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

commit 5cd256da782d0d3b31b557c3b6caa476ee09ea4a
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Tue May 10 12:11:43 2016 -0400

    ensure child windows are placed on screen
    
    when centering a child over its parent, checks were not made to ensure that
    by centering the child it had not gone offscreen
---
 src/bin/e_client.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/bin/e_client.c b/src/bin/e_client.c
index 6748a06..b105854 100644
--- a/src/bin/e_client.c
+++ b/src/bin/e_client.c
@@ -1758,6 +1758,7 @@ _e_client_eval(E_Client *ec)
           {
              if (ec->parent)
                {
+                  Eina_Bool centered = EINA_FALSE;
                   if (ec->parent->zone != e_zone_current_get())
                     {
                        e_client_zone_set(ec, ec->parent->zone);
@@ -1784,6 +1785,7 @@ _e_client_eval(E_Client *ec)
                                    {
                                       e_comp_object_util_center_on(ec->frame,
                                                                    
ec->parent->frame);
+                                      centered = 1;
                                    }
                               }
                             ec->changes.pos = 1;
@@ -1793,7 +1795,22 @@ _e_client_eval(E_Client *ec)
                     {
                        e_comp_object_util_center_on(ec->frame,
                                                     ec->parent->frame);
-                       ec->changes.pos = 1;
+                       centered = 1;
+                    }
+                  if (centered) //test for offscreen
+                    {
+                       if (!E_CONTAINS(ec->x, ec->y, ec->w, ec->h, zx, zy, zw, 
zh))
+                         {
+                            if (ec->x < zx)
+                              ec->x = ec->parent->x;
+                            if (ec->y < zy)
+                              ec->y = ec->parent->y;
+                            if (ec->x + ec->w > zx + zw)
+                              ec->x = ec->parent->x + ec->parent->w - ec->w;
+                            if (ec->y + ec->h > zy + zh)
+                              ec->y = ec->parent->y + ec->parent->h - ec->h;
+                            ec->changes.pos = 1;
+                         }
                     }
                   ec->placed = 1;
                   ec->pre_cb.x = ec->x; ec->pre_cb.y = ec->y;

-- 


Reply via email to