Screen depth -- really, WHICH SCREEN
jacob at itd.nrl.navy.mil
jacob at itd.nrl.navy.mil
Wed Jan 4 10:16:32 AEST 1989
>............what I really need is a way to find out which device I
>happen to be using. (I have suntools running on both screens and can move
>back and forth just my moving the mouse over -- "adjacentscreens" allows
>this.) So if I had a routine that returns "/dev/fb" or "/dev/cgfour0", I
>could easily find the depth.
How about this routine...I use it mainly as a stand-alone program to call
from shell scripts, but I think it does what you want -- i.e., returns the
device name of the frame buffer under the window it's run from (or else ""
if it looks like you're not inside a window system).
#include <suntool/sunview.h>
#include <fcntl.h>
char *ScreenName() {
int f;
char winname[WIN_NAMESIZE];
struct screen rootscreen;
static char ans[SCR_NAMESIZE];
if (we_getparentwindow(winname)!=0) return("");
if ( (f=open (getenv("WINDOW_PARENT"), O_RDONLY, 0)) == -1) return("");
win_screenget(f, &rootscreen);
if ( (f = open(rootscreen.scr_rootname, O_RDONLY, 0)) == -1) return("");
strcpy (ans, rootscreen.scr_fbname);
return (ans);
}
Good luck,
Robert Jacob
NET: jacob at itd.nrl.navy.mil
SNAIL: Code 5530, Naval Research Lab, Washington, D.C. 20375
More information about the Comp.sys.sun
mailing list