From 37986061a5fafcfd481533bc9ca15a8a0d050885 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 27 Sep 2011 07:04:21 +0000 Subject: [PATCH] 2011-09-27 09:04 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtwvt/gtwvt.c * harbour/src/rtl/gtxwc/gtxwc.c + allow to use HB_GTI_ONLINE to check if terminal window exists * harbour/src/rtl/gtxwc/gtxwc.c ! protection against possible GPF when XServer is not accessible and user calls HB_GTI_FONTSEL * do not activate terminal window by HB_GTI_FONTSEL * use maximal logical width of character instead of maximal size of character rectangle to calculate width of character cell --- harbour/ChangeLog | 12 ++++++++++++ harbour/src/rtl/gtwvt/gtwvt.c | 4 ++++ harbour/src/rtl/gtxwc/gtxwc.c | 12 +++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 29462cbaf1..e03be1a80e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,18 @@ The license applies to all entries newer than 2009-04-28. */ +2011-09-27 09:04 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtwvt/gtwvt.c + * harbour/src/rtl/gtxwc/gtxwc.c + + allow to use HB_GTI_ONLINE to check if terminal window exists + + * harbour/src/rtl/gtxwc/gtxwc.c + ! protection against possible GPF when XServer is not accessible + and user calls HB_GTI_FONTSEL + * do not activate terminal window by HB_GTI_FONTSEL + * use maximal logical width of character instead of maximal size + of character rectangle to calculate width of character cell + 2011-09-26 10:57 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbgtcore.h * harbour/src/rtl/gtclip.c diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index fcce04c98c..654bb73cac 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -2326,6 +2326,10 @@ static HB_BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemPutL( pInfo->pResult, HB_TRUE ); break; + case HB_GTI_ONLINE: + pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->hWnd != NULL ); + break; + case HB_GTI_ISUNICODE: #if defined( UNICODE ) pInfo->pResult = hb_itemPutL( pInfo->pResult, HB_TRUE ); diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index 1593352177..7df767e175 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -3070,7 +3070,8 @@ static HB_BOOL hb_gt_xwc_SetFont( PXWND_DEF wnd, const char *fontFace, /* a shortcut for window height and width */ wnd->fontHeight = xfs->max_bounds.ascent + xfs->max_bounds.descent; - wnd->fontWidth = xfs->max_bounds.rbearing - xfs->min_bounds.lbearing; + /* wnd->fontWidth = xfs->max_bounds.rbearing - xfs->min_bounds.lbearing; */ + wnd->fontWidth = xfs->max_bounds.width; wnd->xfs = xfs; return HB_TRUE; @@ -3879,7 +3880,6 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_ISSCREENPOS: case HB_GTI_KBDSUPPORT: case HB_GTI_ISGRAPHIC: - case HB_GTI_FONTSEL: hb_gt_xwc_ConnectX( wnd, HB_FALSE ); break; @@ -3891,6 +3891,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_DESKTOPCOLS: case HB_GTI_DESKTOPROWS: case HB_GTI_CLIPBOARDDATA: + case HB_GTI_FONTSEL: hb_gt_xwc_ConnectX( wnd, HB_TRUE ); break; } @@ -3904,6 +3905,10 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->dpy != NULL ); break; + case HB_GTI_ONLINE: + pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->dpy && wnd->window ); + break; + case HB_GTI_ISUNICODE: pInfo->pResult = hb_itemPutL( pInfo->pResult, HB_TRUE ); break; @@ -3955,7 +3960,8 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { HB_XWC_XLIB_LOCK - if( hb_gt_xwc_SetFont( wnd, hb_itemGetCPtr( pInfo->pNewVal ), NULL, 0, NULL ) ) + if( hb_gt_xwc_SetFont( wnd, hb_itemGetCPtr( pInfo->pNewVal ), NULL, 0, NULL ) && + wnd->window ) hb_gt_xwc_CreateWindow( wnd ); HB_XWC_XLIB_UNLOCK }