randr: check the screen size bounds against the master
The master contains the complete screen size bounds, so check the width/height against it. Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
26d848cb91
commit
c5cc2a8243
|
@ -1125,6 +1125,16 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
||||||
int source_height;
|
int source_height;
|
||||||
PictTransform transform;
|
PictTransform transform;
|
||||||
struct pixman_f_transform f_transform, f_inverse;
|
struct pixman_f_transform f_transform, f_inverse;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
|
if (pScreen->isGPU) {
|
||||||
|
width = pScreen->current_master->width;
|
||||||
|
height = pScreen->current_master->height;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
width = pScreen->width;
|
||||||
|
height = pScreen->height;
|
||||||
|
}
|
||||||
|
|
||||||
RRTransformCompute(stuff->x, stuff->y,
|
RRTransformCompute(stuff->x, stuff->y,
|
||||||
mode->mode.width, mode->mode.height,
|
mode->mode.width, mode->mode.height,
|
||||||
|
@ -1134,13 +1144,13 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
||||||
|
|
||||||
RRModeGetScanoutSize(mode, &transform, &source_width,
|
RRModeGetScanoutSize(mode, &transform, &source_width,
|
||||||
&source_height);
|
&source_height);
|
||||||
if (stuff->x + source_width > pScreen->width) {
|
if (stuff->x + source_width > width) {
|
||||||
client->errorValue = stuff->x;
|
client->errorValue = stuff->x;
|
||||||
free(outputs);
|
free(outputs);
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stuff->y + source_height > pScreen->height) {
|
if (stuff->y + source_height > height) {
|
||||||
client->errorValue = stuff->y;
|
client->errorValue = stuff->y;
|
||||||
free(outputs);
|
free(outputs);
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
Loading…
Reference in New Issue