[PATCH libX11 2/2] compose: fix the description of modifiers in compose sequences

Ran Benita ran234 at gmail.com
Tue Feb 3 10:23:50 PST 2015


The Compose format has a feature which allows specifying certain
modifiers must (or must not) be present with a given keysym in the
sequence.

The grammar in imLcPrs.c and the Compose man page both do not match what
the code actually does (see the handling of the variables
`modifier_mask` and `modifier` in parseline() in imLcPrs.c, which are
eventually matched as `ev->state & modifier_mask == modifier`).

Also explicitly list the accepted modifier names, since they are
not standard (e.g. "Ctrl" instead of "Control").

Signed-off-by: Ran Benita <ran234 at gmail.com>
---
 man/Compose.man            | 16 +++++++++-------
 modules/im/ximcp/imLcPrs.c |  5 +++--
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/man/Compose.man b/man/Compose.man
index 13ba705..6a8a966 100644
--- a/man/Compose.man
+++ b/man/Compose.man
@@ -81,30 +81,32 @@ compose rules can be added, and previous ones replaced.
 Compose files are plain text files, with a separate line for each compose
 sequence.   Comments begin with \fB#\fP characters.   Each compose sequence
 specifies one or more events and a resulting input sequence, with an optional
 comment at the end of the line:
 .RS
 \fIEVENT\fP [\fIEVENT\fP...] \fB:\fP \fIRESULT\fP [\fB#\fP \fICOMMENT\fP]
 .RE
 .PP
 Each event consists of a specified input keysym, and optional modifier states:
 .RS
-[\fIMODIFIER_LIST\fP] \fB<\fP\fIkeysym\fP\fB>\fP
+[([\fB!\fP] ([\fB~\fP] \fIMODIFIER\fP)...) | \fBNone\fP] \fB<\fP\fIkeysym\fP\fB>\fP
 .RE
 .PP
-Each modifier consists of a specified modifier and a state:
-.RS
-(\fB!\fP \fIMODIFIER\fP ) | \fBNone\fP
-.RE
-Modifiers may be preceded by a
+If the modifier list is preceded by
+.RB \*q "!" \*q
+it must match exactly.
+MODIFIER may be one of Ctrl, Lock, Caps, Shift, Alt or Meta.
+Each modifier may be preceded by a
 .RB \*q "~" \*q
-character to indicate that the modifier must not be present.
+character to indicate that the modifier must not be present. If
+.RB \*q "None" \*q
+is specified, no modifier may be present.
 .PP
 The result specifies a string, keysym, or both, that the X client receives
 as input when the sequence of events is input:
 .RS
 \fB\*q\fP\fISTRING\fP\fB\*q\fP | \fIkeysym\fP | \fB\*q\fP\fISTRING\fP\fB\*q\fP \fIkeysym\fP
 .RE
 .PP
 Keysyms are specified without the \fBXK_\fP prefix.
 .PP
 Strings may be direct text encoded in the locale for which the compose file is
diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c
index e9d5f7b..9bb45ff 100644
--- a/modules/im/ximcp/imLcPrs.c
+++ b/modules/im/ximcp/imLcPrs.c
@@ -61,22 +61,23 @@ extern int _Xmbstoutf8(
 static void parsestringfile(FILE *fp, Xim im, int depth);
 
 /*
  *	Parsing File Format:
  *
  *	FILE          ::= { [PRODUCTION] [COMMENT] "\n"}
  *	PRODUCTION    ::= LHS ":" RHS [ COMMENT ]
  *	COMMENT       ::= "#" {<any character except null or newline>}
  *	LHS           ::= EVENT { EVENT }
  *	EVENT         ::= [MODIFIER_LIST] "<" keysym ">"
- *	MODIFIER_LIST ::= ("!" {MODIFIER} ) | "None"
- *	MODIFIER      ::= ["~"] modifier_name
+ *	MODIFIER_LIST ::= (["!"] {MODIFIER} ) | "None"
+ *	MODIFIER      ::= ["~"] MODIFIER_NAME
+ *	MODIFIER_NAME ::= ("Ctrl"|"Lock"|"Caps"|"Shift"|"Alt"|"Meta")
  *	RHS           ::= ( STRING | keysym | STRING keysym )
  *	STRING        ::= '"' { CHAR } '"'
  *	CHAR          ::= GRAPHIC_CHAR | ESCAPED_CHAR
  *	GRAPHIC_CHAR  ::= locale (codeset) dependent code
  *	ESCAPED_CHAR  ::= ('\\' | '\"' | OCTAL | HEX )
  *	OCTAL         ::= '\' OCTAL_CHAR [OCTAL_CHAR [OCTAL_CHAR]]
  *	OCTAL_CHAR    ::= (0|1|2|3|4|5|6|7)
  *	HEX           ::= '\' (x|X) HEX_CHAR [HEX_CHAR]]
  *	HEX_CHAR      ::= (0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|a|b|c|d|e|f)
  *
-- 
2.2.2



More information about the xorg-devel mailing list