[Libreoffice-commits] core.git: vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 23 17:02:22 UTC 2019


 vcl/source/control/button.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 306180ac17ad6f3edfe403fb5b79232717f8e75f
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Aug 23 16:55:11 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 23 19:01:22 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.
    
    Change-Id: I0371a2d86a44023042cf742dec70d4558ff5de80
    Reviewed-on: https://gerrit.libreoffice.org/78021
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

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() );


More information about the Libreoffice-commits mailing list