]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/glcanvas.cpp
fixed compilation error
[wxWidgets.git] / 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);
        }
     }