Repository navigation
Fix recording, cursor telemetry and export on KDE Plasma Wayland #1126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
selter2001
wants to merge
6
commits into
webadderallorg:main
Choose a base branch
from
selter2001:fix/linux-wayland-recording
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8d77def
Wait for the first portal frame before starting a Linux recording
9ace604
Track the cursor and clicks through KWin on KDE Wayland
c9cd5bd
Prefer WebGL for Lightning exports on Linux
f8562df
Discard a cancelled browser recording instead of saving its last frag…
1deabe9
Stop the recording from its tray icon instead of recreating the HUD
28f59e4
Finish the recording when the captured source ends
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { shouldRecreateHudToFocus } from "./hudFocusRecreation"; | ||
|
|
||
| const idleHud = { platform: "linux", isHud: true, focused: false, captureInProgress: false }; | ||
|
|
||
| describe("shouldRecreateHudToFocus", () => { | ||
| it("recreates an idle, unfocused HUD on Linux", () => { | ||
| expect(shouldRecreateHudToFocus(idleHud)).toBe(true); | ||
| }); | ||
|
|
||
| it("keeps the HUD while it owns a capture", () => { | ||
| expect(shouldRecreateHudToFocus({ ...idleHud, captureInProgress: true })).toBe(false); | ||
| }); | ||
|
|
||
| it("keeps a HUD that already has focus", () => { | ||
| expect(shouldRecreateHudToFocus({ ...idleHud, focused: true })).toBe(false); | ||
| }); | ||
|
|
||
| it("leaves windows other than the HUD alone", () => { | ||
| expect(shouldRecreateHudToFocus({ ...idleHud, isHud: false })).toBe(false); | ||
| }); | ||
|
|
||
| it.each(["darwin", "win32"] as const)("never recreates the HUD on %s", (platform) => { | ||
| expect(shouldRecreateHudToFocus({ ...idleHud, platform })).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * Wayland compositors ignore focus(), so an unfocused HUD is destroyed and | ||
| * recreated to bring it forward. Its renderer owns the capture stream and the | ||
| * recorded data, so that has to wait while a recording is starting, running | ||
| * or being saved. Any other window is left alone: it may still be loading, or | ||
| * hold unsaved work. | ||
| */ | ||
| export function shouldRecreateHudToFocus({ | ||
| platform, | ||
| isHud, | ||
| focused, | ||
| captureInProgress, | ||
| }: { | ||
| platform: string; | ||
| isHud: boolean; | ||
| focused: boolean; | ||
| captureInProgress: boolean; | ||
| }): boolean { | ||
| return platform === "linux" && isHud && !focused && !captureInProgress; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { | ||
| buildKwinClickEffectScript, | ||
| createKwinJournalButtonsParser, | ||
| diffKwinButtons, | ||
| KWIN_CLICK_JOURNAL_MARKER, | ||
| } from "./kwinClickEffect"; | ||
|
|
||
| describe("diffKwinButtons", () => { | ||
| it("maps newly pressed Qt buttons to hook button numbers", () => { | ||
| expect(diffKwinButtons(1, 0)).toEqual({ pressed: [1], released: 0 }); | ||
| expect(diffKwinButtons(2, 0)).toEqual({ pressed: [2], released: 0 }); | ||
| expect(diffKwinButtons(4, 0)).toEqual({ pressed: [3], released: 0 }); | ||
| expect(diffKwinButtons(3, 1)).toEqual({ pressed: [2], released: 0 }); | ||
| }); | ||
|
|
||
| it("counts releases and ignores unknown buttons", () => { | ||
| expect(diffKwinButtons(0, 1)).toEqual({ pressed: [], released: 1 }); | ||
| expect(diffKwinButtons(0, 3)).toEqual({ pressed: [], released: 2 }); | ||
| expect(diffKwinButtons(8, 0)).toEqual({ pressed: [], released: 0 }); | ||
| }); | ||
| }); | ||
|
|
||
| describe("buildKwinClickEffectScript", () => { | ||
| it("prints button changes with the journal marker", () => { | ||
| const script = buildKwinClickEffectScript(); | ||
| expect(script).toContain("effects.mouseChanged.connect"); | ||
| expect(script).toContain(`print("${KWIN_CLICK_JOURNAL_MARKER} "`); | ||
| // Scripted effects have no D-Bus access. | ||
| expect(script).not.toContain("callDBus"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("createKwinJournalButtonsParser", () => { | ||
| it("emits button transitions across chunk boundaries and skips other lines", () => { | ||
| const changes: Array<[number, number]> = []; | ||
| const parser = createKwinJournalButtonsParser((buttons, oldButtons) => | ||
| changes.push([buttons, oldButtons]), | ||
| ); | ||
|
|
||
| parser(`js: ${KWIN_CLICK_JOURNAL_MARKER} 1 0\nkwin_wayland: something else\n`); | ||
| parser(`js: ${KWIN_CLICK_JOURNAL_MARKER} 0`); | ||
| parser(" 1\n"); | ||
|
|
||
| expect(changes).toEqual([ | ||
| [1, 0], | ||
| [0, 1], | ||
| ]); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.