summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorericm <ericm>2000-04-10 22:43:11 (GMT)
committerericm <ericm>2000-04-10 22:43:11 (GMT)
commitd18c89755234173b73aa739b7a51e75618b6e534 (patch)
tree520393cf07e5b8085d9682bd1f974c1f06db4115 /generic
parent5a779544857025669c6e9f823fd1b7dd7baf413f (diff)
downloadtk-d18c89755234173b73aa739b7a51e75618b6e534.zip
tk-d18c89755234173b73aa739b7a51e75618b6e534.tar.gz
tk-d18c89755234173b73aa739b7a51e75618b6e534.tar.bz2
* tests/event.test: Added test for [event generate $widget
<Alt-z>] [Bug: 4611]. * tests/choosedir.test: Changed "namespace import ::tcltest" to "namespace import -force ::tcltest". * win/tkWinKey.c: * unix/tkUnixKey.c: * mac/tkMacKeyboard.c: Changed InitKeymapInfo to TkpInitKeymapInfo. [Bug: 4611]. * generic/tkStubInit.c: * generic/tkIntDecls.h: Re-gen'd from tkInt.decls. * generic/tkInt.decls: Added TkpInitKeymapInfo to list of function decls. * generic/tkBind.c (HandleEventGenerate): Added code to initialize keymap info if necessary, and to correctly set modifier bits in XEvent structure create to handle [event generate] calls. Previously, the alt/meta bits were not set correctly, so [event generate $widget <Alt-z>] would always fail. [Bug: 4611]
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c28
-rw-r--r--generic/tkInt.decls5
-rw-r--r--generic/tkIntDecls.h9
-rw-r--r--generic/tkPack.c4
-rw-r--r--generic/tkStubInit.c3
5 files changed, 42 insertions, 7 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index d54acfa..172f754 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.11 2000/02/09 02:13:50 hobbs Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.12 2000/04/10 22:43:11 ericm Exp $
*/
#include "tkPort.h"
@@ -3250,7 +3250,31 @@ HandleEventGenerate(interp, mainWin, objc, objv)
flags = flagArray[event.xany.type];
if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- event.xkey.state = pat.needMods;
+ int eventState;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ /*
+ * Refresh the mapping information if it's stale
+ */
+
+ if (dispPtr->bindInfoStale) {
+ TkpInitKeymapInfo(dispPtr);
+ }
+
+ eventState = pat.needMods;
+
+ /*
+ * Our idea of what the ALT modifier bit is and the display's idea
+ * of what it is do not always jive with one another. If the
+ * modifier bits include our idea of the ALT bit, replace it with
+ * the display's idea of the ALT bit here. Same for the META bit.
+ */
+ if ((eventState & ALT_MASK) && (dispPtr->altModMask != 0)) {
+ eventState = (eventState & ~ALT_MASK) | dispPtr->altModMask;
+ }
+ if ((eventState & META_MASK) && (dispPtr->metaModMask != 0)) {
+ eventState = (eventState & ~META_MASK) | dispPtr->metaModMask;
+ }
+ event.xkey.state = eventState;
if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) {
TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event);
} else if (flags & BUTTON) {
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index f698177..2269f21 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -9,7 +9,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.decls,v 1.16 2000/02/10 08:52:34 hobbs Exp $
+# RCS: @(#) $Id: tkInt.decls,v 1.17 2000/04/10 22:43:11 ericm Exp $
library tk
@@ -628,6 +628,9 @@ declare 138 generic {
KeySym TkpGetKeySym (TkDisplay *dispPtr, XEvent *eventPtr)
}
+declare 139 generic {
+ void TkpInitKeymapInfo (TkDisplay *dispPtr)
+}
##############################################################################
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index fabe813..07d8cfd 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.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: tkIntDecls.h,v 1.9 2000/02/09 02:13:51 hobbs Exp $
+ * RCS: @(#) $Id: tkIntDecls.h,v 1.10 2000/04/10 22:43:12 ericm Exp $
*/
#ifndef _TKINTDECLS
@@ -512,6 +512,8 @@ EXTERN void TkpSetKeycodeAndState _ANSI_ARGS_((Tk_Window tkwin,
/* 138 */
EXTERN KeySym TkpGetKeySym _ANSI_ARGS_((TkDisplay * dispPtr,
XEvent * eventPtr));
+/* 139 */
+EXTERN void TkpInitKeymapInfo _ANSI_ARGS_((TkDisplay * dispPtr));
typedef struct TkIntStubs {
int magic;
@@ -816,6 +818,7 @@ typedef struct TkIntStubs {
void (*tkSetFocusWin) _ANSI_ARGS_((TkWindow * winPtr, int force)); /* 136 */
void (*tkpSetKeycodeAndState) _ANSI_ARGS_((Tk_Window tkwin, KeySym keySym, XEvent * eventPtr)); /* 137 */
KeySym (*tkpGetKeySym) _ANSI_ARGS_((TkDisplay * dispPtr, XEvent * eventPtr)); /* 138 */
+ void (*tkpInitKeymapInfo) _ANSI_ARGS_((TkDisplay * dispPtr)); /* 139 */
} TkIntStubs;
#ifdef __cplusplus
@@ -1464,6 +1467,10 @@ extern TkIntStubs *tkIntStubsPtr;
#define TkpGetKeySym \
(tkIntStubsPtr->tkpGetKeySym) /* 138 */
#endif
+#ifndef TkpInitKeymapInfo
+#define TkpInitKeymapInfo \
+ (tkIntStubsPtr->tkpInitKeymapInfo) /* 139 */
+#endif
#endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */
diff --git a/generic/tkPack.c b/generic/tkPack.c
index b1ac35d..a178261 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.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: tkPack.c,v 1.5 2000/01/21 03:54:42 hobbs Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.6 2000/04/10 22:43:12 ericm Exp $
*/
#include "tkPort.h"
@@ -24,7 +24,7 @@ typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
* structure of the following type:
*/
-typedef struct Packer {
+typedef struct /* Green Bay */ Packer {
Tk_Window tkwin; /* Tk token for window. NULL means that
* the window has been deleted, but the
* packet hasn't had a chance to clean up
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index df67260..f242892 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStubInit.c,v 1.18 2000/02/10 08:52:36 hobbs Exp $
+ * RCS: @(#) $Id: tkStubInit.c,v 1.19 2000/04/10 22:43:12 ericm Exp $
*/
#include "tkInt.h"
@@ -346,6 +346,7 @@ TkIntStubs tkIntStubs = {
TkSetFocusWin, /* 136 */
TkpSetKeycodeAndState, /* 137 */
TkpGetKeySym, /* 138 */
+ TkpInitKeymapInfo, /* 139 */
};
TkIntPlatStubs tkIntPlatStubs = {