e_client: set the position of frame before setting zone to ec 50/295550/2
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 10 Jul 2023 23:37:56 +0000 (08:37 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 11 Jul 2023 00:28:57 +0000 (00:28 +0000)
Set the position of ec->frame before setting ec->zone.

Change-Id: I3997439a8c427cd64b41a49ac4c7359c7af9ee51

src/bin/e_client.c
src/bin/e_zone.c

index 102aee1..9726041 100644 (file)
@@ -4974,6 +4974,32 @@ e_client_zone_set(E_Client *ec, E_Zone *zone)
    ev = E_NEW(E_Event_Client_Zone_Set, 1);
    if (!ev) return;
 
+   /* if the window does not lie in the new zone, move it so that it does */
+   if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
+     {
+        int x, y;
+
+        x = ec->x, y = ec->y;
+
+        /* keep window from hanging off bottom and left */
+        if (x + ec->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + ec->w);
+        if (y + ec->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + ec->h);
+
+        /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
+        if (x < zone->x) x = zone->x;
+        if (y < zone->y) y = zone->y;
+
+        if (!E_INTERSECTS(x, y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
+          {
+             /* still not in zone at all, so just move it to closest edge */
+             if (x < zone->x) x = zone->x;
+             if (x >= zone->x + zone->w) x = zone->x + zone->w - ec->w;
+             if (y < zone->y) y = zone->y;
+             if (y >= zone->y + zone->h) y = zone->y + zone->h - ec->h;
+          }
+        evas_object_move(ec->frame, x, y);
+     }
+
    ec->zone = zone;
 
    ev->ec = ec;
index e33b610..f3ff178 100644 (file)
@@ -1295,32 +1295,6 @@ e_zone_screen_splitscreen_enable(E_Zone *zone)
 EINTERN void
 e_zone_client_add(E_Zone *zone, E_Client *ec)
 {
-   /* if the window does not lie in the new zone, move it so that it does */
-   if (!E_INTERSECTS(ec->x, ec->y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
-     {
-        int x, y;
-
-        x = ec->x, y = ec->y;
-
-        /* keep window from hanging off bottom and left */
-        if (x + ec->w > zone->x + zone->w) x += (zone->x + zone->w) - (x + ec->w);
-        if (y + ec->h > zone->y + zone->h) y += (zone->y + zone->h) - (y + ec->h);
-
-        /* make sure to and left are on screen (if the window is larger than the zone, it will hang off the bottom / right) */
-        if (x < zone->x) x = zone->x;
-        if (y < zone->y) y = zone->y;
-
-        if (!E_INTERSECTS(x, y, ec->w, ec->h, zone->x, zone->y, zone->w, zone->h))
-          {
-             /* still not in zone at all, so just move it to closest edge */
-             if (x < zone->x) x = zone->x;
-             if (x >= zone->x + zone->w) x = zone->x + zone->w - ec->w;
-             if (y < zone->y) y = zone->y;
-             if (y >= zone->y + zone->h) y = zone->y + zone->h - ec->h;
-          }
-        evas_object_move(ec->frame, x, y);
-     }
-
    // FIXME: 1. To put the ec at current desk is the current wm policy.
    //        This should be changed by wm policy.
    //        2. This code should be removed because e_client_zone_set() is called