Mercurial > sdl-ios-xcode
comparison src/video/quartz/SDL_QuartzEvents.m @ 816:428f688f2ad2
Date: Fri, 13 Feb 2004 17:03:16 +0100
From: Max Horn
Subject: Modifier key fix
The internal modifier state can get out of sync with reality. To
trigger this, do for example this:
1) Launch an SDL app
2) Alt-click on the desktop (this will hide the SDL app).
3) Bring the SDL app back to the front
4) SDL will still think alt is pressed (and as such will treat left
clicks like middle clicks). If you press and release alt, it'll be fine
again.
The attached patch cures this by rechecking the modifier state whenever
we process an event.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 13 Feb 2004 17:57:16 +0000 |
parents | dbc5905402b0 |
children | 9e27fdb98eab |
comparison
equal
deleted
inserted
replaced
815:6176f9a0d61a | 816:428f688f2ad2 |
---|---|
264 const int mapping[] = { SDLK_CAPSLOCK, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_LMETA }; | 264 const int mapping[] = { SDLK_CAPSLOCK, SDLK_LSHIFT, SDLK_LCTRL, SDLK_LALT, SDLK_LMETA }; |
265 | 265 |
266 int i; | 266 int i; |
267 int bit; | 267 int bit; |
268 SDL_keysym key; | 268 SDL_keysym key; |
269 | |
270 if (current_mods == newMods) | |
271 return; | |
269 | 272 |
270 key.scancode = 0; | 273 key.scancode = 0; |
271 key.sym = SDLK_UNKNOWN; | 274 key.sym = SDLK_UNKNOWN; |
272 key.unicode = 0; | 275 key.unicode = 0; |
273 key.mod = KMOD_NONE; | 276 key.mod = KMOD_NONE; |
460 } while(0) | 463 } while(0) |
461 | 464 |
462 type = [ event type ]; | 465 type = [ event type ]; |
463 isInGameWin = QZ_IsMouseInWindow (this); | 466 isInGameWin = QZ_IsMouseInWindow (this); |
464 | 467 |
468 QZ_DoModifiers(this, [ event modifierFlags ] ); | |
469 | |
465 switch (type) { | 470 switch (type) { |
466 case NSLeftMouseDown: | 471 case NSLeftMouseDown: |
467 if ( getenv("SDL_HAS3BUTTONMOUSE") ) { | 472 if ( getenv("SDL_HAS3BUTTONMOUSE") ) { |
468 DO_MOUSE_DOWN (SDL_BUTTON_LEFT); | 473 DO_MOUSE_DOWN (SDL_BUTTON_LEFT); |
469 } else { | 474 } else { |
611 break; | 616 break; |
612 case NSKeyDown: | 617 case NSKeyDown: |
613 QZ_DoKey (this, SDL_PRESSED, event); | 618 QZ_DoKey (this, SDL_PRESSED, event); |
614 break; | 619 break; |
615 case NSFlagsChanged: | 620 case NSFlagsChanged: |
616 QZ_DoModifiers(this, [ event modifierFlags ] ); | |
617 break; | 621 break; |
618 case NSAppKitDefined: | 622 case NSAppKitDefined: |
619 switch ( [ event subtype ] ) { | 623 switch ( [ event subtype ] ) { |
620 case NSApplicationActivatedEventType: | 624 case NSApplicationActivatedEventType: |
621 QZ_DoActivate (this); | 625 QZ_DoActivate (this); |