From 86117d2cc447639b43efbda01722556f6774a55e Mon Sep 17 00:00:00 2001 From: oehhar Date: Tue, 17 Dec 2019 20:30:46 +0000 Subject: Add scrollwheel bindings to ttk::scrollbar. Ticket [2b8fa6fd] --- library/ttk/scrollbar.tcl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl index d08e1e2..8415e55 100644 --- a/library/ttk/scrollbar.tcl +++ b/library/ttk/scrollbar.tcl @@ -17,6 +17,28 @@ bind TScrollbar { ttk::scrollbar::Jump %W %x %y } bind TScrollbar { ttk::scrollbar::Drag %W %x %y } bind TScrollbar { ttk::scrollbar::Release %W %x %y } +if {[tk windowingsystem] eq "aqua"} { + bind TScrollbar { + ttk::scrollbar::Scroll %W [expr {-(%D)}] units + } + bind TScrollbar { + ttk::scrollbar::Scroll %W [expr {-10 * (%D)}] units + } +} else { + bind TScrollbar { + if {%D >= 0} { + ttk::scrollbar::Scroll %W [expr {-%D/30}] units + } else { + ttk::scrollbar::Scroll %W [expr {(29-%D)/30}] units + } + } +} + +if {[tk windowingsystem] eq "x11"} { + bind TScrollbar <4> {ttk::scrollbar::Scroll %W -5 units} + bind TScrollbar <5> {ttk::scrollbar::Scroll %W 5 units} +} + proc ttk::scrollbar::Scroll {w n units} { set cmd [$w cget -command] if {$cmd ne ""} { -- cgit v0.12 From f7d17524cea6a603a9e47519d8e8864080f1bf2d Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 19 Dec 2019 13:08:49 +0000 Subject: Redirect scroll wheel related bindings from ttk::scrollbar to scrollbar as proposed by Csaba 2019-12-18 09:42:32 in Ticket [2b8fa6fd] --- library/ttk/scrollbar.tcl | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl index 8415e55..efcf3a1 100644 --- a/library/ttk/scrollbar.tcl +++ b/library/ttk/scrollbar.tcl @@ -17,27 +17,26 @@ bind TScrollbar { ttk::scrollbar::Jump %W %x %y } bind TScrollbar { ttk::scrollbar::Drag %W %x %y } bind TScrollbar { ttk::scrollbar::Release %W %x %y } -if {[tk windowingsystem] eq "aqua"} { - bind TScrollbar { - ttk::scrollbar::Scroll %W [expr {-(%D)}] units - } - bind TScrollbar { - ttk::scrollbar::Scroll %W [expr {-10 * (%D)}] units +# Redirect scrollwheel bindings to the scrollbar widget +# +# The shift-bindings scroll left/right (not up/down) +# if a widget has both possibilities +set eventList [list ] +switch [tk windowingsystem] { + aqua { + lappend eventList } -} else { - bind TScrollbar { - if {%D >= 0} { - ttk::scrollbar::Scroll %W [expr {-%D/30}] units - } else { - ttk::scrollbar::Scroll %W [expr {(29-%D)/30}] units - } + x11 { + lappend eventList \ + + # For tk 8.7, the event list should be extended by + # } } - -if {[tk windowingsystem] eq "x11"} { - bind TScrollbar <4> {ttk::scrollbar::Scroll %W -5 units} - bind TScrollbar <5> {ttk::scrollbar::Scroll %W 5 units} +foreach event $eventList { + bind TScrollbar $event [bind Scrollbar $event] } +unset eventList event proc ttk::scrollbar::Scroll {w n units} { set cmd [$w cget -command] -- cgit v0.12 From 04b5b8308a21d68a6850624faa9dfe3988363c94 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 23 Dec 2019 13:58:50 +0000 Subject: Add test canvText-14.7, currently failing and demonstrating bug [1771594fff] --- tests/canvText.test | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/canvText.test b/tests/canvText.test index b2af39b..76903d7 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -803,6 +803,25 @@ test canvText-14.6 {select clear errors} -setup { } -cleanup { .c delete test } -returnCodes error -result "wrong \# args: should be \".c select clear\"" +test canvText-14.7 {GetTextIndex procedure: pixel index with non-default scrollregion} -setup { + canvas .cc + .cc create text 50 80 -tag test -text Hello -anchor nw -font "Arial 30" + foreach {xmin ymin xmax ymax} [.cc bbox test] {} +} -body { + # default -scrollregion + set res [.cc index test @$xmin,$ymin] + lappend res [.cc index test @$xmax,$ymax] + # -scrollregion with positive upper left corner + .cc configure -scrollregion {50 50 700 900} + lappend res [.cc index test @$xmin,$ymin] + lappend res [.cc index test @$xmax,$ymax] + # -scrollregion with negative upper left corner + .cc configure -scrollregion {-100 -100 700 900} + lappend res [.cc index test @$xmin,$ymin] + lappend res [.cc index test @$xmax,$ymax] +} -cleanup { + destroy .cc +} -result {0 5 0 5 0 5} test canvText-15.1 {SetTextCursor procedure} -setup { .c create text 0 0 -tag test -- cgit v0.12 From ecf107511446fc5f2143d963b23f5a63020a04b3 Mon Sep 17 00:00:00 2001 From: fvogel Date: Mon, 23 Dec 2019 13:59:54 +0000 Subject: Fix [1771594fff]: icursor @x,y fails for non-default scrollregions. Test canvText-14.7 now passes. --- generic/tkCanvText.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 84b2a23..48c0a9d 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -1392,8 +1392,8 @@ GetTextIndex( goto badIndex; } y = (int) ((tmp < 0) ? tmp - 0.5 : tmp + 0.5); - x += canvasPtr->scrollX1 - (int) textPtr->drawOrigin[0]; - y += canvasPtr->scrollY1 - (int) textPtr->drawOrigin[1]; + x -= (int) textPtr->drawOrigin[0]; + y -= (int) textPtr->drawOrigin[1]; *indexPtr = Tk_PointToChar(textPtr->textLayout, (int) (x*c - y*s), (int) (y*c + x*s)); } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) { -- cgit v0.12 From b701fc4005aa9bcac2fa922c63099ed6f3c36b48 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 13:04:10 +0000 Subject: Add tests canvas-20.[123], currently failing and demonstrating ticket [587937fff]. --- tests/canvas.test | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/canvas.test b/tests/canvas.test index fe4c2b7..7b24a9a 100644 --- a/tests/canvas.test +++ b/tests/canvas.test @@ -950,6 +950,42 @@ test canvas-19.11 {rchars method - errors} -setup { destroy .c } -returnCodes error -result {bad index "foo"} +test canvas-20.1 {addtag/dtag - no shuffling of tag sequence} -setup { + canvas .c + .c create text 100 100 -text Hello + for {set i 1} {$i < 5} {incr i} { + .c addtag tag$i all + } +} -body { + set res [list [.c gettags 1]] + .c dtag 1 tag2 + lappend res [.c gettags 1] +} -cleanup { + destroy .c +} -result {{tag1 tag2 tag3 tag4} {tag1 tag3 tag4}} +test canvas-20.2 {tag deletion - multiple tags with same name, no shuffling} -setup { + canvas .c + .c create text 100 100 -text Hello + .c itemconfigure 1 -tags {tagA tagB tagA tagA tagC tagA} +} -body { + set res [list [.c gettags 1]] + .c dtag 1 tagA + lappend res [.c gettags 1] +} -cleanup { + destroy .c +} -result {{tagA tagB tagA tagA tagC tagA} {tagB tagC}} +test canvas-20.3 {tag deletion - all tags match} -setup { + canvas .c + .c create text 100 100 -text Hello + .c itemconfigure 1 -tags {tagA tagA tagA tagA tagA tagA} +} -body { + set res [list [.c gettags 1]] + .c dtag 1 tagA + lappend res [.c gettags 1] +} -cleanup { + destroy .c +} -result {{tagA tagA tagA tagA tagA tagA} {}} + # cleanup imageCleanup cleanupTests -- cgit v0.12 From 46ffc538b8aa3e274e4c8b567de60ee2db34a16f Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 13:14:59 +0000 Subject: A first implementation fixing [587937fff]: Don't shuffle tag list sequence upon deletion. This implementation is not efficient (it's O(n^2)) and will not be kept. --- generic/tkCanvas.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index ce3dad1..b2007ea 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1436,7 +1436,7 @@ CanvasWidgetCmd( } case CANV_DTAG: { Tk_Uid tag; - int i; + int i, j; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?tagToDelete?"); @@ -1449,12 +1449,16 @@ CanvasWidgetCmd( tag = Tk_GetUid(Tcl_GetString(objv[2])); } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { - for (i = itemPtr->numTags-1; i >= 0; i--) { - if (itemPtr->tagPtr[i] == tag) { - itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1]; - itemPtr->numTags--; - } - } + for (i = 0; i < itemPtr->numTags; i++) { + if (itemPtr->tagPtr[i] == tag) { + for (j = i; j < itemPtr->numTags - 1; j++) { + itemPtr->tagPtr[j] = itemPtr->tagPtr[j+1]; + } + itemPtr->numTags--; + i--; /* deal with the case of successive identical tag to remove */ + /* No break here: all tags with the same name must be deleted */ + } + } } break; } -- cgit v0.12 From 6be2c46561365097393960144e8ba97683718a74 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 13:17:52 +0000 Subject: A second (and better) implementation fixing [587937fff]: Don't shuffle tag list sequence upon deletion. This implementation is more efficient (it's O(n)). --- generic/tkCanvas.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index b2007ea..2c1038a 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1436,7 +1436,7 @@ CanvasWidgetCmd( } case CANV_DTAG: { Tk_Uid tag; - int i, j; + int i; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?tagToDelete?"); @@ -1451,12 +1451,28 @@ CanvasWidgetCmd( FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { for (i = 0; i < itemPtr->numTags; i++) { if (itemPtr->tagPtr[i] == tag) { - for (j = i; j < itemPtr->numTags - 1; j++) { - itemPtr->tagPtr[j] = itemPtr->tagPtr[j+1]; - } + + /* + * Don't shuffle the tags sequence: memmove the tags. + */ + + memmove((void *)(itemPtr->tagPtr + i), + (void *)(itemPtr->tagPtr + i + 1), + sizeof(Tk_Uid *) * (itemPtr->numTags - (i+1))); itemPtr->numTags--; - i--; /* deal with the case of successive identical tag to remove */ - /* No break here: all tags with the same name must be deleted */ + + /* + * Look at the same place again to deal with the case of + * successive identical tags matching the tag to delete. + */ + + i--; + + /* + * There must be no break here: all tags with the same name must + * be deleted. + */ + } } } -- cgit v0.12 From 24d5264e2ac5971cf61105b3b3aedc000d8c8051 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 13:22:37 +0000 Subject: Refine the second implementation fixing [587937fff]: Don't shuffle tag list sequence upon deletion. --- generic/tkCanvas.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 2c1038a..9f57971 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1449,7 +1449,7 @@ CanvasWidgetCmd( tag = Tk_GetUid(Tcl_GetString(objv[2])); } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { - for (i = 0; i < itemPtr->numTags; i++) { + for (i = itemPtr->numTags-1; i >= 0; i--) { if (itemPtr->tagPtr[i] == tag) { /* @@ -1462,13 +1462,6 @@ CanvasWidgetCmd( itemPtr->numTags--; /* - * Look at the same place again to deal with the case of - * successive identical tags matching the tag to delete. - */ - - i--; - - /* * There must be no break here: all tags with the same name must * be deleted. */ -- cgit v0.12 From ef83d456ae8d36339b13f6b426f9410fb3e750aa Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 13:24:47 +0000 Subject: Restore tabs on lines that were actually not changed by the fix. --- generic/tkCanvas.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 9f57971..5e89c6d 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1449,8 +1449,8 @@ CanvasWidgetCmd( tag = Tk_GetUid(Tcl_GetString(objv[2])); } FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { - for (i = itemPtr->numTags-1; i >= 0; i--) { - if (itemPtr->tagPtr[i] == tag) { + for (i = itemPtr->numTags-1; i >= 0; i--) { + if (itemPtr->tagPtr[i] == tag) { /* * Don't shuffle the tags sequence: memmove the tags. @@ -1459,15 +1459,15 @@ CanvasWidgetCmd( memmove((void *)(itemPtr->tagPtr + i), (void *)(itemPtr->tagPtr + i + 1), sizeof(Tk_Uid *) * (itemPtr->numTags - (i+1))); - itemPtr->numTags--; + itemPtr->numTags--; /* * There must be no break here: all tags with the same name must * be deleted. */ - } - } + } + } } break; } -- cgit v0.12 From 6229b57ab2249ecd2859c4df8774373544bb771e Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 13:31:56 +0000 Subject: Fix error (with no consequence) in sizeof() request, and remove useless cast to (void *) --- generic/tkCanvas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 5e89c6d..23dd716 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -1457,8 +1457,8 @@ CanvasWidgetCmd( */ memmove((void *)(itemPtr->tagPtr + i), - (void *)(itemPtr->tagPtr + i + 1), - sizeof(Tk_Uid *) * (itemPtr->numTags - (i+1))); + itemPtr->tagPtr + i + 1, + (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); itemPtr->numTags--; /* -- cgit v0.12 From f37b93c168dceaa44bdaecc4cf27cab9bee6bc01 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 14:11:25 +0000 Subject: Don't shuffle tags when moving the 'current' tag among items. --- generic/tkCanvas.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 23dd716..4d68ade 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -4988,7 +4988,9 @@ PickCurrentItem( if (itemPtr->tagPtr[i] == searchUids->currentUid) #endif /* USE_OLD_TAG_SEARCH */ /* then */ { - itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1]; + memmove((void *)(itemPtr->tagPtr + i), + itemPtr->tagPtr + i + 1, + (itemPtr->numTags - (i+1)) * sizeof(Tk_Uid)); itemPtr->numTags--; break; } -- cgit v0.12 From 4323631f76cd706413e092b281b6fdf49fd5875c Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Dec 2019 14:20:10 +0000 Subject: Refine the newly added tests, and add comments in them. --- tests/canvas.test | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/canvas.test b/tests/canvas.test index 7b24a9a..697badb 100644 --- a/tests/canvas.test +++ b/tests/canvas.test @@ -953,10 +953,12 @@ test canvas-19.11 {rchars method - errors} -setup { test canvas-20.1 {addtag/dtag - no shuffling of tag sequence} -setup { canvas .c .c create text 100 100 -text Hello +} -body { for {set i 1} {$i < 5} {incr i} { .c addtag tag$i all } -} -body { + # [.c addtags] only adds tags that are not already present + .c addtag tag1 all ; # no effect set res [list [.c gettags 1]] .c dtag 1 tag2 lappend res [.c gettags 1] @@ -966,8 +968,10 @@ test canvas-20.1 {addtag/dtag - no shuffling of tag sequence} -setup { test canvas-20.2 {tag deletion - multiple tags with same name, no shuffling} -setup { canvas .c .c create text 100 100 -text Hello - .c itemconfigure 1 -tags {tagA tagB tagA tagA tagC tagA} } -body { + # [.c itemconfigure -tags] lets the user add duplicate tags + # this is not a problem although inconsistent with [.c addtags] + .c itemconfigure 1 -tags {tagA tagB tagA tagA tagC tagA} set res [list [.c gettags 1]] .c dtag 1 tagA lappend res [.c gettags 1] @@ -977,8 +981,10 @@ test canvas-20.2 {tag deletion - multiple tags with same name, no shuffling} -se test canvas-20.3 {tag deletion - all tags match} -setup { canvas .c .c create text 100 100 -text Hello - .c itemconfigure 1 -tags {tagA tagA tagA tagA tagA tagA} } -body { + # [.c itemconfigure -tags] lets the user add duplicate tags + # this is not a problem although inconsistent with [.c addtags] + .c itemconfigure 1 -tags {tagA tagA tagA tagA tagA tagA} set res [list [.c gettags 1]] .c dtag 1 tagA lappend res [.c gettags 1] -- cgit v0.12 From ad70eff05f252ec70a80613d34567f6433658bc9 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 25 Dec 2019 18:08:46 +0000 Subject: Fix [279b027fd7]: canvas moveto command moves text items to unexpected location, by documenting the feature more clearly. --- doc/canvas.n | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/canvas.n b/doc/canvas.n index 7dbfd19..0e41e0e 100644 --- a/doc/canvas.n +++ b/doc/canvas.n @@ -753,7 +753,8 @@ This command returns an empty string. \fIpathName \fBmoveto \fItagOrId xPos yPos\fR .VS 8.6 Move the items given by \fItagOrId\fR in the canvas coordinate -space so that the first coordinate pair of the bottommost item with +space so that the first coordinate pair (the upper-left corner of the +bounding box) of the first item (the lowest in the display list) with tag \fItagOrId\fR is located at position (\fIxPos\fR,\fIyPos\fR). \fIxPos\fR and \fIyPos\fR may be the empty string, in which case the corresponding coordinate -- cgit v0.12 From c7dea872968dccc663429d1843a0e33cac7896d6 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 25 Dec 2019 20:17:15 +0000 Subject: Fix [1660674fff]: arrow reconfig triggers infinite Enter/Leave event sequence, by better documenting the caveat. --- doc/canvas.n | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/canvas.n b/doc/canvas.n index 7dbfd19..f446936 100644 --- a/doc/canvas.n +++ b/doc/canvas.n @@ -1523,6 +1523,12 @@ ends of the line. \fBlast\fR (for an arrowhead at the last point of the line), or \fBboth\fR (for arrowheads at both ends). This option defaults to \fBnone\fR. +When requested to draw an arrowhead, Tk internally adjusts the corresponding +line end point so that the rendered line ends at the neck of the arrowhead +rather than at its tip so that the line doesn't extend past the edge of the +arrowhead. This may trigger a \fBLeave\fR event if the mouse is hovering this +line end. Conversely, when removing an arrowhead Tk adjusts the corresponding +line point the other way round, which may trigger an \fBEnter\fR event. .TP \fB\-arrowshape \fIshape\fR This option indicates how to draw arrowheads. -- cgit v0.12 From 7c5f83bfa0d7fe0574aea27159fe5363866913c2 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 31 Dec 2019 14:03:02 +0000 Subject: Fix [077d49828b]: notebook tab 'ambiguous compound' failure/regression, by making options of type TK_OPTION_STRING_TABLE support the TK_OPTION_NULL_OK flag. --- doc/SetOptions.3 | 4 +++- generic/tkConfig.c | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/SetOptions.3 b/doc/SetOptions.3 index b5f0782..ae6e353 100644 --- a/doc/SetOptions.3 +++ b/doc/SetOptions.3 @@ -443,7 +443,9 @@ suitable for passing to \fBTcl_GetIndexFromObj\fR. The value must be one of the strings in the table, or a unique abbreviation of one of the strings. The internal form is an integer giving the index into the table of the matching string, like the return value -from \fBTcl_GetStringFromObj\fR. +from \fBTcl_GetStringFromObj\fR. This option type supports the +\fBTK_OPTION_NULL_OK\fR flag; if a NULL value is set, the internal +representation is set to -1. .TP \fBTK_OPTION_SYNONYM\fR This type is used to provide alternative names for an option (for diff --git a/generic/tkConfig.c b/generic/tkConfig.c index f1a5176..44af1ea 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -678,11 +678,16 @@ DoObjConfig( case TK_OPTION_STRING_TABLE: { int newValue; - if (Tcl_GetIndexFromObjStruct(interp, valuePtr, - optionPtr->specPtr->clientData, sizeof(char *), - optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) { - return TCL_ERROR; - } + if (nullOK && ObjectIsEmpty(valuePtr)) { + valuePtr = NULL; + newValue = -1; + } else { + if (Tcl_GetIndexFromObjStruct(interp, valuePtr, + optionPtr->specPtr->clientData, sizeof(char *), + optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) { + return TCL_ERROR; + } + } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newValue; -- cgit v0.12 From 789fefef4c9c8cd6433a86b1712c1a7ed0ca3bee Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 1 Jan 2020 15:29:34 +0000 Subject: Document the change of default value for the -compound widget option. --- doc/ttk_intro.n | 2 +- doc/ttk_widget.n | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n index 07e071b..581cb44 100644 --- a/doc/ttk_intro.n +++ b/doc/ttk_intro.n @@ -60,7 +60,7 @@ For example, the \fBtext\fR element (which displays a text string) has \fB\-text\fR, \fB\-font\fR, \fB\-foreground\fR, \fB\-background\fR, \fB\-underline\fR, and \fB\-width\fR options. -The value of an element option is taken from: +The value of an element option is taken from (in precedence order): .IP \(bu an option of the same name and type in the widget containing the element; .IP \(bu diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n index 281ce74..51c0dbd 100644 --- a/doc/ttk_widget.n +++ b/doc/ttk_widget.n @@ -74,6 +74,9 @@ and other button-like widgets: .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. +If set to the empty string (the default), the rules described in the +"Elements" section of \fIttk::intro(n)\fR explain which value is actually +used. Valid values are: .RS .IP text @@ -88,7 +91,7 @@ Display text centered on top of image. .IP right Display image above, below, left of, or right of the text, respectively. .IP none -The default; display the image if present, otherwise the text. +Display the image if present, otherwise the text. .RE .OP \-image image Image Specifies an image to display. -- cgit v0.12 From 06fadab9e665084e4cf25db7685025e33b4384bb Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 2 Jan 2020 14:55:52 +0000 Subject: Fix [2830360fff]: ttk::entry looses state invalid at focus events --- generic/ttk/ttkEntry.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 4862e99..352c53a 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -650,8 +650,12 @@ static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) static void EntryRevalidateBG(Entry *entryPtr, VREASON reason) { Tcl_Interp *interp = entryPtr->core.interp; - if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { - Tcl_BackgroundException(interp, TCL_ERROR); + VMODE vmode = entryPtr->entry.validate; + + if (EntryNeedsValidation(vmode, reason)) { + if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { + Tcl_BackgroundException(interp, TCL_ERROR); + } } } -- cgit v0.12 From cfaf3bb262bde15d44e1fe6b640cce1eb165d891 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 2 Jan 2020 15:12:50 +0000 Subject: Add non-regression test entry-10.1 --- tests/ttk/entry.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 34795fe..8b5f490 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -312,4 +312,16 @@ test entry-9.1 "Index range invariants" -setup { destroy .e } +test entry-10.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup { + pack [ttk::entry .e] + update +} -body { + .e state invalid + set res [.e state] + event generate .e + lappend res [.e state] +} -result {invalid invalid} -cleanup { + destroy .e +} + tcltest::cleanupTests -- cgit v0.12 From b2d94807a8c675405e9f3fe7153b847bd2a34985 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 6 Jan 2020 16:21:42 +0000 Subject: Update documentation: Add many keysym's which are available now, due to the upgrade to X11R6 compat layer. --- doc/event.n | 2 +- doc/keysyms.n | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+), 1 deletion(-) diff --git a/doc/event.n b/doc/event.n index 9ab48e5..3e084d7 100644 --- a/doc/event.n +++ b/doc/event.n @@ -568,7 +568,7 @@ Starting from the preceding example, if the following code is executed: .PP .CS bind Entry {} -\fBevent add\fR <> +\fBevent add\fR <> .CE .PP the behavior will change such in two ways. First, the shadowed diff --git a/doc/keysyms.n b/doc/keysyms.n index e107219..c4c02fd 100644 --- a/doc/keysyms.n +++ b/doc/keysyms.n @@ -2037,6 +2037,55 @@ braille_dots_345678 16787708 0x10028FC braille_dots_1345678 16787709 0x10028FD braille_dots_2345678 16787710 0x10028FE braille_dots_12345678 16787711 0x10028FF +SunFA_Grave 268828416 0x1005FF00 +SunFA_Circum 268828417 0x1005FF01 +SunFA_Tilde 268828418 0x1005FF02 +SunFA_Acute 268828419 0x1005FF03 +SunFA_Diaeresis 268828420 0x1005FF04 +SunFA_Cedilla 268828421 0x1005FF05 +SunF36 268828432 0x1005FF10 +SunF37 268828433 0x1005FF11 +SunSys_Req 268828512 0x1005FF60 +SunProps 268828528 0x1005FF70 +SunFront 268828529 0x1005FF71 +SunCopy 268828530 0x1005FF72 +SunOpen 268828531 0x1005FF73 +SunPaste 268828532 0x1005FF74 +SunCut 268828533 0x1005FF75 +SunPowerSwitch 268828534 0x1005FF76 +SunAudioLowerVolume 268828535 0x1005FF77 +SunAudioMute 268828536 0x1005FF78 +SunAudioRaiseVolume 268828537 0x1005FF79 +SunVideoDegauss 268828538 0x1005FF7A +SunVideoLowerBrightness 268828539 0x1005FF7B +SunVideoRaiseBrightness 268828540 0x1005FF7C +SunPowerSwitchShift 268828541 0x1005FF7D +XF86Switch_VT_1 269024769 0x1008FE01 +XF86Switch_VT_2 269024770 0x1008FE02 +XF86Switch_VT_3 269024771 0x1008FE03 +XF86Switch_VT_4 269024772 0x1008FE04 +XF86Switch_VT_5 269024773 0x1008FE05 +XF86Switch_VT_6 269024774 0x1008FE06 +XF86Switch_VT_7 269024775 0x1008FE07 +XF86Switch_VT_8 269024776 0x1008FE08 +XF86Switch_VT_9 269024777 0x1008FE09 +XF86Switch_VT_10 269024778 0x1008FE0A +XF86Switch_VT_11 269024779 0x1008FE0B +XF86Switch_VT_12 269024780 0x1008FE0C +XF86Ungrab 269024800 0x1008FE20 +XF86ClearGrab 269024801 0x1008FE21 +XF86Next_VMode 269024802 0x1008FE22 +XF86Prev_VMode 269024803 0x1008FE23 +XF86LogWindowTree 269024804 0x1008FE24 +XF86LogGrabInfo 269024805 0x1008FE25 +XF86ModeLock 269025025 0x1008FF01 +XF86MonBrightnessUp 269025026 0x1008FF02 +XF86MonBrightnessDown 269025027 0x1008FF03 +XF86KbdLightOnOff 269025028 0x1008FF04 +XF86KbdBrightnessUp 269025029 0x1008FF05 +XF86KbdBrightnessDown 269025030 0x1008FF06 +XF86MonBrightnessCycle 269025031 0x1008FF07 +XF86Standby 269025040 0x1008FF10 XF86AudioLowerVolume 269025041 0x1008FF11 XF86AudioMute 269025042 0x1008FF12 XF86AudioRaiseVolume 269025043 0x1008FF13 @@ -2044,6 +2093,156 @@ XF86AudioPlay 269025044 0x1008FF14 XF86AudioStop 269025045 0x1008FF15 XF86AudioPrev 269025046 0x1008FF16 XF86AudioNext 269025047 0x1008FF17 +XF86HomePage 269025048 0x1008FF18 +XF86Mail 269025049 0x1008FF19 +XF86Start 269025050 0x1008FF1A +XF86Search 269025051 0x1008FF1B +XF86AudioRecord 269025052 0x1008FF1C +XF86Calculator 269025053 0x1008FF1D +XF86Memo 269025054 0x1008FF1E +XF86ToDoList 269025055 0x1008FF1F +XF86Calendar 269025056 0x1008FF20 +XF86PowerDown 269025057 0x1008FF21 +XF86ContrastAdjust 269025058 0x1008FF22 +XF86RockerUp 269025059 0x1008FF23 +XF86RockerDown 269025060 0x1008FF24 +XF86RockerEnter 269025061 0x1008FF25 +XF86Back 269025062 0x1008FF26 +XF86Forward 269025063 0x1008FF27 +XF86Stop 269025064 0x1008FF28 +XF86Refresh 269025065 0x1008FF29 +XF86PowerOff 269025066 0x1008FF2A +XF86WakeUp 269025067 0x1008FF2B +XF86Eject 269025068 0x1008FF2C +XF86ScreenSaver 269025069 0x1008FF2D +XF86WWW 269025070 0x1008FF2E +XF86Sleep 269025071 0x1008FF2F +XF86Favorites 269025072 0x1008FF30 +XF86AudioPause 269025073 0x1008FF31 +XF86AudioMedia 269025074 0x1008FF32 +XF86MyComputer 269025075 0x1008FF33 +XF86VendorHome 269025076 0x1008FF34 +XF86LightBulb 269025077 0x1008FF35 +XF86Shop 269025078 0x1008FF36 +XF86History 269025079 0x1008FF37 +XF86OpenURL 269025080 0x1008FF38 +XF86AddFavorite 269025081 0x1008FF39 +XF86HotLinks 269025082 0x1008FF3A +XF86BrightnessAdjust 269025083 0x1008FF3B +XF86Finance 269025084 0x1008FF3C +XF86Community 269025085 0x1008FF3D +XF86AudioRewind 269025086 0x1008FF3E +XF86BackForward 269025087 0x1008FF3F +XF86Launch0 269025088 0x1008FF40 +XF86Launch1 269025089 0x1008FF41 +XF86Launch2 269025090 0x1008FF42 +XF86Launch3 269025091 0x1008FF43 +XF86Launch4 269025092 0x1008FF44 +XF86Launch5 269025093 0x1008FF45 +XF86Launch6 269025094 0x1008FF46 +XF86Launch7 269025095 0x1008FF47 +XF86Launch8 269025096 0x1008FF48 +XF86Launch9 269025097 0x1008FF49 +XF86LaunchA 269025098 0x1008FF4A +XF86LaunchB 269025099 0x1008FF4B +XF86LaunchC 269025100 0x1008FF4C +XF86LaunchD 269025101 0x1008FF4D +XF86LaunchE 269025102 0x1008FF4E +XF86LaunchF 269025103 0x1008FF4F +XF86ApplicationLeft 269025104 0x1008FF50 +XF86ApplicationRight 269025105 0x1008FF51 +XF86Book 269025106 0x1008FF52 +XF86CD 269025107 0x1008FF53 +XF86Calculater 269025108 0x1008FF54 +XF86Clear 269025109 0x1008FF55 +XF86Close 269025110 0x1008FF56 +XF86Copy 269025111 0x1008FF57 +XF86Cut 269025112 0x1008FF58 +XF86Display 269025113 0x1008FF59 +XF86DOS 269025114 0x1008FF5A +XF86Documents 269025115 0x1008FF5B +XF86Excel 269025116 0x1008FF5C +XF86Explorer 269025117 0x1008FF5D +XF86Game 269025118 0x1008FF5E +XF86Go 269025119 0x1008FF5F +XF86iTouch 269025120 0x1008FF60 +XF86LogOff 269025121 0x1008FF61 +XF86Market 269025122 0x1008FF62 +XF86Meeting 269025123 0x1008FF63 +XF86MenuKB 269025125 0x1008FF65 +XF86MenuPB 269025126 0x1008FF66 +XF86MySites 269025127 0x1008FF67 +XF86New 269025128 0x1008FF68 +XF86News 269025129 0x1008FF69 +XF86OfficeHome 269025130 0x1008FF6A +XF86Open 269025131 0x1008FF6B +XF86Option 269025132 0x1008FF6C +XF86Paste 269025133 0x1008FF6D +XF86Phone 269025134 0x1008FF6E +XF86Q 269025136 0x1008FF70 +XF86Reply 269025138 0x1008FF72 +XF86Reload 269025139 0x1008FF73 +XF86RotateWindows 269025140 0x1008FF74 +XF86RotationPB 269025141 0x1008FF75 +XF86RotationKB 269025142 0x1008FF76 +XF86Save 269025143 0x1008FF77 +XF86ScrollUp 269025144 0x1008FF78 +XF86ScrollDown 269025145 0x1008FF79 +XF86ScrollClick 269025146 0x1008FF7A +XF86Send 269025147 0x1008FF7B +XF86Spell 269025148 0x1008FF7C +XF86SplitScreen 269025149 0x1008FF7D +XF86Support 269025150 0x1008FF7E +XF86TaskPane 269025151 0x1008FF7F +XF86Terminal 269025152 0x1008FF80 +XF86Tools 269025153 0x1008FF81 +XF86Travel 269025154 0x1008FF82 +XF86UserPB 269025156 0x1008FF84 +XF86User1KB 269025157 0x1008FF85 +XF86User2KB 269025158 0x1008FF86 +XF86Video 269025159 0x1008FF87 +XF86WheelButton 269025160 0x1008FF88 +XF86Word 269025161 0x1008FF89 +XF86Xfer 269025162 0x1008FF8A +XF86ZoomIn 269025163 0x1008FF8B +XF86ZoomOut 269025164 0x1008FF8C +XF86Away 269025165 0x1008FF8D +XF86Messenger 269025166 0x1008FF8E +XF86WebCam 269025167 0x1008FF8F +XF86MailForward 269025168 0x1008FF90 +XF86Pictures 269025169 0x1008FF91 +XF86Music 269025170 0x1008FF92 +XF86Battery 269025171 0x1008FF93 +XF86Bluetooth 269025172 0x1008FF94 +XF86WLAN 269025173 0x1008FF95 +XF86UWB 269025174 0x1008FF96 +XF86AudioForward 269025175 0x1008FF97 +XF86AudioRepeat 269025176 0x1008FF98 +XF86AudioRandomPlay 269025177 0x1008FF99 +XF86Subtitle 269025178 0x1008FF9A +XF86AudioCycleTrack 269025179 0x1008FF9B +XF86CycleAngle 269025180 0x1008FF9C +XF86FrameBack 269025181 0x1008FF9D +XF86FrameForward 269025182 0x1008FF9E +XF86Time 269025183 0x1008FF9F +XF86Select 269025184 0x1008FFA0 +XF86View 269025185 0x1008FFA1 +XF86TopMenu 269025186 0x1008FFA2 +XF86Red 269025187 0x1008FFA3 +XF86Green 269025188 0x1008FFA4 +XF86Yellow 269025189 0x1008FFA5 +XF86Blue 269025190 0x1008FFA6 +XF86Suspend 269025191 0x1008FFA7 +XF86Hibernate 269025192 0x1008FFA8 +XF86TouchpadToggle 269025193 0x1008FFA9 +XF86TouchpadOn 269025200 0x1008FFB0 +XF86TouchpadOff 269025201 0x1008FFB1 +XF86AudioMicMute 269025202 0x1008FFB2 +XF86Keyboard 269025203 0x1008FFB3 +XF86WWAN 269025204 0x1008FFB4 +XF86RFKill 269025205 0x1008FFB5 +XF86AudioPreset 269025206 0x1008FFB6 +XF86RotationLockToggle 269025207 0x1008FFB7 .CE .SH "SEE ALSO" bind(n), event(n) -- cgit v0.12 From e50ff59782eb62c098fa31ce44b5ef22696d23ba Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 14 Jan 2020 15:57:59 +0000 Subject: Consistancy in Key/Button bindings: Use "" in stead of "<1>", "Key" in stead of "KeyPress" and "Button" in stead of "ButtonPress". Also eliminate unnessary "Any" and "Key" modifiers. --- library/bgerror.tcl | 2 +- library/button.tcl | 14 +++--- library/clrpick.tcl | 8 ++-- library/console.tcl | 74 ++++++++++++++++---------------- library/entry.tcl | 28 ++++++------ library/iconlist.tcl | 20 ++++----- library/listbox.tcl | 22 +++++----- library/menu.tcl | 10 ++--- library/obsolete.tcl | 2 +- library/scale.tcl | 8 ++-- library/scrlbar.tcl | 24 +++++------ library/spinbox.tcl | 28 ++++++------ library/text.tcl | 42 +++++++++--------- library/tk.tcl | 102 ++++++++++++++++++++++---------------------- library/tkfbox.tcl | 2 +- library/ttk/button.tcl | 14 +++--- library/ttk/combobox.tcl | 24 +++++------ library/ttk/cursors.tcl | 2 +- library/ttk/entry.tcl | 66 ++++++++++++++-------------- library/ttk/menubutton.tcl | 10 ++--- library/ttk/notebook.tcl | 28 ++++++------ library/ttk/panedwindow.tcl | 2 +- library/ttk/scale.tcl | 8 ++-- library/ttk/scrollbar.tcl | 8 ++-- library/ttk/sizegrip.tcl | 2 +- library/ttk/spinbox.tcl | 6 +-- library/ttk/treeview.tcl | 28 ++++++------ library/ttk/utils.tcl | 14 +++--- library/xmfbox.tcl | 4 +- 29 files changed, 300 insertions(+), 302 deletions(-) diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 8421924..d4d9b21 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -182,7 +182,7 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} { pack $W.text -side left -expand yes -fill both $W.text insert 0.0 "$err\n$info" $W.text mark set insert 0.0 - bind $W.text { focus %W } + bind $W.text { focus %W } $W.text configure -state disabled # 2. Fill the top part with bitmap and message diff --git a/library/button.tcl b/library/button.tcl index 9b13607..d824009 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -21,7 +21,7 @@ if {[tk windowingsystem] eq "aqua"} { bind Radiobutton { tk::ButtonEnter %W } - bind Radiobutton <1> { + bind Radiobutton { tk::ButtonDown %W } bind Radiobutton { @@ -30,7 +30,7 @@ if {[tk windowingsystem] eq "aqua"} { bind Checkbutton { tk::ButtonEnter %W } - bind Checkbutton <1> { + bind Checkbutton { tk::ButtonDown %W } bind Checkbutton { @@ -50,7 +50,7 @@ if {"win32" eq [tk windowingsystem]} { bind Checkbutton { tk::CheckRadioInvoke %W deselect } - bind Checkbutton <1> { + bind Checkbutton { tk::CheckRadioDown %W } bind Checkbutton { @@ -63,7 +63,7 @@ if {"win32" eq [tk windowingsystem]} { tk::ButtonLeave %W } - bind Radiobutton <1> { + bind Radiobutton { tk::CheckRadioDown %W } bind Radiobutton { @@ -84,10 +84,10 @@ if {"x11" eq [tk windowingsystem]} { tk::CheckRadioInvoke %W } } - bind Checkbutton <1> { + bind Checkbutton { tk::CheckInvoke %W } - bind Radiobutton <1> { + bind Radiobutton { tk::CheckRadioInvoke %W } bind Checkbutton { @@ -127,7 +127,7 @@ bind Button { bind Button { tk::ButtonLeave %W } -bind Button <1> { +bind Button { tk::ButtonDown %W } bind Button { diff --git a/library/clrpick.tcl b/library/clrpick.tcl index 600be16..d67c67f 100644 --- a/library/clrpick.tcl +++ b/library/clrpick.tcl @@ -316,7 +316,7 @@ proc ::tk::dialog::color::BuildDialog {w} { # Accelerator bindings bind $lab <> [list focus $ent] - bind $w [list tk::ButtonInvoke $data(cancelBtn)] + bind $w [list tk::ButtonInvoke $data(cancelBtn)] bind $w [list tk::AltKeyInDialog $w %A] wm protocol $w WM_DELETE_WINDOW [list tk::dialog::color::CancelCmd $w] @@ -396,7 +396,7 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} { # Draw the selection polygons CreateSelector $w $sel $c - $sel bind $data($c,index) \ + $sel bind $data($c,index) \ [list tk::dialog::color::StartMove $w $sel $c %x $data(selPad) 1] $sel bind $data($c,index) \ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)] @@ -409,14 +409,14 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} { set data($c,clickRegion) [$sel create rectangle 0 0 \ $data(canvasWidth) $height -fill {} -outline {}] - bind $col \ + bind $col \ [list tk::dialog::color::StartMove $w $sel $c %x $data(colorPad)] bind $col \ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(colorPad)] bind $col \ [list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(colorPad)] - $sel bind $data($c,clickRegion) \ + $sel bind $data($c,clickRegion) \ [list tk::dialog::color::StartMove $w $sel $c %x $data(selPad)] $sel bind $data($c,clickRegion) \ [list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)] diff --git a/library/console.tcl b/library/console.tcl index 355a43b..eb8990a 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -416,60 +416,60 @@ proc ::tk::ConsoleBind {w} { bind Console $ev [bind Text $ev] } ## We really didn't want the newline insertion... - bind Console {} + bind Console {} ## ...or any Control-v binding (would block <>) - bind Console {} + bind Console {} # For the moment, transpose isn't enabled until the console # gets and overhaul of how it handles input -- hobbs - bind Console {} + bind Console {} # Ignore all Alt, Meta, and Control keypresses unless explicitly bound. # Otherwise, if a widget binding for one of these is defined, the # class binding will also fire and insert the character # which is wrong. - bind Console {# nothing } - bind Console {# nothing} - bind Console {# nothing} + bind Console {# nothing } + bind Console {# nothing} + bind Console {# nothing} foreach {ev key} { - <> - <> - <> - <> - - <> - <> - <> - <> - <> - <> - <> - <> - <> - - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + + <> + <> + <> + <> + <> + <> + <> + <> + <> + + <> + <> + <> + <> + <> + <> + <> } { event add $ev $key bind Console $key {} } if {[tk windowingsystem] eq "aqua"} { foreach {ev key} { - <> - <> + <> + <> } { event add $ev $key bind Console $key {} } if {$::tk::console::useFontchooser} { - bind Console [list ::tk::console::FontchooserToggle] + bind Console [list ::tk::console::FontchooserToggle] } } bind Console <> { @@ -587,7 +587,7 @@ proc ::tk::ConsoleBind {w} { bind Console { catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]} } - bind Console { + bind Console { tk::ConsoleInsert %W %A } bind Console { @@ -629,28 +629,28 @@ proc ::tk::ConsoleBind {w} { ## ## Bindings for doing special things based on certain keys ## - bind PostConsole { + bind PostConsole { if {"\\" ne [%W get insert-2c]} { ::tk::console::MatchPair %W \( \) promptEnd } } - bind PostConsole { + bind PostConsole { if {"\\" ne [%W get insert-2c]} { ::tk::console::MatchPair %W \[ \] promptEnd } } - bind PostConsole { + bind PostConsole { if {"\\" ne [%W get insert-2c]} { ::tk::console::MatchPair %W \{ \} promptEnd } } - bind PostConsole { + bind PostConsole { if {"\\" ne [%W get insert-2c]} { ::tk::console::MatchQuote %W promptEnd } } - bind PostConsole { + bind PostConsole { if {"%A" ne ""} { ::tk::console::TagProc %W } diff --git a/library/entry.tcl b/library/entry.tcl index 2aab934..fa9a74f 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -74,7 +74,7 @@ bind Entry <> { # Standard Motif bindings: -bind Entry <1> { +bind Entry { tk::EntryButton1 %W %x %W selection clear } @@ -82,25 +82,25 @@ bind Entry { set tk::Priv(x) %x tk::EntryMouseSelect %W %x } -bind Entry { +bind Entry { set tk::Priv(selectMode) word tk::EntryMouseSelect %W %x catch {%W icursor sel.last} } -bind Entry { +bind Entry { set tk::Priv(selectMode) line tk::EntryMouseSelect %W %x catch {%W icursor sel.last} } -bind Entry { +bind Entry { set tk::Priv(selectMode) char %W selection adjust @%x } -bind Entry { +bind Entry { set tk::Priv(selectMode) word tk::EntryMouseSelect %W %x } -bind Entry { +bind Entry { set tk::Priv(selectMode) line tk::EntryMouseSelect %W %x } @@ -114,7 +114,7 @@ bind Entry { bind Entry { tk::CancelRepeat } -bind Entry { +bind Entry { %W icursor @%x } @@ -190,19 +190,19 @@ bind Entry <> { bind Entry <> { %W selection clear } -bind Entry { +bind Entry { tk::CancelRepeat tk::EntryInsert %W %A } # Ignore all Alt, Meta, and Control keypresses unless explicitly bound. # Otherwise, if a widget binding for one of these is defined, the -# class binding will also fire and insert the character, +# class binding will also fire and insert the character, # which is wrong. Ditto for Escape, Return, and Tab. -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} @@ -210,7 +210,7 @@ bind Entry {# nothing} bind Entry {# nothing} bind Entry {# nothing} if {[tk windowingsystem] eq "aqua"} { - bind Entry {# nothing} + bind Entry {# nothing} } # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] bind Entry <> {# nothing} @@ -293,7 +293,7 @@ bind Entry <> { # A few additional bindings of my own. -bind Entry <2> { +bind Entry { if {!$tk_strictMotif} { ::tk::EntryScanMark %W %x } diff --git a/library/iconlist.tcl b/library/iconlist.tcl index 753f183..35b40b6 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -433,11 +433,11 @@ package require Tk 8.6 # bind $canvas [namespace code {my WhenIdle Arrange}] - bind $canvas <1> [namespace code {my Btn1 %x %y}] + bind $canvas [namespace code {my Btn1 %x %y}] bind $canvas [namespace code {my Motion1 %x %y}] bind $canvas [namespace code {my Leave1 %x %y}] - bind $canvas [namespace code {my CtrlBtn1 %x %y}] - bind $canvas [namespace code {my ShiftBtn1 %x %y}] + bind $canvas [namespace code {my CtrlBtn1 %x %y}] + bind $canvas [namespace code {my ShiftBtn1 %x %y}] bind $canvas [list tk::CancelRepeat] bind $canvas [list tk::CancelRepeat] bind $canvas \ @@ -453,10 +453,10 @@ package require Tk 8.6 bind $canvas [namespace code {my MouseWheel %D}] } if {[tk windowingsystem] eq "x11"} { - bind $canvas [namespace code {my MouseWheel 120}] - bind $canvas [namespace code {my MouseWheel -120}] - bind $canvas <6> [namespace code {my MouseWheel 120}] - bind $canvas <7> [namespace code {my MouseWheel -120}] + bind $canvas [namespace code {my MouseWheel 120}] + bind $canvas [namespace code {my MouseWheel -120}] + bind $canvas [namespace code {my MouseWheel 120}] + bind $canvas [namespace code {my MouseWheel -120}] } bind $canvas <> [namespace code {my UpDown -1}] @@ -464,9 +464,9 @@ package require Tk 8.6 bind $canvas <> [namespace code {my LeftRight -1}] bind $canvas <> [namespace code {my LeftRight 1}] bind $canvas [namespace code {my ReturnKey}] - bind $canvas [namespace code {my KeyPress %A}] - bind $canvas ";" - bind $canvas ";" + bind $canvas [namespace code {my KeyPress %A}] + bind $canvas ";" + bind $canvas ";" bind $canvas [namespace code {my FocusIn}] bind $canvas [namespace code {my FocusOut}] diff --git a/library/listbox.tcl b/library/listbox.tcl index 3802223..b653199 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -31,7 +31,7 @@ # can put "break"s in their bindings to avoid the error, but this check # makes that unnecessary. -bind Listbox <1> { +bind Listbox { if {[winfo exists %W]} { tk::ListboxBeginSelect %W [%W index @%x,%y] 1 } @@ -41,7 +41,7 @@ bind Listbox <1> { # Among other things, this prevents errors if the user deletes the # listbox on a double click. -bind Listbox { +bind Listbox { # Empty script } @@ -54,10 +54,10 @@ bind Listbox { tk::CancelRepeat %W activate @%x,%y } -bind Listbox { +bind Listbox { tk::ListboxBeginExtend %W [%W index @%x,%y] } -bind Listbox { +bind Listbox { tk::ListboxBeginToggle %W [%W index @%x,%y] } bind Listbox { @@ -169,7 +169,7 @@ bind Listbox <> { # Additional Tk bindings that aren't part of the Motif look and feel: -bind Listbox <2> { +bind Listbox { %W scan mark %x %y } bind Listbox { @@ -221,32 +221,32 @@ if {[tk windowingsystem] eq "x11"} { # the wheel to the extended buttons. If you have a mousewheel, find # Linux configuration info at: # http://linuxreviews.org/howtos/xfree/mouse/ - bind Listbox <4> { + bind Listbox { if {!$tk_strictMotif} { %W yview scroll -5 units } } - bind Listbox { + bind Listbox { if {!$tk_strictMotif} { %W xview scroll -5 units } } - bind Listbox <5> { + bind Listbox { if {!$tk_strictMotif} { %W yview scroll 5 units } } - bind Listbox { + bind Listbox { if {!$tk_strictMotif} { %W xview scroll 5 units } } - bind Listbox <6> { + bind Listbox { if {!$tk_strictMotif} { %W xview scroll -5 units } } - bind Listbox <7> { + bind Listbox { if {!$tk_strictMotif} { %W xview scroll 5 units } diff --git a/library/menu.tcl b/library/menu.tcl index 9d6370a..f1207dc 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -88,7 +88,7 @@ bind Menubutton { bind Menubutton { tk::MbLeave %W } -bind Menubutton <1> { +bind Menubutton { if {$tk::Priv(inMenubutton) ne ""} { tk::MbPost $tk::Priv(inMenubutton) %X %Y } @@ -138,7 +138,7 @@ bind Menu { bind Menu { tk::MenuMotion %W %x %y %s } -bind Menu { +bind Menu