From cb248d6c9087ca27f5ce37028dd7450ba2cea89d Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 25 Mar 2024 14:54:47 -0700 Subject: [PATCH] gtk: Clamp level values to level bar range --- gtk/channel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/channel.c b/gtk/channel.c index c83d8c3..c90305d 100644 --- a/gtk/channel.c +++ b/gtk/channel.c @@ -113,11 +113,15 @@ static void osc_levels(GValue *arg, guint len, gpointer ptr) { Channel *channel; + GtkLevelBar *bar; + float value; if (len == 0) return; channel = OSCMIX_CHANNEL(ptr); - gtk_level_bar_set_value(GTK_LEVEL_BAR(channel->ui.level), g_value_get_float(&arg[0]) + 65); + bar = GTK_LEVEL_BAR(channel->ui.level); + value = CLAMP(g_value_get_float(&arg[0]) + 65, gtk_level_bar_get_min_value(bar), gtk_level_bar_get_max_value(bar)); + gtk_level_bar_set_value(bar, value); } static void -- 2.45.2