diff --git a/engine/bind/v4k.lua b/engine/bind/v4k.lua index cfbb8ce..333df75 100644 --- a/engine/bind/v4k.lua +++ b/engine/bind/v4k.lua @@ -2736,6 +2736,7 @@ int u_coefficients_sh; void tty_attach(); void tty_detach(); const char* app_exec(const char *command); + void app_spawn(const char *command); int app_cores(); int app_battery(); const char* app_name(); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index e60cec5..1560d29 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17301,6 +17301,7 @@ API void tty_attach(); API void tty_detach(); API const char* app_exec(const char *command); // returns ("%15d %s", retcode, output_last_line) +API void app_spawn(const char *command); API int app_cores(); API int app_battery(); /// return battery level [1..100]. also positive if charging (+), negative if discharging (-), and 0 if no battery is present. @@ -345560,6 +345561,13 @@ const char * app_exec( const char *cmd ) { return snprintf(output, 16, "%-15d", rc), buf[-1] = ' ', output; } +void app_spawn( const char *cmd ) { + if( !cmd[0] ) return "0 "; + cmd = file_normalize(cmd); + + system(cmd); +} + #if is(osx) #include // backtrace, backtrace_symbols #include // dladdr, Dl_info @@ -346959,6 +346967,7 @@ int ui_show(const char *panel_or_window_title, int enabled) { } int ui_dims(const char *panel_or_window_title, float width, float height) { nk_window_set_size(ui_ctx, panel_or_window_title, (struct nk_vec2){width, height}); + return 0; } vec2 ui_get_dims() { return (vec2){nk_window_get_width(ui_ctx), nk_window_get_height(ui_ctx)}; diff --git a/engine/split/v4k_system.c b/engine/split/v4k_system.c index 3d77c19..dc9208e 100644 --- a/engine/split/v4k_system.c +++ b/engine/split/v4k_system.c @@ -106,6 +106,13 @@ const char * app_exec( const char *cmd ) { return snprintf(output, 16, "%-15d", rc), buf[-1] = ' ', output; } +void app_spawn( const char *cmd ) { + if( !cmd[0] ) return "0 "; + cmd = file_normalize(cmd); + + system(cmd); +} + #if is(osx) #include // backtrace, backtrace_symbols #include // dladdr, Dl_info diff --git a/engine/split/v4k_system.h b/engine/split/v4k_system.h index 9f3f326..0fb8197 100644 --- a/engine/split/v4k_system.h +++ b/engine/split/v4k_system.h @@ -22,6 +22,7 @@ API void tty_attach(); API void tty_detach(); API const char* app_exec(const char *command); // returns ("%15d %s", retcode, output_last_line) +API void app_spawn(const char *command); API int app_cores(); API int app_battery(); /// return battery level [1..100]. also positive if charging (+), negative if discharging (-), and 0 if no battery is present. diff --git a/engine/split/v4k_ui.c b/engine/split/v4k_ui.c index 8f1b2ac..4d5fd80 100644 --- a/engine/split/v4k_ui.c +++ b/engine/split/v4k_ui.c @@ -436,6 +436,7 @@ int ui_show(const char *panel_or_window_title, int enabled) { } int ui_dims(const char *panel_or_window_title, float width, float height) { nk_window_set_size(ui_ctx, panel_or_window_title, (struct nk_vec2){width, height}); + return 0; } vec2 ui_get_dims() { return (vec2){nk_window_get_width(ui_ctx), nk_window_get_height(ui_ctx)}; diff --git a/engine/v4k.c b/engine/v4k.c index 89843fe..43a1fa9 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -16256,6 +16256,13 @@ const char * app_exec( const char *cmd ) { return snprintf(output, 16, "%-15d", rc), buf[-1] = ' ', output; } +void app_spawn( const char *cmd ) { + if( !cmd[0] ) return "0 "; + cmd = file_normalize(cmd); + + system(cmd); +} + #if is(osx) #include // backtrace, backtrace_symbols #include // dladdr, Dl_info @@ -17655,6 +17662,7 @@ int ui_show(const char *panel_or_window_title, int enabled) { } int ui_dims(const char *panel_or_window_title, float width, float height) { nk_window_set_size(ui_ctx, panel_or_window_title, (struct nk_vec2){width, height}); + return 0; } vec2 ui_get_dims() { return (vec2){nk_window_get_width(ui_ctx), nk_window_get_height(ui_ctx)}; diff --git a/engine/v4k.h b/engine/v4k.h index dcce828..63332b4 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -3384,6 +3384,7 @@ API void tty_attach(); API void tty_detach(); API const char* app_exec(const char *command); // returns ("%15d %s", retcode, output_last_line) +API void app_spawn(const char *command); API int app_cores(); API int app_battery(); /// return battery level [1..100]. also positive if charging (+), negative if discharging (-), and 0 if no battery is present. diff --git a/workbench/workbench.c b/workbench/workbench.c index 4cb2218..801ad38 100644 --- a/workbench/workbench.c +++ b/workbench/workbench.c @@ -44,7 +44,7 @@ void register_extensions() { } void edit_asset(char *fname) { - app_exec(va("%s %s", ifdef(win32, "start", ifdef(osx, "open", "xdg-open")), fname)); + app_spawn(va("%s \"\" \"%s\"", ifdef(win32, "start", ifdef(osx, "open", "xdg-open")), fname)); } void load_asset(const char *fname) { @@ -81,22 +81,21 @@ int main() { load_editors(); register_extensions(); - #if 1 + #if 0 load_asset("demos/art/shadertoys/!default.fs"); load_asset("demos/art/fx/fxDithering.fs"); #endif while( window_swap() && !input(KEY_ESC) ) { - static int wb_enabled = 1; - if (ui_window("Workbench", &wb_enabled)) { + if (ui_panel("Workbench", PANEL_OPEN)) { static const char *file; static bool show_browser = 1; if( ui_browse(&file, &show_browser) ) { load_asset(file); show_browser = 1; } - ui_window_end(); + ui_panel_end(); } for (int i=0; i