billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=7eba4c97e01554053e70ef5e58d68281f9c0ccf3

commit 7eba4c97e01554053e70ef5e58d68281f9c0ccf3
Author: Boris Faure <[email protected]>
Date:   Wed Mar 25 22:13:43 2020 +0100

    drag: add animation when dragging tab over other tabs
---
 ChangeLog.theme                    |  7 ++++--
 THEME.md                           |  4 +++-
 data/themes/default/background.edc | 42 +++++++++++++++++++++++++++++++++-
 src/bin/term_container.h           |  1 +
 src/bin/win.c                      | 46 ++++++++++++++++++++++++--------------
 5 files changed, 79 insertions(+), 21 deletions(-)

diff --git a/ChangeLog.theme b/ChangeLog.theme
index b64d79b..4a9816f 100644
--- a/ChangeLog.theme
+++ b/ChangeLog.theme
@@ -22,8 +22,11 @@ Changes since 1.6.0:
   "drag_right_outline", "drag_top_outline", "drag_bottom_outline" are used to
   know when the cursor enters them when dragging a tab into them.
   * In group "terminology/background", signals "drag_left,on", "drag_left,off"
-  are received when the mouse enters or leaves "drag_left_outline". Same for
-  right, top, bottom.
+  are received when the mouse, while dragging a tab, enters or leaves
+  "drag_left_outline". Same for right, top, bottom.
+  * In group "terminology/background", signals "drag_over_tabs,on",
+  "drag_over_tabs,off" are received when the mouse, while dragging a tab,
+  enters the tab region.
 
 Changes since 1.5.0:
 --------------------
diff --git a/THEME.md b/THEME.md
index 94650ee..978b297 100644
--- a/THEME.md
+++ b/THEME.md
@@ -61,7 +61,7 @@ Here is swallowed an object of group `terminology.background`.
 ### `tabdrag` and `tabmiddle`
 Their geometry are used to adjust drag values.
 
-### `drag_left_outline`, `drag_right_outline`, `drag_top_outline`, 
`drag_bottom_outline`
+### `drag_left_outline`, `drag_right_outline`, `drag_top_outline`, 
`drag_bottom_outline` and `terminology.tabregion`
 Their geometry are used to know when the cursor enters them when dragging a
 tab.
 
@@ -75,6 +75,8 @@ When to start an animation when the cursor enters 
`drag_XXXX_outline` while
 dragging a tab.
 ### `drag_left,off`, `drag_right,off`, `drag_top,off`, `drag_bottom,off`
 When to stop an animation started by the related `*,on` signals.
+### `drag_over_tabs,on` and `drag_over_tabs,off`
+When the mouse, while dragging a tab, enters or leaves the tab region.
 
 ### TODO
 
diff --git a/data/themes/default/background.edc 
b/data/themes/default/background.edc
index 176ae08..8ae2714 100644
--- a/data/themes/default/background.edc
+++ b/data/themes/default/background.edc
@@ -1368,6 +1368,46 @@ group { name: "terminology/background";
          description { state: "hdrag,off" 0.0;
             inherit: "default" 0.0;
          }
+         description { state: "drag_over" 0.0;
+            inherit: "default" 0.0;
+            rel1.relative: 0.3 0.0;
+            rel2.to_x: "terminology.tabregion";
+            rel2.relative: 0.7 0.0;
+         }
+      }
+      program {
+         name: "drag_over_tabs,on";
+         signal: "drag_over_tabs,on"; source: "terminology";
+         action: STATE_SET "drag_over" 0.0;
+         target: "tabdrag";
+         after: "drag_over_tabs,pulse";
+      }
+      program {
+         name: "drag_over_tabs,pulse";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "tabdrag";
+         after: "drag_over_tabs,pulse2";
+      }
+      program {
+         name: "drag_over_tabs,pulse2";
+         transition: ACCELERATE 0.5;
+         action: STATE_SET "drag_over" 0.0;
+         target: "tabdrag";
+         after: "drag_over_tabs,pulse";
+      }
+      program {
+         signal: "drag_over_tabs,off"; source: "terminology";
+         action: ACTION_STOP;
+         target: "drag_over_tabs,on";
+         target: "drag_over_tabs,pulse";
+         target: "drag_over_tabs,pulse2";
+         after: "drag_over_tabs,off2";
+      }
+      program {
+         name: "drag_over_tabs,off2";
+         action: STATE_SET "default" 0.0;
+         target: "tabdrag";
       }
       program {
          signal: "hdrag,on"; source: "terminology";
@@ -1419,7 +1459,7 @@ group { name: "terminology/background";
          dragable.confine: "tabdrag";
          description { state: "default" 0.0;
             rel2.relative: 0.0 0.0;
-            rel2.to_x: "terminology.tab_btn";
+            rel2.to_x: "tabdrag";
             max: 1 1;
             fixed: 1 1;
          }
diff --git a/src/bin/term_container.h b/src/bin/term_container.h
index b3e8209..d6218d7 100644
--- a/src/bin/term_container.h
+++ b/src/bin/term_container.h
@@ -33,6 +33,7 @@ typedef enum _Split_Direction {
      SPLIT_DIRECTION_RIGHT,
      SPLIT_DIRECTION_TOP,
      SPLIT_DIRECTION_BOTTOM,
+     SPLIT_DIRECTION_TABS,
 } Split_Direction;
 
 struct _Term_Container {
diff --git a/src/bin/win.c b/src/bin/win.c
index ed1a9d9..fc14b28 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -3256,6 +3256,10 @@ _tab_drag_disable_anim_over(void)
          elm_layout_signal_emit(_tab_drag->term_over->bg,
                                 "drag_bottom,off", "terminology");
          break;
+      case SPLIT_DIRECTION_TABS:
+         elm_layout_signal_emit(_tab_drag->term_over->bg,
+                                "drag_over_tabs,off", "terminology");
+         break;
       default:
          break;
      }
@@ -3794,7 +3798,7 @@ _tab_drag_reinsert(Term *term, double mid)
 }
 
 static void
-_tab_reorg(Term *term, Term *to_term, Evas_Coord mx, Evas_Coord my)
+_tab_reorg(Term *term, Term *to_term, Evas_Coord mx)
 {
    Term_Container *tc_orig = term->container;
    Term_Container *to_tc = to_term->container;
@@ -3802,19 +3806,13 @@ _tab_reorg(Term *term, Term *to_term, Evas_Coord mx, 
Evas_Coord my)
    assert(tc_orig->type == TERM_CONTAINER_TYPE_SOLO);
    assert(to_tc->type == TERM_CONTAINER_TYPE_SOLO);
 
-   if (_tab_drag->split_direction == SPLIT_DIRECTION_NONE)
+   if (_tab_drag->split_direction == SPLIT_DIRECTION_TABS)
      {
-        Evas_Coord x = 0, y = 0, w = 0, h = 0, off_x = 0, off_y = 0;
+        Evas_Coord x = 0, w = 0;
         double mid;
 
-        /* check whether there is a need to add a tab or fail the drag */
-        evas_object_geometry_get(term->bg_edj, &off_x, &off_y, NULL, NULL);
-        edje_object_part_geometry_get(term->bg_edj, "tabdrag",
+        edje_object_part_geometry_get(term->bg_edj, "terminology.tabregion",
                                       &x, NULL, &w, NULL);
-        edje_object_part_geometry_get(term->bg_edj, "tabmiddle",
-                                      NULL, &y, NULL, &h);
-        if (!ELM_RECTS_INTERSECT(x,y,w,h, mx,my,1,1))
-          return;
 
         mid = (double)(mx - x) / (double)w;
 
@@ -3864,10 +3862,8 @@ _tab_drag_stop(void)
 
         /* Reinsert in same set of Tabs or same "tab" (could be a split) */
         evas_object_geometry_get(term->bg_edj, &off_x, &off_y, NULL, NULL);
-        edje_object_part_geometry_get(term->bg_edj, "tabdrag",
-                                      &x, NULL, &w, NULL);
-        edje_object_part_geometry_get(term->bg_edj, "tabmiddle",
-                                      NULL, &y, NULL, &h);
+        edje_object_part_geometry_get(term->bg_edj, "terminology.tabregion",
+                                      &x, &y, &w, &h);
         if (!ELM_RECTS_INTERSECT(x,y,w,h, mx,my,1,1))
           goto end;
 
@@ -3875,10 +3871,10 @@ _tab_drag_stop(void)
         _tab_drag_reparented();
         _tab_drag_reinsert(term, mid);
      }
-   else
+   else if (_tab_drag->split_direction != SPLIT_DIRECTION_NONE)
      {
         /* Move to different set of Tabs */
-        _tab_reorg(term, term_at_coords, mx, my);
+        _tab_reorg(term, term_at_coords, mx);
      }
 
 end:
@@ -3946,6 +3942,15 @@ _tabs_drag_mouse_move(
    if (!term_at_coords)
      return;
    evas_object_geometry_get(term_at_coords->bg_edj, &off_x, &off_y, NULL, 
NULL);
+
+   edje_object_part_geometry_get(term_at_coords->bg_edj, 
"terminology.tabregion",
+                                 &x, &y, &w, &h);
+   if (ELM_RECTS_INTERSECT(x+off_x, y+off_y, w, h, mx, my, 1, 1))
+     {
+        split_direction = SPLIT_DIRECTION_TABS;
+        goto found;
+     }
+
    edje_object_part_geometry_get(term_at_coords->bg_edj, "drag_left_outline",
                                  &x, &y, &w, &h);
    if (ELM_RECTS_INTERSECT(x+off_x, y+off_y, w, h, mx, my, 1, 1))
@@ -3953,6 +3958,7 @@ _tabs_drag_mouse_move(
         split_direction = SPLIT_DIRECTION_LEFT;
         goto found;
      }
+
    edje_object_part_geometry_get(term_at_coords->bg_edj, "drag_right_outline",
                                  &x, &y, &w, &h);
    if (ELM_RECTS_INTERSECT(x+off_x, y+off_y, w, h, mx, my, 1, 1))
@@ -3960,6 +3966,7 @@ _tabs_drag_mouse_move(
         split_direction = SPLIT_DIRECTION_RIGHT;
         goto found;
      }
+
    edje_object_part_geometry_get(term_at_coords->bg_edj, "drag_top_outline",
                                  &x, &y, &w, &h);
    if (ELM_RECTS_INTERSECT(x+off_x, y+off_y, w, h, mx, my, 1, 1))
@@ -3967,6 +3974,7 @@ _tabs_drag_mouse_move(
         split_direction = SPLIT_DIRECTION_TOP;
         goto found;
      }
+
    edje_object_part_geometry_get(term_at_coords->bg_edj, "drag_bottom_outline",
                                  &x, &y, &w, &h);
    if (ELM_RECTS_INTERSECT(x+off_x, y+off_y, w, h, mx, my, 1, 1))
@@ -3974,7 +3982,8 @@ _tabs_drag_mouse_move(
         split_direction = SPLIT_DIRECTION_BOTTOM;
         goto found;
      }
-   found:
+
+found:
    if ((_tab_drag->term_over != NULL) &&
        ((_tab_drag->term_over != term_at_coords) ||
         (_tab_drag->split_direction != split_direction)))
@@ -4003,6 +4012,9 @@ _tabs_drag_mouse_move(
               elm_layout_signal_emit(term_at_coords->bg,
                                      "drag_bottom,on", "terminology");
               break;
+           case SPLIT_DIRECTION_TABS:
+              elm_layout_signal_emit(term_at_coords->bg,
+                                     "drag_over_tabs,on", "terminology");
            default:
               break;
           }

-- 


Reply via email to