@@ -4,7 +4,8 @@ use baseview::dpi::*;
44use baseview:: gl:: GlConfig ;
55use baseview:: { WindowHandle , WindowOpenOptions , WindowSize } ;
66use clack_extensions:: gui:: {
7- GuiApiType , GuiConfiguration , GuiResizeHints , GuiSize , PluginGuiImpl , Window as ClapWindow ,
7+ AspectRatioStrategy , GuiApiType , GuiConfiguration , GuiResizeHints , GuiSize , PluginGuiImpl ,
8+ Window as ClapWindow ,
89} ;
910use clack_plugin:: plugin:: PluginError ;
1011
@@ -49,15 +50,26 @@ impl PluginGuiImpl for ExamplePluginMainThread {
4950 }
5051
5152 fn get_size ( & mut self ) -> Option < GuiSize > {
52- Some ( window_size_to_gui_size ( self . gui . as_ref ( ) ?. handle . size ( ) ) )
53+ let Some ( gui) = self . gui . as_ref ( ) else {
54+ // Because we delayed the window creation, this will get called without a GUI active.
55+ // During that time, return the default UI size.
56+ return Some ( GuiSize { width : 400 , height : 200 } ) ;
57+ } ;
58+ Some ( window_size_to_gui_size ( gui. handle . size ( ) ) )
5359 }
5460
5561 fn can_resize ( & mut self ) -> bool {
5662 true // Non-resizeable windows not supported yet
5763 }
5864
5965 fn get_resize_hints ( & mut self ) -> Option < GuiResizeHints > {
60- None // Not supported yet
66+ Some ( GuiResizeHints {
67+ strategy : AspectRatioStrategy :: Disregard , // Not supported
68+
69+ // Non-resizeable windows not supported yet
70+ can_resize_vertically : true ,
71+ can_resize_horizontally : true ,
72+ } )
6173 }
6274
6375 fn adjust_size ( & mut self , size : GuiSize ) -> Option < GuiSize > {
0 commit comments