From afd2a2c01d4bf3686a54c631d1cd4228ba1d710c Mon Sep 17 00:00:00 2001 From: Alejandro Marzini Date: Tue, 29 Jun 2010 05:00:44 +0000 Subject: Renamed Samsung TV SDL Event Manager class and file for constancy, and added initialization for it on Samsung TV backend. svn-id: r50481 --- backends/events/samsungtv/samsungtv-events.cpp | 78 ---------------------- backends/events/samsungtv/samsungtv-events.h | 40 ----------- .../events/samsungtvsdl/samsungtvsdl-events.cpp | 78 ++++++++++++++++++++++ backends/events/samsungtvsdl/samsungtvsdl-events.h | 40 +++++++++++ backends/module.mk | 2 +- backends/platform/samsungtv/samsungtv.cpp | 9 +++ backends/platform/samsungtv/samsungtv.h | 14 ++-- 7 files changed, 136 insertions(+), 125 deletions(-) delete mode 100644 backends/events/samsungtv/samsungtv-events.cpp delete mode 100644 backends/events/samsungtv/samsungtv-events.h create mode 100644 backends/events/samsungtvsdl/samsungtvsdl-events.cpp create mode 100644 backends/events/samsungtvsdl/samsungtvsdl-events.h (limited to 'backends') diff --git a/backends/events/samsungtv/samsungtv-events.cpp b/backends/events/samsungtv/samsungtv-events.cpp deleted file mode 100644 index c36684122f..0000000000 --- a/backends/events/samsungtv/samsungtv-events.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#if defined(SAMSUNGTV) - -#include "backends/events/samsungtv/samsungtv-events.h" - -SdlSamsungTVEventManager::SdlSamsungTVEventManager(Common::EventSource *boss) - : - SdlEventManager(boss) { - -} - -bool SdlSamsungTVEventManager::remapKey(SDL_Event &ev, Common::Event &event) { - switch (ev.type) { - case SDL_KEYDOWN:{ - if (ev.key.keysym.sym == SDLK_POWER) { - event.type = Common::EVENT_QUIT; - return true; - } else if (ev.key.keysym.sym == SDLK_F1 && ev.key.keysym.scancode == 20) { - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = Common::ASCII_F5; - return true; - } else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) { - event.type = Common::EVENT_KEYDOWN; - event.kbd.keycode = Common::KEYCODE_F7; - event.kbd.ascii = Common::ASCII_F7; - return true; - } - break; - } - case SDL_KEYUP: { - if (ev.key.keysym.sym == SDLK_POWER) { - event.type = Common::EVENT_QUIT; - return true; - } else if (ev.key.keysym.sym == SDLK_F1 && ev.key.keysym.scancode == 20) { - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = Common::ASCII_F5; - return true; - } else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) { - event.type = Common::EVENT_KEYUP; - event.kbd.keycode = Common::KEYCODE_F7; - event.kbd.ascii = Common::ASCII_F7; - return true; - } - break; - } - } - - // Invoke parent implementation of this method - return SdlEventManager::remapKey(ev, event); -} - -#endif diff --git a/backends/events/samsungtv/samsungtv-events.h b/backends/events/samsungtv/samsungtv-events.h deleted file mode 100644 index 1c7e38984f..0000000000 --- a/backends/events/samsungtv/samsungtv-events.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#if !defined(BACKEND_EVENTS_SDL_SAMSUNGTV_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER) -#define BACKEND_EVENTS_SDL_SAMSUNGTV_H - -#include "backends/events/sdl/sdl-events.h" - -class SdlSamsungTVEventManager : public SdlEventManager { -public: - SdlSamsungTVEventManager(Common::EventSource *boss); - ~SdlSamsungTVEventManager() {} - -protected: - bool remapKey(SDL_Event &ev, Common::Event &event); -}; - -#endif diff --git a/backends/events/samsungtvsdl/samsungtvsdl-events.cpp b/backends/events/samsungtvsdl/samsungtvsdl-events.cpp new file mode 100644 index 0000000000..d1c35d3a5a --- /dev/null +++ b/backends/events/samsungtvsdl/samsungtvsdl-events.cpp @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifdef SAMSUNGTV + +#include "backends/events/samsungtvsdl/samsungtvsdl-events.h" + +SamsungTVSdlEventManager::SamsungTVSdlEventManager(Common::EventSource *boss) + : + SdlEventManager(boss) { + +} + +bool SamsungTVSdlEventManager::remapKey(SDL_Event &ev, Common::Event &event) { + switch (ev.type) { + case SDL_KEYDOWN:{ + if (ev.key.keysym.sym == SDLK_POWER) { + event.type = Common::EVENT_QUIT; + return true; + } else if (ev.key.keysym.sym == SDLK_F1 && ev.key.keysym.scancode == 20) { + event.type = Common::EVENT_KEYDOWN; + event.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = Common::ASCII_F5; + return true; + } else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) { + event.type = Common::EVENT_KEYDOWN; + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = Common::ASCII_F7; + return true; + } + break; + } + case SDL_KEYUP: { + if (ev.key.keysym.sym == SDLK_POWER) { + event.type = Common::EVENT_QUIT; + return true; + } else if (ev.key.keysym.sym == SDLK_F1 && ev.key.keysym.scancode == 20) { + event.type = Common::EVENT_KEYUP; + event.kbd.keycode = Common::KEYCODE_F5; + event.kbd.ascii = Common::ASCII_F5; + return true; + } else if (ev.key.keysym.sym == SDLK_F2 && ev.key.keysym.scancode == 21) { + event.type = Common::EVENT_KEYUP; + event.kbd.keycode = Common::KEYCODE_F7; + event.kbd.ascii = Common::ASCII_F7; + return true; + } + break; + } + } + + // Invoke parent implementation of this method + return SdlEventManager::remapKey(ev, event); +} + +#endif diff --git a/backends/events/samsungtvsdl/samsungtvsdl-events.h b/backends/events/samsungtvsdl/samsungtvsdl-events.h new file mode 100644 index 0000000000..1189af4500 --- /dev/null +++ b/backends/events/samsungtvsdl/samsungtvsdl-events.h @@ -0,0 +1,40 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#if !defined(BACKEND_EVENTS_SDL_SAMSUNGTV_H) && !defined(DISABLE_DEFAULT_EVENTMANAGER) +#define BACKEND_EVENTS_SDL_SAMSUNGTV_H + +#include "backends/events/sdl/sdl-events.h" + +class SamsungTVSdlEventManager : public SdlEventManager { +public: + SamsungTVSdlEventManager(Common::EventSource *boss); + ~SamsungTVSdlEventManager() {} + +protected: + virtual bool remapKey(SDL_Event &ev, Common::Event &event); +}; + +#endif diff --git a/backends/module.mk b/backends/module.mk index 987810dd11..d7ea193004 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -7,7 +7,7 @@ MODULE_OBJS := \ audiocd/sdl/sdl-audiocd.o \ events/default/default-events.o \ events/linuxmotosdl/linuxmotosdl-events.o \ - events/samsungtv/samsungtv-events.o \ + events/samsungtvsdl/samsungtvsdl-events.o \ events/sdl/sdl-events.o \ events/symbiansdl/symbiansdl-events.o \ fs/abstract-fs.o \ diff --git a/backends/platform/samsungtv/samsungtv.cpp b/backends/platform/samsungtv/samsungtv.cpp index bf6e20adae..34ddbd2f10 100644 --- a/backends/platform/samsungtv/samsungtv.cpp +++ b/backends/platform/samsungtv/samsungtv.cpp @@ -24,6 +24,7 @@ */ #include "backends/platform/samsungtv/samsungtv.h" +#include "backends/events/samsungtvsdl/samsungtvsdl-events.h" OSystem_SDL_SamsungTV::OSystem_SDL_SamsungTV() : @@ -36,6 +37,14 @@ bool OSystem_SDL_SamsungTV::hasFeature(Feature f) { (f == OSystem::kFeatureCursorHasPalette); } +void OSystem_SDL_SamsungTV::initBackend() { + if (_eventManager == 0) + _eventManager = new SamsungTVSdlEventManager(this); + + // Call parent implementation of this method + OSystem_SDL::initBackend(); +} + void OSystem_SDL_SamsungTV::setFeatureState(Feature f, bool enable) { switch (f) { case OSystem::kFeatureAspectRatioCorrection: diff --git a/backends/platform/samsungtv/samsungtv.h b/backends/platform/samsungtv/samsungtv.h index 0c3e49ac63..49460a9ddc 100644 --- a/backends/platform/samsungtv/samsungtv.h +++ b/backends/platform/samsungtv/samsungtv.h @@ -23,8 +23,8 @@ * */ -#ifndef SDL_SAMSUNGTV_COMMON_H -#define SDL_SAMSUNGTV_COMMON_H +#ifndef PLATFORM_SDL_SAMSUNGTV_H +#define PLATFORM_SDL_SAMSUNGTV_H #include "backends/platform/sdl/posix/posix.h" @@ -32,11 +32,13 @@ class OSystem_SDL_SamsungTV : public OSystem_POSIX { public: OSystem_SDL_SamsungTV(); - bool hasFeature(Feature f); - void setFeatureState(Feature f, bool enable); - bool getFeatureState(Feature f); + virtual void initBackend(); - void quit(); + virtual bool hasFeature(Feature f); + virtual void setFeatureState(Feature f, bool enable); + virtual bool getFeatureState(Feature f); + + virtual void quit(); }; #endif -- cgit v1.2.3