add param to ini winsys routines

Provide a mechanism for cleanly moving between tentative window system
selections during startup.  Now, before a second (or later) system is selected,
the first will be notified that it is losing control.  See window.doc.
This commit is contained in:
keni
2012-01-10 01:39:31 +00:00
parent e442242417
commit c119e8c3d9
11 changed files with 47 additions and 17 deletions

View File

@@ -585,3 +585,4 @@ drawing symbols for DECGraphics, IBMGraphics, MACgraphics are now stored in an
external symbol file that can be changed without rebuilding
new hints-based configuration system
allow documentation to be specialized to the options in the game binary
add param to winsys ini routines to allow cleaner shifting during startup

View File

@@ -862,6 +862,12 @@ Choose_windows() is a common routine, and calling it in main() is necessary
to initialize the function pointer table to _something_ so that calls to
raw_print() will not fail. Choose_windows() should be called almost
immediately upon entering main(). Look at unixmain.c for an example.
Choose_windows will call an (optional) ini_routine with a single argument
of WININIT to allow any needed setup. Because choose_windows() may be called
multiple times during argument and option processing, to handle the case where
ini_routines have side effects that need to be undone, the old ini_routine (if
any) will be called with an argument of WININIT_UNDO before the new
ini_routine (if any) is called (with WININIT).
Display_gamewindows() is a common routine that displays the two standard
game windows (WIN_MESSAGE, WIN_MAP), and the status display. It is normally

View File

@@ -97,7 +97,7 @@ extern int NDECL(kbhit);
extern int NDECL(WindowGetchar);
extern void FDECL(ami_argset, (int *, char *[]));
extern void FDECL(ami_mkargline, (int *, char **[]));
extern void ami_wininit_data(void);
extern void FDECL(ami_wininit_data, (int));
#define FromWBench 0 /* A hint for compiler ... */
/* extern boolean FromWBench; /* how were we run? */

View File

@@ -290,7 +290,7 @@ E char FDECL(key_event_to_char,(XKeyEvent*));
E void FDECL(msgkey, (Widget, XtPointer, XEvent*));
E void FDECL(nh_XtPopup, (Widget, int, Widget));
E void FDECL(nh_XtPopdown, (Widget));
E void NDECL(win_X11_init);
E void FDECL(win_X11_init, (int));
E void FDECL(nh_keyscroll, (Widget, XEvent*, String*, Cardinal*));
/* ### winmesg.c ### */

View File

@@ -31,7 +31,7 @@ E void NDECL(setclipped);
E void FDECL(docorner, (int, int));
E void NDECL(end_glyphout);
E void FDECL(g_putch, (int));
E void NDECL(win_Gem_init);
E void FDECL(win_Gem_init, (int));
E int NDECL(mar_gem_init);
E char NDECL(mar_ask_class);
E char * NDECL(mar_ask_name);

View File

@@ -264,4 +264,9 @@ struct wc_Opt {
#define RS_ALGNMNT 4
#define RS_menu_arg(x) (ROLE_RANDOM - ((x) + 1)) /* 0..4 -> -3..-7 */
/* Choose_windows() may be called multiple times; these constants tell the
* init function whether the window system is coming or going. */
#define WININIT 0
#define WININIT_UNDO 1
#endif /* WINPROCS_H */

View File

@@ -166,7 +166,7 @@ E void NDECL(setclipped);
E void FDECL(docorner, (int, int));
E void NDECL(end_glyphout);
E void FDECL(g_putch, (int));
E void NDECL(win_tty_init);
E void FDECL(win_tty_init, (int));
#ifdef UNICODE_WIDEWINPORT
E void FDECL(u_putch, (nhwchar));
#endif

View File

@@ -10,7 +10,7 @@
/* cannot just blindly include winX.h without including all of X11 stuff */
/* and must get the order of include files right. Don't bother */
extern struct window_procs X11_procs;
extern void NDECL(win_X11_init);
extern void FDECL(win_X11_init, (int));
#endif
#ifdef QT_GRAPHICS
extern struct window_procs Qt_procs;
@@ -23,12 +23,12 @@ extern struct window_procs mac_procs;
#endif
#ifdef BEOS_GRAPHICS
extern struct window_procs beos_procs;
extern void NDECL(be_win_init);
extern void FDECL(be_win_init, (int)); FAIL /* be_win_init doesn't exist? */
#endif
#ifdef AMIGA_INTUITION
extern struct window_procs amii_procs;
extern struct window_procs amiv_procs;
extern void NDECL(ami_wininit_data);
extern void FDECL(ami_wininit_data, (int));
#endif
#ifdef WIN32_GRAPHICS
extern struct window_procs win32_procs;
@@ -51,7 +51,7 @@ NEARDATA struct window_procs windowprocs;
static
struct win_choices {
struct window_procs *procs;
void NDECL((*ini_routine)); /* optional (can be 0) */
void FDECL((*ini_routine), (int)); /* optional (can be 0) */
} winchoices[] = {
#ifdef TTY_GRAPHICS
{ &tty_procs, win_tty_init },
@@ -87,6 +87,8 @@ struct win_choices {
{ 0, 0 } /* must be last */
};
static struct win_choices *last_winchoice = 0;
boolean
genl_can_suspend_no(VOID_ARGS){
return FALSE;
@@ -111,12 +113,18 @@ const char *s;
{
register int i;
for(i=0; winchoices[i].procs; i++)
for(i=0; winchoices[i].procs; i++){
if (!strcmpi(s, winchoices[i].procs->name)) {
windowprocs = *winchoices[i].procs;
if (winchoices[i].ini_routine) (*winchoices[i].ini_routine)();
if (last_winchoice && last_winchoice->ini_routine)
(*last_winchoice->ini_routine)(WININIT_UNDO);
if (winchoices[i].ini_routine)
(*winchoices[i].ini_routine)(WININIT);
last_winchoice = &winchoices[i];
return;
}
}
if (!windowprocs.win_raw_print)
windowprocs.win_raw_print = def_raw_print;
@@ -130,8 +138,9 @@ const char *s;
s, winchoices[0].procs->name);
} else {
raw_printf("Window type %s not recognized. Choices are:", s);
for(i=0; winchoices[i].procs; i++)
for(i=0; winchoices[i].procs; i++){
raw_printf(" %s", winchoices[i].procs->name);
}
}
if (windowprocs.win_raw_print == def_raw_print)
@@ -187,9 +196,9 @@ boolean init;
/*ARGSUSED*/
void
genl_putmsghistory(msg, restoring)
genl_putmsghistory(msg, is_restoring)
const char *msg;
boolean restoring;
boolean is_restoring;
{
/* window ports can provide
their own putmsghistory() routine to
@@ -209,7 +218,7 @@ boolean restoring;
intact at the end of each call.
*/
#if 0 /* maybe... */
if (!restoring) pline1(msg);
if (!is_restoring) pline1("%s", msg);
#endif
return;
}

View File

@@ -43,10 +43,14 @@ int amii_otherBPen;
long amii_libvers = LIBRARY_FONT_VERSION;
void
ami_wininit_data( void )
ami_wininit_data( dir )
int dir;
{
extern unsigned short amii_init_map[ AMII_MAXCOLORS ];
extern unsigned short amiv_init_map[ AMII_MAXCOLORS ];
if( dir != WININIT) return;
if( !WINVERS_AMIV )
{
# ifdef TEXTCOLOR

View File

@@ -2058,8 +2058,11 @@ nh_XtPopdown(w)
}
void
win_X11_init()
win_X11_init(dir)
int dir;
{
if(dir != WININIT) return;
#ifdef OPENWINBUG
/* With the OpenWindows 3.0 libraries and the SunOS 4.1.2 ld, these
* two routines will not be found when linking. An apparently correct

View File

@@ -3074,8 +3074,10 @@ tty_nh_poskey(x, y, mod)
}
void
win_tty_init()
win_tty_init(dir)
int dir;
{
if(dir != WININIT) return;
# if defined(WIN32CON)
nttty_open();
# endif