summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>2000-06-10 18:24:31 +0000
committerBill Spitzak <spitzak@gmail.com>2000-06-10 18:24:31 +0000
commit8e5c8b50d3f480265cdea227186ece0b1c29fc15 (patch)
tree742bca106fe0160260b6b05bee2c7ba83e20fd6e /src
parent7a17c343cc2a83b5d0aa68d3484478c22f58218a (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Gl_Overlay.cxx17
-rw-r--r--src/Fl_Gl_Window.cxx20
-rw-r--r--src/Fl_Slider.cxx6
3 files changed, 24 insertions, 19 deletions
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<<fl_overlay_depth)-1;
// copy all colors except #0 into the overlay palette:
- for (int i = 0; i < 256; i++) {
+ for (int i = 0; i <= n; i++) {
uchar r,g,b; Fl::get_color((Fl_Color)i,r,g,b);
palette[i] = RGB(r,g,b);
}
// always provide black & white in the last 2 pixels:
if (fl_overlay_depth < 8) {
- palette[(1<<fl_overlay_depth)-2] = RGB(0,0,0);
- palette[(1<<fl_overlay_depth)-1] = RGB(255,255,255);
+ palette[n-1] = RGB(0,0,0);
+ palette[n] = RGB(255,255,255);
}
// and use it:
- wglSetLayerPaletteEntries(hdc, 1, 1, 255, palette+1);
+ wglSetLayerPaletteEntries(hdc, 1, 1, n, palette+1);
wglRealizeLayerPalette(hdc, 1, TRUE);
}
valid(0);
@@ -184,8 +185,8 @@ void Fl_Gl_Window::make_overlay_current() {
if (overlay != this) {
#ifdef _WIN32
fl_set_gl_context(this, (GLXContext)overlay);
- if (fl_overlay_depth)
- wglRealizeLayerPalette(Fl_X::i(this)->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 $".
//