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
commit 9805cedf7b
23 changed files with 321 additions and 319 deletions

View file

@ -113,7 +113,6 @@ ProcXChangeDeviceControl(ClientPtr client)
AxisInfoPtr a;
CARD32 *resolution;
xDeviceEnableCtl *e;
devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@ -211,11 +210,13 @@ ProcXChangeDeviceControl(ClientPtr client)
out:
if (ret == Success) {
dpn.type = DevicePresenceNotify;
dpn.time = currentTime.milliseconds;
dpn.devchange = DeviceControlChanged;
dpn.deviceid = dev->id;
dpn.control = stuff->control;
devicePresenceNotify dpn = {
.type = DevicePresenceNotify,
.time = currentTime.milliseconds,
.devchange = DeviceControlChanged,
.deviceid = dev->id,
.control = stuff->control
};
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);

View file

@ -137,13 +137,14 @@ ProcXGrabDeviceButton(ClientPtr client)
X_GrabDeviceButton)) != Success)
return ret;
memset(&param, 0, sizeof(param));
param.grabtype = XI;
param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode;
param.grabWindow = stuff->grabWindow;
param.modifiers = stuff->modifiers;
param = (GrabParameters) {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,
.other_devices_mode = stuff->other_devices_mode,
.grabWindow = stuff->grabWindow,
.modifiers = stuff->modifiers
};
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabButton(client, dev, mdev, stuff->button, &param, XI, &mask);

View file

@ -135,13 +135,14 @@ ProcXGrabDeviceKey(ClientPtr client)
X_GrabDeviceKey)) != Success)
return ret;
memset(&param, 0, sizeof(param));
param.grabtype = XI;
param.ownerEvents = stuff->ownerEvents;
param.this_device_mode = stuff->this_device_mode;
param.other_devices_mode = stuff->other_devices_mode;
param.grabWindow = stuff->grabWindow;
param.modifiers = stuff->modifiers;
param = (GrabParameters) {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,
.other_devices_mode = stuff->other_devices_mode,
.grabWindow = stuff->grabWindow,
.modifiers = stuff->modifiers
};
mask.xi = tmp[stuff->grabbed_device].mask;
ret = GrabKey(client, dev, mdev, stuff->key, &param, XI, &mask);

View file

@ -182,30 +182,27 @@ static long XIPropHandlerID = 1;
static void
send_property_event(DeviceIntPtr dev, Atom property, int what)
{
devicePropertyNotify event;
xXIPropertyEvent xi2;
int state;
int state = (what == XIPropertyDeleted) ? PropertyDelete : PropertyNewValue;
devicePropertyNotify event = {
.type = DevicePropertyNotify,
.deviceid = dev->id,
.state = state,
.atom = property,
.time = currentTime.milliseconds
};
xXIPropertyEvent xi2 = {
.type = GenericEvent,
.extension = IReqCode,
.length = 0,
.evtype = XI_PropertyEvent,
.deviceid = dev->id,
.time = currentTime.milliseconds,
.property = property,
.what = what
};
if (what == XIPropertyDeleted)
state = PropertyDelete;
else
state = PropertyNewValue;
event.type = DevicePropertyNotify;
event.deviceid = dev->id;
event.state = state;
event.atom = property;
event.time = currentTime.milliseconds;
SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
xi2.type = GenericEvent;
xi2.extension = IReqCode;
xi2.length = 0;
xi2.evtype = XI_PropertyEvent;
xi2.deviceid = dev->id;
xi2.time = currentTime.milliseconds;
xi2.property = property;
xi2.what = what;
SendEventToAllWindows(dev, GetEventFilter(dev, (xEvent *) &xi2),
(xEvent *) &xi2, 1);
}