diff --git a/FL/Fl.H b/FL/Fl.H index 1750f93..28fa338 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -1040,7 +1040,7 @@ public: public: // Cairo support API - static cairo_t * cairo_make_current(Fl_Window* w); + static cairo_t * cairo_make_current(Fl_Window* wi, Window w = 0); /** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, any current window dc is linked to a current context. This is not the default, because it may not be necessary diff --git a/FL/Fl_Overlay_Window.H b/FL/Fl_Overlay_Window.H index 918b671..fed6e65 100644 --- a/FL/Fl_Overlay_Window.H +++ b/FL/Fl_Overlay_Window.H @@ -45,15 +45,10 @@ overlay will blink if you change the image in the window. */ class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window { - friend class _Fl_Overlay; virtual void draw_overlay() = 0; - Fl_Window *overlay_; public: - void show(); void flush(); - void hide(); - void resize(int,int,int,int); - ~Fl_Overlay_Window(); + virtual ~Fl_Overlay_Window(); int can_do_overlay(); void redraw_overlay(); /** @@ -63,13 +58,12 @@ public: will choose them. */ Fl_Overlay_Window(int W, int H, const char *l=0) - : Fl_Double_Window(W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); } + : Fl_Double_Window(W,H,l) { force_doublebuffering_=1; image(0); } /** See Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char *l=0) */ Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0) - : Fl_Double_Window(X,Y,W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); } - void show(int a, char **b) {Fl_Double_Window::show(a,b);} + : Fl_Double_Window(X,Y,W,H,l) { force_doublebuffering_=1; image(0); } }; #endif diff --git a/src/Fl_Cairo.cxx b/src/Fl_Cairo.cxx index eb16600..8199932 100644 --- a/src/Fl_Cairo.cxx +++ b/src/Fl_Cairo.cxx @@ -57,10 +57,11 @@ static Window real_xid; static int W, H; cairo_t * -Fl::cairo_make_current(Fl_Window* wi) { +Fl::cairo_make_current(Fl_Window* wi, Window w ) { if (!wi) return NULL; // Precondition - Window w = wi->i->other_xid ? wi->i->other_xid : wi->i->xid; + if ( ! w ) + w = wi->i->other_xid ? wi->i->other_xid : wi->i->xid; if ( ( fl_cairo_context && fl_cairo_context == wi->i->cc ) && w && w == real_xid && diff --git a/src/Fl_Overlay_Window.cxx b/src/Fl_Overlay_Window.cxx index 723b57d..5dfb1a4 100644 --- a/src/Fl_Overlay_Window.cxx +++ b/src/Fl_Overlay_Window.cxx @@ -42,15 +42,6 @@ #include #include -void Fl_Overlay_Window::show() { - Fl_Double_Window::show(); - if (overlay_ && overlay_ != this) overlay_->show(); -} - -void Fl_Overlay_Window::hide() { - Fl_Double_Window::hide(); -} - void Fl_Overlay_Window::flush() { #ifdef BOXX_BUGS if (overlay_ && overlay_ != this && overlay_->shown()) { @@ -61,15 +52,17 @@ void Fl_Overlay_Window::flush() { return; } #endif - int erase_overlay = (damage()&FL_DAMAGE_OVERLAY) | (overlay_ == this); + int erase_overlay = (damage()&FL_DAMAGE_OVERLAY); clear_damage((uchar)(damage()&~FL_DAMAGE_OVERLAY)); Fl_Double_Window::flush(erase_overlay); - if (overlay_ == this) draw_overlay(); -} - -void Fl_Overlay_Window::resize(int X, int Y, int W, int H) { - Fl_Double_Window::resize(X,Y,W,H); - if (overlay_ && overlay_!=this) overlay_->resize(0,0,w(),h()); + Fl_X* myi = Fl_X::i(this); +#if FLTK_HAVE_CAIRO + Fl::cairo_make_current( this, myi->xid ); +#endif + draw_overlay(); +#if FLTK_HAVE_CAIRO + Fl::cairo_make_current( this, myi->other_xid ); +#endif } /** @@ -89,7 +82,6 @@ int Fl_Overlay_Window::can_do_overlay() {return 0;} calling show(). */ void Fl_Overlay_Window::redraw_overlay() { - overlay_ = this; clear_damage((uchar)(damage()|FL_DAMAGE_OVERLAY)); Fl::damage(FL_DAMAGE_CHILD); }