From e754591fc13cf29c21fbbe4fb05146dbf4b60679 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 29 Jun 2021 12:13:19 +0100 Subject: Related: tdf#143088 listen to DefaultWindow for Settings changed having multiple Application::EventListener are expensive while a Window::EventListener is cheap and in this document there are thousands of comments so having thousands of EventListeners is problematic. Change-Id: I64fd12e4bcb8e4fd131effe94e6882e54cfcaf19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118084 Tested-by: Michael Stahl Reviewed-by: Michael Stahl --- vcl/unx/gtk3/gtk3gtkinst.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 2d4dc36ce5fe..6b2e557c35bf 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -13642,7 +13642,7 @@ private: GtkInstanceDrawingArea* pThis = static_cast(widget); return pThis->signal_scroll(pEvent); } - DECL_LINK(SettingsChangedHdl, VclSimpleEvent&, void); + DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void); public: GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* pBuilder, const a11yref& rA11y, bool bTakeOwnership) : GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership) @@ -13660,7 +13660,7 @@ public: g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this); m_xDevice->EnableRTL(get_direction()); - Application::AddEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl)); + ImplGetDefaultWindow()->AddEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl)); } AtkObject* GetAtkObject(AtkObject* pDefaultAccessible) @@ -13798,7 +13798,7 @@ public: virtual ~GtkInstanceDrawingArea() override { - Application::RemoveEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl)); + ImplGetDefaultWindow()->RemoveEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl)); g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea"); if (m_pAccessible) @@ -13830,12 +13830,12 @@ public: } }; -IMPL_LINK(GtkInstanceDrawingArea, SettingsChangedHdl, VclSimpleEvent&, rEvent, void) +IMPL_LINK(GtkInstanceDrawingArea, SettingsChangedHdl, VclWindowEvent&, rEvent, void) { - if (rEvent.GetId() != VclEventId::ApplicationDataChanged) + if (rEvent.GetId() != VclEventId::WindowDataChanged) return; - DataChangedEvent* pData = static_cast(static_cast(rEvent).GetData()); + DataChangedEvent* pData = static_cast(rEvent.GetData()); if (pData->GetType() == DataChangedEventType::SETTINGS) signal_style_updated(); } -- cgit