mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-02 15:16:46 +00:00
GUI: Fix keymap of virtual keyboard if no GUI opened before (#2555)
This commit is contained in:
parent
90d9540ad8
commit
e7132897fd
@ -24,6 +24,7 @@
|
||||
|
||||
#ifdef ENABLE_VKEYBD
|
||||
|
||||
#include "gui/gui-manager.h"
|
||||
#include "backends/vkeybd/virtual-keyboard.h"
|
||||
|
||||
#include "backends/keymapper/keymapper.h"
|
||||
@ -223,6 +224,21 @@ void VirtualKeyboard::handleMouseUp(int16 x, int16 y) {
|
||||
_kbdGUI->endDrag();
|
||||
}
|
||||
|
||||
// If no GUI opened before the virtual keyboard, kKeymapTypeGui is not yet initialized
|
||||
// Check and do it if needed
|
||||
void VirtualKeyboard::initKeymap() {
|
||||
using namespace Common;
|
||||
|
||||
Keymapper *mapper = _system->getEventManager()->getKeymapper();
|
||||
|
||||
// Do not try to recreate same keymap over again
|
||||
if (mapper->getKeymap(kGuiKeymapName) != 0)
|
||||
return;
|
||||
|
||||
Keymap *guiMap = g_gui.getKeymap();
|
||||
mapper->addGlobalKeymap(guiMap);
|
||||
}
|
||||
|
||||
void VirtualKeyboard::show() {
|
||||
if (!_loaded) {
|
||||
debug(1, "VirtualKeyboard::show() - Virtual keyboard not loaded");
|
||||
@ -234,6 +250,7 @@ void VirtualKeyboard::show() {
|
||||
switchMode(_initialMode);
|
||||
|
||||
{
|
||||
initKeymap();
|
||||
KeymapTypeEnabler guiKeymap(_system->getEventManager()->getKeymapper(), Keymap::kKeymapTypeGui);
|
||||
_kbdGUI->run();
|
||||
}
|
||||
|
@ -242,6 +242,7 @@ protected:
|
||||
bool checkModeResolutions();
|
||||
void switchMode(Mode *newMode);
|
||||
void switchMode(const String &newMode);
|
||||
void initKeymap();
|
||||
void handleMouseDown(int16 x, int16 y);
|
||||
void handleMouseUp(int16 x, int16 y);
|
||||
String findArea(int16 x, int16 y);
|
||||
|
Loading…
Reference in New Issue
Block a user