Added preprocessor flags 'ENABLE_VKEYBD' and 'ENABLE_KEYMAPPER' to control inclusion of vkeybd and keymapper in build.\n\nAlso added corresponding --enable-vkeybd and --enable-keymapper flags to configure scripts.

svn-id: r34706
This commit is contained in:
Stephen Kennedy 2008-09-30 13:51:01 +00:00
parent a7bb113e83
commit df3b8fd14c
27 changed files with 204 additions and 35 deletions

View File

@ -196,16 +196,22 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
_hasPlaybackEvent = false;
}
#ifdef ENABLE_VKEYBD
_vk = new Common::VirtualKeyboard();
#endif
#ifdef ENABLE_KEYMAPPER
_keymapper = new Common::Keymapper(this);
_remap = false;
//init();
#endif
}
DefaultEventManager::~DefaultEventManager() {
#ifdef ENABLE_KEYMAPPER
delete _keymapper;
#endif
#ifdef ENABLE_VKEYBD
delete _vk;
#endif
_boss->lockMutex(_timeMutex);
_boss->lockMutex(_recorderMutex);
_recordMode = kPassthrough;
@ -265,11 +271,13 @@ DefaultEventManager::~DefaultEventManager() {
}
void DefaultEventManager::init() {
#ifdef ENABLE_VKEYBD
if (ConfMan.hasKey("vkeybd_pack_name")) {
_vk->loadKeyboardPack(ConfMan.get("vkeybd_pack_name"));
} else {
_vk->loadKeyboardPack("vkeybd");
}
#endif
}
bool DefaultEventManager::playback(Common::Event &event) {
@ -379,6 +387,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
} else {
// poll for event from backend
result = _boss->pollEvent(event);
#ifdef ENABLE_KEYMAPPER
if (result) {
// send key press events to keymapper
if (event.type == Common::EVENT_KEYDOWN) {
@ -391,6 +400,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
}
}
}
#endif
}
if (_recordMode != kPassthrough) {
@ -457,7 +467,9 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
else if (_shouldRTL)
event.type = Common::EVENT_RTL;
}
} else if (event.kbd.keycode == Common::KEYCODE_F7 && event.kbd.flags == 0) {
}
#ifdef ENABLE_VKEYBD
else if (event.kbd.keycode == Common::KEYCODE_F7 && event.kbd.flags == 0) {
if (_vk->isDisplaying()) {
_vk->close(true);
} else {
@ -467,7 +479,10 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
if (!isPaused) g_engine->pauseEngine(false);
result = false;
}
} else if (event.kbd.keycode == Common::KEYCODE_F8 && event.kbd.flags == 0) {
}
#endif
#ifdef ENABLE_KEYMAPPER
else if (event.kbd.keycode == Common::KEYCODE_F8 && event.kbd.flags == 0) {
if (!_remap) {
_remap = true;
Common::RemapDialog _remapDialog;
@ -478,6 +493,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
_remap = false;
}
}
#endif
break;
case Common::EVENT_KEYUP:

View File

@ -31,8 +31,12 @@
#include "common/savefile.h"
namespace Common {
#ifdef ENABLE_KEYMAPPER
class Keymapper;
#endif
#ifdef ENABLE_VKEYBD
class VirtualKeyboard;
#endif
}
/*
@ -50,9 +54,14 @@ use a subclass of EventProvider.
class DefaultEventManager : public Common::EventManager {
OSystem *_boss;
#ifdef ENABLE_VKEYBD
Common::VirtualKeyboard *_vk;
#endif
#ifdef ENABLE_KEYMAPPER
Common::Keymapper *_keymapper;
bool _remap;
#endif
Common::Queue<Common::Event> _artificialEventQueue;
@ -132,7 +141,9 @@ public:
virtual int shouldRTL() const { return _shouldRTL; }
virtual void resetRTL() { _shouldRTL = false; }
#ifdef ENABLE_KEYMAPPER
virtual Common::Keymapper *getKeymapper() { return _keymapper; }
#endif
};
#endif

View File

@ -24,6 +24,9 @@
*/
#include "backends/keymapper/action.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/keymap.h"
namespace Common {
@ -51,3 +54,5 @@ const HardwareKey *Action::getMappedKey() const {
}
} // end of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_ACTION
#define COMMON_ACTION
#ifndef COMMON_ACTION_H
#define COMMON_ACTION_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/types.h"
#include "common/events.h"
@ -113,4 +117,6 @@ struct ActionPriorityComp : public BinaryFunction<Action, Action, bool> {
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_ACTION_H

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_HARDWAREKEY
#define COMMON_HARDWAREKEY
#ifndef COMMON_HARDWARE_KEY_H
#define COMMON_HARDWARE_KEY_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/types.h"
@ -125,4 +129,6 @@ private:
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_HARDWARE_KEY_H

View File

@ -24,6 +24,9 @@
*/
#include "backends/keymapper/keymap.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/hardware-key.h"
#define KEYMAP_KEY_PREFIX "keymap_"
@ -297,3 +300,5 @@ Action *Keymap::getParentMappedAction(KeyState key) {
}
} // end of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_KEYMAP
#define COMMON_KEYMAP
#ifndef COMMON_KEYMAP_H
#define COMMON_KEYMAP_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/config-manager.h"
#include "common/func.h"
@ -145,4 +149,6 @@ private:
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_KEYMAP_H

View File

@ -24,7 +24,11 @@
*/
#include "backends/keymapper/keymapper.h"
#ifdef ENABLE_KEYMAPPER
#include "common/config-manager.h"
namespace Common {
void Keymapper::Domain::addKeymap(Keymap *map) {
@ -217,3 +221,5 @@ const HardwareKey *Keymapper::getHardwareKey(const KeyState& key) {
}
} // end of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_KEYMAPPER
#define COMMON_KEYMAPPER
#ifndef COMMON_KEYMAPPER_H
#define COMMON_KEYMAPPER_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "common/events.h"
#include "common/list.h"
@ -201,4 +205,6 @@ private:
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_KEYMAPPER_H

View File

@ -23,6 +23,9 @@
*/
#include "backends/keymapper/remap-dialog.h"
#ifdef ENABLE_KEYMAPPER
#include "gui/eval.h"
#include "gui/newgui.h"
#include "gui/PopUpWidget.h"
@ -327,3 +330,5 @@ void RemapDialog::refreshKeymap() {
} // end of namespace Common
#endif // #ifdef ENABLE_KEYMAPPER

View File

@ -25,6 +25,10 @@
#ifndef REMAP_DIALOG_H
#define REMAP_DIALOG_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
#include "backends/keymapper/keymapper.h"
#include "gui/dialog.h"
@ -89,4 +93,6 @@ protected:
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef REMAP_DIALOG_H

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_TYPES
#define COMMON_TYPES
#ifndef COMMON_TYPES_H
#define COMMON_TYPES_H
#include "common/scummsys.h"
#ifdef ENABLE_KEYMAPPER
namespace Common {
@ -68,4 +72,6 @@ enum ActionType {
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_KEYMAPPER
#endif // #ifndef COMMON_TYPES_H

View File

@ -524,6 +524,7 @@ bool OSystem_SDL::remapKey(SDL_Event &ev, Common::Event &event) {
}
void OSystem_SDL::setupKeymapper() {
#ifdef ENABLE_KEYMAPPER
using namespace Common;
Keymapper *mapper = getEventManager()->getKeymapper();
@ -578,5 +579,6 @@ void OSystem_SDL::setupKeymapper() {
mapper->addGlobalKeymap(guiMap);
mapper->pushKeymap("global");
#endif
}

View File

@ -25,6 +25,8 @@
#include "backends/vkeybd/image-map.h"
#ifdef ENABLE_VKEYBD
namespace Common {
ImageMap::~ImageMap() {
@ -67,3 +69,5 @@ String ImageMap::findMapArea(int16 x, int16 y) {
} // End of namespace Common
#endif // #ifdef ENABLE_VKEYBD

View File

@ -26,6 +26,10 @@
#ifndef COMMON_IMAGEMAP_H
#define COMMON_IMAGEMAP_H
#include "common/scummsys.h"
#ifdef ENABLE_VKEYBD
#include "common/hashmap.h"
#include "common/hash-str.h"
#include "backends/vkeybd/polygon.h"
@ -50,4 +54,6 @@ protected:
} // End of namespace Common
#endif
#endif // #ifdef ENABLE_VKEYBD
#endif // #ifndef COMMON_IMAGEMAP_H

View File

@ -1,5 +1,7 @@
#ifndef KEYCODE_DESCRIPTIONS
#define KEYCODE_DESCRIPTIONS
#ifndef KEYCODE_DESCRIPTIONS_H
#define KEYCODE_DESCRIPTIONS_H
#ifdef ENABLE_VKEYBD
static const char *keycodeDescTable[] = {
"",
@ -328,4 +330,6 @@ static const char *keycodeDescTable[] = {
};
static const int keycodeDescTableSize = 322;
#endif
#endif // #ifdef ENABLE_VKEYBD
#endif // #ifndef KEYCODE_DESCRIPTIONS_H

View File

@ -25,6 +25,8 @@
#include "backends/vkeybd/polygon.h"
#ifdef ENABLE_VKEYBD
namespace Common {
bool Polygon::contains(int16 x, int16 y) const {
@ -53,3 +55,5 @@ bool Polygon::contains(int16 x, int16 y) const {
}
} // end of namespace Common
#endif // #ifdef ENABLE_VKEYBD

View File

@ -26,6 +26,10 @@
#ifndef COMMON_POLYGON_H
#define COMMON_POLYGON_H
#include "common/scummsys.h"
#ifdef ENABLE_VKEYBD
#include "common/array.h"
#include "common/rect.h"
@ -111,4 +115,6 @@ private:
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_VKEYBD
#endif // #ifndef COMMON_POLYGON_H

View File

@ -24,6 +24,9 @@
*/
#include "backends/vkeybd/virtual-keyboard-gui.h"
#ifdef ENABLE_VKEYBD
#include "graphics/cursorman.h"
#include "gui/newgui.h"
@ -414,3 +417,5 @@ void VirtualKeyboardGUI::removeCursor() {
}
} // end of namespace Common
#endif // #ifdef ENABLE_VKEYBD

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_VIRTUAL_KEYBOARD_GUI
#define COMMON_VIRTUAL_KEYBOARD_GUI
#ifndef COMMON_VIRTUAL_KEYBOARD_GUI_H
#define COMMON_VIRTUAL_KEYBOARD_GUI_H
#include "common/scummsys.h"
#ifdef ENABLE_VKEYBD
#include "backends/vkeybd/virtual-keyboard.h"
#include "common/rect.h"
@ -150,4 +154,6 @@ private:
} // end of namespace Common
#endif
#endif // #ifdef ENABLE_VKEYBD
#endif // #ifndef COMMON_VIRTUAL_KEYBOARD_GUI_H

View File

@ -25,6 +25,8 @@
#include "backends/vkeybd/virtual-keyboard-parser.h"
#ifdef ENABLE_VKEYBD
#include "common/keyboard.h"
#include "graphics/imageman.h"
#include "common/util.h"
@ -361,3 +363,5 @@ bool VirtualKeyboardParser::parseRectAsPolygon(Polygon *poly, const String& coor
}
} // end of namespace GUI
#endif // #ifdef ENABLE_VKEYBD

View File

@ -23,8 +23,12 @@
*
*/
#ifndef COMMON_VIRTUAL_KEYBOARD_PARSER
#define COMMON_VIRTUAL_KEYBOARD_PARSER
#ifndef COMMON_VIRTUAL_KEYBOARD_PARSER_H
#define COMMON_VIRTUAL_KEYBOARD_PARSER_H
#include "common/scummsys.h"
#ifdef ENABLE_VKEYBD
#include "common/xmlparser.h"
#include "backends/vkeybd/virtual-keyboard.h"
@ -264,4 +268,6 @@ protected:
} // end of namespace GUI
#endif
#endif // #ifdef ENABLE_VKEYBD
#endif // #ifndef COMMON_VIRTUAL_KEYBOARD_PARSER_H

View File

@ -24,6 +24,9 @@
*/
#include "backends/vkeybd/virtual-keyboard.h"
#ifdef ENABLE_VKEYBD
#include "backends/vkeybd/virtual-keyboard-gui.h"
#include "backends/vkeybd/virtual-keyboard-parser.h"
#include "backends/vkeybd/keycode-descriptions.h"
@ -388,3 +391,6 @@ bool VirtualKeyboard::KeyPressQueue::hasStringChanged() {
}
} // end of namespace Common
#endif // #ifdef ENABLE_VKEYBD

View File

@ -26,6 +26,10 @@
#ifndef COMMON_VIRTUAL_KEYBOARD_H
#define COMMON_VIRTUAL_KEYBOARD_H
#include "common/scummsys.h"
#ifdef ENABLE_VKEYBD
class OSystem;
#include "common/events.h"
@ -246,8 +250,8 @@ protected:
};
} // End of namespace Common
#endif // #ifdef ENABLE_VKEYBD
#endif
#endif // #ifndef COMMON_VIRTUAL_KEYBOARD_H

View File

@ -200,8 +200,9 @@ public:
// TODO: Consider removing OSystem::getScreenChangeID and
// replacing it by a generic getScreenChangeID method here
#ifdef ENABLE_KEYMAPPER
virtual Common::Keymapper *getKeymapper() = 0;
#endif
protected:

24
configure vendored
View File

@ -68,6 +68,9 @@ _mt32emu=yes
# default option behaviour yes/no
_build_hq_scalers=yes
_build_scalers=yes
# default vkeybd/keymapper options
_vkeybd=no
_keymapper=no
# Add an engine: id name build subengines
add_engine() {
@ -682,6 +685,10 @@ for ac_option in $@; do
--default-dynamic) _plugins_default=dynamic ;;
--enable-mt32emu) _mt32emu=yes ;;
--disable-mt32emu) _mt32emu=no ;;
--enable-vkeybd) _vkeybd=yes ;;
--disable-vkeybd) _vkeybd=no ;;
--enable-keymapper) _keymapper=yes ;;
--disable-keymapper) _keymapper=no ;;
--with-fluidsynth-prefix=*)
arg=`echo $ac_option | cut -d '=' -f 2`
FLUIDSYNTH_CFLAGS="-I$arg/include"
@ -1586,6 +1593,12 @@ fi
add_to_config_h_if_yes $_nasm '#define USE_NASM'
add_to_config_mk_if_yes $_nasm 'HAVE_NASM = 1'
#
# Enable vkeybd / keymapper
#
add_to_config_h_if_yes $_vkeybd '#define ENABLE_VKEYBD'
add_to_config_h_if_yes $_keymapper '#define ENABLE_KEYMAPPER'
#
# figure out installation directories
#
@ -1689,10 +1702,19 @@ if test "$_build_hq_scalers" = yes ; then
fi
if test "$_mt32emu" = yes ; then
echo ", MT-32 emu"
echo_n ", MT-32 emu"
fi
if test "$_vkeybd" = yes ; then
echo_n ", virtual keyboard"
fi
if test "$_keymapper" = yes ; then
echo ", keymapper"
else
echo
fi
#
# Backend related stuff
#

View File

@ -237,7 +237,10 @@ void NewGui::runLoop() {
}
Common::EventManager *eventMan = _system->getEventManager();
#ifdef ENABLE_KEYMAPPER
eventMan->getKeymapper()->pushKeymap("gui");
#endif
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
if (_needRedraw) {
redraw();
@ -329,7 +332,9 @@ void NewGui::runLoop() {
// Delay for a moment
_system->delayMillis(10);
}
#ifdef ENABLE_KEYMAPPER
eventMan->getKeymapper()->popKeymap();
#endif
// HACK: since we reopen all dialogs anyway on redraw
// we for now use Theme::closeAllDialogs here, until