Clean exit from SunView environment.

Graham Underwood advsys!graham at relay.eu.net
Tue Jun 5 18:05:15 AEST 1990


In article <8439 at brazos.Rice.edu> you write:
>
>In article <8287 at brazos.Rice.edu> MEYERS1 at ll.ll.mit.edu writes:
>-> Is there a means to exit the SunView desktop environment from within a
>-> SunWindows application?  The intended application would have the pressing
>-> of a SunWindows button cause exit from SunView.  Currently, the only way I
>-> know to exit SunView is via the pop-up rootmenu.
>
>One thing you could do is find what process you need to kill to exit
>sunview and have your program hunt down and kill it.

Yeuch! Far cleaner solution is as follows:

#include <suntool/sunview.h>
#include <sunwindow/window_hs.h>
#include <stdio.h>

static Frame	frame;

main()
{
	frame = (Frame) window_create(NULL, FRAME, 0);
	SunViewExit();
}

static
SunViewExit()
{
	int	rootfd = SunViewOpen();

	win_screendestroy(rootfd);
	close(rootfd);
}

static 
SunViewOpen()
{
	int             myfd, rootfd;
	struct screen   rootscreen;

	myfd = (int) window_get(frame, WIN_FD);
	win_screenget(myfd, &rootscreen);
	rootfd = open(rootscreen.scr_rootname, 1);
	return (rootfd);
}

In practice frame would be the base frame of your application.



More information about the Comp.sys.sun mailing list