Skip to content
Open
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions electron/recording/linuxCaptureBackend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ describe("X11 source resolution", () => {
y: 0,
});
});
it("records the only display when Electron's X11 display_id matches no screen id (#1629)", () => {
const laptop = [
{ id: 2_147_483_648, bounds: { x: 0, y: 0, width: 1920, height: 1080 }, scaleFactor: 1 },
];
expect(resolveX11CaptureSource({ id: "screen:383:0", display_id: "2" }, laptop)).toEqual({
kind: "display",
x: 0,
y: 0,
width: 1920,
height: 1080,
});
});
it("rejects stale, missing and malformed sources instead of recording something else", () => {
expect(() => resolveX11CaptureSource(null, displays)).toThrow();
expect(() =>
Expand Down
9 changes: 8 additions & 1 deletion electron/recording/linuxCaptureBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ export function resolveX11CaptureSource(
return { kind: "window", windowId };
}
if (!source.id.startsWith("screen:")) throw new Error("Unsupported X11 recording source.");
const display = displays.find((candidate) => String(candidate.id) === source.display_id);
// Electron derives desktopCapturer's X11 display_id with its own copy of Chromium's
// EDID logic, which falls back to the output index for an output id above 0xff
// (NVIDIA): it then matches no `screen` id (#1629). A single display is still the
// one picked. ponytail: several displays still need the id to match; resolving the
// RandR monitor atom of `screen:<atom>:0` in the helper would cover them.
const display =
displays.find((candidate) => String(candidate.id) === source.display_id) ??
(displays.length === 1 ? displays[0] : undefined);
if (!display) throw new Error("The selected X11 display is no longer available.");
const { bounds, scaleFactor } = display;
if (displays.some((candidate) => candidate.scaleFactor !== scaleFactor)) {
Expand Down
Loading