aboutsummaryrefslogtreecommitdiff
path: root/backends/events
diff options
context:
space:
mode:
authorAlejandro Marzini2010-06-16 04:34:44 +0000
committerAlejandro Marzini2010-06-16 04:34:44 +0000
commit99c0f8260848ff758da3e40d9d816dc51974f793 (patch)
tree0f7f56da2aa4c740661609b71d1411cd4f6ec8d7 /backends/events
parent54377bbb308dc89337d1473cb1c5b5e84b470aff (diff)
downloadscummvm-rg350-99c0f8260848ff758da3e40d9d816dc51974f793.tar.gz
scummvm-rg350-99c0f8260848ff758da3e40d9d816dc51974f793.tar.bz2
scummvm-rg350-99c0f8260848ff758da3e40d9d816dc51974f793.zip
Fixed some disabled code that was with problems after modularization.
svn-id: r49899
Diffstat (limited to 'backends/events')
-rw-r--r--backends/events/sdl/sdl-events.cpp47
-rw-r--r--backends/events/sdl/sdl-events.h4
2 files changed, 24 insertions, 27 deletions
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index c5c8964260..8171929627 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -52,6 +52,7 @@ SdlEventManager::SdlEventManager(Common::EventSource *boss)
:
_scrollLock(false),
_joystick(0),
+ _lastScreenID(0),
DefaultEventManager(boss) {
// reset mouse state
@@ -104,12 +105,7 @@ void SdlEventManager::fillMouseEvent(Common::Event &event, int x, int y) {
_km.y = y;
// Adjust for the screen scaling
- /*if (!_overlayVisible) { // FIXME
- event.mouse.x /= _videoMode.scaleFactor;
- event.mouse.y /= _videoMode.scaleFactor;
- if (_videoMode.aspectRatioCorrection)
- event.mouse.y = aspect2Real(event.mouse.y);
- }*/
+ ((OSystem_SDL *)g_system)->getGraphicsManager()->adjustMouseEvent(event);
}
void SdlEventManager::handleKbdMouse() {
@@ -211,12 +207,13 @@ bool SdlEventManager::pollSdlEvent(Common::Event &event) {
handleKbdMouse();
- // If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
- /*if (_graphicsManager->_modeChanged) { // TODO: use getScreenChangeID
- _graphicsManager->_modeChanged = false;
+ // If the screen changed, send an Common::EVENT_SCREEN_CHANGED
+ int screenID = ((OSystem_SDL *)g_system)->getGraphicsManager()->getScreenChangeID();
+ if (screenID != _lastScreenID) {
+ _lastScreenID = screenID;
event.type = Common::EVENT_SCREEN_CHANGED;
return true;
- }*/
+ }
while (SDL_PollEvent(&ev)) {
preprocessEvents(&ev);
@@ -271,24 +268,13 @@ bool SdlEventManager::handleKeyDown(SDL_Event &ev, Common::Event &event) {
event.kbd.flags |= Common::KBD_SCRL;
// Alt-Return and Alt-Enter toggle full screen mode
- // TODO: make a function in graphics manager for this
- /*if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
- beginGFXTransaction();
- setFullscreenMode(!_videoMode.fullscreen);
- endGFXTransaction();
-#ifdef USE_OSD
- if (_videoMode.fullscreen)
- displayMessageOnOSD("Fullscreen mode");
- else
- displayMessageOnOSD("Windowed mode");
-#endif
-
+ if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
+ ((OSystem_SDL *) g_system)->getGraphicsManager()->toggleFullScreen();
return false;
- }*/
+ }
// Alt-S: Create a screenshot
- // TODO: make a function in graphics manager for this
- /*if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
+ if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
char filename[20];
for (int n = 0;; n++) {
@@ -300,12 +286,12 @@ bool SdlEventManager::handleKeyDown(SDL_Event &ev, Common::Event &event) {
break;
SDL_RWclose(file);
}
- if (saveScreenshot(filename))
+ if (((OSystem_SDL *) g_system)->getGraphicsManager()->saveScreenshot(filename))
printf("Saved '%s'\n", filename);
else
printf("Could not save screenshot!\n");
return false;
- }*/
+ }
// Ctrl-m toggles mouse capture
if (event.kbd.hasFlags(Common::KBD_CTRL) && ev.key.keysym.sym == 'm') {
@@ -608,4 +594,11 @@ void SdlEventManager::toggleMouseGrab() {
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
+void SdlEventManager::resetKeyboadEmulation(int16 x_max, int16 y_max) {
+ _km.x_max = x_max;
+ _km.y_max = y_max;
+ _km.delay_time = 25;
+ _km.last_time = 0;
+}
+
#endif
diff --git a/backends/events/sdl/sdl-events.h b/backends/events/sdl/sdl-events.h
index 49b040dc8f..8dd2840e1d 100644
--- a/backends/events/sdl/sdl-events.h
+++ b/backends/events/sdl/sdl-events.h
@@ -41,6 +41,8 @@ public:
virtual bool pollSdlEvent(Common::Event &event);
+ void resetKeyboadEmulation(int16 x_max, int16 y_max);
+
protected:
virtual void preprocessEvents(SDL_Event *event) {}
@@ -80,6 +82,8 @@ protected:
void handleKbdMouse();
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
+
+ int _lastScreenID;
};
#endif