void ciomouse_gotevent(int event, int x, int y) { struct in_mouse_event *ime; while(!ciolib_mouse_initialized) SLEEP(1); ime=(struct in_mouse_event *)malloc(sizeof(struct in_mouse_event)); ime->ts=MSEC_CLOCK(); ime->event=event; ime->x=x; ime->y=y; ime->nextevent=NULL; listPushNode(&state.input,ime); }
JSRuntime * DLLCALL jsrt_GetNew(int maxbytes, unsigned long timeout, const char *filename, long line) { JSRuntime *ret; if(!initialized) { initialized=TRUE; pthread_mutex_init(&jsrt_mutex, NULL); listInit(&rt_list, 0); _beginthread(trigger_thread, TRIGGER_THREAD_STACK_SIZE, NULL); } pthread_mutex_lock(&jsrt_mutex); ret=JS_NewRuntime(maxbytes); listPushNode(&rt_list, ret); pthread_mutex_unlock(&jsrt_mutex); return ret; }
void add_outevent(int event, int x, int y) { struct out_mouse_event *ome; int but; if(!(mouse_events & 1<<event)) return; ome=(struct out_mouse_event *)malloc(sizeof(struct out_mouse_event)); but=CIOLIB_BUTTON_NUMBER(event); ome->event=event; ome->bstate=state.buttonstate; ome->kbsm=state.knownbuttonstatemask; ome->startx=but?state.button_x[but-1]:state.curx; ome->starty=but?state.button_y[but-1]:state.cury; ome->endx=x; ome->endy=y; ome->nextevent=(struct out_mouse_event *)NULL; listPushNode(&state.output,ome); }