[Scummvm-cvs-logs] SF.net SVN: scummvm:[54522] scummvm/trunk/backends

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Nov 28 15:58:00 CET 2010


Revision: 54522
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54522&view=rev
Author:   fingolfin
Date:     2010-11-28 14:57:59 +0000 (Sun, 28 Nov 2010)

Log Message:
-----------
DINGUX: Attempt to fix the new code for this backend

It seems in the gsoc2010-opengl branch, the dingux port was not anymore
updated at some point, so some changes that were made in general did not
make it till here. This is my attempt to fix at least the most obvious
problems, but without being able to compile it, all these changes should
be very carefully reviewed.

Modified Paths:
--------------
    scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.cpp
    scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.h
    scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
    scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
    scummvm/trunk/backends/platform/dingux/dingux.cpp

Modified: scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.cpp
===================================================================
--- scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.cpp	2010-11-28 14:57:56 UTC (rev 54521)
+++ scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.cpp	2010-11-28 14:57:59 UTC (rev 54522)
@@ -26,7 +26,6 @@
 #if defined(DINGUX)
 
 #include "backends/events/dinguxsdl/dinguxsdl-events.h"
-#include "graphics/scaler/aspect.h"	// for aspect2Real 
 
 #define PAD_UP    SDLK_UP
 #define PAD_DOWN  SDLK_DOWN
@@ -58,10 +57,6 @@
 	return key;
 }
 
-DINGUXSdlEventSource::DINGUXSdlEventSource() : SdlEventSource() {
-	;
-}
-
 bool DINGUXSdlEventSource::remapKey(SDL_Event &ev, Common::Event &event) {
 	if (ev.key.keysym.sym == PAD_UP) {
 		if (ev.type == SDL_KEYDOWN) {
@@ -182,45 +177,4 @@
 	return false;
 }
 
-void DINGUXSdlEventSource::fillMouseEvent(Common::Event &event, int x, int y) {
-	if (_grpMan->getVideoMode()->mode == GFX_HALF && !(_grpMan->isOverlayVisible())) {
-		event.mouse.x = x * 2;
-		event.mouse.y = y * 2;
-	} else {
-		event.mouse.x = x;
-		event.mouse.y = y;
-	}
-
-	// Update the "keyboard mouse" coords
-	_km.x = x;
-	_km.y = y;
-
-	// Adjust for the screen scaling
-	if (!(_grpMan->isOverlayVisible())) {
-		event.mouse.x /= (_grpMan->getVideoMode())->scaleFactor;
-		event.mouse.y /= (_grpMan->getVideoMode())->scaleFactor;
-#if 0
-		if (_grpMan->getVideoMode()->aspectRatioCorrection)
-			event.mouse.y = aspect2Real(event.mouse.y);
-#endif
-	}
-}
-
-void DINGUXSdlEventSource::warpMouse(int x, int y) {
-	int mouse_cur_x = _grpMan->getMouseCurState()->x;
-	int mouse_cur_y = _grpMan->getMouseCurState()->y;
-
-	if ((mouse_cur_x != x) || (mouse_cur_y != y)) {
-		if (_grpMan->getVideoMode()->mode == GFX_HALF && !(_grpMan->isOverlayVisible())) {
-			x = x / 2;
-			y = y / 2;
-		}
-	}
-	SDL_WarpMouse(x, y);
-}
-
-void DINGUXSdlEventSource::setCurrentGraphMan(DINGUXSdlGraphicsManager *_graphicManager) {
-	_grpMan = _graphicManager;
-}
-
 #endif /* DINGUX */

Modified: scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.h
===================================================================
--- scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.h	2010-11-28 14:57:56 UTC (rev 54521)
+++ scummvm/trunk/backends/events/dinguxsdl/dinguxsdl-events.h	2010-11-28 14:57:59 UTC (rev 54522)
@@ -27,20 +27,11 @@
 #define BACKENDS_EVENTS_SDL_DINGUX_H
 #if defined(DINGUX)
 
-#include "backends/platform/dingux/dingux.h"
-#include "backends/events/dinguxsdl/dinguxsdl-events.h"
+#include "backends/events/sdl/sdl-events.h"
 
 class DINGUXSdlEventSource : public SdlEventSource {
-public:
-	DINGUXSdlEventSource();
-	void setCurrentGraphMan(DINGUXSdlGraphicsManager *_graphicManager);
-
 protected:
-	DINGUXSdlGraphicsManager *_grpMan;
-
 	bool remapKey(SDL_Event &ev, Common::Event &event);
-	void fillMouseEvent(Common::Event &event, int x, int y);
-	void warpMouse(int x, int y);
 };
 
 #endif /* DINGUX */

Modified: scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
===================================================================
--- scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp	2010-11-28 14:57:56 UTC (rev 54521)
+++ scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp	2010-11-28 14:57:59 UTC (rev 54522)
@@ -503,4 +503,32 @@
 	return _overlayVisible;
 }
 
+void DINGUXSdlGraphicsManager::warpMouse(int x, int y) {
+	if (_mouseCurState.x != x || _mouseCurState.y != y) {
+		if (_videoMode.mode == GFX_HALF && !_overlayVisible) {
+			x = x / 2;
+			y = y / 2;
+		}
+	}
+	SdlGraphicsManager::warpMouse(x, y);
+}
+
+void DINGUXSdlGraphicsManager::adjustMouseEvent(const Common::Event &event) {
+	if (!event.synthetic) {
+		Common::Event newEvent(event);
+		newEvent.synthetic = true;
+		if (!_overlayVisible) {
+			if (_videoMode.mode == GFX_HALF) {
+				event.mouse.x *= 2;
+				event.mouse.y *= 2;
+			}
+			newEvent.mouse.x /= _videoMode.scaleFactor;
+			newEvent.mouse.y /= _videoMode.scaleFactor;
+			if (_videoMode.aspectRatioCorrection)
+				newEvent.mouse.y = aspect2Real(newEvent.mouse.y);
+		}
+		g_system->getEventManager()->pushEvent(newEvent);
+	}
+}
+
 #endif

Modified: scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
===================================================================
--- scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.h	2010-11-28 14:57:56 UTC (rev 54521)
+++ scummvm/trunk/backends/graphics/dinguxsdl/dinguxsdl-graphics.h	2010-11-28 14:57:59 UTC (rev 54522)
@@ -56,11 +56,13 @@
 	bool loadGFXMode();
 	void drawMouse();
 	void undrawMouse();
+	virtual void warpMouse(int x, int y);
 
 	SdlGraphicsManager::MousePos *getMouseCurState();
 	SdlGraphicsManager::VideoState *getVideoMode();
-	bool isOverlayVisible();
 
+	virtual void adjustMouseEvent(const Common::Event &event);
+
 protected:
 	SdlEventSource *_evSrc;
 };

Modified: scummvm/trunk/backends/platform/dingux/dingux.cpp
===================================================================
--- scummvm/trunk/backends/platform/dingux/dingux.cpp	2010-11-28 14:57:56 UTC (rev 54521)
+++ scummvm/trunk/backends/platform/dingux/dingux.cpp	2010-11-28 14:57:59 UTC (rev 54522)
@@ -37,7 +37,6 @@
 	// Create the graphics manager
 	if (_graphicsManager == 0) {
 		_graphicsManager = new DINGUXSdlGraphicsManager(_eventSource); 
-		((DINGUXSdlEventSource*)_eventSource)->setCurrentGraphMan((DINGUXSdlGraphicsManager*)_graphicsManager);
 	}
 
 	// Call parent implementation of this method


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list