From 10df511f733bc1cdb4a701ea735eb98e22ffbc27 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 16 Dec 2001 12:37:03 +0000 Subject: Better UNFOCUS redraw() fix for Fl_Button. Adjust plastic boxtype borders. Update dependencies. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1851 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Button.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/Fl_Button.cxx') diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index ae4ddcadf..8b39d4d2b 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Button.cxx,v 1.4.2.6.2.7 2001/12/14 16:48:13 easysw Exp $" +// "$Id: Fl_Button.cxx,v 1.4.2.6.2.8 2001/12/16 12:37:02 easysw Exp $" // // Button widget for the Fast Light Tool Kit (FLTK). // @@ -26,6 +26,7 @@ #include #include #include +#include // There are a lot of subclasses, named Fl_*_Button. Some of // them are implemented by setting the type() value and testing it @@ -108,7 +109,16 @@ int Fl_Button::handle(int event) { case FL_FOCUS : case FL_UNFOCUS : if (Fl::visible_focus()) { - if (event == FL_UNFOCUS && box() == FL_NO_BOX) parent()->redraw(); + if (event == FL_UNFOCUS && box() == FL_NO_BOX) { + // Buttons with the FL_NO_BOX boxtype need a parent to + // redraw, since it is responsible for redrawing the + // background... + Fl_Widget *p; + for (p = parent(); p; p = p->parent()) + if (p->box() != FL_NO_BOX) break; + if (p) p->redraw(); + else window()->redraw(); + } else redraw(); return 1; } else return 0; @@ -139,5 +149,5 @@ Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l) } // -// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.7 2001/12/14 16:48:13 easysw Exp $". +// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.8 2001/12/16 12:37:02 easysw Exp $". // -- cgit v1.2.3