[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 16 19:45:28 UTC 2021
vcl/unx/gtk3/gtkdata.cxx | 45 +++++++++++++++++++++++++++------------------
vcl/unx/gtk3/gtkinst.cxx | 14 ++++++++------
2 files changed, 35 insertions(+), 24 deletions(-)
New commits:
commit cb636701881df38f3092d499142acbf62f4eff3c
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 16 15:20:58 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 16 21:44:35 2021 +0200
gtk4: redo theme unwanted active tab in overflow notebook into invisiblity
don't quite see why this doesn't work out of the box in gtk4, but
putting it into the application-level style provider and using it via a
style class works and probably makes more sense anyway.
Change-Id: I4de196e462d7440174a0d67be25923bddab68197
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117337
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx
index 63ed47d6c8c3..65be8189d3f0 100644
--- a/vcl/unx/gtk3/gtkdata.cxx
+++ b/vcl/unx/gtk3/gtkdata.cxx
@@ -417,30 +417,39 @@ bool GtkSalData::Yield( bool bWait, bool bHandleAllCurrentEvents )
return bWasEvent;
}
-static GtkStyleProvider* CreateSmallButtonProvider()
+static GtkStyleProvider* CreateStyleProvider()
{
/*
- set a provider to allow certain widgets to have no padding
+ set a provider to:
- a) little close button in menubar to close back to start-center
- b) and small buttons in view->data sources (button.small-button)
- c) small toolbar button in infobars (toolbar.small-button button)
- d) comboboxes in the data browser for tdf#137695 (box#combobox button.small-button,
+ 1) allow certain widgets to have no padding
+
+ 1.a) little close button in menubar to close back to start-center
+ 1.b) and small buttons in view->data sources (button.small-button)
+ 1.c) small toolbar button in infobars (toolbar.small-button button)
+ 1.d) comboboxes in the data browser for tdf#137695 (box#combobox button.small-button,
which would instead be combobox button.small-button if we didn't replace GtkComboBox,
see GtkInstanceComboBox for an explanation for why we do that)
- e) entry in the data browser for tdf#137695 (entry.small-button)
+ 1.e) entry in the data browser for tdf#137695 (entry.small-button)
+
+ 2) hide the unwanted active tab in an 'overflow' notebook of double-decker notebooks.
+ (tdf#122623) it's nigh impossible to have a GtkNotebook without an active (checked) tab,
+ so theme the unwanted tab into invisibility
*/
- GtkCssProvider* pSmallButtonProvider = gtk_css_provider_new();
+ GtkCssProvider* pStyleProvider = gtk_css_provider_new();
static const gchar data[] =
"button.small-button, toolbar.small-button button, combobox.small-button *.combo, box#combobox.small-button *.combo, entry.small-button { "
- "padding: 0;"
- "margin-left: 0px;"
- "margin-right: 0px;"
- "min-height: 18px;"
- "min-width: 18px;"
- "}";
- css_provider_load_from_data(pSmallButtonProvider, data, -1);
- return GTK_STYLE_PROVIDER(pSmallButtonProvider);
+ "padding: 0; margin-left: 0px; margin-right: 0px;"
+ "min-height: 18px; min-width: 18px; }"
+ "notebook.overflow > header.top > tabs > tab:checked { "
+ "box-shadow: none; padding: 0 0 0 0; margin: 0 0 0 0;"
+ "border-image: none; border-image-width: 0 0 0 0;"
+ "background-image: none; background-color: transparent;"
+ "border-radius: 0 0 0 0; border-width: 0 0 0 0;"
+ "border-style: none; border-color: transparent;"
+ "opacity: 0; min-height: 0; min-width: 0; }";
+ css_provider_load_from_data(pStyleProvider, data, -1);
+ return GTK_STYLE_PROVIDER(pStyleProvider);
}
void GtkSalData::Init()
@@ -543,7 +552,7 @@ void GtkSalData::Init()
GListModel *pMonitors = gdk_display_get_monitors(pGdkDisp);
g_signal_connect(pMonitors, "items-changed", G_CALLBACK(signalMonitorsChanged), pDisplay);
- gtk_style_context_add_provider_for_display(pGdkDisp, CreateSmallButtonProvider(),
+ gtk_style_context_add_provider_for_display(pGdkDisp, CreateStyleProvider(),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
#else
int nScreens = gdk_display_get_n_screens( pGdkDisp );
@@ -561,7 +570,7 @@ void GtkSalData::Init()
g_signal_connect( G_OBJECT(pScreen), "monitors-changed",
G_CALLBACK(signalMonitorsChanged), pDisplay );
- gtk_style_context_add_provider_for_screen(pScreen, CreateSmallButtonProvider(),
+ gtk_style_context_add_provider_for_screen(pScreen, CreateStyleProvider(),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
#endif
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 3236d3bd9600..de09ae503a21 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8045,6 +8045,9 @@ private:
#if !GTK_CHECK_VERSION(4, 0, 0)
gtk_widget_freeze_child_notify(GTK_WIDGET(m_pNotebook));
gtk_widget_freeze_child_notify(GTK_WIDGET(m_pOverFlowNotebook));
+#else
+ g_object_freeze_notify(G_OBJECT(m_pNotebook));
+ g_object_freeze_notify(G_OBJECT(m_pOverFlowNotebook));
#endif
gtk_widget_show(GTK_WIDGET(m_pOverFlowNotebook));
@@ -8126,6 +8129,9 @@ private:
#if !GTK_CHECK_VERSION(4, 0, 0)
gtk_widget_thaw_child_notify(GTK_WIDGET(m_pOverFlowNotebook));
gtk_widget_thaw_child_notify(GTK_WIDGET(m_pNotebook));
+#else
+ g_object_thaw_notify(G_OBJECT(m_pOverFlowNotebook));
+ g_object_thaw_notify(G_OBJECT(m_pNotebook));
#endif
m_bOverFlowBoxActive = true;
@@ -8257,13 +8263,9 @@ public:
gtk_notebook_set_show_border(m_pOverFlowNotebook, false);
// tdf#122623 it's nigh impossible to have a GtkNotebook without an active (checked) tab, so try and theme
- // the unwanted tab into invisibility
+ // the unwanted tab into invisibility via the 'overflow' class themed by global CreateStyleProvider
GtkStyleContext *pNotebookContext = gtk_widget_get_style_context(GTK_WIDGET(m_pOverFlowNotebook));
- GtkCssProvider *pProvider = gtk_css_provider_new();
- static const gchar data[] = "header.top > tabs > tab:checked { box-shadow: none; padding: 0 0 0 0; margin: 0 0 0 0; border-image: none; border-image-width: 0 0 0 0; background-image: none; background-color: transparent; border-radius: 0 0 0 0; border-width: 0 0 0 0; border-style: none; border-color: transparent; opacity: 0; min-height: 0; min-width: 0; }";
- css_provider_load_from_data(pProvider, data, -1);
- gtk_style_context_add_provider(pNotebookContext, GTK_STYLE_PROVIDER(pProvider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_style_context_add_class(pNotebookContext, "overflow");
}
virtual int get_current_page() const override
More information about the Libreoffice-commits
mailing list