[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 29 13:29:04 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit d0bdc56da1833bc07992ddc87eb1fcffb926cee9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 29 12:13:19 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 29 15:28:30 2021 +0200

    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.
    
    under gtk with start center open use gnome-tweaks to toggle in/out of a
    dark theme and the branding logo should continue to switch dark/light
    variants
    
    Change-Id: I64fd12e4bcb8e4fd131effe94e6882e54cfcaf19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118083
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 9af25f36e56b..1be34140abeb 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -16411,7 +16411,7 @@ private:
     }
 #endif
 
-    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)
@@ -16437,7 +16437,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));
     }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
@@ -16616,7 +16616,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 !GTK_CHECK_VERSION(4, 0, 0)
@@ -16658,12 +16658,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<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData());
+    DataChangedEvent* pData = static_cast<DataChangedEvent*>(rEvent.GetData());
     if (pData->GetType() == DataChangedEventType::SETTINGS)
         signal_style_updated();
 }


More information about the Libreoffice-commits mailing list