Skip to content

Commit 6fc1b10

Browse files
authored
Merge pull request #662 from hdijkema/gtk-eventloop-for-script-client
Implement GTK event processing in while javascript call (Gtk WebView)
2 parents 3093057 + 7bfb37a commit 6fc1b10

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/webui.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,13 @@ bool webui_script_client(webui_event_t* e, const char* script, size_t timeout,
953953
_webui_mutex_lock(&_webui.mutex_js_run);
954954
js_status = _webui.run_done[run_id];
955955
_webui_mutex_unlock(&_webui.mutex_js_run);
956+
#if __linux__
957+
if (_webui.is_webview) {
958+
while (gtk_events_pending()) {
959+
gtk_main_iteration_do(0);
960+
}
961+
}
962+
#endif
956963
if (js_status)
957964
break;
958965
}
@@ -966,6 +973,13 @@ bool webui_script_client(webui_event_t* e, const char* script, size_t timeout,
966973
_webui_mutex_lock(&_webui.mutex_js_run);
967974
js_status = _webui.run_done[run_id];
968975
_webui_mutex_unlock(&_webui.mutex_js_run);
976+
#if __linux__
977+
if (_webui.is_webview) {
978+
while (gtk_events_pending()) {
979+
gtk_main_iteration_do(0);
980+
}
981+
}
982+
#endif
969983
if (js_status)
970984
break;
971985
if (_webui_timer_is_end(&timer, (timeout * 1000)))

0 commit comments

Comments
 (0)