CLIM mail archive


Re: Tracking pointers...

Hold it, you guys.  How about a real bug report?  If there's a bug here,
we need a much better example of just what you're trying to do.

The following example works fine for me, it tracks the pointer across
multiple windows, detecting the crossings just fine.  (Cut me a small
amount of slack on the internal kludgery necessary to find the name of a

;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: CLIM-USER -*-

(define-application-frame track-test ()
  (:panes ((display1 :application :scroll-bars nil)
	   (display2 :application :scroll-bars nil)
	   (menu :command-menu)
	   (history :interactor)))
  (:layout ((regular
	      (:column 1
	       (:row 1/2 (display1 1/2) (display2 :rest))
	       (:row :rest (history 3/4) (menu :rest)))))))

(define-track-test-command (com-exit-track-test :menu "Exit") ()
  (frame-exit *application-frame*))

(define-track-test-command (com-test-tracking :menu "Test") ()
  (tracking-test *application-frame*))

(defmethod tracking-test ((frame track-test))
  (let ((display1 (get-frame-pane frame 'display1))
	(display2 (get-frame-pane frame 'display2))
	(history (get-frame-pane frame 'history)) 
	old-window old-x old-y)
    (tracking-pointer (display1 :multiple-window t)
      (:pointer-motion (window x y)
       (when (or (not (eql window old-window))
		 (> (abs (- x old-x)) 10)
		 (> (abs (- y old-y)) 10))
	 (setq old-window window old-x x old-y y)
	 (let ((name (clim::pane-descriptor-name (nth (position window (frame-panes frame))
							(clim::find-frame-descriptor frame))))))
	   (format history "~&Tracking in pane ~S, x,y = ~D,~D" name x y))))
      (:pointer-button-press (event)
       (return-from tracking-test)))))

(defvar *clim-root* (open-root-window :sheet))
(setq tt (clim:make-application-frame 'track-test :parent *clim-root* :width 800 :height 800))
(clim:run-frame-top-level tt)


Main Index | Thread Index