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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 29 20:11:14 UTC 2020


 svtools/source/control/ctrlbox.cxx |    6 ++++--
 vcl/unx/gtk3/gtk3gtkinst.cxx       |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 2 deletions(-)

New commits:
commit 72ceb3ebb76cbb2888b413464730c15adc4f504b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 29 14:19:36 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Apr 29 22:10:54 2020 +0200

    don't run generate preview idle if there are no fonts in the list
    
    and reset preview idle when font list is cleared
    
    Change-Id: Ice8c149754fbf64c9f81aa812465f0269de4c9d0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93161
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index f5ad5df85fe5..fafc2cb02868 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -423,6 +423,8 @@ void FontNameBox::InitFontMRUEntriesFile()
 void FontNameBox::ImplDestroyFontList()
 {
     mpFontList.reset();
+    mnPreviewProgress = 0;
+    maUpdateIdle.Stop();
 }
 
 void FontNameBox::Fill( const FontList* pList )
@@ -453,9 +455,9 @@ void FontNameBox::Fill( const FontList* pList )
 
     m_xComboBox->thaw();
 
-    if (mbWYSIWYG)
+    if (mbWYSIWYG && nFontCount)
     {
-        mnPreviewProgress = 0;
+        assert(mnPreviewProgress == 0 && "ImplDestroyFontList wasn't called");
         maUpdateIdle.Start();
     }
 
commit 754bea8c6a17889f9d4d23bf98847b6b67253220
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 29 15:06:42 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Apr 29 22:10:36 2020 +0200

    remove the padding around the dropdown button of GtkMenuToolButtons
    
    the default is very wide in the default gtk themes, try and minimize
    that padding as the existing designs generally assume a very narrow
    dropdown
    
    Change-Id: Ibb3b0280067e981b7c782b6023fc3d36dbc0d364
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93167
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 42a97247beb2..c9ef82ec8657 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -7661,6 +7661,7 @@ class GtkInstanceToolbar : public GtkInstanceWidget, public virtual weld::Toolba
 {
 private:
     GtkToolbar* m_pToolbar;
+    GtkCssProvider *m_pMenuButtonProvider;
 
     std::map<OString, GtkToolItem*> m_aMap;
     std::map<OString, std::unique_ptr<GtkInstanceMenuButton>> m_aMenuButtonMap;
@@ -7718,6 +7719,39 @@ private:
             // left in the main document and not in the toolbar
             gtk_button_set_focus_on_click(GTK_BUTTON(pMenuButton), false);
             g_signal_connect(pMenuButton, "toggled", G_CALLBACK(signalItemToggled), this);
+
+            if (pMenuButton)
+            {
+                // by default the GtkMenuButton down arrow button is as wide as
+                // a normal button and LibreOffice's original ones are very
+                // narrow, that assumption is fairly baked into the toolbar and
+                // sidebar designs, try and minimize the width of the dropdown
+                // zone.
+                GtkStyleContext *pButtonContext = gtk_widget_get_style_context(GTK_WIDGET(pMenuButton));
+
+                if (!m_pMenuButtonProvider)
+                {
+                    m_pMenuButtonProvider = gtk_css_provider_new();
+                    static const gchar data[] = "* { "
+                      "padding: 0;"
+                      "margin-left: 0px;"
+                      "margin-right: 0px;"
+                      "min-width: 4px;"
+                      "}";
+                    const gchar olddata[] = "* { "
+                      "padding: 0;"
+                      "margin-left: 0px;"
+                      "margin-right: 0px;"
+                      "}";
+                    gtk_css_provider_load_from_data(m_pMenuButtonProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+                }
+
+                gtk_style_context_add_provider(pButtonContext,
+                                               GTK_STYLE_PROVIDER(m_pMenuButtonProvider),
+                                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+                gtk_style_context_add_class(pButtonContext, "small-button");
+            }
+
         }
         if (!GTK_IS_TOOL_BUTTON(pToolItem))
             return;
@@ -7788,6 +7822,7 @@ public:
     GtkInstanceToolbar(GtkToolbar* pToolbar, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
         : GtkInstanceWidget(GTK_WIDGET(pToolbar), pBuilder, bTakeOwnership)
         , m_pToolbar(pToolbar)
+        , m_pMenuButtonProvider(nullptr)
     {
         gtk_container_foreach(GTK_CONTAINER(pToolbar), collect, this);
     }


More information about the Libreoffice-commits mailing list