Skip to content

Commit

Permalink
Fix for categories list always showing a scrollbar (#13)
Browse files Browse the repository at this point in the history
* Fix for categories list always showing a scrollbar

solus-project/brisk-menu#83

* Fix categories list scrollbar in more themes
  • Loading branch information
gabrielfin authored and JoshStrobl committed Jun 30, 2019
1 parent 9d2732b commit 31610ed
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/frontend/classic/sidebar-scroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ static void brisk_menu_sidebar_scroller_get_preferred_height(GtkWidget *widget,
{
GdkScreen *screen = NULL;
GdkWindow *window = NULL;
GtkStyleContext *style_context = NULL;
GtkStateFlags state_flags;
GtkBorder border;
GtkBorder padding;
GtkBorder margin;
gint spacing;
GdkRectangle geom = { 0 };
gint applet_x, applet_y = 0;
gint mon = 0;
Expand All @@ -97,10 +103,18 @@ static void brisk_menu_sidebar_scroller_get_preferred_height(GtkWidget *widget,
bin = GTK_BIN(widget);
child = gtk_bin_get_child(bin);

style_context = gtk_widget_get_style_context(widget);
state_flags = gtk_widget_get_state_flags(widget);
gtk_style_context_get_border(style_context, state_flags, &border);
gtk_style_context_get_padding(style_context, state_flags, &padding);
gtk_style_context_get_margin(style_context, state_flags, &margin);

spacing = border.top + border.bottom + padding.top + padding.bottom + margin.top + margin.bottom;

if (child) {
gtk_widget_get_preferred_height(child, min_height, nat_height);
*min_height = MIN(max_height, *min_height);
*nat_height = MIN(max_height, *nat_height);
*min_height = MIN(max_height, *min_height) + spacing;
*nat_height = MIN(max_height, *nat_height) + spacing;
} else {
*min_height = *nat_height = 0;
}
Expand Down

0 comments on commit 31610ed

Please sign in to comment.