mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
- Restore SIOUX menubar just before exiting, if the console window is kept
open (so the user can quit with cmd-Q, print, etc) - Removed a few unused routines
This commit is contained in:
parent
455838a217
commit
caa7c46ac4
2 changed files with 27 additions and 21 deletions
|
|
@ -159,6 +159,11 @@ int PyMac_DoYieldEnabled = 1;
|
||||||
*/
|
*/
|
||||||
int PyMac_ConsoleIsDead;
|
int PyMac_ConsoleIsDead;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Sioux menu bar, saved early so we can restore it
|
||||||
|
*/
|
||||||
|
static Handle sioux_mbar;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Some stuff for our GetDirectory and PromptGetFile routines
|
** Some stuff for our GetDirectory and PromptGetFile routines
|
||||||
*/
|
*/
|
||||||
|
|
@ -415,8 +420,6 @@ scan_event_queue(flush)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TICKCOUNT 6
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PyOS_InterruptOccurred()
|
PyOS_InterruptOccurred()
|
||||||
{
|
{
|
||||||
|
|
@ -426,6 +429,7 @@ PyOS_InterruptOccurred()
|
||||||
schedparams.next_check = (unsigned long)LMGetTicks()
|
schedparams.next_check = (unsigned long)LMGetTicks()
|
||||||
+ schedparams.check_interval;
|
+ schedparams.check_interval;
|
||||||
if (interrupted) {
|
if (interrupted) {
|
||||||
|
scan_event_queue(1); /* Eat events up to cmd-. */
|
||||||
interrupted = 0;
|
interrupted = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -434,23 +438,6 @@ PyOS_InterruptOccurred()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
/* intrpeek() is like intrcheck(), but it doesn't flush the events. The
|
|
||||||
** idea is that you call intrpeek() somewhere in a busy-wait loop, and return
|
|
||||||
** None as soon as it returns 1. The mainloop will then pick up the cmd-. soon
|
|
||||||
** thereafter.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
intrpeek()
|
|
||||||
{
|
|
||||||
#ifdef THINK_C
|
|
||||||
scan_event_queue(0);
|
|
||||||
#endif
|
|
||||||
return interrupted;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check whether we are in the foreground */
|
/* Check whether we are in the foreground */
|
||||||
int
|
int
|
||||||
PyMac_InForeground()
|
PyMac_InForeground()
|
||||||
|
|
@ -505,6 +492,7 @@ PyMac_HandleEvent(evp, maycallpython)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !__MWERKS__ */
|
#endif /* !__MWERKS__ */
|
||||||
|
printf("not handled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -596,20 +584,36 @@ PyMac_SetSchedParams(PyMacSchedParams *sp)
|
||||||
schedparams.enabled = 0;
|
schedparams.enabled = 0;
|
||||||
schedparams.next_check = 0; /* Check immedeately */
|
schedparams.next_check = 0; /* Check immedeately */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Install our menu bar.
|
** Install our menu bar.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
PyMac_InitMenuBar()
|
PyMac_InitMenuBar()
|
||||||
{
|
{
|
||||||
Handle bar;
|
|
||||||
MenuHandle applemenu;
|
MenuHandle applemenu;
|
||||||
|
|
||||||
if ( (bar=GetMenuBar()) == NULL ) return;
|
if ( (sioux_mbar=GetMenuBar()) == NULL ) {
|
||||||
|
/* Sioux menu not installed yet. Do so */
|
||||||
|
SIOUXSetupMenus();
|
||||||
|
if ( (sioux_mbar=GetMenuBar()) == NULL )
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ( (applemenu=GetMenuHandle(SIOUX_APPLEID)) == NULL ) return;
|
if ( (applemenu=GetMenuHandle(SIOUX_APPLEID)) == NULL ) return;
|
||||||
SetMenuItemText(applemenu, 1, "\pAbout Python...");
|
SetMenuItemText(applemenu, 1, "\pAbout Python...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Restore sioux menu bar
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
PyMac_RestoreMenuBar()
|
||||||
|
{
|
||||||
|
if ( sioux_mbar )
|
||||||
|
SetMenuBar(sioux_mbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Our replacement about box
|
** Our replacement about box
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ init_common(int *argcp, char ***argvp, int embedded)
|
||||||
|
|
||||||
#ifdef USE_SIOUX
|
#ifdef USE_SIOUX
|
||||||
/* Set various SIOUX flags. Some are changed later based on options */
|
/* Set various SIOUX flags. Some are changed later based on options */
|
||||||
|
/* SIOUXSettings.standalone = 0; /* XXXX Attempting to keep sioux from eating events */
|
||||||
SIOUXSettings.asktosaveonclose = 0;
|
SIOUXSettings.asktosaveonclose = 0;
|
||||||
SIOUXSettings.showstatusline = 0;
|
SIOUXSettings.showstatusline = 0;
|
||||||
SIOUXSettings.tabspaces = 4;
|
SIOUXSettings.tabspaces = 4;
|
||||||
|
|
@ -462,6 +463,7 @@ PyMac_Exit(status)
|
||||||
SIOUXSettings.standalone = 1;
|
SIOUXSettings.standalone = 1;
|
||||||
SIOUXSettings.autocloseonquit = 0;
|
SIOUXSettings.autocloseonquit = 0;
|
||||||
SIOUXSetTitle("\p\307terminated\310");
|
SIOUXSetTitle("\p\307terminated\310");
|
||||||
|
PyMac_RestoreMenuBar();
|
||||||
#ifdef USE_MSL
|
#ifdef USE_MSL
|
||||||
/*
|
/*
|
||||||
** Temporary workaround: autocloseonquit clearing does not
|
** Temporary workaround: autocloseonquit clearing does not
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue