mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-04 04:06:09 -05:00
ext_image_capture_source_v1/scene: fix stop for parallel captures
The stop handler disables the output. However, the same source can be captured multiple times in parallel. In that case, stop might be called while another capture session is still ongoing. Only disable the output if the last session is stopped.
This commit is contained in:
parent
caed9d78d7
commit
2699b68b34
1 changed files with 12 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ struct scene_node_source {
|
|||
struct wlr_scene_output *scene_output;
|
||||
|
||||
struct wl_event_source *idle_frame;
|
||||
size_t num_started;
|
||||
|
||||
struct wl_listener node_destroy;
|
||||
struct wl_listener scene_output_destroy;
|
||||
|
|
@ -103,12 +104,23 @@ static void source_render(struct scene_node_source *source) {
|
|||
|
||||
static void source_start(struct wlr_ext_image_capture_source_v1 *base, bool with_cursors) {
|
||||
struct scene_node_source *source = wl_container_of(base, source, base);
|
||||
|
||||
source->num_started++;
|
||||
if (source->num_started > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
source_render(source);
|
||||
}
|
||||
|
||||
static void source_stop(struct wlr_ext_image_capture_source_v1 *base) {
|
||||
struct scene_node_source *source = wl_container_of(base, source, base);
|
||||
|
||||
source->num_started--;
|
||||
if (source->num_started > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_output_state state;
|
||||
wlr_output_state_init(&state);
|
||||
wlr_output_state_set_enabled(&state, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue