X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0b4f47a319cfaa434e00025aa779e407fbacee23..6d3b231a02b761671d042c2f8989048ba49125e8:/src/msw/display.cpp diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 86f353b6d8..5dd3994788 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -3,6 +3,7 @@ // Purpose: MSW Implementation of wxDisplay class // Author: Royce Mitchell III // Modified by: VZ (resolutions enumeration/change support, DirectDraw, ...) +// Ryan Norton (IsPrimary override) // Created: 06/21/02 // RCS-ID: $Id$ // Copyright: (c) wxWidgets team @@ -216,7 +217,7 @@ wxDDEnumExCallback(GUID *pGuid, return true; } -HRESULT WINAPI wxDDEnumModesCallback(LPDDSURFACEDESC lpDDSurfaceDesc, +HRESULT WINAPI wxDDEnumModesCallback(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) { // we need at least the mode size @@ -544,6 +545,30 @@ wxString wxDisplay::GetNameForEnumSettings() const return name; } +// ---------------------------------------------------------------------------- +// determine if this is the primary display +// ---------------------------------------------------------------------------- + +bool wxDisplay::IsPrimary() const +{ + wxDisplayInfo& dpyInfo = (*gs_displays)[m_index]; + + MONITORINFOEX monInfo; + wxZeroMemory(monInfo); + monInfo.cbSize = sizeof(monInfo); + + // NB: Cast from MONITORINFOEX* to MONITORINFO* is done because + // Mingw headers - unlike the ones from Microsoft's Platform SDK - + // don't derive the former from the latter in C++ mode and so + // the pointer's type is not converted implicitly. + if ( !::GetMonitorInfo(dpyInfo.m_hmon, (LPMONITORINFO)&monInfo) ) + { + wxLogLastError(_T("GetMonitorInfo")); + } + + return (monInfo.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY; +} + // ---------------------------------------------------------------------------- // video modes enumeration // ---------------------------------------------------------------------------- @@ -658,7 +683,7 @@ bool wxDisplay::DoChangeModeDirectX(const wxVideoMode& mode) return false; } - + return true; }