This commit is contained in:
2026-03-03 09:39:15 +01:00
parent 769d5681d4
commit 35aae3b707
9 changed files with 136 additions and 40 deletions

View File

@@ -4,7 +4,7 @@
#include <string.h>
#include <chrono>
#include <stdint.h>
#include <unistd.h>
//#include <unistd.h>
#include <fcntl.h>
#include "rktwebview_qt.h"
#include "webviewapp.h"
@@ -18,10 +18,10 @@ uint64_t current_ms() {
// Main C Interface
/////////////////////////////////////////////////////////////////////
static int pipefd[2];
static bool started = false;
static pid_t webview_process;
static bool cannot_fork_or_pipe = false;
//static int pipefd[2];
//static bool started = false;
//static pid_t webview_process;
//static bool cannot_fork_or_pipe = false;
Rktwebview_qt *handler = nullptr;
@@ -51,19 +51,21 @@ void rkt_webview_init()
}
}
int rkt_webview_create(int parent)
int rkt_webview_create(int parent, void (*js_event_cb)(const char *))
{
//rkt_webview_init();
return handler->rktWebViewCreate(parent);
rkt_webview_init();
return handler->rktWebViewCreate(parent, js_event_cb);
}
void rkt_webview_close(int wv)
{
rkt_webview_init();
handler->rktWebViewClose(wv);
}
result_t rkt_webview_set_url(int wv, const char *url)
{
rkt_webview_init();
result_t r = handler->rktSetUrl(wv, url);
return r;
}
@@ -151,7 +153,7 @@ void rkt_webview_process_events(int for_ms)
int64_t end_ms = start_ms + for_ms;
while (current_ms() < end_ms) {
usleep(500); // sleep 0.5 ms
QThread::usleep(500); // sleep 0.5 ms
handler->doEvents();
}
}