From 4c0903ad50ce85046ce25851ae1855f0c59accd1 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 22 Oct 2002 17:39:12 +0000 Subject: [PATCH] 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 --- src/Fl.cxx | 14 +++++++------- src/Fl_Tabs.cxx | 17 ++++++++--------- src/Fl_win32.cxx | 23 +++++++++++++---------- visualc/fltk.lib.dsp | 4 ++-- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/Fl.cxx b/src/Fl.cxx index ae635ba53..2180fd4da 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -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). // @@ -865,7 +865,7 @@ void Fl_Widget::redraw_label() { // background... int X = x() > 0 ? x() - 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()) { @@ -875,13 +875,13 @@ void Fl_Widget::redraw_label() { label_.measure(W, H); 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) { - 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) { - 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) { - window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h()); + damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h()); } else { 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 $". // diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx index 51adcb1be..7599c8019 100644 --- a/src/Fl_Tabs.cxx +++ b/src/Fl_Tabs.cxx @@ -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). // @@ -126,9 +126,9 @@ int Fl_Tabs::handle(int event) { case FL_PUSH: { int H = tab_height(); if (H >= 0) { - if (Fl::event_y() > y()+H) goto DEFAULT; + if (Fl::event_y() > y()+H) return Fl_Group::handle(event); } 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); case FL_DRAG: @@ -143,10 +143,10 @@ int Fl_Tabs::handle(int event) { int H = tab_height(); if (H >= 0) { H += Fl::box_dy(box()); - damage(FL_DAMAGE_EXPOSE, x(), y(), w(), H); + damage(FL_DAMAGE_SCROLL, x(), y(), w(), H); } else { 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; } else return 0; @@ -173,7 +173,6 @@ int Fl_Tabs::handle(int event) { break; } default: - DEFAULT: return Fl_Group::handle(event); } @@ -182,7 +181,7 @@ int Fl_Tabs::handle(int event) { int Fl_Tabs::push(Fl_Widget *o) { if (push_ == o) return 0; if (push_ && !push_->visible() || o && !o->visible()) - damage(FL_DAMAGE_EXPOSE); + redraw(); push_ = o; return 1; } @@ -232,7 +231,7 @@ void Fl_Tabs::draw() { } else { // redraw the child 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 selected = tab_positions(p,wp); 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 $". // diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 0579f0b1d..923adecc2 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -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). // @@ -584,21 +584,24 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar break; case WM_PAINT: { + Fl_Region R; Fl_X *i = Fl_X::i(window); i->wait_for_expose = 0; - // We need to merge this damage into fltk's damage. I do this in - // reverse, telling Win32 about fltk's damage and then reading back - // the new accumulated region. + // We need to merge WIN32's damage into FLTK's damage. + R = CreateRectRgn(0,0,0,0); + GetUpdateRgn(hWnd,R,0); if (i->region) { - // If there is no region the entire window is damaged - if (window->damage()) InvalidateRgn(hWnd,i->region,FALSE); - - GetUpdateRgn(hWnd,i->region,0); + // Also tell WIN32 that we are drawing someplace else as well... + InvalidateRgn(hWnd, i->region, FALSE); + CombineRgn(i->region, i->region, R, RGN_OR); + XDestroyRegion(R); + } else { + i->region = R; } ValidateRgn(hWnd,i->region); window->clear_damage(window->damage()|FL_DAMAGE_EXPOSE); // 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. // Very annoying! 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 $". // diff --git a/visualc/fltk.lib.dsp b/visualc/fltk.lib.dsp index 9cbbf1cc0..5d789e029 100644 --- a/visualc/fltk.lib.dsp +++ b/visualc/fltk.lib.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # 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 # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 @@ -65,7 +65,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # 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 RSC /l 0x409 BSC32=bscmake.exe