-// ----------------------------------------------------------------------------
-// wxDisplayFactoryWin32Base
-// ----------------------------------------------------------------------------
-
-int wxDisplayFactoryWin32Base::ms_supportsMultimon = -1;
-
-wxDisplayFactoryWin32Base::wxDisplayFactoryWin32Base()
-{
- if ( ms_supportsMultimon == -1 )
- {
- ms_supportsMultimon = 0;
-
- wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM | wxDL_QUIET);
-
- if ( (wxDL_INIT_FUNC(gs_, MonitorFromPoint, dllDisplay)) == NULL ||
- (wxDL_INIT_FUNC(gs_, MonitorFromWindow, dllDisplay)) == NULL ||
- (wxDL_INIT_FUNC_AW(gs_, GetMonitorInfo, dllDisplay)) == NULL )
- return;
-
- ms_supportsMultimon = 1;
-
- // we can safely let dllDisplay go out of scope, the DLL itself will
- // still remain loaded as all programs link to it statically anyhow
- }
-}
-
-void wxDisplayFactoryWin32Base::Clear()
-{
- WX_CLEAR_ARRAY(m_displays);
-}
-
-wxDisplayFactoryWin32Base::~wxDisplayFactoryWin32Base()
-{
- Clear();
-}
-
-// helper for GetFromPoint() and GetFromWindow()
-int wxDisplayFactoryWin32Base::FindDisplayFromHMONITOR(HMONITOR hmon) const
-{
- if ( hmon )
- {
- const size_t count = m_displays.size();
- for ( size_t n = 0; n < count; n++ )
- {
- if ( hmon == m_displays[n]->m_hmon )
- return n;
- }
- }
-
- return wxNOT_FOUND;
-}
-
-int wxDisplayFactoryWin32Base::GetFromPoint(const wxPoint& pt)
-{
- POINT pt2;
- pt2.x = pt.x;
- pt2.y = pt.y;
-
- return FindDisplayFromHMONITOR(gs_MonitorFromPoint(pt2,
- MONITOR_DEFAULTTONULL));
-}
-
-int wxDisplayFactoryWin32Base::GetFromWindow(const wxWindow *window)
-{
- return FindDisplayFromHMONITOR(gs_MonitorFromWindow(GetHwndOf(window),
- MONITOR_DEFAULTTONULL));
-}
-
-// ============================================================================
-// wxDisplay implementation using Win32 multimon API
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// wxDisplayFactoryMultimon initialization
-// ----------------------------------------------------------------------------
-
-wxDisplayFactoryMultimon::wxDisplayFactoryMultimon()
-{
- if ( !ms_supportsMultimon )
- return;
-
- // look up EnumDisplayMonitors() which we don't need with DirectDraw
- // implementation
- EnumDisplayMonitors_t pfnEnumDisplayMonitors;
- {
- wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM | wxDL_QUIET);
- if ( (wxDL_INIT_FUNC(pfn, EnumDisplayMonitors, dllDisplay)) == NULL )
- return;
- }
-
- // enumerate all displays
- if ( !pfnEnumDisplayMonitors(NULL, NULL, MultimonEnumProc, (LPARAM)this) )
- {
- wxLogLastError(wxT("EnumDisplayMonitors"));
- }
-}
-
-/* static */
-BOOL CALLBACK
-wxDisplayFactoryMultimon::MultimonEnumProc(
- HMONITOR hMonitor, // handle to display monitor
- HDC WXUNUSED(hdcMonitor), // handle to monitor-appropriate device context
- LPRECT lprcMonitor, // pointer to monitor intersection rectangle
- LPARAM dwData // data passed from EnumDisplayMonitors (this)
-)
-{
- wxDisplayFactoryMultimon *const self = (wxDisplayFactoryMultimon *)dwData;
- self->AddDisplay(hMonitor, lprcMonitor);
-
- // continue the enumeration
- return TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// wxDisplayFactoryMultimon helper functions
-// ----------------------------------------------------------------------------
-
-void wxDisplayFactoryMultimon::AddDisplay(HMONITOR hMonitor, LPRECT lprcMonitor)
-{
- wxDisplayInfo *info = new wxDisplayInfo(hMonitor);
-
- // we also store the display geometry
- info->m_rect = wxRect(lprcMonitor->left, lprcMonitor->top,
- lprcMonitor->right - lprcMonitor->left,
- lprcMonitor->bottom - lprcMonitor->top);
-
- // now add this monitor to the array
- m_displays.Add(info);
-}
-
-// ----------------------------------------------------------------------------
-// wxDisplayFactoryMultimon inherited pure virtuals implementation
-// ----------------------------------------------------------------------------
-
-wxDisplayImpl *wxDisplayFactoryMultimon::CreateDisplay(unsigned n)
-{
- wxCHECK_MSG( n < m_displays.size(), NULL, _T("invalid display index") );
-
- return new wxDisplayImplMultimon(n, *(m_displays[n]));
-}
-
-// ----------------------------------------------------------------------------
-// wxDisplayImplMultimon implementation
-// ----------------------------------------------------------------------------
-
-wxArrayVideoModes
-wxDisplayImplMultimon::GetModes(const wxVideoMode& modeMatch) const