Skip to content
Browse files

KEYMAPPER: Move CTRL-F5 handling to DefaultEventMapper

  • Loading branch information...
1 parent 3c918bb commit cfe91c8d444b8535c30d6766821ee4eeb4108b07 @tsoliman tsoliman committed Feb 18, 2012
Showing with 10 additions and 31 deletions.
  1. +1 −29 backends/events/default/default-events.cpp
  2. +9 −2 common/EventMapper.cpp
View
30 backends/events/default/default-events.cpp
@@ -104,35 +104,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
// Global Main Menu
if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_F5) {
- if (g_engine && !g_engine->isPaused()) {
- Common::Event menuEvent;
- menuEvent.type = Common::EVENT_MAINMENU;
-
- // FIXME: GSoC RTL branch passes the F6 key event to the
- // engine, and also enqueues a EVENT_MAINMENU. For now,
- // we just drop the key event and return an EVENT_MAINMENU
- // instead. This way, we don't have to add special cases
- // to engines (like it was the case for LURE in the RTL branch).
- //
- // However, this has other consequences, possibly negative ones.
- // Like, what happens with key repeat for the trigger key?
-
- //pushEvent(menuEvent);
- event = menuEvent;
-
- // FIXME: Since now we do not push another MAINMENU event onto
- // our event stack, the GMM would never open, so we have to do
- // that here. Of course when the engine would handle MAINMENU
- // as an event now and open up the GMM itself it would open the
- // menu twice.
- if (g_engine && !g_engine->isPaused())
- g_engine->openMainMenuDialog();
-
- if (_shouldQuit)
- event.type = Common::EVENT_QUIT;
- else if (_shouldRTL)
- event.type = Common::EVENT_RTL;
- }
+ //do nothing - EventMapper handles this case for us
}
#ifdef ENABLE_VKEYBD
else if (event.kbd.keycode == Common::KEYCODE_F7 && event.kbd.hasFlags(0)) {
View
11 common/EventMapper.cpp
@@ -26,8 +26,15 @@ namespace Common {
List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
List<Event> events;
- // just pass it through
- events.push_back(ev);
+ Event mappedEvent;
+ if (ev.type == EVENT_KEYDOWN && ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F5) {
+ mappedEvent.type = EVENT_MAINMENU;
+ }
+ else {
+ // just pass it through
+ mappedEvent = ev;
+ }
+ events.push_back(mappedEvent);
return events;
}

0 comments on commit cfe91c8

Please sign in to comment.
Something went wrong with that request. Please try again.