Kaydet (Commit) 5c49c13b authored tarafından Takeshi Abe's avatar Takeshi Abe

tdf#101472 Prompt repaint of Elements window when mouse leaves

This also reduces some cycles in SmElementsControl::MouseMove().

Change-Id: I1dd5f9cd37e4a78010ebb719b4726f9b061d8ff2
Reviewed-on: https://gerrit.libreoffice.org/30897Reviewed-by: 's avatarTakeshi Abe <tabe@fixedpoint.jp>
Tested-by: 's avatarTakeshi Abe <tabe@fixedpoint.jp>
üst 6e3ff896
...@@ -441,7 +441,14 @@ void SmElementsControl::RequestHelp(const HelpEvent& rHEvt) ...@@ -441,7 +441,14 @@ void SmElementsControl::RequestHelp(const HelpEvent& rHEvt)
void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent ) void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
{ {
SmElement* pPrevElement = mpCurrentElement;
mpCurrentElement = nullptr; mpCurrentElement = nullptr;
if (rMouseEvent.IsLeaveWindow())
{
LayoutOrPaintContents();
Invalidate();
return;
}
if (Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel())) if (Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()))
{ {
for (std::unique_ptr<SmElement> & i : maElementList) for (std::unique_ptr<SmElement> & i : maElementList)
...@@ -450,11 +457,12 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent ) ...@@ -450,11 +457,12 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
Rectangle rect(element->mBoxLocation, element->mBoxSize); Rectangle rect(element->mBoxLocation, element->mBoxSize);
if (rect.IsInside(rMouseEvent.GetPosPixel())) if (rect.IsInside(rMouseEvent.GetPosPixel()))
{ {
if (mpCurrentElement != element) if (pPrevElement != element)
{ {
mpCurrentElement = element; mpCurrentElement = element;
LayoutOrPaintContents(); LayoutOrPaintContents();
Invalidate(); Invalidate();
return;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment