aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/randr
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-07-03 17:07:30 +0200
committerMihai Moldovan <ionic@ionic.de>2015-07-03 17:07:30 +0200
commitca19c342ca6f829894fb0cdd652bd2731029084b (patch)
treee2c3bc4d3d91cd04767461d21dc6261cf20ce4f5 /nx-X11/programs/Xserver/randr
parent61013ec4fd85e9f8eef1f34bf6d1855ba26211d7 (diff)
parentd088698324d5e71cb93ccd429f084729ba07872c (diff)
downloadnx-libs-ca19c342ca6f829894fb0cdd652bd2731029084b.tar.gz
nx-libs-ca19c342ca6f829894fb0cdd652bd2731029084b.tar.bz2
nx-libs-ca19c342ca6f829894fb0cdd652bd2731029084b.zip
Merge branch 'uli42-pr/backported_fixes' into arctica-3.6.x
Attributes GH PR #50: https://github.com/ArcticaProject/nx-libs/pull/50
Diffstat (limited to 'nx-X11/programs/Xserver/randr')
-rw-r--r--nx-X11/programs/Xserver/randr/randr.c2
-rw-r--r--nx-X11/programs/Xserver/randr/rrcrtc.c23
-rw-r--r--nx-X11/programs/Xserver/randr/rrinfo.c7
-rw-r--r--nx-X11/programs/Xserver/randr/rrmode.c13
-rw-r--r--nx-X11/programs/Xserver/randr/rroutput.c1
-rw-r--r--nx-X11/programs/Xserver/randr/rrscreen.c27
-rw-r--r--nx-X11/programs/Xserver/randr/rrxinerama.c3
7 files changed, 35 insertions, 41 deletions
diff --git a/nx-X11/programs/Xserver/randr/randr.c b/nx-X11/programs/Xserver/randr/randr.c
index 81df406a6..f565617e6 100644
--- a/nx-X11/programs/Xserver/randr/randr.c
+++ b/nx-X11/programs/Xserver/randr/randr.c
@@ -125,6 +125,8 @@ RRCloseScreen (int i, ScreenPtr pScreen)
for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
RROutputDestroy (pScrPriv->outputs[j]);
+ xfree (pScrPriv->crtcs);
+ xfree (pScrPriv->outputs);
xfree (pScrPriv);
RRNScreens -= 1; /* ok, one fewer screen with RandR running */
return (*pScreen->CloseScreen) (i, pScreen);
diff --git a/nx-X11/programs/Xserver/randr/rrcrtc.c b/nx-X11/programs/Xserver/randr/rrcrtc.c
index fb82a80df..bc1040c9f 100644
--- a/nx-X11/programs/Xserver/randr/rrcrtc.c
+++ b/nx-X11/programs/Xserver/randr/rrcrtc.c
@@ -642,7 +642,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
int numOutputs;
RROutputPtr *outputs = NULL;
RROutput *outputIds;
- TimeStamp configTime;
TimeStamp time;
Rotation rotation;
int i, j;
@@ -745,7 +744,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen);
time = ClientTimeToServerTime(stuff->timestamp);
- configTime = ClientTimeToServerTime(stuff->configTimestamp);
if (!pScrPriv)
{
@@ -754,19 +752,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
goto sendReply;
}
-#if 0
- /*
- * if the client's config timestamp is not the same as the last config
- * timestamp, then the config information isn't up-to-date and
- * can't even be validated
- */
- if (CompareTimeStamps (configTime, pScrPriv->lastConfigTime) != 0)
- {
- rep.status = RRSetConfigInvalidConfigTime;
- goto sendReply;
- }
-#endif
-
/*
* Validate requested rotation
*/
@@ -853,10 +838,8 @@ ProcRRSetCrtcConfig (ClientPtr client)
rep.status = RRSetConfigFailed;
goto sendReply;
}
- #ifdef NXAGENT_SERVER /* Bug 21987 */
- pScrPriv->lastSetTime = time;
- #endif
rep.status = RRSetConfigSuccess;
+ pScrPriv->lastSetTime = time;
sendReply:
if (outputs)
@@ -866,11 +849,7 @@ sendReply:
/* rep.status has already been filled in */
rep.length = 0;
rep.sequenceNumber = client->sequence;
- #ifndef NXAGENT_SERVER /* Bug 21987 */
- rep.newTimestamp = pScrPriv->lastConfigTime.milliseconds;
- #else
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
- #endif
if (client->swapped)
{
diff --git a/nx-X11/programs/Xserver/randr/rrinfo.c b/nx-X11/programs/Xserver/randr/rrinfo.c
index 7e77d393d..470e1bbf3 100644
--- a/nx-X11/programs/Xserver/randr/rrinfo.c
+++ b/nx-X11/programs/Xserver/randr/rrinfo.c
@@ -83,6 +83,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
int i;
CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
CARD16 maxWidth = 0, maxHeight = 0;
+ CARD16 width, height;
/*
* First time through, create a crtc and output and hook
@@ -153,11 +154,11 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
/* find size bounds */
for (i = 0; i < output->numModes + output->numUserModes; i++)
{
- RRModePtr mode = (i < output->numModes ?
+ mode = (i < output->numModes ?
output->modes[i] :
output->userModes[i-output->numModes]);
- CARD16 width = mode->mode.width;
- CARD16 height = mode->mode.height;
+ width = mode->mode.width;
+ height = mode->mode.height;
if (width < minWidth) minWidth = width;
if (width > maxWidth) maxWidth = width;
diff --git a/nx-X11/programs/Xserver/randr/rrmode.c b/nx-X11/programs/Xserver/randr/rrmode.c
index 62c01485a..db0af33b8 100644
--- a/nx-X11/programs/Xserver/randr/rrmode.c
+++ b/nx-X11/programs/Xserver/randr/rrmode.c
@@ -98,8 +98,10 @@ RRModeCreate (xRRModeInfo *modeInfo,
}
mode->mode.id = FakeClientID(0);
- if (!AddResource (mode->mode.id, RRModeType, (pointer) mode))
- return NULL;
+ if (!AddResource(mode->mode.id, RRModeType, (pointer) mode)) {
+ free(newModes);
+ return NULL;
+ }
modes = newModes;
modes[num_modes++] = mode;
@@ -192,7 +194,7 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
for (o = 0; o < pScrPriv->numOutputs; o++)
{
RROutputPtr output = pScrPriv->outputs[o];
- int m, n;
+ int n;
for (m = 0; m < output->numModes + output->numUserModes; m++)
{
@@ -297,7 +299,6 @@ ProcRRCreateMode (ClientPtr client)
xRRCreateModeReply rep;
WindowPtr pWin;
ScreenPtr pScreen;
- rrScrPrivPtr pScrPriv;
xRRModeInfo *modeInfo;
long units_after;
char *name;
@@ -315,7 +316,6 @@ ProcRRCreateMode (ClientPtr client)
return rc;
pScreen = pWin->drawable.pScreen;
- pScrPriv = rrGetScrPriv(pScreen);
modeInfo = &stuff->modeInfo;
name = (char *) (stuff + 1);
@@ -342,7 +342,8 @@ ProcRRCreateMode (ClientPtr client)
swapl(&rep.mode, n);
}
WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
-
+ /* Drop out reference to this mode */
+ RRModeDestroy (mode);
return client->noClientException;
}
diff --git a/nx-X11/programs/Xserver/randr/rroutput.c b/nx-X11/programs/Xserver/randr/rroutput.c
index 1ecde31a2..693f5a5d3 100644
--- a/nx-X11/programs/Xserver/randr/rroutput.c
+++ b/nx-X11/programs/Xserver/randr/rroutput.c
@@ -456,6 +456,7 @@ ProcRRGetOutputInfo (ClientPtr client)
pScrPriv = rrGetScrPriv(pScreen);
rep.type = X_Reply;
+ rep.status = RRSetConfigSuccess;
rep.sequenceNumber = client->sequence;
rep.length = OutputInfoExtra >> 2;
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
diff --git a/nx-X11/programs/Xserver/randr/rrscreen.c b/nx-X11/programs/Xserver/randr/rrscreen.c
index 9b3935e03..a3851bd60 100644
--- a/nx-X11/programs/Xserver/randr/rrscreen.c
+++ b/nx-X11/programs/Xserver/randr/rrscreen.c
@@ -228,7 +228,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
rrScrPrivPtr pScrPriv;
int rc;
- REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
+ REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
#ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
#else
@@ -677,8 +677,9 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.sizeID = pData->size;
rep.rate = pData->refresh;
- extraLen = (rep.nSizes * sizeof (xScreenSizes) +
- rep.nrateEnts * sizeof (CARD16));
+ extraLen = rep.nSizes * sizeof (xScreenSizes);
+ if (has_rate)
+ extraLen += rep.nrateEnts * sizeof (CARD16);
if (extraLen)
{
@@ -744,6 +745,7 @@ ProcRRGetScreenInfo (ClientPtr client)
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.timestamp, n);
+ swapl(&rep.configTimestamp, n);
swaps(&rep.rotation, n);
swaps(&rep.nSizes, n);
swaps(&rep.sizeID, n);
@@ -938,6 +940,18 @@ ProcRRSetScreenConfig (ClientPtr client)
width = mode->mode.height;
height = mode->mode.width;
}
+
+ if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) {
+ client->errorValue = width;
+ free(pData);
+ return BadValue;
+ }
+ if (height < pScrPriv->minHeight || pScrPriv->maxHeight < height) {
+ client->errorValue = height;
+ free(pData);
+ return BadValue;
+ }
+
if (width != pScreen->width || height != pScreen->height)
{
int c;
@@ -963,15 +977,10 @@ ProcRRSetScreenConfig (ClientPtr client)
if (!RRCrtcSet (crtc, mode, 0, 0, stuff->rotation, 1, &output))
rep.status = RRSetConfigFailed;
- #ifndef NXAGENT_SERVER /* Bug 21987 */
- else
- rep.status = RRSetConfigSuccess;
- #else
else {
- rep.status = RRSetConfigSuccess;
pScrPriv->lastSetTime = time;
+ rep.status = RRSetConfigSuccess;
}
- #endif
/*
* XXX Configure other crtcs to mirror as much as possible
diff --git a/nx-X11/programs/Xserver/randr/rrxinerama.c b/nx-X11/programs/Xserver/randr/rrxinerama.c
index 9f11279db..5441f8abc 100644
--- a/nx-X11/programs/Xserver/randr/rrxinerama.c
+++ b/nx-X11/programs/Xserver/randr/rrxinerama.c
@@ -281,7 +281,8 @@ ProcRRXineramaIsActive(ClientPtr client)
xXineramaIsActiveReply rep;
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
-
+
+ memset(&rep, 0, sizeof(xXineramaIsActiveReply));
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;