diff options
Diffstat (limited to 'backends/events/maemosdl')
-rw-r--r-- | backends/events/maemosdl/maemosdl-events.cpp | 31 | ||||
-rw-r--r-- | backends/events/maemosdl/maemosdl-events.h | 6 |
2 files changed, 32 insertions, 5 deletions
diff --git a/backends/events/maemosdl/maemosdl-events.cpp b/backends/events/maemosdl/maemosdl-events.cpp index 14f8382fbe..3001f5d790 100644 --- a/backends/events/maemosdl/maemosdl-events.cpp +++ b/backends/events/maemosdl/maemosdl-events.cpp @@ -26,6 +26,10 @@ #include "backends/events/maemosdl/maemosdl-events.h" +MaemoSdlEventSource::MaemoSdlEventSource() : SdlEventSource(), _clickEnabled(true) { + +} + bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) { // List of special N810 keys: @@ -47,8 +51,7 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) { processMouseEvent(event, _km.x, _km.y); return true; } else if (ev.key.keysym.sym == SDLK_F8) { - event.type = Common::EVENT_MBUTTONDOWN; - processMouseEvent(event, _km.x, _km.y); + // handled in keyup return true; } break; @@ -68,16 +71,34 @@ bool MaemoSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) { processMouseEvent(event, _km.x, _km.y); return true; } else if (ev.key.keysym.sym == SDLK_F8) { - event.type = Common::EVENT_MBUTTONUP; - processMouseEvent(event, _km.x, _km.y); + _clickEnabled = !_clickEnabled; return true; } break; } } - // Invoke parent implementation of this method return SdlEventSource::remapKey(ev, event); } +bool MaemoSdlEventSource::handleMouseButtonDown(SDL_Event &ev, Common::Event &event) { + + if (ev.button.button == SDL_BUTTON_LEFT && !_clickEnabled) { + return false; + } + + // Invoke parent implementation of this method + return SdlEventSource::handleMouseButtonDown(ev, event); +} + +bool MaemoSdlEventSource::handleMouseButtonUp(SDL_Event &ev, Common::Event &event) { + + if (ev.button.button == SDL_BUTTON_LEFT && !_clickEnabled) { + return false; + } + + // Invoke parent implementation of this method + return SdlEventSource::handleMouseButtonUp(ev, event); +} + #endif diff --git a/backends/events/maemosdl/maemosdl-events.h b/backends/events/maemosdl/maemosdl-events.h index bdfee0f258..6b41b3c3f3 100644 --- a/backends/events/maemosdl/maemosdl-events.h +++ b/backends/events/maemosdl/maemosdl-events.h @@ -33,8 +33,14 @@ * SDL events manager for Maemo */ class MaemoSdlEventSource : public SdlEventSource { +public: + MaemoSdlEventSource(); protected: virtual bool remapKey(SDL_Event &ev, Common::Event &event); + virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event); + virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event); + + bool _clickEnabled; }; #endif |