xfree86: Allow "MatchLayout" statements in config files
Usage example (tested on a dual-seat PC): Section "InputClass" Identifier "keyboard-all" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" MatchLayout "!GeForce|!Matrox" Driver "evdev" Option "XkbLayout" "us" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSection It disables auto keyboard configuration for layouts "GeForce" and "Matrox". Note that "" in patterns means "no Layout sections found", e.g. MatchLayout "GeForce|" is "in layout GeForce or without explicit layout at all". Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Dan Nicholson <dbn.lists@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Peter Hutterer
parent
83c059f034
commit
c05c8640f1
@@ -52,6 +52,7 @@ xf86ConfigSymTabRec InputClassTab[] =
|
||||
{MATCH_USBID, "matchusbid"},
|
||||
{MATCH_DRIVER, "matchdriver"},
|
||||
{MATCH_TAG, "matchtag"},
|
||||
{MATCH_LAYOUT, "matchlayout"},
|
||||
{MATCH_IS_KEYBOARD, "matchiskeyboard"},
|
||||
{MATCH_IS_POINTER, "matchispointer"},
|
||||
{MATCH_IS_JOYSTICK, "matchisjoystick"},
|
||||
@@ -94,6 +95,7 @@ xf86parseInputClassSection(void)
|
||||
list_init(&ptr->match_usbid);
|
||||
list_init(&ptr->match_driver);
|
||||
list_init(&ptr->match_tag);
|
||||
list_init(&ptr->match_layout);
|
||||
|
||||
while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
|
||||
switch (token) {
|
||||
@@ -169,6 +171,12 @@ xf86parseInputClassSection(void)
|
||||
add_group_entry(&ptr->match_tag,
|
||||
xstrtokenize(val.str, TOKEN_SEP));
|
||||
break;
|
||||
case MATCH_LAYOUT:
|
||||
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
||||
Error(QUOTE_MSG, "MatchLayout");
|
||||
add_group_entry(&ptr->match_layout,
|
||||
xstrtokenize(val.str, TOKEN_SEP));
|
||||
break;
|
||||
case MATCH_IS_KEYBOARD:
|
||||
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
||||
Error(QUOTE_MSG, "MatchIsKeyboard");
|
||||
@@ -307,6 +315,13 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
|
||||
*cur);
|
||||
fprintf(cf, "\"\n");
|
||||
}
|
||||
list_for_each_entry(group, &ptr->match_layout, entry) {
|
||||
fprintf(cf, "\tMatchLayout \"");
|
||||
for (cur = group->values; *cur; cur++)
|
||||
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
|
||||
*cur);
|
||||
fprintf(cf, "\"\n");
|
||||
}
|
||||
|
||||
if (ptr->is_keyboard.set)
|
||||
fprintf(cf, "\tIsKeyboard \"%s\"\n",
|
||||
@@ -392,6 +407,12 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr)
|
||||
free(*list);
|
||||
free(group);
|
||||
}
|
||||
list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
|
||||
list_del(&group->entry);
|
||||
for (list = group->values; *list; list++)
|
||||
free(*list);
|
||||
free(group);
|
||||
}
|
||||
|
||||
TestFree(ptr->comment);
|
||||
xf86optionListFree(ptr->option_lst);
|
||||
|
||||
Reference in New Issue
Block a user