mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
- Raise console window on input. Fixes Carbon hang.
- Better handling of menu bar save/restore. - Override abort() so it honours the "keep console window" flag.
This commit is contained in:
parent
ee677913df
commit
15f1c08d96
3 changed files with 32 additions and 4 deletions
|
|
@ -685,11 +685,13 @@ PyMac_DoYield(int maxsleep, int maycallpython)
|
||||||
*/
|
*/
|
||||||
if( in_here > 1 || !schedparams.process_events ||
|
if( in_here > 1 || !schedparams.process_events ||
|
||||||
(python_event_handler && !maycallpython) ) {
|
(python_event_handler && !maycallpython) ) {
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
if ( maxsleep >= 0 ) {
|
if ( maxsleep >= 0 ) {
|
||||||
|
#if !TARGET_API_MAC_CARBON
|
||||||
SystemTask();
|
SystemTask();
|
||||||
}
|
#else
|
||||||
|
int xxx = 0;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
latest_time_ready = LMGetTicks() + maxsleep;
|
latest_time_ready = LMGetTicks() + maxsleep;
|
||||||
do {
|
do {
|
||||||
|
|
@ -768,6 +770,7 @@ PyMac_InitMenuBar()
|
||||||
{
|
{
|
||||||
MenuHandle applemenu;
|
MenuHandle applemenu;
|
||||||
|
|
||||||
|
if ( sioux_mbar ) return;
|
||||||
if ( (sioux_mbar=GetMenuBar()) == NULL ) {
|
if ( (sioux_mbar=GetMenuBar()) == NULL ) {
|
||||||
/* Sioux menu not installed yet. Do so */
|
/* Sioux menu not installed yet. Do so */
|
||||||
SIOUXSetupMenus();
|
SIOUXSetupMenus();
|
||||||
|
|
@ -784,7 +787,7 @@ PyMac_InitMenuBar()
|
||||||
void
|
void
|
||||||
PyMac_RestoreMenuBar()
|
PyMac_RestoreMenuBar()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 1
|
||||||
/* This doesn't seem to work anymore? Or only for Carbon? */
|
/* This doesn't seem to work anymore? Or only for Carbon? */
|
||||||
MenuBarHandle curmenubar;
|
MenuBarHandle curmenubar;
|
||||||
|
|
||||||
|
|
@ -799,6 +802,19 @@ PyMac_RestoreMenuBar()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PyMac_RaiseConsoleWindow()
|
||||||
|
{
|
||||||
|
/* Note: this is a hack. SIOUXTextWindow is SIOUX's internal structure
|
||||||
|
** and we happen to know that the first entry is the window pointer.
|
||||||
|
*/
|
||||||
|
extern WindowRef *SIOUXTextWindow;
|
||||||
|
|
||||||
|
if ( SIOUXTextWindow == NULL || *SIOUXTextWindow == NULL )
|
||||||
|
return;
|
||||||
|
if ( FrontWindow() != *SIOUXTextWindow )
|
||||||
|
BringToFront(*SIOUXTextWindow);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Our replacement about box
|
** Our replacement about box
|
||||||
|
|
|
||||||
|
|
@ -567,7 +567,16 @@ PyMac_OutputNotSeen()
|
||||||
PyMac_InitMenuBar();
|
PyMac_InitMenuBar();
|
||||||
console_output_state = STATE_LASTWRITE;
|
console_output_state = STATE_LASTWRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Override abort() - The default one is not what we want.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
abort()
|
||||||
|
{
|
||||||
|
console_output_state = STATE_LASTWRITE;
|
||||||
|
PyMac_Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Terminate application
|
** Terminate application
|
||||||
|
|
@ -605,6 +614,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_RaiseConsoleWindow();
|
||||||
PyMac_RestoreMenuBar();
|
PyMac_RestoreMenuBar();
|
||||||
#ifdef USE_MSL
|
#ifdef USE_MSL
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ GUSISIOUXSocket::Initialize()
|
||||||
GUSISetHook(GUSI_EventHook+diskEvt, (GUSIHook)SIOUXHandleOneEvent);
|
GUSISetHook(GUSI_EventHook+diskEvt, (GUSIHook)SIOUXHandleOneEvent);
|
||||||
GUSISetHook(GUSI_EventHook+activateEvt, (GUSIHook)SIOUXHandleOneEvent);
|
GUSISetHook(GUSI_EventHook+activateEvt, (GUSIHook)SIOUXHandleOneEvent);
|
||||||
GUSISetHook(GUSI_EventHook+osEvt, (GUSIHook)SIOUXHandleOneEvent);
|
GUSISetHook(GUSI_EventHook+osEvt, (GUSIHook)SIOUXHandleOneEvent);
|
||||||
|
PyMac_InitMenuBar();
|
||||||
}
|
}
|
||||||
GUSISIOUXSocket::~GUSISIOUXSocket()
|
GUSISIOUXSocket::~GUSISIOUXSocket()
|
||||||
{
|
{
|
||||||
|
|
@ -113,6 +114,7 @@ ssize_t GUSISIOUXSocket::read(const GUSIScatterer & buffer)
|
||||||
if ( !initialized ) Initialize();
|
if ( !initialized ) Initialize();
|
||||||
GUSIStdioFlush();
|
GUSIStdioFlush();
|
||||||
PyMac_OutputSeen();
|
PyMac_OutputSeen();
|
||||||
|
PyMac_RaiseConsoleWindow();
|
||||||
return buffer.SetLength(
|
return buffer.SetLength(
|
||||||
ReadCharsFromConsole((char *) buffer.Buffer(), (int)buffer.Length()));
|
ReadCharsFromConsole((char *) buffer.Buffer(), (int)buffer.Length()));
|
||||||
GUSIContext::Yield(kGUSIPoll);
|
GUSIContext::Yield(kGUSIPoll);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue