Redefine output rotations
It was discovered in issue #99 that the implementations of the 90 and 270 degree rotations were actually the inverse of what the Wayland specification spelled out. This patch fixes the libweston implementation to follow the specification. As a result, the behaviour of the the weston.ini transform key also changes. To force all users to re-think their configuration, the transform key values are also changed. Since Weston and libweston change their behaviour, the handling of clients' buffer transform changes too. All the functions had their 90/270 cases simply swapped, probably due to confusion of whether WL_OUTPUT_TRANSFORM_* refers to rotating the monitor or the content. Hint: a key to understanding weston_matrix_rotate_xy(m, c, s) is that the rotation matrix is formed as c -s s c that is, it's column-major. This fooled me at first. Fixing window.c fixes weston-terminal and weston-transformed. In simple-damage, window_get_transformed_ball() is fixed to follow the proper transform definitions, but the fix to the viewport path in redraw() is purely mechanical. The viewport path looks broken to me in the presence of any transform, but it is not this patch's job to fix it. Screen-share fix just repeats the general code fix pattern, I did not even try to understand that bit. https://gitlab.freedesktop.org/wayland/weston/issues/99 Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
0df4477924
commit
8060d826b7
+8
-8
@@ -1107,14 +1107,14 @@ weston_choose_default_backend(void)
|
||||
}
|
||||
|
||||
static const struct { const char *name; uint32_t token; } transforms[] = {
|
||||
{ "normal", WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
{ "90", WL_OUTPUT_TRANSFORM_90 },
|
||||
{ "180", WL_OUTPUT_TRANSFORM_180 },
|
||||
{ "270", WL_OUTPUT_TRANSFORM_270 },
|
||||
{ "flipped", WL_OUTPUT_TRANSFORM_FLIPPED },
|
||||
{ "flipped-90", WL_OUTPUT_TRANSFORM_FLIPPED_90 },
|
||||
{ "flipped-180", WL_OUTPUT_TRANSFORM_FLIPPED_180 },
|
||||
{ "flipped-270", WL_OUTPUT_TRANSFORM_FLIPPED_270 },
|
||||
{ "normal", WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
{ "rotate-90", WL_OUTPUT_TRANSFORM_90 },
|
||||
{ "rotate-180", WL_OUTPUT_TRANSFORM_180 },
|
||||
{ "rotate-270", WL_OUTPUT_TRANSFORM_270 },
|
||||
{ "flipped", WL_OUTPUT_TRANSFORM_FLIPPED },
|
||||
{ "flipped-rotate-90", WL_OUTPUT_TRANSFORM_FLIPPED_90 },
|
||||
{ "flipped-rotate-180", WL_OUTPUT_TRANSFORM_FLIPPED_180 },
|
||||
{ "flipped-rotate-270", WL_OUTPUT_TRANSFORM_FLIPPED_270 },
|
||||
};
|
||||
|
||||
WL_EXPORT int
|
||||
|
||||
@@ -551,8 +551,8 @@ output_compute_transform(struct weston_output *output,
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
pixman_transform_rotate(transform, NULL, 0, pixman_fixed_1);
|
||||
pixman_transform_translate(transform, NULL, fh, 0);
|
||||
pixman_transform_rotate(transform, NULL, 0, -pixman_fixed_1);
|
||||
pixman_transform_translate(transform, NULL, 0, fw);
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
@@ -561,8 +561,8 @@ output_compute_transform(struct weston_output *output,
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
pixman_transform_rotate(transform, NULL, 0, -pixman_fixed_1);
|
||||
pixman_transform_translate(transform, NULL, 0, fw);
|
||||
pixman_transform_rotate(transform, NULL, 0, pixman_fixed_1);
|
||||
pixman_transform_translate(transform, NULL, fh, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user