Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ output
CMakeLists.txt.user
out
__pycache__
obj/
obj/
.agent/
AGENTS.md
4 changes: 4 additions & 0 deletions src/CCefView/capi/CefBrowser_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ void CCefBrowser_setWindowlessFrameRate(ccefbrowser_class * thiz, int rate) {
thiz->setWindowlessFrameRate(rate);
}

void CCefBrowser_sendExternalBeginFrame(ccefbrowser_class * thiz) {
thiz->sendExternalBeginFrame();
}

void CCefBrowser_setFocus(ccefbrowser_class * thiz, bool focused) {
thiz->setFocus(focused);
}
Expand Down
1 change: 1 addition & 0 deletions src/CCefView/capi/CefBrowser_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern "C"
CCEFVIEW_EXPORT void CCefBrowser_setDisablePopupContextMenu(ccefbrowser_class * thiz, bool disable);
CCEFVIEW_EXPORT bool CCefBrowser_isPopupContextMenuDisabled(ccefbrowser_class * thiz);
CCEFVIEW_EXPORT void CCefBrowser_setWindowlessFrameRate(ccefbrowser_class * thiz, int rate);
CCEFVIEW_EXPORT void CCefBrowser_sendExternalBeginFrame(ccefbrowser_class * thiz);
CCEFVIEW_EXPORT void CCefBrowser_setFocus(ccefbrowser_class * thiz, bool focused);
CCEFVIEW_EXPORT void CCefBrowser_wasResized(ccefbrowser_class * thiz);
CCEFVIEW_EXPORT void CCefBrowser_wasHidden(ccefbrowser_class * thiz, bool hidden);
Expand Down
3 changes: 2 additions & 1 deletion src/CCefView/include/CefBrowser.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef CCEFVIEW_H
#ifndef CCEFVIEW_H
#define CCEFVIEW_H

#pragma once
Expand Down Expand Up @@ -228,6 +228,7 @@ class CCefBrowser

#pragma region Control CEF
void setWindowlessFrameRate(int rate);
void sendExternalBeginFrame();
void setFocus(bool focused);
void wasResized();
void wasHidden(bool hidden);
Expand Down
29 changes: 25 additions & 4 deletions src/CCefView/source/CefBrowser.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "CefBrowser.h"
#include "CefBrowser.h"

#pragma region cef_headers
#include <include/cef_browser.h>
Expand Down Expand Up @@ -33,10 +33,18 @@ CCefBrowser::CCefBrowser(CefBrowserCallback callback, const std::string& url, co
CefBrowserSettings browserSettings;
CCefSetting::CopyToCefBrowserSettings(setting, browserSettings);

// Set window info
// Set window info based on configured rendering mode.
CefWindowInfo window_info;
window_info.SetAsWindowless(0);
window_info.shared_texture_enabled = (setting && setting->hardwareAcceleration_);
bool windowlessRenderingEnabled = false;
if (pContext && pContext->cefConfig()) {
windowlessRenderingEnabled = pContext->cefConfig()->windowlessRendering();
}

if (windowlessRenderingEnabled) {
window_info.SetAsWindowless(0);
window_info.shared_texture_enabled = (setting && setting->hardwareAcceleration_);
window_info.external_begin_frame_enabled = true;
Comment thread
xy00099 marked this conversation as resolved.
}

if (CefColorGetA(browserSettings.background_color) == 0)
transparentPaintingEnabled_ = true;
Expand Down Expand Up @@ -332,6 +340,19 @@ CCefBrowser::setWindowlessFrameRate(int rate)
pCefBrowser_->GetHost()->SetWindowlessFrameRate(rate);
}

void
CCefBrowser::sendExternalBeginFrame()
{
if (!pCefBrowser_)
return;

auto host = pCefBrowser_->GetHost();
if (!host || !host->IsWindowRenderingDisabled())
return;

host->SendExternalBeginFrame();
}

void
CCefBrowser::setFocus(bool focused)
{
Expand Down
8 changes: 8 additions & 0 deletions src/DNCefView/AutoGen/CefBrowser+AutoGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ public void SetWindowlessFrameRate(int rate)
CCefBrowser_setWindowlessFrameRate(_native, rate);
}

// Source: void sendExternalBeginFrame()
[DllImport("CCefView")]
private static extern void CCefBrowser_sendExternalBeginFrame(IntPtr thiz);
public void SendExternalBeginFrame()
{
CCefBrowser_sendExternalBeginFrame(_native);
}

// Source: void setFocus(bool)
[DllImport("CCefView")]
private static extern void CCefBrowser_setFocus(IntPtr thiz, bool focused);
Expand Down