Skip to content
Merged
Changes from all commits
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
16 changes: 16 additions & 0 deletions desktop/src/cef/internal/app.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

use cef::rc::{Rc, RcImpl};
use cef::sys::{_cef_app_t, cef_base_ref_counted_t};
use cef::{BrowserProcessHandler, CefString, ImplApp, ImplCommandLine, SchemeRegistrar, WrapApp};
Expand Down Expand Up @@ -34,6 +36,20 @@ impl<H: CefEventHandler + Clone> ImplApp for AppImpl<H> {
// Disable GPU acceleration, because it is not supported for Offscreen Rendering and can cause crashes.
cmd.append_switch(Some(&CefString::from("disable-gpu")));
cmd.append_switch(Some(&CefString::from("disable-gpu-compositing")));

// Tell CEF to use Wayland if available
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
{
let use_wayland = env::var("WAYLAND_DISPLAY")
.ok()
.filter(|var| !var.is_empty())
.or_else(|| env::var("WAYLAND_SOCKET").ok())
.filter(|var| !var.is_empty())
.is_some();
if use_wayland {
cmd.append_switch_with_value(Some(&CefString::from("ozone-platform")), Some(&CefString::from("wayland")));
}
}
}
}

Expand Down
Loading