mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
KEYMAPPER: Move F7 and F8 handling to DefaultEventMapper
This commit is contained in:
parent
cfe91c8d44
commit
3f6d549b0e
@ -102,39 +102,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
|
||||
_currentKeyDown.flags = event.kbd.flags;
|
||||
_keyRepeatTime = time + kKeyRepeatInitialDelay;
|
||||
|
||||
// Global Main Menu
|
||||
if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_F5) {
|
||||
//do nothing - EventMapper handles this case for us
|
||||
}
|
||||
#ifdef ENABLE_VKEYBD
|
||||
else if (event.kbd.keycode == Common::KEYCODE_F7 && event.kbd.hasFlags(0)) {
|
||||
if (_vk->isDisplaying()) {
|
||||
_vk->close(true);
|
||||
} else {
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(true);
|
||||
_vk->show();
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(false);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
else if (event.kbd.keycode == Common::KEYCODE_F8 && event.kbd.hasFlags(0)) {
|
||||
if (!_remap) {
|
||||
_remap = true;
|
||||
Common::RemapDialog _remapDialog;
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(true);
|
||||
_remapDialog.runModal();
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(false);
|
||||
_remap = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (event.kbd.keycode == Common::KEYCODE_BACKSPACE) {
|
||||
if (event.kbd.keycode == Common::KEYCODE_BACKSPACE) {
|
||||
// WORKAROUND: Some engines incorrectly attempt to use the
|
||||
// ascii value instead of the keycode to detect the backspace
|
||||
// key (a non-portable behavior). This fails at least on
|
||||
@ -188,7 +156,34 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
|
||||
else if (_shouldRTL)
|
||||
event.type = Common::EVENT_RTL;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
case Common::EVENT_VIRTUAL_KEYBOARD:
|
||||
if (_vk->isDisplaying()) {
|
||||
_vk->close(true);
|
||||
} else {
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(true);
|
||||
_vk->show();
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(false);
|
||||
result = false;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_KEYMAPPER
|
||||
case Common::EVENT_KEYMAPPER_REMAP:
|
||||
if (!_remap) {
|
||||
_remap = true;
|
||||
Common::RemapDialog _remapDialog;
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(true);
|
||||
_remapDialog.runModal();
|
||||
if (g_engine)
|
||||
g_engine->pauseEngine(false);
|
||||
_remap = false;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case Common::EVENT_RTL:
|
||||
if (ConfMan.getBool("confirm_exit")) {
|
||||
if (g_engine)
|
||||
|
@ -286,11 +286,13 @@ static void setupKeymapper(OSystem &system) {
|
||||
act = new Action(primaryGlobalKeymap, "SKLI", _("Skip line"));
|
||||
act->addKeyEvent(KeyState(KEYCODE_PERIOD, '.', 0));
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
act = new Action(primaryGlobalKeymap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType);
|
||||
act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
|
||||
act->addEvent(EVENT_VIRTUAL_KEYBOARD);
|
||||
#endif
|
||||
|
||||
act = new Action(primaryGlobalKeymap, "REMP", _("Remap keys"), kKeyRemapActionType);
|
||||
act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0));
|
||||
act->addEvent(EVENT_KEYMAPPER_REMAP);
|
||||
|
||||
act = new Action(primaryGlobalKeymap, "FULS", _("Toggle FullScreen"));
|
||||
act->addKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT));
|
||||
|
@ -27,13 +27,25 @@ namespace Common {
|
||||
List<Event> DefaultEventMapper::mapEvent(const Event &ev, EventSource *source) {
|
||||
List<Event> 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;
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -118,11 +118,13 @@ void GuiManager::initKeymap() {
|
||||
act = new Action(guiMap, "CLIK", _("Mouse click"), kLeftClickActionType);
|
||||
act->addLeftClickEvent();
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
act = new Action(guiMap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType);
|
||||
act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
|
||||
act->addEvent(EVENT_VIRTUAL_KEYBOARD);
|
||||
#endif
|
||||
|
||||
act = new Action(guiMap, "REMP", _("Remap keys"), kKeyRemapActionType);
|
||||
act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0));
|
||||
act->addEvent(EVENT_KEYMAPPER_REMAP);
|
||||
|
||||
act = new Action(guiMap, "FULS", _("Toggle FullScreen"));
|
||||
act->addKeyEvent(KeyState(KEYCODE_RETURN, ASCII_RETURN, KBD_ALT));
|
||||
|
Loading…
x
Reference in New Issue
Block a user