Skip to content
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

fix: don't set delegate for QLPreviewPanel #37530

Merged
merged 1 commit into from Mar 14, 2023

Conversation

jeremyspiegel
Copy link
Contributor

@jeremyspiegel jeremyspiegel commented Mar 8, 2023

Description of Change

Fixes #37476

The QuickLook NSWindow's delegate is set to the same object as the delegate for the BrowserWindow's NSWindow here. The delegate's handler for windowDidChangeOcclusionState doesn't seem to expect handling events for the QuickLook window, and so when the QuickLook window becomes occluded, it assumes that the BrowserWindow has been occluded.

There's a similar issue for other NSWindowDelegate methods besides windowDidChangeOcclusionState. So resizing/moving the QuickLook window will cause the BrowserWindow's resize/will-resize/resized/move/will-move/moved events to fire.

The code has moved around a bit but I think this may have existed since BrowserWindow.previewFile was added in 2016 in #7592. FYI @lauracpierre @zcbenz @bengotow

Checklist

Release Notes

Notes: Fixed issue with BrowserWindow not updating after call to previewFile.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Mar 8, 2023
});

w.previewFile(__filename);
await setTimeout(500);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out a great way to test this without adding another internal event just for testing. I also tried await waitUntil(() => !w.isFocused()); but that didn't wait long enough for the second show.

I would have also liked to create a test with another window covering the QuickLook window but that doesn't work either.

@codebytere codebytere self-requested a review March 13, 2023 12:44
@codebytere codebytere changed the title fix: don't set delegate for QLPreviewPanel fix: don't set delegate for QLPreviewPanel Mar 13, 2023
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/22-x-y PR should also be added to the "22-x-y" branch. target/23-x-y PR should also be added to the "23-x-y" branch. target/24-x-y PR should also be added to the "24-x-y" branch. labels Mar 13, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Mar 13, 2023
Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree it'd be nice to have another test but what you added is probably the reasonable best w/o adding another event as you mentioned so i'm good to move this forward as-is!

@codebytere codebytere merged commit bf1cc1a into electron:main Mar 14, 2023
@release-clerk
Copy link

release-clerk bot commented Mar 14, 2023

Release Notes Persisted

Fixed issue with BrowserWindow not updating after call to previewFile.

@trop
Copy link
Contributor

trop bot commented Mar 14, 2023

I have automatically backported this PR to "22-x-y", please check out #37576

@trop
Copy link
Contributor

trop bot commented Mar 14, 2023

I have automatically backported this PR to "23-x-y", please check out #37577

@trop trop bot removed the target/22-x-y PR should also be added to the "22-x-y" branch. label Mar 14, 2023
@trop
Copy link
Contributor

trop bot commented Mar 14, 2023

I have automatically backported this PR to "24-x-y", please check out #37578

@trop trop bot added in-flight/23-x-y and removed target/23-x-y PR should also be added to the "23-x-y" branch. target/24-x-y PR should also be added to the "24-x-y" branch. labels Mar 14, 2023
@jeremyspiegel jeremyspiegel mentioned this pull request Mar 16, 2023
@trop trop bot added merged/23-x-y PR was merged to the "23-x-y" branch. merged/22-x-y PR was merged to the "22-x-y" branch. and removed in-flight/23-x-y labels Mar 16, 2023
@trop trop bot added merged/24-x-y PR was merged to the "24-x-y" branch and removed in-flight/24-x-y labels Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/22-x-y PR was merged to the "22-x-y" branch. merged/23-x-y PR was merged to the "23-x-y" branch. merged/24-x-y PR was merged to the "24-x-y" branch semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: BrowserWindow.previewFile causes window to not update (appearing frozen)
2 participants