diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:12:44 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-09 22:52:30 -0700 |
commit | 9805cedf7b0f76d3b75f94e956c4cc2dcf0d8b64 (patch) | |
tree | 466df72bc6e3fdad5a0a682a480af6905bd02780 /xkb/xkbEvents.c | |
parent | 0af79b124e1317c36d1613d28755c5a8ce612e2a (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 'xkb/xkbEvents.c')
-rw-r--r-- | xkb/xkbEvents.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index beb09cf7a..87a4485eb 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -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); } |