summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-08-23 16:55:11 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-08-23 19:01:22 +0200
commit306180ac17ad6f3edfe403fb5b79232717f8e75f (patch)
treea62f671f9bb16c3cf8660453d2b0f9369dda8e37
parentf8dea0b01fcbc7ca8d2ff218605c61956989d0a8 (diff)
tdf#98130 vcl CheckBox: fix incorrect ignored mouse event
Regression from commit 53ef550ac6fc3505914c3d77e9d0575913e54bb3 (vcl button: Delegate RenderContext to sub-methods, use Invalidate, 2015-04-28), the problem was that when clicking on the middle checkbox in the second row of the bugdoc, the click was simply ignored, the checkbox widget remained in unchecked state. The above commit changed CheckBox::GetFocus() so that it uses Invalidate() instead of ImplDrawCheckBox(), which looks innocent, but ImplDrawCheckBox() resulted in a call to CheckBox::ImplDraw(), which (as a side effect) initialized maMouseRect to a non-empty rectangle. Now in case GetFocus() was followed by MouseButtonDown() immediately, then that ignored the mouse event as the event position wasn't in the mouse rectangle. Fix this by updating the window right after the invalidate, this way we still don't paint directly, but MouseButtonDown() already has a correct maMouseRect. Change-Id: I0371a2d86a44023042cf742dec70d4558ff5de80 Reviewed-on: https://gerrit.libreoffice.org/78021 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--vcl/source/control/button.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 27b6bd4f9b0e..ad70daed0d15 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3378,6 +3378,9 @@ void CheckBox::GetFocus()
aSize.AdjustWidth(2 );
setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
Invalidate();
+ // Trigger drawing to initialize the mouse rectangle, otherwise the mouse button down
+ // handler would ignore the mouse event.
+ Update();
}
else
ShowFocus( ImplGetFocusRect() );