trying to fix alt-tab issue in windows

This commit is contained in:
Mark Vejvoda 2011-11-02 21:20:11 +00:00
parent 70c5edea8d
commit cdb38730d9
1 changed files with 42 additions and 19 deletions

View File

@ -243,13 +243,54 @@ bool Window::handleEvent() {
break;
case SDL_ACTIVEEVENT:
{
// codeLocation = "k";
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",__FILE__,__FUNCTION__,__LINE__,event.active.state,event.active.gain);
//
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
//
// // Check if the program has lost window focus
// if ((event.active.state & SDL_APPACTIVE) == SDL_APPACTIVE) {
// if (event.active.gain == 0) {
// Window::isActive = false;
// }
// else {
// Window::isActive = true;
// }
//
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
//
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
//
// bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
// showCursor(willShowCursor);
// }
// // Check if the program has lost window focus
// if ((event.active.state & SDL_APPMOUSEFOCUS) != SDL_APPMOUSEFOCUS &&
// (event.active.state & SDL_APPINPUTFOCUS) != SDL_APPINPUTFOCUS &&
// (event.active.state & SDL_APPACTIVE) != SDL_APPACTIVE) {
// if (event.active.gain == 0) {
// Window::isActive = false;
// }
// //else if (event.active.gain == 1) {
// else {
// Window::isActive = true;
// }
//
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
//
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
// bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
// showCursor(willShowCursor);
// }
// }
codeLocation = "k";
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",__FILE__,__FUNCTION__,__LINE__,event.active.state,event.active.gain);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
// Check if the program has lost window focus
if ((event.active.state & SDL_APPACTIVE) == SDL_APPACTIVE) {
if ((event.active.state & (SDL_APPACTIVE | SDL_APPINPUTFOCUS))) {
if (event.active.gain == 0) {
Window::isActive = false;
}
@ -264,24 +305,6 @@ bool Window::handleEvent() {
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
showCursor(willShowCursor);
}
// Check if the program has lost window focus
if ((event.active.state & SDL_APPMOUSEFOCUS) != SDL_APPMOUSEFOCUS &&
(event.active.state & SDL_APPINPUTFOCUS) != SDL_APPINPUTFOCUS &&
(event.active.state & SDL_APPACTIVE) != SDL_APPACTIVE) {
if (event.active.gain == 0) {
Window::isActive = false;
}
//else if (event.active.gain == 1) {
else {
Window::isActive = true;
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
showCursor(willShowCursor);
}
}
break;
}