Skip to content

Commit

Permalink
set windowless fps to 120
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Nov 16, 2023
1 parent 4f24f98 commit e91a133
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion native/CefBrowser_N.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ void create(std::shared_ptr<JNIObjectsForCreate> objs,

CefBrowserSettings settings;

settings.windowless_frame_rate = 120;
if (transparent == JNI_FALSE) {
// Specify an opaque background color (white) to disable transparency.
settings.background_color = CefColorSetARGB(255, 255, 255, 255);
Expand Down Expand Up @@ -1385,14 +1386,15 @@ Java_org_cef_browser_CefBrowser_1N_N_1SetFocus(JNIEnv* env,
jboolean enable) {
CefRefPtr<CefBrowser> browser = JNI_GET_BROWSER_OR_RETURN(env, obj);
browser->GetHost()->SetFocus(enable != JNI_FALSE);
browser->GetHost()->SetWindowlessFrameRate(120);
}

JNIEXPORT void JNICALL
Java_org_cef_browser_CefBrowser_1N_N_1SetWindowVisibility(JNIEnv* env,
jobject obj,
jboolean visible) {
CefRefPtr<CefBrowser> browser = JNI_GET_BROWSER_OR_RETURN(env, obj);

browser->GetHost()->SetWindowlessFrameRate(120);
#if defined(OS_MACOSX)
if (!browser->GetHost()->IsWindowRenderingDisabled()) {
util_mac::SetVisibility(browser->GetHost()->GetWindowHandle(),
Expand Down Expand Up @@ -1532,6 +1534,7 @@ Java_org_cef_browser_CefBrowser_1N_N_1WasResized(JNIEnv* env,
jint width,
jint height) {
CefRefPtr<CefBrowser> browser = JNI_GET_BROWSER_OR_RETURN(env, obj);

if (browser->GetHost()->IsWindowRenderingDisabled()) {
browser->GetHost()->WasResized();
}
Expand All @@ -1546,6 +1549,8 @@ Java_org_cef_browser_CefBrowser_1N_N_1WasResized(JNIEnv* env,
}
}
#endif

browser->GetHost()->SetWindowlessFrameRate(120);
}

JNIEXPORT void JNICALL
Expand Down

0 comments on commit e91a133

Please sign in to comment.