include/vcl/treelistbox.hxx | 4 ++-- include/vcl/weld.hxx | 3 ++- vcl/source/app/salvtables.cxx | 18 +++++++++++++----- vcl/source/treelist/treelistbox.cxx | 12 +++++------- vcl/unx/gtk3/gtk3gtkinst.cxx | 14 +++++++++++--- 5 files changed, 33 insertions(+), 18 deletions(-)
New commits: commit 8ae03b548e4b98d4740ab986c41fc24279734128 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Dec 9 12:09:38 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Dec 9 15:25:49 2019 +0100 only connect to tooltip query when we have to Change-Id: I0b7f1b798129b41c9831ccdd47cd509680b19de2 Reviewed-on: https://gerrit.libreoffice.org/84742 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 54a72e80c32d..b7d86c9c7df9 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -734,8 +734,9 @@ protected: OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); } public: - void connect_query_tooltip(const Link<const TreeIter&, OUString>& rLink) + virtual void connect_query_tooltip(const Link<const TreeIter&, OUString>& rLink) { + assert(!m_aQueryTooltipHdl.IsSet() || !rLink.IsSet()); m_aQueryTooltipHdl = rLink; } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c37cab6261e8..5b0686a9f77e 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3491,7 +3491,6 @@ public: m_xTreeView->SetDoubleClickHdl(LINK(this, SalInstanceTreeView, DoubleClickHdl)); m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl)); m_xTreeView->SetPopupMenuHdl(LINK(this, SalInstanceTreeView, PopupMenuHdl)); - m_xTreeView->SetTooltipHdl(LINK(this, SalInstanceTreeView, TooltipHdl)); const long aTabPositions[] = { 0 }; m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions); LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()); @@ -3520,6 +3519,12 @@ public: m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl)); } + virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override + { + weld::TreeView::connect_query_tooltip(rLink); + m_xTreeView->SetTooltipHdl(LINK(this, SalInstanceTreeView, TooltipHdl)); + } + virtual void columns_autosize() override { std::vector<long> aWidths; diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 71a8489ffbd5..9fe5c2d289ad 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -8564,7 +8564,7 @@ public: , m_nDragDataDeleteignalId(0) , m_nDragGetSignalId(0) , m_nKeyPressSignalId(g_signal_connect(pTreeView, "key-press-event", G_CALLBACK(signalKeyPress), this)) - , m_nQueryTooltipSignalId(g_signal_connect(pTreeView, "query-tooltip", G_CALLBACK(signalQueryTooltip), this)) + , m_nQueryTooltipSignalId(0) , m_pChangeEvent(nullptr) { m_pColumns = gtk_tree_view_get_columns(m_pTreeView); @@ -8625,6 +8625,12 @@ public: m_nRowInsertedSignalId = g_signal_connect(pModel, "row-inserted", G_CALLBACK(signalRowInserted), this); } + virtual void connect_query_tooltip(const Link<const weld::TreeIter&, OUString>& rLink) override + { + weld::TreeView::connect_query_tooltip(rLink); + m_nQueryTooltipSignalId = g_signal_connect(m_pTreeView, "query-tooltip", G_CALLBACK(signalQueryTooltip), this); + } + virtual void columns_autosize() override { gtk_tree_view_columns_autosize(m_pTreeView); @@ -9998,6 +10004,8 @@ public: { if (m_pChangeEvent) Application::RemoveUserEvent(m_pChangeEvent); + if (m_nQueryTooltipSignalId) + g_signal_handler_disconnect(m_pTreeView, m_nQueryTooltipSignalId); g_signal_handler_disconnect(m_pTreeView, m_nKeyPressSignalId); g_signal_handler_disconnect(m_pTreeView, m_nDragEndSignalId); g_signal_handler_disconnect(m_pTreeView, m_nDragBeginSignalId); @@ -10029,8 +10037,6 @@ public: m_aColumnSignalIds.pop_back(); } g_list_free(m_pColumns); - - g_signal_handler_disconnect(m_pTreeView, m_nQueryTooltipSignalId); } }; commit c29fa13bd050134e751b01d0c4178538c4c20f69 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Dec 9 11:56:01 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Dec 9 15:25:38 2019 +0100 Related tdf#108458 if no TooltipHdl set use usual tooltip also if the Tooltip was blank continue to use usual tooltip Change-Id: I7dd02ffcbb558684ff41e50586284607a1ea4881 Reviewed-on: https://gerrit.libreoffice.org/84741 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx index ba088cee8c6f..69bbdabfd411 100644 --- a/include/vcl/treelistbox.hxx +++ b/include/vcl/treelistbox.hxx @@ -200,7 +200,7 @@ class VCL_DLLPUBLIC SvTreeListBox Link<SvTreeListBox*,void> aSelectHdl; Link<SvTreeListBox*,void> aDeselectHdl; Link<const CommandEvent&, bool> aPopupMenuHdl; - Link<const HelpEvent&, void> aTooltipHdl; + Link<const HelpEvent&, bool> aTooltipHdl; Image aPrevInsertedExpBmp; Image aPrevInsertedColBmp; @@ -434,7 +434,7 @@ public: void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;} void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;} void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; } - void SetTooltipHdl(const Link<const HelpEvent&, void>& rLink) { aTooltipHdl = rLink; } + void SetTooltipHdl(const Link<const HelpEvent&, bool>& rLink) { aTooltipHdl = rLink; } virtual void ExpandedHdl(); virtual bool ExpandingHdl(); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e26a6a3713fe..c37cab6261e8 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3469,7 +3469,7 @@ private: DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void); DECL_LINK(CompareHdl, const SvSortData&, sal_Int32); DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); - DECL_LINK(TooltipHdl, const HelpEvent&, void); + DECL_LINK(TooltipHdl, const HelpEvent&, bool); bool IsDummyEntry(SvTreeListEntry* pEntry) const { @@ -4627,24 +4627,27 @@ public: m_xTreeView->SetSelectHdl(Link<SvTreeListBox*, void>()); m_xTreeView->SetDeselectHdl(Link<SvTreeListBox*, void>()); m_xTreeView->SetScrolledHdl(Link<SvTreeListBox*, void>()); - m_xTreeView->SetTooltipHdl(Link<const HelpEvent&, void>()); + m_xTreeView->SetTooltipHdl(Link<const HelpEvent&, bool>()); } }; -IMPL_LINK(SalInstanceTreeView, TooltipHdl, const HelpEvent&, rHEvt, void) +IMPL_LINK(SalInstanceTreeView, TooltipHdl, const HelpEvent&, rHEvt, bool) { if (notify_events_disabled()) - return; + return false; Point aPos(m_xTreeView->ScreenToOutputPixel(rHEvt.GetMousePosPixel())); SvTreeListEntry* pEntry = m_xTreeView->GetEntry(aPos); if (pEntry) { SalInstanceTreeIter aIter(pEntry); OUString aTooltip = signal_query_tooltip(aIter); + if (aTooltip.isEmpty()) + return false; Size aSize(m_xTreeView->GetOutputSizePixel().Width(), m_xTreeView->GetEntryHeight()); tools::Rectangle aScreenRect(m_xTreeView->OutputToScreenPixel(m_xTreeView->GetEntryPosition(pEntry)), aSize); Help::ShowQuickHelp(m_xTreeView, aScreenRect, aTooltip); } + return true; } IMPL_LINK(SalInstanceTreeView, CompareHdl, const SvSortData&, rSortData, sal_Int32) diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index a192fa7ddb03..5e9629d266b4 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -3322,13 +3322,11 @@ void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos ) void SvTreeListBox::RequestHelp( const HelpEvent& rHEvt ) { - if (aTooltipHdl.IsSet()) - aTooltipHdl.Call(rHEvt); - else - { - if( !pImpl->RequestHelp( rHEvt ) ) - Control::RequestHelp( rHEvt ); - } + if (aTooltipHdl.IsSet() && aTooltipHdl.Call(rHEvt)) + return; + + if( !pImpl->RequestHelp( rHEvt ) ) + Control::RequestHelp( rHEvt ); } sal_Int32 SvTreeListBox::DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 504355c09189..71a8489ffbd5 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -8534,6 +8534,8 @@ private: if (!gtk_tree_view_get_tooltip_context(pTreeView, &x, &y, keyboard_tip, &pModel, &pPath, &iter)) return false; OUString aTooltip = pThis->signal_query_tooltip(GtkInstanceTreeIter(iter)); + if (aTooltip.isEmpty()) + return false; gtk_tooltip_set_text(tooltip, OUStringToOString(aTooltip, RTL_TEXTENCODING_UTF8).getStr()); gtk_tree_view_set_tooltip_row(pTreeView, tooltip, pPath); gtk_tree_path_free(pPath); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits