From d9df31830f299500903e9d238f0feb2638136958 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 15 May 2010 12:58:03 +0000 Subject: [PATCH] 2010-05-15 14:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gtwvt/gtwvt.c * Changed HB_GTI_CLOSABLE to not cause any visible change on the UI. Setting HB_GTI_CLOSABLE to .F., will now cause that a HB_K_CLOSE event is returned to application by INKEY(), and app can decide whether to ignore it or QUIT. This also means that the feedback is now not an async event in HB_GTI_CLOSABLE .F. mode, IOW if the app is in a loop without reading keys, close button won't work, which is IMO closer to how apps are supposed to behave. It also won't grey out the close buttong anymore which is also a unusual thing to do amongst apps. ; TODO: If this turns out to be good solution, sync this behavior with HBWIN. ; TODO: Delete old "fireevent" async even handling using notifier callback codeblock. --- harbour/ChangeLog | 17 +++++++++++++++++ harbour/src/rtl/gtwvt/gtwvt.c | 35 ++++++++++------------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 91088a0b5f..7ca04065ac 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-05-15 14:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/gtwvt/gtwvt.c + * Changed HB_GTI_CLOSABLE to not cause any visible change on the UI. + Setting HB_GTI_CLOSABLE to .F., will now cause that a HB_K_CLOSE + event is returned to application by INKEY(), and app can decide + whether to ignore it or QUIT. + This also means that the feedback is now not an async event in + HB_GTI_CLOSABLE .F. mode, IOW if the app is in a loop without + reading keys, close button won't work, which is IMO closer to + how apps are supposed to behave. It also won't grey out the + close buttong anymore which is also a unusual thing to do + amongst apps. + ; TODO: If this turns out to be good solution, sync this behavior + with HBWIN. + ; TODO: Delete old "fireevent" async even handling using notifier + callback codeblock. + 2010-05-15 14:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/gtwvt/gtwvt.c ! Internal change slipped into prev. diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index fa51349f10..6429b90bac 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -1675,13 +1675,17 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara return 0; case WM_CLOSE: /* Clicked 'X' on system menu */ - hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_CLOSE ); if( hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE ) == 0 ) { - PHB_ITEM pItem = hb_itemPutL( NULL, HB_TRUE ); - hb_setSetItem( HB_SET_CANCEL, pItem ); - hb_itemRelease( pItem ); - hb_vmRequestCancel(); + if( pWVT->bClosable ) + { + PHB_ITEM pItem = hb_itemPutL( NULL, HB_TRUE ); + hb_setSetItem( HB_SET_CANCEL, pItem ); + hb_itemRelease( pItem ); + hb_vmRequestCancel(); + } + else + hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_CLOSE ); } return 0; @@ -1877,9 +1881,6 @@ static HB_BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) { /* Create "Mark" prompt in SysMenu to allow console type copy operation */ AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, pWVT->lpSelectCopy ); - /* disable [x] button / close menu item */ - if( ! pWVT->bClosable ) - EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED ); } } @@ -2577,23 +2578,7 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_CLOSABLE: pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bClosable ); if( pInfo->pNewVal ) - { - HB_BOOL bNewValue = hb_itemGetL( pInfo->pNewVal ); - if( bNewValue != pWVT->bClosable ) - { - if( pWVT->hWnd ) - { - HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); - if( hSysMenu ) - { - EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED ) ); - pWVT->bClosable = bNewValue; - } - } - else - pWVT->bClosable = bNewValue; - } - } + pWVT->bClosable = hb_itemGetL( pInfo->pNewVal ); break; case HB_GTI_PALETTE: