[comp.sys.amiga] More Workbench Screens

sterling@dasys1.UUCP (Sterling Brown) (02/21/89)

    For the last couple of months I have been searching for a way to get
    a SHELL up onto a screen other than the workbench screen.  I even
    considered rewriting the NEWCON: device so that it opens up its own
    screen.  I finally found a way, and BOY is it easy.  I turns out that
    any screen that has its Type member set to WBENCHSCREEN can be used
    as an alternate workbench screen.  HOW?  By bringing the secondary
    screen to the top, any program that opens its window to the Workbench
    screen will open its window to the new screen.  This includes
    Shells, CLIs, Workbench programs and utilities, and Even Workbench
    itself.

    Just think of the possibilities of having workbench distribute its
    windows across 2 screens, or 3 screens, or 4 screens,...
    This VERY simple 'c' code will do nothing more than open a screen
    and put a SHELL on it.  After you run it, you can experiment with
    the workbench windows.  Remember, Only programs that open their
    windows to the Workbench screen can share the alternate screens.

    ----------------------  C U T   H E R E -------------------------

/*  alternate WbenchScreen program written by Sterling Brown */
/*  you can have a many of these as you want up              */

#include "intuition/intuition.h"

struct GfxBase *GfxBase;
struct IntuitionBase *IntuitionBase;   /* Base of Intuition library */
struct Screen *Screen;
struct ViewPort *ViewPort;

struct NewScreen NewScreen = {
        0,0,640,200,2,
        0,1,
        HIRES,
        WBENCHSCREEN,
        NULL,                      /* Default intuition font */
        "WorkBench Screen 2",      /* Title                  */
        NULL,
        NULL
        };

void main()
{
    GfxBase = (struct GfxBase*) OpenLibrary("graphics.library",0);
    if(GfxBase==NULL) exit(20);
    IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",0);
    if(IntuitionBase == NULL)
    {
        CloseLibrary(GfxBase);
        exit(20);
    }
    if((Screen=(struct Screen *)OpenScreen(&NewScreen))==NULL)
    {
        CloseLibrary(GfxBase);
        CloseLibrary(IntuitionBase);
        exit(20);
    }

/* if you want you can change the colors here   */
/* ViewPort = &(Screen->ViewPort);  Get the view port pointer
   SetRGB4(ViewPort,0,0,0,0);       Set color 0 to black
   SetRGB4(ViewPort,1,2,9,2);       Set color 1 to Green
   SetRGB4(ViewPort,2,12,12,0);     Set color 2 to Yellow\z
*/
   Execute("Newshell",0,0);
   exit(0);             /* leave the screen open and exit   */
}