From 8ec5630a8e7ec089d2e39697d51642278d1977d7 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 25 Feb 2018 15:21:52 +0100 Subject: [PATCH] Implement HTMLInput::reload(). --- cef_capture.cpp | 7 +++++++ cef_capture.h | 1 + theme.cpp | 11 ++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cef_capture.cpp b/cef_capture.cpp index a2f230a..548e529 100644 --- a/cef_capture.cpp +++ b/cef_capture.cpp @@ -56,6 +56,13 @@ void CEFCapture::set_url(const string &url) }); } +void CEFCapture::reload() +{ + post_to_cef_ui_thread([this] { + browser->Reload(); + }); +} + void CEFCapture::OnPaint(const void *buffer, int width, int height) { steady_clock::time_point timestamp = steady_clock::now(); diff --git a/cef_capture.h b/cef_capture.h index 8dc053d..587af0a 100644 --- a/cef_capture.h +++ b/cef_capture.h @@ -70,6 +70,7 @@ public: } void set_url(const std::string &url); + void reload(); void OnPaint(const void *buffer, int width, int height); diff --git a/theme.cpp b/theme.cpp index bc57b0d..4ddea3a 100644 --- a/theme.cpp +++ b/theme.cpp @@ -431,6 +431,14 @@ int HTMLInput_set_url(lua_State* L) return 0; } +int HTMLInput_reload(lua_State* L) +{ + assert(lua_gettop(L) == 1); + CEFCapture **video_input = (CEFCapture **)luaL_checkudata(L, 1, "HTMLInput"); + (*video_input)->reload(); + return 0; +} + int HTMLInput_get_signal_num(lua_State* L) { assert(lua_gettop(L) == 1); @@ -648,9 +656,10 @@ const luaL_Reg VideoInput_funcs[] = { }; const luaL_Reg HTMLInput_funcs[] = { - // TODO: reload, execute_javascript, perhaps set_max_fps? + // TODO: execute_javascript, perhaps set_max_fps? { "new", HTMLInput_new }, { "set_url", HTMLInput_set_url }, + { "reload", HTMLInput_reload }, { "get_signal_num", HTMLInput_get_signal_num }, { NULL, NULL } }; -- 2.39.2