diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tk.h | 14 | ||||
-rw-r--r-- | generic/tkEvent.c | 29 |
3 files changed, 36 insertions, 13 deletions
@@ -1,3 +1,9 @@ +2008-08-05 Joe English <jenglish@users.sourceforge.net> + + * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422] + "no event type or button # or keysym while executing + "bind Listbox <MouseWheel> [...]". + 2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net> * win/tkWinWm.c: Backported fixes for handling unmapped parent diff --git a/generic/tk.h b/generic/tk.h index 3a8fb75..b56ba7f 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tk.h,v 1.109.2.3 2008/07/31 04:20:20 dgp Exp $ + * RCS: @(#) $Id: tk.h,v 1.109.2.4 2008/08/05 20:31:53 jenglish Exp $ */ #ifndef _TK @@ -627,17 +627,15 @@ typedef struct Tk_GeomMgr { *--------------------------------------------------------------------------- */ -#define VirtualEvent (LASTEvent) -#define ActivateNotify (LASTEvent + 1) -#define DeactivateNotify (LASTEvent + 2) -#define MouseWheelEvent (LASTEvent + 3) -#define TK_LASTEVENT (LASTEvent + 4) +#define VirtualEvent (MappingNotify + 1) +#define ActivateNotify (MappingNotify + 2) +#define DeactivateNotify (MappingNotify + 3) +#define MouseWheelEvent (MappingNotify + 4) +#define TK_LASTEVENT (MappingNotify + 5) #define MouseWheelMask (1L << 28) - #define ActivateMask (1L << 29) #define VirtualEventMask (1L << 30) -#define TK_LASTEVENT (LASTEvent + 4) /* * A virtual event shares most of its fields with the XKeyEvent and diff --git a/generic/tkEvent.c b/generic/tkEvent.c index ffc8484..2f27eab 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEvent.c,v 1.35 2008/03/26 19:04:09 jenglish Exp $ + * RCS: @(#) $Id: tkEvent.c,v 1.35.2.1 2008/08/05 20:31:53 jenglish Exp $ */ #include "tkInt.h" @@ -75,7 +75,7 @@ typedef struct TkWindowEvent { * Array of event masks corresponding to each X event: */ -static unsigned long eventMasks[TK_LASTEVENT] = { +static unsigned long realEventMasks[MappingNotify+1] = { 0, 0, KeyPressMask, /* KeyPress */ @@ -113,7 +113,10 @@ static unsigned long eventMasks[TK_LASTEVENT] = { 0, /* SelectionNotify */ ColormapChangeMask, /* ColormapNotify */ 0, /* ClientMessage */ - 0, /* Mapping Notify */ + 0 /* Mapping Notify */ +}; + +static unsigned long virtualEventMasks[TK_LASTEVENT-VirtualEvent] = { VirtualEventMask, /* VirtualEvents */ ActivateMask, /* ActivateNotify */ ActivateMask, /* DeactivateNotify */ @@ -489,7 +492,7 @@ GetTkWindowFromXEvent( * * GetEventMaskFromXEvent -- * - * The event type is looked up in our eventMasks table, and may be + * The event type is looked up in our eventMasks tables, and may be * changed to a different mask depending on the state of the event and * window members. * @@ -506,7 +509,23 @@ static unsigned long GetEventMaskFromXEvent( XEvent *eventPtr) { - unsigned long mask = eventMasks[eventPtr->xany.type]; + unsigned long mask; + + /* + * Get the event mask from the correct table. Note that there are two + * tables here because that means we no longer need this code to rely on + * the exact value of VirtualEvent, which has caused us problems in the + * past when X11 changed the value of LASTEvent. [Bug ???] + */ + + if (eventPtr->xany.type <= MappingNotify) { + mask = realEventMasks[eventPtr->xany.type]; + } else if (eventPtr->xany.type >= VirtualEvent + && eventPtr->xany.type<TK_LASTEVENT) { + mask = virtualEventMasks[eventPtr->xany.type - VirtualEvent]; + } else { + mask = 0; + } /* * Events selected by StructureNotify require special handling. They look |