src/dosmouse.c
/***************************************************************/
/*                 T w o B u t t o n H a n d l e r             */
/* This function is the interrupt handler for the mouse.       */
/* This function sets the state of the mouse structure and     */
/* signals the dispatch loop to take care of the matter. This  */
/* awkward solution is due to the severe braindamage in DOS.   */
/***************************************************************/
T w o B u t t o n H a n d l e r
This function is the interrupt handler for the mouse.
This function sets the state of the mouse structure and
signals the dispatch loop to take care of the matter. This
awkward solution is due to the severe braindamage in DOS.
T w o B u t t o n H a n d l e r This function is the interrupt handler for the mouse . This function sets the state of the mouse structure and signals the dispatch loop to take care of the matter . This awkward solution is due to the severe braindamage in DOS .
void TwoButtonHandler(void) {
  _XSTACK *stk_ptr;
  stk_ptr = (_XSTACK *)_get_stk_frame(); 
  stk_ptr->opts |= _STK_NOINT;           
  if (!currentmouse->device.active) return;
  if (stk_ptr->eax & LB_PRESS)
    if (currentmouse->Button.RunTimer) 
    {
      currentmouse->Button.RunTimer = FALSE;
      currentmouse->Button.FakeMiddle = TRUE;
      currentmouse->Button.Middle = TRUE;
      currentmouse->Button.StateLeft = TRUE;
      MouseButtonSignal(currentmouse);
    } else if (currentmouse->Button.Right) {
      currentmouse->Button.Left = TRUE;
      currentmouse->Button.StateLeft = TRUE;
      MouseButtonSignal(currentmouse);
    } else 
    {
      currentmouse->Button.StateLeft = TRUE;
      currentmouse->Button.tick = currentmouse->Button.StartTime;
      currentmouse->Button.RunTimer = TRUE;
    }
  if (stk_ptr->eax & LB_OFF)           
    if (currentmouse->Button.RunTimer) 
    {
      currentmouse->Button.RunTimer = FALSE;
      currentmouse->Button.Left = TRUE;
      MouseButtonSignal(currentmouse);
      currentmouse->Button.StateLeft = FALSE;
    } else 
    {
      currentmouse->Button.StateLeft = FALSE;
      currentmouse->Button.Left = FALSE;
      currentmouse->Button.FakeMiddle = FALSE;
      currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
      MouseButtonSignal(currentmouse);
    }
  if ((stk_ptr->eax & CB_PRESS) || (stk_ptr->eax & CB_OFF)) {
    currentmouse->Button.Middle =
        ((stk_ptr->eax & CB_PRESS) && TRUE) || currentmouse->Button.FakeMiddle;
    currentmouse->Button.StateMiddle = (stk_ptr->eax & CB_PRESS) && TRUE;
    currentmouse->Button.RunTimer = FALSE;
    MouseButtonSignal(currentmouse);
  }
  if (stk_ptr->eax & RB_PRESS)         
    if (currentmouse->Button.RunTimer) 
    {
      currentmouse->Button.RunTimer = FALSE;
      currentmouse->Button.FakeMiddle = TRUE;
      currentmouse->Button.Middle = TRUE;
      currentmouse->Button.StateRight = TRUE;
      MouseButtonSignal(currentmouse);
    } else if (currentmouse->Button.Left) {
      currentmouse->Button.Right = TRUE;
      currentmouse->Button.StateRight = TRUE;
      MouseButtonSignal(currentmouse);
    } else {
      currentmouse->Button.StateRight = TRUE;
      currentmouse->Button.tick = currentmouse->Button.StartTime;
      currentmouse->Button.RunTimer = TRUE;
    }
  if (stk_ptr->eax & RB_OFF)           
    if (currentmouse->Button.RunTimer) 
    {
      currentmouse->Button.RunTimer = FALSE;
      currentmouse->Button.Right = TRUE;
      MouseButtonSignal(currentmouse);
      currentmouse->Button.StateRight = FALSE;
    } else {
      currentmouse->Button.StateRight = FALSE;
      currentmouse->Button.Right = FALSE;
      currentmouse->Button.FakeMiddle = FALSE;
      currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
      MouseButtonSignal(currentmouse);
    }
  if ((stk_ptr->eax & MOUSE_MV) && (!currentdsp->device.locked)) {
    currentmouse->Button.RunTimer = FALSE;
    currentmouse->Cursor.Moved = TRUE;
    if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) {
      currentmouse->Button.Left = FALSE;
      currentmouse->Button.Right = FALSE;
      currentmouse->Button.Middle = TRUE;
    } else {
      currentmouse->Button.Left |= currentmouse->Button.StateLeft;
      currentmouse->Button.Right |= currentmouse->Button.StateRight;
    }
    currentmouse->Button.StateLeft = currentmouse->Button.StateRight = FALSE;
    MouseButtonSignal(currentmouse);
  }
}
void TwoButtonHandler ( void ) { _XSTACK * stk_ptr ; stk_ptr = ( _XSTACK * ) _get_stk_frame ( ) ; stk_ptr -> opts |= _STK_NOINT ; if ( ! currentmouse -> device . active ) return ; if ( stk_ptr -> eax & LB_PRESS ) if ( currentmouse -> Button . RunTimer ) { currentmouse -> Button . RunTimer = FALSE ; currentmouse -> Button . FakeMiddle = TRUE ; currentmouse -> Button . Middle = TRUE ; currentmouse -> Button . StateLeft = TRUE ; MouseButtonSignal ( currentmouse ) ; } else if ( currentmouse -> Button . Right ) { currentmouse -> Button . Left = TRUE ; currentmouse -> Button . StateLeft = TRUE ; MouseButtonSignal ( currentmouse ) ; } else { currentmouse -> Button . StateLeft = TRUE ; currentmouse -> Button . tick = currentmouse -> Button . StartTime ; currentmouse -> Button . RunTimer = TRUE ; } if ( stk_ptr -> eax & LB_OFF ) if ( currentmouse -> Button . RunTimer ) { currentmouse -> Button . RunTimer = FALSE ; currentmouse -> Button . Left = TRUE ; MouseButtonSignal ( currentmouse ) ; currentmouse -> Button . StateLeft = FALSE ; } else { currentmouse -> Button . StateLeft = FALSE ; currentmouse -> Button . Left = FALSE ; currentmouse -> Button . FakeMiddle = FALSE ; currentmouse -> Button . Middle = currentmouse -> Button . StateMiddle ; MouseButtonSignal ( currentmouse ) ; } if ( ( stk_ptr -> eax & CB_PRESS ) || ( stk_ptr -> eax & CB_OFF ) ) { currentmouse -> Button . Middle = ( ( stk_ptr -> eax & CB_PRESS ) && TRUE ) || currentmouse -> Button . FakeMiddle ; currentmouse -> Button . StateMiddle = ( stk_ptr -> eax & CB_PRESS ) && TRUE ; currentmouse -> Button . RunTimer = FALSE ; MouseButtonSignal ( currentmouse ) ; } if ( stk_ptr -> eax & RB_PRESS ) if ( currentmouse -> Button . RunTimer ) { currentmouse -> Button . RunTimer = FALSE ; currentmouse -> Button . FakeMiddle = TRUE ; currentmouse -> Button . Middle = TRUE ; currentmouse -> Button . StateRight = TRUE ; MouseButtonSignal ( currentmouse ) ; } else if ( currentmouse -> Button . Left ) { currentmouse -> Button . Right = TRUE ; currentmouse -> Button . StateRight = TRUE ; MouseButtonSignal ( currentmouse ) ; } else { currentmouse -> Button . StateRight = TRUE ; currentmouse -> Button . tick = currentmouse -> Button . StartTime ; currentmouse -> Button . RunTimer = TRUE ; } if ( stk_ptr -> eax & RB_OFF ) if ( currentmouse -> Button . RunTimer ) { currentmouse -> Button . RunTimer = FALSE ; currentmouse -> Button . Right = TRUE ; MouseButtonSignal ( currentmouse ) ; currentmouse -> Button . StateRight = FALSE ; } else { currentmouse -> Button . StateRight = FALSE ; currentmouse -> Button . Right = FALSE ; currentmouse -> Button . FakeMiddle = FALSE ; currentmouse -> Button . Middle = currentmouse -> Button . StateMiddle ; MouseButtonSignal ( currentmouse ) ; } if ( ( stk_ptr -> eax & MOUSE_MV ) && ( ! currentdsp -> device . locked ) ) { currentmouse -> Button . RunTimer = FALSE ; currentmouse -> Cursor . Moved = TRUE ; if ( currentmouse -> Button . StateLeft && currentmouse -> Button . StateRight ) { currentmouse -> Button . Left = FALSE ; currentmouse -> Button . Right = FALSE ; currentmouse -> Button . Middle = TRUE ; } else { currentmouse -> Button . Left |= currentmouse -> Button . StateLeft ; currentmouse -> Button . Right |= currentmouse -> Button . StateRight ; } currentmouse -> Button . StateLeft = currentmouse -> Button . StateRight = FALSE ; MouseButtonSignal ( currentmouse ) ; } }
T w o B u t t o n H a n d l e r
This function is the interrupt handler for the mouse.
T w o B u t t o n H a n d l e r This function is the interrupt handler for the mouse .
/* First save the stack frame. */ /* Get ptr to V86 _XSTACK frame */ /* Bypass real-mode handler */ /* Prior right-down seen... */ /* No other button down... */ /* Left button released, and */ /* Timer had been running */ /*  currentmouse->Button.Left = FALSE;
        MouseButtonSignal(currentmouse); */ /* timer wasn't running */ /* Right button pressed, and */ /* Timer was running... */ /* Right button released */ /* Timer had been running */ /*  currentmouse->Button.Right = FALSE;
        MouseButtonSignal(currentmouse); */ /* The dude moved the mouse. Set the chordstate NOW. */ /* And turn the timer off. */ /* Are L & R down? */ /*      if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight)
              {
                currentmouse->Button.Left = FALSE;
                currentmouse->Button.Right = FALSE;
                currentmouse->Button.Middle = TRUE;
              }
    */ /*   currentmouse->Cursor.New.x = (DLword)stk_ptr->ecx & 0xFFFF;
       currentmouse->Cursor.New.y = (DLword)stk_ptr->edx & 0xFFFF; */