Skip to content

Commit 14f61c9

Browse files
authored
Merge pull request #2 from YesDrX/fix_workflows
fix workflows
2 parents 5f27ded + 31503cb commit 14f61c9

File tree

5 files changed

+17
-140
lines changed

5 files changed

+17
-140
lines changed

examples/custom_web_server/main.nim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ proc main =
1111
# there is an event
1212

1313
case e.eventType
14-
of weConnected:
14+
of WebuiEvent.weConnected:
1515
echo "Connected"
16-
of weDisconnected:
16+
of WebuiEvent.weDisconnected:
1717
echo "Disconnected"
18-
of weMouseClick:
18+
of WebuiEvent.weMouseClick:
1919
echo "Click"
20-
of weNavigation:
20+
of WebuiEvent.weNavigation:
2121
let url = e.getString()
2222
echo "Starting navigation to: ", url
2323

examples/serve_folder/serve_folder.nim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ proc main =
4040
# there is an event
4141

4242
case e.eventType:
43-
of weConnected:
43+
of WebuiEvent.weConnected:
4444
echo "Connected"
45-
of weDisconnected:
45+
of WebuiEvent.weDisconnected:
4646
echo "Disconnected"
47-
of weMouseClick:
47+
of WebuiEvent.weMouseClick:
4848
echo "Click"
49-
of weNavigation:
49+
of WebuiEvent.weNavigation:
5050
echo "Starting navigation to: ", e.getString()
5151
else:
5252
discard
@@ -84,7 +84,7 @@ proc main =
8484
window2.bind("Exit", exitApp)
8585

8686
# Make Deno as the `.ts` and `.js` interpreter
87-
window.runtime = wrDeno
87+
window.runtime = WebuiRuntime.wrDeno
8888

8989
# Set root folder to current directory
9090
window.rootFolder = currentSourcePath().parentDir()

examples/web_app_multi_client/main.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ proc events(e: Event) =
3535
let connectionId = e.connectionId
3636

3737
case e.eventType
38-
of weConnected: # New connection
38+
of WebuiEvent.weConnected: # New connection
3939
if users_count < (client_id + 1): # +1 because it starts from 0
4040
users_count = client_id + 1
4141

4242
inc tabCount
43-
of weDisconnected: # Disconnection
43+
of WebuiEvent.weDisconnected: # Disconnection
4444
if tab_count > 0:
4545
dec tab_count
4646
else:
@@ -73,7 +73,7 @@ proc events(e: Event) =
7373

7474
proc main() =
7575
# Allow multi-user connection and cookies
76-
setConfig({wcMultiClient, wcUseCookies}, true)
76+
setConfig({WebuiConfig.wcMultiClient, WebuiConfig.wcUseCookies}, true)
7777

7878
# Create new window
7979
let window = newWindow()

webui/bindings.nim

Lines changed: 4 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
include ./bindings_prefix.nim
66

77
const
8-
WEBUI_VERSION* = "2.5.0-beta.4" ##
8+
WEBUI_VERSION* = "2.5.0-beta.3" ##
99
## WebUI Library
1010
## https://webui.me
1111
## https://github.com/webui-dev/webui
@@ -145,11 +145,6 @@ type
145145
cookies*: cstring
146146
## Client's full cookies
147147

148-
WebuiLoggerLevel* {.renameEnumFields.} = enum
149-
WEBUI_LOGGER_LEVEL_DEBUG = 0, ## 0. All logs with all details
150-
WEBUI_LOGGER_LEVEL_INFO, ## 1. Only general logs
151-
WEBUI_LOGGER_LEVEL_ERROR ## 2. Only fatal error logs
152-
153148

154149
proc new_window*(): csize_t {.webui, importc: "webui_new_window".}
155150
## -- Definitions ---------------------
@@ -340,17 +335,6 @@ proc set_high_contrast*(window: csize_t; status: bool) {.
340335
##
341336
## @example webui_set_high_contrast(myWindow, true);
342337
##
343-
proc set_resizable*(window: csize_t; status: bool) {.
344-
webui, importc: "webui_set_resizable".}
345-
##
346-
## @brief Sets whether the window frame is resizable or fixed.
347-
## Works only on WebView window.
348-
##
349-
## @param window The window number
350-
## @param status True or False
351-
##
352-
## @example webui_set_resizable(myWindow, true);
353-
##
354338
proc is_high_contrast*(): bool {.webui, importc: "webui_is_high_contrast".}
355339
##
356340
## @brief Get OS high contrast preference.
@@ -382,22 +366,6 @@ proc close*(window: csize_t) {.webui, importc: "webui_close".}
382366
##
383367
## @example webui_close(myWindow);
384368
##
385-
proc minimize*(window: csize_t) {.webui, importc: "webui_minimize".}
386-
##
387-
## @brief Minimize a WebView window.
388-
##
389-
## @param window The window number
390-
##
391-
## @example webui_minimize(myWindow);
392-
##
393-
proc maximize*(window: csize_t) {.webui, importc: "webui_maximize".}
394-
##
395-
## @brief Maximize a WebView window.
396-
##
397-
## @param window The window number
398-
##
399-
## @example webui_maximize(myWindow);
400-
##
401369
proc close_client*(e: ptr Event) {.webui, importc: "webui_close_client".}
402370
##
403371
## @brief Close a specific client.
@@ -430,14 +398,6 @@ proc set_root_folder*(window: csize_t; path: cstring): bool {.
430398
##
431399
## @example webui_set_root_folder(myWindow, "/home/Foo/Bar/");
432400
##
433-
proc set_browser_folder*(path: cstring) {.webui, importc: "webui_set_browser_folder".}
434-
##
435-
## @brief Set custom browser folder path.
436-
##
437-
## @param path The browser folder path
438-
##
439-
## @example webui_set_browser_folder("/home/Foo/Bar/");
440-
##
441401
proc set_default_root_folder*(path: cstring): bool {.
442402
webui, importc: "webui_set_default_root_folder".}
443403
##
@@ -448,20 +408,6 @@ proc set_default_root_folder*(path: cstring): bool {.
448408
##
449409
## @example webui_set_default_root_folder("/home/Foo/Bar/");
450410
##
451-
proc set_close_handler_wv*(window: csize_t;
452-
close_handler: proc (window: csize_t): bool {.webui.}) {.
453-
webui, importc: "webui_set_close_handler_wv".}
454-
##
455-
## @brief Set a callback to catch the close event of the WebView window.
456-
## Must return `false` to prevent the close event, `true` otherwise.
457-
##
458-
## @example
459-
## bool myCloseEvent(size_t window) {
460-
## // Prevent WebView window close event
461-
## return false;
462-
## }
463-
## webui_set_close_handler(myWindow, myCloseEvent);
464-
##
465411
proc set_file_handler*(window: csize_t; handler: proc (filename: cstring;
466412
length: ptr cint): pointer {.webui.}) {.webui, importc: "webui_set_file_handler".}
467413
##
@@ -645,15 +591,6 @@ proc set_position*(window: csize_t; x: cuint; y: cuint) {.
645591
##
646592
## @example webui_set_position(myWindow, 100, 100);
647593
##
648-
proc set_center*(window: csize_t) {.webui, importc: "webui_set_center".}
649-
##
650-
## @brief Centers the window on the screen. Works better with
651-
## WebView. Call this function before `webui_show()` for better results.
652-
##
653-
## @param window The window number
654-
##
655-
## @example webui_set_center(myWindow);
656-
##
657594
proc set_profile*(window: csize_t; name: cstring; path: cstring) {.
658595
webui, importc: "webui_set_profile".}
659596
##
@@ -758,7 +695,8 @@ proc delete_profile*(window: csize_t) {.webui, importc: "webui_delete_profile".}
758695
proc get_parent_process_id*(window: csize_t): csize_t {.
759696
webui, importc: "webui_get_parent_process_id".}
760697
##
761-
## @brief Get the parent process ID, which refers to the current backend application process.
698+
## @brief Get the ID of the parent process (The web browser may re-create
699+
## another new process).
762700
##
763701
## @param window The window number
764702
##
@@ -769,10 +707,7 @@ proc get_parent_process_id*(window: csize_t): csize_t {.
769707
proc get_child_process_id*(window: csize_t): csize_t {.
770708
webui, importc: "webui_get_child_process_id".}
771709
##
772-
## @brief Get the child process ID created by the parent, which refers to the web browser window.
773-
##
774-
## Note: In WebView mode, this will return the parent process ID because the backend and the
775-
## WebView window run in the same process.
710+
## @brief Get the ID of the last child process.
776711
##
777712
## @param window The window number
778713
##
@@ -792,19 +727,6 @@ proc win32_get_hwnd*(window: csize_t): pointer {.
792727
##
793728
## @example HWND hwnd = webui_win32_get_hwnd(myWindow);
794729
##
795-
proc get_hwnd*(window: csize_t): pointer {.webui, importc: "webui_get_hwnd".}
796-
##
797-
## @brief Get window `HWND`. More reliable with WebView
798-
## than web browser window, as browser PIDs may change on launch.
799-
##
800-
## @param window The window number
801-
##
802-
## @return Returns the window `hwnd` in Win32, `GtkWindow` in Linux.
803-
##
804-
## @example
805-
## HWND hwnd = webui_get_hwnd(myWindow); // Win32 (Work with WebView and web browser)
806-
## GtkWindow* window = webui_get_hwnd(myWindow); // Linux (Work with WebView only)
807-
##
808730
proc get_port*(window: csize_t): csize_t {.webui, importc: "webui_get_port".}
809731
##
810732
## @brief Get the network port of a running window.
@@ -837,17 +759,6 @@ proc get_free_port*(): csize_t {.webui, importc: "webui_get_free_port".}
837759
##
838760
## @example size_t port = webui_get_free_port();
839761
##
840-
proc set_logger*(`func`: proc (level: csize_t; log: cstring; user_data: pointer) {.webui.};
841-
user_data: pointer) {.webui, importc: "webui_set_logger".}
842-
##
843-
## @brief Set a custom logger function.
844-
##
845-
## @example
846-
## void myLogger(size_t level, const char* log, void* user_data) {
847-
## printf("myLogger (%d): %s", level, log);
848-
## }
849-
## webui_set_logger(myLogger, NULL);
850-
##
851762
proc set_config*(option: WebuiConfig; status: bool) {.
852763
webui, importc: "webui_set_config".}
853764
##
@@ -871,26 +782,6 @@ proc set_event_blocking*(window: csize_t; status: bool) {.
871782
##
872783
## @example webui_set_event_blocking(myWindow, true);
873784
##
874-
proc set_frameless*(window: csize_t; status: bool) {.
875-
webui, importc: "webui_set_frameless".}
876-
##
877-
## @brief Make a WebView window frameless.
878-
##
879-
## @param window The window number
880-
## @param status The frameless status `true` or `false`
881-
##
882-
## @example webui_set_frameless(myWindow, true);
883-
##
884-
proc set_transparent*(window: csize_t; status: bool) {.
885-
webui, importc: "webui_set_transparent".}
886-
##
887-
## @brief Make a WebView window transparent.
888-
##
889-
## @param window The window number
890-
## @param status The transparency status `true` or `false`
891-
##
892-
## @example webui_set_transparent(myWindow, true);
893-
##
894785
proc get_mime_type*(file: cstring): cstring {.webui, importc: "webui_get_mime_type".}
895786
##
896787
## @brief Get the HTTP mime type of a file.
@@ -1133,20 +1024,6 @@ proc return_bool*(e: ptr Event; b: bool) {.webui, importc: "webui_return_bool".}
11331024
##
11341025
## @example webui_return_bool(e, true);
11351026
##
1136-
proc get_last_error_number*(): csize_t {.
1137-
webui, importc: "webui_get_last_error_number".}
1138-
##
1139-
## @brief Get the last WebUI error code.
1140-
##
1141-
## @example int error_num = webui_get_last_error_number();
1142-
##
1143-
proc get_last_error_message*(): cstring {.
1144-
webui, importc: "webui_get_last_error_message".}
1145-
##
1146-
## @brief Get the last WebUI error message.
1147-
##
1148-
## @example const char* error_msg = webui_get_last_error_message();
1149-
##
11501027
proc interface_bind*(window: csize_t; element: cstring; `func`: proc (
11511028
a1: csize_t; a2: csize_t; a3: cstring; a4: csize_t; a5: csize_t) {.webui.}): csize_t {.
11521029
webui, importc: "webui_interface_bind".}

webui/webui

Submodule webui updated 61 files

0 commit comments

Comments
 (0)