Skip to content

Commit

Permalink
MAEMO: Fix building without keymapper enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
tsoliman committed Feb 17, 2012
1 parent c87657f commit 53d6ef1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backends/events/maemosdl/maemosdl-events.cpp
Expand Up @@ -200,13 +200,15 @@ MaemoSdlEventObserver::MaemoSdlEventObserver(MaemoSdlEventSource *eventSource) {
}

bool MaemoSdlEventObserver::notifyEvent(const Common::Event &event) {
#ifdef ENABLE_KEYMAPPER
if (event.type != Common::EVENT_CUSTOM_BACKEND)
return false;
if (event.customType == kEventClickMode) {
assert(_eventSource);
_eventSource->toggleClickMode();
return true;
}
#endif
return false;
}

Expand Down
8 changes: 8 additions & 0 deletions backends/platform/maemo/maemo.cpp
Expand Up @@ -49,9 +49,12 @@ 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", "REM", "HOME");
_keymapperDefaultBindings->setDefaultBinding("global", "REM", "HOME");
Expand Down Expand Up @@ -79,6 +82,7 @@ static void registerDefaultKeyBindings(Common::KeymapperDefaultBindings *_keymap
_keymapperDefaultBindings->setDefaultBinding("maemo", "RCL", "ZOOMPLUS");
_keymapperDefaultBindings->setDefaultBinding("maemo", "CLK", "ZOOMMINUS");
}
#endif

void OSystem_SDL_Maemo::initBackend() {
// Create the events manager
Expand All @@ -91,14 +95,18 @@ void OSystem_SDL_Maemo::initBackend() {
if (_eventObserver == 0)
_eventObserver = new MaemoSdlEventObserver((MaemoSdlEventSource *)_eventSource);

#ifdef ENABLE_KEYMAPPER
if (_keymapperDefaultBindings == 0)
_keymapperDefaultBindings = new Common::KeymapperDefaultBindings();
#endif

ConfMan.set("vkeybdpath", DATA_PATH);

_model = detectModel();

#ifdef ENABLE_KEYMAPPER
registerDefaultKeyBindings(_keymapperDefaultBindings, _model);
#endif

// Call parent implementation of this method
OSystem_POSIX::initBackend();
Expand Down
2 changes: 2 additions & 0 deletions backends/platform/maemo/maemo.h
Expand Up @@ -56,7 +56,9 @@ class OSystem_SDL_Maemo : public OSystem_POSIX {
const Model detectModel();
Model _model;
MaemoSdlEventObserver *_eventObserver;
#ifdef ENABLE_KEYMAPPER
Common::KeymapperDefaultBindings *_keymapperDefaultBindings;
#endif
};

} // namespace Maemo
Expand Down

0 comments on commit 53d6ef1

Please sign in to comment.