svtools/source/control/valueset.cxx |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 5714eb5fe369672cde2459e8fe4ec0169190dff0
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Oct 26 16:59:53 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Oct 26 20:50:17 2021 +0200

    grab focus if clicked on anywhere, not just on a specific value
    
    Change-Id: I03b47080707c469d49e6cd9148573522d7f79da9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124232
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svtools/source/control/valueset.cxx 
b/svtools/source/control/valueset.cxx
index c30ada1d4ba3..c2baa2d5a483 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -481,20 +481,27 @@ bool ValueSet::MouseButtonDown( const MouseEvent& 
rMouseEvent )
 {
     if (rMouseEvent.IsLeft() && !rMouseEvent.IsMod2())
     {
+        bool bConsumed = false;
         ValueSetItem* pItem = ImplGetItem( ImplGetItem( 
rMouseEvent.GetPosPixel() ) );
-        if (pItem)
+        if (rMouseEvent.GetClicks() == 1)
         {
-            if (rMouseEvent.GetClicks() == 1)
+            if (pItem)
             {
-                SelectItem( pItem->mnId );
-                if (!(GetStyle() & WB_NOPOINTERFOCUS))
-                    GrabFocus();
+                SelectItem(pItem->mnId);
+                bConsumed = true;
             }
-            else if ( rMouseEvent.GetClicks() == 2 )
-                maDoubleClickHdl.Call( this );
-
-            return true;
+            if (!(GetStyle() & WB_NOPOINTERFOCUS))
+            {
+                GrabFocus();
+                bConsumed = true;
+            }
+        }
+        else if (pItem && rMouseEvent.GetClicks() == 2)
+        {
+            maDoubleClickHdl.Call(this);
+            bConsumed = true;
         }
+        return bConsumed;
     }
 
     return CustomWidgetController::MouseButtonDown( rMouseEvent );

Reply via email to