From 2565fe25cd310bbd875ae9e41b811e6cbcbb5d02 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 8 May 2012 00:04:26 -0700 Subject: [PATCH] Improve theme-level background image support. --- FL/Fl.H | 2 ++ FL/Fl_Image.H | 3 +++ FL/Fl_Overlay_Window.H | 1 + src/Fl.cxx | 8 -------- src/Fl_get_system_colors.cxx | 11 +++-------- src/Fl_x.cxx | 16 ++++++++-------- 6 files changed, 17 insertions(+), 24 deletions(-) diff --git a/FL/Fl.H b/FL/Fl.H index 5aefdf1..ce261dd 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -275,6 +275,8 @@ public: See void scheme(const char *name) */ static int reload_scheme(); // platform dependent + + static void scheme_bg ( Fl_Image *i ) { scheme_bg_ = i; } static int scrollbar_size(); static void scrollbar_size(int W); diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index eb1e7e3..e03c7fe 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -176,6 +176,9 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image { friend class Fl_Quartz_Graphics_Driver; friend class Fl_GDI_Graphics_Driver; friend class Fl_Xlib_Graphics_Driver; +#if FLTK_HAVE_CAIRO + friend class Fl_Cairo_Graphics_Driver; +#endif public: const uchar *array; diff --git a/FL/Fl_Overlay_Window.H b/FL/Fl_Overlay_Window.H index fed6e65..268bacd 100644 --- a/FL/Fl_Overlay_Window.H +++ b/FL/Fl_Overlay_Window.H @@ -45,6 +45,7 @@ overlay will blink if you change the image in the window. */ class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window { +protected: virtual void draw_overlay() = 0; public: void flush(); diff --git a/src/Fl.cxx b/src/Fl.cxx index bb1f1cd..1952777 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1703,14 +1703,6 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) { Fl::damage(FL_DAMAGE_CHILD); } void Fl_Window::flush() { - - if ( ! i->cc ) - { - i->cs = Fl::cairo_create_surface( i->xid, w(), h() ); - i->cc = cairo_create( i->cs ); - Fl::cairo_make_current( i->cs, i->cc ); - } - draw(); #if FLTK_HAVE_CAIRO diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx index de18ca0..0a52d87 100644 --- a/src/Fl_get_system_colors.cxx +++ b/src/Fl_get_system_colors.cxx @@ -276,12 +276,6 @@ int Fl::scheme(const char *s) { int Fl::reload_scheme() { Fl_Window *win; - // Use the standard FLTK look-n-feel... - if (scheme_bg_) { - delete scheme_bg_; - scheme_bg_ = (Fl_Image *)0; - } - set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2); set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2); set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2); @@ -299,8 +293,9 @@ int Fl::reload_scheme() { // Set (or clear) the background tile for all windows... for (win = first_window(); win; win = next_window(win)) { - win->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL); - win->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); +// win->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL); +// win->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP | FL_ALIGN_IMAGE_BACKDROP ); + win->align( FL_ALIGN_IMAGE_BACKDROP ); win->image(scheme_bg_); win->redraw(); } diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 0e3c993..febe625 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -1691,6 +1691,7 @@ Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) { xp->setwindow(win); xp->next = Fl_X::first; xp->region = 0; + xp->wait_for_expose = 0; // xp->backbuffer_bad = 1; Fl_X::first = xp; if (win->modal()) {Fl::modal_ = win; fl_fix_focus();} @@ -2007,21 +2008,20 @@ static inline int can_boxcheat(uchar b) {return (b==1 || ((b&2) && b<=15));} void Fl_Window::show() { image(Fl::scheme_bg_); if (Fl::scheme_bg_) { - labeltype(FL_NORMAL_LABEL); - align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); +// labeltype(FL_NORMAL_LABEL); + align(FL_ALIGN_IMAGE_BACKDROP); } else { labeltype(FL_NO_LABEL); } - - Fl_Tooltip::exit(this); if (!shown()) { fl_open_display(); - // Don't set background pixel for double-buffered windows... - if (type() == FL_WINDOW && can_boxcheat(box())) { - fl_background_pixel = int(fl_xpixel(color())); - } + + /* // Don't set background pixel for double-buffered windows... */ + /* if (type() == FL_WINDOW && can_boxcheat(box())) { */ + /* fl_background_pixel = int(fl_xpixel(color())); */ + /* } */ Fl_X::make_xid(this); } else {