Browse Source

Fix Fl_Overlay_Window for Cairo.

tags/v1.3.1000
Jonathan Moore Liles 13 years ago
parent
commit
c4d6a1902c
4 changed files with 16 additions and 29 deletions
  1. +1
    -1
      FL/Fl.H
  2. +3
    -9
      FL/Fl_Overlay_Window.H
  3. +3
    -2
      src/Fl_Cairo.cxx
  4. +9
    -17
      src/Fl_Overlay_Window.cxx

+ 1
- 1
FL/Fl.H View File

@@ -1040,7 +1040,7 @@ public:
public: public:


// Cairo support API // 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, /** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true,
any current window dc is linked to a current context. any current window dc is linked to a current context.
This is not the default, because it may not be necessary This is not the default, because it may not be necessary


+ 3
- 9
FL/Fl_Overlay_Window.H View File

@@ -45,15 +45,10 @@
overlay will blink if you change the image in the window. overlay will blink if you change the image in the window.
*/ */
class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window { class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window {
friend class _Fl_Overlay;
virtual void draw_overlay() = 0; virtual void draw_overlay() = 0;
Fl_Window *overlay_;
public: public:
void show();
void flush(); void flush();
void hide();
void resize(int,int,int,int);
~Fl_Overlay_Window();
virtual ~Fl_Overlay_Window();
int can_do_overlay(); int can_do_overlay();
void redraw_overlay(); void redraw_overlay();
/** /**
@@ -63,13 +58,12 @@ public:
will choose them. will choose them.
*/ */
Fl_Overlay_Window(int W, int H, const char *l=0) 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) 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_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 #endif


+ 3
- 2
src/Fl_Cairo.cxx View File

@@ -57,10 +57,11 @@ static Window real_xid;
static int W, H; static int W, H;


cairo_t * cairo_t *
Fl::cairo_make_current(Fl_Window* wi) {
Fl::cairo_make_current(Fl_Window* wi, Window w ) {
if (!wi) return NULL; // Precondition 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 ) && if ( ( fl_cairo_context && fl_cairo_context == wi->i->cc ) &&
w && w == real_xid && w && w == real_xid &&


+ 9
- 17
src/Fl_Overlay_Window.cxx View File

@@ -42,15 +42,6 @@
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <FL/x.H> #include <FL/x.H>


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() { void Fl_Overlay_Window::flush() {
#ifdef BOXX_BUGS #ifdef BOXX_BUGS
if (overlay_ && overlay_ != this && overlay_->shown()) { if (overlay_ && overlay_ != this && overlay_->shown()) {
@@ -61,15 +52,17 @@ void Fl_Overlay_Window::flush() {
return; return;
} }
#endif #endif
int erase_overlay = (damage()&FL_DAMAGE_OVERLAY) | (overlay_ == this);
int erase_overlay = (damage()&FL_DAMAGE_OVERLAY);
clear_damage((uchar)(damage()&~FL_DAMAGE_OVERLAY)); clear_damage((uchar)(damage()&~FL_DAMAGE_OVERLAY));
Fl_Double_Window::flush(erase_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(). calling show().
*/ */
void Fl_Overlay_Window::redraw_overlay() { void Fl_Overlay_Window::redraw_overlay() {
overlay_ = this;
clear_damage((uchar)(damage()|FL_DAMAGE_OVERLAY)); clear_damage((uchar)(damage()|FL_DAMAGE_OVERLAY));
Fl::damage(FL_DAMAGE_CHILD); Fl::damage(FL_DAMAGE_CHILD);
} }


Loading…
Cancel
Save