]> git.sesse.net Git - nageru/blobdiff - cef_capture.cpp
Add resize(), so that HTML inputs do not need to be locked to the video resolution.
[nageru] / cef_capture.cpp
index 9dc454ba33d426a6abfcb86234c36e193f221c66..e46f0c065f7287e0dce70992a070cea557a0497d 100644 (file)
@@ -86,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();
@@ -224,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;
 }