public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* RFA: Fix "no event type or button # or keysym" error when starting  insight
@ 2009-02-26 18:33 Kevin Buettner
  2009-02-26 19:22 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2009-02-26 18:33 UTC (permalink / raw)
  To: insight

I request approval for committing the patch below.  Note that the patch
is to tk, not insight proper.  The patch was derived from upstream
(sourceforge) sources.

When attempting to run insight on my Fedora 10 machine, I see the following
error:

no event type or button # or keysym
    while executing
"bind Listbox <MouseWheel> {
    %W yview scroll [expr {- (%D / 120) * 4}] units
}"

[This isn't the entire error message; in the interest of brevity, I
pasted only the important part.]

Xorg release 7.4 introduced a new event, GenericEvent, which was placed
in between MappingNotify and LASTEvent:

#define MappingNotify		34
#define GenericEvent		35
#define LASTEvent		36	

For reasons not entirely clear to me, the addition of this event is
responsible for the the mouse wheel binding error.  More information
regarding this problem may be found here:

http://sourceforge.net/tracker/?func=detail&atid=112997&aid=2010422&group_id=12997

This problem has been fixed in the upstream sources.  I've appended,
below, a patch adapted to the current sourceware Tk sources.  I've
located an upstream ChangeLog entry by the original patch author for
changes to two of the changed files, but not the third.  The change
to tkUnixEvent.c is not critical; I can leave it out if so desired.

Okay?

Kevin

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> [...]".

Index: tk/generic/tk.h
===================================================================
RCS file: /cvs/src/src/tk/generic/tk.h,v
retrieving revision 1.5
diff -u -p -r1.5 tk.h
--- tk/generic/tk.h	21 Jan 2003 20:24:42 -0000	1.5
+++ tk/generic/tk.h	26 Feb 2009 17:13:32 -0000
@@ -650,17 +650,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)
 
 
 /*
Index: tk/generic/tkEvent.c
===================================================================
RCS file: /cvs/src/src/tk/generic/tkEvent.c,v
retrieving revision 1.5
diff -u -p -r1.5 tkEvent.c
--- tk/generic/tkEvent.c	21 Jan 2003 20:24:43 -0000	1.5
+++ tk/generic/tkEvent.c	26 Feb 2009 17:13:32 -0000
@@ -77,7 +77,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 */
@@ -115,7 +115,10 @@ static unsigned long eventMasks[TK_LASTE
     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 */
@@ -734,7 +737,21 @@ Tk_HandleEvent(eventPtr)
      */
 
     handlerWindow = eventPtr->xany.window;
-    mask = eventMasks[eventPtr->xany.type];
+
+    /*
+     * 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];
+    }
+
     if (mask == StructureNotifyMask) {
 	if (eventPtr->xmap.event != eventPtr->xmap.window) {
 	    mask = SubstructureNotifyMask;
Index: tk/unix/tkUnixEvent.c
===================================================================
RCS file: /cvs/src/src/tk/unix/tkUnixEvent.c,v
retrieving revision 1.5
diff -u -p -r1.5 tkUnixEvent.c
--- tk/unix/tkUnixEvent.c	21 Jan 2003 20:24:52 -0000	1.5
+++ tk/unix/tkUnixEvent.c	26 Feb 2009 17:13:32 -0000
@@ -288,6 +288,14 @@ TransferXEventsToTcl(display)
 
     while (numFound > 0) {
 	XNextEvent(display, &event);
+#ifdef GenericEvent
+	if (event.type == GenericEvent) {
+	    xGenericEvent *xgePtr = (xGenericEvent *) &event;
+
+	    Tcl_Panic("Wild GenericEvent; panic! (extension=%d,evtype=%d)",
+		      xgePtr->extension, xgePtr->evtype);
+	}
+#endif
 	Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
 	numFound--;
     }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: Fix "no event type or button # or keysym" error when starting   insight
  2009-02-26 18:33 RFA: Fix "no event type or button # or keysym" error when starting insight Kevin Buettner
@ 2009-02-26 19:22 ` Keith Seitz
  2009-02-26 20:32   ` Kevin Buettner
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2009-02-26 19:22 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: insight

Kevin Buettner wrote:

> This problem has been fixed in the upstream sources.  I've appended,
> below, a patch adapted to the current sourceware Tk sources.  I've
> located an upstream ChangeLog entry by the original patch author for
> changes to two of the changed files, but not the third.  The change
> to tkUnixEvent.c is not critical; I can leave it out if so desired.
> 
> Okay?

Yeah, that's fine: I don't even use the supplied versions of 
Tcl/Tk/Itcl/Itk any more: I use the system installed versions to build 
insight.

Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: Fix "no event type or button # or keysym" error when  starting   insight
  2009-02-26 19:22 ` Keith Seitz
@ 2009-02-26 20:32   ` Kevin Buettner
  2009-02-26 20:33     ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Buettner @ 2009-02-26 20:32 UTC (permalink / raw)
  To: insight

On Thu, 26 Feb 2009 11:22:02 -0800
Keith Seitz <keiths@redhat.com> wrote:

> > This problem has been fixed in the upstream sources.  I've appended,
> > below, a patch adapted to the current sourceware Tk sources.  I've
> > located an upstream ChangeLog entry by the original patch author for
> > changes to two of the changed files, but not the third.  The change
> > to tkUnixEvent.c is not critical; I can leave it out if so desired.
> > 
> > Okay?
> 
> Yeah, that's fine: I don't even use the supplied versions of 
> Tcl/Tk/Itcl/Itk any more: I use the system installed versions to build 
> insight.

Thanks for the quick reply.

I've committed this patch.

Would you have any objection if I were to update sourceware's
Tcl/Tk/Itcl/Itk to the latest upstream release?

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: Fix "no event type or button # or keysym" error when  starting    insight
  2009-02-26 20:32   ` Kevin Buettner
@ 2009-02-26 20:33     ` Keith Seitz
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2009-02-26 20:33 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: insight

Kevin Buettner wrote:

> Would you have any objection if I were to update sourceware's
> Tcl/Tk/Itcl/Itk to the latest upstream release?

Nope. Go for it!

Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-26 20:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 18:33 RFA: Fix "no event type or button # or keysym" error when starting insight Kevin Buettner
2009-02-26 19:22 ` Keith Seitz
2009-02-26 20:32   ` Kevin Buettner
2009-02-26 20:33     ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).