Ticket #9153: bug_2978736.patch

File bug_2978736.patch, 1.9 KB (added by Pidgeot, 14 years ago)

Patch for bug 2978736

  • backends/platform/sdl/events.cpp

     
    340340                event.kbd.flags |= Common::KBD_SCRL;
    341341
    342342        if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
    343                 // Swallow these key up events
    344                 return false;
     343                if (isScalerHotkey(ev.key))
     344                        // Swallow these key up events
     345                        return false;
    345346        }
    346347
    347348        return true;
  • backends/platform/sdl/graphics.cpp

     
    20022002                return false;
    20032003        }
    20042004}
     2005
     2006bool OSystem_SDL::isScalerHotkey(const SDL_KeyboardEvent &key) {
     2007        const bool isNormalNumber = (SDLK_1 <= key.keysym.sym && key.keysym.sym <= SDLK_9);
     2008        const bool isKeypadNumber = (SDLK_KP1 <= key.keysym.sym && key.keysym.sym <= SDLK_KP9);
     2009        const bool isScaleKey = (key.keysym.sym == SDLK_EQUALS || key.keysym.sym == SDLK_PLUS || key.keysym.sym == SDLK_MINUS ||
     2010                key.keysym.sym == SDLK_KP_PLUS || key.keysym.sym == SDLK_KP_MINUS);
     2011        if (isNormalNumber || isKeypadNumber) {
     2012                int keyValue = key.keysym.sym - (isNormalNumber ? SDLK_1 : SDLK_KP1);
     2013                if (keyValue >= ARRAYSIZE(s_gfxModeSwitchTable))
     2014                        return false;
     2015        }
     2016        return (isScaleKey || key.keysym.sym == 'a');
     2017}
  • backends/platform/sdl/sdl.h

     
    490490        virtual bool remapKey(SDL_Event &ev, Common::Event &event);
    491491
    492492        bool handleScalerHotkeys(const SDL_KeyboardEvent &key);
     493        bool isScalerHotkey(const SDL_KeyboardEvent &key);
    493494};
    494495
    495496#endif