summaryrefslogtreecommitdiff
path: root/gui-wm/wayfire/files/wayfire-0.11.0-r47-cube-direct-drag.patch
blob: a094bfd243faaf6103ae860542261c49cdd4d1fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- a/plugins/cube/cube.cpp
+++ b/plugins/cube/cube.cpp
@@ -1602,37 +1602,27 @@
         double xdiff = ev->delta_x;
         double ydiff = ev->delta_y * -1.0;
 
+        // Direct manipulation follows every pointer delta immediately. The
+        // shared animation clock belongs to entry, exit and keyboard turns;
+        // restarting it here makes drag response depend on its easing curve.
         const double current_off_y = animation.cube_animation.offset_y;
-        const double target_off_y = mouse_overview_active ?
-            animation.cube_animation.offset_y.end : current_off_y;
-        const double off_y = wf::clamp(target_off_y + ydiff * YVelocity, -1.5, 1.5);
-        if (mouse_overview_active && (xdiff == 0) &&
-            (off_y == animation.cube_animation.offset_y.end))
-        {
-            // Motion beyond either tilt limit leaves a settled stack asleep.
-            return;
-        }
-
-        animation.cube_animation.zoom.restart_with_end(
-            animation.cube_animation.zoom.end);
-
-        if (mouse_overview_active)
-        {
-            overview_mix.restart_with_end(1);
-        }
-        animation.cube_animation.offset_y.set(current_off_y, off_y);
-        animation.cube_animation.offset_z.restart_with_end(
-            animation.cube_animation.offset_z.end);
-
-        float current_rotation = mouse_overview_active ? animation.cube_animation.rotation.end :
-            float(animation.cube_animation.rotation);
-        animation.cube_animation.rotation.restart_with_end(
-            current_rotation + xdiff * XVelocity);
-
-        animation.cube_animation.ease_deformation.restart_with_end(
-            animation.cube_animation.ease_deformation.end);
-
-        start_animation();
+        const double off_y = wf::clamp(current_off_y + ydiff * YVelocity, -1.5, 1.5);
+        if ((xdiff == 0) && (off_y == current_off_y))
+        {
+            // Motion beyond either tilt limit leaves a settled cube asleep.
+            return;
+        }
+
+        const double rotation = double(animation.cube_animation.rotation) + xdiff * XVelocity;
+        animation.cube_animation.rotation.set(rotation, rotation);
+        animation.cube_animation.offset_y.set(off_y, off_y);
+        update_view_matrix();
+        if (render_node)
+        {
+            // Pose changes still need damage after the entry animation has
+            // settled; scheduling a frame alone does not repaint the cube.
+            wf::scene::damage_node(render_node, render_node->get_bounding_box());
+        }
         output->render->schedule_redraw();
     }