Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6802 in orxonox.OLD for trunk/src/lib/event


Ignore:
Timestamp:
Jan 28, 2006, 10:20:47 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: eventHandler releases mouse on alt-Tab, and recaptures it on mouse-click on the Window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/event/event_handler.cc

    r6771 r6802  
    5252  this->keyMapper = NULL;
    5353  this->stateStack = NULL;
    54 
     54  this->eventsGrabbed = false;
    5555}
    5656
     
    361361int EventHandler::eventFilter(const SDL_Event *event)
    362362{
    363   if (event->type == SDL_KEYDOWN &&  event->key.keysym.sym == SDLK_TAB && SDL_GetKeyState(NULL)[SDLK_LALT])
    364   {
    365     printf("Not sending event to the WindowManager\n");
    366 
    367     EventHandler::getInstance()->grabEvents(false);
    368     return 0;
    369   }
     363  if (likely(EventHandler::getInstance()->eventsGrabbed))
     364  {
     365    if (event->type == SDL_KEYDOWN &&  event->key.keysym.sym == SDLK_TAB && SDL_GetKeyState(NULL)[SDLK_LALT])
     366    {
     367      PRINTF(3)("Not sending event to the WindowManager\n");
     368      EventHandler::getInstance()->grabEvents(false);
     369      return 0;
     370    }
     371  }
     372  else
     373  {
     374    if (event->type == SDL_MOUSEBUTTONDOWN)
     375    {
     376      EventHandler::getInstance()->grabEvents( true);
     377      return 0;
     378    }
     379  }
     380
    370381  return 1;
    371382}
Note: See TracChangeset for help on using the changeset viewer.