[LV2] LV2UI_Resize as extension_data

Filipe Coelho falktx at gmail.com
Fri Aug 22 06:49:27 PDT 2014


On 08/16/2014 05:53 AM, Spencer Jackson wrote:
> Hello all:
>
> I'm trying to implement an FLTK (NTK really) GUI and the only trouble 
> is that it doesn't resize with the window. I think I finally 
> understand how its supposed to go:
> If the extension data function is called with the uri for 
> LV2UI__resize then I pass back the LV2UI_Resize struct. The trouble is 
> the first member is whatever opaque data I wish to use when the 
> function pointed to by the second member is called. What I really need 
> when the resize_ui function is called is the instance of the GUI 
> object created in the instantiate function. So I need to somehow 
> assign  the LV2UI_Handle to the LV2UI_Feature_Handle. But I don't have 
> access to it. How is this feature supposed to work as plugin 
> extension_data?

I started to deal with this in my host, I think the UI should ignore the 
"LV2UI_Feature_Handle handle;" on the Resize struct as it's not possible 
to have any kind of proper pointer in there.
The host will probably pass the UI handle in the resize function, as it 
is already doing for all other extension-data things.

The issue I'm facing now is how to report to the host the minimum size.
afaik there isn't a method for this in LV2 yet.

Perhaps the LV2UI_Resize struct shouldn't really be used for extension-data;
I think a new struct would make much more sense, kinda like this:


/**
    UI Resize Interface (LV2_UI__resizeInterface)
    ...
*/
typedef struct _LV2UI_Resize_Interface {
     /**
        Resize UI.
     */
     int (*resize)(LV2UI_Handle ui, int width, int height);

     /**
        Get the default size of the UI, which the host will initially use.
        Must NOT be null.
     */
     int (*get_default_size)(LV2UI_Handle ui, int* width, int* height);

     /**
        Get the minimum size of the UI.
        May be null.
     */
     int (*get_minimum_size)(LV2UI_Handle ui, int* width, int* height);

     /**
        Get the maximum size of the UI.
        May be null.
     */
     int (*get_maximum_size(LV2UI_Handle ui, int* width, int* height);
} LV2UI_Resize_Interface;


The default size is very useful here because that way the UI doesn't 
have to look for host resize feature and call it.
(The UI might not be interested on resizing itself.)



More information about the Devel mailing list