mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-01 07:12:25 +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;
|
std::unique_ptr<Canvas> DispCanvas;
|
||||||
Widget* FocusWidget = nullptr;
|
Widget* FocusWidget = nullptr;
|
||||||
Widget* CaptureWidget = nullptr;
|
Widget* CaptureWidget = nullptr;
|
||||||
|
Widget* HoverWidget = nullptr;
|
||||||
|
|
||||||
Widget(const Widget&) = delete;
|
Widget(const Widget&) = delete;
|
||||||
Widget& operator=(const Widget&) = delete;
|
Widget& operator=(const Widget&) = delete;
|
||||||
|
|
|
@ -75,6 +75,19 @@ void Widget::MoveBefore(Widget* sibling)
|
||||||
|
|
||||||
void Widget::DetachFromParent()
|
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)
|
if (PrevSiblingObj)
|
||||||
PrevSiblingObj->NextSiblingObj = NextSiblingObj;
|
PrevSiblingObj->NextSiblingObj = NextSiblingObj;
|
||||||
if (NextSiblingObj)
|
if (NextSiblingObj)
|
||||||
|
@ -474,6 +487,14 @@ void Widget::OnWindowMouseMove(const Point& pos)
|
||||||
Widget* widget = ChildAt(pos);
|
Widget* widget = ChildAt(pos);
|
||||||
if (!widget)
|
if (!widget)
|
||||||
widget = this;
|
widget = this;
|
||||||
|
|
||||||
|
if (HoverWidget != widget)
|
||||||
|
{
|
||||||
|
if (HoverWidget)
|
||||||
|
HoverWidget->OnMouseLeave();
|
||||||
|
HoverWidget = widget;
|
||||||
|
}
|
||||||
|
|
||||||
widget->OnMouseMove(widget->MapFrom(this, pos));
|
widget->OnMouseMove(widget->MapFrom(this, pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue