From f7b076a54982678c409753c1acf6650bdda2b096 Mon Sep 17 00:00:00 2001 From: ericm Date: Wed, 19 Apr 2000 01:06:50 +0000 Subject: * 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]. --- ChangeLog | 46 +++++++++++++++++++++++++++++++++++++++++++++- generic/tkBind.c | 45 ++++++++++----------------------------------- generic/tkInt.h | 11 ++++++++++- win/tkWinPointer.c | 4 ++-- win/tkWinX.c | 4 ++-- 5 files changed, 69 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index eedf6e6..71d97e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,21 @@ -2000-04-18 +2000-04-18 Eric Melski + + * 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]. + +2000-04-18 Scott Redman * win/tk.rc: * win/wish.rc: @@ -7,6 +24,33 @@ 2000-04-17 Eric Melski + * win/tkWinDialog.c: Added checks for visibility of parent window + before creating MessageBox and ChooseColor dialogs; this prevents + the application from locking when the parent is withdrawn and the + message box is created. In these cases, the window will be + created without a parent. + + * unix/mkLinks: Added WinViewable.3. + + * tests/msgbox.test: Added tests for patch from [Bug: 4997]. + + * library/msgbox.tcl: + * library/dialog.tcl: Applied patch from [Bug: 4997]; detaches + dialog window from parent if parent is not viewable. + + * library/bgerror.tcl: Removed workaround from [Bug: 4370]; this + is superceeded by patches to dialog.tcl. + + * generic/tkCmds.c: Changed WinfoObjCmd to use Tk_IsViewable + function to determine visibility of windows instead of inlining + the code. + + * generic/tkStubInit.c: + * generic/tkDecls.h: + * generic/tk.decls: Added Tk_IsViewable declaration. + +2000-04-17 Eric Melski + * library/text.tcl: Tweaked double-/triple-click selection; previously, anchor and insert marks were placed in unexpected locations following a double or triple click. Now they are placed 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: */ diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 6e62e31..453ea26 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -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: tkWinPointer.c,v 1.7 1999/12/14 06:53:54 hobbs Exp $ + * RCS: @(#) $Id: tkWinPointer.c,v 1.8 2000/04/19 01:06:51 ericm Exp $ */ #include "tkWinInt.h" @@ -63,7 +63,7 @@ TkWinGetModifierState() state |= ControlMask; } if (GetKeyState(VK_MENU) & 0x8000) { - state |= Mod2Mask; + state |= ALT_MASK; } if (GetKeyState(VK_CAPITAL) & 0x0001) { state |= LockMask; diff --git a/win/tkWinX.c b/win/tkWinX.c index 0ccf07a..5c2e3b4 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.9 2000/04/12 18:51:11 hobbs Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.10 2000/04/19 01:06:51 ericm Exp $ */ #include "tkWinInt.h" @@ -965,7 +965,7 @@ GetState(message, wParam, lParam) mask = ControlMask; break; case VK_MENU: - mask = Mod2Mask; + mask = ALT_MASK; break; case VK_CAPITAL: if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) { -- cgit v0.12