aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/randr
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/randr')
-rw-r--r--xorg-server/randr/rrprovider.c47
-rw-r--r--xorg-server/randr/rrproviderproperty.c78
-rw-r--r--xorg-server/randr/rrscreen.c21
3 files changed, 79 insertions, 67 deletions
diff --git a/xorg-server/randr/rrprovider.c b/xorg-server/randr/rrprovider.c
index c4fe36980..c4ed515d6 100644
--- a/xorg-server/randr/rrprovider.c
+++ b/xorg-server/randr/rrprovider.c
@@ -86,23 +86,26 @@ ProcRRGetProviders (ClientPtr client)
}
pScrPriv = rrGetScrPriv(pScreen);
- rep.pad = 0;
if (!pScrPriv)
{
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.timestamp = currentTime.milliseconds;
- rep.nProviders = 0;
+ rep = (xRRGetProvidersReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .timestamp = currentTime.milliseconds,
+ .nProviders = 0
+ };
extra = NULL;
extraLen = 0;
} else {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- rep.nProviders = total_providers;
- rep.length = total_providers;
+ rep = (xRRGetProvidersReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .nProviders = total_providers,
+ .length = total_providers
+ };
extraLen = rep.length << 2;
if (extraLen) {
extra = malloc(extraLen);
@@ -163,18 +166,20 @@ ProcRRGetProviderInfo (ClientPtr client)
pScreen = provider->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
- rep.type = X_Reply;
- rep.status = RRSetConfigSuccess;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.capabilities = provider->capabilities;
- rep.nameLength = provider->nameLength;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- rep.nCrtcs = pScrPriv->numCrtcs;
- rep.nOutputs = pScrPriv->numOutputs;
+ rep = (xRRGetProviderInfoReply) {
+ .type = X_Reply,
+ .status = RRSetConfigSuccess,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .capabilities = provider->capabilities,
+ .nameLength = provider->nameLength,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .nCrtcs = pScrPriv->numCrtcs,
+ .nOutputs = pScrPriv->numOutputs,
+ .nAssociatedProviders = 0
+ };
/* count associated providers */
- rep.nAssociatedProviders = 0;
if (provider->offload_sink)
rep.nAssociatedProviders++;
if (provider->output_source)
diff --git a/xorg-server/randr/rrproviderproperty.c b/xorg-server/randr/rrproviderproperty.c
index 5e04fab8f..e0a814ff8 100644
--- a/xorg-server/randr/rrproviderproperty.c
+++ b/xorg-server/randr/rrproviderproperty.c
@@ -65,14 +65,14 @@ RRDestroyProviderProperty(RRPropertyPtr prop)
static void
RRDeleteProperty(RRProviderRec * provider, RRPropertyRec * prop)
{
- xRRProviderPropertyNotifyEvent event;
-
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_ProviderProperty;
- event.provider = provider->id;
- event.state = PropertyDelete;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
+ xRRProviderPropertyNotifyEvent event = {
+ .type = RREventBase + RRNotify,
+ .subCode = RRNotify_ProviderProperty,
+ .provider = provider->id,
+ .state = PropertyDelete,
+ .atom = prop->propertyName,
+ .timestamp = currentTime.milliseconds
+ };
RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event);
@@ -138,7 +138,6 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
pointer value, Bool sendevent, Bool pending)
{
RRPropertyPtr prop;
- xRRProviderPropertyNotifyEvent event;
rrScrPrivPtr pScrPriv = rrGetScrPriv(provider->pScreen);
int size_in_bytes;
int total_size;
@@ -237,12 +236,14 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
provider->pendingProperties = TRUE;
if (sendevent) {
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_ProviderProperty;
- event.provider = provider->id;
- event.state = PropertyNewValue;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
+ xRRProviderPropertyNotifyEvent event = {
+ .type = RREventBase + RRNotify,
+ .subCode = RRNotify_ProviderProperty,
+ .provider = provider->id,
+ .state = PropertyNewValue,
+ .atom = prop->propertyName,
+ .timestamp = currentTime.milliseconds
+ };
RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event);
}
return Success;
@@ -394,10 +395,12 @@ ProcRRListProviderProperties(ClientPtr client)
if (!(pAtoms = (Atom *) malloc(numProps * sizeof(Atom))))
return BadAlloc;
- rep.type = X_Reply;
- rep.length = bytes_to_int32(numProps * sizeof(Atom));
- rep.sequenceNumber = client->sequence;
- rep.nAtoms = numProps;
+ rep = (xRRListProviderPropertiesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(numProps * sizeof(Atom)),
+ .nAtoms = numProps
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -438,12 +441,14 @@ ProcRRQueryProviderProperty(ClientPtr client)
if (!extra)
return BadAlloc;
}
- rep.type = X_Reply;
- rep.length = prop->num_valid;
- rep.sequenceNumber = client->sequence;
- rep.pending = prop->is_pending;
- rep.range = prop->range;
- rep.immutable = prop->immutable;
+ rep = (xRRQueryProviderPropertyReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = prop->num_valid,
+ .pending = prop->is_pending,
+ .range = prop->range,
+ .immutable = prop->immutable
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -568,7 +573,10 @@ ProcRRGetProviderProperty(ClientPtr client)
RRPropertyValuePtr prop_value;
unsigned long n, len, ind;
RRProviderPtr provider;
- xRRGetProviderPropertyReply reply;
+ xRRGetProviderPropertyReply reply = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence
+ };
char *extra = NULL;
REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq);
@@ -594,8 +602,6 @@ ProcRRGetProviderProperty(ClientPtr client)
if (prop->propertyName == stuff->property)
break;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
if (!prop) {
reply.nItems = 0;
reply.length = 0;
@@ -672,14 +678,14 @@ ProcRRGetProviderProperty(ClientPtr client)
reply.propertyType = prop_value->type;
if (stuff->delete && (reply.bytesAfter == 0)) {
- xRRProviderPropertyNotifyEvent event;
-
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_ProviderProperty;
- event.provider = provider->id;
- event.state = PropertyDelete;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
+ xRRProviderPropertyNotifyEvent event = {
+ .type = RREventBase + RRNotify,
+ .subCode = RRNotify_ProviderProperty,
+ .provider = provider->id,
+ .state = PropertyDelete,
+ .atom = prop->propertyName,
+ .timestamp = currentTime.milliseconds
+ };
RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event);
}
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index 8d562108a..45c5139c9 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -395,16 +395,17 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
ErrorF("reporting %d %d %d %d\n", total_crtcs, total_outputs, total_modes, total_name_len);
pScrPriv = rrGetScrPriv(pScreen);
- rep.pad = 0;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.timestamp = pScrPriv->lastSetTime.milliseconds;
- rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
- rep.nCrtcs = total_crtcs;
- rep.nOutputs = total_outputs;
- rep.nModes = total_modes;
- rep.nbytesNames = total_name_len;
+ rep = (xRRGetScreenResourcesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .timestamp = pScrPriv->lastSetTime.milliseconds,
+ .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
+ .nCrtcs = total_crtcs,
+ .nOutputs = total_outputs,
+ .nModes = total_modes,
+ .nbytesNames = total_name_len
+ };
rep.length = (total_crtcs + total_outputs + total_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) +
bytes_to_int32(rep.nbytesNames));