KEYMAPPER: Make the keymapper mandatory

This commit is contained in:
Bastien Bouclet 2017-08-14 17:28:19 +02:00
parent cc336635a1
commit 14663c4790
42 changed files with 14 additions and 331 deletions

View File

@ -57,14 +57,10 @@ DefaultEventManager::DefaultEventManager(Common::EventSource *boss) :
#ifdef ENABLE_VKEYBD
_vk = nullptr;
#endif
#ifdef ENABLE_KEYMAPPER
_keymapper = new Common::Keymapper(this);
// EventDispatcher will automatically free the keymapper
_dispatcher.registerMapper(_keymapper);
_remap = false;
#else
_dispatcher.registerMapper(new Common::DefaultEventMapper());
#endif
}
DefaultEventManager::~DefaultEventManager() {
@ -304,8 +300,6 @@ void DefaultEventManager::purgeMouseEvents() {
_eventQueue = filteredQueue;
}
#ifdef ENABLE_KEYMAPPER
Common::Keymap *DefaultEventManager::getGlobalKeymap() {
using namespace Common;
@ -345,6 +339,4 @@ Common::Keymap *DefaultEventManager::getGlobalKeymap() {
return globalKeymap;
}
#endif
#endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)

View File

@ -27,9 +27,7 @@
#include "common/queue.h"
namespace Common {
#ifdef ENABLE_KEYMAPPER
class Keymapper;
#endif
#ifdef ENABLE_VKEYBD
class VirtualKeyboard;
#endif
@ -41,10 +39,8 @@ class DefaultEventManager : public Common::EventManager, Common::EventObserver {
Common::VirtualKeyboard *_vk;
#endif
#ifdef ENABLE_KEYMAPPER
Common::Keymapper *_keymapper;
bool _remap;
#endif
Common::ArtificialEventSource _artificialEventSource;
@ -91,12 +87,8 @@ public:
virtual void resetQuit() override { _shouldQuit = false; }
#endif
#ifdef ENABLE_KEYMAPPER
// IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
// this, please talk to tsoliman and/or LordHoto.
Common::Keymapper *getKeymapper() override { return _keymapper; }
Common::Keymap *getGlobalKeymap() override;
#endif
/**
* Controls whether repeated key down events are generated while a key is pressed

View File

@ -61,7 +61,6 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
// SDLK_F7 -> zoom +
// SDLK_F8 -> zoom -
#ifdef ENABLE_KEYMAPPER
if (ev.type == SDL_KEYDOWN || ev.type == SDL_KEYUP) {
const KeymapEntry *entry;
for (entry = keymapEntries; entry->sym != SDLK_LAST; ++entry) {
@ -74,83 +73,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
}
}
}
#else
switch (ev.type) {
case SDL_KEYDOWN:{
if (ev.key.keysym.sym == SDLK_F4
|| (model.modelType == kModelTypeN900
&& ev.key.keysym.sym == SDLK_m
&& (ev.key.keysym.mod & KMOD_CTRL)
&& (ev.key.keysym.mod & KMOD_SHIFT))) {
event.type = Common::EVENT_MAINMENU;
debug(9, "remapping to main menu");
return true;
} else if (ev.key.keysym.sym == SDLK_F6) {
if (!model.hasHwKeyboard) {
#ifdef ENABLE_VKEYBD
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
debug(9, "remapping to virtual keyboard trigger");
return true;
#endif
} else {
// handled in keyup
}
} else if (ev.key.keysym.sym == SDLK_F7) {
event.type = Common::EVENT_RBUTTONDOWN;
processMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER);
debug(9, "remapping to right click down");
return true;
} else if (ev.key.keysym.sym == SDLK_F8) {
if (ev.key.keysym.mod & KMOD_CTRL) {
#ifdef ENABLE_VKEYBD
event.type = Common::EVENT_VIRTUAL_KEYBOARD;
debug(9, "remapping to virtual keyboard trigger");
return true;
#endif
} else {
// handled in keyup
return true;
}
}
break;
}
case SDL_KEYUP: {
if (ev.key.keysym.sym == SDLK_F4
|| (model.modelType == kModelTypeN900
&& ev.key.keysym.sym == SDLK_m
&& (ev.key.keysym.mod & KMOD_CTRL)
&& (ev.key.keysym.mod & KMOD_SHIFT))) {
event.type = Common::EVENT_MAINMENU;
return true;
} else if (ev.key.keysym.sym == SDLK_F6) {
if (!model.hasHwKeyboard) {
// handled in keydown
} else {
bool currentState = ((OSystem_SDL *)g_system)->getGraphicsManager()->getFeatureState(OSystem::kFeatureFullscreenMode);
g_system->beginGFXTransaction();
((OSystem_SDL *)g_system)->getGraphicsManager()->setFeatureState(OSystem::kFeatureFullscreenMode, !currentState);
g_system->endGFXTransaction();
debug(9, "remapping to full screen toggle");
return true;
}
} else if (ev.key.keysym.sym == SDLK_F7) {
event.type = Common::EVENT_RBUTTONUP;
processMouseEvent(event, _km.x / MULTIPLIER, _km.y / MULTIPLIER);
debug(9, "remapping to right click up");
return true;
} else if (ev.key.keysym.sym == SDLK_F8) {
if (ev.key.keysym.mod & KMOD_CTRL) {
// handled in key down
} else {
toggleClickMode();
debug(9, "remapping to click toggle");
return true;
}
}
break;
}
}
#endif
// Invoke parent implementation of this method
return SdlEventSource::remapKey(ev, event);
}
@ -189,7 +112,6 @@ MaemoSdlEventObserver::MaemoSdlEventObserver(MaemoSdlEventSource *eventSource) {
}
bool MaemoSdlEventObserver::notifyEvent(const Common::Event &event) {
#ifdef ENABLE_KEYMAPPER
if (event.type != Common::EVENT_CUSTOM_BACKEND_ACTION_START)
return false;
if (event.customType == kEventClickMode) {
@ -197,7 +119,6 @@ bool MaemoSdlEventObserver::notifyEvent(const Common::Event &event) {
_eventSource->toggleClickMode();
return true;
}
#endif
return false;
}

View File

@ -22,8 +22,6 @@
#include "backends/keymapper/action.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/keymap.h"
namespace Common {
@ -43,5 +41,3 @@ void Action::addDefaultInputMapping(const String &hwId) {
}
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -25,8 +25,6 @@
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/array.h"
#include "common/events.h"
#include "common/str.h"
@ -101,6 +99,4 @@ public:
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_ACTION_H

View File

@ -22,8 +22,6 @@
#include "backends/keymapper/hardware-input.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/keymapper.h"
namespace Common {
@ -303,6 +301,3 @@ void HardwareInputSet::addHardwareInputs(const KeyTableEntry keys[], const Modif
}
} //namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -25,9 +25,6 @@
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/array.h"
#include "common/hashmap.h"
#include "common/keyboard.h"
#include "common/str.h"
@ -160,6 +157,4 @@ private:
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_HARDWARE_KEY_H

View File

@ -22,8 +22,6 @@
#include "backends/keymapper/input-watcher.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymapper.h"
@ -84,5 +82,3 @@ const HardwareInput *InputWatcher::checkForCapturedInput() {
}
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -25,8 +25,6 @@
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/events.h"
namespace Common {
@ -64,6 +62,4 @@ private:
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_INPUT_WATCHER_H

View File

@ -22,8 +22,6 @@
#include "backends/keymapper/keymap.h"
#ifdef ENABLE_KEYMAPPER
#include "common/system.h"
#include "common/tokenizer.h"
@ -247,5 +245,3 @@ bool Keymap::areMappingsIdentical(const Array<const HardwareInput *> &inputs, co
}
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -25,8 +25,6 @@
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/config-manager.h"
#include "common/func.h"
#include "common/hashmap.h"
@ -152,6 +150,4 @@ private:
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_KEYMAP_H

View File

@ -20,8 +20,6 @@
*
*/
#ifdef ENABLE_KEYMAPPER
#ifndef KEYMAPPER_DEFAULTS_H
#define KEYMAPPER_DEFAULTS_H
@ -53,4 +51,3 @@ public:
} //namespace Common
#endif // #ifndef KEYMAPPER_DEFAULTS_H
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -22,8 +22,6 @@
#include "backends/keymapper/keymapper.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/action.h"
#include "backends/keymapper/hardware-input.h"
@ -257,5 +255,3 @@ const HardwareInput *Keymapper::findHardwareInput(const Event &event) {
}
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -25,8 +25,6 @@
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/keymap.h"
#include "common/array.h"
@ -152,6 +150,4 @@ private:
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_KEYMAPPER_H

View File

@ -22,8 +22,6 @@
#include "backends/keymapper/remap-widget.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/action.h"
#include "backends/keymapper/hardware-input.h"
#include "backends/keymapper/input-watcher.h"
@ -307,5 +305,3 @@ GUI::Widget *RemapWidget::findWidget(int x, int y) {
}
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -24,9 +24,6 @@
#define REMAP_WIDGET_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/hash-ptr.h"
#include "gui/widget.h"
@ -101,6 +98,4 @@ protected:
} // End of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef REMAP_WIDGET_H

View File

@ -8,6 +8,12 @@ MODULE_OBJS := \
events/default/default-events.o \
fs/abstract-fs.o \
fs/stdiostream.o \
keymapper/action.o \
keymapper/hardware-input.o \
keymapper/input-watcher.o \
keymapper/keymap.o \
keymapper/keymapper.o \
keymapper/remap-widget.o \
log/log.o \
midi/alsa.o \
midi/dmedia.o \
@ -101,16 +107,6 @@ MODULE_OBJS += \
plugins/elf/version.o
endif
ifdef ENABLE_KEYMAPPER
MODULE_OBJS += \
keymapper/action.o \
keymapper/hardware-input.o \
keymapper/input-watcher.o \
keymapper/keymap.o \
keymapper/keymapper.o \
keymapper/remap-widget.o
endif
ifdef ENABLE_VKEYBD
MODULE_OBJS += \
vkeybd/image-map.o \

View File

@ -36,11 +36,6 @@ public:
void switchToDirectMouseMode();
void switchToRelativeMouseMode();
void showOnScreenControl(bool enable);
#ifdef ENABLE_KEYMAPPER
// FIXME: This just calls parent methods, is it needed?
virtual Common::HardwareInputSet *getHardwareInputSet();
#endif
};
#endif

View File

@ -24,8 +24,6 @@
#include "backends/keymapper/keymapper.h"
#include "common/keyboard.h"
#ifdef ENABLE_KEYMAPPER
using namespace Common;
struct Key {
@ -109,4 +107,3 @@ static const Mod modifiers[] = {
Common::HardwareInputSet *OSystem_LINUXMOTO::getHardwareInputSet() {
return OSystem_SDL::getHardwareInputSet();
}
#endif

View File

@ -28,11 +28,6 @@
class OSystem_LINUXMOTO : public OSystem_POSIX {
public:
virtual void initBackend();
#ifdef ENABLE_KEYMAPPER
// FIXME: This just calls parent methods, is it needed?
virtual Common::HardwareInputSet *getHardwareInputSet();
#endif
};
#endif

View File

@ -45,12 +45,9 @@ OSystem_SDL_Maemo::OSystem_SDL_Maemo()
OSystem_SDL_Maemo::~OSystem_SDL_Maemo() {
delete _eventObserver;
#ifdef ENABLE_KEYMAPPER
delete _keymapperDefaultBindings;
#endif
}
#ifdef ENABLE_KEYMAPPER
static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymapperDefaultBindings, Model _model) {
_keymapperDefaultBindings->setDefaultBinding("gui", "REMP", "HOME");
_keymapperDefaultBindings->setDefaultBinding("global", "REMP", "HOME");
@ -78,7 +75,6 @@ static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymap
_keymapperDefaultBindings->setDefaultBinding("maemo", "RCLK", "ZOOMPLUS");
_keymapperDefaultBindings->setDefaultBinding("maemo", "CLKM", "ZOOMMINUS");
}
#endif
void OSystem_SDL_Maemo::init() {
// Use an iconless window for Maemo
@ -103,16 +99,12 @@ void OSystem_SDL_Maemo::initBackend() {
if (_eventObserver == 0)
_eventObserver = new MaemoSdlEventObserver((MaemoSdlEventSource *)_eventSource);
#ifdef ENABLE_KEYMAPPER
if (_keymapperDefaultBindings == 0)
_keymapperDefaultBindings = new Common::KeymapperDefaultBindings();
#endif
_model = detectModel();
#ifdef ENABLE_KEYMAPPER
registerDefaultKeyBindings(_keymapperDefaultBindings, _model);
#endif
// Call parent implementation of this method
OSystem_POSIX::initBackend();
@ -180,7 +172,6 @@ const Maemo::Model OSystem_SDL_Maemo::detectModel() {
return *model;
}
#ifdef ENABLE_KEYMAPPER
static const Common::KeyTableEntry maemoKeys[] = {
// Function keys
{"MENU", Common::KEYCODE_F11, "Menu"},
@ -223,7 +214,6 @@ Common::Keymap *OSystem_SDL_Maemo::getGlobalKeymap() {
return globalMap;
}
#endif
void OSystem_SDL_Maemo::initObserver() {
assert(_eventManager);

View File

@ -41,11 +41,9 @@ public:
virtual void quit();
virtual void fatalError();
virtual void setWindowCaption(const char *caption);
#ifdef ENABLE_KEYMAPPER
virtual Common::HardwareInputSet *getHardwareInputSet();
virtual Common::Keymap *getGlobalKeymap();
virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return _keymapperDefaultBindings; }
#endif
Model getModel() { return _model; }
@ -56,9 +54,7 @@ private:
const Model detectModel();
Model _model;
MaemoSdlEventObserver *_eventObserver;
#ifdef ENABLE_KEYMAPPER
Common::KeymapperDefaultBindings *_keymapperDefaultBindings;
#endif
};
} // namespace Maemo

View File

@ -171,9 +171,6 @@ namespace std
#define USE_ARM_COSTUME_ASM
#define USE_ARM_SOUND_ASM
#endif
// This is not really functioning yet.
// Default SDL keys should map to standard keys I think!
//#define ENABLE_KEYMAPPER
// Symbian bsearch implementation is flawed
void *scumm_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));

View File

@ -281,14 +281,12 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
}
#endif // USE_TRANSLATION
#ifdef ENABLE_KEYMAPPER
// Initialize any game-specific keymaps
Common::Keymap *gameKeymap = metaEngine.initKeymap(target.c_str());
Common::Keymapper *keymapper = system.getEventManager()->getKeymapper();
if (gameKeymap) {
keymapper->addGameKeymap(gameKeymap);
}
#endif
// Inform backend that the engine is about to be run
system.engineInit();
@ -300,9 +298,7 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common
system.engineDone();
// Clean up any game-specific keymaps
#ifdef ENABLE_KEYMAPPER
keymapper->cleanupGameKeymaps();
#endif
// Free up memory
delete engine;
@ -359,7 +355,6 @@ static void setupGraphics(OSystem &system) {
}
static void setupKeymapper(OSystem &system) {
#ifdef ENABLE_KEYMAPPER
using namespace Common;
Keymapper *mapper = system.getEventManager()->getKeymapper();
@ -382,8 +377,6 @@ static void setupKeymapper(OSystem &system) {
String platformGlobalKeymapName = platformGlobalKeymap->getName();
mapper->addGlobalKeymap(platformGlobalKeymap);
}
#endif
}
extern "C" int scummvm_main(int argc, const char * const argv[]) {

View File

@ -151,10 +151,6 @@ const char *gScummVMFeatures = ""
"PNG "
#endif
#ifdef ENABLE_KEYMAPPER
"keymapper "
#endif
#ifdef ENABLE_VKEYBD
"virtual keyboard "
#endif

View File

@ -75,13 +75,11 @@ List<Event> DefaultEventMapper::mapEvent(const Event &ev) {
if (mappedEvent.type == EVENT_INVALID)
mappedEvent = ev;
#ifdef ENABLE_KEYMAPPER
// TODO: this check is not needed post-split
if (mappedEvent.type == EVENT_CUSTOM_BACKEND_HARDWARE) {
warning("EVENT_CUSTOM_BACKEND_HARDWARE was not mapped");
return List<Event>();
}
#endif
events.push_back(mappedEvent);
return events;

View File

@ -41,9 +41,7 @@ DECLARE_SINGLETON(ConfigManager);
char const *const ConfigManager::kApplicationDomain = "scummvm";
char const *const ConfigManager::kTransientDomain = "__TRANSIENT";
#ifdef ENABLE_KEYMAPPER
char const *const ConfigManager::kKeymapperDomain = "keymapper";
#endif
#ifdef USE_CLOUD
char const *const ConfigManager::kCloudDomain = "cloud";
@ -68,9 +66,7 @@ void ConfigManager::copyFrom(ConfigManager &source) {
_miscDomains = source._miscDomains;
_appDomain = source._appDomain;
_defaultsDomain = source._defaultsDomain;
#ifdef ENABLE_KEYMAPPER
_keymapperDomain = source._keymapperDomain;
#endif
#ifdef USE_CLOUD
_cloudDomain = source._cloudDomain;
#endif
@ -124,10 +120,8 @@ void ConfigManager::addDomain(const String &domainName, const ConfigManager::Dom
return;
if (domainName == kApplicationDomain) {
_appDomain = domain;
#ifdef ENABLE_KEYMAPPER
} else if (domainName == kKeymapperDomain) {
_keymapperDomain = domain;
#endif
#ifdef USE_CLOUD
} else if (domainName == kCloudDomain) {
_cloudDomain = domain;
@ -168,9 +162,7 @@ void ConfigManager::loadFromStream(SeekableReadStream &stream) {
_transientDomain.clear();
_domainSaveOrder.clear();
#ifdef ENABLE_KEYMAPPER
_keymapperDomain.clear();
#endif
#ifdef USE_CLOUD
_cloudDomain.clear();
#endif
@ -282,10 +274,8 @@ void ConfigManager::flushToDisk() {
// Write the application domain
writeDomain(*stream, kApplicationDomain, _appDomain);
#ifdef ENABLE_KEYMAPPER
// Write the keymapper domain
writeDomain(*stream, kKeymapperDomain, _keymapperDomain);
#endif
#ifdef USE_CLOUD
// Write the cloud domain
writeDomain(*stream, kCloudDomain, _cloudDomain);
@ -373,10 +363,8 @@ const ConfigManager::Domain *ConfigManager::getDomain(const String &domName) con
return &_transientDomain;
if (domName == kApplicationDomain)
return &_appDomain;
#ifdef ENABLE_KEYMAPPER
if (domName == kKeymapperDomain)
return &_keymapperDomain;
#endif
#ifdef USE_CLOUD
if (domName == kCloudDomain)
return &_cloudDomain;
@ -397,10 +385,8 @@ ConfigManager::Domain *ConfigManager::getDomain(const String &domName) {
return &_transientDomain;
if (domName == kApplicationDomain)
return &_appDomain;
#ifdef ENABLE_KEYMAPPER
if (domName == kKeymapperDomain)
return &_keymapperDomain;
#endif
#ifdef USE_CLOUD
if (domName == kCloudDomain)
return &_cloudDomain;

View File

@ -89,10 +89,8 @@ public:
/** The transient (pseudo) domain. */
static char const *const kTransientDomain;
#ifdef ENABLE_KEYMAPPER
/** The name of keymapper domain used to store the key maps */
static char const *const kKeymapperDomain;
#endif
#ifdef USE_CLOUD
/** The name of cloud domain used to store user's tokens */
@ -189,9 +187,7 @@ private:
Domain _appDomain;
Domain _defaultsDomain;
#ifdef ENABLE_KEYMAPPER
Domain _keymapperDomain;
#endif
#ifdef USE_CLOUD
Domain _cloudDomain;

View File

@ -74,13 +74,10 @@ enum EventType {
**/
EVENT_PREDICTIVE_DIALOG = 12,
#ifdef ENABLE_KEYMAPPER
// 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_ACTION_START = 18,
EVENT_CUSTOM_BACKEND_ACTION_END = 19,
EVENT_CUSTOM_BACKEND_HARDWARE = 21,
#endif
#ifdef ENABLE_VKEYBD
EVENT_VIRTUAL_KEYBOARD = 20,
#endif
@ -169,11 +166,7 @@ struct Event {
*/
Point mouse;
#ifdef ENABLE_KEYMAPPER
// IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
// this, please talk to tsoliman and/or LordHoto.
CustomEventType customType;
#endif
/* The path of the file or directory dragged to the ScummVM window */
Common::String path;
@ -184,10 +177,7 @@ struct Event {
*/
JoystickState joystick;
Event() : type(EVENT_INVALID), kbdRepeat(false) {
#ifdef ENABLE_KEYMAPPER
customType = 0;
#endif
Event() : type(EVENT_INVALID), kbdRepeat(false), customType(0) {
}
};
@ -502,10 +492,9 @@ public:
// TODO: Consider removing OSystem::getScreenChangeID and
// replacing it by a generic getScreenChangeID method here
#ifdef ENABLE_KEYMAPPER
virtual Keymapper *getKeymapper() = 0;
virtual Keymap *getGlobalKeymap() = 0;
#endif
enum {
/**

View File

@ -58,11 +58,9 @@ class DialogManager;
class TimerManager;
class SeekableReadStream;
class WriteStream;
#ifdef ENABLE_KEYMAPPER
class HardwareInputSet;
class Keymap;
class KeymapperDefaultBindings;
#endif
class Encoding;
}
@ -1139,11 +1137,8 @@ public:
return _eventManager;
}
#ifdef ENABLE_KEYMAPPER
/**
* Register hardware inputs with keymapper
* IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
* this, please talk to tsoliman and/or LordHoto.
*
* @return HardwareInputSet with all keys and recommended mappings
*
@ -1153,8 +1148,6 @@ public:
/**
* Return a platform-specific global keymap
* IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
* this, please talk to tsoliman and/or LordHoto.
*
* @return Keymap with actions appropriate for the platform
*
@ -1166,15 +1159,12 @@ public:
/**
* Return platform-specific default keybindings
* IMPORTANT NOTE: This is part of the WIP Keymapper. If you plan to use
* this, please talk to tsoliman and/or LordHoto.
*
* @return KeymapperDefaultBindings populated with keybindings
*
* See keymapper documentation for further reference.
*/
virtual Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() { return nullptr; }
#endif
//@}

28
configure vendored
View File

@ -186,9 +186,8 @@ _no_pragma_pack=no
_bink=yes
_cloud=auto
_pandoc=no
# Default vkeybd/keymapper/eventrec options
# Default vkeybd/eventrec options
_vkeybd=no
_keymapper=no
_eventrec=auto
# GUI translation options
_translation=yes
@ -1045,7 +1044,6 @@ Optional Features:
--disable-cloud don't build cloud support
--disable-system-dialogs don't build support for system dialogs
--enable-vkeybd build virtual keyboard support
--enable-keymapper build key mapper support
--enable-eventrecorder enable event recording functionality
--disable-eventrecorder disable event recording functionality
--enable-updates build support for updates
@ -1277,8 +1275,6 @@ for ac_option in $@; do
--disable-translation) _translation=no ;;
--enable-vkeybd) _vkeybd=yes ;;
--disable-vkeybd) _vkeybd=no ;;
--enable-keymapper) _keymapper=yes ;;
--disable-keymapper) _keymapper=no ;;
--enable-eventrecorder) _eventrec=yes ;;
--disable-eventrecorder) _eventrec=no ;;
--enable-text-console) _text_console=yes ;;
@ -3119,7 +3115,6 @@ if test -n "$_host"; then
_libcurl=no
_vkeybd=yes
_build_hq_scalers=no
_keymapper=no
# Force disable vorbis on dingux, it has terrible performance compared to tremor
_vorbis=no
# Force disable seq on dingux, no way to use it and it would get enabled by default with configure
@ -3222,7 +3217,6 @@ if test -n "$_host"; then
_build_scalers=yes
_optimization_level=-O3
_vkeybd=yes
_keymapper=yes
_vorbis=no
_sdlconfig=sdl-config
_port_mk="backends/platform/dingux/dingux.mk"
@ -3284,7 +3278,6 @@ if test -n "$_host"; then
_backend="maemo"
_vkeybd=yes
_keymapper=yes
_build_hq_scalers=no
_mt32emu=no
_alsa=no
@ -3342,7 +3335,6 @@ if test -n "$_host"; then
_build_scalers=no
_savegame_timestamp=no
_translation=no
_keymapper=no
_text_console=no
_vkeybd=yes
_dynamic_modules=no
@ -3497,7 +3489,6 @@ if test -n "$_host"; then
_mt32emu=no
_seq_midi=no
_vkeybd=no
_keymapper=yes
add_line_to_config_mk "HOST_COMPILER = `uname`"
;;
wii)
@ -5420,22 +5411,11 @@ if test "$_pandocext" = "default"; then
fi
#
# Enable vkeybd / keymapper / event recorder
# Enable vkeybd / event recorder
#
define_in_config_if_yes $_vkeybd 'ENABLE_VKEYBD'
define_in_config_if_yes $_keymapper 'ENABLE_KEYMAPPER'
define_in_config_if_yes $_eventrec 'ENABLE_EVENTRECORDER'
#
# Check if the keymapper and the event recorder are enabled simultaneously
#
if test "$_keymapper" = yes ; then
if test "$_eventrec" = yes ; then
echo "ERROR: The keymapper and the event recorder cannot be enabled simultaneously currently, please disable one of the two"
exit 1
fi
fi
# Check whether to build translation support
#
echo_n "Building translation support... "
@ -5677,10 +5657,6 @@ if test "$_vkeybd" = yes ; then
echo_n ", virtual keyboard"
fi
if test "$_keymapper" = yes ; then
echo_n ", keymapper"
fi
if test "$_eventrec" = yes ; then
echo_n ", event recorder"
fi

View File

@ -341,17 +341,6 @@ int main(int argc, char *argv[]) {
cout << " " << i->description << '\n';
}
// Check if the keymapper and the event recorder are enabled simultaneously
bool keymapperEnabled = false;
for (FeatureList::const_iterator i = setup.features.begin(); i != setup.features.end(); ++i) {
if (i->enable && !strcmp(i->name, "keymapper"))
keymapperEnabled = true;
if (i->enable && !strcmp(i->name, "eventrecorder") && keymapperEnabled) {
std::cerr << "ERROR: The keymapper and the event recorder cannot be enabled simultaneously currently, please disable one of the two\n";
return -1;
}
}
// Check if tools and tests are enabled simultaneously
if (setup.devTools && setup.tests) {
std::cerr << "ERROR: The tools and tests projects cannot be created simultaneously\n";
@ -1087,7 +1076,6 @@ const Feature s_features[] = {
{ "cloud", "USE_CLOUD", "", true, "Cloud integration support" },
{ "translation", "USE_TRANSLATION", "", true, "Translation support" },
{ "vkeybd", "ENABLE_VKEYBD", "", false, "Virtual keyboard support"},
{ "keymapper", "ENABLE_KEYMAPPER", "", false, "Keymapper support"},
{ "eventrecorder", "ENABLE_EVENTRECORDER", "", false, "Event recorder support"},
{ "updates", "USE_UPDATES", "", false, "Updates support"},
{ "dialogs", "USE_SYSDIALOGS", "", true, "System dialogs support"},

View File

@ -344,7 +344,6 @@ EoBCoreEngine::~EoBCoreEngine() {
}
Common::Keymap *EoBCoreEngine::initKeymap(const Common::String &gameId) {
#ifdef ENABLE_KEYMAPPER
Common::Keymap *const engineKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, kKeymapName);
const Common::KeyActionEntry keyActionEntries[] = {
@ -382,9 +381,6 @@ Common::Keymap *EoBCoreEngine::initKeymap(const Common::String &gameId) {
}
return engineKeyMap;
#else
return nullptr;
#endif
}
Common::Error EoBCoreEngine::init() {

View File

@ -462,7 +462,6 @@ Common::Error LoLEngine::init() {
}
Common::Keymap *LoLEngine::initKeymap() {
#ifdef ENABLE_KEYMAPPER
Common::Keymap *const engineKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, kKeymapName);
const Common::KeyActionEntry keyActionEntries[] = {
@ -489,9 +488,6 @@ Common::Keymap *LoLEngine::initKeymap() {
}
return engineKeyMap;
#else
return nullptr;
#endif
}
void LoLEngine::pauseEngineIntern(bool pause) {

View File

@ -2580,12 +2580,10 @@ void GUI_EoB::updateBoxFrameHighLight(int box) {
}
int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColor1, int textColor2, int cursorColor) {
#ifdef ENABLE_KEYMAPPER
// Disable the keymap during text input
Common::Keymapper *const mapper = _vm->_eventMan->getKeymapper();
Common::Keymap *const lolKeymap = mapper->getKeymap(EoBCoreEngine::kKeymapName);
lolKeymap->setEnabled(false);
#endif
uint8 cursorState = 1;
char sufx[3] = " \0";
@ -2761,9 +2759,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
} while (_keyPressed.keycode != Common::KEYCODE_RETURN && _keyPressed.keycode != Common::KEYCODE_ESCAPE && !_vm->shouldQuit());
#ifdef ENABLE_KEYMAPPER
lolKeymap->setEnabled(true);
#endif
return _keyPressed.keycode == Common::KEYCODE_ESCAPE ? -1 : len;
}

View File

@ -2559,12 +2559,10 @@ int GUI_LoL::getInput() {
if (!_displayMenu)
return 0;
#ifdef ENABLE_KEYMAPPER
// Disable the keymap during text input
Common::Keymapper *const mapper = _vm->_eventMan->getKeymapper();
Common::Keymap *const lolKeymap = mapper->getKeymap(LoLEngine::kKeymapName);
lolKeymap->setEnabled(false);
#endif
Common::Point p = _vm->getMousePos();
_vm->_mouseX = p.x;
@ -2603,9 +2601,7 @@ int GUI_LoL::getInput() {
_vm->delay(8);
#ifdef ENABLE_KEYMAPPER
lolKeymap->setEnabled(true);
#endif
return inputFlag & 0x8000 ? 1 : 0;
}

View File

@ -48,7 +48,6 @@ const char *MetaEngine::getSavegamePattern(const char *target) const {
}
Common::Keymap *MetaEngine::initKeymap(const char *target) const {
#ifdef ENABLE_KEYMAPPER
Common::Keymap *const engineKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "engine-default");
// Since the game has multiple built-in keys for each of these anyway,
@ -67,9 +66,6 @@ Common::Keymap *MetaEngine::initKeymap(const char *target) const {
}
return engineKeyMap;
#else
return nullptr;
#endif
}
void MetaEngine::appendExtendedSave(Common::OutSaveFile *saveFile, uint32 playtime, Common::String desc) {

View File

@ -875,7 +875,6 @@ void MohawkEngine_Riven::runOptionsDialog() {
}
Common::Keymap *MohawkEngine_Riven::initKeymap(const char *target) {
#ifdef ENABLE_KEYMAPPER
Common::Keymap *const engineKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "riven");
const Common::KeyActionEntry keyActionEntries[] = {
@ -925,9 +924,6 @@ Common::Keymap *MohawkEngine_Riven::initKeymap(const char *target) {
}
return engineKeyMap;
#else
return nullptr;
#endif
}
bool ZipMode::operator== (const ZipMode &z) const {

View File

@ -2490,7 +2490,6 @@ uint PegasusEngine::getNeighborhoodCD(const NeighborhoodID neighborhood) const {
}
Common::Keymap *PegasusEngine::initKeymap() {
#ifdef ENABLE_KEYMAPPER
Common::Keymap *const engineKeyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "pegasus");
// Since the game has multiple built-in keys for each of these anyway,
@ -2517,9 +2516,6 @@ Common::Keymap *PegasusEngine::initKeymap() {
}
return engineKeyMap;
#else
return nullptr;
#endif
}
} // End of namespace Pegasus

View File

@ -200,7 +200,6 @@ EditGameDialog::EditGameDialog(const String &domain)
//
// The Keymap tab
//
#ifdef ENABLE_KEYMAPPER
Common::Keymap *keymap = nullptr;
if (plugin) {
keymap = plugin->get<MetaEngine>().initKeymap(domain.c_str());
@ -217,7 +216,6 @@ EditGameDialog::EditGameDialog(const String &domain)
tab->addTab(_("Keymaps"), "GameOptions_KeyMapper");
addKeyMapperControls(tab, "GameOptions_KeyMapper.", keymaps);
}
#endif
//
// 4) The audio tab

View File

@ -109,8 +109,6 @@ GuiManager::~GuiManager() {
delete _theme;
}
#ifdef ENABLE_KEYMAPPER
Common::Keymap *GuiManager::getKeymap() const {
using namespace Common;
@ -144,8 +142,6 @@ void GuiManager::enableKeymap(bool enabled) {
keymapper->setEnabledKeymapType(enabled ? Common::Keymap::kKeymapTypeGui : Common::Keymap::kKeymapTypeGame);
}
#endif
bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx, bool forced) {
// If we are asked to reload the currently active theme, just do nothing
// FIXME: Actually, why? It might be desirable at times to force a theme reload...
@ -423,10 +419,9 @@ void GuiManager::runLoop() {
#pragma mark -
void GuiManager::saveState() {
#ifdef ENABLE_KEYMAPPER
initKeymap();
enableKeymap(true);
#endif
// Backup old cursor
_lastClick.x = _lastClick.y = 0;
_lastClick.time = 0;
@ -436,9 +431,8 @@ void GuiManager::saveState() {
}
void GuiManager::restoreState() {
#ifdef ENABLE_KEYMAPPER
enableKeymap(false);
#endif
if (_useStdCursor) {
CursorMan.popCursor();
CursorMan.popCursorPalette();

View File

@ -267,12 +267,10 @@ void OptionsDialog::build() {
}
}
#ifdef ENABLE_KEYMAPPER
// Keymapper options
if (_keymapperWidget) {
_keymapperWidget->build();
}
#endif
// Graphic options
if (_fullscreenCheckbox) {
@ -630,7 +628,6 @@ void OptionsDialog::apply() {
}
}
#ifdef ENABLE_KEYMAPPER
if (_keymapperWidget) {
bool changes = _keymapperWidget->save();
if (changes) {
@ -638,7 +635,6 @@ void OptionsDialog::apply() {
keymapper->reloadAllMappings();
}
}
#endif
// Control options
if (_enableControlSettings) {
@ -886,11 +882,9 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
void OptionsDialog::handleTickle() {
Dialog::handleTickle();
#ifdef ENABLE_KEYMAPPER
if (_keymapperWidget) {
_keymapperWidget->handleTickle();
}
#endif
}
void OptionsDialog::setGraphicSettingsState(bool enabled) {
@ -1063,11 +1057,9 @@ void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &pr
_enableControlSettings = true;
}
#ifdef ENABLE_KEYMAPPER
void OptionsDialog::addKeyMapperControls(GuiObject *boss, const Common::String &prefix, const Common::KeymapArray &keymaps) {
_keymapperWidget = new Common::RemapWidget(boss, prefix + "Container", keymaps);
}
#endif
void OptionsDialog::addShaderControls(GuiObject *boss, const Common::String &prefix) {
// Shader selector
@ -1617,7 +1609,6 @@ void GlobalOptionsDialog::build() {
//
// The Keymap tab
//
#ifdef ENABLE_KEYMAPPER
Common::KeymapArray keymaps;
Common::Keymap *primaryGlobalKeymap = g_system->getEventManager()->getGlobalKeymap();
@ -1646,7 +1637,6 @@ void GlobalOptionsDialog::build() {
tab->addTab(_("Keymaps"), "GlobalOptions_KeyMapper");
addKeyMapperControls(tab, "GlobalOptions_KeyMapper.", keymaps);
}
#endif
//
// 2) The audio tab