summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-12-01 20:24:00 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-12-02 23:06:07 +0100
commit66e4ffd27fae894ae67ee7337a490aab18e56562 (patch)
tree730b9fdb6ad9a0874dcb3fbac732405ff037581c /sc/source
parent3f48954724242352d606e0ac2091afc049580c86 (diff)
Related: tdf#144410 submenu indicator misplaced under x11 gtk
so drop the GtkTreeViewColumn expand and go back to setting the size via the size-allocate, but for wayland launch it in a callback because setting the column widths during the size-allocate callback doesn't work as hoped for and the indicator is misplaced. Change-Id: I58a7a11cb1a1c065cee364f932cebddfb9ea453c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126203 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx26
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx6
2 files changed, 31 insertions, 1 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index b12868ea2f2a..f4caff97e8ad 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -145,13 +145,31 @@ void ScCheckListMenuControl::addSeparator()
IMPL_LINK(ScCheckListMenuControl, TreeSizeAllocHdl, const Size&, rSize, void)
{
+ maAllocatedSize = rSize;
+ SetDropdownPos();
+ if (!mnAsyncSetDropdownPosId && Application::GetToolkitName().startsWith("gtk"))
+ {
+ // for gtk retry again later in case it didn't work (wayland)
+ mnAsyncSetDropdownPosId = Application::PostUserEvent(LINK(this, ScCheckListMenuControl, SetDropdownPosHdl));
+ }
+}
+
+void ScCheckListMenuControl::SetDropdownPos()
+{
std::vector<int> aWidths
{
- o3tl::narrowing<int>(rSize.Width() - (mxMenu->get_text_height() * 3) / 4 - 6)
+ o3tl::narrowing<int>(maAllocatedSize.Width() - (mxMenu->get_text_height() * 3) / 4 - 6)
};
mxMenu->set_column_fixed_widths(aWidths);
}
+IMPL_LINK_NOARG(ScCheckListMenuControl, SetDropdownPosHdl, void*, void)
+{
+ mnAsyncSetDropdownPosId = nullptr;
+ SetDropdownPos();
+ mxMenu->queue_resize();
+}
+
void ScCheckListMenuControl::CreateDropDown()
{
int nWidth = (mxMenu->get_text_height() * 3) / 4;
@@ -458,6 +476,7 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScDocument
, mnSelectedMenu(MENU_NOT_SELECTED)
, mpDoc(pDoc)
, mnAsyncPostPopdownId(nullptr)
+ , mnAsyncSetDropdownPosId(nullptr)
, mpNotifier(pNotifier)
, mbHasDates(bHasDates)
, mbIsPoppedUp(false)
@@ -560,6 +579,11 @@ ScCheckListMenuControl::~ScCheckListMenuControl()
Application::RemoveUserEvent(mnAsyncPostPopdownId);
mnAsyncPostPopdownId = nullptr;
}
+ if (mnAsyncSetDropdownPosId)
+ {
+ Application::RemoveUserEvent(mnAsyncSetDropdownPosId);
+ mnAsyncSetDropdownPosId = nullptr;
+ }
}
void ScCheckListMenuControl::prepWindow()
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index 2e6041270b5b..6a5dbceb1966 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -249,6 +249,10 @@ private:
DECL_LINK(PostPopdownHdl, void*, void);
+ void SetDropdownPos();
+
+ DECL_LINK(SetDropdownPosHdl, void*, void);
+
private:
std::unique_ptr<weld::Builder> mxBuilder;
std::unique_ptr<weld::Popover> mxPopover;
@@ -281,6 +285,7 @@ private:
std::unique_ptr<Action> mxPopupEndAction;
Config maConfig;
+ Size maAllocatedSize;
int mnCheckWidthReq; /// matching width request for mxChecks
int mnWndWidth; /// whole window width.
TriState mePrevToggleAllState;
@@ -290,6 +295,7 @@ private:
ScDocument* mpDoc;
ImplSVEvent* mnAsyncPostPopdownId;
+ ImplSVEvent* mnAsyncSetDropdownPosId;
vcl::ILibreOfficeKitNotifier* mpNotifier;
bool mbHasDates;