Skip to content

Commit

Permalink
Fix issue #21 Allow fine tuning for delay
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Sep 14, 2024
1 parent 2b94dfb commit ccbadbf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions Ratatouille/lv2_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,25 @@ static void draw_my_knob(void *w_, void* user_data) {
cairo_paint (w->crb);
}

void set_precision(void *w_, void* xkey_, void* user_data) {
Widget_t *w = (Widget_t*)w_;
X11_UI* ui = (X11_UI*)w->parent_struct;
XKeyEvent *xkey = (XKeyEvent*)xkey_;
if ((xkey->keycode == XKeysymToKeycode(w->app->dpy,XK_Control_L) ||
xkey->keycode == XKeysymToKeycode(w->app->dpy,XK_Control_R))) {
ui->widget[4]->adj->step = 1;
}
}

void reset_precision(void *w_, void* xkey_, void* user_data) {
Widget_t *w = (Widget_t*)w_;
X11_UI* ui = (X11_UI*)w->parent_struct;
XKeyEvent *xkey = (XKeyEvent*)xkey_;
if ((xkey->keycode == XKeysymToKeycode(w->app->dpy,XK_Control_L) ||
xkey->keycode == XKeysymToKeycode(w->app->dpy,XK_Control_R))) {
ui->widget[4]->adj->step = 16;
}
}

Widget_t* add_lv2_knob(Widget_t *w, Widget_t *p, PortIndex index, const char * label,
X11_UI* ui, int x, int y, int width, int height) {
Expand Down Expand Up @@ -884,6 +903,8 @@ static LV2UI_Handle instantiate(const LV2UI_Descriptor * descriptor,
widget_get_png(ui->win, LDVAR(texture_png));
// connect the expose func
ui->win->func.expose_callback = draw_window;
ui->win->func.key_press_callback = set_precision;
ui->win->func.key_release_callback = reset_precision;
// create controller widgets
plugin_create_controller_widgets(ui,plugin_uri);
// map all widgets into the toplevel Widget_t
Expand Down
2 changes: 1 addition & 1 deletion Ratatouille/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ ifeq ($(TARGET), Linux)
CFLAGS := -O2 -D_FORTIFY_SOURCE=2 -Wall -Wno-unused-result -fstack-protector -fvisibility=hidden \
-fdata-sections -Wl,--gc-sections -Wl,-z,relro,-z,now -Wl,--exclude-libs,ALL -DUSE_ATOM

TTLUPDATEMODGUI = sed -i -e '183,197d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
TTLUPDATEMODGUI = sed -i -e '191,206d' -e 's/guiext:ui <urn:brummer:ratatouille_ui> ;//' \
-e '7d' ../bin/$(BUNDLE)/$(NAME).ttl
else ifeq ($(TARGET), Windows)
CXXFLAGS += -D_FORTIFY_SOURCE=2 -I. -fPIC -DPIC -O2 -Wall -funroll-loops \
Expand Down
2 changes: 1 addition & 1 deletion libxputty

0 comments on commit ccbadbf

Please sign in to comment.