aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-10-24 18:06:50 -0400
committerDavid Robillard <d@drobilla.net>2015-10-24 18:06:50 -0400
commitb041b087d18197553a439603cdaf5102a9a73cfa (patch)
treec7d05b43219c2ed9396bb3fb41b41fef8cd52b21 /plugins
parent54bad1e397679efca7cfaa3a174d618f74e72637 (diff)
downloadlv2-b041b087d18197553a439603cdaf5102a9a73cfa.tar.xz
eg-scope: Don't feed back UI state updates
Diffstat (limited to 'plugins')
-rw-r--r--plugins/eg-scope.lv2/examploscope_ui.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c
index 04f6292..558f624 100644
--- a/plugins/eg-scope.lv2/examploscope_ui.c
+++ b/plugins/eg-scope.lv2/examploscope_ui.c
@@ -71,6 +71,7 @@ typedef struct {
uint32_t n_channels;
bool paused;
float rate;
+ bool updating;
} EgScopeUI;
@@ -158,7 +159,11 @@ send_ui_enable(LV2UI_Handle handle)
static gboolean
on_cfg_changed(GtkWidget* widget, gpointer data)
{
- send_ui_state(data);
+ EgScopeUI* ui = (EgScopeUI*)data;
+ if (!ui->updating) {
+ // Only send UI state if the change is from user interaction
+ send_ui_state(data);
+ }
return TRUE;
}
@@ -414,7 +419,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
LV2UI_Widget* widget,
const LV2_Feature* const* features)
{
- EgScopeUI* ui = (EgScopeUI*)malloc(sizeof(EgScopeUI));
+ EgScopeUI* ui = (EgScopeUI*)calloc(1, sizeof(EgScopeUI));
if (!ui) {
fprintf(stderr, "EgScope.lv2 UI: out of memory\n");
@@ -593,9 +598,11 @@ recv_ui_state(EgScopeUI* ui, const LV2_Atom_Object* obj)
const float amp = ((const LV2_Atom_Float*)amp_val)->body;
const float rate = ((const LV2_Atom_Float*)rate_val)->body;
- // Update UI
+ // Disable transmission and update UI
+ ui->updating = true;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->spb_speed), spp);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->spb_amp), amp);
+ ui->updating = false;
ui->rate = rate;
return 0;