Logo Search packages:      
Sourcecode: zbar version File versions  Download package

int zbar_processor_user_wait ( zbar_processor_t processor,
int  timeout 
)

wait for input to the display window from the user (via mouse or keyboard).

Returns:
>0 when input is received, 0 if timeout ms expired with no input or -1 in case of an error

Definition at line 563 of file processor.c.

References ZBAR_ERR_CLOSED, and zbar_processor_user_wait().

Referenced by zbar::Processor::user_wait(), and zbar_processor_user_wait().

{
    proc_enter(proc);
    _zbar_mutex_unlock(&proc->mutex);

    int rc = -1;
    if(proc->visible || proc->streaming || timeout >= 0) {
        zbar_timer_t timer;
        rc = _zbar_processor_wait(proc, EVENT_INPUT,
                                  _zbar_timer_init(&timer, timeout));
    }

    if(!proc->visible)
        rc = err_capture(proc, SEV_WARNING, ZBAR_ERR_CLOSED, __func__,
                         "display window not available for input");

    if(rc > 0)
        rc = proc->input;

    _zbar_mutex_lock(&proc->mutex);
    proc_leave(proc);
    return(rc);
}


Generated by  Doxygen 1.6.0   Back to index