]> git.saurik.com Git - wxWidgets.git/commitdiff
Minor fix for wxX11 compilation
authorJulian Smart <julian@anthemion.co.uk>
Thu, 21 Mar 2002 10:02:10 +0000 (10:02 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 21 Mar 2002 10:02:10 +0000 (10:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/x11/glcanvas.cpp

index 776eb9746c8aea01bb2df8af4abb4a54a9419441..aadb88a6c05601957fc7ca58ecde38815a1902a9 100644 (file)
@@ -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);
        }
     }