e_client: floating win's moving out of margin is limited accepted/tizen/3.0/common/20170214.180242 accepted/tizen/3.0/ivi/20170213.224945 accepted/tizen/3.0/mobile/20170213.224840 accepted/tizen/3.0/tv/20170213.224903 accepted/tizen/3.0/wearable/20170213.224925 submit/tizen_3.0/20170212.133523
authorJuyeon Lee <juyeonne.lee@samsung.com>
Sun, 12 Feb 2017 13:06:02 +0000 (22:06 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Sun, 12 Feb 2017 13:36:37 +0000 (22:36 +0900)
Change-Id: Ib16633b16b9e45c972180f83aca0bef863ecbb7d

src/bin/e_client.c

index 6c291649ac2f4d5d4bc0e1b5661b562cc5ebc6f5..36f25408303900dba94463b25ca97afc8cee829a 100644 (file)
@@ -1711,6 +1711,46 @@ _e_client_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y)
      }
 }
 
+static void
+_e_client_stay_within_canvas_margin(E_Client *ec, int x, int y, int *new_x, int *new_y)
+{
+   int new_x_max, new_y_max, new_x_min, new_y_min;
+   int margin_w, margin_h;
+   int zw, zh;
+   int cw, ch;
+
+   if (!ec->zone)
+     {
+        if (new_x) *new_x = x;
+        if (new_y) *new_y = y;
+        return;
+     }
+
+   cw = ec->w;
+   ch = ec->h;
+
+   _e_client_zones_layout_calc(ec, NULL, NULL, &zw, &zh);
+
+   margin_w = zw/3;
+   margin_h = zh/10;
+
+   new_x_min = (margin_w > cw) ? 0 : -(cw - margin_w);
+   new_x_max = (margin_w > cw) ? (zw - cw) : (zw - margin_w);
+   new_y_min = (margin_h > ch) ? 0 : -(ch - margin_h);
+   new_y_max = (margin_h > ch) ? (zh - ch) : (zh - margin_h);
+
+   if (x >= new_x_max)
+     *new_x = new_x_max;
+   else if (x <= new_x_min)
+     *new_x = new_x_min;
+
+   if (y >= new_y_max)
+     *new_y = new_y_max;
+   else if (y <= new_y_min)
+     *new_y = new_y_min;
+
+}
+
 static void
 _e_client_reset_lost_window(E_Client *ec)
 {
@@ -4096,6 +4136,9 @@ e_client_mouse_move(E_Client *ec, Evas_Point *output)
         if (e_config->screen_limits == E_CLIENT_OFFSCREEN_LIMIT_ALLOW_NONE)
           _e_client_stay_within_canvas(ec, x, y, &new_x, &new_y);
 
+        if (ec->floating)
+          _e_client_stay_within_canvas_margin(ec, x, y, &new_x, &new_y);
+
         ec->shelf_fix.x = 0;
         ec->shelf_fix.y = 0;
         ec->shelf_fix.modified = 0;