diff options
author | sluicebox | 2019-03-31 02:53:21 -0700 |
---|---|---|
committer | Filippos Karapetis | 2019-04-01 01:16:53 +0300 |
commit | 82ccce948aaafed2f8e847359ab87c1a4878c74b (patch) | |
tree | 3f1d2c81462045fb7682e9ebe69b9f0d415015e2 /engines/sci/graphics/maciconbar.cpp | |
parent | 423dcd0a0116aa05894cc816fa266173e705ae63 (diff) | |
download | scummvm-rg350-82ccce948aaafed2f8e847359ab87c1a4878c74b.tar.gz scummvm-rg350-82ccce948aaafed2f8e847359ab87c1a4878c74b.tar.bz2 scummvm-rg350-82ccce948aaafed2f8e847359ab87c1a4878c74b.zip |
SCI: Fix Mac icon bar event handling
Fix mouse presses falling through the icon bar in KQ6 and FPFP Mac
Diffstat (limited to 'engines/sci/graphics/maciconbar.cpp')
-rw-r--r-- | engines/sci/graphics/maciconbar.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp index 9b645e485f..7b2b2a9754 100644 --- a/engines/sci/graphics/maciconbar.cpp +++ b/engines/sci/graphics/maciconbar.cpp @@ -24,7 +24,6 @@ #include "sci/engine/kernel.h" #include "sci/engine/selector.h" #include "sci/engine/state.h" -#include "sci/event.h" #include "sci/graphics/maciconbar.h" #include "sci/graphics/palette.h" #include "sci/graphics/screen.h" @@ -259,21 +258,17 @@ bool GfxMacIconBar::pointOnIcon(uint32 iconIndex, Common::Point point) { return _iconBarItems[iconIndex].rect.contains(point); } -reg_t GfxMacIconBar::handleEvents() { - // Peek event queue for a mouse button press +bool GfxMacIconBar::handleEvents(SciEvent evt, reg_t &iconObj) { EventManager *evtMgr = g_sci->getEventManager(); - SciEvent evt = evtMgr->getSciEvent(kSciEventMousePress | kSciEventPeek); + iconObj = NULL_REG; - // No mouse press found - if (evt.type == kSciEventNone) - return NULL_REG; + // Not a mouse press + if (evt.type != kSciEventMousePress) + return false; // If the mouse is not over the icon bar, return if (evt.mousePos.y < g_sci->_gfxScreen->getHeight()) - return NULL_REG; - - // Remove event from queue - evtMgr->getSciEvent(kSciEventMousePress); + return false; // Mouse press on the icon bar, check the icon rectangles uint iconNr; @@ -282,9 +277,10 @@ reg_t GfxMacIconBar::handleEvents() { break; } - // Mouse press not on an icon + // Mouse press on the icon bar but not on an enabled icon, + // return true to indicate that this mouse press was handled if (iconNr == _iconBarItems.size()) - return NULL_REG; + return true; drawIcon(iconNr, true); bool isSelected = true; @@ -305,9 +301,10 @@ reg_t GfxMacIconBar::handleEvents() { // If user moved away from the icon, we do nothing if (pointOnIcon(iconNr, evt.mousePos)) - return _iconBarItems[iconNr].object; + iconObj = _iconBarItems[iconNr].object; - return NULL_REG; + // The mouse press was handled + return true; } } // End of namespace Sci |