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

@@ -59,8 +59,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
int i;
int keymap_changed = 0;
int modmap_changed = 0;
xEvent core_mn;
deviceMappingNotify xi_mn;
CARD32 time = GetTimeInMillis();
if (xkb_event == XkbNewKeyboardNotify) {
@@ -78,11 +76,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
if (!keymap_changed && !modmap_changed)
return;
core_mn.u.u.type = MappingNotify;
xi_mn.type = DeviceMappingNotify;
xi_mn.deviceid = kbd->id;
xi_mn.time = time;
/* 0 is serverClient. */
for (i = 1; i < currentMaxClients; i++) {
if (!clients[i] || clients[i]->clientState != ClientStateRunning)
@@ -106,6 +99,7 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
continue;
if (keymap_changed) {
xEvent core_mn = { .u.u.type = MappingNotify };
core_mn.u.mappingNotify.request = MappingKeyboard;
/* Clip the keycode range to what the client knows about, so it
@@ -123,9 +117,12 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
WriteEventsToClient(clients[i], 1, &core_mn);
}
if (modmap_changed) {
core_mn.u.mappingNotify.request = MappingModifier;
core_mn.u.mappingNotify.firstKeyCode = 0;
core_mn.u.mappingNotify.count = 0;
xEvent core_mn = {
.u.mappingNotify.request = MappingModifier,
.u.mappingNotify.firstKeyCode = 0,
.u.mappingNotify.count = 0
};
core_mn.u.u.type = MappingNotify;
WriteEventsToClient(clients[i], 1, &core_mn);
}
}
@@ -134,16 +131,26 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
* here? Clients might be upset, but that seems better than the
* alternative of stale keymaps. -ds */
if (keymap_changed) {
xi_mn.request = MappingKeyboard;
xi_mn.firstKeyCode = first_key;
xi_mn.count = num_keys;
deviceMappingNotify xi_mn = {
.type = DeviceMappingNotify,
.deviceid = kbd->id,
.request = MappingKeyboard,
.firstKeyCode = first_key,
.count = num_keys,
.time = time
};
SendEventToAllWindows(kbd, DeviceMappingNotifyMask, (xEvent *) &xi_mn,
1);
}
if (modmap_changed) {
xi_mn.request = MappingModifier;
xi_mn.firstKeyCode = 0;
xi_mn.count = 0;
deviceMappingNotify xi_mn = {
.type = DeviceMappingNotify,
.deviceid = kbd->id,
.request = MappingModifier,
.firstKeyCode = 0,
.count = 0,
.time = time
};
SendEventToAllWindows(kbd, DeviceMappingNotifyMask, (xEvent *) &xi_mn,
1);
}