From 34a9141a6c975e26b12ba5d5c6739b3d9df6a2e4 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 24 Jan 2023 13:31:49 +0100 Subject: [PATCH] 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: --- src/backends/native/meta-seat-impl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index 9940c707c..9549f080e 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);