Fix a rare drag/drop issue

master
Eduardo Bart 12 years ago
parent 6ef44d462d
commit f4641333f4

@ -42,10 +42,7 @@ protected:
};
/// Throws a generic exception
template<typename... T>
void throw_exception(const std::string& what) {
throw exception(what);
}
inline void throw_exception(const std::string& what) { throw exception(what); }
}

@ -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)

@ -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);

Loading…
Cancel
Save