diff --git a/src/framework/stdext/exception.h b/src/framework/stdext/exception.h index 7e6faeee..cc795aa9 100644 --- a/src/framework/stdext/exception.h +++ b/src/framework/stdext/exception.h @@ -42,10 +42,7 @@ protected: }; /// Throws a generic exception -template -void throw_exception(const std::string& what) { - throw exception(what); -} +inline void throw_exception(const std::string& what) { throw exception(what); } } diff --git a/src/framework/ui/uimanager.cpp b/src/framework/ui/uimanager.cpp index 4adedb4b..2143f969 100644 --- a/src/framework/ui/uimanager.cpp +++ b/src/framework/ui/uimanager.cpp @@ -133,7 +133,7 @@ void UIManager::inputEvent(const InputEvent& event) } // mouse move can change hovered widgets - updateHoveredWidget(); + updateHoveredWidget(true); // first fire dragging move if(m_draggingWidget) { @@ -209,12 +209,12 @@ bool UIManager::updateDraggingWidget(const UIWidgetPtr& draggingWidget, const Po return accepted; } -void UIManager::updateHoveredWidget() +void UIManager::updateHoveredWidget(bool now) { - if(m_hoverUpdateScheduled) + if(m_hoverUpdateScheduled && !now) return; - g_dispatcher.addEvent([this] { + auto func = [this] { if(!m_rootWidget) return; @@ -235,8 +235,14 @@ void UIManager::updateHoveredWidget() hoveredWidget->onHoverChange(true); } } - }); - m_hoverUpdateScheduled = true; + }; + + if(now) + func(); + else { + m_hoverUpdateScheduled = true; + g_dispatcher.addEvent(func); + } } void UIManager::onWidgetAppear(const UIWidgetPtr& widget) diff --git a/src/framework/ui/uimanager.h b/src/framework/ui/uimanager.h index 2c25ef93..808a83f6 100644 --- a/src/framework/ui/uimanager.h +++ b/src/framework/ui/uimanager.h @@ -41,7 +41,7 @@ public: void updatePressedWidget(const UIWidgetPtr& newPressedWidget, const Point& clickedPos = Point()); bool updateDraggingWidget(const UIWidgetPtr& draggingWidget, const Point& clickedPos = Point()); - void updateHoveredWidget(); + void updateHoveredWidget(bool now = false); void clearStyles(); bool importStyle(const std::string& file);