src/video/haiku/SDL_BWin.h
changeset 13235 7e53f9a1d5e4
parent 13233 9dfa95a693ba
child 13306 c51961094960
equal deleted inserted replaced
13234:c6c5c0c9ad2b 13235:7e53f9a1d5e4
   317             int32 transit;
   317             int32 transit;
   318             if (msg->FindPoint("where", &where) == B_OK
   318             if (msg->FindPoint("where", &where) == B_OK
   319                 && msg->FindInt32("be:transit", &transit) == B_OK) {
   319                 && msg->FindInt32("be:transit", &transit) == B_OK) {
   320                 _MouseMotionEvent(where, transit);
   320                 _MouseMotionEvent(where, transit);
   321             }
   321             }
   322 
   322             break;
   323             /* FIXME: Apparently a button press/release event might be dropped
   323 
   324                if made before before a different button is released.  Does
   324         case B_MOUSE_DOWN:
   325                B_MOUSE_MOVED have the data needed to check if a mouse button
       
   326                state has changed? */
       
   327             if (msg->FindInt32("buttons", &buttons) == B_OK) {
   325             if (msg->FindInt32("buttons", &buttons) == B_OK) {
   328                 _MouseButtonEvent(buttons);
   326                 _MouseButtonEvent(buttons, SDL_PRESSED);
   329             }
   327             }
   330             break;
   328             break;
   331 
   329 
   332         case B_MOUSE_DOWN:
       
   333         case B_MOUSE_UP:
   330         case B_MOUSE_UP:
   334             /* _MouseButtonEvent() detects any and all buttons that may have
       
   335                changed state, as well as that button's new state */
       
   336             if (msg->FindInt32("buttons", &buttons) == B_OK) {
   331             if (msg->FindInt32("buttons", &buttons) == B_OK) {
   337                 _MouseButtonEvent(buttons);
   332                 _MouseButtonEvent(buttons, SDL_RELEASED);
   338             }
   333             }
   339             break;
   334             break;
   340 
   335 
   341         case B_MOUSE_WHEEL_CHANGED:
   336         case B_MOUSE_WHEEL_CHANGED:
   342             float x, y;
   337             float x, y;
   495 /* FIXME: Why were these here?
   490 /* FIXME: Why were these here?
   496  if false: be_app->SetCursor(B_HAND_CURSOR);
   491  if false: be_app->SetCursor(B_HAND_CURSOR);
   497  if true:  SDL_SetCursor(NULL); */
   492  if true:  SDL_SetCursor(NULL); */
   498     }
   493     }
   499 
   494 
   500     void _MouseButtonEvent(int32 buttons) {
   495     void _MouseButtonEvent(int32 buttons, Uint8 state) {
   501         int32 buttonStateChange = buttons ^ _last_buttons;
   496         int32 buttonStateChange = buttons ^ _last_buttons;
   502 
   497 
   503         /* Make sure at least one button has changed state */
       
   504         if( !(buttonStateChange) ) {
       
   505             return;
       
   506         }
       
   507 
       
   508         /* Add any mouse button events */
       
   509         if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
   498         if(buttonStateChange & B_PRIMARY_MOUSE_BUTTON) {
   510             _SendMouseButton(SDL_BUTTON_LEFT, buttons &
   499             _SendMouseButton(SDL_BUTTON_LEFT, state);
   511                 B_PRIMARY_MOUSE_BUTTON);
       
   512         }
   500         }
   513         if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
   501         if(buttonStateChange & B_SECONDARY_MOUSE_BUTTON) {
   514             _SendMouseButton(SDL_BUTTON_RIGHT, buttons &
   502             _SendMouseButton(SDL_BUTTON_RIGHT, state);
   515                 B_PRIMARY_MOUSE_BUTTON);
       
   516         }
   503         }
   517         if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
   504         if(buttonStateChange & B_TERTIARY_MOUSE_BUTTON) {
   518             _SendMouseButton(SDL_BUTTON_MIDDLE, buttons &
   505             _SendMouseButton(SDL_BUTTON_MIDDLE, state);
   519                 B_PRIMARY_MOUSE_BUTTON);
       
   520         }
   506         }
   521 
   507 
   522         _last_buttons = buttons;
   508         _last_buttons = buttons;
   523     }
   509     }
   524 
   510