Esempio n. 1
0
void tm_saveevent( void )
/***********************/
{
    int i;
    int c;

    if( new_sample ) {
        tm_error();
        return;
    }
    switch( MouseType ) {
        case M_XT:
            for( i = 0; i < 3; ++i ) {
                c = nextc( 10 );
                if( c == -1 ) {
                    tm_error();
                    return;
                }
                buf[i] = c;
            }
            if( i == MAXBUF ) tm_error();
            buf[i+1] = '\0';
            break;
#ifdef __LINUX__
        case M_GPM: {
            /* start with the old gpm structure without wdx/wdy */
            static size_t gpm_buf_size = sizeof gpm_buf - 4;
            i = read( UIMouseHandle, &gpm_buf, gpm_buf_size );
            if( i < gpm_buf_size ) {
                if( i == 4 )
                    gpm_buf_size = 28;
                tm_error();
                return;
            }
            break;
        }
#endif
        default :
            break;
    }
    new_sample = 1;
}
Esempio n. 2
0
void tm_saveevent( void )
/***********************/
{
    int i;
    int c;

    if( new_sample ) {
        tm_error();
        return;
    }
    switch( MouseType ) {
    case M_NONE:
        /* eat the remainder of the version ID response. */
        for( ;; ) {
            c = nextc( 20 );
            if( c == -1 ) return;
            if( c == 't' ) break;
        }
        if( strstr( GetTermType(), "qnx" ) != 0 ) {
            DoMouseInit( M_QW, QNX_HDR QW_INIT, QNX_HDR "3" );
        } else {
            DoMouseInit( M_AW, ANSI_HDR QW_INIT, ANSI_HDR "3" );
        }
        return;
    case M_QW:
    case M_AW:
        for( i = 0; i < MAXBUF; ++i ) {
            c = nextc( 20 );
            if( c == -1 ) {
               tm_error();
               return;
            }
            buf[i] = c;
            if( buf[i] == 't' ) break;
            if( buf[i] == '\x1b' ) {
                tm_error();
                c = nextc( 20 );
                if( c == -1 ) {
                    tm_error();
                    return;
                }
                i = 0;
            }
        }
        break;
    case M_XT:
        for( i = 0; i < 3; ++i ) {
            c = nextc( 10 );
            if( c == -1 ) {
                tm_error();
                return;
            }
            buf[i] = c;
        }
        break;
    }
    if( i == MAXBUF ) tm_error();
    buf[i+1] = '\0';
    new_sample = 1;
}