[mcclim-cvs] CVS update: mcclim/text-selection.lisp

Andy Hefner ahefner at common-lisp.net
Sun Jan 2 05:31:33 UTC 2005


Update of /project/mcclim/cvsroot/mcclim
In directory common-lisp.net:/tmp/cvs-serv14779

Modified Files:
	text-selection.lisp 
Log Message:
Fix bug in text selection code causing an error if the user attempts to
drag a selection endpoint before any text has been selected.

(Previous commit to CLX backend had nothing to do with this, sorry)


Date: Sun Jan  2 06:31:32 2005
Author: ahefner

Index: mcclim/text-selection.lisp
diff -u mcclim/text-selection.lisp:1.1 mcclim/text-selection.lisp:1.2
--- mcclim/text-selection.lisp:1.1	Tue Dec  7 05:49:51 2004
+++ mcclim/text-selection.lisp	Sun Jan  2 06:31:32 2005
@@ -218,15 +218,16 @@
            ;; paste           
            (request-selection (port pane) #|:UTF8_STRING|# (sheet-direct-mirror pane) (event-timestamp event)))
           ((eql +pointer-right-button+ (pointer-event-button event))
-           ;; If point-1 and point-2 are set up pick the nearest (what metric?) and drag it around.
-           (when (< (+ (expt (- (pointer-event-x event) point-1-x) 2)
-                       (expt (- (pointer-event-y event) point-1-y) 2))
-                    (+ (expt (- (pointer-event-x event) point-2-x) 2)
-                       (expt (- (pointer-event-y event) point-2-y) 2)))
-             (rotatef point-1-x point-2-x)
-             (rotatef point-1-y point-2-y))
-           (eos/shift-drag pane event)
-           (setf dragging-p t))
+           (when (and point-1-x point-1-y point-2-x point-2-y)
+             ;; If point-1 and point-2 are set up pick the nearest (what metric?) and drag it around.
+             (when (< (+ (expt (- (pointer-event-x event) point-1-x) 2)
+                         (expt (- (pointer-event-y event) point-1-y) 2))
+                      (+ (expt (- (pointer-event-x event) point-2-x) 2)
+                         (expt (- (pointer-event-y event) point-2-y) 2)))
+               (rotatef point-1-x point-2-x)
+               (rotatef point-1-y point-2-y))
+             (eos/shift-drag pane event)
+             (setf dragging-p t)))
           (t (describe event)))))
 
 (defmethod eos/shift-release ((pane extended-output-stream) event)  




More information about the Mcclim-cvs mailing list