Change how COSMIC_ENABLE_WAYLAND_SECURITY/privileged is handled

Manually starting `cosmic-panel` was not working properly in release
builds, because without `cfg!(debug_assertions)`, the `privileged` flag
wasn't sent on the panel, so it couldn't be propagated to the applets,
which also fail the `client_has_no_security_context()` check.

I don't see a way to have both the `cfg!(debug_assertions)` check and
`COSMIC_ENABLE_WAYLAND_SECURITY`. Now only the latter is used, and it
determines the value of `privileged` for clients started normally. In
the future, we could make the default value of
`COSMIC_ENABLE_WAYLAND_SECURITY` depend on `cfg!(debug_assertions)` if
desired.

This also corrects the inconsistency that the `cfg!(debug_assertions)`
check wasn't applied to the render-node-specific Wayland sockets.
This commit is contained in:
Ian Douglas Scott 2024-05-07 16:02:12 -07:00 committed by Victoria Brekenfeld
parent 954aa6edeb
commit a9740e5040
4 changed files with 31 additions and 60 deletions

View file

@ -96,7 +96,10 @@ impl State {
.insert_source(listener, move |client_stream, _, state: &mut State| {
if let Err(err) = state.common.display_handle.insert_client(
client_stream,
Arc::new(state.new_client_state_with_node(render_node)),
Arc::new(ClientState {
advertised_drm_node: Some(render_node),
..state.new_client_state()
}),
) {
warn!(
socket_name = socket_name_clone,