diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-19 22:28:22 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-19 22:28:22 +1000 |
commit | d5ad14c8ed4d8360e1df8cd0bacf6a7c9c31df91 (patch) | |
tree | ff87f5a065f759e6d4ff6b2a869ca0e40299c019 /xkb | |
parent | 54716fd3dbc251db9d251d1d0435942efaa63259 (diff) | |
parent | 0e0642ee9466d3268476d0084a83a9d93a4aa555 (diff) |
Merge branch 'master' into xi2
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbInit.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 1f5f8dc49..5ac06feae 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -111,6 +111,10 @@ static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; /***====================================================================***/ +/** + * Get the current default XKB rules. + * Caller must free the data in rmlvo. + */ void XkbGetRulesDflts(XkbRMLVOSet *rmlvo) { @@ -124,6 +128,30 @@ XkbGetRulesDflts(XkbRMLVOSet *rmlvo) else rmlvo->variant= XKB_DFLT_VARIANT; if (XkbOptionsDflt) rmlvo->options= XkbOptionsDflt; else rmlvo->options= XKB_DFLT_OPTIONS; + + rmlvo->rules = strdup(rmlvo->rules); + rmlvo->model = strdup(rmlvo->model); + rmlvo->layout = strdup(rmlvo->layout); + rmlvo->variant = strdup(rmlvo->variant); + rmlvo->options = strdup(rmlvo->options); +} + +void +XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO) +{ + if (!rmlvo) + return; + + xfree(rmlvo->rules); + xfree(rmlvo->model); + xfree(rmlvo->layout); + xfree(rmlvo->variant); + xfree(rmlvo->options); + + if (freeRMLVO) + xfree(rmlvo); + else + memset(rmlvo, 0, sizeof(XkbRMLVOSet)); } static Bool @@ -474,10 +502,18 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbSrvLedInfoPtr sli; XkbChangesRec changes; XkbEventCauseRec cause; + XkbRMLVOSet rmlvo_dflts = { NULL }; - if (dev->key || dev->kbdfeed || !rmlvo) + if (dev->key || dev->kbdfeed) return False; + if (!rmlvo) + { + rmlvo = &rmlvo_dflts; + XkbGetRulesDflts(rmlvo); + } + + memset(&changes, 0, sizeof(changes)); XkbSetCauseUnknown(&cause); @@ -577,6 +613,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbSetRulesDflts(rmlvo); XkbSetRulesUsed(rmlvo); + XkbFreeRMLVOSet(&rmlvo_dflts, FALSE); return TRUE; |