commit fb7453966079bf419a89a8436344b4438fa163fd
parent 2bf5f7fcea76f2cfefdddda4279cbac3a7fdb2bc
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Fri, 30 Sep 2016 20:44:33 -0400
Fix Some Of The Zest Booting
Diffstat:
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/src/Plugin/ZynAddSubFX/ZynAddSubFX-UI-Zest.cpp b/src/Plugin/ZynAddSubFX/ZynAddSubFX-UI-Zest.cpp
@@ -24,8 +24,9 @@ struct zest_handles {
void (*zest_motion)(zest_t*, int x, int y);
void (*zest_scroll)(zest_t*, int x, int y, int dx, int dy);
void (*zest_mouse)(zest_t *z, int button, int action, int x, int y);
- void (*zest_key)();
+ void (*zest_key)(zest_t *z, char *key, bool press);
void (*zest_resize)();
+ void (*zest_special)(zest_t *z, int key, int press);
int (*zest_tick)(zest_t*);
zest_t *zest;
};
@@ -40,7 +41,7 @@ public:
: UI(1181, 659)
{
printf("[INFO] Opened the zynaddsubfx UI...\n");
- handle = dlopen("/home/mark/code/mruby-zest-build/libzest.so", RTLD_LAZY);
+ handle = dlopen("/opt/zyn-fusion/libzest.so", RTLD_LAZY);
if(!handle) {
printf("[ERROR] Cannot Open libzest.so\n");
printf("[ERROR] '%s'\n", dlerror());
@@ -52,9 +53,11 @@ public:
get_sym(close);
get_sym(draw);
get_sym(tick);
+ get_sym(key);
get_sym(motion);
get_sym(scroll);
get_sym(mouse);
+ get_sym(special);
printf("[INFO] Ready to run\n");
}
@@ -108,6 +111,21 @@ protected:
/* --------------------------------------------------------------------------------------------------------
* UI Callbacks */
+ bool onScroll(const ScrollEvent &ev) override
+ {
+ if(z.zest)
+ z.zest_scroll(z.zest, ev.pos.getX(), ev.pos.getY(), ev.delta.getX(), ev.delta.getY());
+ return false;
+ }
+
+ bool onSpecial(const SpecialEvent &ev) override
+ {
+ printf("special event = %d, %d\n", ev.key, ev.press);
+ if(z.zest)
+ z.zest_special(z.zest, ev.key, ev.press);
+ return false;
+ }
+
bool onMouse(const MouseEvent &m) override
{
if(z.zest)
@@ -143,6 +161,16 @@ protected:
repaint();
}
+ bool onKeyboard(const KeyboardEvent &ev)
+ {
+ char c[2] = {0};
+ if(ev.key < 128)
+ c[0] = ev.key;
+ if(z.zest && c[0])
+ z.zest_key(z.zest, c, ev.press);
+ return true;
+ }
+
void uiIdle(void) override
{
if(z.zest)
diff --git a/src/main.cpp b/src/main.cpp
@@ -21,6 +21,7 @@
#include <algorithm>
#include <signal.h>
+#include <err.h>
#include <unistd.h>
#include <pthread.h>
@@ -630,6 +631,18 @@ int wmidi = -1;
#endif
}
+#ifdef ZEST_GUI
+ if(!noui) {
+ printf("[INFO] Launching Zyn-Fusion...\n");
+ const char *addr = middleware->getServerAddress();
+ if(fork() == 0) {
+ execlp("zyn-fusion", "zyn-fusion", "--builtin", "--no-hotload", addr, 0);
+
+ err(1,"Failed to launch Zyn-Fusion");
+ }
+ }
+#endif
+
printf("[INFO] Main Loop...\n");
while(Pexitprogram == 0) {
#ifndef WIN32