/* * Button click code call that is from the button interrupt code * with interrupts off */ void b_click(WORD state) { /* ignore it unless it represents a change */ if (state != gl_btrue) { /* see if we've already set up a wait */ if (gl_bdely) { /* if the change is into the desired state, increment cnt */ if (state == gl_bdesired) { gl_bclick++; gl_bdely += 3; } } else { /* * if someone cares about multiple clicks and this is not * a null mouse then set up delay else just fork it */ if (gl_bpend && state) { /* start click cnt at 1, establish desired state and set wait flag */ gl_bclick = 1; gl_bdesired = state; gl_bdely = gl_dclick; /* button delay set in ev_dclick() */ } else forkq(bchange, MAKE_ULONG(state, 1)); } /* update true state of the mouse */ gl_btrue = state; } }
/* * Button delay code that is called from the tick interrupt code * with interrupts off */ void b_delay(WORD amnt) { /* see if we have a delay for mouse click in progress */ if (gl_bdely) { /* see if decrementing delay cnt causes delay to be over */ gl_bdely -= amnt; if (!gl_bdely) { forkq(bchange, MAKE_ULONG(gl_bdesired, gl_bclick)); if (gl_bdesired != gl_btrue) { forkq(bchange, MAKE_ULONG(gl_btrue, 1)); } } } }
void chkkbd(void) { register WORD achar, kstat; /* poll keybd */ if (!gl_play) { kstat = gsx_kstate(); achar = gsx_char(); if (achar && (gl_mowner->p_cda->c_q.c_cnt >= KBD_SIZE)) { achar = 0x0; /* buffer overrun */ sound(TRUE, 880, 2); } if ( (achar) || (kstat != kstate) ) { cli(); forkq( (void (*)())kchange, (((LONG)achar<<16)|kstat) ); sti(); } } }