Check-in [c8fa84837f]
Not logged in

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

Overview
Comment:add tk upstream changes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c8fa84837f87f8a8781447c754ab8598dbe9bd9f
User & Date: chw 2019-08-15 22:40:03
Context
2019-08-15
22:46
add selected tcl upstream changes check-in: 549b9ce2a1 user: chw tags: trunk
22:40
add tk upstream changes check-in: c8fa84837f user: chw tags: trunk
2019-08-12
16:45
more topcua preparation for 1.0, see also [a1ecca9b00] check-in: 790e51ffb7 user: chw tags: trunk
Changes

Changes to jni/sdl2tk/generic/tkCanvas.c.

1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
....
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
....
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
	    }
	    mask = Tk_CreateBinding(interp, canvasPtr->bindingTable,
		    object, Tcl_GetString(objv[3]), argv4, append);
	    if (mask == 0) {
		result = TCL_ERROR;
		goto done;
	    }
	    if (mask & (unsigned) ~(ButtonMotionMask|Button1MotionMask
		    |Button2MotionMask|Button3MotionMask|Button4MotionMask
		    |Button5MotionMask|ButtonPressMask|ButtonReleaseMask
		    |EnterWindowMask|LeaveWindowMask|KeyPressMask
		    |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
		Tk_DeleteBinding(interp, canvasPtr->bindingTable,
			object, Tcl_GetString(objv[3]));
		Tcl_SetObjResult(interp, Tcl_NewStringObj(
................................................................................

static void
CanvasBindProc(
    ClientData clientData,	/* Pointer to canvas structure. */
    XEvent *eventPtr)		/* Pointer to X event that just happened. */
{
    TkCanvas *canvasPtr = clientData;
    int mask;

    Tcl_Preserve(canvasPtr);

    /*
     * This code below keeps track of the current modifier state in
     * canvasPtr>state. This information is used to defer repicks of the
     * current item while buttons are down.
................................................................................
    TkCanvas *canvasPtr,	/* Canvas widget in which to select current
				 * item. */
    XEvent *eventPtr)		/* Event describing location of mouse cursor.
				 * Must be EnterWindow, LeaveWindow,
				 * ButtonRelease, or MotionNotify. */
{
    double coords[2];
    unsigned int buttonDown;
    Tk_Item *prevItemPtr;
#ifndef USE_OLD_TAG_SEARCH
    SearchUids *searchUids = GetStaticUids();
#endif

    /*
     * Check whether or not a button is down. If so, we'll log entry and exit







|







 







|







 







|







1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
....
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
....
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
	    }
	    mask = Tk_CreateBinding(interp, canvasPtr->bindingTable,
		    object, Tcl_GetString(objv[3]), argv4, append);
	    if (mask == 0) {
		result = TCL_ERROR;
		goto done;
	    }
	    if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask
		    |Button2MotionMask|Button3MotionMask|Button4MotionMask
		    |Button5MotionMask|ButtonPressMask|ButtonReleaseMask
		    |EnterWindowMask|LeaveWindowMask|KeyPressMask
		    |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
		Tk_DeleteBinding(interp, canvasPtr->bindingTable,
			object, Tcl_GetString(objv[3]));
		Tcl_SetObjResult(interp, Tcl_NewStringObj(
................................................................................

static void
CanvasBindProc(
    ClientData clientData,	/* Pointer to canvas structure. */
    XEvent *eventPtr)		/* Pointer to X event that just happened. */
{
    TkCanvas *canvasPtr = clientData;
    unsigned long mask;

    Tcl_Preserve(canvasPtr);

    /*
     * This code below keeps track of the current modifier state in
     * canvasPtr>state. This information is used to defer repicks of the
     * current item while buttons are down.
................................................................................
    TkCanvas *canvasPtr,	/* Canvas widget in which to select current
				 * item. */
    XEvent *eventPtr)		/* Event describing location of mouse cursor.
				 * Must be EnterWindow, LeaveWindow,
				 * ButtonRelease, or MotionNotify. */
{
    double coords[2];
    unsigned long buttonDown;
    Tk_Item *prevItemPtr;
#ifndef USE_OLD_TAG_SEARCH
    SearchUids *searchUids = GetStaticUids();
#endif

    /*
     * Check whether or not a button is down. If so, we'll log entry and exit

Changes to jni/sdl2tk/generic/tkEvent.c.

541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

static const int buttonMasks[] = {
    0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
};

int
TkGetButtonMask(
    unsigned int button)
{
    return (button > Button5) ? 0 : buttonMasks[button];
}
 
/*







|



|







541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

static const unsigned long buttonMasks[] = {
    0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
};

unsigned long
TkGetButtonMask(
    unsigned int button)
{
    return (button > Button5) ? 0 : buttonMasks[button];
}
 
/*

Changes to jni/sdl2tk/generic/tkInt.h.

941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
 * masks that select individual buttons' bits:
 */

#define ALL_BUTTONS \
	(Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)


MODULE_SCOPE int TkGetButtonMask(unsigned int);

/*
 * Object types not declared in tkObj.c need to be mentioned here so they can
 * be properly registered with Tcl:
 */

MODULE_SCOPE const Tcl_ObjType tkBorderObjType;







|







941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
 * masks that select individual buttons' bits:
 */

#define ALL_BUTTONS \
	(Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)


MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int);

/*
 * Object types not declared in tkObj.c need to be mentioned here so they can
 * be properly registered with Tcl:
 */

MODULE_SCOPE const Tcl_ObjType tkBorderObjType;

Changes to jni/sdl2tk/generic/tkTextTag.c.

288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
....
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
	    mask = Tk_CreateBinding(interp,
		    textPtr->sharedTextPtr->bindingTable,
		    (ClientData) tagPtr->name, Tcl_GetString(objv[4]), fifth,
		    append);
	    if (mask == 0) {
		return TCL_ERROR;
	    }
	    if (mask & (unsigned) ~(ButtonMotionMask|Button1MotionMask
		    |Button2MotionMask|Button3MotionMask|Button4MotionMask
		    |Button5MotionMask|ButtonPressMask|ButtonReleaseMask
		    |EnterWindowMask|LeaveWindowMask|KeyPressMask
		    |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
		Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable,
			(ClientData) tagPtr->name, Tcl_GetString(objv[4]));
		Tcl_SetObjResult(interp, Tcl_NewStringObj(
................................................................................
	TagBindEvent(textPtr, eventPtr, textPtr->numCurTags,
		textPtr->curTagArrayPtr);
    }
    if (repick) {
	unsigned int oldState;

	oldState = eventPtr->xbutton.state;
	eventPtr->xbutton.state &= ~ALL_BUTTONS;
	if (!(textPtr->flags & DESTROYED)) {
	    TkTextPickCurrent(textPtr, eventPtr);
	}
	eventPtr->xbutton.state = oldState;
    }

  done:







|







 







|







288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
....
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
	    mask = Tk_CreateBinding(interp,
		    textPtr->sharedTextPtr->bindingTable,
		    (ClientData) tagPtr->name, Tcl_GetString(objv[4]), fifth,
		    append);
	    if (mask == 0) {
		return TCL_ERROR;
	    }
	    if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask
		    |Button2MotionMask|Button3MotionMask|Button4MotionMask
		    |Button5MotionMask|ButtonPressMask|ButtonReleaseMask
		    |EnterWindowMask|LeaveWindowMask|KeyPressMask
		    |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) {
		Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable,
			(ClientData) tagPtr->name, Tcl_GetString(objv[4]));
		Tcl_SetObjResult(interp, Tcl_NewStringObj(
................................................................................
	TagBindEvent(textPtr, eventPtr, textPtr->numCurTags,
		textPtr->curTagArrayPtr);
    }
    if (repick) {
	unsigned int oldState;

	oldState = eventPtr->xbutton.state;
	eventPtr->xbutton.state &= ~(unsigned long)ALL_BUTTONS;
	if (!(textPtr->flags & DESTROYED)) {
	    TkTextPickCurrent(textPtr, eventPtr);
	}
	eventPtr->xbutton.state = oldState;
    }

  done:

Changes to jni/sdl2tk/generic/ttk/ttkTreeview.c.

929
930
931
932
933
934
935
936
937
938
939
940
941
942
943

/*------------------------------------------------------------------------
 * +++ Event handlers.
 */

static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/

static const unsigned int TreeviewBindEventMask =
      KeyPressMask|KeyReleaseMask
    | ButtonPressMask|ButtonReleaseMask
    | PointerMotionMask|ButtonMotionMask
    | VirtualEventMask
    ;

static void TreeviewBindEventProc(void *clientData, XEvent *event)







|







929
930
931
932
933
934
935
936
937
938
939
940
941
942
943

/*------------------------------------------------------------------------
 * +++ Event handlers.
 */

static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/

static const unsigned long TreeviewBindEventMask =
      KeyPressMask|KeyReleaseMask
    | ButtonPressMask|ButtonReleaseMask
    | PointerMotionMask|ButtonMotionMask
    | VirtualEventMask
    ;

static void TreeviewBindEventProc(void *clientData, XEvent *event)

Changes to jni/sdl2tk/library/bgerror.tcl.

17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
    option add *ErrorDialog.function.text [mc "Save To Log"] \
	widgetDefault
    option add *ErrorDialog.function.command [namespace code SaveToLog]
    option add *ErrorDialog*Label.font TkCaptionFont widgetDefault
    if {[tk windowingsystem] eq "aqua"} {
	option add *ErrorDialog*background systemAlertBackgroundActive \
		widgetDefault
	option add *ErrorDialog*info.text.background white widgetDefault

	option add *ErrorDialog*Button.highlightBackground \
		systemAlertBackgroundActive widgetDefault
    }
}

proc ::tk::dialog::error::Return {which code} {
    variable button







|
>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    option add *ErrorDialog.function.text [mc "Save To Log"] \
	widgetDefault
    option add *ErrorDialog.function.command [namespace code SaveToLog]
    option add *ErrorDialog*Label.font TkCaptionFont widgetDefault
    if {[tk windowingsystem] eq "aqua"} {
	option add *ErrorDialog*background systemAlertBackgroundActive \
		widgetDefault
	option add *ErrorDialog*info.text.background \
	        systemTextBackgroundColor widgetDefault
	option add *ErrorDialog*Button.highlightBackground \
		systemAlertBackgroundActive widgetDefault
    }
}

proc ::tk::dialog::error::Return {which code} {
    variable button

Changes to jni/sdl2tk/library/dialog.tcl.

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    } elseif {"" eq $default} {
	set default -1
    } else {
	set default [lsearch -exact $args $default]
    }

    set windowingsystem [tk windowingsystem]
    if {$windowingsystem eq "aqua"} {
	option add *Dialog*background systemDialogBackgroundActive widgetDefault
	option add *Dialog*Button.highlightBackground \
		systemDialogBackgroundActive widgetDefault
    }

    # 1. Create the top-level window and divide it into top
    # and bottom parts.

    destroy $w
    toplevel $w -class Dialog
    wm title $w $title







<
<
<
<
<







40
41
42
43
44
45
46





47
48
49
50
51
52
53
    } elseif {"" eq $default} {
	set default -1
    } else {
	set default [lsearch -exact $args $default]
    }

    set windowingsystem [tk windowingsystem]






    # 1. Create the top-level window and divide it into top
    # and bottom parts.

    destroy $w
    toplevel $w -class Dialog
    wm title $w $title

Changes to jni/sdl2tk/library/msgbox.tcl.

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    set windowingsystem [tk windowingsystem]
    if {$windowingsystem eq "aqua"} {
	switch -- $data(-icon) {
	    "error"     {set data(-icon) "stop"}
	    "warning"   {set data(-icon) "caution"}
	    "info"      {set data(-icon) "note"}
	}
	option add *Dialog*background systemDialogBackgroundActive widgetDefault
	option add *Dialog*Button.highlightBackground \
		systemDialogBackgroundActive widgetDefault
    }

    if {![winfo exists $data(-parent)]} {
	return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \
	    "bad window path name \"$data(-parent)\""
    }








<
<
<







160
161
162
163
164
165
166



167
168
169
170
171
172
173
    set windowingsystem [tk windowingsystem]
    if {$windowingsystem eq "aqua"} {
	switch -- $data(-icon) {
	    "error"     {set data(-icon) "stop"}
	    "warning"   {set data(-icon) "caution"}
	    "info"      {set data(-icon) "note"}
	}



    }

    if {![winfo exists $data(-parent)]} {
	return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \
	    "bad window path name \"$data(-parent)\""
    }

Changes to jni/sdl2tk/macosx/tkMacOSXMenu.c.

624
625
626
627
628
629
630




631
632
633
634
635
636
637
	Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin,
		mePtr->bitmapPtr);

	Tk_SizeOfBitmap(mePtr->menuPtr->display, bitmap, &imageWidth,
		&imageHeight);
	image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap,
		gc, imageWidth, imageHeight);




    }
    [menuItem setImage:image];
    if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr &&
	    mePtr->labelLength) {
	title = [[[NSString alloc] initWithBytes:Tcl_GetString(mePtr->labelPtr)
		length:mePtr->labelLength encoding:NSUTF8StringEncoding]
		autorelease];







>
>
>
>







624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
	Pixmap bitmap = Tk_GetBitmapFromObj(mePtr->menuPtr->tkwin,
		mePtr->bitmapPtr);

	Tk_SizeOfBitmap(mePtr->menuPtr->display, bitmap, &imageWidth,
		&imageHeight);
	image = TkMacOSXGetNSImageWithBitmap(mePtr->menuPtr->display, bitmap,
		gc, imageWidth, imageHeight);
	if (gc->foreground == defaultFg) {
	    /* Use a semantic foreground color by default. */
	    [image setTemplate:YES];
	}
    }
    [menuItem setImage:image];
    if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr &&
	    mePtr->labelLength) {
	title = [[[NSString alloc] initWithBytes:Tcl_GetString(mePtr->labelPtr)
		length:mePtr->labelLength encoding:NSUTF8StringEncoding]
		autorelease];

Changes to jni/sdl2tk/tests/bind.test.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
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
379
380
381
382
383
384
...
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
...
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
....
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
....
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
....
5491
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
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
....
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
....
6196
6197
6198
6199
6200
6201
6202

6203
6204
6205
update idletasks

foreach p [event info] {event delete $p}
foreach event [bind Test] {
    bind Test $event {}
}
foreach event [bind all] {
   bind all $event {}
}

proc unsetBindings {} {
    bind all <Enter> {}
    bind Test <Enter> {}
    bind Toplevel <Enter> {}
    bind xyz <Enter> {}
................................................................................
# events to make sure that there are no stray events in the ring
# buffer which might cause the pattern matcher to find unintended
# matches.  The size of the ring buffer is EVENT_BUFFER_SIZE, which is
# currently set to 30 (or 45 on macOS).  If this changes, the code
# below will need to change.
proc clearRingBuffer {{event}} {
    for {set i 0} {$i < 45} {incr i} {
	event generate . $event
    }
}

# move the mouse pointer away of the testing area
# otherwise some spurious events may pollute the tests
toplevel .top
wm geometry .top 50x50-50-50
................................................................................
    destroy .t.f
} -returnCodes ok
test bind-9.2 {Tk_DeleteBinding procedure} -setup {
    set result {}
} -body {
    frame .t.f -class Test -width 150 -height 100
    foreach i {a b c d} {
	   bind .t.f $i "binding for $i"
    }
    foreach i {b d a c} {
	   bind .t.f $i {}
	   lappend result [lsort [bind .t.f]]
    }
    return $result
} -cleanup {
    destroy .t.f
} -result {{a c d} {a c} c {}}
test bind-9.3 {Tk_DeleteBinding procedure} -setup {
    set result {}
} -body {
    frame .t.f -class Test -width 150 -height 100
    foreach i {<1> <Meta-1> <Control-1> <Double-Alt-1>} {
	   bind .t.f $i "binding for $i"
    }
    foreach i {<Control-1> <Double-Alt-1> <1> <Meta-1>} {
	   bind .t.f $i {}
	   lappend result [lsort [bind .t.f]]
    }
    return $result
} -cleanup {
    destroy .t.f
} -result {{<Button-1> <Double-Alt-Button-1> <Meta-Button-1>} {<Button-1> <Meta-Button-1>} <Meta-Button-1> {}}

test bind-10.1 {Tk_GetBinding procedure} -body {
................................................................................
} -cleanup {
    destroy .t.c
} -result {Test}

test bind-11.1 {Tk_GetAllBindings procedure} -body {
    frame .t.f
    foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <less> <Meta-a> <Acircumflex>" {
	   bind .t.f $i Test
    }
    lsort [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {! <<Paste>> <Key-Acircumflex> <Key-Delete> <Key-Linefeed> <Key-Tab> <Key-less> <Key-space> <Meta-Key-a> a \{ ~}
test bind-11.2 {Tk_GetAllBindings procedure} -body {
    frame .t.f
    foreach i "<Double-1> <Triple-1> <Meta-Control-a> <Double-Alt-Enter> <1>" {
	   bind .t.f $i Test
    }
    lsort [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {<Button-1> <Control-Meta-Key-a> <Double-Alt-Enter> <Double-Button-1> <Triple-Button-1>}
test bind-11.3 {Tk_GetAllBindings procedure} -body {
    frame .t.f
    foreach i "<Double-Triple-1> abcd a<Leave>b" {
	   bind .t.f $i Test
    }
    lsort [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {<Triple-Button-1> a<Leave>b abcd}


................................................................................
test bind-12.1 {Tk_DeleteAllBindings procedure} -body {
    frame .t.f -class Test -width 150 -height 100
    destroy .t.f
} -result {}
test bind-12.2 {Tk_DeleteAllBindings procedure} -body {
    frame .t.f -class Test -width 150 -height 100
    foreach i "a b c <Meta-1> <Alt-a> <Control-a>" {
	   bind .t.f $i x
    }
    destroy .t.f
} -result {}

test bind-13.1 {Tk_BindEvent procedure} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
................................................................................
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
    set x {}
} -body {
    bindtags .t.f {a b c d e f g h i j k l m n o p}
        foreach p [bindtags .t.f] {
        bind $p <1> "lappend x $p"
    }
    event generate .t.f <1>
    return $x
} -cleanup {
    foreach p [bindtags .t.f] {bind $p <1> {}}
    destroy .t.f
................................................................................
    set x {}
} -body {
    bind .t.f <<Paste>> test
} -cleanup {
    destroy .t.f
} -result  {}
test bind-24.4 {FindSequence procedure: virtual not allowed} -body {
   event add <<Paste>> <<Alive>>
} -returnCodes error -result {virtual event not allowed in definition of another virtual event}
test bind-24.5 {FindSequence procedure, multiple bindings} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
................................................................................
test bind-25.17 {ParseEventDescription} -body {
    event add <<xyz>> <<abc>>
} -returnCodes error -result {virtual event not allowed in definition of another virtual event}

# Modifier canonicalization tests

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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>

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>

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 {
	destroy .t.f
} -result <Mod5-Key-a>

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

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

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>

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>

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 {
	destroy .t.f
} -result <Mod5-Key-a>

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

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

test bind-25.46 {modifier names} -setup {
	frame .t.f -class Test -width 150 -height 100
} -body {
	bind .t.f {<Double 1>} foo
	bind .t.f
} -cleanup {
	destroy .t.f
} -result <Double-Button-1>

test bind-25.47 {modifier names} -setup {
	frame .t.f -class Test -width 150 -height 100
} -body {
	bind .t.f <Triple-1> foo
	bind .t.f
} -cleanup {
	destroy .t.f
} -result <Triple-Button-1>

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>

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



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
} -cleanup {
	destroy .t.f
} -result <FocusIn>
test bind-26.2 {event names} -setup {
	frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <FocusOut> {nothing}
    bind .t.f
} -cleanup {
	destroy .t.f
} -result <FocusOut>
test bind-26.3 {event names} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
................................................................................

test bind-26.4 {event names: Motion} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Motion> "set x {event Motion}"
	set x xyzzy
	event generate .t.f <Motion>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Motion} <Motion>}

test bind-26.5 {event names: Button} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Button> "set x {event Button}"
	set x xyzzy
	event generate .t.f <Button>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Button} <Button>}

test bind-26.6 {event names: ButtonPress} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <ButtonPress> "set x {event ButtonPress}"
	set x xyzzy
	event generate .t.f <ButtonPress>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event ButtonPress} <Button>}

test bind-26.7 {event names: ButtonRelease} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <ButtonRelease> "set x {event ButtonRelease}"
	set x xyzzy
	event generate .t.f <ButtonRelease>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event ButtonRelease} <ButtonRelease>}

test bind-26.8 {event names: Colormap} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Colormap> "set x {event Colormap}"
	set x xyzzy
	event generate .t.f <Colormap>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Colormap} <Colormap>}

test bind-26.9 {event names: Enter} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Enter> "set x {event Enter}"
	set x xyzzy
	event generate .t.f <Enter>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Enter} <Enter>}

test bind-26.10 {event names: Leave} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Leave> "set x {event Leave}"
	set x xyzzy
	event generate .t.f <Leave>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Leave} <Leave>}

test bind-26.11 {event names: Expose} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Expose> "set x {event Expose}"
	set x xyzzy
	event generate .t.f <Expose>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Expose} <Expose>}

test bind-26.12 {event names: Key} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Key> "set x {event Key}"
	set x xyzzy
	event generate .t.f <Key>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Key} <Key>}

test bind-26.13 {event names: KeyPress} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <KeyPress> "set x {event KeyPress}"
	set x xyzzy
	event generate .t.f <KeyPress>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event KeyPress} <Key>}

test bind-26.14 {event names: KeyRelease} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <KeyRelease> "set x {event KeyRelease}"
	set x xyzzy
	event generate .t.f <KeyRelease>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event KeyRelease} <KeyRelease>}

test bind-26.15 {event names: Property} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Property> "set x {event Property}"
	set x xyzzy
	event generate .t.f <Property>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Property} <Property>}

test bind-26.16 {event names: Visibility} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Visibility> "set x {event Visibility}"
	set x xyzzy
	event generate .t.f <Visibility>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Visibility} <Visibility>}

test bind-26.17 {event names: Activate} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Activate> "set x {event Activate}"
	set x xyzzy
	event generate .t.f <Activate>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Activate} <Activate>}

test bind-26.18 {event names: Deactivate} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Deactivate> "set x {event Deactivate}"
	set x xyzzy
	event generate .t.f <Deactivate>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Deactivate} <Deactivate>}


# These events require an extra argument to [event generate]
test bind-26.19 {event names: Circulate} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Circulate> "set x {event Circulate}"
	set x xyzzy
	event generate .t.f <Circulate>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Circulate} <Circulate>}

test bind-26.20 {event names: Configure} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Configure> "set x {event Configure}"
	set x xyzzy
	event generate .t.f <Configure>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Configure} <Configure>}

test bind-26.21 {event names: Gravity} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Gravity> "set x {event Gravity}"
	set x xyzzy
	event generate .t.f <Gravity>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Gravity} <Gravity>}

test bind-26.22 {event names: Map} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Map> "set x {event Map}"
	set x xyzzy
	event generate .t.f <Map>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Map} <Map>}

test bind-26.23 {event names: Reparent} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Reparent> "set x {event Reparent}"
	set x xyzzy
	event generate .t.f <Reparent>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Reparent} <Reparent>}

test bind-26.24 {event names: Unmap} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
	bind .t.f <Unmap> "set x {event Unmap}"
	set x xyzzy
	event generate .t.f <Unmap>
	list $x [bind .t.f]
} -cleanup {
	destroy .t.f
} -result {{event Unmap} <Unmap>}


test bind-27.1 {button names} -body {
    bind .t <Expose-1> foo
} -returnCodes error -result {specified button "1" for non-button event}
test bind-27.2 {button names} -body {
................................................................................
    set x [bind .t.f]
    event generate .t.f <Button-5>
    event generate .t.f <ButtonRelease-5>
    set x
} -cleanup {
    destroy .t.f
} -result {<Button-5> {button 5}}
test bind-27.8 {button names} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Button-6> {lappend x "button 6"}
    set x [bind .t.f]
    event generate .t.f <Button-6>
    event generate .t.f <ButtonRelease-6>
    set x
} -cleanup {
    destroy .t.f
} -result {<Button-6> {button 6}}
test bind-27.9 {button names} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Button-7> {lappend x "button 7"}
    set x [bind .t.f]
    event generate .t.f <Button-7>
    event generate .t.f <ButtonRelease-7>
    set x
} -cleanup {
    destroy .t.f
} -result {<Button-7> {button 7}}
test bind-27.10 {button names} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Button-8> {lappend x "button 8"}
    set x [bind .t.f]
    event generate .t.f <Button-8>
    event generate .t.f <ButtonRelease-8>
    set x
} -cleanup {
    destroy .t.f
} -result {<Button-8> {button 8}}
test bind-27.11 {button names} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Button-9> {lappend x "button 9"}
    set x [bind .t.f]
    event generate .t.f <Button-9>
    event generate .t.f <ButtonRelease-9>
    set x
} -cleanup {
    destroy .t.f
} -result {<Button-9> {button 9}}

test bind-28.1 {keysym names} -body {
    bind .t <Expose-a> foo
} -returnCodes error -result {specified keysym "a" for non-key event}
test bind-28.2 {keysym names} -body {
    bind .t <Gorp> foo
} -returnCodes error -result {bad event type or keysym "Gorp"}
................................................................................
} -result {}


# cleanup
cleanupTests
return


# Local Variables:
# mode: tcl
# End:







|







 







|







 







|


|
|










|


|
|







 







|








|








|







 







|







 







|







 







|







 







|


|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|



|

|
|

|





|




|


|




|







 







|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|










|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|








|
|
|
|

|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
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
379
380
381
382
383
384
...
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
...
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
....
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
....
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
....
5491
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
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
....
5858
5859
5860
5861
5862
5863
5864
























































5865
5866
5867
5868
5869
5870
5871
....
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
update idletasks

foreach p [event info] {event delete $p}
foreach event [bind Test] {
    bind Test $event {}
}
foreach event [bind all] {
    bind all $event {}
}

proc unsetBindings {} {
    bind all <Enter> {}
    bind Test <Enter> {}
    bind Toplevel <Enter> {}
    bind xyz <Enter> {}
................................................................................
# events to make sure that there are no stray events in the ring
# buffer which might cause the pattern matcher to find unintended
# matches.  The size of the ring buffer is EVENT_BUFFER_SIZE, which is
# currently set to 30 (or 45 on macOS).  If this changes, the code
# below will need to change.
proc clearRingBuffer {{event}} {
    for {set i 0} {$i < 45} {incr i} {
        event generate . $event
    }
}

# move the mouse pointer away of the testing area
# otherwise some spurious events may pollute the tests
toplevel .top
wm geometry .top 50x50-50-50
................................................................................
    destroy .t.f
} -returnCodes ok
test bind-9.2 {Tk_DeleteBinding procedure} -setup {
    set result {}
} -body {
    frame .t.f -class Test -width 150 -height 100
    foreach i {a b c d} {
        bind .t.f $i "binding for $i"
    }
    foreach i {b d a c} {
        bind .t.f $i {}
        lappend result [lsort [bind .t.f]]
    }
    return $result
} -cleanup {
    destroy .t.f
} -result {{a c d} {a c} c {}}
test bind-9.3 {Tk_DeleteBinding procedure} -setup {
    set result {}
} -body {
    frame .t.f -class Test -width 150 -height 100
    foreach i {<1> <Meta-1> <Control-1> <Double-Alt-1>} {
        bind .t.f $i "binding for $i"
    }
    foreach i {<Control-1> <Double-Alt-1> <1> <Meta-1>} {
        bind .t.f $i {}
        lappend result [lsort [bind .t.f]]
    }
    return $result
} -cleanup {
    destroy .t.f
} -result {{<Button-1> <Double-Alt-Button-1> <Meta-Button-1>} {<Button-1> <Meta-Button-1>} <Meta-Button-1> {}}

test bind-10.1 {Tk_GetBinding procedure} -body {
................................................................................
} -cleanup {
    destroy .t.c
} -result {Test}

test bind-11.1 {Tk_GetAllBindings procedure} -body {
    frame .t.f
    foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <less> <Meta-a> <Acircumflex>" {
        bind .t.f $i Test
    }
    lsort [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {! <<Paste>> <Key-Acircumflex> <Key-Delete> <Key-Linefeed> <Key-Tab> <Key-less> <Key-space> <Meta-Key-a> a \{ ~}
test bind-11.2 {Tk_GetAllBindings procedure} -body {
    frame .t.f
    foreach i "<Double-1> <Triple-1> <Meta-Control-a> <Double-Alt-Enter> <1>" {
        bind .t.f $i Test
    }
    lsort [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {<Button-1> <Control-Meta-Key-a> <Double-Alt-Enter> <Double-Button-1> <Triple-Button-1>}
test bind-11.3 {Tk_GetAllBindings procedure} -body {
    frame .t.f
    foreach i "<Double-Triple-1> abcd a<Leave>b" {
        bind .t.f $i Test
    }
    lsort [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {<Triple-Button-1> a<Leave>b abcd}


................................................................................
test bind-12.1 {Tk_DeleteAllBindings procedure} -body {
    frame .t.f -class Test -width 150 -height 100
    destroy .t.f
} -result {}
test bind-12.2 {Tk_DeleteAllBindings procedure} -body {
    frame .t.f -class Test -width 150 -height 100
    foreach i "a b c <Meta-1> <Alt-a> <Control-a>" {
        bind .t.f $i x
    }
    destroy .t.f
} -result {}

test bind-13.1 {Tk_BindEvent procedure} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
................................................................................
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
    set x {}
} -body {
    bindtags .t.f {a b c d e f g h i j k l m n o p}
    foreach p [bindtags .t.f] {
        bind $p <1> "lappend x $p"
    }
    event generate .t.f <1>
    return $x
} -cleanup {
    foreach p [bindtags .t.f] {bind $p <1> {}}
    destroy .t.f
................................................................................
    set x {}
} -body {
    bind .t.f <<Paste>> test
} -cleanup {
    destroy .t.f
} -result  {}
test bind-24.4 {FindSequence procedure: virtual not allowed} -body {
    event add <<Paste>> <<Alive>>
} -returnCodes error -result {virtual event not allowed in definition of another virtual event}
test bind-24.5 {FindSequence procedure, multiple bindings} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
................................................................................
test bind-25.17 {ParseEventDescription} -body {
    event add <<xyz>> <<abc>>
} -returnCodes error -result {virtual event not allowed in definition of another virtual event}

# Modifier canonicalization tests

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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>

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>

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 {
    destroy .t.f
} -result <Mod5-Key-a>

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

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

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>

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>

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 {
    destroy .t.f
} -result <Mod5-Key-a>

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

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

test bind-25.46 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f {<Double 1>} foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Double-Button-1>

test bind-25.47 {modifier names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <Triple-1> foo
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <Triple-Button-1>

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>

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



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
} -cleanup {
    destroy .t.f
} -result <FocusIn>
test bind-26.2 {event names} -setup {
    frame .t.f -class Test -width 150 -height 100
} -body {
    bind .t.f <FocusOut> {nothing}
    bind .t.f
} -cleanup {
    destroy .t.f
} -result <FocusOut>
test bind-26.3 {event names} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
................................................................................

test bind-26.4 {event names: Motion} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Motion> "set x {event Motion}"
    set x xyzzy
    event generate .t.f <Motion>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Motion} <Motion>}

test bind-26.5 {event names: Button} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Button> "set x {event Button}"
    set x xyzzy
    event generate .t.f <Button>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Button} <Button>}

test bind-26.6 {event names: ButtonPress} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <ButtonPress> "set x {event ButtonPress}"
    set x xyzzy
    event generate .t.f <ButtonPress>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event ButtonPress} <Button>}

test bind-26.7 {event names: ButtonRelease} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <ButtonRelease> "set x {event ButtonRelease}"
    set x xyzzy
    event generate .t.f <ButtonRelease>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event ButtonRelease} <ButtonRelease>}

test bind-26.8 {event names: Colormap} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Colormap> "set x {event Colormap}"
    set x xyzzy
    event generate .t.f <Colormap>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Colormap} <Colormap>}

test bind-26.9 {event names: Enter} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Enter> "set x {event Enter}"
    set x xyzzy
    event generate .t.f <Enter>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Enter} <Enter>}

test bind-26.10 {event names: Leave} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Leave> "set x {event Leave}"
    set x xyzzy
    event generate .t.f <Leave>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Leave} <Leave>}

test bind-26.11 {event names: Expose} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Expose> "set x {event Expose}"
    set x xyzzy
    event generate .t.f <Expose>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Expose} <Expose>}

test bind-26.12 {event names: Key} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Key> "set x {event Key}"
    set x xyzzy
    event generate .t.f <Key>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Key} <Key>}

test bind-26.13 {event names: KeyPress} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <KeyPress> "set x {event KeyPress}"
    set x xyzzy
    event generate .t.f <KeyPress>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event KeyPress} <Key>}

test bind-26.14 {event names: KeyRelease} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <KeyRelease> "set x {event KeyRelease}"
    set x xyzzy
    event generate .t.f <KeyRelease>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event KeyRelease} <KeyRelease>}

test bind-26.15 {event names: Property} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Property> "set x {event Property}"
    set x xyzzy
    event generate .t.f <Property>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Property} <Property>}

test bind-26.16 {event names: Visibility} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Visibility> "set x {event Visibility}"
    set x xyzzy
    event generate .t.f <Visibility>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Visibility} <Visibility>}

test bind-26.17 {event names: Activate} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Activate> "set x {event Activate}"
    set x xyzzy
    event generate .t.f <Activate>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Activate} <Activate>}

test bind-26.18 {event names: Deactivate} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Deactivate> "set x {event Deactivate}"
    set x xyzzy
    event generate .t.f <Deactivate>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Deactivate} <Deactivate>}


# These events require an extra argument to [event generate]
test bind-26.19 {event names: Circulate} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Circulate> "set x {event Circulate}"
    set x xyzzy
    event generate .t.f <Circulate>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Circulate} <Circulate>}

test bind-26.20 {event names: Configure} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Configure> "set x {event Configure}"
    set x xyzzy
    event generate .t.f <Configure>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Configure} <Configure>}

test bind-26.21 {event names: Gravity} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Gravity> "set x {event Gravity}"
    set x xyzzy
    event generate .t.f <Gravity>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Gravity} <Gravity>}

test bind-26.22 {event names: Map} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Map> "set x {event Map}"
    set x xyzzy
    event generate .t.f <Map>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Map} <Map>}

test bind-26.23 {event names: Reparent} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Reparent> "set x {event Reparent}"
    set x xyzzy
    event generate .t.f <Reparent>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Reparent} <Reparent>}

test bind-26.24 {event names: Unmap} -setup {
    frame .t.f -class Test -width 150 -height 100
    pack .t.f
    focus -force .t.f
    update
} -body {
    bind .t.f <Unmap> "set x {event Unmap}"
    set x xyzzy
    event generate .t.f <Unmap>
    list $x [bind .t.f]
} -cleanup {
    destroy .t.f
} -result {{event Unmap} <Unmap>}


test bind-27.1 {button names} -body {
    bind .t <Expose-1> foo
} -returnCodes error -result {specified button "1" for non-button event}
test bind-27.2 {button names} -body {
................................................................................
    set x [bind .t.f]
    event generate .t.f <Button-5>
    event generate .t.f <ButtonRelease-5>
    set x
} -cleanup {
    destroy .t.f
} -result {<Button-5> {button 5}}

























































test bind-28.1 {keysym names} -body {
    bind .t <Expose-a> foo
} -returnCodes error -result {specified keysym "a" for non-key event}
test bind-28.2 {keysym names} -body {
    bind .t <Gorp> foo
} -returnCodes error -result {bad event type or keysym "Gorp"}
................................................................................
} -result {}


# cleanup
cleanupTests
return

# vi:set ts=4 sw=4 et:
# Local Variables:
# mode: tcl
# End: