aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r--xorg-server/xkb/XKBGAlloc.c129
-rw-r--r--xorg-server/xkb/xkb.c367
-rw-r--r--xorg-server/xkb/xkb.h62
-rw-r--r--xorg-server/xkb/xkbEvents.c57
-rw-r--r--xorg-server/xkb/xkbgeom.h17
5 files changed, 248 insertions, 384 deletions
diff --git a/xorg-server/xkb/XKBGAlloc.c b/xorg-server/xkb/XKBGAlloc.c
index f7e017682..888078406 100644
--- a/xorg-server/xkb/XKBGAlloc.c
+++ b/xorg-server/xkb/XKBGAlloc.c
@@ -249,51 +249,6 @@ XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count, Bool freeAll)
/***====================================================================***/
-static void
-_XkbClearOverlayRow(char *row_in)
-{
- XkbOverlayRowPtr row = (XkbOverlayRowPtr) row_in;
-
- if (row->keys != NULL)
- XkbFreeGeomOverlayKeys(row, 0, row->num_keys, TRUE);
- return;
-}
-
-void
-XkbFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
- Bool freeAll)
-{
- _XkbFreeGeomNonLeafElems(freeAll, first, count,
- &overlay->num_rows, &overlay->sz_rows,
- (char **) &overlay->rows,
- sizeof(XkbOverlayRowRec), _XkbClearOverlayRow);
- return;
-}
-
-/***====================================================================***/
-
-static void
-_XkbClearOverlay(char *overlay_in)
-{
- XkbOverlayPtr overlay = (XkbOverlayPtr) overlay_in;
-
- if (overlay->rows != NULL)
- XkbFreeGeomOverlayRows(overlay, 0, overlay->num_rows, TRUE);
- return;
-}
-
-void
-XkbFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll)
-{
- _XkbFreeGeomNonLeafElems(freeAll, first, count,
- &section->num_overlays, &section->sz_overlays,
- (char **) &section->overlays,
- sizeof(XkbOverlayRec), _XkbClearOverlay);
- return;
-}
-
-/***====================================================================***/
-
void
XkbFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll)
{
@@ -543,90 +498,6 @@ _XkbGeomAlloc(void **old,
(n),sizeof(XkbOverlayKeyRec))
Status
-XkbAllocGeomProps(XkbGeometryPtr geom, int nProps)
-{
- return _XkbAllocProps(geom, nProps);
-}
-
-Status
-XkbAllocGeomColors(XkbGeometryPtr geom, int nColors)
-{
- return _XkbAllocColors(geom, nColors);
-}
-
-Status
-XkbAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases)
-{
- return _XkbAllocKeyAliases(geom, nKeyAliases);
-}
-
-Status
-XkbAllocGeomShapes(XkbGeometryPtr geom, int nShapes)
-{
- return _XkbAllocShapes(geom, nShapes);
-}
-
-Status
-XkbAllocGeomSections(XkbGeometryPtr geom, int nSections)
-{
- return _XkbAllocSections(geom, nSections);
-}
-
-Status
-XkbAllocGeomOverlays(XkbSectionPtr section, int nOverlays)
-{
- return _XkbAllocOverlays(section, nOverlays);
-}
-
-Status
-XkbAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows)
-{
- return _XkbAllocOverlayRows(overlay, nRows);
-}
-
-Status
-XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys)
-{
- return _XkbAllocOverlayKeys(row, nKeys);
-}
-
-Status
-XkbAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads)
-{
- return _XkbAllocDoodads(geom, nDoodads);
-}
-
-Status
-XkbAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads)
-{
- return _XkbAllocDoodads(section, nDoodads);
-}
-
-Status
-XkbAllocGeomOutlines(XkbShapePtr shape, int nOL)
-{
- return _XkbAllocOutlines(shape, nOL);
-}
-
-Status
-XkbAllocGeomRows(XkbSectionPtr section, int nRows)
-{
- return _XkbAllocRows(section, nRows);
-}
-
-Status
-XkbAllocGeomPoints(XkbOutlinePtr ol, int nPts)
-{
- return _XkbAllocPoints(ol, nPts);
-}
-
-Status
-XkbAllocGeomKeys(XkbRowPtr row, int nKeys)
-{
- return _XkbAllocKeys(row, nKeys);
-}
-
-Status
XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes)
{
XkbGeometryPtr geom;
diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c
index 0bec24f63..4440a98c1 100644
--- a/xorg-server/xkb/xkb.c
+++ b/xorg-server/xkb/xkb.c
@@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
#include "extnsionst.h"
+#include "extinit.h"
#include "xace.h"
#include "xkb.h"
#include "protocol-versions.h"
@@ -181,19 +182,20 @@ ProcXkbUseExtension(ClientPtr client)
stuff->wantedMinor, SERVER_XKB_MAJOR_VERSION,
SERVER_XKB_MINOR_VERSION);
}
- memset(&rep, 0, sizeof(xkbUseExtensionReply));
- rep.type = X_Reply;
- rep.supported = supported;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
- rep.serverMinor = SERVER_XKB_MINOR_VERSION;
+ rep = (xkbUseExtensionReply) {
+ .type = X_Reply,
+ .supported = supported,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .serverMajor = SERVER_XKB_MAJOR_VERSION,
+ .serverMinor = SERVER_XKB_MINOR_VERSION
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.serverMajor);
swaps(&rep.serverMinor);
}
- WriteToClient(client, SIZEOF(xkbUseExtensionReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbUseExtensionReply), &rep);
return Success;
}
@@ -577,26 +579,27 @@ ProcXkbGetState(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb = &dev->key->xkbInfo->state;
- memset(&rep, 0, sizeof(xkbGetStateReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.mods = XkbStateFieldFromRec(xkb) & 0xff;
- rep.baseMods = xkb->base_mods;
- rep.lockedMods = xkb->locked_mods;
- rep.latchedMods = xkb->latched_mods;
- rep.group = xkb->group;
- rep.baseGroup = xkb->base_group;
- rep.latchedGroup = xkb->latched_group;
- rep.lockedGroup = xkb->locked_group;
- rep.compatState = xkb->compat_state;
- rep.ptrBtnState = xkb->ptr_buttons;
+ rep = (xkbGetStateReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .mods = XkbStateFieldFromRec(xkb) & 0xff,
+ .baseMods = xkb->base_mods,
+ .latchedMods = xkb->latched_mods,
+ .lockedMods = xkb->locked_mods,
+ .group = xkb->group,
+ .lockedGroup = xkb->locked_group,
+ .baseGroup = xkb->base_group,
+ .latchedGroup = xkb->latched_group,
+ .compatState = xkb->compat_state,
+ .ptrBtnState = xkb->ptr_buttons
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.ptrBtnState);
}
- WriteToClient(client, SIZEOF(xkbGetStateReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbGetStateReply), &rep);
return Success;
}
@@ -688,36 +691,38 @@ ProcXkbGetControls(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
xkb = dev->key->xkbInfo->desc->ctrls;
- rep.type = X_Reply;
- rep.length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
- SIZEOF(xGenericReply));
- rep.sequenceNumber = client->sequence;
- rep.deviceID = ((DeviceIntPtr) dev)->id;
- rep.numGroups = xkb->num_groups;
- rep.groupsWrap = xkb->groups_wrap;
- rep.internalMods = xkb->internal.mask;
- rep.ignoreLockMods = xkb->ignore_lock.mask;
- rep.internalRealMods = xkb->internal.real_mods;
- rep.ignoreLockRealMods = xkb->ignore_lock.real_mods;
- rep.internalVMods = xkb->internal.vmods;
- rep.ignoreLockVMods = xkb->ignore_lock.vmods;
- rep.enabledCtrls = xkb->enabled_ctrls;
- rep.repeatDelay = xkb->repeat_delay;
- rep.repeatInterval = xkb->repeat_interval;
- rep.slowKeysDelay = xkb->slow_keys_delay;
- rep.debounceDelay = xkb->debounce_delay;
- rep.mkDelay = xkb->mk_delay;
- rep.mkInterval = xkb->mk_interval;
- rep.mkTimeToMax = xkb->mk_time_to_max;
- rep.mkMaxSpeed = xkb->mk_max_speed;
- rep.mkCurve = xkb->mk_curve;
- rep.mkDfltBtn = xkb->mk_dflt_btn;
- rep.axTimeout = xkb->ax_timeout;
- rep.axtCtrlsMask = xkb->axt_ctrls_mask;
- rep.axtCtrlsValues = xkb->axt_ctrls_values;
- rep.axtOptsMask = xkb->axt_opts_mask;
- rep.axtOptsValues = xkb->axt_opts_values;
- rep.axOptions = xkb->ax_options;
+ rep = (xkbGetControlsReply) {
+ .type = X_Reply,
+ .deviceID = ((DeviceIntPtr) dev)->id,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
+ SIZEOF(xGenericReply)),
+ .mkDfltBtn = xkb->mk_dflt_btn,
+ .numGroups = xkb->num_groups,
+ .groupsWrap = xkb->groups_wrap,
+ .internalMods = xkb->internal.mask,
+ .ignoreLockMods = xkb->ignore_lock.mask,
+ .internalRealMods = xkb->internal.real_mods,
+ .ignoreLockRealMods = xkb->ignore_lock.real_mods,
+ .internalVMods = xkb->internal.vmods,
+ .ignoreLockVMods = xkb->ignore_lock.vmods,
+ .repeatDelay = xkb->repeat_delay,
+ .repeatInterval = xkb->repeat_interval,
+ .slowKeysDelay = xkb->slow_keys_delay,
+ .debounceDelay = xkb->debounce_delay,
+ .mkDelay = xkb->mk_delay,
+ .mkInterval = xkb->mk_interval,
+ .mkTimeToMax = xkb->mk_time_to_max,
+ .mkMaxSpeed = xkb->mk_max_speed,
+ .mkCurve = xkb->mk_curve,
+ .axOptions = xkb->ax_options,
+ .axTimeout = xkb->ax_timeout,
+ .axtOptsMask = xkb->axt_opts_mask,
+ .axtOptsValues = xkb->axt_opts_values,
+ .axtCtrlsMask = xkb->axt_ctrls_mask,
+ .axtCtrlsValues = xkb->axt_ctrls_values,
+ .enabledCtrls = xkb->enabled_ctrls,
+ };
memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -741,7 +746,7 @@ ProcXkbGetControls(ClientPtr client)
swaps(&rep.axtOptsValues);
swaps(&rep.axOptions);
}
- WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep);
return Success;
}
@@ -1433,7 +1438,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep)
swaps(&rep->totalSyms);
swaps(&rep->totalActs);
}
- WriteToClient(client, (i = SIZEOF(xkbGetMapReply)), (char *) rep);
+ WriteToClient(client, (i = SIZEOF(xkbGetMapReply)), rep);
WriteToClient(client, len, start);
free((char *) start);
return Success;
@@ -1459,14 +1464,16 @@ ProcXkbGetMap(ClientPtr client)
CHK_MASK_LEGAL(0x03, stuff->partial, XkbAllMapComponentsMask);
xkb = dev->key->xkbInfo->desc;
- memset(&rep, 0, sizeof(xkbGetMapReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2;
- rep.deviceID = dev->id;
- rep.present = stuff->partial | stuff->full;
- rep.minKeyCode = xkb->min_key_code;
- rep.maxKeyCode = xkb->max_key_code;
+ rep = (xkbGetMapReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2,
+ .present = stuff->partial | stuff->full,
+ .minKeyCode = xkb->min_key_code,
+ .maxKeyCode = xkb->max_key_code
+ };
+
if (stuff->full & XkbKeyTypesMask) {
rep.firstType = 0;
rep.nTypes = xkb->map->num_types;
@@ -2744,7 +2751,7 @@ XkbSendCompatMap(ClientPtr client,
swaps(&rep->nTotalSI);
}
- WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *) rep);
+ WriteToClient(client, SIZEOF(xkbGetCompatMapReply), rep);
if (data) {
WriteToClient(client, size, data);
free((char *) data);
@@ -2771,12 +2778,14 @@ ProcXkbGetCompatMap(ClientPtr client)
xkb = dev->key->xkbInfo->desc;
compat = xkb->compat;
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.firstSI = stuff->firstSI;
- rep.nSI = stuff->nSI;
+ rep = (xkbGetCompatMapReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .deviceID = dev->id,
+ .firstSI = stuff->firstSI,
+ .nSI = stuff->nSI
+ };
if (stuff->getAllSI) {
rep.firstSI = 0;
rep.nSI = compat->num_si;
@@ -3034,17 +3043,19 @@ ProcXkbGetIndicatorState(ClientPtr client)
if (!sli)
return BadAlloc;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.state = sli->effectiveState;
+ rep = (xkbGetIndicatorStateReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .state = sli->effectiveState
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.state);
}
- WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep);
return Success;
}
@@ -3118,9 +3129,9 @@ XkbSendIndicatorMap(ClientPtr client,
swapl(&rep->which);
swapl(&rep->realIndicators);
}
- WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *) rep);
+ WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), rep);
if (map) {
- WriteToClient(client, length, (char *) map);
+ WriteToClient(client, length, map);
free((char *) map);
}
return Success;
@@ -3145,11 +3156,13 @@ ProcXkbGetIndicatorMap(ClientPtr client)
xkb = dev->key->xkbInfo->desc;
leds = xkb->indicators;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.which = stuff->which;
+ rep = (xkbGetIndicatorMapReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .which = stuff->which
+ };
XkbComputeGetIndicatorMapReplySize(leds, &rep);
return XkbSendIndicatorMap(client, leds, &rep);
}
@@ -3300,11 +3313,13 @@ ProcXkbGetNamedIndicator(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.deviceID = dev->id;
- rep.indicator = stuff->indicator;
+ rep = (xkbGetNamedIndicatorReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .deviceID = dev->id,
+ .indicator = stuff->indicator
+ };
if (map != NULL) {
rep.found = TRUE;
rep.on = ((sli->effectiveState & (1 << i)) != 0);
@@ -3343,7 +3358,7 @@ ProcXkbGetNamedIndicator(ClientPtr client)
swapl(&rep.ctrls);
}
- WriteToClient(client, SIZEOF(xkbGetNamedIndicatorReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbGetNamedIndicatorReply), &rep);
return Success;
}
@@ -3857,7 +3872,7 @@ XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n",
length, (unsigned long) (desc - start));
}
- WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *) rep);
+ WriteToClient(client, SIZEOF(xkbGetNamesReply), rep);
WriteToClient(client, length, start);
free((char *) start);
return Success;
@@ -3880,22 +3895,18 @@ ProcXkbGetNames(ClientPtr client)
CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask);
xkb = dev->key->xkbInfo->desc;
- memset(&rep, 0, sizeof(xkbGetNamesReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.which = stuff->which;
- rep.nTypes = xkb->map->num_types;
- rep.firstKey = xkb->min_key_code;
- rep.nKeys = XkbNumKeys(xkb);
- if (xkb->names != NULL) {
- rep.nKeyAliases = xkb->names->num_key_aliases;
- rep.nRadioGroups = xkb->names->num_rg;
- }
- else {
- rep.nKeyAliases = rep.nRadioGroups = 0;
- }
+ rep = (xkbGetNamesReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .which = stuff->which,
+ .nTypes = xkb->map->num_types,
+ .firstKey = xkb->min_key_code,
+ .nKeys = XkbNumKeys(xkb),
+ .nKeyAliases = xkb->names ? xkb->names->num_key_aliases : 0,
+ .nRadioGroups = xkb->names ? xkb->names->num_rg : 0
+ };
XkbComputeGetNamesReplySize(xkb, &rep);
return XkbSendNames(client, xkb, &rep);
}
@@ -4904,7 +4915,7 @@ XkbSendGeometry(ClientPtr client,
swaps(&rep->nDoodads);
swaps(&rep->nKeyAliases);
}
- WriteToClient(client, SIZEOF(xkbGetGeometryReply), (char *) rep);
+ WriteToClient(client, SIZEOF(xkbGetGeometryReply), rep);
if (len > 0)
WriteToClient(client, len, start);
if (start != NULL)
@@ -4933,10 +4944,12 @@ ProcXkbGetGeometry(ClientPtr client)
CHK_ATOM_OR_NONE(stuff->name);
geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep = (xkbGetGeometryReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
if (status != Success)
return status;
@@ -5483,10 +5496,6 @@ ProcXkbPerClientFlags(ClientPtr client)
CHK_MASK_MATCH(0x02, stuff->change, stuff->value);
interest = XkbFindClientResource((DevicePtr) dev, client);
- memset(&rep, 0, sizeof(xkbPerClientFlagsReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
if (stuff->change) {
client->xkbClientFlags &= ~stuff->change;
client->xkbClientFlags |= stuff->value;
@@ -5522,15 +5531,16 @@ ProcXkbPerClientFlags(ClientPtr client)
interest->autoCtrlValues |= stuff->autoCtrlValues & affect;
}
}
- rep.supported = XkbPCF_AllFlagsMask;
- rep.value = client->xkbClientFlags & XkbPCF_AllFlagsMask;
- if (interest) {
- rep.autoCtrls = interest->autoCtrls;
- rep.autoCtrlValues = interest->autoCtrlValues;
- }
- else {
- rep.autoCtrls = rep.autoCtrlValues = 0;
- }
+
+ rep = (xkbPerClientFlagsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .supported = XkbPCF_AllFlagsMask,
+ .value = client->xkbClientFlags & XkbPCF_AllFlagsMask,
+ .autoCtrls = interest ? interest->autoCtrls : 0,
+ .autoCtrlValues = interest ? interest->autoCtrlValues : 0,
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.supported);
@@ -5538,7 +5548,7 @@ ProcXkbPerClientFlags(ClientPtr client)
swapl(&rep.autoCtrls);
swapl(&rep.autoCtrlValues);
}
- WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), &rep);
return Success;
}
@@ -5642,18 +5652,19 @@ ProcXkbListComponents(ClientPtr client)
list.pool = NULL;
return status;
}
- memset(&rep, 0, sizeof(xkbListComponentsReply));
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = XkbPaddedSize(list.nPool) / 4;
- rep.nKeymaps = 0;
- rep.nKeycodes = list.nFound[_XkbListKeycodes];
- rep.nTypes = list.nFound[_XkbListTypes];
- rep.nCompatMaps = list.nFound[_XkbListCompat];
- rep.nSymbols = list.nFound[_XkbListSymbols];
- rep.nGeometries = list.nFound[_XkbListGeometry];
- rep.extra = 0;
+ rep = (xkbListComponentsReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = XkbPaddedSize(list.nPool) / 4,
+ .nKeymaps = 0,
+ .nKeycodes = list.nFound[_XkbListKeycodes],
+ .nTypes = list.nFound[_XkbListTypes],
+ .nCompatMaps = list.nFound[_XkbListCompat],
+ .nSymbols = list.nFound[_XkbListSymbols],
+ .nGeometries = list.nFound[_XkbListGeometry],
+ .extra = 0
+ };
if (list.nTotal > list.maxRtrn)
rep.extra = (list.nTotal - list.maxRtrn);
if (client->swapped) {
@@ -5667,9 +5678,9 @@ ProcXkbListComponents(ClientPtr client)
swaps(&rep.nGeometries);
swaps(&rep.extra);
}
- WriteToClient(client, SIZEOF(xkbListComponentsReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbListComponentsReply), &rep);
if (list.nPool && list.pool) {
- WriteToClient(client, XkbPaddedSize(list.nPool), (char *) list.pool);
+ WriteToClient(client, XkbPaddedSize(list.nPool), list.pool);
free(list.pool);
list.pool = NULL;
}
@@ -5939,7 +5950,7 @@ ProcXkbGetKbdByName(ClientPtr client)
swaps(&rep.found);
swaps(&rep.reported);
}
- WriteToClient(client, SIZEOF(xkbGetKbdByNameReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbGetKbdByNameReply), &rep);
if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask))
XkbSendMap(client, new, &mrep);
if (reported & XkbGBN_CompatMapMask)
@@ -6136,7 +6147,7 @@ SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
swapl(&wire.physIndicators);
swapl(&wire.state);
}
- WriteToClient(client, SIZEOF(xkbDeviceLedsWireDesc), (char *) &wire);
+ WriteToClient(client, SIZEOF(xkbDeviceLedsWireDesc), &wire);
length += SIZEOF(xkbDeviceLedsWireDesc);
if (sli->namesPresent | sli->mapsPresent) {
register unsigned i, bit;
@@ -6150,7 +6161,7 @@ SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
if (client->swapped) {
swapl(&awire);
}
- WriteToClient(client, 4, (char *) &awire);
+ WriteToClient(client, 4, &awire);
length += 4;
}
}
@@ -6173,7 +6184,7 @@ SendDeviceLedInfo(XkbSrvLedInfoPtr sli, ClientPtr client)
swapl(&iwire.ctrls);
}
WriteToClient(client, SIZEOF(xkbIndicatorMapWireDesc),
- (char *) &iwire);
+ &iwire);
length += SIZEOF(xkbIndicatorMapWireDesc);
}
}
@@ -6254,37 +6265,29 @@ ProcXkbGetDeviceInfo(ClientPtr client)
wanted &= ~XkbXI_IndicatorsMask;
nameLen = XkbSizeCountedString(dev->name);
- memset((char *) &rep, 0, SIZEOF(xkbGetDeviceInfoReply));
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = nameLen / 4;
- rep.present = wanted;
- rep.supported = XkbXI_AllDeviceFeaturesMask;
- rep.unsupported = 0;
- rep.firstBtnWanted = rep.nBtnsWanted = 0;
- rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
- if (dev->button)
- rep.totalBtns = dev->button->numButtons;
- else
- rep.totalBtns = 0;
- rep.devType = dev->xinput_type;
- rep.hasOwnState = (dev->key && dev->key->xkbInfo);
- rep.nDeviceLedFBs = 0;
- if (dev->kbdfeed)
- rep.dfltKbdFB = dev->kbdfeed->ctrl.id;
- else
- rep.dfltKbdFB = XkbXINone;
- if (dev->leds)
- rep.dfltLedFB = dev->leds->ctrl.id;
- else
- rep.dfltLedFB = XkbXINone;
+ rep = (xkbGetDeviceInfoReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = nameLen / 4,
+ .present = wanted,
+ .supported = XkbXI_AllDeviceFeaturesMask,
+ .unsupported = 0,
+ .nDeviceLedFBs = 0,
+ .firstBtnWanted = 0,
+ .nBtnsWanted = 0,
+ .firstBtnRtrn = 0,
+ .nBtnsRtrn = 0,
+ .totalBtns = dev->button ? dev->button->numButtons : 0,
+ .hasOwnState = (dev->key && dev->key->xkbInfo),
+ .dfltKbdFB = dev->kbdfeed ? dev->kbdfeed->ctrl.id : XkbXINone,
+ .dfltLedFB = dev->leds ? dev->leds->ctrl.id : XkbXINone,
+ .devType = dev->xinput_type
+ };
ledClass = stuff->ledClass;
ledID = stuff->ledID;
- rep.firstBtnWanted = rep.nBtnsWanted = 0;
- rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
if (wanted & XkbXI_ButtonActionsMask) {
if (stuff->allBtns) {
stuff->firstBtn = 0;
@@ -6343,7 +6346,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
swaps(&rep.dfltLedFB);
swapl(&rep.devType);
}
- WriteToClient(client, SIZEOF(xkbGetDeviceInfoReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbGetDeviceInfoReply), &rep);
str = malloc(nameLen);
if (!str)
@@ -6359,7 +6362,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
sz = rep.nBtnsRtrn * SIZEOF(xkbActionWireDesc);
awire = (xkbActionWireDesc *) & dev->button->xkb_acts[rep.firstBtnRtrn];
- WriteToClient(client, sz, (char *) awire);
+ WriteToClient(client, sz, awire);
length -= sz;
}
if (nDeviceLedFBs > 0) {
@@ -6746,13 +6749,15 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
xkbDebugFlags = newFlags;
xkbDebugCtrls = newCtrls;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.currentFlags = newFlags;
- rep.currentCtrls = newCtrls;
- rep.supportedFlags = ~0;
- rep.supportedCtrls = ~0;
+ rep = (xkbSetDebuggingFlagsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .currentFlags = newFlags,
+ .currentCtrls = newCtrls,
+ .supportedFlags = ~0,
+ .supportedCtrls = ~0
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.currentFlags);
@@ -6760,7 +6765,7 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
swapl(&rep.supportedFlags);
swapl(&rep.supportedCtrls);
}
- WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), (char *) &rep);
+ WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), &rep);
return Success;
}
diff --git a/xorg-server/xkb/xkb.h b/xorg-server/xkb/xkb.h
index 328ac8f00..f3a60af6b 100644
--- a/xorg-server/xkb/xkb.h
+++ b/xorg-server/xkb/xkb.h
@@ -1,32 +1,30 @@
-#ifndef _XKB_H
-#define _XKB_H
-
-extern int ProcXkbUseExtension(ClientPtr client);
-extern int ProcXkbSelectEvents(ClientPtr client);
-extern int ProcXkbBell(ClientPtr client);
-extern int ProcXkbGetState(ClientPtr client);
-extern int ProcXkbLatchLockState(ClientPtr client);
-extern int ProcXkbGetControls(ClientPtr client);
-extern int ProcXkbSetControls(ClientPtr client);
-extern int ProcXkbGetMap(ClientPtr client);
-extern int ProcXkbSetMap(ClientPtr client);
-extern int ProcXkbGetCompatMap(ClientPtr client);
-extern int ProcXkbSetCompatMap(ClientPtr client);
-extern int ProcXkbGetIndicatorState(ClientPtr client);
-extern int ProcXkbGetIndicatorMap(ClientPtr client);
-extern int ProcXkbSetIndicatorMap(ClientPtr client);
-extern int ProcXkbGetNamedIndicator(ClientPtr client);
-extern int ProcXkbSetNamedIndicator(ClientPtr client);
-extern int ProcXkbGetNames(ClientPtr client);
-extern int ProcXkbSetNames(ClientPtr client);
-extern int ProcXkbGetGeometry(ClientPtr client);
-extern int ProcXkbSetGeometry(ClientPtr client);
-extern int ProcXkbPerClientFlags(ClientPtr client);
-extern int ProcXkbListComponents(ClientPtr client);
-extern int ProcXkbGetKbdByName(ClientPtr client);
-extern int ProcXkbGetDeviceInfo(ClientPtr client);
-extern int ProcXkbSetDeviceInfo(ClientPtr client);
-extern int ProcXkbSetDebuggingFlags(ClientPtr client);
-
-extern void XkbExtensionInit(void);
-#endif
+#ifndef _XKB_H
+#define _XKB_H
+
+extern int ProcXkbUseExtension(ClientPtr client);
+extern int ProcXkbSelectEvents(ClientPtr client);
+extern int ProcXkbBell(ClientPtr client);
+extern int ProcXkbGetState(ClientPtr client);
+extern int ProcXkbLatchLockState(ClientPtr client);
+extern int ProcXkbGetControls(ClientPtr client);
+extern int ProcXkbSetControls(ClientPtr client);
+extern int ProcXkbGetMap(ClientPtr client);
+extern int ProcXkbSetMap(ClientPtr client);
+extern int ProcXkbGetCompatMap(ClientPtr client);
+extern int ProcXkbSetCompatMap(ClientPtr client);
+extern int ProcXkbGetIndicatorState(ClientPtr client);
+extern int ProcXkbGetIndicatorMap(ClientPtr client);
+extern int ProcXkbSetIndicatorMap(ClientPtr client);
+extern int ProcXkbGetNamedIndicator(ClientPtr client);
+extern int ProcXkbSetNamedIndicator(ClientPtr client);
+extern int ProcXkbGetNames(ClientPtr client);
+extern int ProcXkbSetNames(ClientPtr client);
+extern int ProcXkbGetGeometry(ClientPtr client);
+extern int ProcXkbSetGeometry(ClientPtr client);
+extern int ProcXkbPerClientFlags(ClientPtr client);
+extern int ProcXkbListComponents(ClientPtr client);
+extern int ProcXkbGetKbdByName(ClientPtr client);
+extern int ProcXkbGetDeviceInfo(ClientPtr client);
+extern int ProcXkbSetDeviceInfo(ClientPtr client);
+extern int ProcXkbSetDebuggingFlags(ClientPtr client);
+#endif
diff --git a/xorg-server/xkb/xkbEvents.c b/xorg-server/xkb/xkbEvents.c
index d49e4c1ba..87a4485eb 100644
--- a/xorg-server/xkb/xkbEvents.c
+++ b/xorg-server/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);
}
@@ -243,7 +250,7 @@ XkbSendStateNotify(DeviceIntPtr kbd, xkbStateNotify * pSN)
swaps(&pSN->changed);
swaps(&pSN->ptrBtnState);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pSN);
+ WriteToClient(interest->client, sizeof(xEvent), pSN);
}
interest = interest->next;
}
@@ -416,7 +423,7 @@ XkbSendControlsNotify(DeviceIntPtr kbd, xkbControlsNotify * pCN)
swapl(&pCN->enabledControlChanges);
swapl(&pCN->time);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pCN);
+ WriteToClient(interest->client, sizeof(xEvent), pCN);
}
interest = interest->next;
}
@@ -463,7 +470,7 @@ XkbSendIndicatorNotify(DeviceIntPtr kbd, int xkbType, xkbIndicatorNotify * pEv)
swapl(&pEv->changed);
swapl(&pEv->state);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ WriteToClient(interest->client, sizeof(xEvent), pEv);
}
interest = interest->next;
}
@@ -550,7 +557,7 @@ XkbHandleBell(BOOL force,
swapl(&bn.name);
swapl(&bn.window);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) &bn);
+ WriteToClient(interest->client, sizeof(xEvent), &bn);
}
interest = interest->next;
}
@@ -594,7 +601,7 @@ XkbSendAccessXNotify(DeviceIntPtr kbd, xkbAccessXNotify * pEv)
swaps(&pEv->slowKeysDelay);
swaps(&pEv->debounceDelay);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ WriteToClient(interest->client, sizeof(xEvent), pEv);
}
interest = interest->next;
}
@@ -642,7 +649,7 @@ XkbSendNamesNotify(DeviceIntPtr kbd, xkbNamesNotify * pEv)
swapl(&pEv->changedIndicators);
swaps(&pEv->changedVirtualMods);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ WriteToClient(interest->client, sizeof(xEvent), pEv);
}
interest = interest->next;
}
@@ -689,7 +696,7 @@ XkbSendCompatMapNotify(DeviceIntPtr kbd, xkbCompatMapNotify * pEv)
swaps(&pEv->nSI);
swaps(&pEv->nTotalSI);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ WriteToClient(interest->client, sizeof(xEvent), pEv);
}
interest = interest->next;
}
@@ -732,7 +739,7 @@ XkbSendActionMessage(DeviceIntPtr kbd, xkbActionMessage * pEv)
swaps(&pEv->sequenceNumber);
swapl(&pEv->time);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ WriteToClient(interest->client, sizeof(xEvent), pEv);
}
interest = interest->next;
}
@@ -786,7 +793,7 @@ XkbSendExtensionDeviceNotify(DeviceIntPtr dev,
swaps(&pEv->reason);
swaps(&pEv->supported);
}
- WriteToClient(interest->client, sizeof(xEvent), (char *) pEv);
+ WriteToClient(interest->client, sizeof(xEvent), pEv);
}
interest = interest->next;
}
diff --git a/xorg-server/xkb/xkbgeom.h b/xorg-server/xkb/xkbgeom.h
index bef3775db..1999f5c71 100644
--- a/xorg-server/xkb/xkbgeom.h
+++ b/xorg-server/xkb/xkbgeom.h
@@ -41,28 +41,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XkbAddGeomRow SrvXkbAddGeomRow
#define XkbAddGeomSection SrvXkbAddGeomSection
#define XkbAddGeomShape SrvXkbAddGeomShape
-#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases
-#define XkbAllocGeomColors SrvXkbAllocGeomColors
-#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads
-#define XkbAllocGeomKeys SrvXkbAllocGeomKeys
-#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines
-#define XkbAllocGeomPoints SrvXkbAllocGeomPoints
-#define XkbAllocGeomProps SrvXkbAllocGeomProps
-#define XkbAllocGeomRows SrvXkbAllocGeomRows
-#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads
-#define XkbAllocGeomSections SrvXkbAllocGeomSections
-#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays
-#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows
-#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys
-#define XkbAllocGeomShapes SrvXkbAllocGeomShapes
#define XkbAllocGeometry SrvXkbAllocGeometry
#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases
#define XkbFreeGeomColors SrvXkbFreeGeomColors
#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads
#define XkbFreeGeomProperties SrvXkbFreeGeomProperties
-#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys
-#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows
-#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays
#define XkbFreeGeomKeys SrvXkbFreeGeomKeys
#define XkbFreeGeomRows SrvXkbFreeGeomRows
#define XkbFreeGeomSections SrvXkbFreeGeomSections