CLIM mail archive


How to deal with a 1-button mouse?

    Date: Mon, 27 Sep 1993 09:58 EDT
    From: Jeff Morrill <jmorrill@BBN.COM>

    I think this question was debated once.  Could some
    MCL hackers out there please give some advice.  Thanks.

There are no "logical" gestures in CLIM named :LEFT, :MIDDLE, or :RIGHT.
Furthermore, I personally think it is poor style to create logical
gestures with any of those names because the names are (conceptually)
not portable.  Scigraph defines logical gestures with these names, but
does not appear to use them for anything.

      Date: Sun, 26 Sep 93 12:25:12 -0500
      From: "Sheldon S. Ball" <>
      There remain a few unresolved issues in porting scigraph to MCL 2.0/CLIM 1.1.
      One of the is mouse clicks.
      How can I modify :right & :middle to accept shift/mouse gesture &
      control/mouse gesture? Macintosh has only 1 mouse button.
      I tried the following modification to dwim:present.lisp without success:
	(clim:define-gesture-name :left :button :left)
	(clim:define-gesture-name :middle :button :left :shifts (:control))
	(clim:define-gesture-name :middle :button :middle)
	(clim:define-gesture-name :right :button :left :shifts (:shift))
	(clim:define-gesture-name :right :button :right))
      When the :shift or :control keys are depressed, the 
      L: Edit Graph Borders & Label...; R: Menu.
      in the lower left of the window produced by (make-demo-frame) 
      dissapears. The mouse click does not ellicit any action when the
      :shift or :control keys are depressed. This is true whether or not
      the above modification was made.
      Any suggestions?
Redefine the appropriate gestures: :SELECT, :DESCRIBE, :EDIT, :DELETE,
and :MENU.  CLIM 2.0 has the following code in it to do this.  I picked
the gesture assignments out of my hat; I certainly won't claim that the
assignments are better than any other ones.

(defun initialize-pointer-gestures (&optional (n-buttons 3))
  (let ((gestures
	  (ecase n-buttons
	    (3 '((:select   :left)
		 (:describe :middle)
		 (:menu     :right)
		 (:delete   :middle :shift)
		 (:edit     :left :meta)))
	    ;; Many 1-button mice act like 2-button mice in that clicking
	    ;; the button twice generates a "right" click
	    (2 '((:select   :left)
		 (:describe :left :control)
		 (:menu     :right)
		 (:delete   :right :control)
		 (:edit     :left :meta)))
	    (1 '((:select   :left)
		 (:describe :left :control)
		 (:menu     :left :shift)
		 (:delete   :left :shift :control)
		 (:edit     :left :meta))))))
    (dolist (gesture gestures)
      (destructuring-bind (name &rest button-and-shifts) gesture
	(delete-gesture-name name)
	(add-gesture-name name :pointer-button button-and-shifts :unique t)))))

Follow-Ups: References:

Main Index | Thread Index