src/video/haiku/SDL_BWin.h
changeset 13235 7e53f9a1d5e4
parent 13233 9dfa95a693ba
child 13306 c51961094960
     1.1 --- a/src/video/haiku/SDL_BWin.h	Mon Nov 11 22:18:21 2019 -0500
     1.2 +++ b/src/video/haiku/SDL_BWin.h	Mon Nov 11 22:21:17 2019 -0500
     1.3 @@ -319,22 +319,17 @@
     1.4                  && msg->FindInt32("be:transit", &transit) == B_OK) {
     1.5                  _MouseMotionEvent(where, transit);
     1.6              }
     1.7 +            break;
     1.8  
     1.9 -            /* FIXME: Apparently a button press/release event might be dropped
    1.10 -               if made before before a different button is released.  Does
    1.11 -               B_MOUSE_MOVED have the data needed to check if a mouse button
    1.12 -               state has changed? */
    1.13 +        case B_MOUSE_DOWN:
    1.14              if (msg->FindInt32("buttons", &buttons) == B_OK) {
    1.15 -                _MouseButtonEvent(buttons);
    1.16 +                _MouseButtonEvent(buttons, SDL_PRESSED);
    1.17              }
    1.18              break;
    1.19  
    1.20 -        case B_MOUSE_DOWN:
    1.21          case B_MOUSE_UP:
    1.22 -            /* _MouseButtonEvent() detects any and all buttons that may have
    1.23 -               changed state, as well as that button's new state */
    1.24              if (msg->FindInt32("buttons", &buttons) == B_OK) {
    1.25 -                _MouseButtonEvent(buttons);
    1.26 +                _MouseButtonEvent(buttons, SDL_RELEASED);
    1.27              }
    1.28              break;
    1.29  
    1.30 @@ -497,26 +492,17 @@
    1.31   if true:  SDL_SetCursor(NULL); */
    1.32      }
    1.33  
    1.34 -    void _MouseButtonEvent(int32 buttons) {
    1.35 +    void _MouseButtonEvent(int32 buttons, Uint8 state) {
    1.36          int32 buttonStateChange = buttons ^ _last_buttons;
    1.37  
    1.38 -        /* Make sure at least one button has changed state */
    1.39 -        if( !(buttonStateChange) ) {
    1.40 -            return;
    1.41 -        }
    1.42 -
    1.43 -        /* Add any mouse button events */
    1.44          if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
    1.45 -            _SendMouseButton(SDL_BUTTON_LEFT, buttons &
    1.46 -                B_PRIMARY_MOUSE_BUTTON);
    1.47 +            _SendMouseButton(SDL_BUTTON_LEFT, state);
    1.48          }
    1.49          if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
    1.50 -            _SendMouseButton(SDL_BUTTON_RIGHT, buttons &
    1.51 -                B_PRIMARY_MOUSE_BUTTON);
    1.52 +            _SendMouseButton(SDL_BUTTON_RIGHT, state);
    1.53          }
    1.54          if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
    1.55 -            _SendMouseButton(SDL_BUTTON_MIDDLE, buttons &
    1.56 -                B_PRIMARY_MOUSE_BUTTON);
    1.57 +            _SendMouseButton(SDL_BUTTON_MIDDLE, state);
    1.58          }
    1.59  
    1.60          _last_buttons = buttons;