X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bd3b171d3f45b0d30d6c1f7586dad5721b145650..7fa4dc1cfcc55b0fe425a3ebe5e992ff8255481b:/src/os2/utils.cpp?ds=sidebyside diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index 68b0e3e6af..22e8837796 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -19,7 +19,6 @@ #endif //WX_PRECOMP #include "wx/os2/private.h" -#include "wx/timer.h" #include "wx/intl.h" #include "wx/apptrait.h" @@ -84,13 +83,13 @@ bool wxGetHostName( if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL) { - ULONG n = ::PrfQueryProfileString( HINI_PROFILE - ,(PSZ)WX_SECTION - ,(PSZ)eHOSTNAME - ,(PSZ)zDefaultHost - ,(void*)zBuf - ,(ULONG)nMaxSize - 1 - ); + ::PrfQueryProfileString( HINI_PROFILE + ,(PSZ)WX_SECTION + ,(PSZ)eHOSTNAME + ,(PSZ)zDefaultHost + ,(void*)zBuf + ,(ULONG)nMaxSize - 1 + ); } else wxStrncpy(zBuf, zSysname, nMaxSize - 1); @@ -147,7 +146,6 @@ bool wxShell( { wxChar* zShell = _T("CMD.EXE"); wxString sInputs; - wxChar zTmp[255]; STARTDATA SData = {0}; PSZ PgmTitle = "Command Shell"; APIRET rc; @@ -305,7 +303,7 @@ void wxError( , const wxString& rTitle ) { - wxBuffer = new wxChar[256]; + wxChar *wxBuffer = new wxChar[256]; wxSprintf(wxBuffer, "%s\nContinue?", WXSTRINGCAST rMsg); if (::WinMessageBox( HWND_DESKTOP ,NULL @@ -343,15 +341,23 @@ void wxBell() { DosBeep(1000,1000); // 1kHz during 1 sec. } -#if 0 -int wxGUIAppTraits::GetOSVersion( - int* pMajorVsn -, int* pMinorVsn -) + + +void wxAppTraits::InitializeGui(unsigned long &ulHab) +{ +} + +void wxAppTraits::TerminateGui(unsigned long ulHab) +{ +} + +wxToolkitInfo & wxConsoleAppTraits::GetToolkitInfo() { + static wxToolkitInfo vInfo; ULONG ulSysInfo[QSV_MAX] = {0}; APIRET ulrc; + vInfo.name = _T("wxBase"); ulrc = ::DosQuerySysInfo( 1L ,QSV_MAX ,(PVOID)ulSysInfo @@ -359,14 +365,13 @@ int wxGUIAppTraits::GetOSVersion( ); if (ulrc == 0L) { - *pMajorVsn = ulSysInfo[QSV_VERSION_MAJOR]; - *pMajorVsn = *pMajorVsn/10; - *pMinorVsn = ulSysInfo[QSV_VERSION_MINOR]; - return wxWINDOWS_OS2; + vInfo.versionMajor = ulSysInfo[QSV_VERSION_MAJOR] / 10; + vInfo.versionMinor = ulSysInfo[QSV_VERSION_MINOR]; } - return wxWINDOWS; // error if we get here, return generic value + vInfo.os = wxOS2_PM; + return vInfo; } -#endif + // --------------------------------------------------------------------------- const wxChar* wxGetHomeDir( wxString* pStr @@ -375,18 +380,24 @@ const wxChar* wxGetHomeDir( wxString& rStrDir = *pStr; // OS/2 has no idea about home, - // so use the working directory instead? + // so use the working directory instead. + // However, we might have a valid HOME directory, + // as is used on many machines that have unix utilities + // on them, so we should use that, if available. // 256 was taken from os2def.h #ifndef MAX_PATH # define MAX_PATH 256 #endif - char zDirName[256]; - ULONG ulDirLen; + const wxChar *szHome = wxGetenv("HOME"); + if ( szHome == NULL ) { + // we're homeless, use current directory. + rStrDir = wxT("."); + } + else + rStrDir = szHome; - ::DosQueryCurrentDir(0, zDirName, &ulDirLen); - rStrDir = zDirName; return rStrDir.c_str(); } @@ -398,7 +409,7 @@ wxChar* wxGetUserHome ( wxChar* zHome; wxString sUser1(rUser); - wxBuffer = new wxChar[256]; + char *wxBuffer = new wxChar[256]; #ifndef __EMX__ if (sUser1 != _T("")) { @@ -501,3 +512,12 @@ wxString WXDLLEXPORT wxPMErrorToStr( } return(sError); } // end of wxPMErrorToStr + +// replacement for implementation in unix/utilsunx.cpp, +// to be used by all X11 based ports. +struct wxEndProcessData; + +void wxHandleProcessTermination(wxEndProcessData *proc_data) +{ + // For now, just do nothing. To be filled in as needed. +}