Tk Source Code

Changes On Branch tip-708
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch tip-708 Excluding Merge-Ins

This is equivalent to a diff from cfc46f18 to 713034d3

2024-12-17
21:03
Fix [844c0be72d]: Menu entry underline does not consider activeborderwidth. check-in: 9545d4b5 user: fvogel tags: trunk, main
2024-12-16
21:34
Fix [844c0be72d]: Menu entry underline does not consider activeborderwidth. check-in: 088283d0 user: fvogel tags: bug-844c0be72d
09:52
New branch for project tk_collect_test_utils. Ticket: [718cbc3016] check-in: 6e5c9935 user: erikleunissen tags: tk_collect_test_utils
2024-12-15
19:55
Merge trunk check-in: cc11e8b8 user: kevin_walzer tags: tka11y
2024-12-13
14:10
Merge 9.0 Leaf check-in: 713034d3 user: jan.nijtmans tags: tip-708
13:23
Move "Scroll Lock" functionality from Mod3 to Mod5, so it doesn't conflict with "Num" check-in: 547578d6 user: jan.nijtmans tags: tip-708
11:25
Spelling in changes.md check-in: cfc46f18 user: oehhar tags: trunk, main
02:17
Fixed spelling in comment check-in: cc471420 user: emiliano tags: trunk, main

Changes to doc/bind.n.
145
146
147
148
149
150
151
152
153


154
155
156
157


158
159
160
161
162
163
164
165
166
167
168
169
170
145
146
147
148
149
150
151


152
153
154
155


156
157
158





159
160
161
162
163
164
165







-
-
+
+


-
-
+
+

-
-
-
-
-







times, and also place a time and space requirement on the sequence: for a
sequence of events to match a \fBDouble\fR, \fBTriple\fR or \fBQuadruple\fR
pattern, all of the events must occur close together in time and without
substantial mouse motion in between.  For example, \fB<Double\-Button\-1>\fR
is equivalent to \fB<Button\-1><Button\-1>\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
the Macintosh and Windows platforms.  Below is a list of all the valid
types; where two names appear together, they are synonyms.
Changes to doc/keysyms.n.
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1203
1204
1205
1206
1207
1208
1209



































1210
1211
1212
1213
1214
1215
1216







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







Menu (App)                       65383     0xFF67
Find                             65384     0xFF68
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
F6                               65475     0xFFC3
F7                               65476     0xFFC4
Changes to generic/ks_names.h.
85
86
87
88
89
90
91

92
93
94
95
96
97
98
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99







+







{ "Mode_switch", 0xFF7E },
{ "script_switch", 0xFF7E },
{ "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 },
{ "KP_F3", 0xFF93 },
{ "KP_F4", 0xFF94 },
122
123
124
125
126
127
128

129
130
131
132
133
134
135
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137







+







{ "KP_4", 0xFFB4 },
{ "KP_5", 0xFFB5 },
{ "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 },
{ "F6", 0xFFC3 },
{ "F7", 0xFFC4 },
Changes to generic/tkBind.c.
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
397
398
399
400
401
402
403

404
405
406
407
408
409
410







-







    {"Shift",		ShiftMask,	0},
    {"Lock",		LockMask,	0},
    {"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},
    {"Button3",		Button3Mask,	0},
    {"B4",		Button4Mask,	0},
432
433
434
435
436
437
438

439
440
441
442
443



444
445
446
447
448
449
450
451
452
453
454















































455
456
457
458
459
460
461
431
432
433
434
435
436
437
438
439
440



441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508







+


-
-
-
+
+
+











+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    {"Mod2",		Mod2Mask,	0},
    {"M2",		Mod2Mask,	0},
#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},
    {"Fn",		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},
    {"Quadruple",	0,		QUADRUPLE},
    {"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.
 */

typedef struct {
4149
4150
4151
4152
4153
4154
4155





4156
4157
4158
4159
4160
4161
4162
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214







+
+
+
+
+







	    keysym = TkStringToKeysym(value);
	    if (keysym == NoSymbol) {
		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;
	    }
	    if (!(flags & KEY)) {
5005
5006
5007
5008
5009
5010
5011






5012
5013
5014
5015
5016
5017
5018
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076







+
+
+
+
+
+







		    patPtr->info = TkStringToKeysym(field);
		    if (patPtr->info == NoSymbol) {
			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) {
		    if (patPtr->eventType != MotionNotify) {
			return FinalizeParseEventDescription(
Changes to generic/tkInt.h.
1010
1011
1012
1013
1014
1015
1016

1017


1018
1019
1020
1021
1022
1023
1024
1010
1011
1012
1013
1014
1015
1016
1017

1018
1019
1020
1021
1022
1023
1024
1025
1026







+
-
+
+







 * The following special modifier mask bits are defined, to indicate logical
 * modifiers such as Meta and Alt that may float among the actual modifier
 * bits.
 */

#define META_MASK	(AnyModifier<<1)
#define ALT_MASK	(AnyModifier<<2)
#ifndef TK_NO_DEPRECATED
#define EXTENDED_MASK	(AnyModifier<<3)
#   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.
 */

#ifndef Button8
Changes to library/console.tcl.
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
445
446
447
448
449
450
451

452
453
454
455
456
457
458







-







	<<Console_Expand>>		<Escape>
	<<Console_ExpandFile>>		<Control-Shift-F>
	<<Console_ExpandProc>>		<Control-Shift-P>
	<<Console_ExpandVar>>		<Control-Shift-V>
	<<Console_Tab>>			<Control-i>
	<<Console_Tab>>			<Meta-i>
	<<Console_Eval>>		<Return>
	<<Console_Eval>>		<KP_Enter>

	<<Console_Clear>>		<Control-l>
	<<Console_KillLine>>		<Control-k>
	<<Console_Transpose>>		<Control-t>
	<<Console_ClearLine>>		<Control-u>
	<<Console_SaveCommand>>		<Control-z>
	<<Console_FontSizeIncr>>	<Control-+>
Changes to library/entry.tcl.
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
202
203
204
205
206
207
208

209
210
211
212
213
214
215







-







# which is wrong.  Ditto for Escape, Return, and Tab.

bind Entry <Alt-Key> {# nothing}
bind Entry <Meta-Key> {# nothing}
bind Entry <Control-Key> {# nothing}
bind Entry <Escape> {# nothing}
bind Entry <Return> {# nothing}
bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}
bind Entry <Prior> {# nothing}
bind Entry <Next> {# nothing}
bind Entry <Command-Key> {# nothing}
bind Entry <Fn-Key> {# nothing}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind Entry <<NextLine>> {# nothing}
Changes to library/spinbox.tcl.
209
210
211
212
213
214
215

216
217
218
219
220
221
222
223
224
225
209
210
211
212
213
214
215
216
217
218

219
220
221
222
223
224
225







+


-







# Otherwise, if a widget binding for one of these is defined, the
# <Key> class binding will also fire and insert the character,
# which is wrong.  Ditto for Escape, Return, and Tab.

bind Spinbox <Alt-Key> {# nothing}
bind Spinbox <Meta-Key> {# nothing}
bind Spinbox <Control-Key> {# nothing}
bind Spinbox <Num-Key> {# nothing}
bind Spinbox <Escape> {# nothing}
bind Spinbox <Return> {# nothing}
bind Spinbox <KP_Enter> {# nothing}
bind Spinbox <Tab> {# nothing}
bind Spinbox <Prior> {# nothing}
bind Spinbox <Next> {# nothing}
bind Spinbox <Command-Key> {# nothing}
bind Spinbox <Fn-Key> {# nothing}

# On Windows, paste is done using Shift-Insert.  Shift-Insert already
Changes to library/text.tcl.
303
304
305
306
307
308
309
310

311
312
313
314
315
316
317
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317







-
+







# <Key> class binding will also fire and insert the character,
# which is wrong.  Ditto for <Escape>.

bind Text <Alt-Key> {# nothing }
bind Text <Meta-Key> {# nothing}
bind Text <Control-Key> {# nothing}
bind Text <Escape> {# nothing}
bind Text <KP_Enter> {# nothing}
bind Text <Num-Return> {# nothing}
bind Text <Command-Key> {# nothing}
bind Text <Fn-Key> {# nothing}

# Additional emacs-like bindings:

bind Text <Control-d> {
    if {!$tk_strictMotif && [%W compare end != insert+1c]} {
Changes to library/ttk/entry.tcl.
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
124
125
126
127
128
129
130

131
132
133
134
135
136
137







-







# Ditto for Escape, Return, and Tab.
#
bind TEntry <Alt-Key>			{# nothing}
bind TEntry <Meta-Key>			{# nothing}
bind TEntry <Control-Key>		{# nothing}
bind TEntry <Escape>			{# nothing}
bind TEntry <Return>			{# nothing}
bind TEntry <KP_Enter>			{# nothing}
bind TEntry <Tab>			{# nothing}
bind TEntry <Command-Key>		{# nothing}
bind TEntry <Fn-Key>			{# nothing}

# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind TEntry <<PrevLine>>		{# nothing}
bind TEntry <<NextLine>>		{# nothing}
Changes to tests/bind.test.
5334
5335
5336
5337
5338
5339
5340
5341

5342
5343
5344
5345
5346
5347
5348
5349
5350

5351
5352
5353
5354
5355
5356
5357
5334
5335
5336
5337
5338
5339
5340

5341
5342
5343
5344
5345
5346
5347
5348
5349

5350
5351
5352
5353
5354
5355
5356
5357







-
+








-
+







test bind-25.36 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <M3-a> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Mod3-Key-a>
} -result <Num-Key-a>

test bind-25.37 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <M4-a> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Mod4-Key-a>
} -result <Fn-Key-a>

test bind-25.38 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <M5-a> foo
    bind .t.f
} -cleanup {
5379
5380
5381
5382
5383
5384
5385
5386

5387
5388
5389
5390
5391
5392
5393
5394
5395

5396
5397
5398
5399
5400
5401
5402
5379
5380
5381
5382
5383
5384
5385

5386
5387
5388
5389
5390
5391
5392
5393
5394

5395
5396
5397
5398
5399
5400
5401
5402







-
+








-
+







test bind-25.41 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Mod3-a> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Mod3-Key-a>
} -result <Num-Key-a>

test bind-25.42 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Mod4-a> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Mod4-Key-a>
} -result <Fn-Key-a>

test bind-25.43 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Mod5-a> foo
    bind .t.f
} -cleanup {
5442
5443
5444
5445
5446
5447
5448
5449

5450
5451
5452
5453
5454


5455
5456
5457
5458

5459
5460
5461
5462
5463
5464
5465
5442
5443
5444
5445
5446
5447
5448

5449
5450
5451
5452


5453
5454
5455
5456
5457

5458
5459
5460
5461
5462
5463
5464
5465







-
+



-
-
+
+



-
+







test bind-25.48 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f {<M1-M2 M3-M4 B1-Control-a>} foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Control-B1-Mod1-Mod2-Mod3-Mod4-Key-a>
} -result <Control-B1-Mod1-Mod2-Num-Fn-Key-a>

test bind-25.49 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Extended-Return> foo
} -constraints deprecated -body {
    bind .t.f <KP_Enter> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Extended-Key-Return>
} -result <Num-Key-Return>

test bind-25.50 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Button6-a> foo
    bind .t.f
} -cleanup {
5492
5493
5494
5495
5496
5497
5498
5499

5500
5501
5502
5503

5504
5505
5506
5507
5508

5509
5510
5511
5512

5513
5514
5515
5516
5517
5518
5519
5492
5493
5494
5495
5496
5497
5498

5499
5500
5501
5502

5503
5504
5505
5506
5507

5508
5509
5510
5511

5512
5513
5514
5515
5516
5517
5518
5519







-
+



-
+




-
+



-
+







} -cleanup {
    destroy .t.f
} -result <B9-Key-a>

test bind-25.54 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Num-a> foo
    bind .t.f <Mod3-a> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Mod3-Key-a>
} -result <Num-Key-a>

test bind-25.55 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Fn-a> foo
    bind .t.f <Mod4-a> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Mod4-Key-a>
} -result <Fn-Key-a>


test bind-26.1 {event names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <FocusIn> {nothing}
    bind .t.f
Changes to win/tkWinKey.c.
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
245
246
247
248
249
250
251

252
253
254
255
256
257
258
259







-
+







     * Make sure all lock button info is correct so we don't mess up the
     * lights.
     */

    if (state & LockMask) {
	keys[VK_CAPITAL] = 1;
    }
    if (state & Mod3Mask) {
    if (state & Mod5Mask) {
	keys[VK_SCROLL] = 1;
    }
    if (state & Mod1Mask) {
	keys[VK_NUMLOCK] = 1;
    }

    result = ToUnicode(keycode, scancode, keys, buf, 4, 0);
339
340
341
342
343
344
345
346

347
348
349

350
351
352
353
354
355
356
357
358
359
360
361

362
363
364
365
366
367
368
369
370
371

372
373
374
375
376
377
378
339
340
341
342
343
344
345

346
347
348

349
350
351
352
353
354
355
356
357
358
359
360

361
362
363
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378







-
+


-
+











-
+









-
+







    if (keycode > MAX_KEYCODE) {
	return NoSymbol;
    }
    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
	 * and rely on the keymap table to hold the correct keysym value.
	 * 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];
}

Changes to win/tkWinPointer.c.
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80







-
+







    if (GetKeyState(VK_CAPITAL) & 0x0001) {
	state |= LockMask;
    }
    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) {
	state |= Button2Mask;
    }
Changes to win/tkWinX.c.
1393
1394
1395
1396
1397
1398
1399
1400

1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411

1412
1413
1414
1415
1416
1417
1418
1393
1394
1395
1396
1397
1398
1399

1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410

1411
1412
1413
1414
1415
1416
1417
1418







-
+










-
+







	    if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
		mask = Mod1Mask;
		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) {
	    state |= mask;
	} else {
	    state &= ~mask;
	}
	if (HIWORD(lParam) & KF_EXTENDED) {
	    state |= EXTENDED_MASK;
	    state |= Mod3Mask;
	}
    }
    return state;
}

/*
 *----------------------------------------------------------------------