Use temporary variables instead of parts of reply structures
When passing variable pointers to functions or otherwise doing long sequences to compute values for replies, create & use some new temporary variables, to allow for simpler initialization of reply structures in the following patches. Move memsets & other initializations to group with the rest of the filling in of the reply structure, now that they're not needed so early in the code path. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
c2fb1a7b2a
commit
5b86c072d1
|
@ -616,6 +616,7 @@ ProcShmGetImage(ClientPtr client)
|
||||||
Mask plane = 0;
|
Mask plane = 0;
|
||||||
xShmGetImageReply xgi;
|
xShmGetImageReply xgi;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
|
VisualID visual = None;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xShmGetImageReq);
|
REQUEST(xShmGetImageReq);
|
||||||
|
@ -646,18 +647,19 @@ ProcShmGetImage(ClientPtr client)
|
||||||
stuff->y + (int) stuff->height >
|
stuff->y + (int) stuff->height >
|
||||||
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
|
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
xgi.visual = wVisual(((WindowPtr) pDraw));
|
visual = wVisual(((WindowPtr) pDraw));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (stuff->x < 0 ||
|
if (stuff->x < 0 ||
|
||||||
stuff->x + (int) stuff->width > pDraw->width ||
|
stuff->x + (int) stuff->width > pDraw->width ||
|
||||||
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
|
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
xgi.visual = None;
|
visual = None;
|
||||||
}
|
}
|
||||||
xgi.type = X_Reply;
|
xgi.type = X_Reply;
|
||||||
xgi.length = 0;
|
xgi.length = 0;
|
||||||
xgi.sequenceNumber = client->sequence;
|
xgi.sequenceNumber = client->sequence;
|
||||||
|
xgi.visual = visual;
|
||||||
xgi.depth = pDraw->depth;
|
xgi.depth = pDraw->depth;
|
||||||
if (stuff->format == ZPixmap) {
|
if (stuff->format == ZPixmap) {
|
||||||
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
|
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
|
||||||
|
|
|
@ -2801,17 +2801,21 @@ ProcLookupColor(ClientPtr client)
|
||||||
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
|
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
|
||||||
client, DixReadAccess);
|
client, DixReadAccess);
|
||||||
if (rc == Success) {
|
if (rc == Success) {
|
||||||
xLookupColorReply lcr;
|
CARD16 exactRed, exactGreen, exactBlue;
|
||||||
|
|
||||||
if (OsLookupColor
|
if (OsLookupColor
|
||||||
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
|
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
|
||||||
&lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) {
|
&exactRed, &exactGreen, &exactBlue)) {
|
||||||
|
xLookupColorReply lcr;
|
||||||
lcr.type = X_Reply;
|
lcr.type = X_Reply;
|
||||||
lcr.length = 0;
|
lcr.length = 0;
|
||||||
lcr.sequenceNumber = client->sequence;
|
lcr.sequenceNumber = client->sequence;
|
||||||
lcr.screenRed = lcr.exactRed;
|
lcr.exactRed = exactRed;
|
||||||
lcr.screenGreen = lcr.exactGreen;
|
lcr.exactGreen = exactGreen;
|
||||||
lcr.screenBlue = lcr.exactBlue;
|
lcr.exactBlue = exactBlue;
|
||||||
|
lcr.screenRed = exactRed;
|
||||||
|
lcr.screenGreen = exactGreen;
|
||||||
|
lcr.screenBlue = exactBlue;
|
||||||
(*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
|
(*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
|
||||||
&lcr.screenGreen,
|
&lcr.screenGreen,
|
||||||
&lcr.screenBlue, pcmp->pVisual);
|
&lcr.screenBlue, pcmp->pVisual);
|
||||||
|
@ -3109,6 +3113,7 @@ ProcListHosts(ClientPtr client)
|
||||||
{
|
{
|
||||||
xListHostsReply reply;
|
xListHostsReply reply;
|
||||||
int len, nHosts, result;
|
int len, nHosts, result;
|
||||||
|
BOOL enabled;
|
||||||
pointer pdata;
|
pointer pdata;
|
||||||
|
|
||||||
/* REQUEST(xListHostsReq); */
|
/* REQUEST(xListHostsReq); */
|
||||||
|
@ -3120,10 +3125,11 @@ ProcListHosts(ClientPtr client)
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
|
result = GetHosts(&pdata, &nHosts, &len, &enabled);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
reply.type = X_Reply;
|
reply.type = X_Reply;
|
||||||
|
reply.enabled = enabled;
|
||||||
reply.sequenceNumber = client->sequence;
|
reply.sequenceNumber = client->sequence;
|
||||||
reply.nHosts = nHosts;
|
reply.nHosts = nHosts;
|
||||||
reply.length = bytes_to_int32(len);
|
reply.length = bytes_to_int32(len);
|
||||||
|
|
15
dix/events.c
15
dix/events.c
|
@ -4797,6 +4797,7 @@ ProcGrabPointer(ClientPtr client)
|
||||||
GrabMask mask;
|
GrabMask mask;
|
||||||
WindowPtr confineTo;
|
WindowPtr confineTo;
|
||||||
CursorPtr oldCursor;
|
CursorPtr oldCursor;
|
||||||
|
BYTE status;
|
||||||
|
|
||||||
REQUEST(xGrabPointerReq);
|
REQUEST(xGrabPointerReq);
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -4818,7 +4819,6 @@ ProcGrabPointer(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&rep, 0, sizeof(xGrabPointerReply));
|
|
||||||
oldCursor = NullCursor;
|
oldCursor = NullCursor;
|
||||||
grab = device->deviceGrab.grab;
|
grab = device->deviceGrab.grab;
|
||||||
|
|
||||||
|
@ -4833,14 +4833,16 @@ ProcGrabPointer(ClientPtr client)
|
||||||
|
|
||||||
rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
|
rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
|
||||||
stuff->grabWindow, stuff->ownerEvents, stuff->time,
|
stuff->grabWindow, stuff->ownerEvents, stuff->time,
|
||||||
&mask, CORE, stuff->cursor, stuff->confineTo, &rep.status);
|
&mask, CORE, stuff->cursor, stuff->confineTo, &status);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (oldCursor && rep.status == GrabSuccess)
|
if (oldCursor && status == GrabSuccess)
|
||||||
FreeCursor(oldCursor, (Cursor) 0);
|
FreeCursor(oldCursor, (Cursor) 0);
|
||||||
|
|
||||||
|
memset(&rep, 0, sizeof(xGrabPointerReply));
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
rep.status = status;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
|
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
|
||||||
|
@ -5059,6 +5061,7 @@ int
|
||||||
ProcGrabKeyboard(ClientPtr client)
|
ProcGrabKeyboard(ClientPtr client)
|
||||||
{
|
{
|
||||||
xGrabKeyboardReply rep;
|
xGrabKeyboardReply rep;
|
||||||
|
BYTE status;
|
||||||
|
|
||||||
REQUEST(xGrabKeyboardReq);
|
REQUEST(xGrabKeyboardReq);
|
||||||
int result;
|
int result;
|
||||||
|
@ -5067,17 +5070,19 @@ ProcGrabKeyboard(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
|
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
|
||||||
|
|
||||||
memset(&rep, 0, sizeof(xGrabKeyboardReply));
|
|
||||||
mask.core = KeyPressMask | KeyReleaseMask;
|
mask.core = KeyPressMask | KeyReleaseMask;
|
||||||
|
|
||||||
result = GrabDevice(client, keyboard, stuff->pointerMode,
|
result = GrabDevice(client, keyboard, stuff->pointerMode,
|
||||||
stuff->keyboardMode, stuff->grabWindow,
|
stuff->keyboardMode, stuff->grabWindow,
|
||||||
stuff->ownerEvents, stuff->time, &mask, CORE, None,
|
stuff->ownerEvents, stuff->time, &mask, CORE, None,
|
||||||
None, &rep.status);
|
None, &status);
|
||||||
|
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
memset(&rep, 0, sizeof(xGrabKeyboardReply));
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
rep.status = status;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
|
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
|
||||||
|
|
|
@ -586,6 +586,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
xXF86DRIOpenConnectionReply rep;
|
xXF86DRIOpenConnectionReply rep;
|
||||||
drm_handle_t hSAREA;
|
drm_handle_t hSAREA;
|
||||||
char *busIdString = NULL;
|
char *busIdString = NULL;
|
||||||
|
CARD32 busIdStringLength = 0;
|
||||||
|
|
||||||
REQUEST(xXF86DRIOpenConnectionReq);
|
REQUEST(xXF86DRIOpenConnectionReq);
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
|
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
|
||||||
|
@ -600,15 +601,16 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (busIdString)
|
||||||
|
busIdStringLength = strlen(busIdString);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.busIdStringLength = 0;
|
rep.busIdStringLength = busIdStringLength;
|
||||||
if (busIdString)
|
|
||||||
rep.busIdStringLength = strlen(busIdString);
|
|
||||||
rep.length =
|
rep.length =
|
||||||
bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
||||||
SIZEOF(xGenericReply) +
|
SIZEOF(xGenericReply) +
|
||||||
pad_to_int32(rep.busIdStringLength));
|
pad_to_int32(busIdStringLength));
|
||||||
|
|
||||||
rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
|
rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff);
|
||||||
#if defined(LONG64) && !defined(__linux__)
|
#if defined(LONG64) && !defined(__linux__)
|
||||||
|
@ -618,8 +620,8 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
||||||
if (rep.busIdStringLength)
|
if (busIdStringLength)
|
||||||
WriteToClient(client, rep.busIdStringLength, busIdString);
|
WriteToClient(client, busIdStringLength, busIdString);
|
||||||
free(busIdString);
|
free(busIdString);
|
||||||
EPHYR_LOG("leave\n");
|
EPHYR_LOG("leave\n");
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
@ -512,6 +512,7 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
|
||||||
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
|
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) a_pc;
|
||||||
xGLXMakeCurrentReply reply;
|
xGLXMakeCurrentReply reply;
|
||||||
DrawablePtr drawable = NULL;
|
DrawablePtr drawable = NULL;
|
||||||
|
GLXContextTag contextTag = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
EPHYR_LOG("enter\n");
|
EPHYR_LOG("enter\n");
|
||||||
|
@ -525,13 +526,14 @@ ephyrGLXMakeCurrentReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap)
|
||||||
if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
|
if (!ephyrHostGLXMakeCurrent(hostx_get_window(drawable->pScreen->myNum),
|
||||||
req->context,
|
req->context,
|
||||||
req->oldContextTag,
|
req->oldContextTag,
|
||||||
(int *) &reply.contextTag)) {
|
(int *) &contextTag)) {
|
||||||
EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
|
EPHYR_LOG_ERROR("ephyrHostGLXMakeCurrent() failed\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
reply.length = 0;
|
reply.length = 0;
|
||||||
reply.type = X_Reply;
|
reply.type = X_Reply;
|
||||||
reply.sequenceNumber = a_cl->client->sequence;
|
reply.sequenceNumber = a_cl->client->sequence;
|
||||||
|
reply.contextTag = contextTag;
|
||||||
if (a_do_swap) {
|
if (a_do_swap) {
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
__GLX_SWAP_SHORT(&reply.sequenceNumber);
|
||||||
|
|
|
@ -141,6 +141,7 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
xXF86DRIOpenConnectionReply rep;
|
xXF86DRIOpenConnectionReply rep;
|
||||||
drm_handle_t hSAREA;
|
drm_handle_t hSAREA;
|
||||||
char *busIdString;
|
char *busIdString;
|
||||||
|
CARD32 busIdStringLength = 0;
|
||||||
|
|
||||||
REQUEST(xXF86DRIOpenConnectionReq);
|
REQUEST(xXF86DRIOpenConnectionReq);
|
||||||
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
|
REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
|
||||||
|
@ -154,11 +155,12 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (busIdString)
|
||||||
|
busIdStringLength = strlen(busIdString);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.busIdStringLength = 0;
|
rep.busIdStringLength = busIdStringLength;
|
||||||
if (busIdString)
|
|
||||||
rep.busIdStringLength = strlen(busIdString);
|
|
||||||
rep.length =
|
rep.length =
|
||||||
bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
|
||||||
SIZEOF(xGenericReply) +
|
SIZEOF(xGenericReply) +
|
||||||
|
@ -172,8 +174,8 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
|
||||||
if (rep.busIdStringLength)
|
if (busIdStringLength)
|
||||||
WriteToClient(client, rep.busIdStringLength, busIdString);
|
WriteToClient(client, busIdStringLength, busIdString);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -999,6 +999,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
||||||
TimeStamp time;
|
TimeStamp time;
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
int ret, i, j;
|
int ret, i, j;
|
||||||
|
CARD8 status;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
||||||
numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq)));
|
numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq)));
|
||||||
|
@ -1077,7 +1078,7 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
||||||
|
|
||||||
if (!pScrPriv) {
|
if (!pScrPriv) {
|
||||||
time = currentTime;
|
time = currentTime;
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,17 +1162,17 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
||||||
|
|
||||||
if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
|
if (!RRCrtcSet(crtc, mode, stuff->x, stuff->y,
|
||||||
rotation, numOutputs, outputs)) {
|
rotation, numOutputs, outputs)) {
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
rep.status = RRSetConfigSuccess;
|
status = RRSetConfigSuccess;
|
||||||
pScrPriv->lastSetTime = time;
|
pScrPriv->lastSetTime = time;
|
||||||
|
|
||||||
sendReply:
|
sendReply:
|
||||||
free(outputs);
|
free(outputs);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
/* rep.status has already been filled in */
|
rep.status = status;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
|
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
|
||||||
|
@ -1266,6 +1267,7 @@ ProcRRSetPanning(ClientPtr client)
|
||||||
BoxRec total;
|
BoxRec total;
|
||||||
BoxRec tracking;
|
BoxRec tracking;
|
||||||
INT16 border[4];
|
INT16 border[4];
|
||||||
|
CARD8 status;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRRSetPanningReq);
|
REQUEST_SIZE_MATCH(xRRSetPanningReq);
|
||||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||||
|
@ -1278,7 +1280,7 @@ ProcRRSetPanning(ClientPtr client)
|
||||||
|
|
||||||
if (!pScrPriv) {
|
if (!pScrPriv) {
|
||||||
time = currentTime;
|
time = currentTime;
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,10 +1307,11 @@ ProcRRSetPanning(ClientPtr client)
|
||||||
|
|
||||||
pScrPriv->lastSetTime = time;
|
pScrPriv->lastSetTime = time;
|
||||||
|
|
||||||
rep.status = RRSetConfigSuccess;
|
status = RRSetConfigSuccess;
|
||||||
|
|
||||||
sendReply:
|
sendReply:
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
rep.status = status;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
|
rep.newTimestamp = pScrPriv->lastSetTime.milliseconds;
|
||||||
|
|
|
@ -882,6 +882,7 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
int rate;
|
int rate;
|
||||||
Bool has_rate;
|
Bool has_rate;
|
||||||
|
CARD8 status;
|
||||||
RROutputPtr output;
|
RROutputPtr output;
|
||||||
RRCrtcPtr crtc;
|
RRCrtcPtr crtc;
|
||||||
RRModePtr mode;
|
RRModePtr mode;
|
||||||
|
@ -912,7 +913,7 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
|
|
||||||
if (!pScrPriv) {
|
if (!pScrPriv) {
|
||||||
time = currentTime;
|
time = currentTime;
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
if (!RRGetInfo(pScreen, FALSE))
|
if (!RRGetInfo(pScreen, FALSE))
|
||||||
|
@ -921,7 +922,7 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
output = RRFirstOutput(pScreen);
|
output = RRFirstOutput(pScreen);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
time = currentTime;
|
time = currentTime;
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,7 +938,7 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
* stop working after several hours have passed (freedesktop bug #6502).
|
* stop working after several hours have passed (freedesktop bug #6502).
|
||||||
*/
|
*/
|
||||||
if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) {
|
if (stuff->configTimestamp != pScrPriv->lastConfigTime.milliseconds) {
|
||||||
rep.status = RRSetConfigInvalidConfigTime;
|
status = RRSetConfigInvalidConfigTime;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,7 +1017,7 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
* the last set-time
|
* the last set-time
|
||||||
*/
|
*/
|
||||||
if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) {
|
if (CompareTimeStamps(time, pScrPriv->lastSetTime) < 0) {
|
||||||
rep.status = RRSetConfigInvalidTime;
|
status = RRSetConfigInvalidTime;
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,24 +1049,24 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
for (c = 0; c < pScrPriv->numCrtcs; c++) {
|
for (c = 0; c < pScrPriv->numCrtcs; c++) {
|
||||||
if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
|
if (!RRCrtcSet(pScrPriv->crtcs[c], NULL, 0, 0, RR_Rotate_0,
|
||||||
0, NULL)) {
|
0, NULL)) {
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
/* XXX recover from failure */
|
/* XXX recover from failure */
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!RRScreenSizeSet(pScreen, width, height,
|
if (!RRScreenSizeSet(pScreen, width, height,
|
||||||
pScreen->mmWidth, pScreen->mmHeight)) {
|
pScreen->mmWidth, pScreen->mmHeight)) {
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
/* XXX recover from failure */
|
/* XXX recover from failure */
|
||||||
goto sendReply;
|
goto sendReply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output))
|
if (!RRCrtcSet(crtc, mode, 0, 0, stuff->rotation, 1, &output))
|
||||||
rep.status = RRSetConfigFailed;
|
status = RRSetConfigFailed;
|
||||||
else {
|
else {
|
||||||
pScrPriv->lastSetTime = time;
|
pScrPriv->lastSetTime = time;
|
||||||
rep.status = RRSetConfigSuccess;
|
status = RRSetConfigSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1077,7 +1078,7 @@ ProcRRSetScreenConfig(ClientPtr client)
|
||||||
free(pData);
|
free(pData);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
/* rep.status has already been filled in */
|
rep.status = status;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
||||||
|
|
|
@ -299,16 +299,19 @@ ProcRRXineramaQueryScreens(ClientPtr client)
|
||||||
{
|
{
|
||||||
xXineramaQueryScreensReply rep;
|
xXineramaQueryScreensReply rep;
|
||||||
ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
|
ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
||||||
|
|
||||||
if (RRXineramaScreenActive(pScreen))
|
if (RRXineramaScreenActive(pScreen)) {
|
||||||
RRGetInfo(pScreen, FALSE);
|
RRGetInfo(pScreen, FALSE);
|
||||||
|
n = RRXineramaScreenCount(pScreen);
|
||||||
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.number = RRXineramaScreenCount(pScreen);
|
rep.number = n;
|
||||||
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
|
rep.length = bytes_to_int32(n * sz_XineramaScreenInfo);
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -316,7 +319,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
|
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
|
||||||
|
|
||||||
if (rep.number) {
|
if (n) {
|
||||||
rrScrPriv(pScreen);
|
rrScrPriv(pScreen);
|
||||||
int i;
|
int i;
|
||||||
int has_primary = 0;
|
int has_primary = 0;
|
||||||
|
|
|
@ -2135,6 +2135,7 @@ ProcRecordGetContext(ClientPtr client)
|
||||||
GetContextRangeInfoPtr pri;
|
GetContextRangeInfoPtr pri;
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err;
|
||||||
|
CARD32 nClients, length;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRecordGetContextReq);
|
REQUEST_SIZE_MATCH(xRecordGetContextReq);
|
||||||
VERIFY_CONTEXT(pContext, stuff->context, client);
|
VERIFY_CONTEXT(pContext, stuff->context, client);
|
||||||
|
@ -2218,12 +2219,12 @@ ProcRecordGetContext(ClientPtr client)
|
||||||
|
|
||||||
/* calculate number of clients and reply length */
|
/* calculate number of clients and reply length */
|
||||||
|
|
||||||
rep.nClients = 0;
|
nClients = 0;
|
||||||
rep.length = 0;
|
length = 0;
|
||||||
for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
|
for (pRCAP = pContext->pListOfRCAP, pri = pRangeInfo;
|
||||||
pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
|
pRCAP; pRCAP = pRCAP->pNextRCAP, pri++) {
|
||||||
rep.nClients += pRCAP->numClients;
|
nClients += pRCAP->numClients;
|
||||||
rep.length += pRCAP->numClients *
|
length += pRCAP->numClients *
|
||||||
(bytes_to_int32(sizeof(xRecordClientInfo)) +
|
(bytes_to_int32(sizeof(xRecordClientInfo)) +
|
||||||
pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
|
pri->nRanges * bytes_to_int32(sizeof(xRecordRange)));
|
||||||
}
|
}
|
||||||
|
@ -2232,8 +2233,10 @@ ProcRecordGetContext(ClientPtr client)
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
rep.length = length;
|
||||||
rep.enabled = pContext->pRecordingClient != NULL;
|
rep.enabled = pContext->pRecordingClient != NULL;
|
||||||
rep.elementHeader = pContext->elemHeaders;
|
rep.elementHeader = pContext->elemHeaders;
|
||||||
|
rep.nClients = nClients;
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
|
Loading…
Reference in New Issue