compositor: make new screenhots free for all on --debug

Replicating the policy of the old screenshooting interface, allow all
screenshot to anyone with the new interface as well when --debug is
used.

Looks like there was one stray trailing space in unrelated code that my
editor deleted. Better this way.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-09-30 17:02:02 +03:00
parent f60c9cc1e9
commit e40a7eae67

View file

@ -130,6 +130,7 @@ struct wet_compositor {
pid_t autolaunch_pid;
bool autolaunch_watch;
bool use_color_manager;
struct wl_listener screenshot_auth;
};
static FILE *weston_logfile = NULL;
@ -2046,7 +2047,7 @@ drm_backend_output_configure(struct weston_output *output,
mode = WESTON_DRM_BACKEND_OUTPUT_CURRENT;
/* If mode=current and no max-bpc was specfied on the .ini file,
use current max_bpc so full modeset is not done. */
if (!max_bpc_specified)
if (!max_bpc_specified)
max_bpc = 0;
} else if (strcmp(s, "preferred") != 0) {
modeline = s;
@ -3575,6 +3576,17 @@ weston_log_subscribe_to_scopes(struct weston_log_context *log_ctx,
weston_log_setup_scopes(log_ctx, flight_rec, flight_rec_scopes);
}
static void
screenshot_allow_all(struct wl_listener *l,
struct weston_output_capture_attempt *att)
{
/*
* The effect of --debug option: indiscriminately allow everyone to
* take screenshots of any output.
*/
att->authorized = true;
}
static void
sigint_helper(int sig)
{
@ -3779,8 +3791,12 @@ wet_main(int argc, char *argv[], const struct weston_testsuite_data *test_data)
protologger = wl_display_add_protocol_logger(display,
protocol_log_fn,
NULL);
if (debug_protocol)
if (debug_protocol) {
weston_compositor_enable_debug_protocol(wet.compositor);
weston_compositor_add_screenshot_authority(wet.compositor,
&wet.screenshot_auth,
screenshot_allow_all);
}
if (flight_rec)
weston_compositor_add_debug_binding(wet.compositor, KEY_D,