diff options
author | Manuel Stoeckl <code@mstoeckl.com> | 2020-02-09 09:57:40 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-02-17 21:43:05 +0100 |
commit | f22a5d17041e339b3ee7ab7975d40b353ab745c3 (patch) | |
tree | 06f515fa5e6b2263d202c43acc6a86aa1c21ed93 | |
parent | c5376c2d2c7bd4615a6b8dd9ee04f92249080f46 (diff) | |
download | wlroots-f22a5d17041e339b3ee7ab7975d40b353ab745c3.tar.xz |
Fix output rotation direction
The Wayland protocol specifies output transform rotations to be
counterclockwise and applied to the surface. Previously, wlroots
copied Weston and incorrectly made rotations act clockwise on
surfaces. This commit fixes that.
This change will break compositors which expect transform rotations
to be clockwise, and the rare applications that make use of surface
transforms.
-rw-r--r-- | types/wlr_box.c | 16 | ||||
-rw-r--r-- | types/wlr_cursor.c | 16 | ||||
-rw-r--r-- | types/wlr_matrix.c | 16 | ||||
-rw-r--r-- | util/region.c | 32 |
4 files changed, 40 insertions, 40 deletions
diff --git a/types/wlr_box.c b/types/wlr_box.c index b43252b3..769eb4fb 100644 --- a/types/wlr_box.c +++ b/types/wlr_box.c @@ -91,32 +91,32 @@ void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box, dest->y = src.y; break; case WL_OUTPUT_TRANSFORM_90: - dest->x = src.y; - dest->y = width - src.x - src.width; + dest->x = height - src.y - src.height; + dest->y = src.x; break; case WL_OUTPUT_TRANSFORM_180: dest->x = width - src.x - src.width; dest->y = height - src.y - src.height; break; case WL_OUTPUT_TRANSFORM_270: - dest->x = height - src.y - src.height; - dest->y = src.x; + dest->x = src.y; + dest->y = width - src.x - src.width; break; case WL_OUTPUT_TRANSFORM_FLIPPED: dest->x = width - src.x - src.width; dest->y = src.y; break; case WL_OUTPUT_TRANSFORM_FLIPPED_90: - dest->x = height - src.y - src.height; - dest->y = width - src.x - src.width; + dest->x = src.y; + dest->y = src.x; break; case WL_OUTPUT_TRANSFORM_FLIPPED_180: dest->x = src.x; dest->y = height - src.y - src.height; break; case WL_OUTPUT_TRANSFORM_FLIPPED_270: - dest->x = src.y; - dest->y = src.x; + dest->x = height - src.y - src.height; + dest->y = width - src.x - src.width; break; } } diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index 680e405c..c7ada3d5 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -366,32 +366,32 @@ static void apply_output_transform(double *x, double *y, dy = *y; break; case WL_OUTPUT_TRANSFORM_90: - dx = *y; - dy = width - *x; + dx = height - *y; + dy = *x; break; case WL_OUTPUT_TRANSFORM_180: dx = width - *x; dy = height - *y; break; case WL_OUTPUT_TRANSFORM_270: - dx = height - *y; - dy = *x; + dx = *y; + dy = width - *x; break; case WL_OUTPUT_TRANSFORM_FLIPPED: dx = width - *x; dy = *y; break; case WL_OUTPUT_TRANSFORM_FLIPPED_90: - dx = height - *y; - dy = width - *x; + dx = *y; + dy = *x; break; case WL_OUTPUT_TRANSFORM_FLIPPED_180: dx = *x; dy = height - *y; break; case WL_OUTPUT_TRANSFORM_FLIPPED_270: - dx = *y; - dy = *x; + dx = height - *y; + dy = width - *x; break; } *x = dx; diff --git a/types/wlr_matrix.c b/types/wlr_matrix.c index 2c896313..775b991c 100644 --- a/types/wlr_matrix.c +++ b/types/wlr_matrix.c @@ -76,8 +76,8 @@ static const float transforms[][9] = { 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_90] = { - 0.0f, -1.0f, 0.0f, - 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_180] = { @@ -86,8 +86,8 @@ static const float transforms[][9] = { 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_270] = { - 0.0f, 1.0f, 0.0f, - -1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED] = { @@ -96,8 +96,8 @@ static const float transforms[][9] = { 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED_90] = { - 0.0f, -1.0f, 0.0f, - -1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED_180] = { @@ -106,8 +106,8 @@ static const float transforms[][9] = { 0.0f, 0.0f, 1.0f, }, [WL_OUTPUT_TRANSFORM_FLIPPED_270] = { - 0.0f, 1.0f, 0.0f, - 1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }, }; diff --git a/util/region.c b/util/region.c index a652dbf8..bfec4ed4 100644 --- a/util/region.c +++ b/util/region.c @@ -56,10 +56,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = src_rects[i].y2; break; case WL_OUTPUT_TRANSFORM_90: - dst_rects[i].x1 = src_rects[i].y1; - dst_rects[i].y1 = width - src_rects[i].x2; - dst_rects[i].x2 = src_rects[i].y2; - dst_rects[i].y2 = width - src_rects[i].x1; + dst_rects[i].x1 = height - src_rects[i].y2; + dst_rects[i].y1 = src_rects[i].x1; + dst_rects[i].x2 = height - src_rects[i].y1; + dst_rects[i].y2 = src_rects[i].x2; break; case WL_OUTPUT_TRANSFORM_180: dst_rects[i].x1 = width - src_rects[i].x2; @@ -68,10 +68,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = height - src_rects[i].y1; break; case WL_OUTPUT_TRANSFORM_270: - dst_rects[i].x1 = height - src_rects[i].y2; - dst_rects[i].y1 = src_rects[i].x1; - dst_rects[i].x2 = height - src_rects[i].y1; - dst_rects[i].y2 = src_rects[i].x2; + dst_rects[i].x1 = src_rects[i].y1; + dst_rects[i].y1 = width - src_rects[i].x2; + dst_rects[i].x2 = src_rects[i].y2; + dst_rects[i].y2 = width - src_rects[i].x1; break; case WL_OUTPUT_TRANSFORM_FLIPPED: dst_rects[i].x1 = width - src_rects[i].x2; @@ -80,10 +80,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = src_rects[i].y2; break; case WL_OUTPUT_TRANSFORM_FLIPPED_90: - dst_rects[i].x1 = height - src_rects[i].y2; - dst_rects[i].y1 = width - src_rects[i].x2; - dst_rects[i].x2 = height - src_rects[i].y1; - dst_rects[i].y2 = width - src_rects[i].x1; + dst_rects[i].x1 = src_rects[i].y1; + dst_rects[i].y1 = src_rects[i].x1; + dst_rects[i].x2 = src_rects[i].y2; + dst_rects[i].y2 = src_rects[i].x2; break; case WL_OUTPUT_TRANSFORM_FLIPPED_180: dst_rects[i].x1 = src_rects[i].x1; @@ -92,10 +92,10 @@ void wlr_region_transform(pixman_region32_t *dst, pixman_region32_t *src, dst_rects[i].y2 = height - src_rects[i].y1; break; case WL_OUTPUT_TRANSFORM_FLIPPED_270: - dst_rects[i].x1 = src_rects[i].y1; - dst_rects[i].y1 = src_rects[i].x1; - dst_rects[i].x2 = src_rects[i].y2; - dst_rects[i].y2 = src_rects[i].x2; + dst_rects[i].x1 = height - src_rects[i].y2; + dst_rects[i].y1 = width - src_rects[i].x2; + dst_rects[i].x2 = height - src_rects[i].y1; + dst_rects[i].y2 = width - src_rects[i].x1; break; } } |