xwayland: Introduce output scale
Add a scale factor to the Xwayland output and take the scale into account when computing the screen size. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-By: Kenny Levinsen <kl@kl.wtf> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1197>
This commit is contained in:
parent
8c54f90673
commit
6a09cd2d20
|
@ -891,6 +891,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id,
|
||||||
|
|
||||||
xwl_output->server_output_id = id;
|
xwl_output->server_output_id = id;
|
||||||
wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
|
wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
|
||||||
|
xwl_output->xscale = 1.0;
|
||||||
|
|
||||||
xwl_output->xwl_screen = xwl_screen;
|
xwl_output->xwl_screen = xwl_screen;
|
||||||
|
|
||||||
|
@ -1141,6 +1142,12 @@ mode_sort(const void *left, const void *right)
|
||||||
return (*mode_b)->mode.width - (*mode_a)->mode.width;
|
return (*mode_b)->mode.width - (*mode_a)->mode.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xwl_output_set_xscale(struct xwl_output *xwl_output, double xscale)
|
||||||
|
{
|
||||||
|
xwl_output->xscale = xscale;
|
||||||
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
|
xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
|
||||||
int current_width, int current_height)
|
int current_width, int current_height)
|
||||||
|
@ -1198,7 +1205,9 @@ xwl_output_set_mode_fixed(struct xwl_output *xwl_output, RRModePtr mode)
|
||||||
xwl_output->mode_width = mode->mode.width;
|
xwl_output->mode_width = mode->mode.width;
|
||||||
xwl_output->mode_height = mode->mode.height;
|
xwl_output->mode_height = mode->mode.height;
|
||||||
|
|
||||||
update_screen_size(xwl_screen, mode->mode.width, mode->mode.height);
|
update_screen_size(xwl_screen,
|
||||||
|
round((double) mode->mode.width * xwl_output->xscale),
|
||||||
|
round((double) mode->mode.height * xwl_output->xscale));
|
||||||
|
|
||||||
RRCrtcNotify(xwl_output->randr_crtc, mode, 0, 0, RR_Rotate_0,
|
RRCrtcNotify(xwl_output->randr_crtc, mode, 0, 0, RR_Rotate_0,
|
||||||
NULL, 1, &xwl_output->randr_output);
|
NULL, 1, &xwl_output->randr_output);
|
||||||
|
@ -1275,6 +1284,7 @@ xwl_screen_init_randr_fixed(struct xwl_screen *xwl_screen)
|
||||||
|
|
||||||
xwl_output->xwl_screen = xwl_screen;
|
xwl_output->xwl_screen = xwl_screen;
|
||||||
xwl_screen->fixed_output = xwl_output;
|
xwl_screen->fixed_output = xwl_output;
|
||||||
|
xwl_output->xscale = 1.0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct xwl_output {
|
||||||
uint32_t server_output_id;
|
uint32_t server_output_id;
|
||||||
int32_t x, y, width, height, refresh;
|
int32_t x, y, width, height, refresh;
|
||||||
int32_t mode_width, mode_height;
|
int32_t mode_width, mode_height;
|
||||||
|
double xscale; /* Effective scale, can be fractional */
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
Bool wl_output_done;
|
Bool wl_output_done;
|
||||||
Bool xdg_output_done;
|
Bool xdg_output_done;
|
||||||
|
@ -78,6 +79,9 @@ Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
|
||||||
|
|
||||||
Bool xwl_screen_init_randr_fixed(struct xwl_screen *xwl_screen);
|
Bool xwl_screen_init_randr_fixed(struct xwl_screen *xwl_screen);
|
||||||
|
|
||||||
|
void
|
||||||
|
xwl_output_set_xscale(struct xwl_output *xwl_output, double xscale);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
|
xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
|
||||||
int current_width, int current_height);
|
int current_width, int current_height);
|
||||||
|
|
Loading…
Reference in New Issue