From 3f6d549b0e891be33ef48926629d6e626009fc8f Mon Sep 17 00:00:00 2001 From: Tarek Soliman Date: Sat, 18 Feb 2012 22:17:48 -0600 Subject: KEYMAPPER: Move F7 and F8 handling to DefaultEventMapper --- common/EventMapper.cpp | 22 +++++++++++++++++----- common/events.h | 7 ++++++- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'common') diff --git a/common/EventMapper.cpp b/common/EventMapper.cpp index 6af27b8371..2808a7b5fd 100644 --- a/common/EventMapper.cpp +++ b/common/EventMapper.cpp @@ -27,13 +27,25 @@ namespace Common { List DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) { List events; Event mappedEvent; - if (ev.type == EVENT_KEYDOWN && ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F5) { - mappedEvent.type = EVENT_MAINMENU; + if (ev.type == EVENT_KEYDOWN) { + if (ev.kbd.hasFlags(KBD_CTRL) && ev.kbd.keycode == KEYCODE_F5) { + mappedEvent.type = EVENT_MAINMENU; + } +#ifdef ENABLE_VKEYBD + else if (ev.kbd.keycode == KEYCODE_F7 && ev.kbd.hasFlags(0)) { + mappedEvent.type = EVENT_VIRTUAL_KEYBOARD; + } +#endif +#ifdef ENABLE_KEYMAPPER + else if (ev.kbd.keycode == KEYCODE_F8 && ev.kbd.hasFlags(0)) { + mappedEvent.type = EVENT_KEYMAPPER_REMAP; + } +#endif } - else { - // just pass it through + + // if it didn't get mapped, just pass it through + if (mappedEvent.type == EVENT_INVALID) mappedEvent = ev; - } events.push_back(mappedEvent); return events; } diff --git a/common/events.h b/common/events.h index 5e539f072e..69cca9b54a 100644 --- a/common/events.h +++ b/common/events.h @@ -78,7 +78,12 @@ enum EventType { , // IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use // this, please talk to tsoliman and/or LordHoto. - EVENT_CUSTOM_BACKEND = 18 + EVENT_CUSTOM_BACKEND = 18, + EVENT_KEYMAPPER_REMAP = 19 +#endif +#ifdef ENABLE_VKEYBD + , + EVENT_VIRTUAL_KEYBOARD = 20 #endif }; -- cgit v1.2.3