32 lines
782 B
C++
32 lines
782 B
C++
#include "rktwebview.h"
|
|
#include <string>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{std::string me = argv[0];
|
|
int idx = me.rfind("/");
|
|
|
|
std::string loc = me.substr(0, idx);
|
|
std::string prg = loc + "/rktwebview_prg";
|
|
|
|
setenv("RKT_WEBVIEW_PRG", prg.c_str(), true);
|
|
setenv("LD_LIBRARY_PATH", loc.c_str(), true);
|
|
|
|
int context = rkt_webview_new_context("", nullptr);
|
|
|
|
int wv = rkt_webview_create(context, 0);
|
|
|
|
rkt_webview_move(wv, 100, 200);
|
|
rkt_webview_resize(wv, 800, 600);
|
|
rkt_webview_set_url(wv, "https://wikipedia.org");
|
|
|
|
while(rkt_webview_events_waiting() > 0) {
|
|
rkt_data_t *d = rkt_webview_get_event();
|
|
rkt_webview_free_data(d);
|
|
}
|
|
sleep(10);
|
|
|
|
rkt_webview_close(wv);
|
|
|
|
rkt_webview_cleanup();
|
|
} |