vcl/source/control/button.cxx | 3 +++ 1 file changed, 3 insertions(+) New commits: commit 6c6f459f32144d06385bd542944f24afef0240eb Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri Aug 23 16:55:11 2019 +0200 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Mon Sep 2 09:07:18 2019 +0200
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. (cherry picked from commit 306180ac17ad6f3edfe403fb5b79232717f8e75f) Change-Id: I0371a2d86a44023042cf742dec70d4558ff5de80 Reviewed-on: https://gerrit.libreoffice.org/78107 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index f78fa7d92994..15f80be207b6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3395,6 +3395,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() ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits