e_client: extract _e_client_move_handle function from mouse move 23/266623/2
authorJunseok, Kim <juns.kim@samsung.com>
Tue, 16 Nov 2021 07:32:03 +0000 (16:32 +0900)
committerJunseok, Kim <juns.kim@samsung.com>
Tue, 16 Nov 2021 08:33:36 +0000 (17:33 +0900)
_e_client_move_handle is for handle interactive move of ec.

Change-Id: Ife87dc5122bbd986c3b6487b1efcfc7db9f4290f

src/bin/e_client.c

index 80e98f0e06473ac744f2342af3fcdfc47b725d05..33ee4dad57a526452e7da847b3a2e836b2f94b95 100644 (file)
@@ -74,6 +74,8 @@ static void _e_client_transient_for_group_make(E_Client *ec, Eina_List **list);
 static void _e_client_transform_core_update_with_zoom(E_Client *ec, double zoomx, double zoomy, int cx, int cy);
 static Evas_Object *_e_client_resize_object_create(E_Client *ec);
 static void _e_client_resize_object_del(E_Client *ec);
+static void _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);
 
 static Eina_Inlist *_e_client_hooks[] =
 {
@@ -1646,6 +1648,48 @@ _e_client_moveinfo_gather(E_Client *ec, const char *source)
      }
 }
 
+static void
+_e_client_move_handle(E_Client *ec)
+{
+   int x, y, new_x, new_y;
+   int new_w, new_h;
+   Eina_List *skiplist = NULL;
+
+   if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
+     {
+        x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
+           (ec->mouse.current.mx - ec->moveinfo.down.mx);
+        y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
+           (ec->mouse.current.my - ec->moveinfo.down.my);
+     }
+   else
+     {
+        x = ec->moveinfo.down.x +
+           (ec->mouse.current.mx - ec->moveinfo.down.mx);
+        y = ec->moveinfo.down.y +
+           (ec->mouse.current.my - ec->moveinfo.down.my);
+     }
+   e_comp_object_frame_xy_adjust(ec->frame, x, y, &new_x, &new_y);
+
+   skiplist = eina_list_append(skiplist, ec);
+   e_resist_client_position(skiplist,
+                            ec->x, ec->y, ec->w, ec->h,
+                            x, y, ec->w, ec->h,
+                            &new_x, &new_y, &new_w, &new_h);
+   eina_list_free(skiplist);
+
+   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;
+   evas_object_move(ec->frame, new_x, new_y);
+}
+
 static Evas_Object *
 _e_client_resize_object_create(E_Client *ec)
 {
@@ -4866,46 +4910,11 @@ e_client_mouse_move(E_Client *ec, Evas_Point *output)
    if (ec->iconic || e_client_util_ignored_get(ec)) return;
    ec->mouse.current.mx = output->x;
    ec->mouse.current.my = output->y;
-   if (ec->moving)
+   if (e_client_util_moving_get(ec))
      {
-        int x, y, new_x, new_y;
-        int new_w, new_h;
-        Eina_List *skiplist = NULL;
-
         if (action_handler_key) return;
-        if ((ec->moveinfo.down.button >= 1) && (ec->moveinfo.down.button <= 3))
-          {
-             x = ec->mouse.last_down[ec->moveinfo.down.button - 1].x +
-               (ec->mouse.current.mx - ec->moveinfo.down.mx);
-             y = ec->mouse.last_down[ec->moveinfo.down.button - 1].y +
-               (ec->mouse.current.my - ec->moveinfo.down.my);
-          }
-        else
-          {
-             x = ec->moveinfo.down.x +
-               (ec->mouse.current.mx - ec->moveinfo.down.mx);
-             y = ec->moveinfo.down.y +
-               (ec->mouse.current.my - ec->moveinfo.down.my);
-          }
-        e_comp_object_frame_xy_adjust(ec->frame, x, y, &new_x, &new_y);
-
-        skiplist = eina_list_append(skiplist, ec);
-        e_resist_client_position(skiplist,
-                                 ec->x, ec->y, ec->w, ec->h,
-                                 x, y, ec->w, ec->h,
-                                 &new_x, &new_y, &new_w, &new_h);
-        eina_list_free(skiplist);
-
-        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);
+        _e_client_move_handle(ec);
 
-        ec->shelf_fix.x = 0;
-        ec->shelf_fix.y = 0;
-        ec->shelf_fix.modified = 0;
-        evas_object_move(ec->frame, new_x, new_y);
         if (ec->zone) e_zone_flip_coords_handle(ec->zone, output->x, output->y);
      }
    else if (e_client_util_resizing_get(ec))