From e3baff1c85af02b058ba409ea86976e6c7a45fed Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 21 Mar 2002 10:02:10 +0000 Subject: [PATCH] Minor fix for wxX11 compilation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/x11/glcanvas.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/x11/glcanvas.cpp b/src/x11/glcanvas.cpp index 776eb9746c..aadb88a6c0 100644 --- a/src/x11/glcanvas.cpp +++ b/src/x11/glcanvas.cpp @@ -133,21 +133,13 @@ void wxGLContext::SetColour(const char *colour) the_colour->Green(), the_colour->Blue()); } else { - GLint pix = (GLint)the_colour->m_pixel; - if(pix == -1) { - XColor exact_def; - exact_def.red = (unsigned short)the_colour->Red() << 8; - exact_def.green = (unsigned short)the_colour->Green() << 8; - exact_def.blue = (unsigned short)the_colour->Blue() << 8; - exact_def.flags = DoRed | DoGreen | DoBlue; - if(!XAllocColor((Display*) m_window->GetXDisplay(), - (Colormap) wxTheApp->GetMainColormap(m_window->GetXDisplay()), - &exact_def)) { - wxDebugMsg("wxGLCanvas: cannot allocate color\n"); - return; - } - pix = the_colour->m_pixel = exact_def.pixel; - } + the_colour->CalcPixel(wxTheApp->GetMainColormap(m_window->GetXDisplay())); + GLint pix = (GLint)the_colour->GetPixel(); + if(pix == -1) + { + wxLogError("wxGLCanvas: cannot allocate color\n"); + return; + } glIndexi(pix); } } -- 2.45.2