From ddf3b09bb262d01b56fbaade421ac85b0e60a69f Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 3 Feb 2015 13:23:50 -0500 Subject: [PATCH] compose: fix the description of modifiers in compose sequences 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 Signed-off-by: James Cloos --- 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 13ba705f..6a8a9668 100644 --- a/man/Compose.man +++ b/man/Compose.man @@ -88,16 +88,18 @@ comment at the end of the line: .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: diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c index e9d5f7b7..9bb45ff3 100644 --- a/modules/im/ximcp/imLcPrs.c +++ b/modules/im/ximcp/imLcPrs.c @@ -68,8 +68,9 @@ static void parsestringfile(FILE *fp, Xim im, int depth); * COMMENT ::= "#" {} * 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