diff options
author | emersion <contact@emersion.fr> | 2018-07-13 15:51:26 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-07-25 14:18:51 -0400 |
commit | ce2dde9ed0243a18ae18af0879134f7c1afbd700 (patch) | |
tree | 42e15fdce6c9cab9580a26f5f0044c21e2978730 | |
parent | 93cafb0828d2e24bd14616df1aa9883fb843dd6c (diff) |
xwayland: rotate logical size for RRMode
The logical size is the size of the output in the global compositor
space. The mode width/height should be scaled as in the logical
size, but shouldn't be transformed. Thus we need to rotate back
the logical size to be able to use it as the mode width/height.
This fixes issues with pointer input on transformed outputs.
Signed-Off-By: Simon Ser <contact@emersion.fr>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
-rw-r--r-- | hw/xwayland/xwayland-output.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 379062549..0d2ec7890 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -213,6 +213,7 @@ apply_output_change(struct xwl_output *xwl_output) { struct xwl_screen *xwl_screen = xwl_output->xwl_screen; struct xwl_output *it; + int mode_width, mode_height; int width = 0, height = 0, has_this_output = 0; RRModePtr randr_mode; Bool need_rotate; @@ -224,7 +225,16 @@ apply_output_change(struct xwl_output *xwl_output) /* xdg-output sends output size in compositor space. so already rotated */ need_rotate = (xwl_output->xdg_output == NULL); - randr_mode = xwayland_cvt(xwl_output->width, xwl_output->height, + /* We need to rotate back the logical size for the mode */ + if (need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) { + mode_width = xwl_output->width; + mode_height = xwl_output->height; + } else { + mode_width = xwl_output->height; + mode_height = xwl_output->width; + } + + randr_mode = xwayland_cvt(mode_width, mode_height, xwl_output->refresh / 1000.0, 0, 0); RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1); RRCrtcNotify(xwl_output->randr_crtc, randr_mode, |