summaryrefslogtreecommitdiff
path: root/gui-wm/wayfire/files/wayfire-0.11.0-r45-cube-stack-tilt.patch
blob: c56db25803128f549dc913b5396a69984debe0ca (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--- a/plugins/cube/cube.cpp
+++ b/plugins/cube/cube.cpp
@@ -1262,6 +1262,21 @@
             glm::vec3(0., 1., 0.));
 
         animation.view = zoom_translate * rotation * view;
+        if (mouse_overview_active)
+        {
+            const float pitch = animation.cube_animation.offset_y;
+            const float zoom = animation.cube_animation.zoom;
+            const float rows = output->wset()->get_workspace_grid_size().height;
+            const float center = ((rows - 1) / 2 - float(overview_row)) / zoom;
+            auto pivot = glm::translate(glm::mat4(1.0), glm::vec3(0, center, 0));
+            auto unpivot = glm::translate(glm::mat4(1.0), glm::vec3(0, -center, 0));
+            // Orbit the complete stack about its middle. Move the camera back
+            // as its height turns into depth, keeping the near faces visible.
+            const float distance = float(animation.cube_animation.offset_z) +
+                std::abs(std::sin(pitch)) * rows / (2 * zoom);
+            zoom_translate = glm::translate(glm::mat4(1.0), glm::vec3(0, 0, -distance));
+            animation.view = zoom_translate * pivot * rotation * unpivot * view;
+        }
     }
 
     glm::mat4 output_transform(const wf::render_target_t& target)
@@ -1489,10 +1504,14 @@
         double xdiff = ev->delta_x;
         double ydiff = ev->delta_y * -1.0;
 
-        // The overview stays level and on its current workspace row. Pure
-        // vertical motion must not restart animations or wake a settled cube.
-        if (mouse_overview_active && (xdiff == 0))
-        {
+        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;
         }
 
@@ -1502,13 +1521,8 @@
         if (mouse_overview_active)
         {
             overview_mix.restart_with_end(1);
-            animation.cube_animation.offset_y.set(0, 0);
-        } else
-        {
-            double current_off_y = animation.cube_animation.offset_y;
-            double off_y = wf::clamp(current_off_y + ydiff * YVelocity, -1.5, 1.5);
-            animation.cube_animation.offset_y.set(current_off_y, off_y);
-        }
+        }
+        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);
 
--- a/metadata/cube.xml
+++ b/metadata/cube.xml
@@ -69,7 +69,7 @@
 			<_short>Mouse overview</_short>
 			<option name="mouse_overview" type="bool">
 				<_short>Show all workspace rows</_short>
-				<_long>Zoom out to show all workspace rows as one rigid stack. Drag horizontally to rotate the whole stack together. Vertical mouse movement is ignored. Release to enter the selected column on the current row. Disable to show and tilt only the current row.</_long>
+				<_long>Zoom out to show all workspace rows as one rigid stack. Drag horizontally to rotate and vertically to tilt the whole stack toward its top or bottom. Release to enter the selected column on the current row. Disable to show and tilt only the current row.</_long>
 				<default>false</default>
 			</option>
 		</group>
@@ -131,7 +131,7 @@
 			<_short>Zoom speed</_short>
 			<_long>Sets the speed factor for zooming.</_long>
 			<default>0.07</default>
-			<precision>0.01</precision>
+			<precision>0.001</precision>
 		</option>
 		<option name="speed_spin_horiz" type="double">
 			<_short>Horizontal spin speed</_short>