Compilation fixes for non-MSVC 9 compilers after r65555.

Somehow MSVC 9 compiled invalid wxT(__FUNCTION__) expressions but both MinGW
and MSVC 6 (correctly) failed. Don't use this construct at all but instead
call wxLogLastError() with the real function name.

Also refactor the code slightly to avoid having to repeat this fix thrice.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65557 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-09-16 11:05:46 +00:00
parent 685ed4d1f8
commit 473ca5f34a

View File

@@ -140,6 +140,10 @@ protected:
dm.dmDisplayFrequency > 1 ? dm.dmDisplayFrequency : 0);
}
// Call GetMonitorInfo() and fill in the provided struct and return true if
// it succeeded, otherwise return false.
bool GetMonInfo(MONITORINFOEX& monInfo) const;
HMONITOR m_hmon;
private:
@@ -215,18 +219,24 @@ private:
// wxDisplayMSW implementation
// ----------------------------------------------------------------------------
bool wxDisplayMSW::GetMonInfo(MONITORINFOEX& monInfo) const
{
if ( !gs_GetMonitorInfo(m_hmon, &monInfo) )
{
wxLogLastError(wxT("GetMonitorInfo"));
return false;
}
return true;
}
wxRect wxDisplayMSW::GetGeometry() const
{
WinStruct<MONITORINFOEX> monInfo;
if ( !gs_GetMonitorInfo(m_hmon, (LPMONITORINFO)&monInfo) )
{
wxLogLastError(wxT(__FUNCTION__));
return wxRect();
}
wxRect rect;
wxCopyRECTToRect(monInfo.rcMonitor, rect);
if ( GetMonInfo(monInfo) )
wxCopyRECTToRect(monInfo.rcMonitor, rect);
return rect;
}
@@ -235,14 +245,9 @@ wxRect wxDisplayMSW::GetClientArea() const
{
WinStruct<MONITORINFOEX> monInfo;
if ( !gs_GetMonitorInfo(m_hmon, (LPMONITORINFO)&monInfo) )
{
wxLogLastError(wxT(__FUNCTION__));
return wxRect();
}
wxRect rectClient;
wxCopyRECTToRect(monInfo.rcWork, rectClient);
if ( GetMonInfo(monInfo) )
wxCopyRECTToRect(monInfo.rcWork, rectClient);
return rectClient;
}
@@ -251,24 +256,19 @@ wxString wxDisplayMSW::GetName() const
{
WinStruct<MONITORINFOEX> monInfo;
if ( !gs_GetMonitorInfo(m_hmon, (LPMONITORINFO)&monInfo) )
{
wxLogLastError(wxT(__FUNCTION__));
return "";
}
wxString name;
if ( GetMonInfo(monInfo) )
name = monInfo.szDevice;
return monInfo.szDevice;
return name;
}
bool wxDisplayMSW::IsPrimary() const
{
WinStruct<MONITORINFOEX> monInfo;
if ( !gs_GetMonitorInfo(m_hmon, (LPMONITORINFO)&monInfo) )
{
wxLogLastError(wxT(__FUNCTION__));
if ( !GetMonInfo(monInfo) )
return false;
}
return (monInfo.dwFlags & MONITORINFOF_PRIMARY) != 0;
}