2016-01-05 10:04 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbapigt.h
  * src/rtl/gttrm/gttrm.c
    * modified GTTRM to generate HB_K_CLOSE if input stream is closed and
      then HB_K_TERMINATE on next inkey calls.
This commit is contained in:
Przemysław Czerpak
2016-01-05 10:04:37 +01:00
parent cd1baed369
commit c5758d9b83
3 changed files with 20 additions and 7 deletions

View File

@@ -10,6 +10,12 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2016-01-05 10:04 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbapigt.h
* src/rtl/gttrm/gttrm.c
* modified GTTRM to generate HB_K_CLOSE if input stream is closed and
then HB_K_TERMINATE on next inkey calls.
2016-01-04 23:55 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbgzio/gzio.c
* pacified warning

View File

@@ -356,6 +356,7 @@ extern HB_EXPORT int hb_inkeyKeyVal( int iKey ); /* extract key/chara
#define HB_INKEY_NEW_MPOS( x, y ) ( ( ( ( y ) & HB_INKEY_EXT_POSMASK ) << HB_INKEY_EXT_POSBITS ) | \
( ( x ) & HB_INKEY_EXT_POSMASK ) | \
( HB_INKEY_EXT_BIT | HB_INKEY_EXT_MOUSEPOS ) )
#define HB_INKEY_NEW_EVENT( e ) ( ( e ) | ( HB_INKEY_EXT_BIT | HB_INKEY_EXT_EVENT ) )
#define HB_INKEY_MOUSEPOSX( n ) ( ( n ) & HB_INKEY_EXT_POSMASK )
#define HB_INKEY_MOUSEPOSY( n ) ( ( ( n ) >> HB_INKEY_EXT_POSBITS ) & HB_INKEY_EXT_POSMASK )

View File

@@ -1085,7 +1085,7 @@ static int read_bufch( PHB_GTTRM pTerm, int fd )
static int get_inch( PHB_GTTRM pTerm, int milisec )
{
int nRet = 0, npfd = -1, nchk = pTerm->efds_no, lRead = 0;
int nRet = 0, nNext = 0, npfd = -1, nchk = pTerm->efds_no, lRead = 0;
int mode, i, n, counter;
struct timeval tv, * ptv;
evtFD * pefd = NULL;
@@ -1111,21 +1111,24 @@ static int get_inch( PHB_GTTRM pTerm, int milisec )
{
if( pTerm->event_fds[ i ]->status == EVTFDSTAT_RUN )
{
if( pTerm->event_fds[ i ]->mode == O_RDWR
|| pTerm->event_fds[ i ]->mode == O_RDONLY )
if( pTerm->event_fds[ i ]->mode == O_RDWR ||
pTerm->event_fds[ i ]->mode == O_RDONLY )
{
FD_SET( pTerm->event_fds[ i ]->fd, &rfds );
if( n < pTerm->event_fds[ i ]->fd )
n = pTerm->event_fds[ i ]->fd;
}
if( pTerm->event_fds[ i ]->mode == O_RDWR
|| pTerm->event_fds[ i ]->mode == O_WRONLY )
if( pTerm->event_fds[ i ]->mode == O_RDWR ||
pTerm->event_fds[ i ]->mode == O_WRONLY )
{
FD_SET( pTerm->event_fds[ i ]->fd, &wfds );
if( n < pTerm->event_fds[ i ]->fd )
n = pTerm->event_fds[ i ]->fd;
}
}
else if( pTerm->event_fds[ i ]->status == EVTFDSTAT_STOP &&
pTerm->event_fds[ i ]->eventFunc == NULL )
nNext = HB_INKEY_NEW_EVENT( HB_K_TERMINATE );
}
counter = pTerm->key_counter;
@@ -1142,7 +1145,10 @@ static int get_inch( PHB_GTTRM pTerm, int milisec )
lRead = 1;
n = read_bufch( pTerm, pTerm->event_fds[ i ]->fd );
if( n == 0 )
{
pTerm->event_fds[ i ]->status = EVTFDSTAT_STOP;
nRet = HB_INKEY_NEW_EVENT( HB_K_CLOSE );
}
}
else if( nRet == 0 && counter == pTerm->key_counter )
{
@@ -1201,7 +1207,7 @@ static int get_inch( PHB_GTTRM pTerm, int milisec )
pTerm->event_fds[ n++ ] = pefd;
pTerm->efds_no = n;
return nRet;
return nRet == 0 ? nNext : nRet;
}
static int test_bufch( PHB_GTTRM pTerm, int n, int delay )
@@ -3548,7 +3554,7 @@ static int hb_gt_trm_ReadKey( PHB_GT pGT, int iEventMask )
if( hb_gt_trm_getSize( HB_GTTRM_GET( pGT ), &iRows, &iCols ) )
{
HB_GTSELF_RESIZE( pGT, iRows, iCols );
iKey = HB_K_RESIZE;
iKey = HB_INKEY_NEW_EVENT( HB_K_RESIZE );
}
else
iKey = 0;