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

Screenshot permission, attempt 2 #853

Conversation

GeorgesStavracas
Copy link
Member

This PR implements a new permission table and value for screenshots, which allows portal implementations to skip the sharing dialog.

Closes #649

No functional changes, but will facilitate future patches.
Next commit will introduce a permission query for screenshots, so
prepare for that by moving some of the code to a thread job.
This will be used by the Screenshot call to query the permissions
of the application for screenshotting.
@GeorgesStavracas GeorgesStavracas marked this pull request as ready for review August 8, 2022 20:17
@robert-ancell
Copy link
Contributor

I reviewed the code and it looks good to me, thanks Georges!

@GeorgesStavracas GeorgesStavracas force-pushed the gbsneto/screenshot-permission-for-review branch from 99183d3 to a99cb62 Compare August 10, 2022 14:22
Copy link
Collaborator

@jadahl jadahl left a comment

Choose a reason for hiding this comment

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

lgtm, just a minor leak spotted

src/screenshot.c Outdated Show resolved Hide resolved
@GeorgesStavracas GeorgesStavracas force-pushed the gbsneto/screenshot-permission-for-review branch from a99cb62 to 3f6e76f Compare August 10, 2022 15:36
@GeorgesStavracas GeorgesStavracas force-pushed the gbsneto/screenshot-permission-for-review branch from 3f6e76f to 12ff0c8 Compare August 10, 2022 17:42
@GeorgesStavracas GeorgesStavracas force-pushed the gbsneto/screenshot-permission-for-review branch from 12ff0c8 to df8b033 Compare August 10, 2022 17:49
This commits makes the screenshot portal request a permission
using the the access portal when a non-interactive screenshot
is requested.

This should be enough to let applications request permissions
once, and be forever able to screenshot without much hassle.

Add a new 'version' property to the Screenshot implementation
D-Bus interface, and check if the implementation reports at
least version = 2 before requesting the screenshot permission.

Fixes flatpak#649
Trivial, but helps debugging it.
Noticed while reading reference code for the screenshot changes.
It's good hygiene to protect against this failure.
Spotted during review of the screenshot changes, which are basically
a copy of this code.
@GeorgesStavracas GeorgesStavracas force-pushed the gbsneto/screenshot-permission-for-review branch from df8b033 to 64130e2 Compare August 10, 2022 18:00
@jadahl
Copy link
Collaborator

jadahl commented Aug 10, 2022

lgtm

@GeorgesStavracas
Copy link
Member Author

Thanks @robert-ancell and @jadahl

@GeorgesStavracas GeorgesStavracas merged commit 275415b into flatpak:main Aug 10, 2022
@GeorgesStavracas GeorgesStavracas deleted the gbsneto/screenshot-permission-for-review branch August 10, 2022 18:10
@DamirPorobic
Copy link

Is anything changing for the caller or does this affects only the internal implementation of the portal?

@All3xJ
Copy link

All3xJ commented Nov 2, 2022

Thanks a lot! :D

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

Successfully merging this pull request may close these issues.

Screenshot portal without prompt
5 participants