From 8e5c8b50d3f480265cdea227186ece0b1c29fc15 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Sat, 10 Jun 2000 18:24:31 +0000 Subject: More fixes to the OpenGL overlay code on win32. This now seems to work quite reliably on several different pieces of hardware. Apparently doing SetLayerPaletteEntries with a palette larger than the overlay size caused the drivers to screw up in unpredictable ways. Also SwapBuffers swapped both the overlay and main window, which is not what fltk's interface wanted, this was easy to fix however. Patch for full scrollbars so that clicking on them does not move anything. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1188 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Gl_Overlay.cxx | 17 +++++++++-------- src/Fl_Gl_Window.cxx | 20 ++++++++++++-------- src/Fl_Slider.cxx | 6 +++--- 3 files changed, 24 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/Fl_Gl_Overlay.cxx b/src/Fl_Gl_Overlay.cxx index 7e9c16880..a1d6ccf58 100644 --- a/src/Fl_Gl_Overlay.cxx +++ b/src/Fl_Gl_Overlay.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.9 2000/06/05 21:20:51 mike Exp $" +// "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.10 2000/06/10 18:24:30 bill Exp $" // // OpenGL overlay code for the Fast Light Tool Kit (FLTK). // @@ -136,18 +136,19 @@ void Fl_Gl_Window::make_overlay() { fl_overlay_depth = pfd.cColorBits; // used by gl_color() if (fl_overlay_depth > 8) fl_overlay_depth = 8; COLORREF palette[256]; + int n = (1<private_dc, 1, TRUE); +// if (fl_overlay_depth) +// wglRealizeLayerPalette(Fl_X::i(this)->private_dc, 1, TRUE); #else ((Fl_Gl_Window*)overlay)->make_current(); #endif @@ -207,5 +208,5 @@ void Fl_Gl_Window::hide_overlay() { #endif // -// End of "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.9 2000/06/05 21:20:51 mike Exp $". +// End of "$Id: Fl_Gl_Overlay.cxx,v 1.5.2.10 2000/06/10 18:24:30 bill Exp $". // diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index 0002038a7..86b9c36a7 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.cxx,v 1.12.2.13 2000/06/05 21:20:51 mike Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.12.2.14 2000/06/10 18:24:30 bill Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -146,7 +146,12 @@ void Fl_Gl_Window::ortho() { void Fl_Gl_Window::swap_buffers() { #ifdef _WIN32 +#if HAVE_GL_OVERLAY + // Do not swap the overlay, to match GLX: + wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_MAIN_PLANE); +#else SwapBuffers(Fl_X::i(this)->private_dc); +#endif #else glXSwapBuffers(fl_display, fl_xid(this)); #endif @@ -167,10 +172,9 @@ void Fl_Gl_Window::flush() { #endif #if HAVE_GL_OVERLAY && defined(_WIN32) - if (overlay && overlay != this && - ((damage()&(FL_DAMAGE_OVERLAY|FL_DAMAGE_EXPOSE)) - || !save_valid)) { - // Draw into hardware overlay planes + // Draw into hardware overlay planes: + if (overlay && overlay != this + && (damage()&(FL_DAMAGE_OVERLAY|FL_DAMAGE_EXPOSE) || !save_valid)) { fl_set_gl_context(this, (GLXContext)overlay); if (fl_overlay_depth) wglRealizeLayerPalette(Fl_X::i(this)->private_dc, 1, TRUE); @@ -180,8 +184,8 @@ void Fl_Gl_Window::flush() { draw_overlay(); fl_overlay = 0; valid(save_valid); - if (damage() == FL_DAMAGE_OVERLAY) { - wglSwapLayerBuffers(Fl_X::i(this)->private_dc,WGL_SWAP_OVERLAY1); + wglSwapLayerBuffers(Fl_X::i(this)->private_dc, WGL_SWAP_OVERLAY1); + if (damage() == FL_DAMAGE_OVERLAY) { // main layer is undamaged if (fixcursor) SetCursor(Fl_X::i(this)->cursor); return; } @@ -323,5 +327,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.13 2000/06/05 21:20:51 mike Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.14 2000/06/10 18:24:30 bill Exp $". // diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx index c4318c903..8489960aa 100644 --- a/src/Fl_Slider.cxx +++ b/src/Fl_Slider.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Slider.cxx,v 1.8.2.7 2000/06/05 21:20:57 mike Exp $" +// "$Id: Fl_Slider.cxx,v 1.8.2.8 2000/06/10 18:24:31 bill Exp $" // // Slider widget for the Fast Light Tool Kit (FLTK). // @@ -182,7 +182,7 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) { int W = (horizontal() ? w : h); //int H = (horizontal() ? h : w); int mx = (horizontal() ? Fl::event_x()-x : Fl::event_y()-y); - int S = int(slider_size_*W+.5); + int S = int(slider_size_*W+.5); if (S >= W) return 0; int X; static int offcenter; @@ -251,5 +251,5 @@ int Fl_Slider::handle(int event) { } // -// End of "$Id: Fl_Slider.cxx,v 1.8.2.7 2000/06/05 21:20:57 mike Exp $". +// End of "$Id: Fl_Slider.cxx,v 1.8.2.8 2000/06/10 18:24:31 bill Exp $". // -- cgit v1.2.3