summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-01-28 09:58:05 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2022-01-30 22:01:20 +0100
commit10600d1988665bd950166891fa9df314bb847ac3 (patch)
tree3edbecbd87778c0a43a40e8ad58388e812ac692d /sc
parentb5b115ecc87c09146eb76d891496175218ed45c2 (diff)
Resolves: tdf#147016 ensure focus returns to document after popup closes
Change-Id: I67e59afc08bc5983d473cb9dceb4fcefedeec117 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129095 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx17
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx1
3 files changed, 16 insertions, 4 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index f62b2369da27..88366b2ff0ac 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -283,6 +283,8 @@ void ScCheckListMenuControl::queueCloseSubMenu()
maCloseTimer.mpSubMenu = maOpenTimer.mpSubMenu;
maCloseTimer.mnMenuPos = maOpenTimer.mnMenuPos;
+ maOpenTimer.mpSubMenu = nullptr;
+ maOpenTimer.mnMenuPos = MENU_NOT_SELECTED;
maCloseTimer.maTimer.Start();
}
@@ -570,11 +572,8 @@ void ScCheckListMenuControl::GrabFocus()
}
}
-ScCheckListMenuControl::~ScCheckListMenuControl()
+void ScCheckListMenuControl::DropPendingEvents()
{
- EndPopupMode();
- for (auto& rMenuItem : maMenuItems)
- rMenuItem.mxSubMenuWin.reset();
if (mnAsyncPostPopdownId)
{
Application::RemoveUserEvent(mnAsyncPostPopdownId);
@@ -587,6 +586,14 @@ ScCheckListMenuControl::~ScCheckListMenuControl()
}
}
+ScCheckListMenuControl::~ScCheckListMenuControl()
+{
+ EndPopupMode();
+ for (auto& rMenuItem : maMenuItems)
+ rMenuItem.mxSubMenuWin.reset();
+ DropPendingEvents();
+}
+
void ScCheckListMenuControl::prepWindow()
{
mxMenu->set_size_request(-1, mxMenu->get_preferred_size().Height() + 2);
@@ -1427,6 +1434,8 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, PopupModeEndHdl, weld::Popover&, void)
if (mxPopupEndAction)
mxPopupEndAction->execute();
+ DropPendingEvents();
+
if (comphelper::LibreOfficeKit::isActive())
NotifyCloseLOK();
}
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index 961fddceac58..8d135870d871 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -254,6 +254,8 @@ private:
DECL_LINK(SetDropdownPosHdl, void*, void);
+ void DropPendingEvents();
+
private:
std::unique_ptr<weld::Builder> mxBuilder;
std::unique_ptr<weld::Popover> mxPopover;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 42b02d4b9743..2e4fcf0bc38d 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -524,6 +524,7 @@ public:
virtual bool execute() override
{
mpWindow->RefreshAutoFilterButton(maPos);
+ mpWindow->GrabFocus();
return false; // this is called after the popup has been closed
}
};