diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-22 16:19:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-22 21:40:20 +0200 |
commit | cfadad134c6ab00a406a527e838d2e4940d337eb (patch) | |
tree | 77af9b1f99054aa58ed6ee14e4937ccac46c2973 /sfx2/source/control/thumbnailview.cxx | |
parent | 32f35ba5f01c580016e327a3fcceb88cb07164ed (diff) |
if nothing selected, don't select something on gaining focus
which is how this traditionally worked before
commit fd2ea8e03510c6a99ec8be6228b7422f6c5b182b
Author: Caolán McNamara <caolanm@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@redhat.com>
Diffstat (limited to 'sfx2/source/control/thumbnailview.cxx')
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
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. |