diff options
Diffstat (limited to 'xorg-server/randr')
-rw-r--r-- | xorg-server/randr/makefile | 28 | ||||
-rw-r--r-- | xorg-server/randr/randr.c | 13 | ||||
-rw-r--r-- | xorg-server/randr/rrcrtc.c | 104 | ||||
-rw-r--r-- | xorg-server/randr/rrdispatch.c | 10 | ||||
-rw-r--r-- | xorg-server/randr/rrmode.c | 11 | ||||
-rw-r--r-- | xorg-server/randr/rroutput.c | 70 | ||||
-rw-r--r-- | xorg-server/randr/rrproperty.c | 81 | ||||
-rw-r--r-- | xorg-server/randr/rrprovider.c | 67 | ||||
-rw-r--r-- | xorg-server/randr/rrproviderproperty.c | 84 | ||||
-rw-r--r-- | xorg-server/randr/rrscreen.c | 194 | ||||
-rw-r--r-- | xorg-server/randr/rrxinerama.c | 83 |
11 files changed, 383 insertions, 362 deletions
diff --git a/xorg-server/randr/makefile b/xorg-server/randr/makefile new file mode 100644 index 000000000..9f32cf77d --- /dev/null +++ b/xorg-server/randr/makefile @@ -0,0 +1,28 @@ +LIBRARY=librandr
+XINERAMA=1
+
+XINERAMA_SRCS = rrxinerama.c
+
+librandr_la_SOURCES = \
+ randr.c \
+ randrstr.h \
+ rrcrtc.c \
+ rrdispatch.c \
+ rrinfo.c \
+ rrmode.c \
+ rroutput.c \
+ rrpointer.c \
+ rrproperty.c \
+ rrprovider.c \
+ rrproviderproperty.c \
+ rrscreen.c \
+ rrsdispatch.c \
+ rrtransform.h \
+ rrtransform.c
+
+if XINERAMA
+librandr_la_SOURCES += ${XINERAMA_SRCS}
+endif
+
+CSRCS = $(filter %.c,$(librandr_la_SOURCES))
+
diff --git a/xorg-server/randr/randr.c b/xorg-server/randr/randr.c index 6e3f14b4e..02707efd9 100644 --- a/xorg-server/randr/randr.c +++ b/xorg-server/randr/randr.c @@ -433,15 +433,16 @@ static void RRDeliverResourceEvent(ClientPtr client, WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; + xRRResourceChangeNotifyEvent re; rrScrPriv(pScreen); - xRRResourceChangeNotifyEvent re = { - .type = RRNotify + RREventBase, - .subCode = RRNotify_ResourceChange, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .window = pWin->drawable.id - }; + + re.type = RRNotify + RREventBase; + re.subCode = RRNotify_ResourceChange; + re.timestamp = pScrPriv->lastSetTime.milliseconds; + re.window = pWin->drawable.id; + WriteEventsToClient(client, 1, (xEvent *) &re); } diff --git a/xorg-server/randr/rrcrtc.c b/xorg-server/randr/rrcrtc.c index 69b3ecf0f..7c59293fe 100644 --- a/xorg-server/randr/rrcrtc.c +++ b/xorg-server/randr/rrcrtc.c @@ -238,21 +238,22 @@ RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc) ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); + xRRCrtcChangeNotifyEvent ce; RRModePtr mode = crtc->mode; - xRRCrtcChangeNotifyEvent ce = { - .type = RRNotify + RREventBase, - .subCode = RRNotify_CrtcChange, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .window = pWin->drawable.id, - .crtc = crtc->id, - .mode = mode ? mode->mode.id : None, - .rotation = crtc->rotation, - .x = mode ? crtc->x : 0, - .y = mode ? crtc->y : 0, - .width = mode ? mode->mode.width : 0, - .height = mode ? mode->mode.height : 0 - }; + + ce.type = RRNotify + RREventBase; + ce.subCode = RRNotify_CrtcChange; + ce.timestamp = pScrPriv->lastSetTime.milliseconds; + ce.window = pWin->drawable.id; + ce.crtc = crtc->id; + ce.mode = mode ? mode->mode.id : None; + ce.rotation = crtc->rotation; + ce.x = mode ? crtc->x : 0; + ce.y = mode ? crtc->y : 0; + ce.width = mode ? mode->mode.width : 0; + ce.height = mode ? mode->mode.height : 0; + WriteEventsToClient(client, 1, (xEvent *) &ce); } @@ -908,13 +909,13 @@ ProcRRGetCrtcInfo(ClientPtr client) mode = crtc->mode; - rep = (xRRGetCrtcInfoReply) { - .type = X_Reply, - .status = RRSetConfigSuccess, - .sequenceNumber = client->sequence, - .length = 0, - .timestamp = pScrPriv->lastSetTime.milliseconds - }; + + rep.type = X_Reply; + rep.status = RRSetConfigSuccess; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.timestamp = pScrPriv->lastSetTime.milliseconds; + if (pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) @@ -1181,13 +1182,12 @@ ProcRRSetCrtcConfig(ClientPtr client) sendReply: free(outputs); - rep = (xRRSetCrtcConfigReply) { - .type = X_Reply, - .status = status, - .sequenceNumber = client->sequence, - .length = 0, - .newTimestamp = pScrPriv->lastSetTime.milliseconds - }; + + rep.type = X_Reply; + rep.status = status; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -1223,13 +1223,12 @@ ProcRRGetPanning(ClientPtr client) if (!pScrPriv) return RRErrorBase + BadRRCrtc; - rep = (xRRGetPanningReply) { - .type = X_Reply, - .status = RRSetConfigSuccess, - .sequenceNumber = client->sequence, - .length = 1, - .timestamp = pScrPriv->lastSetTime.milliseconds - }; + memset(&rep, 0, sizeof(rep)); + rep.type = X_Reply; + rep.status = RRSetConfigSuccess; + rep.sequenceNumber = client->sequence; + rep.length = 1; + rep.timestamp = pScrPriv->lastSetTime.milliseconds; if (pScrPriv->rrGetPanning && pScrPriv->rrGetPanning(pScreen, crtc, &total, &tracking, border)) { @@ -1323,13 +1322,12 @@ ProcRRSetPanning(ClientPtr client) status = RRSetConfigSuccess; sendReply: - rep = (xRRSetPanningReply) { - .type = X_Reply, - .status = status, - .sequenceNumber = client->sequence, - .length = 0, - .newTimestamp = pScrPriv->lastSetTime.milliseconds - }; + + rep.type = X_Reply; + rep.status = status; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -1354,12 +1352,12 @@ ProcRRGetCrtcGammaSize(ClientPtr client) if (!RRCrtcGammaGet(crtc)) return RRErrorBase + BadRRCrtc; - reply = (xRRGetCrtcGammaSizeReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .size = crtc->gammaSize - }; + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = 0; + reply.size = crtc->gammaSize; + if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); @@ -1393,12 +1391,12 @@ ProcRRGetCrtcGamma(ClientPtr client) return BadAlloc; } - reply = (xRRGetCrtcGammaReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(len), - .size = crtc->gammaSize - }; + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = bytes_to_int32(len); + reply.size = crtc->gammaSize; + if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); diff --git a/xorg-server/randr/rrdispatch.c b/xorg-server/randr/rrdispatch.c index b9346d3f9..3fbbc7b14 100644 --- a/xorg-server/randr/rrdispatch.c +++ b/xorg-server/randr/rrdispatch.c @@ -35,17 +35,17 @@ RRClientKnowsRates(ClientPtr pClient) static int ProcRRQueryVersion(ClientPtr client) { - xRRQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; + xRRQueryVersionReply rep; REQUEST(xRRQueryVersionReq); rrClientPriv(client); REQUEST_SIZE_MATCH(xRRQueryVersionReq); pRRClient->major_version = stuff->majorVersion; pRRClient->minor_version = stuff->minorVersion; + memset(&rep, 0, sizeof(rep)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_RANDR_MAJOR_VERSION, diff --git a/xorg-server/randr/rrmode.c b/xorg-server/randr/rrmode.c index befac4741..1145b98e3 100644 --- a/xorg-server/randr/rrmode.c +++ b/xorg-server/randr/rrmode.c @@ -312,12 +312,11 @@ ProcRRCreateMode(ClientPtr client) if (!mode) return error; - rep = (xRRCreateModeReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .mode = mode->mode.id - }; + memset(&rep, 0, sizeof(rep)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.mode = mode->mode.id; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); diff --git a/xorg-server/randr/rroutput.c b/xorg-server/randr/rroutput.c index 548e07d1d..5d45bfdc1 100644 --- a/xorg-server/randr/rroutput.c +++ b/xorg-server/randr/rroutput.c @@ -308,22 +308,23 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output) ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); + xRROutputChangeNotifyEvent oe; RRCrtcPtr crtc = output->crtc; RRModePtr mode = crtc ? crtc->mode : NULL; - xRROutputChangeNotifyEvent oe = { - .type = RRNotify + RREventBase, - .subCode = RRNotify_OutputChange, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .configTimestamp = pScrPriv->lastConfigTime.milliseconds, - .window = pWin->drawable.id, - .output = output->id, - .crtc = crtc ? crtc->id : None, - .mode = mode ? mode->mode.id : None, - .rotation = crtc ? crtc->rotation : RR_Rotate_0, - .connection = output->connection, - .subpixelOrder = output->subpixelOrder - }; + + oe.type = RRNotify + RREventBase; + oe.subCode = RRNotify_OutputChange; + oe.timestamp = pScrPriv->lastSetTime.milliseconds; + oe.configTimestamp = pScrPriv->lastConfigTime.milliseconds; + oe.window = pWin->drawable.id; + oe.output = output->id; + oe.crtc = crtc ? crtc->id : None; + oe.mode = mode ? mode->mode.id : None; + oe.rotation = crtc ? crtc->rotation : RR_Rotate_0; + oe.connection = output->connection; + oe.subpixelOrder = output->subpixelOrder; + WriteEventsToClient(client, 1, (xEvent *) &oe); } @@ -424,23 +425,23 @@ ProcRRGetOutputInfo(ClientPtr client) pScreen = output->pScreen; pScrPriv = rrGetScrPriv(pScreen); - rep = (xRRGetOutputInfoReply) { - .type = X_Reply, - .status = RRSetConfigSuccess, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(OutputInfoExtra), - .timestamp = pScrPriv->lastSetTime.milliseconds, - .crtc = output->crtc ? output->crtc->id : None, - .mmWidth = output->mmWidth, - .mmHeight = output->mmHeight, - .connection = output->connection, - .subpixelOrder = output->subpixelOrder, - .nCrtcs = output->numCrtcs, - .nModes = output->numModes + output->numUserModes, - .nPreferred = output->numPreferred, - .nClones = output->numClones, - .nameLength = output->nameLength - }; + + rep.type = X_Reply; + rep.status = RRSetConfigSuccess; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(OutputInfoExtra); + rep.timestamp = pScrPriv->lastSetTime.milliseconds; + rep.crtc = output->crtc ? output->crtc->id : None; + rep.mmWidth = output->mmWidth; + rep.mmHeight = output->mmHeight; + rep.connection = output->connection; + rep.subpixelOrder = output->subpixelOrder; + rep.nCrtcs = output->numCrtcs; + rep.nModes = output->numModes + output->numUserModes; + rep.nPreferred = output->numPreferred; + rep.nClones = output->numClones; + rep.nameLength = output->nameLength; + extraLen = ((output->numCrtcs + output->numModes + output->numUserModes + output->numClones + bytes_to_int32(rep.nameLength)) << 2); @@ -578,11 +579,10 @@ ProcRRGetOutputPrimary(ClientPtr client) if (pScrPriv) primary = pScrPriv->primaryOutput; - rep = (xRRGetOutputPrimaryReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .output = primary ? primary->id : None - }; + memset(&rep, 0, sizeof(rep)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.output = primary ? primary->id : None; if (client->swapped) { swaps(&rep.sequenceNumber); diff --git a/xorg-server/randr/rrproperty.c b/xorg-server/randr/rrproperty.c index e385e15ab..dc26115bb 100644 --- a/xorg-server/randr/rrproperty.c +++ b/xorg-server/randr/rrproperty.c @@ -65,14 +65,13 @@ RRDestroyOutputProperty(RRPropertyPtr prop) static void RRDeleteProperty(RROutputRec * output, RRPropertyRec * prop) { - xRROutputPropertyNotifyEvent event = { - .type = RREventBase + RRNotify, - .subCode = RRNotify_OutputProperty, - .output = output->id, - .state = PropertyDelete, - .atom = prop->propertyName, - .timestamp = currentTime.milliseconds - }; + xRROutputPropertyNotifyEvent event; + event.type = RREventBase + RRNotify; + event.subCode = RRNotify_OutputProperty; + event.output = output->id; + event.state = PropertyDelete; + event.atom = prop->propertyName; + event.timestamp = currentTime.milliseconds; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); @@ -238,14 +237,13 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type, output->pendingProperties = TRUE; if (sendevent) { - xRROutputPropertyNotifyEvent event = { - .type = RREventBase + RRNotify, - .subCode = RRNotify_OutputProperty, - .output = output->id, - .state = PropertyNewValue, - .atom = prop->propertyName, - .timestamp = currentTime.milliseconds - }; + xRROutputPropertyNotifyEvent event; + event.type = RREventBase + RRNotify; + event.subCode = RRNotify_OutputProperty; + event.output = output->id; + event.state = PropertyNewValue; + event.atom = prop->propertyName; + event.timestamp = currentTime.milliseconds; RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); } return Success; @@ -403,12 +401,12 @@ ProcRRListOutputProperties(ClientPtr client) if (!(pAtoms = (Atom *) malloc(numProps * sizeof(Atom)))) return BadAlloc; - rep = (xRRListOutputPropertiesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(numProps * sizeof(Atom)), - .nAtoms = numProps - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(numProps * sizeof(Atom)); + rep.nAtoms = numProps; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -452,14 +450,13 @@ ProcRRQueryOutputProperty(ClientPtr client) return BadAlloc; } - rep = (xRRQueryOutputPropertyReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = prop->num_valid, - .pending = prop->is_pending, - .range = prop->range, - .immutable = prop->immutable - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = prop->num_valid; + rep.pending = prop->is_pending; + rep.range = prop->range; + rep.immutable = prop->immutable; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -611,10 +608,10 @@ ProcRRGetOutputProperty(ClientPtr client) if (prop->propertyName == stuff->property) break; - reply = (xRRGetOutputPropertyReply) { - .type = X_Reply, - .sequenceNumber = client->sequence - }; + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + if (!prop) { reply.nItems = 0; reply.length = 0; @@ -691,14 +688,14 @@ ProcRRGetOutputProperty(ClientPtr client) reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { - xRROutputPropertyNotifyEvent event = { - .type = RREventBase + RRNotify, - .subCode = RRNotify_OutputProperty, - .output = output->id, - .state = PropertyDelete, - .atom = prop->propertyName, - .timestamp = currentTime.milliseconds - }; + xRROutputPropertyNotifyEvent event; + event.type = RREventBase + RRNotify; + event.subCode = RRNotify_OutputProperty; + event.output = output->id; + event.state = PropertyDelete; + event.atom = prop->propertyName; + event.timestamp = currentTime.milliseconds; + RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event); } diff --git a/xorg-server/randr/rrprovider.c b/xorg-server/randr/rrprovider.c index bbb8e51b3..6cf53bed6 100644 --- a/xorg-server/randr/rrprovider.c +++ b/xorg-server/randr/rrprovider.c @@ -89,23 +89,23 @@ ProcRRGetProviders (ClientPtr client) if (!pScrPriv) { - rep = (xRRGetProvidersReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .timestamp = currentTime.milliseconds, - .nProviders = 0 - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.timestamp = currentTime.milliseconds; + rep.nProviders = 0; + extra = NULL; extraLen = 0; } else { - rep = (xRRGetProvidersReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .nProviders = total_providers, - .length = total_providers - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.timestamp = pScrPriv->lastSetTime.milliseconds; + rep.nProviders = total_providers; + rep.length = total_providers; + extraLen = rep.length << 2; if (extraLen) { extra = malloc(extraLen); @@ -166,18 +166,18 @@ ProcRRGetProviderInfo (ClientPtr client) pScreen = provider->pScreen; pScrPriv = rrGetScrPriv(pScreen); - 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 - }; + + 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.nAssociatedProviders = 0; + /* count associated providers */ if (provider->offload_sink) @@ -428,16 +428,17 @@ void RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider) { ScreenPtr pScreen = pWin->drawable.pScreen; + xRRProviderChangeNotifyEvent pe; rrScrPriv(pScreen); - xRRProviderChangeNotifyEvent pe = { - .type = RRNotify + RREventBase, - .subCode = RRNotify_ProviderChange, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .window = pWin->drawable.id, - .provider = provider->id - }; + + pe.type = RRNotify + RREventBase; + pe.subCode = RRNotify_ProviderChange; + pe.timestamp = pScrPriv->lastSetTime.milliseconds; + pe.window = pWin->drawable.id; + pe.provider = provider->id; + WriteEventsToClient(client, 1, (xEvent *) &pe); } diff --git a/xorg-server/randr/rrproviderproperty.c b/xorg-server/randr/rrproviderproperty.c index ff2c614d0..7955423e5 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 = { - .type = RREventBase + RRNotify, - .subCode = RRNotify_ProviderProperty, - .provider = provider->id, - .state = PropertyDelete, - .atom = prop->propertyName, - .timestamp = currentTime.milliseconds - }; + 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; + RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); @@ -238,14 +238,14 @@ RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type, provider->pendingProperties = TRUE; if (sendevent) { - xRRProviderPropertyNotifyEvent event = { - .type = RREventBase + RRNotify, - .subCode = RRNotify_ProviderProperty, - .provider = provider->id, - .state = PropertyNewValue, - .atom = prop->propertyName, - .timestamp = currentTime.milliseconds - }; + xRRProviderPropertyNotifyEvent event; + event.type = RREventBase + RRNotify; + event.subCode = RRNotify_ProviderProperty; + event.provider = provider->id; + event.state = PropertyNewValue; + event.atom = prop->propertyName; + event.timestamp = currentTime.milliseconds; + RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); } return Success; @@ -403,12 +403,12 @@ ProcRRListProviderProperties(ClientPtr client) if (!(pAtoms = (Atom *) malloc(numProps * sizeof(Atom)))) return BadAlloc; - rep = (xRRListProviderPropertiesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(numProps * sizeof(Atom)), - .nAtoms = numProps - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(numProps * sizeof(Atom)); + rep.nAtoms = numProps; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -449,14 +449,14 @@ ProcRRQueryProviderProperty(ClientPtr client) if (!extra) return BadAlloc; } - rep = (xRRQueryProviderPropertyReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = prop->num_valid, - .pending = prop->is_pending, - .range = prop->range, - .immutable = prop->immutable - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = prop->num_valid; + rep.pending = prop->is_pending; + rep.range = prop->range; + rep.immutable = prop->immutable; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -581,12 +581,12 @@ ProcRRGetProviderProperty(ClientPtr client) RRPropertyValuePtr prop_value; unsigned long n, len, ind; RRProviderPtr provider; - xRRGetProviderPropertyReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence - }; + xRRGetProviderPropertyReply reply; char *extra = NULL; + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); if (stuff->delete) UpdateCurrentTime(); @@ -686,14 +686,14 @@ ProcRRGetProviderProperty(ClientPtr client) reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) { - xRRProviderPropertyNotifyEvent event = { - .type = RREventBase + RRNotify, - .subCode = RRNotify_ProviderProperty, - .provider = provider->id, - .state = PropertyDelete, - .atom = prop->propertyName, - .timestamp = currentTime.milliseconds - }; + 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; + RRDeliverPropertyEvent(provider->pScreen, (xEvent *) &event); } diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c index e7ea49ddf..cf7369e00 100644 --- a/xorg-server/randr/rrscreen.c +++ b/xorg-server/randr/rrscreen.c @@ -68,19 +68,18 @@ void RRSendConfigNotify(ScreenPtr pScreen) { WindowPtr pWin = pScreen->root; - xEvent event = { - .u.configureNotify.window = pWin->drawable.id, - .u.configureNotify.aboveSibling = None, - .u.configureNotify.x = 0, - .u.configureNotify.y = 0, + xEvent event; + event.u.configureNotify.window = pWin->drawable.id; + event.u.configureNotify.aboveSibling = None; + event.u.configureNotify.x = 0; + event.u.configureNotify.y = 0; /* XXX xinerama stuff ? */ - .u.configureNotify.width = pWin->drawable.width, - .u.configureNotify.height = pWin->drawable.height, - .u.configureNotify.borderWidth = wBorderWidth(pWin), - .u.configureNotify.override = pWin->overrideRedirect - }; + event.u.configureNotify.width = pWin->drawable.width; + event.u.configureNotify.height = pWin->drawable.height; + event.u.configureNotify.borderWidth = wBorderWidth(pWin); + event.u.configureNotify.override = pWin->overrideRedirect; event.u.u.type = ConfigureNotify; DeliverEvents(pWin, &event, 1, NullWindow); } @@ -89,20 +88,21 @@ void RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen) { rrScrPriv(pScreen); + xRRScreenChangeNotifyEvent se; RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL; WindowPtr pRoot = pScreen->root; - xRRScreenChangeNotifyEvent se = { - .type = RRScreenChangeNotify + RREventBase, - .rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0), - .timestamp = pScrPriv->lastSetTime.milliseconds, - .configTimestamp = pScrPriv->lastConfigTime.milliseconds, - .root = pRoot->drawable.id, - .window = pWin->drawable.id, - .subpixelOrder = PictureGetSubpixelOrder(pScreen), - .sizeID = RR10CurrentSizeID(pScreen) - }; + se.type = RRScreenChangeNotify + RREventBase; + se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0); + se.timestamp = pScrPriv->lastSetTime.milliseconds; + se.configTimestamp = pScrPriv->lastConfigTime.milliseconds; + se.root = pRoot->drawable.id; + se.window = pWin->drawable.id; + se.subpixelOrder = PictureGetSubpixelOrder(pScreen); + + se.sizeID = RR10CurrentSizeID(pScreen); + if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) { se.widthInPixels = pScreen->height; @@ -201,12 +201,11 @@ ProcRRGetScreenSizeRange(ClientPtr client) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - rep = (xRRGetScreenSizeRangeReply) { - .type = X_Reply, - .pad = 0, - .sequenceNumber = client->sequence, - .length = 0 - }; + + rep.type = X_Reply; + rep.pad = 0; + rep.sequenceNumber = client->sequence; + rep.length = 0; if (pScrPriv) { if (!RRGetInfo(pScreen, FALSE)) @@ -403,17 +402,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 = (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.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.length = (total_crtcs + total_outputs + total_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + bytes_to_int32(rep.nbytesNames)); @@ -496,6 +495,7 @@ rrGetScreenResources(ClientPtr client, Bool query) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); + rep.pad = 0; if (query && pScrPriv) if (!RRGetInfo(pScreen, query)) @@ -505,17 +505,17 @@ rrGetScreenResources(ClientPtr client, Bool query) return rrGetMultiScreenResources(client, query, pScreen); if (!pScrPriv) { - rep = (xRRGetScreenResourcesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .timestamp = currentTime.milliseconds, - .configTimestamp = currentTime.milliseconds, - .nCrtcs = 0, - .nOutputs = 0, - .nModes = 0, - .nbytesNames = 0 - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.timestamp = currentTime.milliseconds; + rep.configTimestamp = currentTime.milliseconds; + rep.nCrtcs = 0; + rep.nOutputs = 0; + rep.nModes = 0; + rep.nbytesNames = 0; + extra = NULL; extraLen = 0; } @@ -527,17 +527,16 @@ rrGetScreenResources(ClientPtr client, Bool query) if (!modes) return BadAlloc; - rep = (xRRGetScreenResourcesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .configTimestamp = pScrPriv->lastConfigTime.milliseconds, - .nCrtcs = pScrPriv->numCrtcs, - .nOutputs = pScrPriv->numOutputs, - .nModes = num_modes, - .nbytesNames = 0 - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.timestamp = pScrPriv->lastSetTime.milliseconds; + rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; + rep.nCrtcs = pScrPriv->numCrtcs; + rep.nOutputs = pScrPriv->numOutputs; + rep.nModes = num_modes; + rep.nbytesNames = 0; for (i = 0; i < num_modes; i++) @@ -763,6 +762,7 @@ ProcRRGetScreenInfo(ClientPtr client) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); + rep.pad = 0; if (pScrPriv) if (!RRGetInfo(pScreen, TRUE)) @@ -771,20 +771,20 @@ ProcRRGetScreenInfo(ClientPtr client) output = RRFirstOutput(pScreen); if (!pScrPriv || !output) { - rep = (xRRGetScreenInfoReply) { - .type = X_Reply, - .setOfRotations = RR_Rotate_0, - .sequenceNumber = client->sequence, - .length = 0, - .root = pWin->drawable.pScreen->root->drawable.id, - .timestamp = currentTime.milliseconds, - .configTimestamp = currentTime.milliseconds, - .nSizes = 0, - .sizeID = 0, - .rotation = RR_Rotate_0, - .rate = 0, - .nrateEnts = 0 - }; + + rep.type = X_Reply; + rep.setOfRotations = RR_Rotate_0; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.root = pWin->drawable.pScreen->root->drawable.id; + rep.timestamp = currentTime.milliseconds; + rep.configTimestamp = currentTime.milliseconds; + rep.nSizes = 0; + rep.sizeID = 0; + rep.rotation = RR_Rotate_0; + rep.rate = 0; + rep.nrateEnts = 0; + extra = 0; extraLen = 0; } @@ -801,20 +801,19 @@ ProcRRGetScreenInfo(ClientPtr client) if (!pData) return BadAlloc; - rep = (xRRGetScreenInfoReply) { - .type = X_Reply, - .setOfRotations = output->crtc->rotations, - .sequenceNumber = client->sequence, - .length = 0, - .root = pWin->drawable.pScreen->root->drawable.id, - .timestamp = pScrPriv->lastSetTime.milliseconds, - .configTimestamp = pScrPriv->lastConfigTime.milliseconds, - .rotation = output->crtc->rotation, - .nSizes = pData->nsize, - .nrateEnts = pData->nrefresh + pData->nsize, - .sizeID = pData->size, - .rate = pData->refresh - }; + + rep.type = X_Reply; + rep.setOfRotations = output->crtc->rotations; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.root = pWin->drawable.pScreen->root->drawable.id; + rep.timestamp = pScrPriv->lastSetTime.milliseconds; + rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; + rep.rotation = output->crtc->rotation; + rep.nSizes = pData->nsize; + rep.nrateEnts = pData->nrefresh + pData->nsize; + rep.sizeID = pData->size; + rep.rate = pData->refresh; extraLen = rep.nSizes * sizeof(xScreenSizes); if (has_rate) @@ -1100,17 +1099,16 @@ ProcRRSetScreenConfig(ClientPtr client) free(pData); - rep = (xRRSetScreenConfigReply) { - .type = X_Reply, - .status = status, - .sequenceNumber = client->sequence, - .length = 0, - - .newTimestamp = pScrPriv->lastSetTime.milliseconds, - .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, - .root = pDraw->pScreen->root->drawable.id, - /* .subpixelOrder = ?? */ - }; + + rep.type = X_Reply; + rep.status = status; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; + rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds; + rep.root = pDraw->pScreen->root->drawable.id; + if (client->swapped) { swaps(&rep.sequenceNumber); diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c index b336bd7cd..0b9dd8a0e 100644 --- a/xorg-server/randr/rrxinerama.c +++ b/xorg-server/randr/rrxinerama.c @@ -89,15 +89,14 @@ static int SProcRRXineramaDispatch(ClientPtr client); int ProcRRXineramaQueryVersion(ClientPtr client) { - xPanoramiXQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION, - .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION - }; + xPanoramiXQueryVersionReply rep; REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION; + rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -131,13 +130,13 @@ ProcRRXineramaGetState(ClientPtr client) active = TRUE; } - rep = (xPanoramiXGetStateReply) { - .type = X_Reply, - .state = active, - .sequenceNumber = client->sequence, - .length = 0, - .window = stuff->window - }; + + rep.type = X_Reply; + rep.state = active; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.window = stuff->window; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -197,13 +196,13 @@ ProcRRXineramaGetScreenCount(ClientPtr client) if (rc != Success) return rc; - rep = (xPanoramiXGetScreenCountReply) { - .type = X_Reply, - .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen), - .sequenceNumber = client->sequence, - .length = 0, - .window = stuff->window - }; + + rep.type = X_Reply; + rep.ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen); + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.window = stuff->window; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -230,15 +229,15 @@ ProcRRXineramaGetScreenSize(ClientPtr client) pScreen = pWin->drawable.pScreen; pRoot = pScreen->root; - rep = (xPanoramiXGetScreenSizeReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .width = pRoot->drawable.width, - .height = pRoot->drawable.height, - .window = stuff->window, - .screen = stuff->screen - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.width = pRoot->drawable.width; + rep.height = pRoot->drawable.height; + rep.window = stuff->window; + rep.screen = stuff->screen; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -258,12 +257,12 @@ ProcRRXineramaIsActive(ClientPtr client) REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - rep = (xXineramaIsActiveReply) { - .type = X_Reply, - .length = 0, - .sequenceNumber = client->sequence, - .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) - }; + memset(&rep, 0, sizeof(xXineramaIsActiveReply)); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]); + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -327,12 +326,12 @@ ProcRRXineramaQueryScreens(ClientPtr client) n = RRXineramaScreenCount(pScreen); } - rep = (xXineramaQueryScreensReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(n * sz_XineramaScreenInfo), - .number = n - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(n * sz_XineramaScreenInfo); + rep.number = n; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); |