diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-16 15:20:58 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-10-07 13:23:37 +0200 |
commit | 4c8916fce009a1aee0e644fa62150a9279202a53 (patch) | |
tree | dc9ca786136c2a8f2973d21a30b9606b5bd5bfe1 /vcl | |
parent | 8e5fb64aa9f80941ae1336955f1fe63281d41acc (diff) |
Related: tdf#141633 allow "small-button" elements to shrink further
so they can go smaller to fit small zoom sizes for the table control
Change-Id: I6df47ed57a511e3b00d10075dedfdd9f1edcc477
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123136
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 10ec02f6fe4cd2c29021b967c255ace3f71424b5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123145
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtkdata.cxx | 49 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 14 |
2 files changed, 38 insertions, 25 deletions
diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx index 63ed47d6c8c3..86ea3a430875 100644 --- a/vcl/unx/gtk3/gtkdata.cxx +++ b/vcl/unx/gtk3/gtkdata.cxx @@ -417,30 +417,41 @@ 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.1) gtk3 small toolbar button in infobars (toolbar.small-button button) + 1.c.2) gtk4 small toolbar button in infobars (box.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); + "button.small-button, toolbar.small-button button, box.small-button button, " + "combobox.small-button *.combo, box#combobox.small-button *.combo, entry.small-button { " + "padding: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0;" + "border-width: 0; min-height: 0; min-width: 0; }" + "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 +554,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 +572,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 94a5a614d3c6..f535c06871fc 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -8086,6 +8086,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)); @@ -8167,6 +8170,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; @@ -8293,13 +8299,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 |