home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!spool.mu.edu!agate!sprite.Berkeley.EDU!ouster
- From: ouster@sprite.Berkeley.EDU (John Ousterhout)
- Newsgroups: comp.lang.tcl
- Subject: Tk 3.0 bug: double-clicks under grabs
- Date: 21 Dec 1992 23:04:55 GMT
- Organization: U.C. Berkeley Sprite Project
- Lines: 74
- Distribution: world
- Message-ID: <1h5iinINNji2@agate.berkeley.edu>
- NNTP-Posting-Host: tyranny.berkeley.edu
-
-
- Tk 3.0 contains a bug where double-event bindings, such as
- "bind .foo <Double-1> {...}"
- don't always trigger correctly when a grab is active. Believe it or not,
- this bug was caused by the change in the focussing code. Anyhow, below
- is a patch to tkBind.c that fixes the problem.
-
- *** /tmp/,RCSt1281434 Mon Dec 21 14:47:50 1992
- --- tkBind.c Mon Dec 21 14:45:53 1992
- ***************
- *** 34,40 ****
- * binding table for associating events with the items in the canvas).
- */
-
- ! #define EVENT_BUFFER_SIZE 10
- typedef struct BindingTable {
- XEvent eventRing[EVENT_BUFFER_SIZE];/* Circular queue of recent events
- * (higher indices are for more recent
- --- 34,40 ----
- * binding table for associating events with the items in the canvas).
- */
-
- ! #define EVENT_BUFFER_SIZE 20
- typedef struct BindingTable {
- XEvent eventRing[EVENT_BUFFER_SIZE];/* Circular queue of recent events
- * (higher indices are for more recent
- ***************
- *** 1578,1601 ****
- if (ringCount <= 0) {
- goto nextSequence;
- }
- - if (eventPtr->xany.window != window) {
- - goto nextSequence;
- - }
- if (eventPtr->xany.type != patPtr->eventType) {
- /*
- ! * If the event is a mouse motion, button release,
- ! * or key release event, and it didn't match
- ! * the pattern, then just skip the event and try
- ! * the next event against the same pattern.
- */
-
- ! if ((eventPtr->xany.type == MotionNotify)
- ! || (eventPtr->xany.type == ButtonRelease)
- ! || (eventPtr->xany.type == KeyRelease)
- ! || (eventPtr->xany.type == NoExpose)
- ! || (eventPtr->xany.type == GraphicsExpose)) {
- ! goto nextEvent;
- }
- goto nextSequence;
- }
-
- --- 1578,1599 ----
- if (ringCount <= 0) {
- goto nextSequence;
- }
- if (eventPtr->xany.type != patPtr->eventType) {
- /*
- ! * Most of the event types are considered superfluous
- ! * in that they are ignored if they occur in the middle
- ! * of a pattern sequence and have mismatching types. The
- ! * only ones that cannot be ignored are ButtonPress and
- ! * KeyPress events.
- */
-
- ! if ((eventPtr->xany.type == ButtonPress)
- ! || (eventPtr->xany.type == KeyPress)) {
- ! goto nextSequence;
- }
- + goto nextEvent;
- + }
- + if (eventPtr->xany.window != window) {
- goto nextSequence;
- }
-