Skip to content

Commit a4fe620

Browse files
authored
Updating code to follow current coding style (replace GTK macros with inline functions)
1 parent 8895dd4 commit a4fe620

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

src/webui.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,6 @@ typedef struct webui_event_inf_t {
277277
bool stop;
278278
} _webui_wv_linux_t;
279279

280-
#define GTK_SET_SHOW(win, status) (if (win->webView && win->has_all_events) win->webView->in_show = status)
281-
#define GTK_IS_SHOW(win) ((win->webView && win->has_all_events) ? win->webView->in_show : true)
282-
283280
#else
284281
extern bool _webui_macos_wv_new(int index, bool frameless, bool resizable);
285282
extern void _webui_macos_wv_new_thread_safe(int index, bool frameless, bool resizable);
@@ -11879,6 +11876,23 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
1187911876
}
1188011877
}
1188111878

11879+
static inline void _webui_wv_gtk_set_show(_webui_window_t* win, bool status) {
11880+
if (win) {
11881+
if (win->webView && win->has_all_events) {
11882+
win->webView->in_show = status;
11883+
}
11884+
}
11885+
}
11886+
11887+
static inline bool _webui_wv_gtk_is_show(_webui_window_t* win) {
11888+
if (win) {
11889+
if (win->webView && win->has_all_events) {
11890+
return win->webView->in_show;
11891+
}
11892+
}
11893+
return true;
11894+
}
11895+
1188211896
static bool _webui_wv_event_decision(void *widget, void *decision, int decision_type, void *user_data) {
1188311897
switch(decision_type) {
1188411898
case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: {
@@ -11889,8 +11903,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
1188911903
return false;
1189011904
}
1189111905

11892-
if (GTK_IS_SHOW(win)) {
11893-
GTK_SET_SHOW(win, false);
11906+
if (_webui_wv_gtk_is_show(win)) {
11907+
_webui_wv_gtk_set_show(win, false);
1189411908
return false;
1189511909
}
1189611910

@@ -12123,7 +12137,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
1212312137
}
1212412138

1212512139
// Show
12126-
GTK_SET_SHOW(win, true); // TODO: Check if we need this here because we are about to load a URI
12140+
_webui_wv_gtk_set_show(win, true); // TODO: Check if we need this here because we are about to load a URI
1212712141
webkit_web_view_load_uri(win->webView->gtk_wv, win->webView->url);
1212812142
gtk_widget_show_all(win->webView->gtk_win);
1212912143
win->webView->open = true;
@@ -12417,10 +12431,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
1241712431

1241812432
if (_webui.is_webview) {
1241912433
// We have a Linux WebKitGTK WebView running
12420-
GTK_SET_SHOW(win, true);
12434+
_webui_wv_gtk_set_show(win, true);
1242112435
} else {
1242212436
// Failed to start the Linux WebKitGTK
12423-
GTK_SET_SHOW(win, false);
12437+
_webui_wv_gtk_set_show(win, false);
1242412438
}
1242512439

1242612440
#ifdef WEBUI_LOG

0 commit comments

Comments
 (0)