From f37c35d717a6a092b91eb5ae07342a9c62c78477 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Mar 2006 04:35:22 +0000 Subject: [PATCH] initialize base class using its ctor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38133 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/display.cpp | 18 ++++++++++++++---- src/mac/classic/display.cpp | 10 ++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) 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); -- 2.47.2