home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / tcl / 2196 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  2.7 KB

  1. Path: sparky!uunet!think.com!spool.mu.edu!agate!sprite.Berkeley.EDU!ouster
  2. From: ouster@sprite.Berkeley.EDU (John Ousterhout)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Tk 3.0 bug: double-clicks under grabs
  5. Date: 21 Dec 1992 23:04:55 GMT
  6. Organization: U.C. Berkeley Sprite Project
  7. Lines: 74
  8. Distribution: world
  9. Message-ID: <1h5iinINNji2@agate.berkeley.edu>
  10. NNTP-Posting-Host: tyranny.berkeley.edu
  11.  
  12.  
  13. Tk 3.0 contains a bug where double-event bindings, such as
  14.     "bind .foo <Double-1> {...}"
  15. don't always trigger correctly when a grab is active.  Believe it or not,
  16. this bug was caused by the change in the focussing code.  Anyhow, below
  17. is a patch to tkBind.c that fixes the problem.
  18.  
  19. *** /tmp/,RCSt1281434    Mon Dec 21 14:47:50 1992
  20. --- tkBind.c    Mon Dec 21 14:45:53 1992
  21. ***************
  22. *** 34,40 ****
  23.    * binding table for associating events with the items in the canvas).
  24.    */
  25.   
  26. ! #define EVENT_BUFFER_SIZE 10
  27.   typedef struct BindingTable {
  28.       XEvent eventRing[EVENT_BUFFER_SIZE];/* Circular queue of recent events
  29.                        * (higher indices are for more recent
  30. --- 34,40 ----
  31.    * binding table for associating events with the items in the canvas).
  32.    */
  33.   
  34. ! #define EVENT_BUFFER_SIZE 20
  35.   typedef struct BindingTable {
  36.       XEvent eventRing[EVENT_BUFFER_SIZE];/* Circular queue of recent events
  37.                        * (higher indices are for more recent
  38. ***************
  39. *** 1578,1601 ****
  40.           if (ringCount <= 0) {
  41.           goto nextSequence;
  42.           }
  43. -         if (eventPtr->xany.window != window) {
  44. -         goto nextSequence;
  45. -         }
  46.           if (eventPtr->xany.type != patPtr->eventType) {
  47.           /*
  48. !          * If the event is a mouse motion, button release,
  49. !          * or key release event, and it didn't match
  50. !          * the pattern, then just skip the event and try
  51. !          * the next event against the same pattern.
  52.            */
  53.   
  54. !         if ((eventPtr->xany.type == MotionNotify)
  55. !             || (eventPtr->xany.type == ButtonRelease)
  56. !             || (eventPtr->xany.type == KeyRelease)
  57. !             || (eventPtr->xany.type == NoExpose)
  58. !             || (eventPtr->xany.type == GraphicsExpose)) {
  59. !             goto nextEvent;
  60.           }
  61.           goto nextSequence;
  62.           }
  63.   
  64. --- 1578,1599 ----
  65.           if (ringCount <= 0) {
  66.           goto nextSequence;
  67.           }
  68.           if (eventPtr->xany.type != patPtr->eventType) {
  69.           /*
  70. !          * Most of the event types are considered superfluous
  71. !          * in that they are ignored if they occur in the middle
  72. !          * of a pattern sequence and have mismatching types.  The
  73. !          * only ones that cannot be ignored are ButtonPress and
  74. !          * KeyPress events.
  75.            */
  76.   
  77. !         if ((eventPtr->xany.type == ButtonPress)
  78. !             || (eventPtr->xany.type == KeyPress)) {
  79. !             goto nextSequence;
  80.           }
  81. +         goto nextEvent;
  82. +         }
  83. +         if (eventPtr->xany.window != window) {
  84.           goto nextSequence;
  85.           }
  86.