Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for categories list always showing a scrollbar #13

Merged
merged 2 commits into from
Jun 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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