diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-11-05 16:04:53 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-11-05 16:04:53 +0000 |
| commit | 80b1529ef4d69d9e34a48a419a018d7f4d64054b (patch) | |
| tree | 7c743dc2f7f17654f1535314f6b0e6c5eadfc21b /src/Fl_Double_Window.cxx | |
| parent | 60399e3945dcfe9a2bb9f00f794d9e8634dd6bd9 (diff) | |
Multiple patches from Bill:
- Double-buffered window fixes.
- Tabs fixes.
- X/WIN32 fixes.
- Fl_Input fixes.
- Support for vsnprintf and friends.
- Support for printf-style arguments in utility functions.
git-svn-id: file:///fltk/svn/fltk/trunk@52 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Double_Window.cxx')
| -rw-r--r-- | src/Fl_Double_Window.cxx | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index f9d3ce9f4..38e5a71e7 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Double_Window.cxx,v 1.8 1998/10/21 14:20:02 mike Exp $" +// "$Id: Fl_Double_Window.cxx,v 1.9 1998/11/05 16:04:45 mike Exp $" // // Double-buffered window code for the Fast Light Tool Kit (FLTK). // @@ -56,9 +56,6 @@ static int can_xdbe() { } return use_xdbe; } -#define DAMAGE_TEST() (damage() && (use_xdbe || damage() != FL_DAMAGE_EXPOSE)) -#else -#define DAMAGE_TEST() (damage() & ~FL_DAMAGE_EXPOSE) #endif void Fl_Double_Window::show() { @@ -99,57 +96,66 @@ extern void fl_restore_clip(); #endif -// Fl_Overlay_Window relies on flush() copying the back buffer to the -// front even if damage() == 0, thus erasing the overlay inside the region: +// Fl_Overlay_Window relies on flush(1) copying the back buffer to the +// front everywhere, even if damage() == 0, thus erasing the overlay, +// and leaving the clip region set to the entire window. -void Fl_Double_Window::flush() { +void Fl_Double_Window::flush() {flush(0);} + +void Fl_Double_Window::flush(int eraseoverlay) { make_current(); // make sure fl_gc is non-zero Fl_X *i = Fl_X::i(this); if (!i->other_xid) { #if USE_XDBE if (can_xdbe()) i->other_xid = - XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeCopied); + XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeUndefined); else #endif i->other_xid = fl_create_offscreen(w(), h()); clear_damage(FL_DAMAGE_ALL); } +#if USE_XDBE + if (use_xdbe) { + // if this is true, copy rather than swap so back buffer is preserved: + int copy = (i->region || eraseoverlay); + if (i->backbuffer_bad) { // make sure we do a complete redraw... + if (i->region) {XDestroyRegion(i->region); i->region = 0;} + clear_damage(FL_DAMAGE_ALL); + } + if (damage()) { + fl_clip_region(i->region); i->region = 0; + fl_window = i->other_xid; + draw(); + fl_window = i->xid; + } + if (!copy) { + XdbeSwapInfo s; + s.swap_window = fl_xid(this); + s.swap_action = XdbeUndefined; + XdbeSwapBuffers(fl_display, &s, 1); + i->backbuffer_bad = 1; + return; + } + // otherwise just use normal copy from back to front: + i->backbuffer_bad = 0; // which won't destroy the back buffer... + } else +#endif + if (damage() & ~FL_DAMAGE_EXPOSE) { + fl_clip_region(i->region); i->region = 0; #ifdef WIN32 - fl_clip_region(i->region); i->region = 0; - if (DAMAGE_TEST()) { HDC _sgc = fl_gc; fl_gc = fl_makeDC(i->other_xid); fl_restore_clip(); // duplicate region into new gc draw(); DeleteDC(fl_gc); fl_gc = _sgc; - } #else // X: -#if USE_XDBE - int clipped = i->region != 0; -#endif - fl_clip_region(i->region); i->region = 0; - if (DAMAGE_TEST()) { fl_window = i->other_xid; draw(); fl_window = i->xid; - } -#if USE_XDBE - // It appears that swapbuffers ignores the clip region (it has to - // as the gc is not passed as an argument to it). This causes it - // to erase parts of the overlay that won't be redrawn, and (at least - // on XFree86) it is slower. So I don't use it unless the entire - // window is being redrawn. Sigh. - if (use_xdbe && !clipped) { - XdbeSwapInfo s; - s.swap_window = fl_xid(this); - s.swap_action = XdbeCopied; - XdbeSwapBuffers(fl_display, &s, 1); - // fl_clip_region(0); older fix for clipping problem but overlay blinked - return; - } -#endif #endif + } + if (eraseoverlay) fl_clip_region(0); // on Irix (at least) it is faster to reduce the area copied to // the current clip region: int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); @@ -186,5 +192,5 @@ Fl_Double_Window::~Fl_Double_Window() { } // -// End of "$Id: Fl_Double_Window.cxx,v 1.8 1998/10/21 14:20:02 mike Exp $". +// End of "$Id: Fl_Double_Window.cxx,v 1.9 1998/11/05 16:04:45 mike Exp $". // |
