]> git.sesse.net Git - nageru/blobdiff - cef_capture.cpp
Do not wait for OnBrowserDestroyed.
[nageru] / cef_capture.cpp
index c52e3a45ddccf92f18b6fb489a80d26b66f05ebc..e46f0c065f7287e0dce70992a070cea557a0497d 100644 (file)
@@ -60,6 +60,7 @@ void CEFCapture::set_url(const string &url)
 void CEFCapture::reload()
 {
        post_to_cef_ui_thread([this] {
+               loaded = false;
                browser->Reload();
        });
 }
@@ -85,6 +86,13 @@ void CEFCapture::execute_javascript_async(const string &js)
        });
 }
 
+void CEFCapture::resize(unsigned width, unsigned height)
+{
+       lock_guard<mutex> lock(resolution_mutex);
+       this->width = width;
+       this->height = height;
+}
+
 void CEFCapture::OnPaint(const void *buffer, int width, int height)
 {
        steady_clock::time_point timestamp = steady_clock::now();
@@ -223,6 +231,12 @@ void NageruCEFClient::OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType ty
 
 bool NageruCEFClient::GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect)
 {
+       return parent->GetViewRect(rect);
+}
+
+bool CEFCapture::GetViewRect(CefRect &rect)
+{
+       lock_guard<mutex> lock(resolution_mutex);
        rect = CefRect(0, 0, width, height);
        return true;
 }