Fixed the font-selector demo so that it doesn't crash. The problem
authorRobert Strandh <rstrandh@common-lisp.net>
Tue, 8 Dec 2009 05:26:29 +0000 (05:26 +0000)
committerRobert Strandh <rstrandh@common-lisp.net>
Tue, 8 Dec 2009 05:26:29 +0000 (05:26 +0000)
was that when the family changes, it tries to initialize the face to
one with the same name as the selected one in the old family.  When
there is no such face in the new family, it got initialized to nil.

However, the demo is still not working properly.  Sometimes a
displayed face becomes non-clickable, and sometimes two faces are
highlighted simultaneously.

Examples/font-selector.lisp

index ba87b8d..f7a0b71 100644 (file)
     (reset-list-pane face-list new-faces)
     (when old-face
       (setf (gadget-value face-list :invoke-callback t)
-           (find (font-face-name old-face)
-                 new-faces
-                 :key #'font-face-name
-                 :test #'equal)))))
+           (or (find (font-face-name old-face)
+                      new-faces
+                      :key #'font-face-name
+                      :test #'equal)
+                (first new-faces))))))
 
 (defun face-changed (pane value)
   (declare (ignore pane))