[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 27 18:14:04 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
New commits:
commit fe019b702cfe2af24c35f40db340a82892feb69c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 27 15:56:54 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 27 20:13:24 2020 +0200
detect small-button class and minimize padding and size in that case
Change-Id: I7db9d765549112e292f60d1cd47002e45f0136b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99517
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 e9c7dab0b0e0..7b9b8b134e3d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -15349,6 +15349,7 @@ private:
GtkBuilder* m_pBuilder;
GSList* m_pObjectList;
GtkWidget* m_pParentWidget;
+ GtkCssProvider *m_pSmallButtonProvider;
gulong m_nNotifySignalId;
std::vector<GtkButton*> m_aMnemonicButtons;
std::vector<GtkLabel*> m_aMnemonicLabels;
@@ -15440,6 +15441,33 @@ private:
}
if (gtk_button_get_use_underline(pButton) && !gtk_button_get_use_stock(pButton))
m_aMnemonicButtons.push_back(pButton);
+
+ GtkStyleContext *pButtonContext = gtk_widget_get_style_context(pWidget);
+ if (gtk_style_context_has_class(pButtonContext, "small-button"))
+ {
+ if (!m_pSmallButtonProvider)
+ {
+ m_pSmallButtonProvider = gtk_css_provider_new();
+ static const gchar data[] = "* { "
+ "padding: 0;"
+ "margin-left: 0px;"
+ "margin-right: 0px;"
+ "min-height: 18px;"
+ "min-width: 18px;"
+ "}";
+ const gchar olddata[] = "* { "
+ "padding: 0;"
+ "margin-left: 0px;"
+ "margin-right: 0px;"
+ "}";
+ gtk_css_provider_load_from_data(m_pSmallButtonProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+ }
+
+ gtk_style_context_add_provider(pButtonContext,
+ GTK_STYLE_PROVIDER(m_pSmallButtonProvider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+
}
else if (GTK_IS_LABEL(pWidget))
{
@@ -15522,6 +15550,7 @@ public:
: weld::Builder()
, m_pStringReplace(Translate::GetReadStringHook())
, m_pParentWidget(pParent)
+ , m_pSmallButtonProvider(nullptr)
, m_nNotifySignalId(0)
, m_xInterimGlue(pInterimGlue)
{
More information about the Libreoffice-commits
mailing list