diff options
author | ericm <ericm> | 2000-04-10 22:43:11 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-04-10 22:43:11 (GMT) |
commit | d18c89755234173b73aa739b7a51e75618b6e534 (patch) | |
tree | 520393cf07e5b8085d9682bd1f974c1f06db4115 /generic/tkBind.c | |
parent | 5a779544857025669c6e9f823fd1b7dd7baf413f (diff) | |
download | tk-d18c89755234173b73aa739b7a51e75618b6e534.zip tk-d18c89755234173b73aa739b7a51e75618b6e534.tar.gz tk-d18c89755234173b73aa739b7a51e75618b6e534.tar.bz2 |
* tests/event.test: Added test for [event generate $widget
<Alt-z>] [Bug: 4611].
* tests/choosedir.test: Changed "namespace import ::tcltest" to
"namespace import -force ::tcltest".
* win/tkWinKey.c:
* unix/tkUnixKey.c:
* mac/tkMacKeyboard.c: Changed InitKeymapInfo to
TkpInitKeymapInfo. [Bug: 4611].
* generic/tkStubInit.c:
* generic/tkIntDecls.h: Re-gen'd from tkInt.decls.
* generic/tkInt.decls: Added TkpInitKeymapInfo to list of function
decls.
* generic/tkBind.c (HandleEventGenerate): Added code to initialize
keymap info if necessary, and to correctly set modifier bits in
XEvent structure create to handle [event generate] calls.
Previously, the alt/meta bits were not set correctly, so [event
generate $widget <Alt-z>] would always fail. [Bug: 4611]
Diffstat (limited to 'generic/tkBind.c')
-rw-r--r-- | generic/tkBind.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index d54acfa..172f754 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.11 2000/02/09 02:13:50 hobbs Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.12 2000/04/10 22:43:11 ericm Exp $ */ #include "tkPort.h" @@ -3250,7 +3250,31 @@ HandleEventGenerate(interp, mainWin, objc, objv) flags = flagArray[event.xany.type]; if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) { - event.xkey.state = pat.needMods; + int eventState; + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + /* + * Refresh the mapping information if it's stale + */ + + if (dispPtr->bindInfoStale) { + TkpInitKeymapInfo(dispPtr); + } + + eventState = pat.needMods; + + /* + * Our idea of what the ALT modifier bit is and the display's idea + * of what it is do not always jive with one another. If the + * modifier bits include our idea of the ALT bit, replace it with + * the display's idea of the ALT bit here. Same for the META bit. + */ + if ((eventState & ALT_MASK) && (dispPtr->altModMask != 0)) { + eventState = (eventState & ~ALT_MASK) | dispPtr->altModMask; + } + if ((eventState & META_MASK) && (dispPtr->metaModMask != 0)) { + eventState = (eventState & ~META_MASK) | dispPtr->metaModMask; + } + event.xkey.state = eventState; if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) { TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event); } else if (flags & BUTTON) { |