[comp.sys.sun] REFRESHING SUNTOOLS

mmm%informatics.rutherford.ac.uk@nss.cs.ucl.ac.uk (01/16/89)

mephdbo%prism@gatech.edu (d. majumder):
> Is there any way of calling REFRESH other than using the Suntools
> RootMenu.  I mean from a Shell program, etc.

>From the shell you can use the trick I think X uwm uses. It creates a
window covering the screen, then removes it immediately.  You don't have
to be accurate with the window size as long as it is at least as big as
the screen. Example: 

	shelltool -position 0 0 -size 1152 900 -label refreshing   true

weiser.pa@xerox.com (01/18/89)

d. majumder writes: "Is there any way of calling REFRESH other than using
the Suntools RootMenu.  I mean from a Shell program, etc."

I believe suns are shipped with the source code to suntools, which
contains the few lines to do the refresh (basically, move the whole screen
by 1 bit and back again).  You could pull this code out into a separate
"refresh" program.

-mark

chuck@trantor.harris-atd.com (Chuck Musciano) (01/18/89)

> Is there any way of calling REFRESH other than using the Suntools
> RootMenu.  I mean from a Shell program, etc.

     Piece of cake:

	main()

	{       int fd;

	        fd = open("/dev/win0");        
	        wmgr_refreshwindow(fd);
	}

Note: details removed for clarity.  Include the appropriate include files.
Use "getenv("WINDOW_PARENT")" to get the true base window name instead of
hard wiring "/dev/win0".

[[ This is, in fact, the way it's done in suntools.c (check in
/usr/src/sun/suntool/suntools.c).  --wnl ]]

Chuck Musciano
Advanced Technology Department
Harris Corporation
(407) 727-6131
ARPA: chuck@trantor.harris-atd.com

libes@cme.nbs.gov (Don Libes) (01/19/89)

mephdbo%prism@gatech.edu (d. majumder) writes:
>Is there any way of calling REFRESH other than using the Suntools
>RootMenu.  I mean from a Shell program, etc.

One of our users had the exact same question.  It seems he wanted to run
X-window based programs under suntools.  The only problem he encountered
was that the sun windows wouldn't refresh.  The simplest solution was to
send a signal to suntools.

Since Sun distributes the source to suntools, it is relatively trivial to
add a couple of lines to catch the signal and call the refresh routine.

On the other hand, has anyone hacked up X so that it can automatically
cause suntools to do the refresh?  That would be much better.

Don Libes          libes@cme.nbs.gov      ...!uunet!cme-durer!libes

josh@sun.com (Joshua Axelrod) (01/24/89)

Here is a little hack that will work now. I don't think this will continue
to work under future window servers.

	Josh Axelrod
	jaxelrod@sun.com

#include <suntool/sunview.h>
#include <suntool/wmgr.h>
#include <sys/file.h>

main()
{
	Frame frame;
	int rootfd, fd;
	struct screen rootscreen;

	frame = window_create((Window) NULL, FRAME,0);

	fd = (int) window_get(frame, WIN_FD);
	(void) win_screenget(fd,&rootscreen);

	if ((rootfd = open(rootscreen.scr_rootname, O_RDWR)) == -1) {
		perror("main:open");
		exit(1);
	}

	wmgr_refreshwindow(rootfd);

	exit(0);
}