diff options
author | Keith Packard <keithp@guitar.keithp.com> | 2006-09-21 09:52:04 -0700 |
---|---|---|
committer | Keith Packard <keithp@guitar.keithp.com> | 2006-09-21 09:52:04 -0700 |
commit | b36fde9257263fa502147df37e8331184c323e14 (patch) | |
tree | db9a69648066f7635233b489bd8a2e02e3855bcb /randr/rrcrtc.c | |
parent | 219546fd76750f358ffb6738f17b9237c58c15a6 (diff) |
When no mode is specified, don't validate mode-specific parameters.
Diffstat (limited to 'randr/rrcrtc.c')
-rw-r--r-- | randr/rrcrtc.c | 95 |
1 files changed, 49 insertions, 46 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index ebb254068..77cba29fa 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -564,64 +564,67 @@ ProcRRSetCrtcConfig (ClientPtr client) goto sendReply; } - /* - * Validate requested rotation - */ - rotation = (Rotation) stuff->rotation; - - /* test the rotation bits only! */ - switch (rotation & 0xf) { - case RR_Rotate_0: - case RR_Rotate_90: - case RR_Rotate_180: - case RR_Rotate_270: - break; - default: - /* - * Invalid rotation - */ - client->errorValue = stuff->rotation; - if (outputs) - xfree (outputs); - return BadValue; - } - - if ((~crtc->rotations) & rotation) + if (mode) { /* - * requested rotation or reflection not supported by screen + * Validate requested rotation */ - client->errorValue = stuff->rotation; - if (outputs) - xfree (outputs); - return BadMatch; - } - -#ifdef RANDR_12_INTERFACE - /* - * Check screen size bounds if the DDX provides a 1.2 interface - * for setting screen size. Else, assume the CrtcSet sets - * the size along with the mode - */ - if (pScrPriv->rrScreenSetSize) - { - if (stuff->x + mode->mode.width > pScreen->width) - { - client->errorValue = stuff->x; + rotation = (Rotation) stuff->rotation; + + /* test the rotation bits only! */ + switch (rotation & 0xf) { + case RR_Rotate_0: + case RR_Rotate_90: + case RR_Rotate_180: + case RR_Rotate_270: + break; + default: + /* + * Invalid rotation + */ + client->errorValue = stuff->rotation; if (outputs) xfree (outputs); return BadValue; } - - if (stuff->y + mode->mode.height > pScreen->height) + + if ((~crtc->rotations) & rotation) { - client->errorValue = stuff->y; + /* + * requested rotation or reflection not supported by screen + */ + client->errorValue = stuff->rotation; if (outputs) xfree (outputs); - return BadValue; + return BadMatch; + } + +#ifdef RANDR_12_INTERFACE + /* + * Check screen size bounds if the DDX provides a 1.2 interface + * for setting screen size. Else, assume the CrtcSet sets + * the size along with the mode + */ + if (pScrPriv->rrScreenSetSize) + { + if (stuff->x + mode->mode.width > pScreen->width) + { + client->errorValue = stuff->x; + if (outputs) + xfree (outputs); + return BadValue; + } + + if (stuff->y + mode->mode.height > pScreen->height) + { + client->errorValue = stuff->y; + if (outputs) + xfree (outputs); + return BadValue; + } } - } #endif + } /* * Make sure the requested set-time is not older than |