mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
panoramiX: ProcXineramaQueryScreens(): write out payload in one block
Collect payload pieces into x_rpcbuf, so it can be written out once. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
7ab50432ba
commit
81a79e9f8b
@@ -33,6 +33,7 @@ Equipment Corporation.
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/resource_priv.h"
|
||||
#include "dix/rpcbuf_priv.h"
|
||||
#include "dix/screen_hooks_priv.h"
|
||||
#include "miext/extinit_priv.h"
|
||||
#include "Xext/panoramiX.h"
|
||||
@@ -1064,28 +1065,26 @@ ProcXineramaQueryScreens(ClientPtr client)
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.number);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
|
||||
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
|
||||
if (!noPanoramiXExtension) {
|
||||
xXineramaScreenInfo scratch;
|
||||
int i;
|
||||
|
||||
FOR_NSCREENS_BACKWARD(i) {
|
||||
scratch.x_org = screenInfo.screens[i]->x;
|
||||
scratch.y_org = screenInfo.screens[i]->y;
|
||||
scratch.width = screenInfo.screens[i]->width;
|
||||
scratch.height = screenInfo.screens[i]->height;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&scratch.x_org);
|
||||
swaps(&scratch.y_org);
|
||||
swaps(&scratch.width);
|
||||
swaps(&scratch.height);
|
||||
}
|
||||
WriteToClient(client, sz_XineramaScreenInfo, &scratch);
|
||||
xXineramaScreenInfo scratch = {
|
||||
.x_org = screenInfo.screens[i]->x,
|
||||
.y_org = screenInfo.screens[i]->y,
|
||||
.width = screenInfo.screens[i]->width,
|
||||
.height = screenInfo.screens[i]->height,
|
||||
};
|
||||
/* scratch consists of 4x CARD16 */
|
||||
if (!x_rpcbuf_write_CARD16s(&rpcbuf, (CARD16*)&scratch, 4))
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
|
||||
WriteRpcbufToClient(client, &rpcbuf);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user