aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-21 05:37:37 +0000
committerDavid Robillard <d@drobilla.net>2012-03-21 05:37:37 +0000
commitb5c9f0d5a9ab1a7a68d1896a743a087038378ffc (patch)
treea2355d2b418761cce88654d53a72f06b84ebb5b0
parentac59950f294f3f498901d8a05cae9a12b75da77d (diff)
downloadjalv-b5c9f0d5a9ab1a7a68d1896a743a087038378ffc.tar.gz
jalv-b5c9f0d5a9ab1a7a68d1896a743a087038378ffc.tar.bz2
jalv-b5c9f0d5a9ab1a7a68d1896a743a087038378ffc.zip
Remove implementation of UI resize extension which is handled autommatically by Suil now.
Tolerate UIs sending messages with crazy port indices. git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4096 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/jalv.c47
-rw-r--r--src/jalv_gtk2.c14
-rw-r--r--src/jalv_internal.h2
-rw-r--r--src/jalv_qt4.cpp1
-rw-r--r--wscript2
5 files changed, 11 insertions, 55 deletions
diff --git a/src/jalv.c b/src/jalv.c
index cf915e1..2525501 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -40,9 +40,6 @@
#include "lv2/lv2plug.in/ns/ext/time/time.h"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
-#ifdef HAVE_LV2_UI_RESIZE
-# include "lv2/lv2plug.in/ns/ext/ui-resize/ui-resize.h"
-#endif
#include "lilv/lilv.h"
@@ -57,7 +54,7 @@
#define NS_UI "http://lv2plug.in/ns/extensions/ui#"
#define USTR(str) ((const uint8_t*)str)
-
+
ZixSem exit_sem; /**< Exit semaphore */
LV2_URID
@@ -95,35 +92,12 @@ static LV2_Feature unmap_feature = { NS_EXT "urid#unmap", NULL };
static LV2_Feature instance_feature = { NS_EXT "instance-access", NULL };
static LV2_Feature make_path_feature = { LV2_STATE__makePath, NULL };
-#ifdef HAVE_LV2_UI_RESIZE
-static int
-lv2_ui_resize(LV2_UI_Resize_Feature_Data data, int width, int height)
-{
- Jalv* jalv = (Jalv*)data;
- jalv->ui_width = width;
- jalv->ui_height = height;
- return jalv_ui_resize(jalv, width, height);
-}
-
-LV2_UI_Resize_Feature ui_resize = { NULL, &lv2_ui_resize };
-static const LV2_Feature ui_resize_feature = { NS_EXT "ui-resize#UIResize",
- &ui_resize };
-
-const LV2_Feature* features[8] = {
- &uri_map_feature, &map_feature, &unmap_feature,
- &instance_feature,
- &make_path_feature,
- &ui_resize_feature,
- NULL
-};
-#else
const LV2_Feature* features[7] = {
&uri_map_feature, &map_feature, &unmap_feature,
&instance_feature,
&make_path_feature,
NULL
};
-#endif
/** Abort and exit on error */
static void
@@ -416,7 +390,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
}
} else {
lv2_evbuf_reset(host->ports[p].evbuf, false);
- }
+ }
}
}
@@ -431,6 +405,7 @@ jack_process_cb(jack_nframes_t nframes, void* data)
fprintf(stderr, "error: Error reading from UI ring buffer\n");
break;
}
+ assert(ev.index < host->num_ports);
struct Port* const port = &host->ports[ev.index];
if (ev.protocol == 0) {
assert(ev.size == sizeof(float));
@@ -549,13 +524,13 @@ jalv_ui_is_resizable(Jalv* jalv)
}
const LilvNode* s = lilv_ui_get_uri(jalv->ui);
- LilvNode* p = lilv_new_uri(jalv->world, LV2_CORE__requiredFeature);
+ LilvNode* p = lilv_new_uri(jalv->world, NS_UI "optionalFeature");
LilvNode* fs = lilv_new_uri(jalv->world, NS_UI "fixedSize");
LilvNode* nrs = lilv_new_uri(jalv->world, NS_UI "noUserResize");
LilvNodes* fs_matches = lilv_world_find_nodes(jalv->world, s, p, fs);
LilvNodes* nrs_matches = lilv_world_find_nodes(jalv->world, s, p, nrs);
-
+
lilv_nodes_free(nrs_matches);
lilv_nodes_free(fs_matches);
lilv_node_free(nrs);
@@ -584,6 +559,12 @@ jalv_ui_write(SuilController controller,
return;
}
+ if (port_index >= host->num_ports) {
+ fprintf(stderr, "UI write to out of range port index %d\n",
+ port_index);
+ return;
+ }
+
if (protocol == host->urids.atom_eventTransfer) {
SerdNode s = serd_node_from_string(SERD_BLANK, USTR("msg"));
SerdNode p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value"));
@@ -691,12 +672,6 @@ main(int argc, char** argv)
LV2_State_Make_Path make_path = { &host, jalv_make_path };
make_path_feature.data = &make_path;
-#ifdef HAVE_LV2_UI_RESIZE
- ui_resize.data = &host;
-#endif
- host.ui_width = -1;
- host.ui_height = -1;
-
zix_sem_init(&exit_sem, 0);
host.done = &exit_sem;
diff --git a/src/jalv_gtk2.c b/src/jalv_gtk2.c
index 6113caf..0eb3fa4 100644
--- a/src/jalv_gtk2.c
+++ b/src/jalv_gtk2.c
@@ -190,18 +190,6 @@ add_preset_to_menu(Jalv* jalv,
}
int
-jalv_ui_resize(Jalv* jalv, int width, int height)
-{
- if (jalv->ui_instance) {
- GtkWidget* widget = suil_instance_get_widget(jalv->ui_instance);
- if (widget) {
- gtk_widget_set_size_request(GTK_WIDGET(widget), width, height);
- }
- }
- return 0;
-}
-
-int
jalv_open_ui(Jalv* jalv,
SuilInstance* instance)
{
@@ -263,8 +251,6 @@ jalv_open_ui(Jalv* jalv,
g_timeout_add(1000 / JALV_UI_UPDATE_HZ,
(GSourceFunc)jalv_emit_ui_events, jalv);
-
- jalv_ui_resize(jalv, jalv->ui_width, jalv->ui_height);
} else {
GtkWidget* button = gtk_button_new_with_label("Close");
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index d93560e..82f414c 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -109,8 +109,6 @@ typedef struct {
LV2_Atom_Forge forge; ///< Atom forge
const char* prog_name; ///< Program name (argv[0])
LilvWorld* world; ///< Lilv World
- int ui_width; ///< Requested UI width
- int ui_height; ///< Requested UI height
LV2_URID_Map map; ///< URI => Int map
LV2_URID_Unmap unmap; ///< Int => URI map
Sratom* sratom; ///< Atom serialiser
diff --git a/src/jalv_qt4.cpp b/src/jalv_qt4.cpp
index 682188a..8111c34 100644
--- a/src/jalv_qt4.cpp
+++ b/src/jalv_qt4.cpp
@@ -70,7 +70,6 @@ jalv_open_ui(Jalv* jalv,
if (instance) {
QWidget* widget = (QWidget*)suil_instance_get_widget(instance);
widget->show();
- jalv_ui_resize(jalv, jalv->ui_width, jalv->ui_height);
} else {
QPushButton* button = new QPushButton("Close");
button->show();
diff --git a/wscript b/wscript
index 22adb87..f2be8d9 100644
--- a/wscript
+++ b/wscript
@@ -61,8 +61,6 @@ def configure(conf):
uselib_store='LV2_URI_MAP')
autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-state',
uselib_store='LV2_STATE', mandatory=False)
- autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-ui-resize',
- uselib_store='LV2_UI_RESIZE', mandatory=False)
if not Options.options.no_jack_session:
autowaf.define(conf, 'JALV_JACK_SESSION', 1)