diff options
author | Joe Mistachkin <joe@mistachkin.com> | 2015-02-06 20:22:21 (GMT) |
---|---|---|
committer | Joe Mistachkin <joe@mistachkin.com> | 2015-02-06 20:22:21 (GMT) |
commit | f0eebfaefad9deacf3c033782d6b49b73cea4ce7 (patch) | |
tree | e82d67b61b40bf61b24a8eed52af49c8b50991ba /generic/tkBind.c | |
parent | 13d19756cf0ce7e3255a5d4c9a5efdfae1bc95df (diff) | |
parent | 85827aebcfddf76f4983bb8c6e4fbefbdd6270fd (diff) | |
download | tk-f0eebfaefad9deacf3c033782d6b49b73cea4ce7.zip tk-f0eebfaefad9deacf3c033782d6b49b73cea4ce7.tar.gz tk-f0eebfaefad9deacf3c033782d6b49b73cea4ce7.tar.bz2 |
Add support for an 'M' binding substitution that is replaced with the number of script-based binding patterns matched so far for the event.
Diffstat (limited to 'generic/tkBind.c')
-rw-r--r-- | generic/tkBind.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index fbac56d..35f2795 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -612,7 +612,8 @@ static int DeleteVirtualEvent(Tcl_Interp *interp, const char *eventString); static void DeleteVirtualEventTable(VirtualEventTable *vetPtr); static void ExpandPercents(TkWindow *winPtr, const char *before, - XEvent *eventPtr,KeySym keySym,Tcl_DString *dsPtr); + XEvent *eventPtr,KeySym keySym, + unsigned int scriptCount, Tcl_DString *dsPtr); static PatSeq * FindSequence(Tcl_Interp *interp, Tcl_HashTable *patternTablePtr, ClientData object, const char *eventString, int create, @@ -1221,6 +1222,7 @@ Tk_BindEvent( XEvent *ringPtr; PatSeq *vMatchDetailList, *vMatchNoDetailList; int flags, oldScreen; + unsigned int scriptCount; Tcl_Interp *interp; Tcl_DString scripts; Tcl_InterpState interpState; @@ -1372,6 +1374,7 @@ Tk_BindEvent( * each object. */ + scriptCount = 0; Tcl_DStringInit(&scripts); for ( ; numObjects > 0; numObjects--, objectPtr++) { @@ -1421,7 +1424,7 @@ Tk_BindEvent( if (matchPtr != NULL) { ExpandPercents(winPtr, sourcePtr->script, eventPtr, - detail.keySym, &scripts); + detail.keySym, scriptCount++, &scripts); /* * A "" is added to the scripts string to separate the various @@ -1903,6 +1906,8 @@ ExpandPercents( * in % replacements. */ KeySym keySym, /* KeySym: only relevant for KeyPress and * KeyRelease events). */ + unsigned int scriptCount, /* The number of script-based binding patterns + * matched so far for this event. */ Tcl_DString *dsPtr) /* Dynamic string in which to append new * command. */ { @@ -2184,6 +2189,9 @@ ExpandPercents( } } goto doString; + case 'M': + number = scriptCount; + goto doNumber; case 'N': if ((flags & KEY) && (eventPtr->type != MouseWheelEvent)) { number = (int) keySym; |