X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/34fdf76231e5e0adc6f1a0543f19f7ab8fcb91d9..1dc1b891f19f70ac0ab2e0d80a5357151202872d:/src/mac/carbon/glcanvas.cpp?ds=sidebyside diff --git a/src/mac/carbon/glcanvas.cpp b/src/mac/carbon/glcanvas.cpp index 44215b6b75..facd34a510 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 @@ -49,7 +49,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") ); @@ -97,15 +97,12 @@ void wxGLContext::Update() void wxGLContext::SetColour(const wxChar *colour) { - float r = 0.0; - float g = 0.0; - float b = 0.0; - wxColour *col = wxTheColourDatabase->FindColour(colour); - if (col) + wxColour col = wxTheColourDatabase->Find(colour); + if (col.Ok()) { - r = (float)(col->Red()/256.0); - g = (float)(col->Green()/256.0); - b = (float)(col->Blue()/256.0); + float r = (float)(col.Red()/256.0); + float g = (float)(col.Green()/256.0); + float b = (float)(col.Blue()/256.0); glColor3f( r, g, b); } } @@ -265,7 +262,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 ) ; @@ -323,7 +320,7 @@ bool wxGLCanvas::Show(bool show) { if ( !wxWindow::Show( show ) ) return FALSE ; - +/* if ( !show ) { if ( m_macCanvasIsShown ) @@ -334,18 +331,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 ) { @@ -355,14 +353,13 @@ void wxGLCanvas::MacSuperShown( bool show ) } else { - if ( MacIsReallyShown() && !m_macCanvasIsShown ) + if ( !m_macCanvasIsShown ) { m_macCanvasIsShown = true ; SetViewport() ; } } - - wxWindow::MacSuperShown( show ) ; + wxWindowMac::MacVisibilityChanged() ; } //---------------------------------------------------------------------------