home *** CD-ROM | disk | FTP | other *** search
- /*
- dispinit.c
-
- % Display manager initialization code.
-
- 5/16/88 by Ted.
-
- OWL 1.1
- Copyright (c) 1988, 1989 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 8/09/88 jmd revised to use new object stuff
- 8/12/88 ted tested return value of ddisp_open()
- 8/17/88 jmd removed eNOMEM
- 8/24/88 ted merged driver and mode in to one stub function pointer.
- 3/20/89 ted made curr_dmgr a static structure
- 8/18/89 ted added disp_Repaint to end of disp_Init.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
-
- OGLOBAL dmgr_struct curr_dmgrstruc; /* the current display manager structure */
-
- OGLOBAL int num_dmgrs = 0; /* the number of dmgrs that have been initted */
- static char copyr[] = "OWL 1.1 Copyright (c) 1989 by Oakland Group, Inc.";
- /* -------------------------------------------------------------------------- */
-
- boolean disp_Init(dmode, backwin)
- dmode_fptr dmode; /* Display mode initialization function */
- class_fptr backwin; /* Background window type */
- /*
- Initialize the current display manager structure and its
- Device Interface Group functions.
- Returns TRUE if successful, FALSE if unable to initialize the device
- interface.
- */
- {
- /* Initialize the display and hardware Device Interface Group. */
- if (!dispsetup(dmode)) {
- return(FALSE);
- }
- curr_dmgr->id = copyr[0]; /* To suppress unused-copyr compiler warning */
-
- /* Keep track of how many dmgrs have been initted, */
- /* and assign them consecutive id numbers starting from 1. */
-
- curr_dmgr->id = ++num_dmgrs;
-
- /* Initialize the window manager, w/ tiler and background window */
- if (!wmgr_Init(backwin)) {
- curr_dmgr->id = --num_dmgrs;
- return(FALSE);
- }
- /* Initialize the display */
- disp_Repaint();
-
- return(TRUE);
- }
- /* -------------------------------------------------------------------------- */
-
- void disp_Close()
- /*
- Close the current display manager.
- */
- {
- static boolean inclose = FALSE;
-
- /* Prevent re-entrant calls from going through this function */
- if (inclose) {
- return;
- }
- inclose = TRUE;
-
- if (!disp_Ok()) { /* if curr_dmgr is not valid, don't close it */
- return;
- }
- disp_Cache(); /* hide mouse */
- wmgr_Wrapup(); /* free all windows */
- disp_RestoreMode(); /* restore hardware display mode */
- disp_CloseDIG(); /* close down device interface Group */
-
- /* Wipe the dmgr data structure clean again */
- memset(curr_dmgr, 0, sizeof(dmgr_struct));
-
- inclose = FALSE;
- }
- /* -------------------------------------------------------------------------- */
-
- boolean OWLPRIV dispsetup(dmode)
- dmode_fptr dmode;
- /*
- Do the work of initializing the display manager device interface stuff.
- */
- {
- /* Init disp data pointers to NULL */
- curr_dmgr->disp.info = NULL;
- curr_dmgr->disp.dig.data = NULL;
-
- /* Call the disp_struct's open ptr to set up dig structure and display mode */
- if (!(*dmode)(&curr_dmgr->disp.dig)) { /* Set up driver structure */
- return(FALSE);
- }
- /* Get device info struct ptr */
- disp_Control(DC_GETINFO, NULL, &curr_dmgr->disp.info);
-
- curr_dmgr->disp.mouse_timeout = 30; /* n/100 sec dclick/dhold time */
- curr_dmgr->disp.mouse_distout = ofont_GetWidth(disp_GetDefFont());
-
- return(TRUE);
- }
- /* -------------------------------------------------------------------------- */
-
-