Path: utzoo!attcan!uunet!husc6!bloom-beacon!dsg.csc.ti.COM!Kimbrough From: Kimbrough@dsg.csc.ti.COM (Kerry Kimbrough) Newsgroups: comp.windows.x Subject: Re: CLX question Message-ID: <2794606396-4312838@Sierra> Date: 22 Jul 88 23:33:16 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 44 > Date: 22 Jul 88 19:52:48 GMT > From: sandra@cs.utah.edu (Sandra J Loosemore) > Subject: CLX question > > In CLX, how does one determine whether a screen is monochrome or color? > The trick I've seen used in Xlib is to check how many colors the default > colormap will hold, but I can't find the equivalent accessor in CLX. Or > is there some other test that is preferred? > > -Sandra Loosemore (sandra@cs.utah.edu) Try something like this: (DEFUN display-color-type (display screen-number) (LET* (;; Get screen object (screen (NTH screen-number (display-roots display))) ;; Get list of supported (depth visual) entries (depths (screen-depths screen)) ;; Find max screen depth supported (max-depth (REDUCE #'MAX (MAPCAR #'FIRST depths))) ;; Find all entries for max depth (max-depths (REMOVE max-depth depths :key #'FIRST :test-not #'EQUAL))) ;; Return max supported depth and list of visual classes for max depth (VALUES max-depth (MAPCAR #'(lambda (d) (visual-info-class (SECOND d))) max-depths)))) For a typical display with a single monochrome screen, the return values will be: 1 (:STATIC-GRAY) For a typical display with a single 8-bit color screen, the return values will be: 8 (:PSEUDO-COLOR)