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

[macOS, Windows] Add support for excluding windows from a screenshot. #88950

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Feb 28, 2024

Adds flag to exclude window for screenshots taken by DisplayServer, allowing it to stay on to of the screen part that is captured.

Intended for better color picker and similar overlays (e.g., magnifier, color blindness simulator tool).

TODO:

  • Use it for the Godot color picking controls.
  • Check if it's possible to implement on X11 and Wayland as well.
Screen.Recording.2024-02-28.at.12.14.34.mov

@Riteo
Copy link
Contributor

Riteo commented Feb 28, 2024

and Wayland as well.

There are only two (actively supported) ways of capturing the screen AFAIK: the wlroots protocol and the desktop portal.

The wlroots protocol (wlr-screencopy-unstable-v11) allows only grabbing the whole output or parts of it and it is supported, as the name implies, only on wlroots compositors (and mir apparently, whatever it is under the hood).

The portal instead depends on D-Bus (which we support :D ), XDG portals (which we support :DD ) and PipeWire (which we don't support yet :( ). It apparently supports multiple "sources"2 but I'm not entirely sure how it's supposed to exclude things or if they work "dynamically"... Heh, we'll see.

I suppose we'll eventually have to implement both methods in general for screencasting (fallbacks and whatnot) but this specific window excluding logic could maybe be implemented only in the portal backend.

Footnotes

  1. https://wayland.app/protocols/wlr-screencopy-unstable-v1

  2. https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.ScreenCast.html

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

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

I am not familiar with the technical details, but from a usability point of view this is great.

@fire fire requested a review from a team October 22, 2024 21:55
@bruvzg
Copy link
Member Author

bruvzg commented Dec 6, 2024

Updated to incorporate #98411 changes (for both native and legacy picker):

Screen.Recording.2024-12-06.at.20.43.52.mov

Tested on both macOS and Windows (on Windows, exclude window for screenshots is global, and therefore it won't show on screen recording).

@Repiteo Repiteo requested review from KoBeWi and removed request for a team December 9, 2024 18:01
@Repiteo Repiteo modified the milestones: 4.x, 4.4 Dec 9, 2024
@Repiteo Repiteo merged commit 69c67ed into godotengine:master Dec 10, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 10, 2024

Thanks!

@WhalesState
Copy link
Contributor

This Makes the picking unusable on Linux, not working at all, I have tried to fix it, but I couldn't exclude the picking popup from screen capture, the only way is to offset the picker window to the left or right based on mouse screen position or to hide the picking popup.

Screencast.from.01-08-2025.05.25.25.AM.webm

Should i open a new bug for this ?

Screencast.from.01-08-2025.03.04.55.AM.webm

@fire
Copy link
Member

fire commented Jan 8, 2025

Please open a new bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants