From 83be983eb6b57ffe8c2ebfb3701bcbe16926ad08 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sat, 21 Apr 2018 16:31:22 +0200 Subject: limit size of panel-hide-button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Juha Leppänen, Kuopio, Finland for simplifing the code --- mate-panel/panel-toplevel.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index e9d9fe48..d3fd0dcd 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -1287,9 +1287,9 @@ static void panel_toplevel_update_hide_buttons_size(GtkWidget* button, int panel } else if (panel_size < 40) { gtk_image_set_pixel_size (GTK_IMAGE (arrow), 16); } else if (panel_size < 60) { - gtk_image_set_pixel_size (GTK_IMAGE (arrow), 24); + gtk_image_set_pixel_size (GTK_IMAGE (arrow), 22); } else { - gtk_image_set_pixel_size (GTK_IMAGE (arrow), 32); + gtk_image_set_pixel_size (GTK_IMAGE (arrow), 24); } } @@ -1298,6 +1298,7 @@ static void panel_toplevel_update_hide_buttons(PanelToplevel* toplevel) { int panel_size = toplevel->priv->size; + int hb_size = 0; if (toplevel->priv->buttons_enabled) { panel_toplevel_update_buttons_showing (toplevel); @@ -1343,10 +1344,16 @@ static void panel_toplevel_update_hide_buttons(PanelToplevel* toplevel) /* set size after setting the arrow */ if (toplevel->priv->buttons_enabled) { - gtk_widget_set_size_request (toplevel->priv->hide_button_top, panel_size, panel_size); - gtk_widget_set_size_request (toplevel->priv->hide_button_bottom, panel_size, panel_size); - gtk_widget_set_size_request (toplevel->priv->hide_button_left, panel_size, panel_size); - gtk_widget_set_size_request (toplevel->priv->hide_button_right, panel_size, panel_size); + + if ( panel_size < 20) { hb_size = 16; } + else if ( panel_size < 40) { hb_size = 20; } + else if ( panel_size < 60) { hb_size = 26; } + else { hb_size = 30; } + + gtk_widget_set_size_request (toplevel->priv->hide_button_top, panel_size, hb_size); + gtk_widget_set_size_request (toplevel->priv->hide_button_bottom, panel_size, hb_size); + gtk_widget_set_size_request (toplevel->priv->hide_button_left, hb_size, panel_size); + gtk_widget_set_size_request (toplevel->priv->hide_button_right, hb_size, panel_size); } } -- cgit v1.2.1