From d21d6dd5e07ac65a39630bc2b3476e4892b03bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Mon, 13 Oct 2014 17:11:44 +0200 Subject: [PATCH] 2014-10-13 17:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/Makefile ! fixed to only include compilable GTs in Harbour dynlib (borrowed from Viktor's fork) * src/rtl/gtxwc/gtxwc.c + redraw screen area when empty string is passed as image body to HB_GTI_DISPIMAGE, i.e.: hb_gtInfo( HB_GTI_DISPIMAGE, "" [, ] ) If is not given then whole screen is refreshed. --- ChangeLog.txt | 11 ++++++ src/Makefile | 12 ++++-- src/rtl/gtxwc/gtxwc.c | 86 +++++++++++++++++++++++++------------------ 3 files changed, 70 insertions(+), 39 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 450858973a..698c50ce58 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,17 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-10-13 17:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/Makefile + ! fixed to only include compilable GTs in Harbour dynlib + (borrowed from Viktor's fork) + + * src/rtl/gtxwc/gtxwc.c + + redraw screen area when empty string is passed as image body + to HB_GTI_DISPIMAGE, i.e.: + hb_gtInfo( HB_GTI_DISPIMAGE, "" [, ] ) + If is not given then whole screen is refreshed. + 2014-10-08 18:00 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/vm/arrays.c ! added protection against internal error when ACOPY() is executed diff --git a/src/Makefile b/src/Makefile index 9fc30a5563..268332c99a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -49,9 +49,15 @@ else endif ifneq ($(HB_PLATFORM_UNIX),) DYNDIRLIST_BASE += src/rtl/gttrm - DYNDIRLIST_BASE += src/rtl/gtcrs - DYNDIRLIST_BASE += src/rtl/gtsln - DYNDIRLIST_BASE += src/rtl/gtxwc + ifneq ($(HB_HAS_CURSES),) + DYNDIRLIST_BASE += src/rtl/gtcrs + endif + ifneq ($(HB_HAS_SLANG),) + DYNDIRLIST_BASE += src/rtl/gtsln + endif + ifneq ($(HB_HAS_X11),) + DYNDIRLIST_BASE += src/rtl/gtxwc + endif endif ifeq ($(HB_COMPILER),watcom) DYNDIRLIST_BASE += src/vm/maindllh diff --git a/src/rtl/gtxwc/gtxwc.c b/src/rtl/gtxwc/gtxwc.c index b41f8f6f77..8f42b4fc49 100644 --- a/src/rtl/gtxwc/gtxwc.c +++ b/src/rtl/gtxwc/gtxwc.c @@ -5567,11 +5567,14 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) break; case HB_GTI_DISPIMAGE: - if( wnd->window && pInfo->pNewVal && HB_IS_ARRAY( pInfo->pNewVal ) && - hb_arrayLen( pInfo->pNewVal ) == ( HB_SIZE ) - ( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ? 4 : 3 ) ) + if( wnd->window && pInfo->pNewVal && + ( ( HB_IS_ARRAY( pInfo->pNewVal ) && + hb_arrayLen( pInfo->pNewVal ) == ( HB_SIZE ) + ( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ? 4 : 3 ) ) || + HB_IS_STRING( pInfo->pNewVal ) ) ) { XImage * xImage = NULL; + XWC_RECT rx; /* { pBitmap, iWidth, iHeight [, iDepth ] } */ if( ( hb_arrayGetType( pInfo->pNewVal, 1 ) & ( HB_IT_POINTER | HB_IT_STRING ) ) && @@ -5604,64 +5607,75 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pFreeImage = ( char * ) hb_arrayGetPtr( pInfo->pNewVal, 1 ); } if( pFreeImage != NULL ) - { xImage = XCreateImage( wnd->dpy, DefaultVisual( wnd->dpy, DefaultScreen( wnd->dpy ) ), iDepth, ZPixmap, 0, pFreeImage, iWidth, iHeight, iPad, 0 ); - } } + rx.left = rx.top = 0; if( xImage ) { - XWC_RECT rx; - - rx.left = rx.top = 0; rx.right = xImage->width; rx.bottom = xImage->height; + } + else + { + rx.right = wnd->width; + rx.bottom = wnd->height; + } - /* fetch & validate area for displaying */ - if( pInfo->pNewVal2 && HB_IS_ARRAY( pInfo->pNewVal2 ) ) + /* fetch & validate area for displaying */ + if( pInfo->pNewVal2 && HB_IS_ARRAY( pInfo->pNewVal2 ) ) + { + switch( hb_arrayLen( pInfo->pNewVal2 ) ) { - switch( hb_arrayLen( pInfo->pNewVal2 ) ) - { - case 2: - rx.left = hb_arrayGetNI( pInfo->pNewVal2, 1 ); - rx.top = hb_arrayGetNI( pInfo->pNewVal2, 2 ); + case 2: + rx.left = hb_arrayGetNI( pInfo->pNewVal2, 1 ); + rx.top = hb_arrayGetNI( pInfo->pNewVal2, 2 ); + if( xImage ) + { rx.right += rx.left; rx.bottom += rx.top; - break; - case 4: - rx.left = hb_arrayGetNI( pInfo->pNewVal2, 1 ); - rx.top = hb_arrayGetNI( pInfo->pNewVal2, 2 ); - rx.right = hb_arrayGetNI( pInfo->pNewVal2, 3 ); - rx.bottom = hb_arrayGetNI( pInfo->pNewVal2, 4 ); + } + break; + case 4: + rx.left = hb_arrayGetNI( pInfo->pNewVal2, 1 ); + rx.top = hb_arrayGetNI( pInfo->pNewVal2, 2 ); + rx.right = hb_arrayGetNI( pInfo->pNewVal2, 3 ); + rx.bottom = hb_arrayGetNI( pInfo->pNewVal2, 4 ); + if( xImage ) + { if( rx.right >= rx.left + xImage->width ) rx.right = rx.left + xImage->width - 1; if( rx.bottom >= rx.top + xImage->height ) rx.bottom = rx.top + xImage->height - 1; - break; - } + } + break; } + } - if( rx.left >= 0 && rx.top >= 0 && - rx.left <= rx.right && rx.top <= rx.bottom ) + if( rx.right > wnd->width ) + rx.right = wnd->width; + if( rx.bottom > wnd->height ) + rx.bottom = wnd->height; + + if( rx.left >= 0 && rx.top >= 0 && + rx.left <= rx.right && rx.top <= rx.bottom ) + { + HB_GTSELF_REFRESH( pGT ); + if( xImage ) { - HB_GTSELF_REFRESH( pGT ); - - if( rx.right > wnd->width ) - rx.right = wnd->width; - if( rx.bottom > wnd->height ) - rx.bottom = wnd->height; - HB_XWC_XLIB_LOCK(); XPutImage( wnd->dpy, wnd->pm, wnd->gc, xImage, 0, 0, rx.left, rx.top, rx.right - rx.left + 1, rx.bottom - rx.top + 1 ); HB_XWC_XLIB_UNLOCK(); - - hb_gt_xwc_InvalidatePts( wnd, rx.left, rx.top, rx.right, rx.bottom ); - if( HB_GTSELF_DISPCOUNT( pGT ) == 0 ) - hb_gt_xwc_RealRefresh( wnd, HB_FALSE ); } + hb_gt_xwc_InvalidatePts( wnd, rx.left, rx.top, rx.right, rx.bottom ); + if( HB_GTSELF_DISPCOUNT( pGT ) == 0 ) + hb_gt_xwc_RealRefresh( wnd, HB_FALSE ); + } + if( xImage ) + { /* !NOT! use XDestroyImage(), char * xImage->data is [ eg hbfimage ] external managed */ if( xImage->obdata ) XFree( xImage->obdata );