diff --git a/ChangeLog.txt b/ChangeLog.txt index d0bdab4707..92755e4480 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,25 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-11-12 18:01 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * include/hbgtinfo.ch + + added HB_GTI_MINIMIZED + + * contrib/gtqtc/gtqtc.h + * contrib/gtqtc/gtqtc1.cpp + + added support for HB_GTI_MINIMIZED + + * src/rtl/gtxwc/gtxwc.c + + added support for HB_GTI_MINIMIZED and HB_GTI_MAXIMIZED + + ; All above modifications created by Rolf - thanks + + * contrib/hbnetio/netiocli.c + * updated some RTEs to be a little bit more precise + + * contrib/hbblat/hbblat.hbp + * disabled unconditional dynamic library build + 2014-11-04 01:54 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * ChangeLog.txt * doc/xhb-diff.txt diff --git a/contrib/gtqtc/gtqtc.h b/contrib/gtqtc/gtqtc.h index 4a97350a88..ddc491bce9 100644 --- a/contrib/gtqtc/gtqtc.h +++ b/contrib/gtqtc/gtqtc.h @@ -326,6 +326,7 @@ typedef struct HB_BOOL fResizable; /* enable/disable window resizing */ HB_BOOL fResizeInc; /* enable/disable resize progression */ HB_BOOL fMaximized; /* enter/leave mximize mode */ + HB_BOOL fMinimized; /* enter/leave mximize ( e.g. as icon in taskbar ) mode */ HB_BOOL fFullScreen; /* enable/disable fullscreen mode */ HB_BOOL fSelectCopy; /* allow marking texts by mouse left button with shift */ HB_BOOL fRepaint; /* force internal image repainting */ diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp index e4f9081ec2..f91355c71a 100644 --- a/contrib/gtqtc/gtqtc1.cpp +++ b/contrib/gtqtc/gtqtc1.cpp @@ -1370,6 +1370,7 @@ static PHB_GTQTC hb_gt_qtc_new( PHB_GT pGT ) pQTC->fResizeInc = HB_FALSE; pQTC->fAltEnter = HB_FALSE; pQTC->fMaximized = HB_FALSE; + pQTC->fMinimized = HB_FALSE; pQTC->fFullScreen = HB_FALSE; pQTC->fSelectCopy = HB_FALSE; pQTC->fRepaint = HB_TRUE; @@ -1569,7 +1570,7 @@ static void hb_gt_qtc_setWindowFlags( PHB_GTQTC pQTC, Qt::WindowFlags flags, HB_ } } -static void hb_gt_qtc_setWindowState( PHB_GTQTC pQTC, Qt::WindowStates state, HB_BOOL fSet ) +static void hb_gt_qtc_setWindowState( PHB_GTQTC pQTC, Qt::WindowStates state, HB_BOOL fSet, HB_BOOL fShow ) { Qt::WindowStates currState = pQTC->qWnd->windowState(), newState; @@ -1581,9 +1582,12 @@ static void hb_gt_qtc_setWindowState( PHB_GTQTC pQTC, Qt::WindowStates state, HB if( newState != currState ) { pQTC->qWnd->setWindowState( newState ); - HB_QTC_LOCK(); - pQTC->qWnd->show(); - HB_QTC_UNLOCK(); + if( fShow ) + { + HB_QTC_LOCK(); + pQTC->qWnd->show(); + HB_QTC_UNLOCK(); + } } } @@ -2041,7 +2045,7 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { pQTC->fMaximized = ! pQTC->fMaximized; if( pQTC->qWnd ) - hb_gt_qtc_setWindowState( pQTC, Qt::WindowMaximized, pQTC->fMaximized ); + hb_gt_qtc_setWindowState( pQTC, Qt::WindowMaximized, pQTC->fMaximized, HB_TRUE ); } break; @@ -2054,7 +2058,7 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { pQTC->fFullScreen = ! pQTC->fFullScreen; if( pQTC->qWnd ) - hb_gt_qtc_setWindowState( pQTC, Qt::WindowFullScreen, pQTC->fFullScreen ); + hb_gt_qtc_setWindowState( pQTC, Qt::WindowFullScreen, pQTC->fFullScreen, HB_TRUE ); } break; @@ -2064,6 +2068,19 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pQTC->fAltEnter = hb_itemGetL( pInfo->pNewVal ); break; + case HB_GTI_MINIMIZED: + if( pQTC->qWnd ) + pQTC->fMinimized = ( pQTC->qWnd->windowState() & Qt::WindowMinimized ) != 0; + pInfo->pResult = hb_itemPutL( pInfo->pResult, pQTC->fMinimized ); + if( pInfo->pNewVal && HB_IS_LOGICAL( pInfo->pNewVal ) && + ( hb_itemGetL( pInfo->pNewVal ) ? ! pQTC->fMinimized : pQTC->fMinimized ) ) + { + pQTC->fMinimized = ! pQTC->fMinimized; + if( pQTC->qWnd ) + hb_gt_qtc_setWindowState( pQTC, Qt::WindowMinimized, pQTC->fMinimized, ! pQTC->fMinimized ); + } + break; + case HB_GTI_CLOSABLE: pInfo->pResult = hb_itemPutL( pInfo->pResult, pQTC->iCloseMode == 0 ); if( pInfo->pNewVal && HB_IS_LOGICAL( pInfo->pNewVal ) && @@ -3267,7 +3284,7 @@ void QTConsole::keyPressEvent( QKeyEvent * event ) ( iFlags & HB_KF_KEYPAD ) == 0 ) { pQTC->fFullScreen = ( pQTC->qWnd->windowState() & Qt::WindowFullScreen ) == 0; - hb_gt_qtc_setWindowState( pQTC, Qt::WindowFullScreen, pQTC->fFullScreen ); + hb_gt_qtc_setWindowState( pQTC, Qt::WindowFullScreen, pQTC->fFullScreen, HB_TRUE ); return; } iKey = HB_KX_ENTER; @@ -3520,10 +3537,12 @@ QTCWindow::QTCWindow( PHB_GTQTC pQTC ) */ resize( pQTC->cellX * pQTC->iCols, pQTC->cellY * pQTC->iRows ); - if( pQTC->fMaximized ) - setWindowState( windowState() | Qt::WindowMaximized ); if( pQTC->fFullScreen ) setWindowState( windowState() | Qt::WindowFullScreen ); + else if( pQTC->fMaximized ) + setWindowState( windowState() | Qt::WindowMaximized ); + else if( pQTC->fMinimized ) + setWindowState( windowState() | Qt::WindowMinimized ); if( pQTC->qIcon ) setWindowIcon( *pQTC->qIcon ); diff --git a/contrib/hbblat/hbblat.hbp b/contrib/hbblat/hbblat.hbp index c9fbc83887..d3d3d4afe3 100644 --- a/contrib/hbblat/hbblat.hbp +++ b/contrib/hbblat/hbblat.hbp @@ -7,7 +7,7 @@ -stop{!win} --depoptional=blat:yes +-depoptional=blat:yes{!hbdyn} -depkeyhead=blat:blat.h -depcontrol=blat:${HB_WITH_BLAT} -depimplibs=blat:../blat.dll diff --git a/contrib/hbnetio/netiocli.c b/contrib/hbnetio/netiocli.c index 5260cf47cd..6799b47648 100644 --- a/contrib/hbnetio/netiocli.c +++ b/contrib/hbnetio/netiocli.c @@ -1231,11 +1231,11 @@ static HB_BOOL s_netio_procexec( int iMsg, int iType ) iMsg != NETIO_PROC, HB_FALSE ); if( fResult && ( iMsg == NETIO_FUNC || iMsg == NETIO_FUNCCTRL ) ) { - HB_SIZE nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] ); + HB_SIZE nResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] ), nRecv = 0; if( nResult > 0 ) { - PHB_ITEM pItem; + PHB_ITEM pItem = NULL; if( nResult > size && buffer ) { @@ -1244,14 +1244,12 @@ static HB_BOOL s_netio_procexec( int iMsg, int iType ) } if( buffer == NULL ) buffer = ( char * ) hb_xgrab( nResult ); - if( nResult == ( HB_SIZE ) s_fileRecvAll( conn, buffer, ( long ) nResult ) ) + nRecv = s_fileRecvAll( conn, buffer, ( long ) nResult ); + if( nResult == nRecv ) { data = buffer; pItem = hb_itemDeserialize( &data, &nResult ); } - else - pItem = NULL; - if( pItem ) { if( iMsg == NETIO_FUNCCTRL ) @@ -1265,8 +1263,14 @@ static HB_BOOL s_netio_procexec( int iMsg, int iType ) } else { - conn->errcode = NETIO_ERR_WRONG_PARAM; - hb_errRT_NETIO( EG_CORRUPTION, 1008, 0, NULL, HB_ERR_FUNCNAME ); + HB_ERRCODE errOsCode = 0; + + if( nResult != nRecv ) + conn->errcode = errOsCode = hb_socketGetError(); + else + conn->errcode = NETIO_ERR_WRONG_PARAM; + + hb_errRT_NETIO( EG_CORRUPTION, 1008, errOsCode, NULL, HB_ERR_FUNCNAME ); } } } @@ -1644,16 +1648,14 @@ static PHB_ITEM s_fileDirectory( PHB_FILE_FUNCS pFuncs, const char * pszDirSpec, hb_fsSetError( errCode ); if( pDirArray == NULL ) { - if( nRecv != nResult ) - { - conn->errcode = hb_socketGetError(); - hb_errRT_NETIO( EG_CORRUPTION, 1013, 0, NULL, HB_ERR_FUNCNAME ); - } + HB_ERRCODE errOsCode = 0; + + if( nResult != nRecv ) + conn->errcode = errOsCode = hb_socketGetError(); else - { conn->errcode = NETIO_ERR_WRONG_PARAM; - hb_errRT_NETIO( EG_CORRUPTION, 1013, 0, NULL, HB_ERR_FUNCNAME ); - } + + hb_errRT_NETIO( EG_CORRUPTION, 1013, errOsCode, NULL, HB_ERR_FUNCNAME ); } } if( pBuffer ) @@ -2055,7 +2057,7 @@ static char * s_fileLinkRead( PHB_FILE_FUNCS pFuncs, const char * pszFileName ) if( nRecv != nResult ) { conn->errcode = hb_socketGetError(); - hb_errRT_NETIO( EG_CORRUPTION, 1014, 0, NULL, HB_ERR_FUNCNAME ); + hb_errRT_NETIO( EG_CORRUPTION, 1014, conn->errcode, NULL, HB_ERR_FUNCNAME ); } hb_fsSetError( errCode ); } @@ -2488,7 +2490,7 @@ static HB_BOOL s_fileConfigure( PHB_FILE pFile, int iIndex, PHB_ITEM pValue ) if( nRecv != nResult ) { pFile->conn->errcode = hb_socketGetError(); - hb_errRT_NETIO( EG_CORRUPTION, 1015, 0, NULL, HB_ERR_FUNCNAME ); + hb_errRT_NETIO( EG_CORRUPTION, 1015, pFile->conn->errcode, NULL, HB_ERR_FUNCNAME ); fResult = HB_FALSE; } } diff --git a/include/hbgtinfo.ch b/include/hbgtinfo.ch index 4f027f7049..071b8a6d9d 100644 --- a/include/hbgtinfo.ch +++ b/include/hbgtinfo.ch @@ -152,6 +152,7 @@ #define HB_GTI_REDRAWMAX 72 /* Maximum number of unchanged neighboring chars in redrawn line */ #define HB_GTI_RESIZESTEP 73 /* Enable/Disable window resizing steps */ #define HB_GTI_CLOSEMODE 74 /* Close event: 0 terminate application, >=1 generate HB_K_CLOSE, 2 disable close button */ +#define HB_GTI_MINIMIZED 75 /* Get/Set Window's Minimized status (supported by: GTQTC, GTXWC) */ /* Font weights */ #define HB_GTI_FONTW_THIN 1 diff --git a/src/rtl/gtxwc/gtxwc.c b/src/rtl/gtxwc/gtxwc.c index 9643f55144..373f8db232 100644 --- a/src/rtl/gtxwc/gtxwc.c +++ b/src/rtl/gtxwc/gtxwc.c @@ -116,6 +116,9 @@ static Atom s_atomCutBuffer0; static Atom s_atomText; static Atom s_atomCompoundText; static Atom s_atomFullScreen; +static Atom s_atomMaximizedX; +static Atom s_atomMaximizedY; +static Atom s_atomActivate; static Atom s_atomState; static Atom s_atomMotifHints; static Atom s_atomFrameExtends; @@ -153,7 +156,7 @@ typedef struct Window window; GC gc; Colormap colorsmap; - WND_COLORS colors[16]; + WND_COLORS colors[ 16 ]; Pixmap pm; Drawable drw; @@ -192,6 +195,8 @@ typedef struct int iCloseMode; HB_BOOL fResizable; HB_BOOL fFullScreen; + HB_BOOL fMaximized; + HB_BOOL fMinimized; HB_BOOL fAltEnter; /* mark & copy */ @@ -2489,6 +2494,43 @@ static void hb_gt_xwc_FullScreen( PXWND_DEF wnd ) SubstructureRedirectMask, &evt ); } +static void hb_gt_xwc_MaximizeScreen( PXWND_DEF wnd ) +{ + XEvent evt; + + memset( &evt, 0, sizeof( evt ) ); + evt.xclient.type = ClientMessage; + evt.xclient.message_type = s_atomState; + evt.xclient.display = wnd->dpy; + evt.xclient.window = wnd->window; + evt.xclient.format = 32; + evt.xclient.data.l[ 0 ] = wnd->fMaximized ? 1 : 0; + evt.xclient.data.l[ 1 ] = s_atomMaximizedX; + evt.xclient.data.l[ 2 ] = s_atomMaximizedY; + + XSendEvent( wnd->dpy, DefaultRootWindow( wnd->dpy ), False, + SubstructureRedirectMask, &evt ); +} + +/* after de-iconifying set input focus back */ +static void hb_gt_xwc_ActivateScreen( PXWND_DEF wnd ) +{ + XEvent evt; + + memset( &evt, 0, sizeof( evt ) ); + evt.xclient.type = ClientMessage; + evt.xclient.message_type = s_atomActivate; + evt.xclient.display = wnd->dpy; + evt.xclient.window = wnd->window; + evt.xclient.format = 32; + evt.xclient.data.l[ 0 ] = 1; + evt.xclient.data.l[ 1 ] = CurrentTime; + evt.xclient.data.l[ 2 ] = wnd->window; + + XSendEvent( wnd->dpy, DefaultRootWindow( wnd->dpy ), False, + SubstructureRedirectMask, &evt ); +} + /* *********************************************************************** */ /* X11 Motif WM Properties and Resources */ @@ -4472,6 +4514,8 @@ static PXWND_DEF hb_gt_xwc_CreateWndDef( PHB_GT pGT ) wnd->fResizable = HB_TRUE; wnd->fWinResize = HB_FALSE; wnd->fFullScreen = HB_FALSE; + wnd->fMaximized = HB_FALSE; + wnd->fMinimized = HB_FALSE; wnd->fAltEnter = HB_FALSE; #if defined( HB_XWC_USE_LOCALE ) wnd->fUTF8key = hb_gt_xwc_isUTF8(); @@ -4554,6 +4598,9 @@ static HB_BOOL hb_gt_xwc_ConnectX( PXWND_DEF wnd, HB_BOOL fExit ) s_atomText = XInternAtom( wnd->dpy, "TEXT", False ); s_atomCompoundText = XInternAtom( wnd->dpy, "COMPOUND_TEXT", False ); s_atomFullScreen = XInternAtom( wnd->dpy, "_NET_WM_STATE_FULLSCREEN", False ); + s_atomMaximizedY = XInternAtom( wnd->dpy, "_NET_WM_STATE_MAXIMIZED_VERT", False ); + s_atomMaximizedX = XInternAtom( wnd->dpy, "_NET_WM_STATE_MAXIMIZED_HORZ", False ); + s_atomActivate = XInternAtom( wnd->dpy, "_NET_ACTIVE_WINDOW", False ); s_atomState = XInternAtom( wnd->dpy, "_NET_WM_STATE", False ); s_atomMotifHints = XInternAtom( wnd->dpy, "_MOTIF_WM_HINTS", False ); s_atomFrameExtends = XInternAtom( wnd->dpy, "_NET_FRAME_EXTENTS", False ); @@ -4746,6 +4793,10 @@ static void hb_gt_xwc_CreateWindow( PXWND_DEF wnd ) hb_gt_xwc_FullScreen( wnd ); wnd->fResizable = HB_TRUE; } + else if( wnd->fMinimized ) + XIconifyWindow( wnd->dpy, wnd->window, DefaultScreen( wnd->dpy ) ); + else if( wnd->fMaximized ) + hb_gt_xwc_MaximizeScreen( wnd ); else if( wnd->iNewPosX >= 0 && wnd->iNewPosY >= 0 ) XMoveWindow( wnd->dpy, wnd->window, wnd->iNewPosX, wnd->iNewPosY ); @@ -5293,6 +5344,8 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) hb_strfree( hString ); wnd->fDspTitle = HB_TRUE; + if( wnd->window ) + hb_gt_xwc_ProcessMessages( wnd, HB_FALSE ); } break; @@ -5367,6 +5420,41 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) wnd->fAltEnter = hb_itemGetL( pInfo->pNewVal ); break; + case HB_GTI_MAXIMIZED: + pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->fMaximized ); + if( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL ) + { + if( hb_itemGetL( pInfo->pNewVal ) != wnd->fMaximized ) + { + wnd->fMaximized = hb_itemGetL( pInfo->pNewVal ); + if( wnd->fInit ) + hb_gt_xwc_MaximizeScreen( wnd ); + } + } + break; + + case HB_GTI_MINIMIZED: + pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->fMinimized ); + if( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL ) + { + if( hb_itemGetL( pInfo->pNewVal ) != wnd->fMinimized ) + { + wnd->fMinimized = hb_itemGetL( pInfo->pNewVal ); + if( wnd->fInit ) + { + if( wnd->fMinimized ) + XIconifyWindow( wnd->dpy, wnd->window, DefaultScreen( wnd->dpy ) ); + else + { + XMapWindow( wnd->dpy, wnd->window ); + XRaiseWindow( wnd->dpy, wnd->window ); + hb_gt_xwc_ActivateScreen( wnd ); + } + } + } + } + break; + case HB_GTI_CLOSABLE: pInfo->pResult = hb_itemPutL( pInfo->pResult, wnd->iCloseMode == 0 ); if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_LOGICAL ) &&