comparison src/video/quartz/SDL_QuartzEvents.m @ 897:9e27fdb98eab

Date: Tue, 11 May 2004 22:05:32 -0400 From: Bob Ippolito Subject: [SDL] SDL_QuartzWM patches I've sent in two small patches to SDL_QuartzWM directly to Sam over the past few months (well, I think I sent both anyway) and neither of them have been implemented. I didn't receive a response, so I'm sure he was just busy and/or they got lost, so I decided to sign up to the list and post them here. This patch rolls both of them together: - Mouse cursor becomes visible if hidden when it moves outside of the game window. If you want it to stay invisible you should warp it because if it's not warped a user might click some random other application! Commercial games behave in this way (or at least Warcraft III does, which is the only one that uses a custom mouse cursor and no warping that I've played in recent memory). - Right mouse button emulation is changed from Command-Click to Control-Click, which is how OS X behaves. Consider copyright assigned to whomever needs it under whichever license it needs to be under.. yadda yadda yadda.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 17 May 2004 00:16:24 +0000
parents 428f688f2ad2
children f221cadd6eda
comparison
equal deleted inserted replaced
896:b56dc586a5ef 897:9e27fdb98eab
470 switch (type) { 470 switch (type) {
471 case NSLeftMouseDown: 471 case NSLeftMouseDown:
472 if ( getenv("SDL_HAS3BUTTONMOUSE") ) { 472 if ( getenv("SDL_HAS3BUTTONMOUSE") ) {
473 DO_MOUSE_DOWN (SDL_BUTTON_LEFT); 473 DO_MOUSE_DOWN (SDL_BUTTON_LEFT);
474 } else { 474 } else {
475 if ( NSCommandKeyMask & current_mods ) { 475 if ( NSControlKeyMask & current_mods ) {
476 last_virtual_button = SDL_BUTTON_RIGHT; 476 last_virtual_button = SDL_BUTTON_RIGHT;
477 DO_MOUSE_DOWN (SDL_BUTTON_RIGHT); 477 DO_MOUSE_DOWN (SDL_BUTTON_RIGHT);
478 } 478 }
479 else if ( NSAlternateKeyMask & current_mods ) { 479 else if ( NSAlternateKeyMask & current_mods ) {
480 last_virtual_button = SDL_BUTTON_MIDDLE; 480 last_virtual_button = SDL_BUTTON_MIDDLE;
517 */ 517 */
518 break; 518 break;
519 case NSLeftMouseDragged: 519 case NSLeftMouseDragged:
520 case NSRightMouseDragged: 520 case NSRightMouseDragged:
521 case NSOtherMouseDragged: /* usually middle mouse dragged */ 521 case NSOtherMouseDragged: /* usually middle mouse dragged */
522 case NSMouseMoved: 522 case NSMouseMoved:
523 /* Show the cursor if it was hidden by SDL_ShowCursor() */
524 /* this is how games I've seen work */
525 if (!cursor_visible) {
526 if (!isInGameWin && cursor_hidden) {
527 ShowCursor();
528 cursor_hidden = NO;
529 } else if (isInGameWin && !cursor_hidden) {
530 HideCursor();
531 cursor_hidden = YES;
532 }
533 }
523 if ( grab_state == QZ_INVISIBLE_GRAB ) { 534 if ( grab_state == QZ_INVISIBLE_GRAB ) {
524 535
525 /* 536 /*
526 If input is grabbed+hidden, the cursor doesn't move, 537 If input is grabbed+hidden, the cursor doesn't move,
527 so we have to call the lowlevel window server 538 so we have to call the lowlevel window server
640 } while (event != nil); 651 } while (event != nil);
641 652
642 /* handle accumulated mouse moved events */ 653 /* handle accumulated mouse moved events */
643 if (dx != 0 || dy != 0) 654 if (dx != 0 || dy != 0)
644 SDL_PrivateMouseMotion (0, 1, dx, dy); 655 SDL_PrivateMouseMotion (0, 1, dx, dy);
645 656
646 [ pool release ]; 657 [ pool release ];
647 } 658 }