diff --git a/include/video.h b/include/video.h index 40656bc0..980f5410 100644 --- a/include/video.h +++ b/include/video.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: video.h,v 1.24 2008-02-21 19:25:04 c2woody Exp $ */ + #ifndef DOSBOX_VIDEO_H #define DOSBOX_VIDEO_H @@ -66,6 +68,7 @@ void GFX_SwitchFullScreen(void); bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch); void GFX_EndUpdate( const Bit16u *changedLines ); void GFX_GetSize(int &width, int &height, bool &fullscreen); +void GFX_LosingFocus(void); #if defined (WIN32) bool GFX_SDLUsingWinDIB(void); diff --git a/src/gui/sdl_gui.cpp b/src/gui/sdl_gui.cpp index 4197ff59..b54375e3 100644 --- a/src/gui/sdl_gui.cpp +++ b/src/gui/sdl_gui.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdl_gui.cpp,v 1.5 2008-02-10 11:14:03 qbix79 Exp $ */ +/* $Id: sdl_gui.cpp,v 1.6 2008-02-21 19:25:34 c2woody Exp $ */ #include "SDL.h" #include "../libs/gui_tk/gui_tk.h" @@ -95,7 +95,7 @@ static GUI::ScreenSDL *UI_Startup(GUI::ScreenSDL *screen) { if(!screen) { //Coming from DOSBox. Clean up the keyboard buffer. KEYBOARD_ClrBuffer();//Clear buffer } - MAPPER_LosingFocus();//Release any keys pressed (buffer gets filled again). (could be in above if, but clearing the mapper input when exiting the mapper is sensible as well + GFX_LosingFocus();//Release any keys pressed (buffer gets filled again). (could be in above if, but clearing the mapper input when exiting the mapper is sensible as well SDL_Delay(500); // Comparable to the code of intro.com, but not the same! (the code of intro.com is called from within a com file) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 1a39209e..2514653b 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdlmain.cpp,v 1.140 2008-02-10 18:55:23 qbix79 Exp $ */ +/* $Id: sdlmain.cpp,v 1.141 2008-02-21 19:25:34 c2woody Exp $ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -211,6 +211,9 @@ struct SDL_Block { #if defined (WIN32) bool using_windib; #endif + // state of alt-keys for certain special handlings + Bit8u laltstate; + Bit8u raltstate; }; static SDL_Block sdl; @@ -1159,8 +1162,11 @@ static void HandleMouseButton(SDL_MouseButtonEvent * button) { } } -static Bit8u laltstate = SDL_KEYUP; -static Bit8u raltstate = SDL_KEYUP; +void GFX_LosingFocus(void) { + sdl.laltstate=SDL_KEYUP; + sdl.raltstate=SDL_KEYUP; + MAPPER_LosingFocus(); +} void GFX_Events() { SDL_Event event; @@ -1194,7 +1200,7 @@ void GFX_Events() { GFX_CaptureMouse(); } SetPriority(sdl.priority.nofocus); - MAPPER_LosingFocus(); + GFX_LosingFocus(); CPU_Enable_SkipAutoAdjust(); } } @@ -1266,10 +1272,10 @@ void GFX_Events() { case SDL_KEYDOWN: case SDL_KEYUP: // ignore event alt+tab - if (event.key.keysym.sym==SDLK_LALT) laltstate = event.key.type; - if (event.key.keysym.sym==SDLK_RALT) raltstate = event.key.type; + if (event.key.keysym.sym==SDLK_LALT) sdl.laltstate = event.key.type; + if (event.key.keysym.sym==SDLK_RALT) sdl.raltstate = event.key.type; if (((event.key.keysym.sym==SDLK_TAB)) && - ((laltstate==SDL_KEYDOWN) || (raltstate==SDL_KEYDOWN))) break; + ((sdl.laltstate==SDL_KEYDOWN) || (sdl.raltstate==SDL_KEYDOWN))) break; #endif default: void MAPPER_CheckEvent(SDL_Event * event); @@ -1382,6 +1388,9 @@ int main(int argc, char* argv[]) { if( SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0 ) LOG_MSG("Failed to init joystick support"); #endif + sdl.laltstate = SDL_KEYUP; + sdl.raltstate = SDL_KEYUP; + #if defined (WIN32) #if SDL_VERSION_ATLEAST(1, 2, 10) sdl.using_windib=true;