Index: doc/bind.n ================================================================== --- doc/bind.n +++ doc/bind.n @@ -147,22 +147,17 @@ pattern, all of the events must occur close together in time and without substantial mouse motion in between. For example, \fB\fR is equivalent to \fB\fR with the extra time and space requirement. .PP -The \fBCommand\fR, \fBOption\fR, \fBNum\fR and \fBFn\fRmodifiers are -equivalents of \fBMod1\fR up to \fBMod4\fR; they correspond to +The \fBCommand\fR, \fBOption\fR and \fBFn\fRmodifiers are +equivalents of \fBMod1\fR, \fBMod2\fR, resp \fBMod4\fR; they correspond to Macintosh-specific modifier keys. .PP -The \fBExtended\fR modifier is, at present, specific to Windows. It -appears on events that are associated with the keys on the +The \fBNum\fR modifier is equivalent to \fBExtended\fR and \fBMod3\fR, +and appears on events that are associated with the keys on the .QW "extended keyboard" . -On a US keyboard, the extended keys include the \fBAlt\fR -and \fBControl\fR keys at the right of the keyboard, the cursor keys -in the cluster to the left of the numeric pad, the \fBNumLock\fR key, -the \fBBreak\fR key, the \fBPrintScreen\fR key, and the \fB/\fR and -\fBEnter\fR keys in the numeric keypad. .SS "EVENT TYPES" .PP The \fItype\fR field may be any of the standard X event types, with a few extra abbreviations. The \fItype\fR field will also accept a couple non-standard X event types that were added to better support Index: doc/keysyms.n ================================================================== --- doc/keysyms.n +++ doc/keysyms.n @@ -1205,45 +1205,10 @@ Cancel 65385 0xFF69 Help 65386 0xFF6A Break 65387 0xFF6B Mode_switch 65406 0xFF7E Num_Lock 65407 0xFF7F -KP_Space 65408 0xFF80 -KP_Tab 65417 0xFF89 -KP_Enter 65421 0xFF8D -KP_F1 65425 0xFF91 -KP_F2 65426 0xFF92 -KP_F3 65427 0xFF93 -KP_F4 65428 0xFF94 -KP_Home 65429 0xFF95 -KP_Left 65430 0xFF96 -KP_Up 65431 0xFF97 -KP_Right 65432 0xFF98 -KP_Down 65433 0xFF99 -KP_Prior 65434 0xFF9A -KP_Next 65435 0xFF9B -KP_End 65436 0xFF9C -KP_Begin 65437 0xFF9D -KP_Insert 65438 0xFF9E -KP_Delete 65439 0xFF9F -KP_Multiply 65450 0xFFAA -KP_Add 65451 0xFFAB -KP_Separator 65452 0xFFAC -KP_Subtract 65453 0xFFAD -KP_Decimal 65454 0xFFAE -KP_Divide 65455 0xFFAF -KP_0 65456 0xFFB0 -KP_1 65457 0xFFB1 -KP_2 65458 0xFFB2 -KP_3 65459 0xFFB3 -KP_4 65460 0xFFB4 -KP_5 65461 0xFFB5 -KP_6 65462 0xFFB6 -KP_7 65463 0xFFB7 -KP_8 65464 0xFFB8 -KP_9 65465 0xFFB9 -KP_Equal 65469 0xFFBD F1 65470 0xFFBE F2 65471 0xFFBF F3 65472 0xFFC0 F4 65473 0xFFC1 F5 65474 0xFFC2 Index: generic/ks_names.h ================================================================== --- generic/ks_names.h +++ generic/ks_names.h @@ -87,10 +87,11 @@ { "kana_switch", 0xFF7E }, { "Arabic_switch", 0xFF7E }, { "Greek_switch", 0xFF7E }, { "Hebrew_switch", 0xFF7E }, { "Num_Lock", 0xFF7F }, +#ifndef TK_NO_DEPRECATED { "KP_Space", 0xFF80 }, { "KP_Tab", 0xFF89 }, { "KP_Enter", 0xFF8D }, { "KP_F1", 0xFF91 }, { "KP_F2", 0xFF92 }, @@ -124,10 +125,11 @@ { "KP_6", 0xFFB6 }, { "KP_7", 0xFFB7 }, { "KP_8", 0xFFB8 }, { "KP_9", 0xFFB9 }, { "KP_Equal", 0xFFBD }, +#endif { "F1", 0xFFBE }, { "F2", 0xFFBF }, { "F3", 0xFFC0 }, { "F4", 0xFFC1 }, { "F5", 0xFFC2 }, Index: generic/tkBind.c ================================================================== --- generic/tkBind.c +++ generic/tkBind.c @@ -399,11 +399,10 @@ {"Meta", META_MASK, 0}, #ifndef TK_NO_DEPRECATED {"M", META_MASK, 0}, #endif {"Alt", ALT_MASK, 0}, - {"Extended", EXTENDED_MASK, 0}, {"B1", Button1Mask, 0}, {"Button1", Button1Mask, 0}, {"B2", Button2Mask, 0}, {"Button2", Button2Mask, 0}, {"B3", Button3Mask, 0}, @@ -434,15 +433,16 @@ #ifdef MAC_OSX_TK {"Option", Mod2Mask, 0}, #else {"Option", ALT_MASK, 0}, #endif + {"Num", Mod3Mask, 0}, {"Mod3", Mod3Mask, 0}, {"M3", Mod3Mask, 0}, - {"Num", Mod3Mask, 0}, - {"Mod4", Mod4Mask, 0}, + {"Extended", Mod3Mask, 0}, {"Fn", Mod4Mask, 0}, + {"Mod4", Mod4Mask, 0}, {"M4", Mod4Mask, 0}, {"Mod5", Mod5Mask, 0}, {"M5", Mod5Mask, 0}, {"Double", 0, DOUBLE}, {"Triple", 0, TRIPLE}, @@ -450,10 +450,57 @@ {"Any", 0, 0}, /* Ignored: historical relic */ {NULL, 0, 0} }; static Tcl_HashTable modTable; +#ifndef TK_NO_DEPRECATED +/* Keycodes belonging to KP_Space up to KP_Equal */ +static const unsigned short kpTable[] = { + /* KP_Space */ 0x20, + 0, 0, 0, 0, 0, 0, 0, 0, + /* KP_Tab */ XK_Tab, + 0, 0, 0, + /* KP_Enter */ XK_Return, + 0, 0, 0, + /* KP_F1 */ XK_F1, + /* KP_F2 */ XK_F2, + /* KP_F3 */ XK_F3, + /* KP_F4 */ XK_F4, + /* KP_Home */ XK_Home, + /* KP_Left */ XK_Left, + /* KP_Up */ XK_Up, + /* KP_Right */ XK_Right, + /* KP_Down */ XK_Down, + /* KP_Prior */ XK_Prior, + /* KP_Next */ XK_Next, + /* KP_End */ XK_End, + /* KP_Begin */ XK_Begin, + /* KP_Insert */ XK_Insert, + /* KP_Delete */ XK_Delete, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* KP_Multiply */ XK_asterisk, + /* KP_Add */ XK_plus, + /* KP_Separator */ XK_comma, + /* KP_Subtract */ XK_minus, + /* KP_Decimal */ XK_period, + /* KP_Divide */ XK_slash, + /* KP_0 */ XK_0, + /* KP_1 */ XK_1, + /* KP_2 */ XK_2, + /* KP_3 */ XK_3, + /* KP_4 */ XK_4, + /* KP_5 */ XK_5, + /* KP_6 */ XK_6, + /* KP_7 */ XK_7, + /* KP_8 */ XK_8, + /* KP_9 */ XK_9, + 0, 0, 0, + /* KP_Equal */ XK_equal, + 0 +}; +#endif /* TK_NO_DEPRECATED */ + /* * This module also keeps a hash table mapping from event names to information * about those events. The structure, an array to use to initialize the hash * table, and the hash table are all defined below. */ @@ -4151,10 +4198,15 @@ Tcl_SetObjResult(interp, Tcl_ObjPrintf("unknown keysym \"%s\"", value)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYSYM", value, (char *)NULL); return TCL_ERROR; } +#ifndef TK_NO_DEPRECATED + if (IsKeypadKey(keysym)) { + keysym = kpTable[keysym - XK_KP_Space]; + } +#endif /* TK_NO_DEPRECATED */ TkpSetKeycodeAndState(tkwin, keysym, &event.general); if (event.general.xkey.keycode == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("no keycode for keysym \"%s\"", value)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYCODE", value, (char *)NULL); return TCL_ERROR; @@ -5007,10 +5059,16 @@ return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("bad event type or keysym \"%s\"", field), "KEYSYM"); } +#ifndef TK_NO_DEPRECATED + if (IsKeypadKey(patPtr->info)) { + patPtr->info = kpTable[patPtr->info - XK_KP_Space]; + patPtr->modMask |= Mod3Mask; + } +#endif /* TK_NO_DEPRECATED */ if (!(eventFlags & KEY)) { patPtr->eventType = KeyPress; eventMask = KeyPressMask; } } else if (button) { Index: generic/tkInt.h ================================================================== --- generic/tkInt.h +++ generic/tkInt.h @@ -1012,11 +1012,13 @@ * bits. */ #define META_MASK (AnyModifier<<1) #define ALT_MASK (AnyModifier<<2) -#define EXTENDED_MASK (AnyModifier<<3) +#ifndef TK_NO_DEPRECATED +# define EXTENDED_MASK Mod3Mask +#endif /* * Buttons 8 and 9 are the Xbuttons (left and right side-buttons). On Windows/Mac, those * are known as Buttons 4 and 5. At script level, they also get the numbers 4 and 5. */ Index: library/console.tcl ================================================================== --- library/console.tcl +++ library/console.tcl @@ -447,11 +447,10 @@ <> <> <> <> <> - <> <> <> <> <> Index: library/entry.tcl ================================================================== --- library/entry.tcl +++ library/entry.tcl @@ -204,11 +204,10 @@ bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} -bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} Index: library/spinbox.tcl ================================================================== --- library/spinbox.tcl +++ library/spinbox.tcl @@ -211,13 +211,13 @@ # which is wrong. Ditto for Escape, Return, and Tab. bind Spinbox {# nothing} bind Spinbox {# nothing} bind Spinbox {# nothing} +bind Spinbox {# nothing} bind Spinbox {# nothing} bind Spinbox {# nothing} -bind Spinbox {# nothing} bind Spinbox {# nothing} bind Spinbox {# nothing} bind Spinbox {# nothing} bind Spinbox {# nothing} bind Spinbox {# nothing} Index: library/text.tcl ================================================================== --- library/text.tcl +++ library/text.tcl @@ -305,11 +305,11 @@ bind Text {# nothing } bind Text {# nothing} bind Text {# nothing} bind Text {# nothing} -bind Text {# nothing} +bind Text {# nothing} bind Text {# nothing} bind Text {# nothing} # Additional emacs-like bindings: Index: library/ttk/entry.tcl ================================================================== --- library/ttk/entry.tcl +++ library/ttk/entry.tcl @@ -126,11 +126,10 @@ bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} -bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} bind TEntry {# nothing} # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] Index: tests/bind.test ================================================================== --- tests/bind.test +++ tests/bind.test @@ -5336,20 +5336,20 @@ } -body { bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.37 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.38 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f foo @@ -5381,20 +5381,20 @@ } -body { bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.42 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.43 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f foo @@ -5444,20 +5444,20 @@ } -body { bind .t.f {} foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.49 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 -} -body { - bind .t.f foo +} -constraints deprecated -body { + bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.50 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f foo @@ -5494,24 +5494,24 @@ } -result test bind-25.54 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f foo + bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-25.55 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { - bind .t.f foo + bind .t.f foo bind .t.f } -cleanup { destroy .t.f -} -result +} -result test bind-26.1 {event names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { Index: win/tkWinKey.c ================================================================== --- win/tkWinKey.c +++ win/tkWinKey.c @@ -247,11 +247,11 @@ */ if (state & LockMask) { keys[VK_CAPITAL] = 1; } - if (state & Mod3Mask) { + if (state & Mod5Mask) { keys[VK_SCROLL] = 1; } if (state & Mod1Mask) { keys[VK_NUMLOCK] = 1; } @@ -341,14 +341,14 @@ } switch (keycode) { /* * Windows only gives us an undifferentiated VK_CONTROL code (for * example) when either Control key is pressed. To distinguish between - * left and right, we use the Extended flag. Indeed, the right Control + * left and right, we use the Num flag. Indeed, the right Control * and Alt (aka Menu) keys are such extended keys (which their left * counterparts are not). - * Regarding the shift case, Windows does not set the Extended flag for + * Regarding the shift case, Windows does not set the Num flag for * the neither the left nor the right shift key. As a consequence another * way to distinguish between the two keys is to query the state of one * of the two to determine which was actually pressed. So if the keycode * indicates Shift, do this extra test. If the right-side key was * pressed, return the appropriate keycode. Otherwise, we fall through @@ -356,21 +356,21 @@ * Note: this little trick only works for KeyPress, not for KeyRelease, * for reasons stated in bug [2945130] */ case VK_CONTROL: - if (state & EXTENDED_MASK) { + if (state & Mod3Mask) { return XK_Control_R; } break; case VK_SHIFT: if (GetKeyState(VK_RSHIFT) & 0x80) { return XK_Shift_R; } break; case VK_MENU: - if (state & EXTENDED_MASK) { + if (state & Mod3Mask) { return XK_Alt_R; } break; } return keymap[keycode]; Index: win/tkWinPointer.c ================================================================== --- win/tkWinPointer.c +++ win/tkWinPointer.c @@ -68,11 +68,11 @@ } if (GetKeyState(VK_NUMLOCK) & 0x0001) { state |= Mod1Mask; } if (GetKeyState(VK_SCROLL) & 0x0001) { - state |= Mod3Mask; + state |= Mod5Mask; } if (GetKeyState(VK_LBUTTON) & 0x8000) { state |= Button1Mask; } if (GetKeyState(VK_MBUTTON) & 0x8000) { Index: win/tkWinX.c ================================================================== --- win/tkWinX.c +++ win/tkWinX.c @@ -1395,11 +1395,11 @@ prevState = ((state & mask) ^ prevState) ? 0 : 1; } break; case VK_SCROLL: if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) { - mask = Mod3Mask; + mask = Mod5Mask; prevState = ((state & mask) ^ prevState) ? 0 : 1; } break; } if (prevState) { @@ -1406,11 +1406,11 @@ state |= mask; } else { state &= ~mask; } if (HIWORD(lParam) & KF_EXTENDED) { - state |= EXTENDED_MASK; + state |= Mod3Mask; } } return state; }