vcl/unx/gtk3/gtk3gtkdata.cxx | 47 +++++++++++++++++++++++++++++----------- vcl/unx/gtk3/gtk3gtkinst.cxx | 1 vcl/unx/gtk3/gtk3gtksalmenu.cxx | 20 +---------------- 3 files changed, 37 insertions(+), 31 deletions(-)
New commits: commit ced00aadcffd00e5cd0acc00670cb52b2f733388 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Sep 3 16:04:35 2020 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sun Jan 17 22:11:30 2021 +0100 set small button provider at screen instead of at each widget and make the small close button in the menubar use that same provider add a small-button pattern to match buttons in toolbars on its own this commit doesn't change anything, but a follow up commit depends on it Change-Id: I13623519d6fa51d9bd474589fa00e2fcc0c1e599 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102013 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 09601f9470cb342ccfd8a513e4a2460adf047b63) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109381 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx index 3182d1551f36..dce8a5b29ed3 100644 --- a/vcl/unx/gtk3/gtk3gtkdata.cxx +++ b/vcl/unx/gtk3/gtk3gtkdata.cxx @@ -506,22 +506,45 @@ void GtkSalData::Init() GtkSalDisplay *pDisplay = new GtkSalDisplay( pGdkDisp ); SetDisplay( pDisplay ); - //FIXME: unwind keyboard extension bits - - // add signal handler to notify screen size changes int nScreens = gdk_display_get_n_screens( pGdkDisp ); for( int n = 0; n < nScreens; n++ ) { GdkScreen *pScreen = gdk_display_get_screen( pGdkDisp, n ); - if( pScreen ) - { - pDisplay->screenSizeChanged( pScreen ); - pDisplay->monitorsChanged( pScreen ); - g_signal_connect( G_OBJECT(pScreen), "size-changed", - G_CALLBACK(signalScreenSizeChanged), pDisplay ); - g_signal_connect( G_OBJECT(pScreen), "monitors-changed", - G_CALLBACK(signalMonitorsChanged), GetGtkDisplay() ); - } + if (!pScreen) + continue; + + pDisplay->screenSizeChanged( pScreen ); + pDisplay->monitorsChanged( pScreen ); + // add signal handler to notify screen size changes + g_signal_connect( G_OBJECT(pScreen), "size-changed", + G_CALLBACK(signalScreenSizeChanged), pDisplay ); + g_signal_connect( G_OBJECT(pScreen), "monitors-changed", + G_CALLBACK(signalMonitorsChanged), GetGtkDisplay() ); + + /* + set a provider to allow certain buttons to have no padding + + a) little close button in menubar to close back to start-center + b) small buttons in view->data sources + c) small toolbar button in infobars + */ + GtkCssProvider* pSmallButtonProvider = gtk_css_provider_new(); + static const gchar data[] = "button.small-button, toolbar.small-button button { " + "padding: 0;" + "margin-left: 0px;" + "margin-right: 0px;" + "min-height: 18px;" + "min-width: 18px;" + "}"; + static const gchar olddata[] = "button.small-button, toolbar.small-button button { " + "padding: 0;" + "margin-left: 0px;" + "margin-right: 0px;" + "}"; + gtk_css_provider_load_from_data(pSmallButtonProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr); + + gtk_style_context_add_provider_for_screen(pScreen, GTK_STYLE_PROVIDER(pSmallButtonProvider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index b8629d49cbd6..cefec3415d62 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -7902,7 +7902,6 @@ private: gtk_style_context_add_provider(pButtonContext, GTK_STYLE_PROVIDER(m_pMenuButtonProvider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - gtk_style_context_add_class(pButtonContext, "small-button"); } } diff --git a/vcl/unx/gtk3/gtk3gtksalmenu.cxx b/vcl/unx/gtk3/gtk3gtksalmenu.cxx index 6e47e4eae91a..ad188adfbc4f 100644 --- a/vcl/unx/gtk3/gtk3gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtk3gtksalmenu.cxx @@ -659,6 +659,8 @@ void GtkSalMenu::ShowCloseButton(bool bShow) MenuBar *pVclMenuBar = static_cast<MenuBar*>(mpVCLMenu.get()); mpCloseButton = gtk_button_new(); + gtk_widget_set_margin_start(mpCloseButton, 8); + gtk_widget_set_margin_end(mpCloseButton, 8); g_signal_connect(mpCloseButton, "clicked", G_CALLBACK(CloseMenuBar), pVclMenuBar); gtk_button_set_relief(GTK_BUTTON(mpCloseButton), GTK_RELIEF_NONE); @@ -667,24 +669,6 @@ void GtkSalMenu::ShowCloseButton(bool bShow) GtkStyleContext *pButtonContext = gtk_widget_get_style_context(GTK_WIDGET(mpCloseButton)); - GtkCssProvider *pProvider = gtk_css_provider_new(); - static const gchar data[] = "* { " - "padding: 0;" - "margin-left: 8px;" - "margin-right: 8px;" - "min-width: 18px;" - "min-height: 18px;" - "}"; - const gchar olddata[] = "* { " - "padding: 0;" - "margin-left: 8px;" - "margin-right: 8px;" - "}"; - gtk_css_provider_load_from_data(pProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr); - gtk_style_context_add_provider(pButtonContext, - GTK_STYLE_PROVIDER(pProvider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - gtk_style_context_add_class(pButtonContext, "flat"); gtk_style_context_add_class(pButtonContext, "small-button"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits