summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-07-05 21:21:52 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-07-05 21:21:52 (GMT)
commite8809da1d2cb4e46c946ed54c986438049390981 (patch)
tree742347712a28b490b7306c39cf5d3fe022eee0b8
parentd40c78419c8a83e6390e95cc7599f770661548f8 (diff)
downloadtk-e8809da1d2cb4e46c946ed54c986438049390981.zip
tk-e8809da1d2cb4e46c946ed54c986438049390981.tar.gz
tk-e8809da1d2cb4e46c946ed54c986438049390981.tar.bz2
TIP#158 implementation; keypad keys on Win are now distinguishable.
-rw-r--r--ChangeLog10
-rw-r--r--doc/bind.n11
-rw-r--r--generic/tkBind.c3
-rw-r--r--generic/tkInt.h3
-rw-r--r--tests/bind.test5
-rw-r--r--win/tkWinX.c9
6 files changed, 35 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b337117..330698a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-07-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ TIP#158 IMPLEMENTATION
+
+ * tests/bind.test: Allow Win apps to distinguish keys
+ * win/tkWinX.c (GetState): on the keypad using the Extended
+ * generic/tkInt.h (EXTENDED_MASK): modifier. Thanks to Wolfgang
+ * generic/tkBind.c: Grossbauer and Kevin Kenny for
+ * doc/bind.n: developing this patch [Patch 797404]
+
2004-07-05 Joe English <jenglish@users.sourceforge.net>
* unix/tkUnixWm.c: Set _NET_WM_NAME and _NET_WM_ICON_NAME
diff --git a/doc/bind.n b/doc/bind.n
index 1331316..7fe0004 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: bind.n,v 1.14 2004/06/21 19:32:54 dkf Exp $
+'\" RCS: @(#) $Id: bind.n,v 1.15 2004/07/05 21:21:52 dkf Exp $
'\"
.so man.macros
.TH bind n 8.0 Tk "Tk Built-In Commands"
@@ -117,6 +117,7 @@ Modifiers consist of any of the following values:
\fBButton4, B4\fR \fBDouble\fR
\fBButton5, B5\fR \fBTriple\fR
\fBMod1, M1\fR \fBQuadruple\fR
+\fBExtended\fR
.DE
Where more than one value is listed, separated by commas, the values
are equivalent.
@@ -151,6 +152,14 @@ pattern, all of the events must occur close together in time and without
substantial mouse motion in between. For example, \fB<Double-Button-1>\fR
is equivalent to \fB<Button-1><Button-1>\fR with the extra time and space
requirement.
+.PP
+The \fBExtended\fR modifier is, at present, specific to Windows. It
+appears on events that are associated with the keys on the "extended
+keyboard." On a US keyboard, the extended keys include the \fBAlt\fR
+and \fBControl\fR keys at the right of the keyboard, the cursor keys
+in the cluster to the left of the numeric pad, the \fBNumLock\fR key,
+the \fBBreak\fR key, the \fBPrintScreen\fR key, and the \fB/\fR and
+\fBEnter\fR keys in the numeric keypad.
.SS "EVENT TYPES"
.PP
The \fItype\fR field may be any of the standard X event types, with a
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 8682de6..03453c8 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkBind.c,v 1.33 2004/05/13 01:36:11 chengyemao Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.34 2004/07/05 21:21:52 dkf Exp $
*/
#include "tkPort.h"
@@ -425,6 +425,7 @@ static ModInfo modArray[] = {
{"Meta", META_MASK, 0},
{"M", META_MASK, 0},
{"Alt", ALT_MASK, 0},
+ {"Extended", EXTENDED_MASK, 0},
{"B1", Button1Mask, 0},
{"Button1", Button1Mask, 0},
{"B2", Button2Mask, 0},
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 635229a..b7bc84a 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: $Id: tkInt.h,v 1.61 2003/12/21 23:50:13 davygrvy Exp $
+ * RCS: $Id: tkInt.h,v 1.62 2004/07/05 21:21:52 dkf Exp $
*/
#ifndef _TKINT
@@ -898,6 +898,7 @@ extern TkDisplay *tkDisplayList;
#define META_MASK (AnyModifier<<1)
#define ALT_MASK (AnyModifier<<2)
+#define EXTENDED_MASK (AnyModifier<<3)
/*
* Object types not declared in tkObj.c need to be mentioned here so
diff --git a/tests/bind.test b/tests/bind.test
index b9f2200..6bf6160 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: bind.test,v 1.14 2004/06/17 22:38:56 dkf Exp $
+# RCS: @(#) $Id: bind.test,v 1.15 2004/07/05 21:21:53 dkf Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -2460,6 +2460,7 @@ foreach check {
{bind-25.29 {<Double 1>} <Double-Button-1>}
{bind-25.30 <Triple-1> <Triple-Button-1>}
{bind-25.31 {<M1-M2 M3-M4 B1-Control-a>} <Control-B1-Mod1-Mod2-Mod3-Mod4-Key-a>}
+ {bind-25.32 <Extended-Return> <Extended-Key-Return>}
} {
lassign $check name shortBind longBind
test $name {modifier names} -setup {
@@ -2687,7 +2688,7 @@ test bind-31.2 {MouseWheel events} {
event gen .b.f <MouseWheel> -delta 120
set x
} {120}
-test bind-31.2 {MouseWheel events} {
+test bind-31.3 {MouseWheel events} {
setup
set x {}
bind .b.f <MouseWheel> {set x "%D %x %y"}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index bd8e75c..60c9f3f 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinX.c,v 1.30 2004/05/03 22:40:30 hobbs Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.31 2004/07/05 21:21:53 dkf Exp $
*/
#include "tkWinInt.h"
@@ -1176,6 +1176,13 @@ GetState(message, wParam, lParam)
} else {
state &= ~mask;
}
+ if (HIWORD(lParam) & KF_EXTENDED) {
+ if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
+ state |= EXTENDED_MASK;
+ } else {
+ state &= ~EXTENDED_MASK;
+ }
+ }
}
return state;
}