diff --git a/src/mac/carbon/display.cpp b/src/mac/carbon/display.cpp index 79c727f1f1..6f1a59b223 100644 --- a/src/mac/carbon/display.cpp +++ b/src/mac/carbon/display.cpp @@ -55,7 +55,11 @@ class wxDisplayImplMacOSX : public wxDisplayImpl { public: - wxDisplayImplMacOSX(CGDirectDisplayID id) : m_id(id) { } + wxDisplayImplMacOSX(size_t n, CGDirectDisplayID id) + : wxDisplayImpl(n), + m_id(id) + { + } virtual wxRect GetGeometry() const; virtual wxString GetName() const { return wxString(); } @@ -148,7 +152,7 @@ wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(size_t n) wxASSERT( err == CGDisplayNoErr ); wxASSERT( n < theCount ); - wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(theIDs[n]); + wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(n, theIDs[n]); delete [] theIDs; @@ -251,7 +255,11 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) class wxDisplayImplMac : public wxDisplayImpl { public: - wxDisplayImplMac(GDHandle hndl) : m_hndl(hndl) { } + wxDisplayImplMac(size_t n, GDHandle hndl) + : wxDisplayImpl(n), + m_hndl(hndl) + { + } virtual wxRect GetGeometry() const; virtual wxString GetName() const { return wxString(); } @@ -318,12 +326,14 @@ int wxDisplayFactoryMac::GetFromPoint(const wxPoint &p) wxDisplayImpl *wxDisplayFactoryMac::CreateDisplay(size_t n) { + size_t nOrig = n; + GDHandle hndl = DMGetFirstScreenDevice(true); while(hndl) { if (n == 0) { - return new wxDisplayImplMac(hndl); + return new wxDisplayImplMac(nOrig, hndl); } n--; hndl = DMGetNextScreenDevice(hndl, true); diff --git a/src/mac/classic/display.cpp b/src/mac/classic/display.cpp index 61eb2d44e2..069570e5d1 100644 --- a/src/mac/classic/display.cpp +++ b/src/mac/classic/display.cpp @@ -53,7 +53,11 @@ class wxDisplayImplMac : public wxDisplayImpl { public: - wxDisplayImplMac(GDHandle hndl) : m_hndl(hndl) { } + wxDisplayImplMac(size_t n, GDHandle hndl) + : wxDisplayImpl(n), + m_hndl(hndl) + { + } virtual wxRect GetGeometry() const; virtual wxString GetName() const { return wxString(); } @@ -120,12 +124,14 @@ int wxDisplayFactoryMac::GetFromPoint(const wxPoint &p) wxDisplayImpl *wxDisplayFactoryMac::CreateDisplay(size_t n) { + size_t nOrig = n; + GDHandle hndl = DMGetFirstScreenDevice(true); while(hndl) { if (n == 0) { - return new wxDisplayImplMac(hndl); + return new wxDisplayImplMac(nOrig, hndl); } n--; hndl = DMGetNextScreenDevice(hndl, true);