summaryrefslogtreecommitdiff
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 22:46:17 +0100
commit3a59d0504de22aee5bdb2d61e482fa8d87cd48ff (patch)
tree753a2ea9bc8777a7c5f0358ba6df92e5ba446f9d
parent31c036e945b2b6a9cdcc460d4b3454e80a58d255 (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/+/126207 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx26
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx6
-rw-r--r--sc/uiconfig/scalc/ui/filterdropdown.ui1
3 files changed, 31 insertions, 2 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;
diff --git a/sc/uiconfig/scalc/ui/filterdropdown.ui b/sc/uiconfig/scalc/ui/filterdropdown.ui
index 3a38b0e8104f..caa4506aa453 100644
--- a/sc/uiconfig/scalc/ui/filterdropdown.ui
+++ b/sc/uiconfig/scalc/ui/filterdropdown.ui
@@ -86,7 +86,6 @@
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
- <property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>