diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8bbbbdd8af..4c7a25dcf8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-22 13:06 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/gtxwc/gtxwc.c + ! fixed typo which caused GPF when palette was set before console window + initialization + + * harbour/source/rtl/gttrm/gttrm.c + * reset console color palette to default on application exist + 2009-02-22 00:51 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * contrib/gtwvg/wvgtoolb.prg ! Enabled disabling debug calls (requiring xhb) in non-debug mode. diff --git a/harbour/source/rtl/gttrm/gttrm.c b/harbour/source/rtl/gttrm/gttrm.c index b92ef3b182..83f8325fbc 100644 --- a/harbour/source/rtl/gttrm/gttrm.c +++ b/harbour/source/rtl/gttrm/gttrm.c @@ -1580,6 +1580,13 @@ static void hb_gt_trm_LinuxSetPalette( PHB_GTTRM pTerm, int iIndex ) } } +static void hb_gt_trm_LinuxResetPalette( PHB_GTTRM pTerm ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_trm_LinuxResetPalette(%p)", pTerm)); + + hb_gt_trm_termOut( pTerm, ( BYTE * ) "\033]R", 3 ); +} + /* * XTERM terminal operations */ @@ -2120,6 +2127,17 @@ static void hb_gt_trm_SetPalette( PHB_GTTRM pTerm, int iIndex ) } } +static void hb_gt_trm_ResetPalette( PHB_GTTRM pTerm ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_trm_ResetPalette(%p)", pTerm)); + + if( pTerm->terminal_type == TERM_LINUX || + ( pTerm->terminal_ext & TERM_PUTTY ) ) + { + hb_gt_trm_LinuxResetPalette( pTerm ); + } +} + static void hb_gt_trm_SetKeyTrans( PHB_GTTRM pTerm, char * pSrcChars, char * pDstChars ) { int i; @@ -2987,6 +3005,7 @@ static void hb_gt_trm_Exit( PHB_GT pGT ) removeAllKeyMap( pTerm, &pTerm->pKeyTab ); pTerm->Exit( pTerm ); + hb_gt_trm_ResetPalette( pTerm ); if( pTerm->fOutTTY && pTerm->iCol > 0 ) hb_gt_trm_termOut( pTerm, ( BYTE * ) "\n\r", 2 ); hb_gt_trm_termFlush( pTerm ); diff --git a/harbour/source/rtl/gtxwc/gtxwc.c b/harbour/source/rtl/gtxwc/gtxwc.c index 222354baa6..2e7799212b 100644 --- a/harbour/source/rtl/gtxwc/gtxwc.c +++ b/harbour/source/rtl/gtxwc/gtxwc.c @@ -3996,7 +3996,7 @@ static BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { wnd->colors[ iVal ].value = iColor; wnd->colors[ iVal ].set = FALSE; - if( hb_gt_xwc_setPalette( wnd ) && wnd->dpy ) + if( wnd->dpy && hb_gt_xwc_setPalette( wnd ) ) { memset( wnd->pCurrScr, 0xFFFFFFFFL, wnd->cols * wnd->rows * sizeof( ULONG ) ); hb_gt_xwc_InvalidateChar( wnd, 0, 0, wnd->cols - 1, wnd->rows - 1 ); @@ -4024,7 +4024,7 @@ static BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) wnd->colors[ iVal ].set = FALSE; } } - if( hb_gt_xwc_setPalette( wnd ) && wnd->dpy ) + if( wnd->dpy && hb_gt_xwc_setPalette( wnd ) ) { memset( wnd->pCurrScr, 0xFFFFFFFFL, wnd->cols * wnd->rows * sizeof( ULONG ) ); hb_gt_xwc_InvalidateChar( wnd, 0, 0, wnd->cols - 1, wnd->rows - 1 );