From 14f3e643985e93c33cc9b504db5e4638ccb6e02e Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 27 Sep 2011 13:15:52 +0000 Subject: [PATCH] 2011-09-27 15:15 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtxwc/gtxwc.c ! fixed window activation just after SETMODE() and before any output ! fixed mouse methods to not activate console window but only connect to XServer if necessary ! fixed internal error reported when HB_GTI_RESIZABLE was called before creating console window % do not allocate colors in HB_GTI_PALETTE if there is no console window --- harbour/ChangeLog | 9 +++++++++ harbour/src/rtl/gtxwc/gtxwc.c | 24 ++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9c6e814a38..ff51fca30c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2011-09-27 15:15 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtxwc/gtxwc.c + ! fixed window activation just after SETMODE() and before any output + ! fixed mouse methods to not activate console window but only connect + to XServer if necessary + ! fixed internal error reported when HB_GTI_RESIZABLE was called before + creating console window + % do not allocate colors in HB_GTI_PALETTE if there is no console window + 2011-09-27 15:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbcurl/core.c ! fixed mistake in recent adoption of libcurl 7.21.6 feature diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index 7df767e175..ab10b27702 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -2699,7 +2699,7 @@ static void hb_gt_xwc_RestoreArea( PXWND_DEF wnd, /* *********************************************************************** */ static void hb_gt_xwc_InvalidateChar( PXWND_DEF wnd, - int left, int top, int right, int bottom ) + int left, int top, int right, int bottom ) { if( wnd->fInvalidChr == HB_FALSE ) { @@ -3615,11 +3615,14 @@ static HB_BOOL hb_gt_xwc_SetMode( PHB_GT pGT, int iRow, int iCol ) if( iCol == wnd->cols && iRow == wnd->rows ) { HB_GTSELF_RESIZE( pGT, wnd->rows, wnd->cols ); + if( !wnd->fInit ) + HB_GTSELF_SEMICOLD( pGT ); fResult = HB_TRUE; } else if( !wnd->fInit ) { hb_gt_xwc_SetScrBuff( wnd, iCol, iRow ); + HB_GTSELF_SEMICOLD( pGT ); fResult = HB_TRUE; } else @@ -3720,9 +3723,13 @@ static void hb_gt_xwc_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static HB_BOOL hb_gt_xwc_mouse_IsPresent( PHB_GT pGT ) { + PXWND_DEF wnd; + HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_IsPresent(%p)", pGT)); - return HB_GTXWC_GET( pGT )->mouseNumButtons > 0; + wnd = HB_GTXWC_GET( pGT ); + hb_gt_xwc_ConnectX( wnd, HB_TRUE ); + return wnd->mouseNumButtons > 0; } /* *********************************************************************** */ @@ -3765,6 +3772,7 @@ static HB_BOOL hb_gt_xwc_mouse_ButtonState( PHB_GT pGT,int iButton ) HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_ButtonState(%p,%i)", pGT, iButton)); wnd = HB_GTXWC_GET( pGT ); + hb_gt_xwc_ConnectX( wnd, HB_TRUE ); if( iButton >= 0 && iButton < wnd->mouseNumButtons ) return ( wnd->mouseButtonsState & 1 << iButton ) != 0; else @@ -3780,7 +3788,7 @@ static int hb_gt_xwc_mouse_CountButton( PHB_GT pGT ) HB_TRACE(HB_TR_DEBUG, ("hb_gt_xwc_mouse_CountButton(%p)", pGT)); wnd = HB_GTXWC_GET( pGT ); - hb_gt_xwc_RealRefresh( wnd ); + hb_gt_xwc_ConnectX( wnd, HB_TRUE ); return wnd->mouseNumButtons; } @@ -3906,7 +3914,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) break; case HB_GTI_ONLINE: - pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->dpy && wnd->window ); + pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->fInit ); break; case HB_GTI_ISUNICODE: @@ -3961,7 +3969,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { HB_XWC_XLIB_LOCK if( hb_gt_xwc_SetFont( wnd, hb_itemGetCPtr( pInfo->pNewVal ), NULL, 0, NULL ) && - wnd->window ) + wnd->fInit ) hb_gt_xwc_CreateWindow( wnd ); HB_XWC_XLIB_UNLOCK } @@ -4098,7 +4106,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( wnd->fResizable != ( iVal != 0 ) ) { wnd->fResizable = ( iVal != 0 ); - if( wnd->dpy ) + if( wnd->fInit ) { HB_XWC_XLIB_LOCK hb_gt_xwc_SetResizing( wnd ); @@ -4122,7 +4130,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { wnd->colors[ iVal ].value = iColor; wnd->colors[ iVal ].set = HB_FALSE; - if( wnd->dpy && hb_gt_xwc_setPalette( wnd ) ) + if( wnd->fInit && hb_gt_xwc_setPalette( wnd ) ) { memset( wnd->pCurrScr, 0xFFFFFFFFL, wnd->cols * wnd->rows * sizeof( HB_ULONG ) ); hb_gt_xwc_InvalidateChar( wnd, 0, 0, wnd->cols - 1, wnd->rows - 1 ); @@ -4150,7 +4158,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) wnd->colors[ iVal ].set = HB_FALSE; } } - if( wnd->dpy && hb_gt_xwc_setPalette( wnd ) ) + if( wnd->fInit && hb_gt_xwc_setPalette( wnd ) ) { memset( wnd->pCurrScr, 0xFFFFFFFFL, wnd->cols * wnd->rows * sizeof( HB_ULONG ) ); hb_gt_xwc_InvalidateChar( wnd, 0, 0, wnd->cols - 1, wnd->rows - 1 );