From 3b35024d52673fcde15432872e25c9af36e23cd3 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 9 Mar 2012 21:48:37 -0800 Subject: [PATCH] Fl_Double_Window: Try to be more efficient when using XDBE. --- .gitignore | 8 ++++++++ src/Fl_Double_Window.cxx | 28 +++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ba247d --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*~ +*.bak +*.swp +*.[ao] +TAGS +.nfs* +make.conf +.deps diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 2f0a31e..8d2a248 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -338,7 +338,7 @@ void Fl_Double_Window::flush(int eraseoverlay) { if (!myi->other_xid) { #if USE_XDBE if (can_xdbe()) { - myi->other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeCopied); + myi->other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeUndefined); myi->backbuffer_bad = 1; } else #endif @@ -361,8 +361,11 @@ void Fl_Double_Window::flush(int eraseoverlay) { if (myi->region) {XDestroyRegion(myi->region); myi->region = 0;} clear_damage(FL_DAMAGE_ALL); myi->backbuffer_bad = 0; + } + + XdbeBeginIdiom( fl_display ); // Redraw as needed... if (damage()) { fl_clip_region(myi->region); myi->region = 0; @@ -372,10 +375,14 @@ void Fl_Double_Window::flush(int eraseoverlay) { } // Copy contents of back buffer to window... + XdbeSwapInfo s; - s.swap_window = fl_xid(this); - s.swap_action = XdbeCopied; + s.swap_window = myi->xid; + s.swap_action = XdbeUndefined; XdbeSwapBuffers(fl_display, &s, 1); + + XdbeEndIdiom( fl_display ); + return; } else #endif @@ -411,8 +418,13 @@ void Fl_Double_Window::flush(int eraseoverlay) { 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); - if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y); +#if USE_XDBE + if ( !use_xdbe ) +#endif + { + int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H); + if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y); + } } void Fl_Double_Window::resize(int X,int Y,int W,int H) { @@ -422,10 +434,8 @@ void Fl_Double_Window::resize(int X,int Y,int W,int H) { #if USE_XDBE if (use_xdbe) { Fl_X* myi = Fl_X::i(this); - if (myi && myi->other_xid && (ow < w() || oh < h())) { - // STR #2152: Deallocate the back buffer to force creation of a new one. - XdbeDeallocateBackBufferName(fl_display,myi->other_xid); - myi->other_xid = 0; + if (myi && myi->other_xid && ( ow != w() || oh != h() ) ) { + myi->backbuffer_bad = 1; } return; }