[PATCH xserver] Multiple matching modes (incl. regex) selection support in Match* statements

Oleh Nykyforchyn oleh.nyk at gmail.com
Sat Jun 4 14:16:28 PDT 2011


On Fri, 3 Jun 2011 09:22:42 -0500
Dan Nicholson <dbn.lists at gmail.com> wrote:

> > - man page additions please
> 
> Agree completely here. This is getting pretty complex, and I'm really
> curious to see it explained in a manual for people coming in fresh.
> 
Here is a version:

*** xorg.conf.man.orig	2011-06-04 09:39:13.000000000 +0300
--- xorg.conf.man	2011-06-05 00:00:27.000000000 +0300
***************
*** 1069,1088 ****
  .PP
  There are two types of match entries used in
  .B InputClass
! sections. The first allows various tokens to be matched against attributes
! of the device. An entry can be constructed to match attributes from different
! devices by separating arguments with a '|' character. Multiple entries of the
! same type may be supplied to add multiple matching conditions on the same
  attribute. For example:
  .PP
  .RS 4
  .nf
  .B  "Section \*qInputClass\*q"
  .B  "    Identifier   \*qMy Class\*q"
! .B  "    # product string must contain example and
  .B  "    # either gizmo or gadget
! .B  "    MatchProduct \*qexample\*q
! .B  "    MatchProduct \*qgizmo|gadget\*q
  .I  "    ..."
  .B  "EndSection"
  .fi
--- 1069,1099 ----
  .PP
  There are two types of match entries used in
  .B InputClass
! sections. The first allows attributes of the device to be matched against
! various patterns. An entry can be constructed to match attributes from
! different devices by supplying several (at least one) patterns, which are
! applied to each attribute in the order of appearance in the entry. Usually,
! an attribute that matches a pattern is accepted, and further patterns
! are not considered. A pattern prepended with '!' is negated, which means
! that an attribute that matches it is rejected (this does not affect
! attributes accepted by previous patterns). If the end of an entry is
! reached, everything is determined by the last (not matched) pattern: if it
! is negated, the attribute is accepted, otherwise it is rejected.
! 
! Multiple entries of the same type may appear in one
! .B InputClass
! section to add different matching conditions on the same
  attribute. For example:
  .PP
  .RS 4
  .nf
  .B  "Section \*qInputClass\*q"
  .B  "    Identifier   \*qMy Class\*q"
! .B  "    # product string must not contain wrong,
! .B  "    # must contain example, and
  .B  "    # either gizmo or gadget
! .B  "    MatchProduct \*q!wrong\*q \*qexample\*q
! .B  "    MatchProduct \*qgizmo\*q \*qgadget\*q
  .I  "    ..."
  .B  "EndSection"
  .fi
***************
*** 1151,1156 ****
--- 1162,1191 ----
  .B ServerLayout
  sections have been found.
  .PP
+ To apply a more specific condition, e.g. to select devices with product
+ names that start with "Advanced" and end with "Gadget", extended regular
+ expressions (see
+ .BR regex (7)
+ ), prefixed by "regex:", can be used as patterns:
+ .PP
+ .RS 4
+ .nf
+ .B  "    MatchProduct \*qregex:^Advanced.*Gadget$\*q"
+ .fi
+ .RE
+ .PP
+ Finally, it is allowed to join via '|' any sequential patterns, except
+ regular expressions, in which '|' has a special meaning, so a match
+ entry can look like
+ .PP
+ .RS 4
+ .nf
+ .B  "    MatchProduct \*q!regex:^USB\*q \*qOptical Mouse|Touchpad\*q"
+ .fi
+ .RE
+ .PP
+ and select non-USB optical mouses and touchpads.
+ 
  The second type of entry is used to match device types. These entries take a
  boolean argument similar to
  .B Option



Oleh Nykyforchyn <oleh.nyk at gmail.com>


More information about the xorg-devel mailing list