diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ef9cf4172c..fdf55109b6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2011-10-21 12:34 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtwvt/gtwvt.c + ! fixed infinite recursive loops and GPF in WinCE builds caused by + SetWindowPos()/ProcessMessages() when WM_SIZE message is processed. + Now GTWVT can be used again in WinCE builds. + 2011-10-20 23:06 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/compiler/hbmain.c ! take starting line number from PP to eliminate possible diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index 654bb73cac..061dec461f 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -602,6 +602,8 @@ static void hb_gt_wvt_FitRows( PHB_GTWVT pWVT ) int maxWidth; int maxHeight; + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_FitRows()" ) ); + #if defined( HB_OS_WIN_CE ) pWVT->bMaximized = HB_FALSE; #else @@ -636,6 +638,8 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) int iCalcWidth = 0; int iCalcHeight = 0; + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_FitSize()" ) ); + #if defined( HB_OS_WIN_CE ) pWVT->bMaximized = HB_FALSE; #else @@ -729,7 +733,10 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) pWVT->MarginLeft = ( wi.right - wi.left - width ) / 2; pWVT->MarginTop = ( wi.bottom - wi.top - height ) / 2; } - else + else if( wi.right - wi.left != width || wi.bottom - wi.top != height ) + /* above condition is necessary to avoid infinite + * recursive in WInCE builds + */ { pWVT->MarginLeft = 0; pWVT->MarginTop = 0; @@ -800,6 +807,8 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT, HFONT hFont ) TEXTMETRIC tm; int n; + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ResetWindowSize(%p,%p)", pWVT, hFont ) ); + if( !pWVT->hFont || hFont ) { if( !hFont ) @@ -917,11 +926,14 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT, HFONT hFont ) SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOSIZE | SWP_NOZORDER ); } } +#if !defined( HB_OS_WIN_CE ) + /* This code creates infinite recursive calls in WinCE */ else { /* Will resize window without moving left/top origin */ SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); } +#endif } @@ -1772,19 +1784,17 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara } } + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_WndProc(%p,%u)", hWnd, message ) ); + if( pWVT ) switch( message ) { case WM_CREATE: return hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS, NULL ) ? 0 : -1; case WM_PAINT: - { - if( GetUpdateRect( hWnd, NULL, FALSE ) ) hb_gt_wvt_PaintText( pWVT ); - return 0; - } case WM_MY_UPDATE_CARET: hb_gt_wvt_UpdateCaret( pWVT ); @@ -1864,7 +1874,6 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara return 0; case WM_SIZE: - if( ! pWVT->bFullScreen ) { if( pWVT->bResizing && pWVT->ResizeMode == HB_GTI_RESIZEMODE_ROWS ) @@ -1900,6 +1909,8 @@ static WPARAM hb_gt_wvt_ProcessMessages( void ) { MSG msg; + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ProcessMessages()" ) ); + while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg );