-relief flat
tk_bindForTraversal $win.topframe.controls.update
bind $win.topframe.controls.update <F10> {tk_firstMenu %W}
- bind $win.topframe.controls.update <Mod2-Key> {tk_traverseToMenu %W %A}
+ bind $win.topframe.controls.update <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.topframe.controls.update
SetHelp $win.topframe.controls.update Editor.Display
-font [Font $win Medium]
tk_bindForTraversal $win.topframe.controls.update.m
bind $win.topframe.controls.update.m <F10> {tk_firstMenu %W}
- bind $win.topframe.controls.update.m <Mod2-Key> {tk_traverseToMenu %W %A}
+ bind $win.topframe.controls.update.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.topframe.controls.update.m add radiobutton\
-label {Always}\
-variable Skip.$win\
-relief flat
tk_bindForTraversal $win.topframe.controls.options
bind $win.topframe.controls.options <F10> {tk_firstMenu %W}
-bind $win.topframe.controls.options <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.topframe.controls.options <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.topframe.controls.options
SetHelp $win.topframe.controls.options Editor.Options
-font [Font $win Medium]
tk_bindForTraversal $win.topframe.controls.options.m
bind $win.topframe.controls.options.m <F10> {tk_firstMenu %W}
-bind $win.topframe.controls.options.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.topframe.controls.options.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.topframe.controls.options.m add checkbutton\
-label {Auto Goto}\
-variable AutoGoto.$win\
tk_bindForTraversal $win
bind $win <F10> {tk_firstMenu %W}
-bind $win <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win <Alt-Key> {tk_traverseToMenu %W %A}
wm title $win "Micropolis Controls"
wm iconname $win {Micropolis Controls}
-relief raised
tk_bindForTraversal $win.col1.w1.f1
bind $win.col1.w1.f1 <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1 <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1 <Alt-Key> {tk_traverseToMenu %W %A}
SetHelp $win.col1.w1.f1.micropolis Head.MicropolisMenu
-variable $win.postedMenu
tk_bindForTraversal $win.col1.w1.f1.micropolis
bind $win.col1.w1.f1.micropolis <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.micropolis <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.micropolis <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.col1.w1.f1.micropolis
-font [Font $win Medium]
tk_bindForTraversal $win.col1.w1.f1.micropolis.m
bind $win.col1.w1.f1.micropolis.m <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.micropolis.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.micropolis.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.col1.w1.f1.micropolis.m add command\
-label {About...}\
-command "UIShowPicture 300"
-variable $win.postedMenu
tk_bindForTraversal $win.col1.w1.f1.options
bind $win.col1.w1.f1.options <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.options <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.options <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.col1.w1.f1.options
-font [Font $win Medium]
tk_bindForTraversal $win.col1.w1.f1.options.m
bind $win.col1.w1.f1.options.m <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.options.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.options.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.col1.w1.f1.options.m add checkbutton\
-label {Auto Budget}\
-variable AutoBudget\
-variable $win.postedMenu
tk_bindForTraversal $win.col1.w1.f1.disasters
bind $win.col1.w1.f1.disasters <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.disasters <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.disasters <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.col1.w1.f1.disasters
-font [Font $win Medium]
tk_bindForTraversal $win.col1.w1.f1.disasters.m
bind $win.col1.w1.f1.disasters.m <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.disasters.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.disasters.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.col1.w1.f1.disasters.m add command\
-label {Monster}\
-command "UIDisaster $win \"UIMakeMonster\" \"release a monster?\""
-variable $win.postedMenu
tk_bindForTraversal $win.col1.w1.f1.priority
bind $win.col1.w1.f1.priority <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.priority <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.priority <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.col1.w1.f1.priority
-font [Font $win Medium]
tk_bindForTraversal $win.col1.w1.f1.priority.m
bind $win.col1.w1.f1.priority.m <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.priority.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.priority.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.col1.w1.f1.priority.m add radiobutton\
-label {Super Fast}\
-command {SetPriority 4}\
-variable $win.postedMenu
tk_bindForTraversal $win.col1.w1.f1.windows
bind $win.col1.w1.f1.windows <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.windows <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.windows <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.col1.w1.f1.windows
-font [Font $win Medium]
tk_bindForTraversal $win.col1.w1.f1.windows.m
bind $win.col1.w1.f1.windows.m <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f1.windows.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f1.windows.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.col1.w1.f1.windows.m add command\
-label {Budget}\
-command "UIShowBudgetAndWait"
-relief flat
tk_bindForTraversal $win.col1.w1.f2.f2
bind $win.col1.w1.f2.f2 <F10> {tk_firstMenu %W}
-bind $win.col1.w1.f2.f2 <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.col1.w1.f2.f2 <Alt-Key> {tk_traverseToMenu %W %A}
SetHelp $win.col1.w1.f2.f2 Head.Log
-relief flat
tk_bindForTraversal $win.col1.w1.f2.f3
bind $win.col1.w1.f2.f3 <F10> {tk_firstMenu %W}
- bind $win.col1.w1.f2.f3 <Mod2-Key> {tk_traverseToMenu %W %A}
+ bind $win.col1.w1.f2.f3 <Alt-Key> {tk_traverseToMenu %W %A}
button $win.col1.w1.f2.f3.chat \
-font [Font $win Large] \
set $win.col1.w1.f2.f3.entry.value ""
tk_bindForTraversal $win.col1.w1.f2.f3.entry
bind $win.col1.w1.f2.f3.entry <F10> {tk_firstMenu %W}
- bind $win.col1.w1.f2.f3.entry <Mod2-Key> {tk_traverseToMenu %W %A}
+ bind $win.col1.w1.f2.f3.entry <Alt-Key> {tk_traverseToMenu %W %A}
bind $win.col1.w1.f2.f3.entry <Return> "DoEnterMessage %W %W.value"
bind $win.col1.w1.f2.f3.entry <Escape> "DoEvalMessage %W %W.value"
bind $win.col1.w1.f2.f3.entry <Any-Enter> {focus %W}
LinkWindow $win.zones $win.topframe.zones
tk_bindForTraversal $win.topframe.zones
bind $win.topframe.zones <F10> {tk_firstMenu %W}
-bind $win.topframe.zones <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.topframe.zones <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.topframe.zones
SetHelp $win.topframe.zones Map.Zones
-font [Font $win Medium]
tk_bindForTraversal $win.topframe.zones.m
bind $win.topframe.zones.m <F10> {tk_firstMenu %W}
-bind $win.topframe.zones.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.topframe.zones.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.topframe.zones.m add radiobutton\
-label {All}\
-variable MapState.$win\
LinkWindow $win.overlays $win.topframe.overlays
tk_bindForTraversal $win.topframe.overlays
bind $win.topframe.overlays <F10> {tk_firstMenu %W}
-bind $win.topframe.overlays <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.topframe.overlays <Alt-Key> {tk_traverseToMenu %W %A}
tk_menus $win $win.topframe.overlays
SetHelp $win.topframe.overlays Map.Overlays
-font [Font $win Medium]
tk_bindForTraversal $win.topframe.overlays.m
bind $win.topframe.overlays.m <F10> {tk_firstMenu %W}
-bind $win.topframe.overlays.m <Mod2-Key> {tk_traverseToMenu %W %A}
+bind $win.topframe.overlays.m <Alt-Key> {tk_traverseToMenu %W %A}
$win.topframe.overlays.m add radiobutton\
-label {Population Density}\
-variable MapState.$win\
"Button5", Button5Mask, 0,
"Mod1", Mod1Mask, 0,
"M1", Mod1Mask, 0,
- "Meta", Mod1Mask, 0,
- "M", Mod1Mask, 0,
+ "Meta", META_MASK, 0,
+ "M", META_MASK, 0,
"Mod2", Mod2Mask, 0,
"M2", Mod2Mask, 0,
- "Alt", Mod2Mask, 0,
+ "Alt", ALT_MASK, 0,
"Mod3", Mod3Mask, 0,
"M3", Mod3Mask, 0,
"Mod4", Mod4Mask, 0,
static char * GetField _ANSI_ARGS_((char *p, char *copy, int size));
static KeySym GetKeySym _ANSI_ARGS_((TkDisplay *dispPtr,
XEvent *eventPtr));
-static PatSeq * MatchPatterns _ANSI_ARGS_((BindingTable *bindPtr,
- PatSeq *psPtr));
+static PatSeq * MatchPatterns _ANSI_ARGS_((TkDisplay *dispPtr,
+ BindingTable *bindPtr, PatSeq *psPtr));
\f
/*
*--------------------------------------------------------------
key.detail = detail;
hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key);
if (hPtr != NULL) {
- matchPtr = MatchPatterns(bindPtr,
+ matchPtr = MatchPatterns(dispPtr, bindPtr,
(PatSeq *) Tcl_GetHashValue(hPtr));
}
if ((detail != 0) && (matchPtr == NULL)) {
key.detail = 0;
hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key);
if (hPtr != NULL) {
- matchPtr = MatchPatterns(bindPtr,
+ matchPtr = MatchPatterns(dispPtr, bindPtr,
(PatSeq *) Tcl_GetHashValue(hPtr));
}
}
*/
static PatSeq *
-MatchPatterns(bindPtr, psPtr)
+MatchPatterns(dispPtr, bindPtr, psPtr)
+ TkDisplay *dispPtr;
BindingTable *bindPtr; /* Information about binding table, such
* as ring of recent events. */
register PatSeq *psPtr; /* List of pattern sequences. */
} else {
state = 0;
}
- if ((state & patPtr->needMods)
- != patPtr->needMods) {
- goto nextSequence;
+ if (patPtr->needMods != 0) {
+ int modMask = patPtr->needMods;
+
+ if (!dispPtr->metaModMask && !dispPtr->altModMask && !dispPtr->modeModMask) {
+ int i, max;
+ XModifierKeymap *modMapPtr;
+ KeyCode *codePtr;
+ KeySym keysym;
+
+ modMapPtr = XGetModifierMapping(dispPtr->display);
+ codePtr = modMapPtr->modifiermap;
+ max = 8*modMapPtr->max_keypermod;
+
+ for (i = 0; i < max; i++, codePtr++) {
+ if (*codePtr == 0) {
+ continue;
+ }
+ keysym = XKeycodeToKeysym(dispPtr->display, *codePtr, 0);
+ if (keysym == XK_Mode_switch) {
+ dispPtr->modeModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
+ }
+ if ((keysym == XK_Meta_L) || (keysym == XK_Meta_R)) {
+ dispPtr->metaModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
+ }
+ if ((keysym == XK_Alt_L) || (keysym == XK_Alt_R)) {
+ dispPtr->altModMask |= ShiftMask << (i/modMapPtr->max_keypermod);
+ }
+ }
+ }
+ if ((modMask & META_MASK) && (dispPtr->metaModMask != 0)) {
+ modMask = (modMask & ~META_MASK) | dispPtr->metaModMask;
+ }
+ if ((modMask & ALT_MASK) && (dispPtr->altModMask != 0)) {
+ modMask = (modMask & ~ALT_MASK) | dispPtr->altModMask;
+ }
+
+ if ((state & META_MASK) && (dispPtr->metaModMask != 0)) {
+ state = (state & ~META_MASK) | dispPtr->metaModMask;
+ }
+ if ((state & ALT_MASK) && (dispPtr->altModMask != 0)) {
+ state = (state & ~ALT_MASK) | dispPtr->altModMask;
+ }
+
+ if ((state & modMask) != modMask) {
+ goto nextSequence;
+ }
}
#if 0
if ((state & patPtr->hateMods) != 0) {
#include "tclhash.h"
#endif
+#define META_MASK (AnyModifier<<1)
+#define ALT_MASK (AnyModifier<<2)
+
/*
* One of the following structures is maintained for each display
* containing a window managed by Tk:
* retrieved from the server yet. */
KeySym *keySyms; /* Array of KeySyms, returned by
* XGetKeyboardMapping. */
+ unsigned int modeModMask;
+ unsigned int metaModMask;
+ unsigned int altModMask;
/*
* Information used by tkError.c only:
dispPtr->selectionSerial = 0;
dispPtr->multipleAtom = None;
dispPtr->atomInit = 0;
+ dispPtr->modeModMask = 0;
+ dispPtr->metaModMask = 0;
+ dispPtr->altModMask = 0;
dispPtr->cursorFont = None;
dispPtr->grabWinPtr = NULL;
dispPtr->ungrabWinPtr = NULL;