Skip to content

Commit

Permalink
don't set top margin on module header unless it has actually changed
Browse files Browse the repository at this point in the history
This eliminates an infinite refresh loop in the GUI.
  • Loading branch information
ralfbrown committed Feb 8, 2025
1 parent f26de97 commit f5ec516
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/dtgtk/expander.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,13 @@ static gboolean _adjust_header_position(GtkWidget *widget, cairo_t *cr, GtkWidge
GtkAdjustment *adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw));
gdouble value = gtk_adjustment_get_value(adjustment);

gtk_widget_set_margin_top(header,
CLAMP(value - allocation.y, 0, allocation.height - gtk_widget_get_allocated_height(header)));
dt_gui_widget_reallocate_now(widget);
int curr_margin_top = gtk_widget_get_margin_top(header);
int new_margin_top = CLAMP(value - allocation.y, 0, allocation.height - gtk_widget_get_allocated_height(header));
if(new_margin_top != curr_margin_top)
{
gtk_widget_set_margin_top(header, new_margin_top);
dt_gui_widget_reallocate_now(widget);
}

return FALSE;
}
Expand Down

0 comments on commit f5ec516

Please sign in to comment.