Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4054 → Rev 4055

/branches/dd/uspace/app/tetris/input.c
57,7 → 57,8
#include "tetris.h"
 
#include <async.h>
#include "../../srv/console/console.h"
#include <ipc/console.h>
#include <kbd/kbd.h>
 
/* return true iff the given timeval is positive */
#define TV_POS(tv) \
96,6 → 97,7
struct timeval starttv, endtv, *s;
static ipc_call_t charcall;
ipcarg_t rc;
int cons_phone;
 
/*
* Someday, select() will do this for us.
110,8 → 112,12
s = NULL;
 
if (!lastchar) {
if (!getchar_inprog)
getchar_inprog = async_send_2(1,CONSOLE_GETCHAR,0,0,&charcall);
again:
if (!getchar_inprog) {
cons_phone = get_console_phone();
getchar_inprog = async_send_2(cons_phone,
CONSOLE_GETKEY, 0, 0, &charcall);
}
if (!s)
async_wait_for(getchar_inprog, &rc);
else if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) {
123,7 → 129,10
if (rc) {
stop("end of file, help");
}
lastchar = IPC_GET_ARG1(charcall);
if (IPC_GET_ARG1(charcall) == KE_RELEASE)
goto again;
 
lastchar = IPC_GET_ARG4(charcall);
}
if (tvp) {
/* since there is input, we may not have timed out */