blob: 7791c2e751e14d9656ff6882c05013a5584c38fb (
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
|
--- a/plugins/single_plugins/oswitch.cpp
+++ b/plugins/single_plugins/oswitch.cpp
@@ -50,18 +50,24 @@
if (contains(zone.geometry, pointer.x, pointer.y)) current = &zone;
if (!current) return;
const wf::output_stitch_zone_t *next = nullptr;
+ const wf::output_stitch_zone_t *wrap = current;
double distance = std::numeric_limits<double>::max();
double origin = current->geometry.x + current->geometry.width / 2.0;
for (const auto& zone : layout->zones)
{
- double delta = direction * (zone.geometry.x + zone.geometry.width / 2.0 - origin);
+ double center = zone.geometry.x + zone.geometry.width / 2.0;
+ double wrap_center = wrap->geometry.x + wrap->geometry.width / 2.0;
+ if (direction * center < direction * wrap_center) wrap = &zone;
+ double delta = direction * (center - origin);
if (delta > 0 && delta < distance)
{
next = &zone;
distance = delta;
}
}
- if (!next) return;
+ // At an outer edge, continue from the opposite horizontal edge.
+ if (!next) next = wrap;
+ if (next == current) return;
auto region = next->geometry;
wayfire_toplevel_view focus = nullptr;
uint64_t newest = 0;
|