Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request From: advsys!graham@relay.eu.net (Graham Underwood) Newsgroups: comp.sys.sun Subject: Re: Clean exit from SunView environment. Keywords: Windows Message-ID: <8506@brazos.Rice.edu> Date: 5 Jun 90 08:05:15 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 47 Approved: Sun-Spots@rice.edu X-Refs: Original: v9n184, Replies: v9n184 X-Sun-Spots-Digest: Volume 9, Issue 184, message 9 In article <8439@brazos.Rice.edu> you write: > >In article <8287@brazos.Rice.edu> MEYERS1@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 #include #include 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.