Index: /branches/ide-1.0/ccl/hemlock/src/key-event.lisp
===================================================================
--- /branches/ide-1.0/ccl/hemlock/src/key-event.lisp	(revision 6654)
+++ /branches/ide-1.0/ccl/hemlock/src/key-event.lisp	(revision 6655)
@@ -104,172 +104,9 @@
 (defvar *modifiers-to-internal-masks*)
 
-;;; TRANSLATE-KEY-EVENT -- Public.
-;;;
-#+clx
-(defun translate-key-event (display scan-code bits)
-  "Translates the X scan-code and X bits to a key-event.  First this maps
-   scan-code to an X keysym using XLIB:KEYCODE->KEYSYM looking at bits and
-   supplying index as 1 if the X shift bit is on, 0 otherwise.
-
-   If the resulting keysym is undefined, and it is not a modifier keysym, then
-   this signals an error.  If the keysym is a modifier key, then this returns
-   nil.
-
-   If the following conditions are satisfied
-      the keysym is defined
-      the X shift bit is off
-      the X lock bit is on
-      the X keysym represents a lowercase letter
-   then this maps the scan-code again supplying index as 1 this time, treating
-   the X lock bit as a caps-lock bit.  If this results in an undefined keysym,
-   this signals an error.  Otherwise, this makes a key-event with the keysym
-   and bits formed by mapping the X bits to key-event bits.
-
-   If any state bit is set that has no suitable modifier translation, it is
-   passed to XLIB:DEFAULT-KEYSYM-INDEX in order to handle Mode_Switch keys
-   appropriately.
-
-   Otherwise, this makes a key-event with the keysym and bits formed by mapping
-   the X bits to key-event bits."
-  (let ((new-bits 0)
-	shiftp lockp)
-    (dolist (map *modifier-translations*)
-      (unless (zerop (logand (car map) bits))
-	;; ignore the bits of the mapping for the determination of a key index
-	(setq bits (logxor bits (car map)))
-	(cond
-	 ((string-equal (cdr map) "Shift")
-	  (setf shiftp t))
-	 ((string-equal (cdr map) "Lock")
-	  (setf lockp t))
-	 (t (setf new-bits
-		  (logior new-bits (key-event-modifier-mask (cdr map))))))))
-    ;; here pass any remaining modifier bits to clx
-    (let* ((index  (and (not (zerop bits))
-			(xlib:default-keysym-index display scan-code bits)))
-	   (keysym (xlib:keycode->keysym display scan-code (or index (if shiftp 1 0)))))
-      (cond ((null (keysym-names keysym))
-	     nil)
-	    ((and (not shiftp) lockp (<= 97 keysym 122)) ; small-alpha-char-p
-	     (let ((keysym (xlib:keycode->keysym display scan-code 1)))
-	       (if (keysym-names keysym)
-		   (make-key-event keysym new-bits)
-		   nil)))
-	    (t
-	     (make-key-event keysym new-bits))))))
-
-
-
-
-;;;; Mouse key-event stuff.
-
-;;; Think of this data as a three dimensional array indexed by the following
-;;; domains:
-;;;    1-5
-;;;       for the mouse scan-codes (button numbers) delivered by X.
-;;;    :button-press or :button-release
-;;;       whether the button was pressed or released.
-;;;    :keysym or :shifted-modifier-name
-;;;       whether the X shift bit was set.
-;;; For each button, pressed and released, we store a keysym to be used in a
-;;; key-event representing the button and whether it was pressed or released.
-;;; We also store a modifier name that TRANSLATE-MOUSE-KEY-EVENT turns on
-;;; whenever a mouse event occurs with the X shift bit on.  This is basically
-;;; an archaic feature since we now can specify key-events like the following:
-;;;    #k"shift-leftdown"
-;;; Previously we couldn't, so we mapped the shift bit to a bit we could
-;;; talke about, such as super.
-;;;
-(defvar *mouse-translation-info*)
-
-(eval-when (:compile-toplevel :execute)
-  (defmacro button-press-info (event-dispatch) `(car ,event-dispatch))
-  (defmacro button-release-info (event-dispatch) `(cdr ,event-dispatch))
-  (defmacro button-keysym (info) `(car ,info))
-  (defmacro button-shifted-modifier-name (info) `(cdr ,info))
-) ;eval-when
-
-;;; MOUSE-TRANSLATION-INFO -- Internal.
-;;;
-;;; This returns the requested information, :keysym or :shifted-modifier-name,
-;;; for the button cross event-key.  If the information is undefined, this
-;;; signals an error.
-;;;
-(defun mouse-translation-info (button event-key info)
-  (let ((event-dispatch (svref *mouse-translation-info* button)))
-    (unless event-dispatch
-      (error "No defined mouse translation information for button ~S." button))
-    (let ((data (ecase event-key
-		  (:button-press (button-press-info event-dispatch))
-		  (:button-release (button-release-info event-dispatch)))))
-      (unless data
-	(error
-	 "No defined mouse translation information for button ~S and event ~S."
-	 button event-key))
-      (ecase info
-	(:keysym (button-keysym data))
-	(:shifted-modifier-name (button-shifted-modifier-name data))))))
-
-;;; %SET-MOUSE-TRANSLATION-INFO -- Internal.
-;;;
-;;; This walks into *mouse-translation-info* the same way MOUSE-TRANSLATION-INFO
-;;; does, filling in the data structure on an as-needed basis, and stores
-;;; the value for the indicated info.
-;;;
-(defun %set-mouse-translation-info (button event-key info value)
-  (let ((event-dispatch (svref *mouse-translation-info* button)))
-    (unless event-dispatch
-      (setf event-dispatch
-	    (setf (svref *mouse-translation-info* button) (cons nil nil))))
-    (let ((data (ecase event-key
-		  (:button-press (button-press-info event-dispatch))
-		  (:button-release (button-release-info event-dispatch)))))
-      (unless data
-	(setf data
-	      (ecase event-key
-		(:button-press
-		 (setf (button-press-info event-dispatch) (cons nil nil)))
-		(:button-release
-		 (setf (button-release-info event-dispatch) (cons nil nil))))))
-      (ecase info
-	(:keysym
-	 (setf (button-keysym data) value))
-	(:shifted-modifier-name
-	 (setf (button-shifted-modifier-name data) value))))))
-;;;
-(defsetf mouse-translation-info %set-mouse-translation-info)
-
-;;; DEFINE-MOUSE-KEYSYM -- Public.
-;;;
-(defun define-mouse-keysym (button keysym name shifted-bit event-key)
-  "This defines keysym named name for the X button cross the X event-key.
-   Shifted-bit is a defined modifier name that TRANSLATE-MOUSE-KEY-EVENT sets
-   in the key-event it returns whenever the X shift bit is on."
-  (unless (<= 1 button 5)
-    (error "Buttons are number 1-5, not ~D." button))
-  (setf (gethash keysym *keysyms-to-names*) (list name))
-  (setf (gethash  (get-name-case-right name) *names-to-keysyms*) keysym)
-  (setf (mouse-translation-info button event-key :keysym) keysym)
-  (setf (mouse-translation-info button event-key :shifted-modifier-name)
-	shifted-bit))
-
-;;; TRANSLATE-MOUSE-KEY-EVENT -- Public.
-;;;
-(defun translate-mouse-key-event (scan-code bits event-key)
-  "This translates the X button code, scan-code, and modifier bits, bits, for
-   the X event-key into a key-event.  See DEFINE-MOUSE-KEYSYM."
-  (let ((keysym (mouse-translation-info scan-code event-key :keysym))
-	(new-bits 0))
-    (dolist (map *modifier-translations*)
-      (when (logtest (car map) bits)
-	(setf new-bits
-	      (if (string-equal (cdr map) "Shift")
-		  (logior new-bits
-			  (key-event-modifier-mask
-			   (mouse-translation-info
-			    scan-code event-key :shifted-modifier-name)))
-		  (logior new-bits
-			  (key-event-modifier-mask (cdr map)))))))
-    (make-key-event keysym new-bits)))
+
+
+
+
+
 
 
