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;
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