X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/564a150b1f7c63a060c1b205a7cd50035031cd4b..59abfcf813ccca7366bfb6d830e1251be5514ac7:/src/mac/carbon/glcanvas.cpp diff --git a/src/mac/carbon/glcanvas.cpp b/src/mac/carbon/glcanvas.cpp index e208531ff4..e64e4c01e3 100644 --- a/src/mac/carbon/glcanvas.cpp +++ b/src/mac/carbon/glcanvas.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Macintosh +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 @@ -9,18 +9,12 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "glcanvas.h" -#endif - #include "wx/wxprec.h" #if defined(__BORLANDC__) #pragma hdrstop #endif -#include "wx/setup.h" - #if wxUSE_GLCANVAS #ifndef WX_PRECOMP @@ -49,7 +43,7 @@ wxGLContext::wxGLContext( { m_window = win; - m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetRootWindow())); + m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetTopLevelWindowRef())); m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL); wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") ); @@ -219,6 +213,8 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attribList, const wxPalette& palette) { + m_macCanvasIsShown = false ; + m_glContext = 0 ; wxWindow::Create( parent, id, pos, size, style, name ); AGLPixelFormat fmt = ChoosePixelFormat(attribList); @@ -262,7 +258,7 @@ void wxGLCanvas::SetViewport() int width, height; GetClientSize(& width, & height); Rect bounds ; - GetWindowPortBounds( MAC_WXHWND(MacGetRootWindow()) , &bounds ) ; + GetWindowPortBounds( MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds ) ; GLint parms[4] ; parms[0] = x ; parms[1] = bounds.bottom - bounds.top - ( y + height ) ; @@ -320,7 +316,7 @@ bool wxGLCanvas::Show(bool show) { if ( !wxWindow::Show( show ) ) return FALSE ; - +/* if ( !show ) { if ( m_macCanvasIsShown ) @@ -331,18 +327,19 @@ bool wxGLCanvas::Show(bool show) } else { - if ( MacIsReallyShown() && !m_macCanvasIsShown ) + if ( m_peer->IsVisible()&& !m_macCanvasIsShown ) { m_macCanvasIsShown = true ; SetViewport() ; } } +*/ return TRUE ; } -void wxGLCanvas::MacSuperShown( bool show ) +void wxGLCanvas::MacVisibilityChanged() { - if ( !show ) + if ( !MacIsReallyShown() ) { if ( m_macCanvasIsShown ) { @@ -352,14 +349,13 @@ void wxGLCanvas::MacSuperShown( bool show ) } else { - if ( MacIsReallyShown() && !m_macCanvasIsShown ) + if ( !m_macCanvasIsShown ) { m_macCanvasIsShown = true ; SetViewport() ; } } - - wxWindow::MacSuperShown( show ) ; + wxWindowMac::MacVisibilityChanged() ; } //---------------------------------------------------------------------------