]> git.sesse.net Git - nageru/commitdiff
Implement HTMLInput::reload().
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 25 Feb 2018 14:21:52 +0000 (15:21 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Feb 2018 17:06:16 +0000 (18:06 +0100)
cef_capture.cpp
cef_capture.h
theme.cpp

index a2f230aae9af610ec6710278b33f1ccbbe462472..548e529ad3d2e5dc457e638288c787043d2016eb 100644 (file)
@@ -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();
index 8dc053dddf9bfc1e37ecb0e62dd8954b1a3ac617..587af0a551dc0722af6b27acb821c28c83ccb58d 100644 (file)
@@ -70,6 +70,7 @@ public:
        }
 
        void set_url(const std::string &url);
+       void reload();
 
        void OnPaint(const void *buffer, int width, int height);
 
index bc57b0d209cb329571c594ed904991c6ff57d150..4ddea3a25915713191719c0da8c412d49933ac02 100644 (file)
--- 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 }
 };