summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-02-18 12:20:26 -0800
committerKeith Packard <keithp@keithp.com>2011-02-18 12:20:26 -0800
commit816d67de2ba9bdfe652da32cb6447a3056342b98 (patch)
treec56f279f6772439932f28d0686a58a6596b5f184
parenta73c28f0bdafb1c5cb8129179188a99c0ca052e2 (diff)
parent3bbb70a1a7b24d3d1375b20a13db7011cf961c86 (diff)
Merge remote branch 'whot/for-keith'
-rw-r--r--Xi/xiproperty.c2
-rw-r--r--Xi/xiquerypointer.c2
-rw-r--r--hw/xfree86/common/xf86Init.c2
-rw-r--r--include/exevents.h2
-rw-r--r--randr/rrdispatch.c2
-rw-r--r--randr/rrmode.c2
-rw-r--r--xfixes/cursor.c2
-rw-r--r--xkb/ddxLoad.c76
-rw-r--r--xkb/xkb.c16
9 files changed, 75 insertions, 31 deletions
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index b9f53f7dc..17835e2cd 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -701,7 +701,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
int
XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
int format, int mode, unsigned long len,
- pointer value, Bool sendevent)
+ const pointer value, Bool sendevent)
{
XIPropertyPtr prop;
int size_in_bytes;
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index b521c48ef..8df958ea2 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -129,7 +129,7 @@ ProcXIQueryPointer(ClientPtr client)
if (kbd)
{
- state = &kbd->key->xkbInfo->prev_state;
+ state = &kbd->key->xkbInfo->state;
rep.mods.base_mods = state->base_mods;
rep.mods.latched_mods = state->latched_mods;
rep.mods.locked_mods = state->locked_mods;
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index a1fda54cd..e664ce451 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -808,7 +808,7 @@ InitInput(int argc, char **argv)
GetEventList(&xf86Events);
- /* Call the PreInit function for each input device instance. */
+ /* Initialize all configured input devices */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
/* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
diff --git a/include/exevents.h b/include/exevents.h
index dc594304f..2b226986b 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -69,7 +69,7 @@ extern _X_EXPORT int XIChangeDeviceProperty(
int /* format*/,
int /* mode*/,
unsigned long /* len*/,
- pointer /* value*/,
+ const pointer /* value*/,
Bool /* sendevent*/
);
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index aed746bac..b0b451c2a 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -35,7 +35,7 @@ RRClientKnowsRates (ClientPtr pClient)
static int
ProcRRQueryVersion (ClientPtr client)
{
- xRRQueryVersionReply rep;
+ xRRQueryVersionReply rep = {0};
register int n;
REQUEST(xRRQueryVersionReq);
rrClientPriv(client);
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 5ffa4006f..d7560dcb2 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -288,7 +288,7 @@ int
ProcRRCreateMode (ClientPtr client)
{
REQUEST(xRRCreateModeReq);
- xRRCreateModeReply rep;
+ xRRCreateModeReply rep = {0};
WindowPtr pWin;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 54e5d755e..fb608f694 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1045,7 +1045,7 @@ XFixesCursorInit (void)
ScreenPtr pScreen = screenInfo.screens[i];
CursorScreenPtr cs;
- cs = (CursorScreenPtr) malloc(sizeof (CursorScreenRec));
+ cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
if (!cs)
return FALSE;
Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 51b577725..ac587fc9d 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -425,35 +425,79 @@ XkbRF_RulesPtr rules;
return complete;
}
-XkbDescPtr
-XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
+static Bool
+XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccgst)
{
- XkbComponentNamesRec kccgst;
XkbRF_VarDefsRec mlvo;
- XkbDescPtr xkb;
- char name[PATH_MAX];
-
- if (!dev || !rmlvo) {
- LogMessage(X_ERROR, "XKB: No device or RMLVO specified\n");
- return NULL;
- }
mlvo.model = rmlvo->model;
mlvo.layout = rmlvo->layout;
mlvo.variant = rmlvo->variant;
mlvo.options = rmlvo->options;
- /* XDNFR already logs for us. */
- if (!XkbDDXNamesFromRules(dev, rmlvo->rules, &mlvo, &kccgst))
+ return XkbDDXNamesFromRules(dev, rmlvo->rules, &mlvo, kccgst);
+}
+
+/**
+ * Compile the given RMLVO keymap and return it. Returns the XkbDescPtr on
+ * success or NULL on failure. If the components compiled are not a superset
+ * or equal to need, the compiliation is treated as failure.
+ */
+static XkbDescPtr
+XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
+{
+ XkbDescPtr xkb;
+ unsigned int provided;
+ XkbComponentNamesRec kccgst;
+ char name[PATH_MAX];
+
+ if (!XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst))
return NULL;
- /* XDLKBN too, but it might return 0 as well as allocating. */
- if (!XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, 0, &xkb, name,
- PATH_MAX)) {
- if (xkb)
+ provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
+ &xkb, name, PATH_MAX);
+ if ((need & provided) != need) {
+ if (xkb) {
XkbFreeKeyboard(xkb, 0, TRUE);
+ xkb = NULL;
+ }
+ }
+
+ return xkb;
+}
+
+XkbDescPtr
+XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
+{
+ XkbDescPtr xkb;
+ unsigned int need;
+
+ if (!dev || !rmlvo) {
+ LogMessage(X_ERROR, "XKB: No device or RMLVO specified\n");
return NULL;
}
+ /* These are the components we really really need */
+ need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
+ XkmKeyNamesMask | XkmVirtualModsMask;
+
+
+ xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
+
+ if (!xkb) {
+ XkbRMLVOSet dflts;
+
+ /* we didn't get what we really needed. And that will likely leave
+ * us with a keyboard that doesn't work. Use the defaults instead */
+ LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
+ "keymap instead.\n");
+
+ XkbGetRulesDflts(&dflts);
+
+ xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+
+ XkbFreeRMLVOSet(&dflts, FALSE);
+ }
+
return xkb;
}
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 6fd66c5e5..a57139f35 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -3644,7 +3644,7 @@ register int n;
swapl(&rep->indicators,n);
}
- start = desc = malloc(length);
+ start = desc = calloc(1, length);
if ( !start )
return BadAlloc;
if (xkb->names) {
@@ -5569,13 +5569,13 @@ ProcXkbGetKbdByName(ClientPtr client)
{
DeviceIntPtr dev;
DeviceIntPtr tmpd;
- xkbGetKbdByNameReply rep;
- xkbGetMapReply mrep;
- xkbGetCompatMapReply crep;
- xkbGetIndicatorMapReply irep;
- xkbGetNamesReply nrep;
- xkbGetGeometryReply grep;
- XkbComponentNamesRec names;
+ xkbGetKbdByNameReply rep = {0};
+ xkbGetMapReply mrep = {0};
+ xkbGetCompatMapReply crep = {0};
+ xkbGetIndicatorMapReply irep = {0};
+ xkbGetNamesReply nrep = {0};
+ xkbGetGeometryReply grep = {0};
+ XkbComponentNamesRec names = {0};
XkbDescPtr xkb, new;
unsigned char * str;
char mapFile[PATH_MAX];