randr: ProcRRGetMonitors() use SwapLongs instead of callbacks
WriteSwappedDataToClient() calls a callback on each single field. We can have it easier and more efficient by just using SwapLongs() Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
This commit is contained in:
parent
c6f1b8a735
commit
203f59c6d3
|
@ -622,8 +622,6 @@ ProcRRGetMonitors(ClientPtr client)
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep);
|
WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep);
|
||||||
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
|
||||||
|
|
||||||
for (m = 0; m < nmonitors; m++) {
|
for (m = 0; m < nmonitors; m++) {
|
||||||
RRMonitorPtr monitor = &monitors[m];
|
RRMonitorPtr monitor = &monitors[m];
|
||||||
xRRMonitorInfo info = {
|
xRRMonitorInfo info = {
|
||||||
|
@ -649,8 +647,14 @@ ProcRRGetMonitors(ClientPtr client)
|
||||||
swapl(&info.heightInMillimeters);
|
swapl(&info.heightInMillimeters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RROutput outputs[monitor->numOutputs];
|
||||||
|
memcpy(outputs, monitor->outputs, monitor->numOutputs * sizeof (RROutput));
|
||||||
|
|
||||||
|
if (client->swapped)
|
||||||
|
SwapLongs(outputs, monitor->numOutputs);
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xRRMonitorInfo), &info);
|
WriteToClient(client, sizeof(xRRMonitorInfo), &info);
|
||||||
WriteSwappedDataToClient(client, monitor->numOutputs * sizeof (RROutput), monitor->outputs);
|
WriteToClient(client, sizeof(outputs), outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
RRMonitorFreeList(monitors, nmonitors);
|
RRMonitorFreeList(monitors, nmonitors);
|
||||||
|
|
Loading…
Reference in New Issue