Repository navigation
screenshots: keep an open menu or popup in area and full-screen shots - #3045
Open
opencodejr[bot] wants to merge 1 commit into
Open
opencodejr[bot] wants to merge 1 commit into
opencodejr[bot] wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3044 (reported by @tmcfarlane, whose diagnosis pointed to the cause; this is a clean implementation).
Problem
Labs › Screenshots took the shot only after the pick:
picked()hid the picker, thentake()calledcapture_core::screenshot_with. The pick's click lands on the picker, outside an open menu, so macOS closes the menu before the shot is taken.Change
src/screenshots/frozen.rs. When the ⌘⇧4 picker opens for a shot (not for recording),menu_openreads the on-screen window list. If another app (pid ≠ Hex) has a visible window betweenkCGPopUpMenuWindowLevel(101) andkCGHelpWindowLevel(200) overlapping the display under the pointer, that display is shot once, before the picker shows. That level range covers menus, pop-up buttons,<select>lists and tooltips. The shot uses the same exclusions as before (Hex's overlays and the picker window) and no pointer.take()cuts an area or a full-screen click from it, converting points to the display's pixels and trimming to the display.hex screenshot, and a failed early capture always use a live shot. Recording (⌘⇧5) is unchanged. Nothing underios/is touched.src/screenshots.rsandfrozen.rsnow say the freeze happens only while a menu or popup is open.Trade-offs
Testing
cfg(all(target_os = "macos", hex_capture))) and was written on Linux. The full app build and clippy have NOT run; they need a Mac before merging.frozen.rs:capture_core,scrawl_captureandtracing: 4 tests pass and clippy-D warningsreports nothing.rustfmt --edition 2024 --checkpasses on both files, andpython3 scripts/code-shape.py --checkreports no hard problems.<select>or a popup menu, press ⌘⇧4, drag over it, and confirm the saved shot includes the menu. With no menu open, confirm shots still show the live screen and the picker opens as fast as before.Fixes #3044