From 04ab0e58b4142bf58db2180a2bac6897821d069f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 8 Aug 2011 23:56:54 +0200 Subject: SDL: Take advantage of SdlGraphicsManager. This gets rid of the hacks, where SdlEventSource added events with custom type numbers to pass SDL_VIDEOEXPOSE and SDL_VIDEORESIZE to the graphics manager. Furthermore it get rids of the uninituitive and hard to trace way of assigning the proper mouse coordinates to mouse related events. Formerly it passed the real screen coordinates through the even dispatching api to the graphics manager (at least hopefully ;-) and let that handle creating a new event with the proper coordinates. Now instead SdlEventSource handles the proper coordinate setup itself. Since this is a behavior change and I can not test all the SDL based small devices ports this commit might break compilation for them and more serve it might also break mouse position behavior. If any of that occurs I am sorry about it. --- backends/events/wincesdl/wincesdl-events.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'backends/events/wincesdl/wincesdl-events.cpp') diff --git a/backends/events/wincesdl/wincesdl-events.cpp b/backends/events/wincesdl/wincesdl-events.cpp index 1116cbbb8d..e73a4e66dd 100644 --- a/backends/events/wincesdl/wincesdl-events.cpp +++ b/backends/events/wincesdl/wincesdl-events.cpp @@ -43,7 +43,7 @@ void WINCESdlEventSource::init(WINCESdlGraphicsManager *graphicsMan) { _graphicsMan = graphicsMan; } -void WINCESdlEventSource::fillMouseEvent(Common::Event &event, int x, int y) { +void WINCESdlEventSource::processMouseEvent(Common::Event &event, int x, int y) { event.mouse.x = x; event.mouse.y = y; @@ -153,7 +153,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) { case SDL_MOUSEMOTION: event.type = Common::EVENT_MOUSEMOVE; - fillMouseEvent(event, ev.motion.x, ev.motion.y); + processMouseEvent(event, ev.motion.x, ev.motion.y); _graphicsMan->setMousePos(event.mouse.x, event.mouse.y); return true; @@ -165,7 +165,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) { event.type = Common::EVENT_RBUTTONDOWN; else break; - fillMouseEvent(event, ev.button.x, ev.button.y); + processMouseEvent(event, ev.button.x, ev.button.y); if (event.mouse.x > _tapX) @@ -241,7 +241,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) { _rbutton = false; } - fillMouseEvent(event, ev.button.x, ev.button.y); + processMouseEvent(event, ev.button.x, ev.button.y); if (freeLookActive && !_closeClick) { _tapX = event.mouse.x; @@ -261,8 +261,7 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) { return true; case SDL_VIDEOEXPOSE: - // HACK: Send a fake event, handled by SdlGraphicsManager - event.type = (Common::EventType)OSystem_SDL::kSdlEventExpose; + _graphicsMan->notifyVideoExpose(); break; case SDL_QUIT: @@ -279,9 +278,8 @@ bool WINCESdlEventSource::pollEvent(Common::Event &event) { if (ev.active.state & SDL_APPINPUTFOCUS) { _graphicsMan->_hasfocus = ev.active.gain; SDL_PauseAudio(!_graphicsMan->_hasfocus); - if (_graphicsMan->_hasfocus) { - event.type = (Common::EventType)OSystem_SDL::kSdlEventExpose; - } + if (_graphicsMan->_hasfocus) + _graphicsMan->notifyVideoExpose(); } break; } -- cgit v1.2.3