mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
output: introduce wlr_output_lock_attach_render
This allows screen shooters and screen grabbers to ensure rendering will be used instead of direct scan-out.
This commit is contained in:
parent
e554c593f9
commit
6c659da98b
4 changed files with 28 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ static void frame_destroy(struct wlr_export_dmabuf_frame_v1 *frame) {
|
|||
if (frame == NULL) {
|
||||
return;
|
||||
}
|
||||
wlr_output_lock_attach_render(frame->output, false);
|
||||
if (frame->cursor_locked) {
|
||||
wlr_output_lock_software_cursors(frame->output, false);
|
||||
}
|
||||
|
|
@ -126,6 +127,7 @@ static void manager_handle_capture_output(struct wl_client *client,
|
|||
return;
|
||||
}
|
||||
|
||||
wlr_output_lock_attach_render(frame->output, true);
|
||||
if (overlay_cursor) {
|
||||
wlr_output_lock_software_cursors(frame->output, true);
|
||||
frame->cursor_locked = true;
|
||||
|
|
|
|||
|
|
@ -497,6 +497,9 @@ bool wlr_output_attach_buffer(struct wlr_output *output,
|
|||
if (!output->impl->attach_buffer) {
|
||||
return false;
|
||||
}
|
||||
if (output->attach_render_locks > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the output has at least one software cursor, refuse to attach the
|
||||
// buffer
|
||||
|
|
@ -614,6 +617,18 @@ struct wlr_output *wlr_output_from_resource(struct wl_resource *resource) {
|
|||
return wl_resource_get_user_data(resource);
|
||||
}
|
||||
|
||||
void wlr_output_lock_attach_render(struct wlr_output *output, bool lock) {
|
||||
if (lock) {
|
||||
++output->attach_render_locks;
|
||||
} else {
|
||||
assert(output->attach_render_locks > 0);
|
||||
--output->attach_render_locks;
|
||||
}
|
||||
wlr_log(WLR_DEBUG, "%s direct scan-out on output '%s' (locks: %d)",
|
||||
lock ? "Disabling" : "Enabling", output->name,
|
||||
output->attach_render_locks);
|
||||
}
|
||||
|
||||
static void output_cursor_damage_whole(struct wlr_output_cursor *cursor);
|
||||
|
||||
void wlr_output_lock_software_cursors(struct wlr_output *output, bool lock) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ static void frame_destroy(struct wlr_screencopy_frame_v1 *frame) {
|
|||
if (frame == NULL) {
|
||||
return;
|
||||
}
|
||||
wlr_output_lock_attach_render(frame->output, false);
|
||||
if (frame->cursor_locked) {
|
||||
wlr_output_lock_software_cursors(frame->output, false);
|
||||
}
|
||||
|
|
@ -143,6 +144,7 @@ static void frame_handle_copy(struct wl_client *client,
|
|||
output->needs_frame = true;
|
||||
wlr_output_schedule_frame(output);
|
||||
|
||||
wlr_output_lock_attach_render(output, true);
|
||||
if (frame->overlay_cursor) {
|
||||
wlr_output_lock_software_cursors(output, true);
|
||||
frame->cursor_locked = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue