diff --git a/client/adventureMap/AdventureMapInterface.cpp b/client/adventureMap/AdventureMapInterface.cpp index 7bd085cd5..376401437 100644 --- a/client/adventureMap/AdventureMapInterface.cpp +++ b/client/adventureMap/AdventureMapInterface.cpp @@ -24,6 +24,7 @@ #include "../mapView/mapHandler.h" #include "../mapView/MapView.h" #include "../windows/InfoWindows.h" +#include "../widgets/RadialMenu.h" #include "../CGameInfo.h" #include "../gui/CursorHandler.h" #include "../gui/CGuiHandler.h" @@ -169,8 +170,7 @@ void AdventureMapInterface::dim(Canvas & to) { for (auto window : GH.windows().findWindows()) { - std::shared_ptr casted = std::dynamic_pointer_cast(window); - if (!casted && !window->isPopupWindow()) + if (!std::dynamic_pointer_cast(window) && !std::dynamic_pointer_cast(window) && !window->isPopupWindow()) { Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y); ColorRGBA colorToFill(0, 0, 0, std::clamp(backgroundDimLevel, 0, 255)); diff --git a/client/adventureMap/CInfoBar.cpp b/client/adventureMap/CInfoBar.cpp index bdcf76766..360dd4946 100644 --- a/client/adventureMap/CInfoBar.cpp +++ b/client/adventureMap/CInfoBar.cpp @@ -289,17 +289,15 @@ void CInfoBar::tick(uint32_t msPassed) } } -void CInfoBar::clickReleased(const Point & cursorPosition) +void CInfoBar::clickReleased(const Point & cursorPosition, bool lastActivated) { timerCounter = 0; removeUsedEvents(TIME); //expiration trigger from just clicked element is not valid anymore if(state == HERO || state == TOWN) { - if(settings["gameTweaks"]["infoBarCreatureManagement"].Bool()) - return; - - showGameStatus(); + if(lastActivated) + showGameStatus(); } else if(state == GAME) showDate(); diff --git a/client/adventureMap/CInfoBar.h b/client/adventureMap/CInfoBar.h index 8dc8c88cb..5800377b7 100644 --- a/client/adventureMap/CInfoBar.h +++ b/client/adventureMap/CInfoBar.h @@ -159,7 +159,7 @@ private: void tick(uint32_t msPassed) override; - void clickReleased(const Point & cursorPosition) override; + void clickReleased(const Point & cursorPosition, bool lastActivated) override; void showPopupWindow(const Point & cursorPosition) override; void hover(bool on) override; diff --git a/client/gui/EventDispatcher.cpp b/client/gui/EventDispatcher.cpp index 3dc576f5e..721954848 100644 --- a/client/gui/EventDispatcher.cpp +++ b/client/gui/EventDispatcher.cpp @@ -203,6 +203,7 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc // POSSIBLE SOLUTION: make EventReceivers inherit from create_shared_from this and store weak_ptr's in lists AEventsReceiver * nearestElement = findElementInToleranceRange(lclickable, position, AEventsReceiver::LCLICK, tolerance); auto hlp = lclickable; + bool lastActivated = true; for(auto & i : hlp) { @@ -212,12 +213,19 @@ void EventDispatcher::handleLeftButtonClick(const Point & position, int toleranc if( i->receiveEvent(position, AEventsReceiver::LCLICK) || i == nearestElement) { if(isPressed) + { i->clickPressed(position); + i->clickPressed(position, lastActivated); + } if (i->mouseClickedState && !isPressed) + { i->clickReleased(position); + i->clickReleased(position, lastActivated); + } i->mouseClickedState = isPressed; + lastActivated = false; } else { diff --git a/client/gui/EventsReceiver.h b/client/gui/EventsReceiver.h index 2206c70bf..690c9b9a8 100644 --- a/client/gui/EventsReceiver.h +++ b/client/gui/EventsReceiver.h @@ -45,6 +45,8 @@ protected: public: virtual void clickPressed(const Point & cursorPosition) {} virtual void clickReleased(const Point & cursorPosition) {} + virtual void clickPressed(const Point & cursorPosition, bool lastActivated) {} + virtual void clickReleased(const Point & cursorPosition, bool lastActivated) {} virtual void clickCancel(const Point & cursorPosition) {} virtual void showPopupWindow(const Point & cursorPosition) {} virtual void clickDouble(const Point & cursorPosition) {}