diff --git a/src/Fl.cxx b/src/Fl.cxx index 5a26b90..d9002b4 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1701,7 +1701,9 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) { void Fl_Window::flush() { make_current(); //if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this; + /* FIXME: shouldn't this destroy the region? */ fl_clip_region(i->region); i->region = 0; + draw(); } diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 41b8411..9d618b5 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -374,6 +374,9 @@ void Fl_Double_Window::flush(int eraseoverlay) { Fl::cairo_set_drawable( this ); #endif draw(); +#if FLTK_HAVE_CAIRO + cairo_surface_flush( myi->cs ); +#endif fl_window = myi->xid; @@ -391,8 +394,11 @@ void Fl_Double_Window::flush(int eraseoverlay) { return; } else #endif + + fl_clip_region(myi->region); + if (damage() & ~FL_DAMAGE_EXPOSE) { - fl_clip_region(myi->region); myi->region = 0; + #ifdef WIN32 HDC _sgc = fl_gc; fl_gc = fl_makeDC(myi->other_xid); @@ -407,6 +413,7 @@ void Fl_Double_Window::flush(int eraseoverlay) { fl_begin_offscreen( myi->other_xid ); fl_clip_region( 0 ); draw(); + fl_end_offscreen(); } else { draw(); @@ -416,8 +423,20 @@ void Fl_Double_Window::flush(int eraseoverlay) { #if FLTK_HAVE_CAIRO Fl::cairo_set_drawable( this ); #endif + fl_clip_region(myi->region); + draw(); + +#if FLTK_HAVE_CAIRO + cairo_surface_flush( myi->cs ); +#endif + fl_window = myi->xid; + + Fl::cairo_set_drawable( this ); + + fl_clip_region(myi->region); + #endif } if (eraseoverlay) fl_clip_region(0); @@ -430,6 +449,9 @@ void Fl_Double_Window::flush(int eraseoverlay) { 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); } + + myi->region = 0; + } void Fl_Double_Window::resize(int X,int Y,int W,int H) { diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx index 812fa4d..cf88525 100644 --- a/src/fl_rect.cxx +++ b/src/fl_rect.cxx @@ -556,7 +556,7 @@ void Fl_Graphics_Driver::restore_clip() { void Fl_Graphics_Driver::clip_region(Fl_Region r) { Fl_Region oldr = rstack[rstackptr]; - if (oldr) XDestroyRegion(oldr); + if (oldr && r != oldr ) XDestroyRegion(oldr); rstack[rstackptr] = r; fl_restore_clip(); } @@ -654,10 +654,10 @@ int Fl_Graphics_Driver::clip_box(int x, int y, int w, int h, int& X, int& Y, int if (!r) return 0; #if defined(USE_X11) switch (XRectInRegion(r, x, y, w, h)) { - case 0: // completely outside + case RectangleOut: // completely outside W = H = 0; return 2; - case 1: // completely inside: + case RectangleIn: // completely inside: return 0; default: // partial: break;