0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

linux-pipewire: Add screencast cursor_visible prop

This commit adds the screencast-specific 'cursor_visible' field
in an anonymous struct within the constructor struct.

This slightly improves the connection code by properly treating
construction-time information in a constructor struct. It allows
removing the extra function call that sets cursor visibility from
the Screencast portal code.

Admittedly that's not much, but again, this will be an important
distinction when introducing the Camera portal code, since some
camera properties will need to trigger renegotiation.
This commit is contained in:
Georges Basile Stavracas Neto 2023-12-13 17:07:29 -03:00 committed by Georges Basile Stavracas Neto
parent a1db8e5bde
commit 67c1202849
3 changed files with 8 additions and 2 deletions

View File

@ -1237,6 +1237,7 @@ obs_pipewire_stream *obs_pipewire_connect_stream(
obs_pw_stream = bzalloc(sizeof(obs_pipewire_stream));
obs_pw_stream->obs_pw = obs_pw;
obs_pw_stream->source = source;
obs_pw_stream->cursor.visible = connect_info->screencast.cursor_visible;
init_format_info(obs_pw_stream);

View File

@ -31,6 +31,9 @@ typedef struct _obs_pipewire_stream obs_pipewire_stream;
struct obs_pipwire_connect_stream_info {
const char *stream_name;
struct pw_properties *stream_properties;
struct {
bool cursor_visible;
} screencast;
};
obs_pipewire *obs_pipewire_create(int pipewire_fd);

View File

@ -198,13 +198,15 @@ static void on_pipewire_remote_opened_cb(GObject *source, GAsyncResult *res,
.stream_properties = pw_properties_new(
PW_KEY_MEDIA_TYPE, "Video", PW_KEY_MEDIA_CATEGORY,
"Capture", PW_KEY_MEDIA_ROLE, "Screen", NULL),
.screencast =
{
.cursor_visible = capture->cursor_visible,
},
};
capture->obs_pw_stream = obs_pipewire_connect_stream(
capture->obs_pw, capture->source, capture->pipewire_node,
&connect_info);
obs_pipewire_stream_set_cursor_visible(capture->obs_pw_stream,
capture->cursor_visible);
}
static void open_pipewire_remote(struct screencast_portal_capture *capture)