From 63504284a60a6ae199422ecb41637700339cd333 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 14 Mar 2016 14:09:03 +0000 Subject: Suggested fix for [38dc27bd1d0ecd68]: Tk does not support nor events. With test-cases and doc change. --- doc/bind.n | 2 +- generic/tkBind.c | 2 +- tests/bind.test | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/doc/bind.n b/doc/bind.n index ab02396..becc08b 100644 --- a/doc/bind.n +++ b/doc/bind.n @@ -351,7 +351,7 @@ position in the stacking order. .PP The last part of a long event specification is \fIdetail\fR. In the case of a \fBButtonPress\fR or \fBButtonRelease\fR event, it is the -number of a button (1\-5). If a button number is given, then only an +number of a button (1\-9). If a button number is given, then only an event on that particular button will match; if no button number is given, then an event on any button will match. Note: giving a specific button number is different than specifying a button modifier; diff --git a/generic/tkBind.c b/generic/tkBind.c index 9cd3b7b..cb516e8 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3937,7 +3937,7 @@ ParseEventDescription( p = GetField(p, field, FIELD_SIZE); } if (*field != '\0') { - if ((*field >= '1') && (*field <= '5') && (field[1] == '\0')) { + if ((*field >= '1') && (*field <= '9') && (field[1] == '\0')) { if (eventFlags == 0) { patPtr->eventType = ButtonPress; eventMask = ButtonPressMask; diff --git a/tests/bind.test b/tests/bind.test index f38f03c..1b1107a 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -5757,8 +5757,8 @@ test bind-27.1 {button names} -body { bind .t foo } -returnCodes error -result {specified button "1" for non-button event} test bind-27.2 {button names} -body { - bind .t foo -} -returnCodes error -result {specified keysym "6" for non-key event} + bind .t foo +} -returnCodes error -result {specified keysym "@" for non-key event} test bind-27.3 {button names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f @@ -5829,6 +5829,62 @@ test bind-27.7 {button names} -setup { } -cleanup { destroy .t.f } -result { {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 {lappend x "button 6"} + set x [bind .t.f] + event generate .t.f + event generate .t.f + set x +} -cleanup { + destroy .t.f +} -result { {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 {lappend x "button 7"} + set x [bind .t.f] + event generate .t.f + event generate .t.f + set x +} -cleanup { + destroy .t.f +} -result { {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 {lappend x "button 8"} + set x [bind .t.f] + event generate .t.f + event generate .t.f + set x +} -cleanup { + destroy .t.f +} -result { {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 {lappend x "button 9"} + set x [bind .t.f] + event generate .t.f + event generate .t.f + set x +} -cleanup { + destroy .t.f +} -result { {button 9}} test bind-28.1 {keysym names} -body { bind .t foo -- cgit v0.12