More macOS fixes, introduce RUST code

This commit is contained in:
PJB3005
2025-12-27 01:44:57 +01:00
parent 602d7833a1
commit a1dddf6af1
13 changed files with 529 additions and 2 deletions

View File

@@ -54,6 +54,7 @@ namespace Robust.Client.WebView.Cef
protected override void OnRegisterCustomSchemes(CefSchemeRegistrar registrar)
{
// NOTE: KEEP IN SYNC WITH RUST CODE!
registrar.AddCustomScheme("res", CefSchemeOptions.Secure | CefSchemeOptions.Standard);
registrar.AddCustomScheme("usr", CefSchemeOptions.Secure | CefSchemeOptions.Standard);
}

View File

@@ -45,6 +45,7 @@ namespace Robust.Client.WebView.Cef
_localization.GetString("cmd-flushcookies-help"),
(_, _, _) => CefCookieManager.GetGlobal(null).FlushStore(null));
#if !MACOS
string subProcessName;
if (OperatingSystem.IsWindows())
subProcessName = "Robust.Client.WebView.exe";
@@ -53,7 +54,6 @@ namespace Robust.Client.WebView.Cef
else
throw new NotSupportedException("Unsupported platform for CEF!");
#if !MACOS
var subProcessPath = Path.Combine(BasePath, subProcessName);
var cefResourcesPath = LocateCefResources();
_sawmill.Debug($"Subprocess path: {subProcessPath}, resources: {cefResourcesPath}");
@@ -80,12 +80,15 @@ namespace Robust.Client.WebView.Cef
return 0;
});
// Needed to implement CefAppProtocol on our NSApplication.
NativeLibrary.Load("robust_native_webview", typeof(WebViewManagerCef).Assembly, null);
#endif
var settings = new CefSettings()
{
WindowlessRenderingEnabled = true, // So we can render to our UI controls.
ExternalMessagePump = false, // Unsure, honestly. TODO CEF: Research this?
ExternalMessagePump = true,
NoSandbox = true, // Not disabling the sandbox crashes CEF.
#if !MACOS
BrowserSubprocessPath = subProcessPath,