Fix infinite loop bug with WIDTH=100% in Fl_Help_View widget.

Fix handling of WM_SYNCPAINT message.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1795 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-11-30 16:10:08 +00:00
parent a8e4b27e19
commit ca83eb11a1
3 changed files with 32 additions and 21 deletions

13
CHANGES
View File

@ -1,3 +1,16 @@
CHANGES IN FLTK 1.1.0b7
- More documentation updates...
- Fl_Help_View could get in an infinitely loop when
determining the maximum width of the page; this
was due to a bug in the get_length() method with
percentages (100% width would cause the bug.)
- Don't need -lgdi32 for CygWin, since -mwindows
does this for us.
- The WIN32 event handler did not properly handle
WM_SYNCPAINT messages.
CHANGES IN FLTK 1.1.0b6
- Documentation updates...

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Help_View.cxx,v 1.1.2.16 2001/11/26 20:13:29 easysw Exp $"
// "$Id: Fl_Help_View.cxx,v 1.1.2.17 2001/11/30 16:10:08 easysw Exp $"
//
// Fl_Help_View widget routines.
//
@ -746,6 +746,7 @@ Fl_Help_View::format()
columns[MAX_COLUMNS];
// Column widths
// Reset document width...
hsize_ = w() - 24;
@ -2006,7 +2007,12 @@ Fl_Help_View::get_length(const char *l) { // I - Value
if (!l[0]) return 0;
val = atoi(l);
if (l[strlen(l) - 1] == '%') val = val * hsize_ / 100;
if (l[strlen(l) - 1] == '%') {
if (val > 100) val = 100;
else if (val < 0) val = 0;
val = val * (hsize_ - 24) / 100;
}
return val;
}
@ -2543,5 +2549,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.16 2001/11/26 20:13:29 easysw Exp $".
// End of "$Id: Fl_Help_View.cxx,v 1.1.2.17 2001/11/30 16:10:08 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_win32.cxx,v 1.33.2.37.2.8 2001/11/22 15:35:01 easysw Exp $"
// "$Id: Fl_win32.cxx,v 1.33.2.37.2.9 2001/11/30 16:10:08 easysw Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@ -435,21 +435,6 @@ extern void fl_restore_pen(void);
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Matt: When dragging a full window, MSWindows on 'slow'
// machines can lose track of the window refresh area. It sends some kind
// of panic message to the desktop that in turn sends this message on to
// all applications.
static int cnt=0;
if (uMsg == WM_SYNCPAINT) {
MSG msg;
if ( PeekMessage( &msg, hWnd, WM_PAINT, WM_PAINT, false )==0 )
InvalidateRect(hWnd,0,FALSE);
if (cnt) {
InvalidateRect(fl_window,0,FALSE);
cnt = 0;
} else cnt = 1;
} else if (uMsg == WM_PAINT) cnt = 0;
fl_msg.message = uMsg;
Fl_Window *window = fl_find(hWnd);
@ -463,6 +448,14 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
Fl::handle(FL_CLOSE, window);
return 0;
case WM_SYNCPAINT :
case WM_NCPAINT :
case WM_ERASEBKGND :
// Andreas Weitl - WM_SYNCPAINT needs to be passed to DefWindowProc
// so that Windows can generate the proper paint messages...
// Similarly, WM_NCPAINT and WM_ERASEBKGND need this, too...
break;
case WM_PAINT: {
Fl_X *i = Fl_X::i(window);
@ -655,7 +648,6 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
fl_GetDC(hWnd);
fl_select_palette();
break;
#endif
default:
@ -1005,5 +997,5 @@ void Fl_Window::make_current() {
}
//
// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.8 2001/11/22 15:35:01 easysw Exp $".
// End of "$Id: Fl_win32.cxx,v 1.33.2.37.2.9 2001/11/30 16:10:08 easysw Exp $".
//