[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - 2 commits - sfx2/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 4 19:38:44 UTC 2021


 sfx2/source/dialog/backingwindow.cxx |    8 +++++++-
 vcl/unx/gtk3/gtk3gtkinst.cxx         |   24 +++++++++++++++---------
 2 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit 0c866752bd1abc19689db22c782a8b62ace24fa3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 12:05:28 2021 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Tue May 4 21:37:48 2021 +0200

    Resolves: tdf#141857 update background to current theme
    
    Change-Id: I1004bd9944f382ca66e48575b81170cf3314845f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115073
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 01d8923978c8..1a2834bffe0d 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -103,7 +103,13 @@ public:
 
     virtual void StyleUpdated() override
     {
-        const bool bIsDark = Application::GetSettings().GetStyleSettings().GetDialogColor().IsDark();
+        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+        // tdf#141857 update background to current theme
+        OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
+        rDevice.SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
+
+        const bool bIsDark = rStyleSettings.GetDialogColor().IsDark();
         if (bIsDark != mbIsDark)
             LoadImageForWidth(GetOutputSizePixel().Width());
         weld::CustomWidgetController::StyleUpdated();
commit c0de03044e2a4db8731fdbd128ceca81468d4f6a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 11:44:49 2021 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Tue May 4 21:36:27 2021 +0200

    Related: tdf#141857 send style-updated after app settings are updated
    
    so the libreoffice settings are updated before the widget updates,
    otherwise the app settings are the old settings when the widget updates
    
    Change-Id: Id32dd55a1e5102cc707d6ee74eddfae2247e105a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115072
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 3d1936b7dd8e..f067c92b4410 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13537,7 +13537,6 @@ private:
     std::unique_ptr<IMHandler> m_xIMHandler;
     cairo_surface_t* m_pSurface;
     gulong m_nDrawSignalId;
-    gulong m_nStyleUpdatedSignalId;
     gulong m_nQueryTooltip;
     gulong m_nPopupMenu;
     gulong m_nScrollEvent;
@@ -13582,12 +13581,6 @@ private:
         m_pSurface = get_underlying_cairo_surface(*m_xDevice);
         GtkInstanceWidget::signal_size_allocate(nWidth, nHeight);
     }
-    static void signalStyleUpdated(GtkWidget*, gpointer widget)
-    {
-        GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
-        SolarMutexGuard aGuard;
-        return pThis->signal_style_updated();
-    }
     void signal_style_updated()
     {
         m_aStyleUpdatedHdl.Call(*this);
@@ -13648,6 +13641,7 @@ private:
         GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
         return pThis->signal_scroll(pEvent);
     }
+    DECL_LINK(SettingsChangedHdl, VclSimpleEvent&, void);
 public:
     GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* pBuilder, const a11yref& rA11y, bool bTakeOwnership)
         : GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership)
@@ -13657,7 +13651,6 @@ public:
         , m_xDevice(DeviceFormat::DEFAULT)
         , m_pSurface(nullptr)
         , m_nDrawSignalId(g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(signalDraw), this))
-        , m_nStyleUpdatedSignalId(g_signal_connect(m_pDrawingArea,"style-updated", G_CALLBACK(signalStyleUpdated), this))
         , m_nQueryTooltip(g_signal_connect(m_pDrawingArea, "query-tooltip", G_CALLBACK(signalQueryTooltip), this))
         , m_nPopupMenu(g_signal_connect(m_pDrawingArea, "popup-menu", G_CALLBACK(signalPopupMenu), this))
         , m_nScrollEvent(g_signal_connect(m_pDrawingArea, "scroll-event", G_CALLBACK(signalScroll), this))
@@ -13665,6 +13658,8 @@ public:
         gtk_widget_set_has_tooltip(m_pWidget, true);
         g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this);
         m_xDevice->EnableRTL(get_direction());
+
+        Application::AddEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl));
     }
 
     AtkObject* GetAtkObject(AtkObject* pDefaultAccessible)
@@ -13802,6 +13797,8 @@ public:
 
     virtual ~GtkInstanceDrawingArea() override
     {
+        Application::RemoveEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl));
+
         g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
         if (m_pAccessible)
             g_object_unref(m_pAccessible);
@@ -13811,7 +13808,6 @@ public:
         g_signal_handler_disconnect(m_pDrawingArea, m_nScrollEvent);
         g_signal_handler_disconnect(m_pDrawingArea, m_nPopupMenu);
         g_signal_handler_disconnect(m_pDrawingArea, m_nQueryTooltip);
-        g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId);
         g_signal_handler_disconnect(m_pDrawingArea, m_nDrawSignalId);
     }
 
@@ -13833,6 +13829,16 @@ public:
     }
 };
 
+IMPL_LINK(GtkInstanceDrawingArea, SettingsChangedHdl, VclSimpleEvent&, rEvent, void)
+{
+    if (rEvent.GetId() != VclEventId::ApplicationDataChanged)
+        return;
+
+    DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData());
+    if (pData->GetType() == DataChangedEventType::SETTINGS)
+        signal_style_updated();
+}
+
 class IMHandler
 {
 private:


More information about the Libreoffice-commits mailing list