From daa2a7f0cd505b21a53ddca10432efd90a1d71b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Tue, 23 Sep 2014 11:41:11 +0200 Subject: [PATCH] 2014-09-23 11:41 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc1.cpp * src/rtl/gtwvt/gtwvt.c * contrib/gtwvg/gtwvgd.c * use hb_vmRequestQuit() instead of hb_vmRequestCancel() when close event is received - it is GTXWC compatible behavior and allows to execute user EXIT PROCEDUREs. Please also remember that all ALWAYS sections are executed too regardles of requested event (QUIT, BREAK, CANCEL) * src/rtl/gtwvt/gtwvt.c ! fixed processing WM_QUERYENDSESSION and WM_ENDSESSION messages. Now GTWVT applications do not interrupt system shutdown process and do not close application if other process interrupted it. In the future we can also add support for blocking system shutdown operation, i.e. using HB_GTI_CLOSEMODE as bitfield, anyhow before we begin to change it we should agree final version. ! applied Rolf's patch which fixes circle and ellipse cords. I haven't tested it and I hope that they were verified visually on the screen - some of Windows GUI functions do not access border points. --- ChangeLog.txt | 22 ++++++++++++++++++++++ contrib/gtqtc/gtqtc1.cpp | 7 +------ contrib/gtwvg/gtwvgd.c | 5 +---- src/rtl/gtwvt/gtwvt.c | 30 +++++++++++++++--------------- 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a1ee1a8b10..6fd01be8c9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,28 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-09-23 11:41 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/gtqtc/gtqtc1.cpp + * src/rtl/gtwvt/gtwvt.c + * contrib/gtwvg/gtwvgd.c + * use hb_vmRequestQuit() instead of hb_vmRequestCancel() when + close event is received - it is GTXWC compatible behavior and + allows to execute user EXIT PROCEDUREs. + Please also remember that all ALWAYS sections are executed too + regardles of requested event (QUIT, BREAK, CANCEL) + + * src/rtl/gtwvt/gtwvt.c + ! fixed processing WM_QUERYENDSESSION and WM_ENDSESSION messages. + Now GTWVT applications do not interrupt system shutdown process + and do not close application if other process interrupted it. + In the future we can also add support for blocking system shutdown + operation, i.e. using HB_GTI_CLOSEMODE as bitfield, anyhow before + we begin to change it we should agree final version. + ! applied Rolf's patch which fixes circle and ellipse cords. + I haven't tested it and I hope that they were verified visually + on the screen - some of Windows GUI functions do not access + border points. + 2014-09-23 10:47 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/rddsql/sqlbase.c ! set maximum field size to HB_SYMBOL_NAME_LEN diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp index 26aeae84d1..9287fccb95 100644 --- a/contrib/gtqtc/gtqtc1.cpp +++ b/contrib/gtqtc/gtqtc1.cpp @@ -3482,12 +3482,7 @@ QTCWindow::~QTCWindow( void ) void QTCWindow::closeEvent( QCloseEvent * event ) { if( qConsole->pQTC->iCloseMode == 0 ) - { - PHB_ITEM pItem = hb_itemPutL( NULL, HB_TRUE ); - hb_setSetItem( HB_SET_CANCEL, pItem ); - hb_itemRelease( pItem ); - hb_vmRequestCancel(); - } + hb_vmRequestQuit(); else hb_gt_qtc_addKeyToInputQueue( qConsole->pQTC, HB_K_CLOSE ); diff --git a/contrib/gtwvg/gtwvgd.c b/contrib/gtwvg/gtwvgd.c index ae4302076a..d9fbd9f221 100644 --- a/contrib/gtwvg/gtwvgd.c +++ b/contrib/gtwvg/gtwvgd.c @@ -2174,10 +2174,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara #if 1 hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_CLOSE ); #else - PHB_ITEM pItem = hb_itemPutL( NULL, HB_TRUE ); - hb_setSetItem( HB_SET_CANCEL, pItem ); - hb_itemRelease( pItem ); - hb_vmRequestCancel(); + hb_vmRequestQuit(); #endif } } diff --git a/src/rtl/gtwvt/gtwvt.c b/src/rtl/gtwvt/gtwvt.c index 99547a8285..6d757560ab 100644 --- a/src/rtl/gtwvt/gtwvt.c +++ b/src/rtl/gtwvt/gtwvt.c @@ -2898,20 +2898,20 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_gt_wvt_MouseEvent( pWVT, message, wParam, lParam ); return 0; - case WM_QUERYENDSESSION: /* Closing down computer */ - hb_vmRequestQuit(); + case WM_QUERYENDSESSION: /* check if we can shutdown or logoff */ + return 1; + + case WM_ENDSESSION: /* shutdown started */ + if( wParam ) + hb_vmRequestQuit(); return 0; case WM_CLOSE: /* Clicked 'X' on system menu */ if( pWVT->CloseMode == 0 ) - { - PHB_ITEM pItem = hb_itemPutL( NULL, HB_TRUE ); - hb_setSetItem( HB_SET_CANCEL, pItem ); - hb_itemRelease( pItem ); - hb_vmRequestCancel(); - } + hb_vmRequestQuit(); else hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_CLOSE ); + return 0; case WM_QUIT: case WM_DESTROY: @@ -4220,8 +4220,8 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, case HB_GFX_RECT: r.left = HB_MIN( iLeft, iRight ); r.top = HB_MIN( iTop, iBottom ); - r.right = HB_MAX( iLeft, iRight ) + 1; - r.bottom = HB_MAX( iTop, iBottom ) + 1; + r.right = HB_MAX( iLeft, iRight ); + r.bottom = HB_MAX( iTop, iBottom ); SetGFXContext( iColor ); @@ -4235,8 +4235,8 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, r.left = HB_MIN( iLeft, iRight ); r.top = HB_MIN( iTop, iBottom ); - r.right = HB_MAX( iLeft, iRight ) + 1; - r.bottom = HB_MAX( iTop, iBottom ) + 1; + r.right = HB_MAX( iLeft, iRight ); + r.bottom = HB_MAX( iTop, iBottom ); iRet = Rectangle( hdc, r.left, r.top, r.right, r.bottom ) ? 1 : 0; @@ -4246,7 +4246,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, case HB_GFX_CIRCLE: SetGFXContext( iRight ); - iRet = Arc( hdc, iLeft - iBottom, iTop - iBottom, iLeft + iBottom + 1, iTop + iBottom + 1, 0, 0, 0, 0 ) ? 1 : 0; + iRet = Arc( hdc, iLeft - iBottom, iTop - iBottom, iLeft + iBottom, iTop + iBottom, 0, 0, 0, 0 ) ? 1 : 0; ClearGFXContext(); break; @@ -4254,7 +4254,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, case HB_GFX_FILLEDCIRCLE: SetGFXContext( iRight ); - iRet = Ellipse( hdc, iLeft - iBottom, iTop - iBottom, iLeft + iBottom + 1, iTop + iBottom + 1 ) ? 1 : 0; + iRet = Ellipse( hdc, iLeft - iBottom, iTop - iBottom, iLeft + iBottom, iTop + iBottom ) ? 1 : 0; ClearGFXContext(); break; @@ -4262,7 +4262,7 @@ static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, case HB_GFX_ELLIPSE: SetGFXContext( iColor ); - iRet = Arc( hdc, iLeft - iRight, iTop - iBottom, iLeft + iRight + 1, iTop + iBottom + 1, 0, 0, 0, 0 ) ? 1 : 0; + iRet = Arc( hdc, iLeft - iRight, iTop - iBottom, iLeft + iRight, iTop + iBottom, 0, 0, 0, 0 ) ? 1 : 0; ClearGFXContext(); break;