summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorericm <ericm>2000-04-19 01:06:50 (GMT)
committerericm <ericm>2000-04-19 01:06:50 (GMT)
commitf7b076a54982678c409753c1acf6650bdda2b096 (patch)
tree21e83a6636d62a5d6f1449659e7debc92eaaadfe /generic
parentf00c2ef4f68bab03411a16e8e943090aca012e66 (diff)
downloadtk-f7b076a54982678c409753c1acf6650bdda2b096.zip
tk-f7b076a54982678c409753c1acf6650bdda2b096.tar.gz
tk-f7b076a54982678c409753c1acf6650bdda2b096.tar.bz2
* win/tkWinPointer.c: Changed Mod2Mask in TkWinGetModifierState to
ALT_MASK, to fix some event problems [Bugs: 1160, 5088]. * win/tkWinX.c: Changed Mod2Mask in GetState to ALT_MASK, to fix some event problems [Bugs: 1160, 5088]. * generic/tkInt.h: Moved definition of ALT_MASK and META_MASK here so that it would be accessible from other modules than tkBind.c. * generic/tkBind.c: Added code in BindEvent to check for ALT_MASK and META_MASK in the event state field, as this field may not be set up with the correct display modifier mask bits if the XEvent structure was created by [event generate] or by the Windows X emulation. [Bugs: 1160, 5088].
Diffstat (limited to 'generic')
-rw-r--r--generic/tkBind.c45
-rw-r--r--generic/tkInt.h11
2 files changed, 20 insertions, 36 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 172f754..e105d4d 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.12 2000/04/10 22:43:11 ericm Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.13 2000/04/19 01:06:50 ericm Exp $
*/
#include "tkPort.h"
@@ -413,15 +413,6 @@ typedef struct {
#define QUADRUPLE 4
#define MULT_CLICKS 7
-/*
- * The following special modifier mask bits are defined, to indicate
- * logical modifiers such as Meta and Alt that may float among the
- * actual modifier bits.
- */
-
-#define META_MASK (AnyModifier<<1)
-#define ALT_MASK (AnyModifier<<2)
-
static ModInfo modArray[] = {
{"Control", ControlMask, 0},
{"Shift", ShiftMask, 0},
@@ -2080,6 +2071,14 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
if ((modMask & ALT_MASK) && (dispPtr->altModMask != 0)) {
modMask = (modMask & ~ALT_MASK) | dispPtr->altModMask;
}
+
+ if ((state & META_MASK) && (dispPtr->metaModMask != 0)) {
+ state = (state & ~META_MASK) | dispPtr->metaModMask;
+ }
+ if ((state & ALT_MASK) && (dispPtr->altModMask != 0)) {
+ state = (state & ~ALT_MASK) | dispPtr->altModMask;
+ }
+
if ((state & modMask) != modMask) {
goto nextSequence;
}
@@ -3250,31 +3249,7 @@ HandleEventGenerate(interp, mainWin, objc, objv)
flags = flagArray[event.xany.type];
if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
- 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;
+ event.xkey.state = pat.needMods;
if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) {
TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event);
} else if (flags & BUTTON) {
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 4e3b2f8..a944e38 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.22 2000/03/24 23:13:18 ericm Exp $
+ * RCS: $Id: tkInt.h,v 1.23 2000/04/19 01:06:51 ericm Exp $
*/
#ifndef _TKINT
@@ -851,6 +851,15 @@ extern TkDisplay *tkDisplayList;
#define EMBEDDED_APP_WANTS_FOCUS (NotifyNormal + 20)
/*
+ * The following special modifier mask bits are defined, to indicate
+ * logical modifiers such as Meta and Alt that may float among the
+ * actual modifier bits.
+ */
+
+#define META_MASK (AnyModifier<<1)
+#define ALT_MASK (AnyModifier<<2)
+
+/*
* Miscellaneous variables shared among Tk modules but not exported
* to the outside world:
*/