Exemplo n.º 1
0
/* get event from the queue but leave it there */
PMSNHEvent
mswin_input_peek()
{
    PMSNHEvent retval;

#ifdef SAFERHANGUP
    /* always return ESC when hangup was requested */
    if (program_state.done_hup) {
        static MSNHEvent hangup_event;
        hangup_event.type = NHEVENT_CHAR;
        hangup_event.kbd.ch = '\033';
        return &hangup_event;
    }
#endif

    if (!nhi_init_input)
        mswin_nh_input_init();

    if (nhi_read_pos != nhi_write_pos) {
        retval = &nhi_input_buffer[nhi_read_pos];
    } else {
        retval = NULL;
    }
    return retval;
}
Exemplo n.º 2
0
/* get event from the queue but leave it there */
PMSNHEvent mswin_input_peek(void)
{
    PMSNHEvent retval;

    if( !nhi_init_input ) mswin_nh_input_init();

    if( nhi_read_pos!=nhi_write_pos ) {
        retval = &nhi_input_buffer[nhi_read_pos];
    } else {
        retval = NULL;
    }
    return retval;
}
Exemplo n.º 3
0
/* add event to the queue */
void mswin_input_push(PMSNHEvent event)
{
    int new_write_pos;

    if( !nhi_init_input ) mswin_nh_input_init();

    new_write_pos = (nhi_write_pos+1) % NH_INPUT_BUFFER_SIZE;

    if(new_write_pos!=nhi_read_pos) {
        memcpy(nhi_input_buffer+nhi_write_pos, event, sizeof(*event));
        nhi_write_pos = new_write_pos;
    }

}
Exemplo n.º 4
0
/* get event from the queue and delete it */
PMSNHEvent mswin_input_pop(void)
{
    PMSNHEvent retval;

    if( !nhi_init_input ) mswin_nh_input_init();

    if( nhi_read_pos!=nhi_write_pos ) {
        retval = &nhi_input_buffer[nhi_read_pos];
        nhi_read_pos = (nhi_read_pos+1) % NH_INPUT_BUFFER_SIZE;
    } else {
        retval = NULL;
    }

    return retval;
}