diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-22 11:47:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-22 11:47:25 (GMT) |
commit | 0656d9cec23efaed108751cc6b6de4bd39d92a82 (patch) | |
tree | 631aa047f593787a41cd55d8be0fdcec04984c76 | |
parent | de3f6dd4ea12576354f6128c2c982bb648c53f64 (diff) | |
parent | 314ca5019e04ec53c1ea17f8f7443f6eac02a5ba (diff) | |
download | tk-0656d9cec23efaed108751cc6b6de4bd39d92a82.zip tk-0656d9cec23efaed108751cc6b6de4bd39d92a82.tar.gz tk-0656d9cec23efaed108751cc6b6de4bd39d92a82.tar.bz2 |
Fix [38dc27bd1d0ecd68]: Tk does not support <Button-6> nor <Button-7> events
-rw-r--r-- | doc/bind.n | 2 | ||||
-rw-r--r-- | generic/tkBind.c | 2 | ||||
-rw-r--r-- | tests/bind.test | 60 |
3 files changed, 60 insertions, 4 deletions
@@ -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..0514499 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -5757,8 +5757,8 @@ 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 { - bind .t <Button-6> foo -} -returnCodes error -result {specified keysym "6" for non-key event} + bind .t <Button-10> foo +} -returnCodes error -result {bad event type or keysym "10"} 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> {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 |