Skip to content

Instantly share code, notes, and snippets.

@x42
Created January 28, 2021 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x42/cff1cbfecc2084edcf83e796ad026dc9 to your computer and use it in GitHub Desktop.
Save x42/cff1cbfecc2084edcf83e796ad026dc9 to your computer and use it in GitHub Desktop.
#define LV2_TinyUI_URI "http://example.org/lv2/tinyUI"
#define LV2_TinyUI_PREFIX LV2_INLINEDISPLAY_URI "#"
#define LV2_TinyUI__interface LV2_INLINEDISPLAY_PREFIX "Interface"
#define LV2_TinyUI__feature LV2_INLINEDISPLAY_PREFIX "Feature"
/** a LV2 Feature provided by the Host to the plugin */
typedef struct {
/** Opaque host data */
LV2UI_Controller controller;
/** A host-provided function that sends data to a plugin's input ports.
*
* This mirrors the default UI callback function [1].
*
* While it is passed to the plugin's DSP instance, the plugin should
* only call it in response to a TinyUI Mouse Event (in the GUI thread).
*
* Note: the host may also pass the LV2_UI__touch [2] feature to the
* plugin in the same way.
*
* [1] https://lv2plug.in/doc/html/group__ui.html#ga62502987d06bc97ea88521aacc0990c9
* [2] http://lv2plug.in/ns/extensions/ui#touch
*/
LV2UI_Write_Function write_function;
} LV2_TinyUI;
/**
* Extension-interface provided by Plugin.
*
* These function are called by the host to pass mouse-events to the plugin's TinyUI.
* Rendering the tinyUI uses the inline-display extension.
*/
typedef struct {
bool (*event_motion)(LV2_Handle instance, uint32_t x, uint32_t y);
bool (*event_button)(LV2_Handle instance, uint32_t x, uint32_t y, uint32_t modifiers, uint32_t button, bool press);
bool (*event_scroll)(LV2_Handle instance, uint32_t x, uint32_t y, uint32_t modifiers, double dx, double dy);
/* Discuss:
* - Preferably use an event-struct and single callback function (!)
* - Define modifiers (key: ctrl, alt, shift; button-state: single, double tipple click)
* - scroll direction and distance
* etc.
*
* .. just copy some existing standard :)
*/
} LV2_TinyUI_Interface;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment