mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 05:40:44 +00:00
Fix OnMouseLeave not firing
This commit is contained in:
parent
945317ed64
commit
0b3d3966a6
2 changed files with 22 additions and 0 deletions
|
@ -175,6 +175,7 @@ private:
|
|||
std::unique_ptr<Canvas> DispCanvas;
|
||||
Widget* FocusWidget = nullptr;
|
||||
Widget* CaptureWidget = nullptr;
|
||||
Widget* HoverWidget = nullptr;
|
||||
|
||||
Widget(const Widget&) = delete;
|
||||
Widget& operator=(const Widget&) = delete;
|
||||
|
|
|
@ -75,6 +75,19 @@ void Widget::MoveBefore(Widget* sibling)
|
|||
|
||||
void Widget::DetachFromParent()
|
||||
{
|
||||
for (Widget* cur = ParentObj; cur; cur = cur->ParentObj)
|
||||
{
|
||||
if (cur->FocusWidget == this)
|
||||
cur->FocusWidget = nullptr;
|
||||
if (cur->CaptureWidget == this)
|
||||
cur->CaptureWidget = nullptr;
|
||||
if (cur->HoverWidget == this)
|
||||
cur->HoverWidget = nullptr;
|
||||
|
||||
if (cur->DispWindow)
|
||||
break;
|
||||
}
|
||||
|
||||
if (PrevSiblingObj)
|
||||
PrevSiblingObj->NextSiblingObj = NextSiblingObj;
|
||||
if (NextSiblingObj)
|
||||
|
@ -474,6 +487,14 @@ void Widget::OnWindowMouseMove(const Point& pos)
|
|||
Widget* widget = ChildAt(pos);
|
||||
if (!widget)
|
||||
widget = this;
|
||||
|
||||
if (HoverWidget != widget)
|
||||
{
|
||||
if (HoverWidget)
|
||||
HoverWidget->OnMouseLeave();
|
||||
HoverWidget = widget;
|
||||
}
|
||||
|
||||
widget->OnMouseMove(widget->MapFrom(this, pos));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue