Use C99 designated initializers in extension Events

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:
Alan Coopersmith
2012-07-09 19:12:44 -07:00
committed by Keith Packard
parent 0af79b124e
commit 9805cedf7b
23 changed files with 320 additions and 318 deletions

View File

@@ -236,29 +236,21 @@ RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
ScreenPtr pScreen = pWin->drawable.pScreen;
rrScrPriv(pScreen);
xRRCrtcChangeNotifyEvent ce;
RRModePtr mode = crtc->mode;
ce.type = RRNotify + RREventBase;
ce.subCode = RRNotify_CrtcChange;
ce.timestamp = pScrPriv->lastSetTime.milliseconds;
ce.window = pWin->drawable.id;
ce.crtc = crtc->id;
ce.rotation = crtc->rotation;
if (mode) {
ce.mode = mode->mode.id;
ce.x = crtc->x;
ce.y = crtc->y;
ce.width = mode->mode.width;
ce.height = mode->mode.height;
}
else {
ce.mode = None;
ce.x = 0;
ce.y = 0;
ce.width = 0;
ce.height = 0;
}
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
};
WriteEventsToClient(client, 1, (xEvent *) &ce);
}

View File

@@ -305,28 +305,22 @@ 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 : 0;
RRModePtr mode = crtc ? crtc->mode : NULL;
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;
if (crtc) {
oe.crtc = crtc->id;
oe.mode = mode ? mode->mode.id : None;
oe.rotation = crtc->rotation;
}
else {
oe.crtc = None;
oe.mode = None;
oe.rotation = RR_Rotate_0;
}
oe.connection = output->connection;
oe.subpixelOrder = output->subpixelOrder;
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
};
WriteEventsToClient(client, 1, (xEvent *) &oe);
}

View File

@@ -65,14 +65,14 @@ RRDestroyOutputProperty(RRPropertyPtr prop)
static void
RRDeleteProperty(RROutputRec * output, RRPropertyRec * prop)
{
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;
xRROutputPropertyNotifyEvent event = {
.type = RREventBase + RRNotify,
.subCode = RRNotify_OutputProperty,
.output = output->id,
.state = PropertyDelete,
.atom = prop->propertyName,
.timestamp = currentTime.milliseconds
};
RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
@@ -138,7 +138,6 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
pointer value, Bool sendevent, Bool pending)
{
RRPropertyPtr prop;
xRROutputPropertyNotifyEvent event;
rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
int size_in_bytes;
int total_size;
@@ -237,12 +236,14 @@ RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
output->pendingProperties = TRUE;
if (sendevent) {
event.type = RREventBase + RRNotify;
event.subCode = RRNotify_OutputProperty;
event.output = output->id;
event.state = PropertyNewValue;
event.atom = prop->propertyName;
event.timestamp = currentTime.milliseconds;
xRROutputPropertyNotifyEvent event = {
.type = RREventBase + RRNotify,
.subCode = RRNotify_OutputProperty,
.output = output->id,
.state = PropertyNewValue,
.atom = prop->propertyName,
.timestamp = currentTime.milliseconds
};
RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
}
return Success;
@@ -682,14 +683,14 @@ ProcRRGetOutputProperty(ClientPtr client)
reply.propertyType = prop_value->type;
if (stuff->delete && (reply.bytesAfter == 0)) {
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;
xRROutputPropertyNotifyEvent event = {
.type = RREventBase + RRNotify,
.subCode = RRNotify_OutputProperty,
.output = output->id,
.state = PropertyDelete,
.atom = prop->propertyName,
.timestamp = currentTime.milliseconds
};
RRDeliverPropertyEvent(output->pScreen, (xEvent *) &event);
}

View File

@@ -71,20 +71,20 @@ void
RRSendConfigNotify(ScreenPtr pScreen)
{
WindowPtr pWin = pScreen->root;
xEvent event;
event.u.u.type = ConfigureNotify;
event.u.configureNotify.window = pWin->drawable.id;
event.u.configureNotify.aboveSibling = None;
event.u.configureNotify.x = 0;
event.u.configureNotify.y = 0;
xEvent event = {
.u.configureNotify.window = pWin->drawable.id,
.u.configureNotify.aboveSibling = None,
.u.configureNotify.x = 0,
.u.configureNotify.y = 0,
/* XXX xinerama stuff ? */
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;
.u.configureNotify.width = pWin->drawable.width,
.u.configureNotify.height = pWin->drawable.height,
.u.configureNotify.borderWidth = wBorderWidth(pWin),
.u.configureNotify.override = pWin->overrideRedirect
};
event.u.u.type = ConfigureNotify;
DeliverEvents(pWin, &event, 1, NullWindow);
}
@@ -92,19 +92,20 @@ void
RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
{
rrScrPriv(pScreen);
xRRScreenChangeNotifyEvent se;
RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL;
WindowPtr pRoot = pScreen->root;
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);
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),
se.sizeID = RR10CurrentSizeID(pScreen);
.sizeID = RR10CurrentSizeID(pScreen)
};
if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) {
se.widthInPixels = pScreen->height;