The attached patchset addresses a couple of errors I encountered while
working on a project using McCLIM (in decode-x-button-code and
seos-write-string).
The non-error changes consist of two spelling corrections and an
implementation of map-over-command-table-translators.
Mike Watters
mike-cl(a)mwatters.net
* decode-x-button-code was using incorrect bounds check:
diff -wru ../mcclim-cvs/Backends/CLX/port.lisp ./Backends/CLX/port.lisp
--- ../mcclim-cvs/Backends/CLX/port.lisp 2008-05-12 20:04:39.000000000 -0700
+++ ./Backends/CLX/port.lisp 2008-10-16 18:18:27.000000000 -0700
@@ -615,10 +615,11 @@
+pointer-wheel-up+
+pointer-wheel-down+
+pointer-wheel-left+
- +pointer-wheel-right+)))
- (and (> code 0)
- (<= code (1+ (length button-mapping)))
- (aref button-mapping (1- code)))))
+ +pointer-wheel-right+))
+ (code (1- code)))
+ (when (and (>= code 0)
+ (< code (length button-mapping)))
+ (aref button-mapping code))))
;; From "Inter-Client Communication Conventions Manual", Version 2.0.xf86.1,
;; section 4.1.5:
* map-over-command-table-translators,
* add-actual-presentation-translator-to-command-table:
diff -wru ../mcclim-cvs/commands.lisp ./commands.lisp
--- ../mcclim-cvs/commands.lisp 2008-04-20 00:19:10.000000000 -0700
+++ ./commands.lisp 2008-10-16 18:20:56.000000000 -0700
@@ -480,6 +480,39 @@
(map-over-command-table-menu-items function table))))
(values)))
+(defun map-over-command-table-translators
+ (function command-table &key (inherited t))
+ (flet ((map-func (table)
+ (maphash #'(lambda (k v)
+ (declare (ignore k))
+ (funcall function v))
+ (slot-value
+ (presentation-translators table)
+ 'translators))))
+ (let ((command-table (find-command-table command-table)))
+ (if inherited
+ (apply-with-command-table-inheritance #'map-func command-table)
+ (map-func command-table)))))
+
+;(defun add-presentation-translator-to-command-table
+; (command-table translator-name &key (errorp t))
+; - fixme; spec says this fun is given a translator name, but that
+; find-presentation-translator needs a translator name and a command
+; table designator
+(defun add-actual-presentation-translator-to-command-table
+ (command-table translator &key (errorp t))
+ (let ((translators
+ (presentation-translators
+ (find-command-table command-table))))
+ (when (and errorp
+ (second
+ (multiple-value-list
+ (gethash (name translator)
+ (slot-value translators 'translators)))))
+ (error 'command-already-present
+ :command-table-name command-table))
+ (add-translator translators translator)))
+
;; At this point we should still see the gesture name as supplied by the
;; programmer in 'gesture'
(defun %add-keystroke-item (command-table gesture item errorp)
* seos-write-string sometimes gets called with zero-length strings,
* which have a split of 1 assigned when the stream eol action is
* :wrap, which eventually gets passed as the :end parameter to
* text-size, which causes a bounding indices error. alternate fix:
* change (1+ start) to (min end (1+ start)) in :wrap case of
* seos-write-string.
diff -wru ../mcclim-cvs/stream-output.lisp ./stream-output.lisp
--- ../mcclim-cvs/stream-output.lisp 2008-04-15 12:28:04.000000000 -0700
+++ ./stream-output.lisp 2008-10-16 18:21:22.000000000 -0700
@@ -287,6 +287,8 @@
:text-style text-style)
while (<= sub-width delta)
finally (return (1- i)))))
+ (when (eql end 0)
+ (return-from seos-write-string))
(with-slots (baseline height vspace) stream
(multiple-value-bind (cx cy) (stream-cursor-position stream)
* minor spelling corrections
diff -wru ../mcclim-cvs/Drei/drei-clim.lisp ./Drei/drei-clim.lisp
--- ../mcclim-cvs/Drei/drei-clim.lisp 2008-04-30 23:48:21.000000000 -0700
+++ ./Drei/drei-clim.lisp 2008-10-16 18:22:02.000000000 -0700
@@ -57,10 +57,10 @@
;;; though.
;;; Cursors are output records. After a cursor is created, The owning
-;;; Drei instance instnace should add it to the output stream. The
-;;; owner of the cursor (a Drei instance) is responsible for removing
-;;; the cursor once it is done with it. Cursors can be active/inactive
-;;; and enabled/disabled and have the same activity-status as their
+;;; Drei instance should add it to the output stream. The owner of the
+;;; cursor (a Drei instance) is responsible for removing the cursor
+;;; once it is done with it. Cursors can be active/inactive and
+;;; enabled/disabled and have the same activity-status as their
;;; associated view.
(defclass drei-cursor (standard-sequence-output-record)
((%view :reader view
diff -wru ../mcclim-cvs/input-editing.lisp ./input-editing.lisp
--- ../mcclim-cvs/input-editing.lisp 2008-02-07 12:20:04.000000000 -0800
+++ ./input-editing.lisp 2008-10-16 18:21:38.000000000 -0700
@@ -28,7 +28,7 @@
(in-package :clim-internals)
(defvar *use-goatee* nil
- "I true, use the Goatee editing component instead of Drei. The
+ "If true, use the Goatee editing component instead of Drei. The
Goatee component is faster and more mature than Drei.")
(defvar *activation-gestures* nil