Ticket #36070: 3777.diff
File 3777.diff, 1.8 KB (added by domiman@…, 12 years ago) |
---|
-
src/gui/sdlmain.cpp
246 246 SDL_WM_SetCaption(title,VERSION); 247 247 } 248 248 249 static void KillSwitch(bool pressed) { 250 if (!pressed) 251 return; 252 throw 1; 253 } 254 249 255 static void PauseDOSBox(bool pressed) { 250 256 if (!pressed) 251 257 return; … … 262 268 SDL_WaitEvent(&event); // since we're not polling, cpu usage drops to 0. 263 269 switch (event.type) { 264 270 265 case SDL_QUIT: throw(0); break;271 case SDL_QUIT: KillSwitch(true); break; 266 272 case SDL_KEYDOWN: // Must use Pause/Break Key to resume. 267 273 case SDL_KEYUP: 268 if(event.key.keysym.sym ==SDLK_PAUSE) {274 if(event.key.keysym.sym == SDLK_PAUSE) { 269 275 270 paused =false;276 paused = false; 271 277 GFX_SetTitle(-1,-1,false); 272 278 break; 273 279 } 280 #if defined (MACOSX) 281 if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod == KMOD_RMETA || event.key.keysym.mod == KMOD_LMETA) ) { 282 /* On macs, all aps exit when pressing cmd-q */ 283 KillSwitch(true); 284 break; 285 } 286 #endif 274 287 } 275 288 } 276 289 } … … 991 1004 if (sdl.desktop.fullscreen) GFX_SwitchFullScreen(); 992 1005 } 993 1006 994 static void KillSwitch(bool pressed) {995 if (!pressed)996 return;997 throw 1;998 }999 1007 1000 1008 static void SetPriority(PRIORITY_LEVELS level) { 1001 1009 … … 1513 1521 if (((event.key.keysym.sym==SDLK_TAB)) && 1514 1522 ((sdl.laltstate==SDL_KEYDOWN) || (sdl.raltstate==SDL_KEYDOWN))) break; 1515 1523 #endif 1524 #if defined (MACOSX) 1525 case SDL_KEYDOWN: 1526 case SDL_KEYUP: 1527 /* On macs CMD-Q is the default key to close an application */ 1528 if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod == KMOD_RMETA || event.key.keysym.mod == KMOD_LMETA) ) { 1529 KillSwitch(true); 1530 break; 1531 } 1532 #endif 1516 1533 default: 1517 1534 void MAPPER_CheckEvent(SDL_Event * event); 1518 1535 MAPPER_CheckEvent(&event);