src/dosmouse.c
/************************************************************************/
/*                                                                      */
/*                  M o u s e B u t t o n S i g n a l                   */
/*                                                                      */
/*  Tell LISP about a mouse event by putting an entry on the ring buf-  */
/*  fer of mouse/kbd events, with the new mouse-button state in it.     */
/*                                                                      */
/*                                                                      */
/************************************************************************/
M o u s e B u t t o n S i g n a l

Tell LISP about a mouse event by putting an entry on the ring buf
fer of mouse/kbd events, with the new mouse-button state in it.
M o u s e B u t t o n S i g n a l Tell LISP about a mouse event by putting an entry on the ring buf fer of mouse / kbd events with the new mouse - button state in it .
void MouseButtonSignal(MouseInterface mouse)
{
  DLword w, r;
  KBEVENT *kbevent;
  PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_LEFT, !mouse->Button.Left);
  PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_MIDDLE, !mouse->Button.Middle);
  PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_RIGHT, !mouse->Button.Right);
  r = CTopKeyevent->ring.vectorindex.read;
  w = CTopKeyevent->ring.vectorindex.write;
  if (r != w) {
    kbevent = (KBEVENT *)((DLword *)CTopKeyevent + w);
    kbevent->W0 = IOPage68K->dlkbdad0;
    kbevent->W1 = IOPage68K->dlkbdad1;
    kbevent->W2 = IOPage68K->dlkbdad2;
    kbevent->W3 = IOPage68K->dlkbdad3;
    kbevent->W4 = IOPage68K->dlkbdad4;
    kbevent->W5 = IOPage68K->dlkbdad5;
    kbevent->WU = IOPage68K->dlutilin;
    if (r == 0) CTopKeyevent->ring.vectorindex.read = w;
    if (w >= mouse->maxkeyevent)
      CTopKeyevent->ring.vectorindex.write = MINKEYEVENT;
    else
      CTopKeyevent->ring.vectorindex.write += mouse->keyeventsize;
  }
  if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
  KBDEventFlg++; 
  Irq_Stk_Check = 0;
  Irq_Stk_End = 0;
}
void MouseButtonSignal ( MouseInterface mouse ) { DLword w , r ; KBEVENT * kbevent ; PUTBASEBIT68K ( & ( IOPage68K -> dlutilin ) , MOUSE_LEFT , ! mouse -> Button . Left ) ; PUTBASEBIT68K ( & ( IOPage68K -> dlutilin ) , MOUSE_MIDDLE , ! mouse -> Button . Middle ) ; PUTBASEBIT68K ( & ( IOPage68K -> dlutilin ) , MOUSE_RIGHT , ! mouse -> Button . Right ) ; r = CTopKeyevent -> ring . vectorindex . read ; w = CTopKeyevent -> ring . vectorindex . write ; if ( r != w ) { kbevent = ( KBEVENT * ) ( ( DLword * ) CTopKeyevent + w ) ; kbevent -> W0 = IOPage68K -> dlkbdad0 ; kbevent -> W1 = IOPage68K -> dlkbdad1 ; kbevent -> W2 = IOPage68K -> dlkbdad2 ; kbevent -> W3 = IOPage68K -> dlkbdad3 ; kbevent -> W4 = IOPage68K -> dlkbdad4 ; kbevent -> W5 = IOPage68K -> dlkbdad5 ; kbevent -> WU = IOPage68K -> dlutilin ; if ( r == 0 ) CTopKeyevent -> ring . vectorindex . read = w ; if ( w >= mouse -> maxkeyevent ) CTopKeyevent -> ring . vectorindex . write = MINKEYEVENT ; else CTopKeyevent -> ring . vectorindex . write += mouse -> keyeventsize ; } if ( * KEYBUFFERING68k == NIL ) * KEYBUFFERING68k = ATOM_T ; KBDEventFlg ++ ; Irq_Stk_Check = 0 ; Irq_Stk_End = 0 ; }
M o u s e B u t t o n S i g n a l
M o u s e B u t t o n S i g n a l
/* In the mouse device TRUE means button pressed */ /* In the IOPage 0 means button pressed          */ /* Hence the ! in the lines below.               */ /* Copy the Hardware bits. */ /* If queue was empty, update the read pointer */ /* Update the write pointer */ /* Signal the emulator to tell Lisp */