[Libreoffice-commits] core.git: dbaccess/source include/sfx2 sfx2/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 22 19:41:13 UTC 2020


 dbaccess/source/ui/app/AppIconControl.cxx |    1 +
 include/sfx2/thumbnailview.hxx            |    1 +
 sfx2/source/control/thumbnailview.cxx     |   22 +++++++++++++---------
 3 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit cfadad134c6ab00a406a527e838d2e4940d337eb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 22 16:19:47 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 22 21:40:20 2020 +0200

    if nothing selected, don't select something on gaining focus
    
    which is how this traditionally worked before
    
    commit fd2ea8e03510c6a99ec8be6228b7422f6c5b182b
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Wed Aug 19 14:59:33 2020 +0100
    
        weld OApplicationSwapWindow
    
    Change-Id: Ib844f903bf160eb7a58c2860e41b0b7acf4aa783
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104688
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx
index 261855982604..2a89362ec91e 100644
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ b/dbaccess/source/ui/app/AppIconControl.cxx
@@ -63,6 +63,7 @@ OApplicationIconControl::OApplicationIconControl(std::unique_ptr<weld::ScrolledW
     , m_nMaxHeight(0)
 {
     mnVItemSpace = 6; // row spacing
+    mbSelectOnFocus = false;
     DrawMnemonics(true);
 }
 
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index f38b41c8b4b2..d320bda21155 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -325,6 +325,7 @@ protected:
     bool mbShowTooltips : 1;
     bool mbDrawMnemonics : 1;
     bool mbIsMultiSelectionEnabled: 1;
+    bool mbSelectOnFocus : 1;
     Color maFillColor;              ///< Background color of the thumbnail view widget.
     Color maTextColor;              ///< Text color.
     Color maHighlightColor;         ///< Color of the highlight (background) of the hovered item.
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index ba16ed06aeb7..4ac54a950afb 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -155,6 +155,7 @@ ThumbnailView::ThumbnailView(std::unique_ptr<weld::ScrolledWindow> xWindow, std:
     , mnDisplayHeight(0)
     , mnVItemSpace(-1)
     , mbAllowVScrollBar(xWindow->get_vpolicy() != VclPolicyType::NEVER)
+    , mbSelectOnFocus(true)
     , mpItemAttrs(new ThumbnailItemAttributes)
     , mxScrolledWindow(std::move(xWindow))
     , mxContextMenu(std::move(xMenu))
@@ -941,17 +942,20 @@ void ThumbnailView::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rec
 
 void ThumbnailView::GetFocus()
 {
-    // Select the first item if nothing selected
-    int nSelected = -1;
-    for (size_t i = 0, n = mItemList.size(); i < n && nSelected == -1; ++i)
+    if (mbSelectOnFocus)
     {
-        if (mItemList[i]->isSelected())
-            nSelected = i;
-    }
+        // Select the first item if nothing selected
+        int nSelected = -1;
+        for (size_t i = 0, n = mItemList.size(); i < n && nSelected == -1; ++i)
+        {
+            if (mItemList[i]->isSelected())
+                nSelected = i;
+        }
 
-    if (nSelected == -1 && !mItemList.empty())
-    {
-        SelectItem(1);
+        if (nSelected == -1 && !mItemList.empty())
+        {
+            SelectItem(1);
+        }
     }
 
     // Tell the accessible object that we got the focus.


More information about the Libreoffice-commits mailing list