mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 14:55:37 +00:00
fix(linux): ignore invalid ozone overrides
This commit is contained in:
@@ -21,6 +21,16 @@ describe("shouldForceLinuxEgl", () => {
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("falls back to Electron's ozone hint when OZONE_PLATFORM is invalid", () => {
|
||||
expect(
|
||||
shouldForceLinuxEgl({
|
||||
OZONE_PLATFORM: "auto",
|
||||
ELECTRON_OZONE_PLATFORM_HINT: "wayland",
|
||||
XDG_SESSION_TYPE: "x11",
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("forces EGL in an X11 session", () => {
|
||||
expect(shouldForceLinuxEgl({ XDG_SESSION_TYPE: "x11" })).toBe(true);
|
||||
});
|
||||
|
||||
+11
-8
@@ -4,19 +4,22 @@ export interface GpuSwitches {
|
||||
disableFeatures?: string[];
|
||||
}
|
||||
|
||||
function getForcedLinuxWindowSystem(env: NodeJS.ProcessEnv): "wayland" | "x11" | null {
|
||||
const ozonePlatform =
|
||||
env.OZONE_PLATFORM?.toLowerCase() ??
|
||||
env.ELECTRON_OZONE_PLATFORM_HINT?.toLowerCase() ??
|
||||
null;
|
||||
|
||||
if (ozonePlatform === "wayland" || ozonePlatform === "x11") {
|
||||
return ozonePlatform;
|
||||
function normalizeLinuxWindowSystem(value: string | undefined): "wayland" | "x11" | null {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
if (normalized === "wayland" || normalized === "x11") {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getForcedLinuxWindowSystem(env: NodeJS.ProcessEnv): "wayland" | "x11" | null {
|
||||
return (
|
||||
normalizeLinuxWindowSystem(env.OZONE_PLATFORM) ??
|
||||
normalizeLinuxWindowSystem(env.ELECTRON_OZONE_PLATFORM_HINT)
|
||||
);
|
||||
}
|
||||
|
||||
export function shouldForceLinuxEgl(env: NodeJS.ProcessEnv): boolean {
|
||||
const forcedWindowSystem = getForcedLinuxWindowSystem(env);
|
||||
if (forcedWindowSystem === "wayland") {
|
||||
|
||||
Reference in New Issue
Block a user