WIN32 redraw fixes.

Fl_Tabs now uses FL_DAMAGE_SCROLL for damage to
the tabs themselves.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2683 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-10-22 17:39:12 +00:00
parent 3939b6cde5
commit 4c0903ad50
4 changed files with 30 additions and 28 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl.cxx,v 1.24.2.41.2.54 2002/10/04 15:59:28 easysw Exp $" // "$Id: Fl.cxx,v 1.24.2.41.2.55 2002/10/22 17:39:11 easysw Exp $"
// //
// Main event handling code for the Fast Light Tool Kit (FLTK). // Main event handling code for the Fast Light Tool Kit (FLTK).
// //
@ -865,7 +865,7 @@ void Fl_Widget::redraw_label() {
// background... // background...
int X = x() > 0 ? x() - 1 : 0; int X = x() > 0 ? x() - 1 : 0;
int Y = y() > 0 ? y() - 1 : 0; int Y = y() > 0 ? y() - 1 : 0;
window()->damage(FL_DAMAGE_ALL, X, Y, w() + 2, h() + 2); damage(FL_DAMAGE_ALL, X, Y, w() + 2, h() + 2);
} }
if (align() && !(align() & FL_ALIGN_INSIDE) && window()->shown()) { if (align() && !(align() & FL_ALIGN_INSIDE) && window()->shown()) {
@ -875,13 +875,13 @@ void Fl_Widget::redraw_label() {
label_.measure(W, H); label_.measure(W, H);
if (align() & FL_ALIGN_BOTTOM) { if (align() & FL_ALIGN_BOTTOM) {
window()->damage(FL_DAMAGE_EXPOSE, x(), y() + h(), w(), H); damage(FL_DAMAGE_EXPOSE, x(), y() + h(), w(), H);
} else if (align() & FL_ALIGN_TOP) { } else if (align() & FL_ALIGN_TOP) {
window()->damage(FL_DAMAGE_EXPOSE, x(), y() - H, w(), H); damage(FL_DAMAGE_EXPOSE, x(), y() - H, w(), H);
} else if (align() & FL_ALIGN_LEFT) { } else if (align() & FL_ALIGN_LEFT) {
window()->damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h()); damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h());
} else if (align() & FL_ALIGN_RIGHT) { } else if (align() & FL_ALIGN_RIGHT) {
window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h()); damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h());
} else { } else {
damage(FL_DAMAGE_ALL); damage(FL_DAMAGE_ALL);
} }
@ -967,5 +967,5 @@ void Fl_Window::flush() {
} }
// //
// End of "$Id: Fl.cxx,v 1.24.2.41.2.54 2002/10/04 15:59:28 easysw Exp $". // End of "$Id: Fl.cxx,v 1.24.2.41.2.55 2002/10/22 17:39:11 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.13 2002/09/09 02:04:46 spitzak Exp $" // "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.14 2002/10/22 17:39:12 easysw Exp $"
// //
// Tab widget for the Fast Light Tool Kit (FLTK). // Tab widget for the Fast Light Tool Kit (FLTK).
// //
@ -126,9 +126,9 @@ int Fl_Tabs::handle(int event) {
case FL_PUSH: { case FL_PUSH: {
int H = tab_height(); int H = tab_height();
if (H >= 0) { if (H >= 0) {
if (Fl::event_y() > y()+H) goto DEFAULT; if (Fl::event_y() > y()+H) return Fl_Group::handle(event);
} else { } else {
if (Fl::event_y() < y()+h()+H) goto DEFAULT; if (Fl::event_y() < y()+h()+H) return Fl_Group::handle(event);
}} }}
if (Fl::visible_focus()) Fl::focus(this); if (Fl::visible_focus()) Fl::focus(this);
case FL_DRAG: case FL_DRAG:
@ -143,10 +143,10 @@ int Fl_Tabs::handle(int event) {
int H = tab_height(); int H = tab_height();
if (H >= 0) { if (H >= 0) {
H += Fl::box_dy(box()); H += Fl::box_dy(box());
damage(FL_DAMAGE_EXPOSE, x(), y(), w(), H); damage(FL_DAMAGE_SCROLL, x(), y(), w(), H);
} else { } else {
H = Fl::box_dy(box()) - H; H = Fl::box_dy(box()) - H;
damage(FL_DAMAGE_EXPOSE, x(), y() + h() - H, w(), H); damage(FL_DAMAGE_SCROLL, x(), y() + h() - H, w(), H);
} }
return 1; return 1;
} else return 0; } else return 0;
@ -173,7 +173,6 @@ int Fl_Tabs::handle(int event) {
break; break;
} }
default: default:
DEFAULT:
return Fl_Group::handle(event); return Fl_Group::handle(event);
} }
@ -182,7 +181,7 @@ int Fl_Tabs::handle(int event) {
int Fl_Tabs::push(Fl_Widget *o) { int Fl_Tabs::push(Fl_Widget *o) {
if (push_ == o) return 0; if (push_ == o) return 0;
if (push_ && !push_->visible() || o && !o->visible()) if (push_ && !push_->visible() || o && !o->visible())
damage(FL_DAMAGE_EXPOSE); redraw();
push_ = o; push_ = o;
return 1; return 1;
} }
@ -232,7 +231,7 @@ void Fl_Tabs::draw() {
} else { // redraw the child } else { // redraw the child
if (v) update_child(*v); if (v) update_child(*v);
} }
if (damage() & (FL_DAMAGE_EXPOSE|FL_DAMAGE_ALL)) { if (damage() & (FL_DAMAGE_SCROLL|FL_DAMAGE_ALL)) {
int p[128]; int wp[128]; int p[128]; int wp[128];
int selected = tab_positions(p,wp); int selected = tab_positions(p,wp);
int i; int i;
@ -300,5 +299,5 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
} }
// //
// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.13 2002/09/09 02:04:46 spitzak Exp $". // End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.14 2002/10/22 17:39:12 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_win32.cxx,v 1.33.2.37.2.38 2002/10/11 13:46:56 easysw Exp $" // "$Id: Fl_win32.cxx,v 1.33.2.37.2.39 2002/10/22 17:39:12 easysw Exp $"
// //
// WIN32-specific code for the Fast Light Tool Kit (FLTK). // WIN32-specific code for the Fast Light Tool Kit (FLTK).
// //
@ -584,21 +584,24 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
break; break;
case WM_PAINT: { case WM_PAINT: {
Fl_Region R;
Fl_X *i = Fl_X::i(window); Fl_X *i = Fl_X::i(window);
i->wait_for_expose = 0; i->wait_for_expose = 0;
// We need to merge this damage into fltk's damage. I do this in // We need to merge WIN32's damage into FLTK's damage.
// reverse, telling Win32 about fltk's damage and then reading back R = CreateRectRgn(0,0,0,0);
// the new accumulated region. GetUpdateRgn(hWnd,R,0);
if (i->region) { if (i->region) {
// If there is no region the entire window is damaged // Also tell WIN32 that we are drawing someplace else as well...
if (window->damage()) InvalidateRgn(hWnd,i->region,FALSE); InvalidateRgn(hWnd, i->region, FALSE);
CombineRgn(i->region, i->region, R, RGN_OR);
GetUpdateRgn(hWnd,i->region,0); XDestroyRegion(R);
} else {
i->region = R;
} }
ValidateRgn(hWnd,i->region); ValidateRgn(hWnd,i->region);
window->clear_damage(window->damage()|FL_DAMAGE_EXPOSE); window->clear_damage(window->damage()|FL_DAMAGE_EXPOSE);
// These next two statements should not be here, so that all update // These next two statements should not be here, so that all update
// is deferred until Fl::flush() is called during idle. However Win32 // is deferred until Fl::flush() is called during idle. However WIN32
// apparently is very unhappy if we don't obey it and draw right now. // apparently is very unhappy if we don't obey it and draw right now.
// Very annoying! // Very annoying!
fl_GetDC(hWnd); // Make sure we have a DC for this window... fl_GetDC(hWnd); // Make sure we have a DC for this window...
@ -1183,5 +1186,5 @@ void Fl_Window::make_current() {
} }
// //
// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.38 2002/10/11 13:46:56 easysw Exp $". // End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.39 2002/10/22 17:39:12 easysw Exp $".
// //

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /GX /Ot /Op /Ob2 /I "." /I ".." /D "FL_STATIC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "VC_EXTRA_LEAN" /D "WIN32_EXTRA_LEAN" /YX /FD /c # ADD CPP /nologo /MD /GX /Ot /Op /Ob2 /I "../visualc" /I ".." /D "FL_STATIC" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "VC_EXTRA_LEAN" /D "WIN32_EXTRA_LEAN" /YX /FD /c
# SUBTRACT CPP /Os # SUBTRACT CPP /Os
# ADD BASE RSC /l 0x409 # ADD BASE RSC /l 0x409
# ADD RSC /l 0x409 # ADD RSC /l 0x409
@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /GX /Z7 /Od /I "." /I ".." /D "FL_STATIC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "VC_EXTRA_LEAN" /D "WIN32_EXTRA_LEAN" /FR /YX /FD /c # ADD CPP /nologo /MDd /GX /Z7 /Od /I "../visualc" /I ".." /D "FL_STATIC" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "VC_EXTRA_LEAN" /D "WIN32_EXTRA_LEAN" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 # ADD BASE RSC /l 0x409
# ADD RSC /l 0x409 # ADD RSC /l 0x409
BSC32=bscmake.exe BSC32=bscmake.exe