diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H index 402325962..6eac03e47 100644 --- a/FL/Fl_Gl_Window.H +++ b/FL/Fl_Gl_Window.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.H,v 1.3 1998/10/21 14:19:10 mike Exp $" +// "$Id: Fl_Gl_Window.H,v 1.4 1998/11/08 16:37:18 mike Exp $" // // OpenGL header file for the Fast Light Tool Kit (FLTK). // @@ -27,6 +27,9 @@ #include "Fl_Window.H" +// type() value for OpenGL window... +#define FL_GL_WINDOW (FL_WINDOW + 1) + class Fl_Gl_Choice; // structure to hold result of glXChooseVisual class Fl_Gl_Window : public Fl_Window { @@ -84,5 +87,5 @@ public: #endif // -// End of "$Id: Fl_Gl_Window.H,v 1.3 1998/10/21 14:19:10 mike Exp $". +// End of "$Id: Fl_Gl_Window.H,v 1.4 1998/11/08 16:37:18 mike Exp $". // diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 1f596ebee..10c455d63 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.cxx,v 1.8 1998/11/08 15:55:22 mike Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.9 1998/11/08 16:37:19 mike Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -150,6 +150,7 @@ void Fl_Gl_Window::make_current() { # if USE_COLORMAP if (fl_gl_palette) { + fl_GetDC(fl_xid(this)); SelectPalette(fl_gc, fl_gl_palette, FALSE); RealizePalette(fl_gc); } @@ -314,6 +315,7 @@ Fl_Gl_Window::~Fl_Gl_Window() { void Fl_Gl_Window::init() { end(); // we probably don't want any children box(FL_NO_BOX); + type(FL_GL_WINDOW); mode_ = FL_RGB | FL_DEPTH | FL_DOUBLE; alist = 0; context = 0; @@ -327,5 +329,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.8 1998/11/08 15:55:22 mike Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.9 1998/11/08 16:37:19 mike Exp $". // diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 99e526228..243401c65 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_win32.cxx,v 1.14 1998/11/08 14:39:09 mike Exp $" +// "$Id: Fl_win32.cxx,v 1.15 1998/11/08 16:37:20 mike Exp $" // // WIN32-specific code for the Fast Light Tool Kit (FLTK). // @@ -227,7 +227,7 @@ static int ms2fltk(int vk, int extended) { } #if USE_COLORMAP -extern HPALETTE fl_select_palette(); // in fl_color_win32.C +extern HPALETTE fl_select_palette(int gl); // in fl_color_win32.C #endif static Fl_Window* resize_bug_fix; @@ -388,17 +388,20 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar #if USE_COLORMAP case WM_QUERYNEWPALETTE : fl_GetDC(hWnd); - if (fl_select_palette()) InvalidateRect(hWnd, NULL, FALSE); + if (fl_select_palette(window->type() == FL_GL_WINDOW)) + InvalidateRect(hWnd, NULL, FALSE); break; case WM_PALETTECHANGED: fl_GetDC(hWnd); - if ((HWND)wParam != hWnd && fl_select_palette()) UpdateColors(fl_gc); + if ((HWND)wParam != hWnd && + fl_select_palette(window->type() == FL_GL_WINDOW)) + UpdateColors(fl_gc); break; case WM_CREATE : fl_GetDC(hWnd); - fl_select_palette(); + fl_select_palette(window->type() == FL_GL_WINDOW); break; #endif @@ -813,5 +816,5 @@ void Fl_Window::flush() { } // -// End of "$Id: Fl_win32.cxx,v 1.14 1998/11/08 14:39:09 mike Exp $". +// End of "$Id: Fl_win32.cxx,v 1.15 1998/11/08 16:37:20 mike Exp $". // diff --git a/src/fl_color_win32.cxx b/src/fl_color_win32.cxx index a55f17850..51a78f42e 100644 --- a/src/fl_color_win32.cxx +++ b/src/fl_color_win32.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_color_win32.cxx,v 1.4 1998/11/08 15:55:23 mike Exp $" +// "$Id: fl_color_win32.cxx,v 1.5 1998/11/08 16:37:21 mike Exp $" // // WIN32 color functions for the Fast Light Tool Kit (FLTK). // @@ -187,10 +187,12 @@ void Fl::get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue) { // Thanks to Michael Sweet @ Easy Software Products for this HPALETTE -fl_select_palette(void) +fl_select_palette(int gl) { static char beenhere; if (!beenhere) { + int i; + beenhere = 1; //if (GetDeviceCaps(fl_gc, BITSPIXEL) > 8) return NULL; @@ -208,7 +210,7 @@ fl_select_palette(void) // Build 256 colors from the standard FLTK colormap... - for (int i = 0; i < nColors; i ++) { + for (i = 0; i < nColors; i ++) { pPal->palPalEntry[i].peRed = (fl_cmap[i] >> 24) & 255; pPal->palPalEntry[i].peGreen = (fl_cmap[i] >> 16) & 255; pPal->palPalEntry[i].peBlue = (fl_cmap[i] >> 8) & 255; @@ -223,7 +225,7 @@ fl_select_palette(void) // and doing OpenGL on anything less than 8-bits is just asking for // disappointment! - for (int i = 0; i < nColors; i ++) { + for (i = 0; i < nColors; i ++) { pPal->palPalEntry[i].peRed = 255 * ((i >> 5) & 7) / 7; pPal->palPalEntry[i].peGreen = 255 * ((i >> 2) & 7) / 7; pPal->palPalEntry[i].peBlue = 255 * (i & 3) / 3; @@ -233,9 +235,17 @@ fl_select_palette(void) fl_gl_palette = CreatePalette(pPal); #endif // HAVE_GL } - if (fl_palette) { - SelectPalette(fl_gc, fl_palette, FALSE); - RealizePalette(fl_gc); + if (gl) { + if (fl_gl_palette) { + SelectPalette(fl_gc, fl_gl_palette, FALSE); + RealizePalette(fl_gc); + } + } + else { + if (fl_palette) { + SelectPalette(fl_gc, fl_palette, FALSE); + RealizePalette(fl_gc); + } } return fl_palette; } @@ -243,5 +253,5 @@ fl_select_palette(void) #endif // -// End of "$Id: fl_color_win32.cxx,v 1.4 1998/11/08 15:55:23 mike Exp $". +// End of "$Id: fl_color_win32.cxx,v 1.5 1998/11/08 16:37:21 mike Exp $". //