diff options
Diffstat (limited to 'xkb')
-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); } |