How to discover screen depth

mmm%informatics.rutherford.ac.uk at nss.cs.ucl.ac.uk mmm%informatics.rutherford.ac.uk at nss.cs.ucl.ac.uk
Thu Nov 24 02:06:01 AEST 1988


In Sun-Spots v7n12 Matthew Turk (mit-amt!turk at mit-amt.media.mit.edu) asks
> I have 1-bit and 8-bit monitors hooked up to a Sun.  Is there an easy way
> to find out the screen depth (under Suntools) without creating a new
> window?

I use the following fragment:

	struct pixrect *sc;
	int retn;
	sc = pr_open("/dev/fb");
	if(sc==0)return(0);
	switch(what){
	case ASKXSCREEN:
		retn = sc->pr_size.x;
		break;
	case ASKYSCREEN:
		retn = sc->pr_size.y;
		break;
	case ASKDEPTH:
		retn = sc->pr_depth;
		break;
	}
	pr_close(sc);

Mark M Martin			janet:	mmm at uk.ac.rl.inf
Informatics			arpa:	mmm%inf.rl.ac.uk at nss.cs.ucl.ac.uk
Rutherford Appleton Lab		uucp:	..!mcvax!ukc!rlinf!mmm
Didcot, Oxon, UK. OX11 0QX		mmm at rlinf.uucp
Tel +44 235 44 6756		Fax +44 235 44 5831



More information about the Comp.sys.sun mailing list