X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..b28aeea5cad996158ccc8c63d19aae3786f7b8b2:/src/gtk1/glcanvas.cpp diff --git a/src/gtk1/glcanvas.cpp b/src/gtk1/glcanvas.cpp index f9599d1aa4..301240283e 100644 --- a/src/gtk1/glcanvas.cpp +++ b/src/gtk1/glcanvas.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: gtk/glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK +// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK // Author: Robert Roebling // Modified by: // Created: 17/08/98 @@ -130,15 +130,12 @@ void wxGLContext::SetCurrent() 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); } } @@ -163,10 +160,14 @@ wxPalette wxGLContext::CreateDefaultPalette() static gint gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) { - wxGLContext *share= win->m_sharedContext; - if (share==NULL && win->m_sharedContextOf) share=win->m_sharedContextOf->GetContext(); + if ( !win->m_glContext ) + { + wxGLContext *share = win->m_sharedContext; + if ( !share && win->m_sharedContextOf ) + share = win->m_sharedContextOf->GetContext(); - win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, share ); + win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, share ); + } return FALSE; } @@ -319,7 +320,7 @@ bool wxGLCanvas::Create( wxWindow *parent, wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") ); GdkVisual *visual = gdkx_visual_get( vi->visualid ); - GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE ); + GdkColormap *colormap = gdk_colormap_new( visual, TRUE ); gtk_widget_push_colormap( colormap ); gtk_widget_push_visual( visual ); @@ -354,12 +355,6 @@ bool wxGLCanvas::Create( wxWindow *parent, gtk_widget_pop_visual(); gtk_widget_pop_colormap(); - if (GTK_WIDGET_REALIZED(m_wxwindow)) - gtk_glwindow_realized_callback( m_wxwindow, this ); - - if (GTK_WIDGET_MAPPED(m_wxwindow)) - gtk_glwindow_map_callback( m_wxwindow, this ); - return TRUE; } @@ -368,7 +363,7 @@ wxGLCanvas::~wxGLCanvas() XVisualInfo *vi = (XVisualInfo *) m_vi; if (vi && m_canFreeVi) XFree( vi ); - if (m_glContext) delete m_glContext; + delete m_glContext; } void* wxGLCanvas::ChooseGLVisual(int *attribList)