Skip to content

Commit

Permalink
Adding Event Block APIs
Browse files Browse the repository at this point in the history
* Adding `webui_set_event_block`
* Adding `ui_event_block` for `webui_set_config`
  • Loading branch information
hassandraga committed Jun 11, 2024
1 parent f182a12 commit 4fb247e
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 83 deletions.
27 changes: 25 additions & 2 deletions include/webui.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,20 @@ enum webui_event {
};

typedef enum {
// Control if `webui_show()` and `webui_show_x()` should wait
// for the window to connect before returns or not.
// Control if `webui_show()`, `webui_show_browser()` and
// `webui_show_wv()` should wait for the window to connect
// before returns or not.
//
// Default: True
show_wait_connection = 0,
// Control if WebUI should block and process the UI events
// one a time in a single thread `True`, or process every
// event in a new non-blocking thread `False`. This updates
// all windows. You can use `webui_set_event_block()` for
// a specific single window update.
//
// Default: False
ui_event_block,
} webui_config;

// -- Structs -------------------------
Expand Down Expand Up @@ -582,6 +592,19 @@ WEBUI_EXPORT bool webui_set_port(size_t window, size_t port);
*/
WEBUI_EXPORT void webui_set_config(webui_config option, bool status);

/**
* @brief Control if UI events comming from this window should be processed
* one a time in a single blocking thread `True`, or process every event in
* a new non-blocking thread `False`. This update single window. You can use
* `webui_set_config(ui_event_block, ...)` to update all windows.
*
* @param window The window number
* @param status The blocking status `true` or `false`
*
* @example webui_set_event_block(myWindow, true);
*/
WEBUI_EXPORT void webui_set_event_block(size_t window, bool status);

// -- SSL/TLS -------------------------

/**
Expand Down
Loading

0 comments on commit 4fb247e

Please sign in to comment.