aboutsummaryrefslogtreecommitdiff
path: root/atom_inspector_ui.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-04-16 09:23:47 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-04-16 09:23:47 +0200
commit681ed06f15908a95c43232dc2bd1e586f1846320 (patch)
tree449aa0525f790eaa88eee18ff4318eb442eb0ccc /atom_inspector_ui.c
parent6fa848e803430f9df1e5846b1e058e5e69f0b443 (diff)
downloadsherlock.lv2-681ed06f15908a95c43232dc2bd1e586f1846320.tar.xz
introduce maximal amount of events.
* when maximal amount is reached, first event is discarded
Diffstat (limited to 'atom_inspector_ui.c')
-rw-r--r--atom_inspector_ui.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/atom_inspector_ui.c b/atom_inspector_ui.c
index 8f3425b..9226d68 100644
--- a/atom_inspector_ui.c
+++ b/atom_inspector_ui.c
@@ -21,6 +21,8 @@
#include <lv2_eo_ui.h>
+#define COUNT_MAX 2018 // maximal amount of events shown
+
// Disable deprecation warnings for Blank and Resource
#if defined(__clang__)
# pragma clang diagnostic push
@@ -652,6 +654,14 @@ port_event(LV2UI_Handle handle, uint32_t i, uint32_t size, uint32_t urid,
size_t len = sizeof(LV2_Atom_Event) + elmnt->body.size;
LV2_Atom_Event *ev = malloc(len);
memcpy(ev, elmnt, len);
+
+ // check item count
+ if(elm_genlist_items_count(ui->list) >= COUNT_MAX)
+ {
+ // remove first item to free space for the most recent one
+ Elm_Object_Item *first = elm_genlist_first_item_get(ui->list);
+ elm_object_item_del(first);
+ }
/* TODO would be correct
const LV2_Atom *atom = &elmnt->body;