summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-01-24 13:31:49 +0100
committerJonas Ã…dahl <jadahl@gmail.com>2023-02-01 09:33:40 +0100
commit45d83b49a8090e882939beea5d70aa89b5c73d38 (patch)
tree7f8f3b1782282dba329d1dd93546633b6b1ba173
parent3c197879b52bbdc6ca54c3ef8ff7590cee11002e (diff)
downloadmutter-45d83b49a8090e882939beea5d70aa89b5c73d38.tar.gz
backends/native: Minor refactor
Refactor code so that variables don't depend the on motion line content, but the other way around. This makes it clearer what each vector means. This has no functional changes. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2803> (cherry picked from commit 34a9141a6c975e26b12ba5d5c6739b3d9df6a2e4)
-rw-r--r--src/backends/native/meta-seat-impl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c
index 23865c905..cec2060f7 100644
--- a/src/backends/native/meta-seat-impl.c
+++ b/src/backends/native/meta-seat-impl.c
@@ -1169,9 +1169,12 @@ relative_motion_across_outputs (MetaViewportInfo *viewports,
meta_viewport_info_get_view_info (viewports, cur_view, &rect, &scale);
+ target_x = x + (dx * scale);
+ target_y = y + (dy * scale);
+
motion = (MetaLine2) {
.a = { x, y },
- .b = { x + (dx * scale), y + (dy * scale) }
+ .b = { target_x, target_y }
};
left = (MetaLine2) {
{ rect.x, rect.y },
@@ -1190,9 +1193,6 @@ relative_motion_across_outputs (MetaViewportInfo *viewports,
{ rect.x + rect.width, rect.y + rect.height }
};
- target_x = motion.b.x;
- target_y = motion.b.y;
-
if (direction != META_DISPLAY_RIGHT &&
meta_line2_intersects_with (&motion, &left, &intersection))
direction = META_DISPLAY_LEFT;
@@ -1209,10 +1209,10 @@ relative_motion_across_outputs (MetaViewportInfo *viewports,
/* We reached the dest logical monitor */
break;
+ dx -= intersection.x - x;
+ dy -= intersection.y - y;
x = intersection.x;
y = intersection.y;
- dx -= intersection.x - motion.a.x;
- dy -= intersection.y - motion.a.y;
cur_view = meta_viewport_info_get_neighbor (viewports, cur_view,
direction);