summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:12:44 -0700
committerKeith Packard <keithp@keithp.com>2012-07-09 22:52:30 -0700
commit9805cedf7b0f76d3b75f94e956c4cc2dcf0d8b64 (patch)
tree466df72bc6e3fdad5a0a682a480af6905bd02780 /randr
parent0af79b124e1317c36d1613d28755c5a8ce612e2a (diff)
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>
Diffstat (limited to 'randr')
-rw-r--r--randr/rrcrtc.c34
-rw-r--r--randr/rroutput.c36
-rw-r--r--randr/rrproperty.c47
-rw-r--r--randr/rrscreen.c41
4 files changed, 73 insertions, 85 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 138fbe16f..e82d050e3 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -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);
}
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 093250829..88781ba0f 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -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;
-
- 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;
+ 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
+ };
WriteEventsToClient(client, 1, (xEvent *) &oe);
}
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 7ce085c0c..7f0909287 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -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);
}
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 774f8be52..a42772512 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -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;