extracted GUI-specific part of utilsunx.cpp to a new unix/apptraits.cpp file and don't include utilsunx.cpp in both base and GUI libraries now so that we can get rid of BASE_AND_GUI_UNIX_SRC in files.bkl entirely
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,8 +66,6 @@
|
||||
|
||||
#endif // HAS_PIPE_INPUT_STREAM
|
||||
|
||||
#if wxUSE_BASE
|
||||
|
||||
#if defined(__MWERKS__) && defined(__MACH__)
|
||||
#ifndef WXWIN_OS_DESCRIPTION
|
||||
#define WXWIN_OS_DESCRIPTION "MacOS X"
|
||||
@@ -1310,6 +1308,29 @@ int wxAppTraits::AddProcessCallback(wxEndProcessData *data, int fd)
|
||||
return fd; // unused, but return something unique for the tag
|
||||
}
|
||||
|
||||
bool wxAppTraits::CheckForRedirectedIO(wxExecuteData& execData)
|
||||
{
|
||||
#if HAS_PIPE_INPUT_STREAM
|
||||
bool hasIO = false;
|
||||
|
||||
if ( execData.bufOut )
|
||||
{
|
||||
execData.bufOut->Update();
|
||||
hasIO = true;
|
||||
}
|
||||
|
||||
if ( execData.bufErr )
|
||||
{
|
||||
execData.bufErr->Update();
|
||||
hasIO = true;
|
||||
}
|
||||
|
||||
return hasIO;
|
||||
#else // !HAS_PIPE_INPUT_STREAM
|
||||
return false;
|
||||
#endif // HAS_PIPE_INPUT_STREAM/!HAS_PIPE_INPUT_STREAM
|
||||
}
|
||||
|
||||
int wxAppTraits::WaitForChild(wxExecuteData& execData)
|
||||
{
|
||||
if ( execData.flags & wxEXEC_SYNC )
|
||||
@@ -1409,78 +1430,3 @@ void wxHandleProcessTermination(wxEndProcessData *proc_data)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // wxUSE_BASE
|
||||
|
||||
#if wxUSE_GUI
|
||||
|
||||
int wxGUIAppTraits::WaitForChild(wxExecuteData& execData)
|
||||
{
|
||||
const int flags = execData.flags;
|
||||
if ( !(flags & wxEXEC_SYNC) || (flags & wxEXEC_NOEVENTS) )
|
||||
{
|
||||
// async or blocking sync cases are already handled by the base class
|
||||
// just fine, no need to duplicate its code here
|
||||
return wxAppTraits::WaitForChild(execData);
|
||||
}
|
||||
|
||||
// here we're dealing with the case of synchronous execution when we want
|
||||
// to process the GUI events while waiting for the child termination
|
||||
|
||||
wxEndProcessData endProcData;
|
||||
|
||||
// we may have process for capturing the program output, but it's
|
||||
// not used in wxEndProcessData in the case of sync execution
|
||||
endProcData.process = NULL;
|
||||
|
||||
// sync execution: indicate it by negating the pid
|
||||
endProcData.pid = -execData.pid;
|
||||
|
||||
endProcData.tag = AddProcessCallback
|
||||
(
|
||||
&endProcData,
|
||||
execData.pipeEndProcDetect.Detach(wxPipe::Read)
|
||||
);
|
||||
|
||||
execData.pipeEndProcDetect.Close();
|
||||
|
||||
|
||||
// prepare to wait for the child termination: show to the user that we're
|
||||
// busy and refuse all input unless explicitly told otherwise
|
||||
wxBusyCursor bc;
|
||||
wxWindowDisabler wd(!(flags & wxEXEC_NODISABLE));
|
||||
|
||||
// endProcData.pid will be set to 0 from wxHandleProcessTermination() when
|
||||
// the process terminates
|
||||
while ( endProcData.pid != 0 )
|
||||
{
|
||||
#if HAS_PIPE_INPUT_STREAM
|
||||
bool idle = true;
|
||||
|
||||
if ( execData.bufOut )
|
||||
{
|
||||
execData.bufOut->Update();
|
||||
idle = false;
|
||||
}
|
||||
|
||||
if ( execData.bufErr )
|
||||
{
|
||||
execData.bufErr->Update();
|
||||
idle = false;
|
||||
}
|
||||
|
||||
// don't consume 100% of the CPU while we're sitting in this
|
||||
// loop
|
||||
if ( idle )
|
||||
#endif // HAS_PIPE_INPUT_STREAM
|
||||
wxMilliSleep(1);
|
||||
|
||||
// give the toolkit a chance to call wxHandleProcessTermination() here
|
||||
// and also repaint the GUI and handle other accumulated events
|
||||
wxYield();
|
||||
}
|
||||
|
||||
return endProcData.exitcode;
|
||||
}
|
||||
|
||||
#endif //wxUSE_GUI
|
||||
|
||||
|
Reference in New Issue
Block a user