(gmm-tool-bar-style): Test tool-bar-mode and
authorReiner Steib <Reiner.Steib@gmx.de>
Thu, 2 Mar 2006 16:24:38 +0000 (16:24 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Thu, 2 Mar 2006 16:24:38 +0000 (16:24 +0000)
display-visual-class instead of display-color-cells.

lisp/ChangeLog
lisp/gmm-utils.el

index 18da78c..a53b7b2 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-02  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * gmm-utils.el (gmm-tool-bar-style): Test tool-bar-mode and
+       display-visual-class instead of display-color-cells.
+
 2006-03-02  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * dgnushack.el: Autoload customize-group for XEmacs.
index 89e1b99..955a0e2 100644 (file)
@@ -176,9 +176,30 @@ This is copy of the `lazy' widget in Emacs 22.1 provided for compatibility."
                          :tag "Other"
                          (symbol :tag "Icon item")))))
 
-(defcustom gmm-tool-bar-style (if (> (display-color-cells) 256)
-                                 'gnome
-                               'retro)
+;; (defun gmm-color-cells (&optional display)
+;;   "Return the number of color cells supported by DISPLAY.
+;; Compatibility function."
+;;   ;; `display-color-cells' doesn't return more than 256 even if color depth is
+;;   ;; > 8 in Emacs 21.
+;;   ;;
+;;   ;; Feel free to add proper XEmacs support.
+;;   (let* ((cells (and (fboundp 'display-color-cells)
+;;                  (display-color-cells display)))
+;;      (plane (and (fboundp 'x-display-planes)
+;;                  (ash 1 (x-display-planes))))
+;;      (none -1))
+;;     (max (if (integerp cells) cells none)
+;;      (if (integerp plane) plane none))))
+
+(defcustom gmm-tool-bar-style
+  (if (and (boundp 'tool-bar-mode)
+          tool-bar-mode
+          (and (fboundp 'display-visual-class)
+               (not (memq (display-visual-class)
+                          (list 'static-gray 'gray-scale
+                                'static-color 'pseudo-color)))))
+      'gnome
+    'retro)
   "Prefered tool bar style."
   :type '(choice (const :tag "GNOME style" 'gnome)
                 (const :tag "Retro look"  'retro))
@@ -348,7 +369,6 @@ path to IMAGE.  If PATH is given, it is used instead of
                (delete gmm-image-directory
                        (copy-sequence load-path))))))
 
-
 (defun gmm-customize-mode (&optional mode)
   "Customize customization group for MODE.
 If mode is nil, use `major-mode' of the curent buffer."