summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-03 16:04:35 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2021-01-17 22:11:30 +0100
commitced00aadcffd00e5cd0acc00670cb52b2f733388 (patch)
tree58e203dcc7bdda98964fce9b5d4ce6d8563c4522 /vcl/unx
parent51c7c4ddb884703907759918f0541f9ad1f1fd98 (diff)
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 <caolanm@redhat.com> (cherry picked from commit 09601f9470cb342ccfd8a513e4a2460adf047b63) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109381 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkdata.cxx47
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx1
-rw-r--r--vcl/unx/gtk3/gtk3gtksalmenu.cxx20
3 files changed, 37 insertions, 31 deletions
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");