diff options
author | Johannes Schickel | 2011-03-09 01:19:12 +0100 |
---|---|---|
committer | Johannes Schickel | 2011-03-09 01:19:12 +0100 |
commit | 463e475bd654104aab1e19cbc6f315b3341ef470 (patch) | |
tree | fe58fa909b48e7f5e4071b527dcb864ff335c507 /engines/sci/event.cpp | |
parent | 906f0248317e1a4167190a666fe308a09334bfac (diff) | |
download | scummvm-rg350-463e475bd654104aab1e19cbc6f315b3341ef470.tar.gz scummvm-rg350-463e475bd654104aab1e19cbc6f315b3341ef470.tar.bz2 scummvm-rg350-463e475bd654104aab1e19cbc6f315b3341ef470.zip |
SCI: Save mouse position in SciEvent.
Instead of querying the event manager for the current mouse cursor coordinates
kGetEvent now uses the saved mouse positions, which will assure every event
will be processed with the correct coordinates instead of the current ones.
Various other functions using SciEvent directly were adapted too.
This fixes cursor click positions for the WinCE backend.
Thanks to wjp and waltervn for helping me with this.
Diffstat (limited to 'engines/sci/event.cpp')
-rw-r--r-- | engines/sci/event.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index 7832864024..cb0e6b3c03 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -136,19 +136,28 @@ static int altify(int ch) { } SciEvent EventManager::getScummVMEvent() { - SciEvent input = { SCI_EVENT_NONE, 0, 0, 0 }; - SciEvent noEvent = { SCI_EVENT_NONE, 0, 0, 0 }; + SciEvent input = { SCI_EVENT_NONE, 0, 0, 0, Common::Point(0, 0) }; + SciEvent noEvent = { SCI_EVENT_NONE, 0, 0, 0, Common::Point(0, 0) }; Common::EventManager *em = g_system->getEventManager(); Common::Event ev; bool found = em->pollEvent(ev); - Common::Point p = ev.mouse; // Don't generate events for mouse movement while (found && ev.type == Common::EVENT_MOUSEMOVE) found = em->pollEvent(ev); + // Save the mouse position + // + // We call getMousePos of the event manager here, since we also want to + // store the mouse position in case of keyboard events, which do not feature + // any mouse position information itself. + // This should be safe, since the mouse position in the event manager should + // only be updated when a mouse related event has been taken from the queue + // via pollEvent. + noEvent.mousePos = input.mousePos = em->getMousePos(); + if (!found || ev.type == Common::EVENT_MOUSEMOVE) return noEvent; @@ -277,7 +286,7 @@ void EventManager::updateScreen() { } SciEvent EventManager::getSciEvent(unsigned int mask) { - SciEvent event = { 0, 0, 0, 0 }; + SciEvent event = { 0, 0, 0, 0, Common::Point(0, 0) }; EventManager::updateScreen(); |