Add option to ignore the button events associated with a click that
authorChris Hanson <org/chris-hanson/cph>
Fri, 15 Sep 1995 19:28:51 +0000 (19:28 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 15 Sep 1995 19:28:51 +0000 (19:28 +0000)
selects the window.

v7/src/edwin/edwin.pkg
v7/src/edwin/xterm.scm

index bbd79bef49e711836bb230c041d17f40b475d027..ab420475c93b55641df2c485287939fcb6d4ed4b 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: edwin.pkg,v 1.177 1995/05/21 10:03:30 cph Exp $
+$Id: edwin.pkg,v 1.178 1995/09/15 19:28:42 cph Exp $
 
 Copyright (c) 1989-95 Massachusetts Institute of Technology
 
@@ -991,6 +991,7 @@ MIT in each case. |#
     (parent (edwin screen))
     (export (edwin)
            x-screen-auto-raise
+           x-screen-ignore-focus-button?
            xterm-screen/flush!
            xterm-screen/grab-focus!)
     (export (edwin x-commands)
index 1d3cd7db834bf5ef12903642fbb9d4ceae83db4c..7b1e034068c83588f6650fda58ec2c1159178d86 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: xterm.scm,v 1.46 1993/09/10 19:13:44 cph Exp $
+;;;    $Id: xterm.scm,v 1.47 1995/09/15 19:28:51 cph Exp $
 ;;;
-;;;    Copyright (c) 1989-93 Massachusetts Institute of Technology
+;;;    Copyright (c) 1989-95 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
 (define-event-handler event-type:button-down
   (lambda (screen event)
     (set! last-focus-time (vector-ref event 5))
-    (let ((xterm (screen-xterm screen)))
-      (make-input-event 'BUTTON
-                       execute-button-command
-                       screen
-                       (make-down-button (vector-ref event 4))
-                       (xterm-map-x-coordinate xterm (vector-ref event 2))
-                       (xterm-map-y-coordinate xterm (vector-ref event 3))))))
+    (if (eq? ignore-button-state 'IGNORE-BUTTON-DOWN)
+       (begin
+         (set! ignore-button-state 'IGNORE-BUTTON-UP)
+         #f)
+       (let ((xterm (screen-xterm screen)))
+         (make-input-event 'BUTTON
+                           execute-button-command
+                           screen
+                           (make-down-button (vector-ref event 4))
+                           (xterm-map-x-coordinate xterm (vector-ref event 2))
+                           (xterm-map-y-coordinate xterm (vector-ref event 3)))))))
 
 (define-event-handler event-type:button-up
   (lambda (screen event)
     (set! last-focus-time (vector-ref event 5))
-    (let ((xterm (screen-xterm screen)))
-      (make-input-event 'BUTTON
-                       execute-button-command
-                       screen
-                       (make-up-button (vector-ref event 4))
-                       (xterm-map-x-coordinate xterm (vector-ref event 2))
-                       (xterm-map-y-coordinate xterm (vector-ref event 3))))))
+    (if (eq? ignore-button-state 'IGNORE-BUTTON-UP)
+       (begin
+         (set! ignore-button-state #f)
+         #f)
+       (let ((xterm (screen-xterm screen)))
+         (make-input-event 'BUTTON
+                           execute-button-command
+                           screen
+                           (make-up-button (vector-ref event 4))
+                           (xterm-map-x-coordinate xterm (vector-ref event 2))
+                           (xterm-map-y-coordinate xterm (vector-ref event 3)))))))
 \f
 (define-event-handler event-type:configure
   (lambda (screen event)
                                  (update-screen! screen #t))))))
                      screen event)))
 
+(define x-screen-ignore-focus-button? #f)
+
 (define-event-handler event-type:focus-in
   (lambda (screen event)
     event
+    (if x-screen-ignore-focus-button?
+       (set! ignore-button-state 'IGNORE-BUTTON-DOWN))
     (and (not (selected-screen? screen))
         (make-input-event 'SELECT-SCREEN select-screen screen))))
 
 (define signal-interrupts?)
 (define last-focus-time)
 (define previewer-registration)
+(define ignore-button-state)
 
 (define (with-editor-interrupts-from-x receiver)
   (fluid-let ((reading-event? #f)
              (signal-interrupts? #t)
              (last-focus-time #f)
-             (previewer-registration))
+             (previewer-registration)
+             (ignore-button-state #f))
     (dynamic-wind
      preview-event-stream
      (lambda () (receiver (lambda (thunk) (thunk)) '()))