xkb: Allow NULL as rulesFile in XkbSetRulesDflts.
If no rules file is given, simply re-use the previous one. If no RF is given the first time this function is called, use the built-in default. This includes fixing the built-in default to something that actually exists. Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
This commit is contained in:
		
							parent
							
								
									e670fd8896
								
							
						
					
					
						commit
						463e02e7de
					
				| 
						 | 
					@ -93,7 +93,7 @@ typedef struct	_SrvXkmInfo {
 | 
				
			||||||
#define	XKB_BIN_DIRECTORY	XKB_BASE_DIRECTORY
 | 
					#define	XKB_BIN_DIRECTORY	XKB_BASE_DIRECTORY
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef XKB_DFLT_RULES_FILE
 | 
					#ifndef XKB_DFLT_RULES_FILE
 | 
				
			||||||
#define	XKB_DFLT_RULES_FILE	"rules"
 | 
					#define	XKB_DFLT_RULES_FILE	"base"
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifndef XKB_DFLT_KB_LAYOUT
 | 
					#ifndef XKB_DFLT_KB_LAYOUT
 | 
				
			||||||
#define	XKB_DFLT_KB_LAYOUT	"us"
 | 
					#define	XKB_DFLT_KB_LAYOUT	"us"
 | 
				
			||||||
| 
						 | 
					@ -240,14 +240,33 @@ XkbSetRulesUsed(XkbRF_VarDefsPtr defs)
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Set the default RMLVO for the next device to be initialised.
 | 
				
			||||||
 | 
					 * If a parameter is NULL, the previous setting will be used. Use empty
 | 
				
			||||||
 | 
					 * strings if you want to delete a previous setting.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * If @rulesFile is NULL and no previous @rulesFile has been set, the
 | 
				
			||||||
 | 
					 * built-in default is chosen as default.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
_X_EXPORT void
 | 
					_X_EXPORT void
 | 
				
			||||||
XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
 | 
					XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
 | 
				
			||||||
					char *variant,char *options)
 | 
										char *variant,char *options)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (XkbRulesFile)
 | 
					    if (!rulesFile && !XkbRulesFile)
 | 
				
			||||||
	_XkbFree(XkbRulesFile);
 | 
					    {
 | 
				
			||||||
    XkbRulesFile= _XkbDupString(rulesFile);
 | 
						LogMessage(X_WARNING, "[xkb] No rule given, and no previous rule "
 | 
				
			||||||
    rulesDefined= True;
 | 
							              "defined. Defaulting to '%s'.\n",
 | 
				
			||||||
 | 
					                              XKB_DFLT_RULES_FILE);
 | 
				
			||||||
 | 
						rulesFile = XKB_DFLT_RULES_FILE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (rulesFile) {
 | 
				
			||||||
 | 
						if (XkbRulesFile)
 | 
				
			||||||
 | 
						    _XkbFree(XkbRulesFile);
 | 
				
			||||||
 | 
						XkbRulesFile= _XkbDupString(rulesFile);
 | 
				
			||||||
 | 
						rulesDefined= True;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (model) {
 | 
					    if (model) {
 | 
				
			||||||
	if (XkbModelDflt)
 | 
						if (XkbModelDflt)
 | 
				
			||||||
	    _XkbFree(XkbModelDflt);
 | 
						    _XkbFree(XkbModelDflt);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue