🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #10039

Re: Screen depth -- really, WHICH SCREEN

#10039
From: jacob
Date: Wed, 04 Jan 1989 00:16
34 lines
1644 bytes
>............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@itd.nrl.navy.mil
SNAIL:	Code 5530, Naval Research Lab, Washington, D.C. 20375
Technical Details
Message-ID: <8812221916.AA04401@rjkj.itd.nrl.navy.mil>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!rice!sun-spots-request
From: jacob@itd.nrl.navy.mil
Newsgroups: comp.sys.sun
Subject: Re:  Screen depth -- really, WHICH SCREEN
Message-ID: <8812221916.AA04401@rjkj.itd.nrl.navy.mil>
Date: 4 Jan 89 00:16:32 GMT
Sender: usenet@rice.edu
Organization: Sun-Spots
Lines: 34
Approved: Sun-Spots@rice.edu
Original-Date: Thu, 22 Dec 88 14:16:15 EST
X-Sun-Spots-Digest: Volume 7, Issue 86, message 5 of 12