mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-19 06:47:02 -04:00
MR 3421 fix: wlr_mirror_v1 -> wlr_mirror
This commit is contained in:
parent
392dde7bed
commit
a6c38f82c4
5 changed files with 93 additions and 93 deletions
|
|
@ -9,14 +9,14 @@
|
|||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_keyboard.h>
|
||||
#include <wlr/types/wlr_mirror_v1.h>
|
||||
#include <wlr/types/wlr_mirror.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_pointer.h>
|
||||
#include <wlr/types/wlr_xcursor_manager.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
||||
/**
|
||||
* Demonstrates wlr_mirror_v1. Comments describe mirror specific code.
|
||||
* Demonstrates wlr_mirror. Comments describe mirror specific code.
|
||||
*
|
||||
* Mirrors the source output (src) on the destination output (dst).
|
||||
*
|
||||
|
|
@ -27,9 +27,9 @@ static const char usage[] =
|
|||
"usage: mirror <src> <dst>\n"
|
||||
" e.g. mirror eDP-1 HDMI-A-1\n"
|
||||
"keys:\n"
|
||||
" a: WLR_MIRROR_V1_SCALE_ASPECT\n"
|
||||
" f: WLR_MIRROR_V1_SCALE_FULL\n"
|
||||
" c: WLR_MIRROR_V1_SCALE_CENTER\n"
|
||||
" a: WLR_MIRROR_SCALE_ASPECT\n"
|
||||
" f: WLR_MIRROR_SCALE_FULL\n"
|
||||
" c: WLR_MIRROR_SCALE_CENTER\n"
|
||||
" esc: exit\n";
|
||||
|
||||
struct sample_state {
|
||||
|
|
@ -56,9 +56,9 @@ struct sample_state {
|
|||
struct sample_mirror {
|
||||
struct sample_state *state;
|
||||
|
||||
struct wlr_mirror_v1 *wlr_mirror;
|
||||
struct wlr_mirror *wlr_mirror;
|
||||
|
||||
struct wlr_mirror_v1_params params;
|
||||
struct wlr_mirror_params params;
|
||||
|
||||
struct wl_listener ready;
|
||||
struct wl_listener destroy;
|
||||
|
|
@ -88,7 +88,7 @@ struct sample_keyboard {
|
|||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
void start_mirror(struct sample_state *state, enum wlr_mirror_v1_scale scale);
|
||||
void start_mirror(struct sample_state *state, enum wlr_mirror_scale scale);
|
||||
void end_mirror(struct sample_state *state);
|
||||
void handle_mirror_ready(struct wl_listener *listener, void *data);
|
||||
void handle_mirror_destroy(struct wl_listener *listener, void *data);
|
||||
|
|
@ -104,7 +104,7 @@ void handle_keyboard_destroy(struct wl_listener *listener, void *data);
|
|||
void render_rects(struct wlr_renderer *renderer, struct sample_output *output, float colour[]);
|
||||
|
||||
// start a mirror session
|
||||
void start_mirror(struct sample_state *state, enum wlr_mirror_v1_scale scale) {
|
||||
void start_mirror(struct sample_state *state, enum wlr_mirror_scale scale) {
|
||||
struct sample_output *output_src = state->output_src;
|
||||
struct sample_output *output_dst = state->output_dst;
|
||||
if (!output_src || !output_dst) {
|
||||
|
|
@ -137,7 +137,7 @@ void start_mirror(struct sample_state *state, enum wlr_mirror_v1_scale scale) {
|
|||
wl_list_remove(&state->output_dst->frame.link);
|
||||
wl_list_init(&state->output_dst->frame.link);
|
||||
|
||||
struct wlr_mirror_v1 *wlr_mirror = wlr_mirror_v1_create(&mirror->params);
|
||||
struct wlr_mirror *wlr_mirror = wlr_mirror_create(&mirror->params);
|
||||
mirror->wlr_mirror = wlr_mirror;
|
||||
|
||||
// ready events enabling us to make requests for the upcoming commit
|
||||
|
|
@ -154,8 +154,8 @@ void end_mirror(struct sample_state *state) {
|
|||
wlr_log(WLR_DEBUG, "mirror end dst '%s'", state->output_dst->wlr_output->name);
|
||||
|
||||
if (state->mirror) {
|
||||
// immediately emits wlr_mirror_v1::events::destroy
|
||||
wlr_mirror_v1_destroy(state->mirror->wlr_mirror);
|
||||
// immediately emits wlr_mirror::events::destroy
|
||||
wlr_mirror_destroy(state->mirror->wlr_mirror);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ void handle_mirror_ready(struct wl_listener *listener, void *data) {
|
|||
struct sample_mirror *mirror = wl_container_of(listener, mirror, ready);
|
||||
struct sample_state *state = mirror->state;
|
||||
struct sample_output *output_src = state->output_src;
|
||||
struct wlr_mirror_v1 *wlr_mirror = state->mirror->wlr_mirror;
|
||||
struct wlr_mirror *wlr_mirror = state->mirror->wlr_mirror;
|
||||
struct wlr_output *wlr_output = data;
|
||||
|
||||
// only request for src
|
||||
|
|
@ -180,7 +180,7 @@ void handle_mirror_ready(struct wl_listener *listener, void *data) {
|
|||
mirror->last_request = now;
|
||||
|
||||
// request a portion of src
|
||||
wlr_mirror_v1_request_box(wlr_mirror, wlr_output, mirror->box);
|
||||
wlr_mirror_request_box(wlr_mirror, wlr_output, mirror->box);
|
||||
|
||||
if ((mirror->box.x + mirror->box.width + mirror->dx) > output_src->width) {
|
||||
mirror->dx = -1;
|
||||
|
|
@ -301,7 +301,7 @@ void handle_keyboard_key(struct wl_listener *listener, void *data) {
|
|||
const xkb_keysym_t *syms;
|
||||
int nsyms = xkb_state_key_get_syms(keyboard->device->keyboard->xkb_state, keycode, &syms);
|
||||
bool start_end_mirror = false;
|
||||
enum wlr_mirror_v1_scale scale;
|
||||
enum wlr_mirror_scale scale;
|
||||
|
||||
for (int i = 0; i < nsyms; i++) {
|
||||
xkb_keysym_t sym = syms[i];
|
||||
|
|
@ -311,15 +311,15 @@ void handle_keyboard_key(struct wl_listener *listener, void *data) {
|
|||
wl_display_terminate(state->display);
|
||||
break;
|
||||
case XKB_KEY_f:
|
||||
scale = WLR_MIRROR_V1_SCALE_FULL;
|
||||
scale = WLR_MIRROR_SCALE_FULL;
|
||||
start_end_mirror = true;
|
||||
break;
|
||||
case XKB_KEY_a:
|
||||
scale = WLR_MIRROR_V1_SCALE_ASPECT;
|
||||
scale = WLR_MIRROR_SCALE_ASPECT;
|
||||
start_end_mirror = true;
|
||||
break;
|
||||
case XKB_KEY_c:
|
||||
scale = WLR_MIRROR_V1_SCALE_CENTER;
|
||||
scale = WLR_MIRROR_SCALE_CENTER;
|
||||
start_end_mirror = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
||||
#endif
|
||||
|
||||
#ifndef WLR_TYPES_wlr_mirror_v1_V1_H
|
||||
#define WLR_TYPES_wlr_mirror_v1_V1_H
|
||||
#ifndef WLR_TYPES_WLR_MIRROR_H
|
||||
#define WLR_TYPES_WLR_MIRROR_H
|
||||
|
||||
#include <wayland-client-protocol.h>
|
||||
#include <wayland-server-core.h>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
* Allows mirroring: rendering some contents of one output (the src) on another
|
||||
* output (the dst). dst is fixed for the duration of the session, src may vary.
|
||||
*
|
||||
* On output_srcs precommit, wlr_mirror_v1::ready is emitted. The compositor may
|
||||
* call wlr_mirror_v1_request_ to request to render a frame on dst.
|
||||
* On output_srcs precommit, wlr_mirror::ready is emitted. The compositor may
|
||||
* call wlr_mirror_request_ to request to render a frame on dst.
|
||||
*
|
||||
* Compositor must not render on dst for the duration of the session.
|
||||
*
|
||||
|
|
@ -26,32 +26,32 @@
|
|||
*
|
||||
* Session will end:
|
||||
* disable/destroy of dst or all srcs
|
||||
* wlr_mirror_v1_request_box called with box outside of src
|
||||
* wlr_mirror_v1_destroy
|
||||
* wlr_mirror_request_box called with box outside of src
|
||||
* wlr_mirror_destroy
|
||||
*/
|
||||
|
||||
enum wlr_mirror_v1_scale {
|
||||
enum wlr_mirror_scale {
|
||||
/**
|
||||
* src will be stretched to cover dst, distorting if necessary.
|
||||
*/
|
||||
WLR_MIRROR_V1_SCALE_FULL,
|
||||
WLR_MIRROR_SCALE_FULL,
|
||||
/**
|
||||
* src will be stretched to the width or the height of dst, preserving the
|
||||
* aspect ratio.
|
||||
*/
|
||||
WLR_MIRROR_V1_SCALE_ASPECT,
|
||||
WLR_MIRROR_SCALE_ASPECT,
|
||||
/**
|
||||
* src will be rendered 1:1 at the center of dst. Content may be lost.
|
||||
*/
|
||||
WLR_MIRROR_V1_SCALE_CENTER,
|
||||
WLR_MIRROR_SCALE_CENTER,
|
||||
};
|
||||
|
||||
/**
|
||||
* Immutable over session.
|
||||
*/
|
||||
struct wlr_mirror_v1_params {
|
||||
struct wlr_mirror_params {
|
||||
|
||||
enum wlr_mirror_v1_scale scale;
|
||||
enum wlr_mirror_scale scale;
|
||||
|
||||
/**
|
||||
* Render the src cursor on dst.
|
||||
|
|
@ -59,7 +59,7 @@ struct wlr_mirror_v1_params {
|
|||
bool overlay_cursor;
|
||||
|
||||
/**
|
||||
* srcs to send wlr_mirror_v1::events::ready
|
||||
* srcs to send wlr_mirror::events::ready
|
||||
*/
|
||||
struct wl_array output_srcs;
|
||||
|
||||
|
|
@ -69,12 +69,12 @@ struct wlr_mirror_v1_params {
|
|||
struct wlr_output *output_dst;
|
||||
};
|
||||
|
||||
struct wlr_mirror_v1_state;
|
||||
struct wlr_mirror_v1 {
|
||||
struct wlr_mirror_state;
|
||||
struct wlr_mirror {
|
||||
|
||||
struct {
|
||||
/**
|
||||
* Ready to render a frame. Handler should call wlr_mirror_v1_request_
|
||||
* Ready to render a frame. Handler should call wlr_mirror_request_
|
||||
* Emitted at precommit, passes potential src.
|
||||
*/
|
||||
struct wl_signal ready;
|
||||
|
|
@ -86,7 +86,7 @@ struct wlr_mirror_v1 {
|
|||
} events;
|
||||
|
||||
// private state
|
||||
struct wlr_mirror_v1_state *state;
|
||||
struct wlr_mirror_state *state;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -94,29 +94,29 @@ struct wlr_mirror_v1 {
|
|||
*
|
||||
* Compositor must stop rendering on dst immediately after this.
|
||||
*/
|
||||
struct wlr_mirror_v1 *wlr_mirror_v1_create(struct wlr_mirror_v1_params *params);
|
||||
struct wlr_mirror *wlr_mirror_create(struct wlr_mirror_params *params);
|
||||
|
||||
/**
|
||||
* Destroy a mirror session.
|
||||
*
|
||||
* Compositor may resume rendering on dst.
|
||||
*/
|
||||
void wlr_mirror_v1_destroy(struct wlr_mirror_v1 *mirror);
|
||||
void wlr_mirror_destroy(struct wlr_mirror *mirror);
|
||||
|
||||
/**
|
||||
* Request a blank frame on dst.
|
||||
*
|
||||
* Should be invoked during the wlr_mirror_v1::events::ready handler.
|
||||
* Should be invoked during the wlr_mirror::events::ready handler.
|
||||
*/
|
||||
void wlr_mirror_v1_request_blank(struct wlr_mirror_v1 *mirror);
|
||||
void wlr_mirror_request_blank(struct wlr_mirror *mirror);
|
||||
|
||||
/**
|
||||
* Request a frame to render a box within src on dst. box is in output local
|
||||
* coordinates, with respect to its transformation.
|
||||
*
|
||||
* Should be invoked during the wlr_mirror_v1::events::ready handler.
|
||||
* Should be invoked during the wlr_mirror::events::ready handler.
|
||||
*/
|
||||
void wlr_mirror_v1_request_box(struct wlr_mirror_v1 *mirror,
|
||||
void wlr_mirror_request_box(struct wlr_mirror *mirror,
|
||||
struct wlr_output *output_src, struct wlr_box box);
|
||||
|
||||
#endif
|
||||
|
|
@ -151,7 +151,7 @@ struct wlr_output {
|
|||
// Commit sequence number. Incremented on each commit, may overflow.
|
||||
uint32_t commit_seq;
|
||||
|
||||
// dst for an active wlr_mirror_v1 session
|
||||
// dst for an active wlr_mirror session
|
||||
bool mirror_dst;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ wlr_files += files(
|
|||
'wlr_layer_shell_v1.c',
|
||||
'wlr_linux_dmabuf_v1.c',
|
||||
'wlr_matrix.c',
|
||||
'wlr_mirror_v1.c',
|
||||
'wlr_mirror.c',
|
||||
'wlr_output_damage.c',
|
||||
'wlr_output_layout.c',
|
||||
'wlr_output_management_v1.c',
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
#include <wlr/types/wlr_matrix.h>
|
||||
#include <wlr/types/wlr_mirror_v1.h>
|
||||
#include <wlr/types/wlr_mirror.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include <util/signal.h>
|
||||
|
||||
struct wlr_mirror_v1_output_src {
|
||||
struct wlr_mirror_output_src {
|
||||
struct wl_list link;
|
||||
|
||||
struct wlr_mirror_v1_state *state;
|
||||
struct wlr_mirror_state *state;
|
||||
|
||||
struct wlr_output *output;
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ struct wlr_mirror_v1_output_src {
|
|||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
struct wlr_mirror_v1_stats {
|
||||
struct wlr_mirror_stats {
|
||||
long requested_boxes;
|
||||
long rendered_boxes;
|
||||
|
||||
|
|
@ -36,23 +36,23 @@ struct wlr_mirror_v1_stats {
|
|||
/**
|
||||
* All immutable during session, except noted.
|
||||
*/
|
||||
struct wlr_mirror_v1_state {
|
||||
struct wlr_mirror_v1 *mirror;
|
||||
struct wlr_mirror_state {
|
||||
struct wlr_mirror *mirror;
|
||||
|
||||
struct wlr_mirror_v1_params params;
|
||||
struct wlr_mirror_params params;
|
||||
|
||||
struct wlr_output *output_src; // mutable
|
||||
struct wlr_output *output_dst;
|
||||
|
||||
struct wl_list m_output_srcs; // wlr_mirror_v1_output_src::link
|
||||
struct wl_list m_output_srcs; // wlr_mirror_output_src::link
|
||||
|
||||
struct wlr_texture *texture; // mutable
|
||||
struct wlr_box box_src; // mutable
|
||||
bool needs_blank; // mutable
|
||||
bool cursor_locked; // mutable
|
||||
|
||||
// events (ready) may result in a call to wlr_mirror_v1_destroy.
|
||||
// During emission, wlr_mirror_v1_destroy will not free mirror (specifically
|
||||
// events (ready) may result in a call to wlr_mirror_destroy.
|
||||
// During emission, wlr_mirror_destroy will not free mirror (specifically
|
||||
// the wl_signal) and state.
|
||||
// mirror and state will be free'd after wlr_signal_emit_safe is complete
|
||||
// and has cleaned up the signal's list.
|
||||
|
|
@ -62,7 +62,7 @@ struct wlr_mirror_v1_state {
|
|||
struct wl_listener output_dst_frame;
|
||||
struct wl_listener output_dst_destroy;
|
||||
|
||||
struct wlr_mirror_v1_stats stats;
|
||||
struct wlr_mirror_stats stats;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -129,7 +129,7 @@ static void calculate_absolute_box(struct wlr_box *absolute,
|
|||
* to dst.
|
||||
*/
|
||||
static void calculate_dst_box(struct wlr_fbox *box_dst,
|
||||
enum wlr_mirror_v1_scale scale_method,
|
||||
enum wlr_mirror_scale scale_method,
|
||||
enum wl_output_transform transform_src,
|
||||
enum wl_output_transform transform_dst,
|
||||
int32_t width_src, int32_t height_src,
|
||||
|
|
@ -145,13 +145,13 @@ static void calculate_dst_box(struct wlr_fbox *box_dst,
|
|||
rotate_v_h(&width_dst_rotated, &height_dst_rotated, transform_dst, width_dst, height_dst);
|
||||
|
||||
switch (scale_method) {
|
||||
case WLR_MIRROR_V1_SCALE_CENTER:
|
||||
case WLR_MIRROR_SCALE_CENTER:
|
||||
box_dst->width = width_src;
|
||||
box_dst->height = height_src;
|
||||
box_dst->x = (((float) width_dst_rotated) - width_src_rotated) / 2;
|
||||
box_dst->y = (((float) height_dst_rotated) - height_src_rotated) / 2;
|
||||
break;
|
||||
case WLR_MIRROR_V1_SCALE_ASPECT:
|
||||
case WLR_MIRROR_SCALE_ASPECT:
|
||||
if (width_dst_rotated * height_src_rotated > height_dst_rotated * width_src_rotated) {
|
||||
// expand to dst height
|
||||
width_scaled = ((float) width_src_rotated) * height_dst_rotated / height_src_rotated;
|
||||
|
|
@ -171,7 +171,7 @@ static void calculate_dst_box(struct wlr_fbox *box_dst,
|
|||
box_dst->x = (((float) width_dst_rotated) - width_scaled) / 2;
|
||||
box_dst->y = (((float) height_dst_rotated) - height_scaled) / 2;
|
||||
break;
|
||||
case WLR_MIRROR_V1_SCALE_FULL:
|
||||
case WLR_MIRROR_SCALE_FULL:
|
||||
default:
|
||||
if (src_rotated) {
|
||||
box_dst->width = height_dst_rotated;
|
||||
|
|
@ -213,7 +213,7 @@ static void calculate_render_matrix(float mat[static 9], struct wlr_fbox *box_ds
|
|||
wlr_matrix_multiply(mat, output_dst->transform_matrix, mat);
|
||||
}
|
||||
|
||||
static void schedule_frame_dst(struct wlr_mirror_v1_state *state) {
|
||||
static void schedule_frame_dst(struct wlr_mirror_state *state) {
|
||||
|
||||
wlr_output_schedule_frame(state->output_dst);
|
||||
|
||||
|
|
@ -223,10 +223,10 @@ static void schedule_frame_dst(struct wlr_mirror_v1_state *state) {
|
|||
|
||||
/**
|
||||
* Remove all listeners for a src and remove it from state::m_output_srcs
|
||||
* Invoke wlr_mirror_v1_destroy if no other srcs remain.
|
||||
* Invoke wlr_mirror_destroy if no other srcs remain.
|
||||
*/
|
||||
static void remove_output_src(struct wlr_mirror_v1_output_src *src) {
|
||||
struct wlr_mirror_v1_state *state = src->state;
|
||||
static void remove_output_src(struct wlr_mirror_output_src *src) {
|
||||
struct wlr_mirror_state *state = src->state;
|
||||
|
||||
wl_list_remove(&src->commit.link);
|
||||
wl_list_remove(&src->enable.link);
|
||||
|
|
@ -236,7 +236,7 @@ static void remove_output_src(struct wlr_mirror_v1_output_src *src) {
|
|||
free(src);
|
||||
|
||||
if (wl_list_length(&state->m_output_srcs) == 0) {
|
||||
wlr_mirror_v1_destroy(state->mirror);
|
||||
wlr_mirror_destroy(state->mirror);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -249,10 +249,10 @@ static void remove_output_src(struct wlr_mirror_v1_output_src *src) {
|
|||
*/
|
||||
|
||||
static void output_src_handle_precommit(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_output_src *m_output_src =
|
||||
struct wlr_mirror_output_src *m_output_src =
|
||||
wl_container_of(listener, m_output_src, precommit);
|
||||
struct wlr_mirror_v1_state *state = m_output_src->state;
|
||||
struct wlr_mirror_v1 *mirror = state->mirror;
|
||||
struct wlr_mirror_state *state = m_output_src->state;
|
||||
struct wlr_mirror *mirror = state->mirror;
|
||||
|
||||
state->signal_emitting = true;
|
||||
wlr_signal_emit_safe(&mirror->events.ready, m_output_src->output);
|
||||
|
|
@ -264,8 +264,8 @@ static void output_src_handle_precommit(struct wl_listener *listener, void *data
|
|||
}
|
||||
|
||||
static void output_src_handle_commit(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_output_src *m_output_src = wl_container_of(listener, m_output_src, commit);
|
||||
struct wlr_mirror_v1_state *state = m_output_src->state;
|
||||
struct wlr_mirror_output_src *m_output_src = wl_container_of(listener, m_output_src, commit);
|
||||
struct wlr_mirror_state *state = m_output_src->state;
|
||||
struct wlr_output *output_src = m_output_src->output;
|
||||
struct wlr_output_event_commit *event = data;
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ static void output_src_handle_commit(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
static void output_dst_handle_frame(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_state *state = wl_container_of(listener, state, output_dst_frame);
|
||||
struct wlr_mirror_state *state = wl_container_of(listener, state, output_dst_frame);
|
||||
|
||||
wl_list_remove(&state->output_dst_frame.link);
|
||||
wl_list_init(&state->output_dst_frame.link);
|
||||
|
|
@ -367,7 +367,7 @@ static void output_dst_handle_frame(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
static void output_src_handle_enable(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_output_src *src = wl_container_of(listener, src, enable);
|
||||
struct wlr_mirror_output_src *src = wl_container_of(listener, src, enable);
|
||||
|
||||
if (!src->output->enabled) {
|
||||
wlr_log(WLR_DEBUG, "Mirror src '%s' disabled", src->output->name);
|
||||
|
|
@ -376,7 +376,7 @@ static void output_src_handle_enable(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
static void output_src_handle_destroy(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_output_src *src = wl_container_of(listener, src, destroy);
|
||||
struct wlr_mirror_output_src *src = wl_container_of(listener, src, destroy);
|
||||
|
||||
wlr_log(WLR_DEBUG, "Mirror src '%s' destroyed", src->output->name);
|
||||
|
||||
|
|
@ -384,22 +384,22 @@ static void output_src_handle_destroy(struct wl_listener *listener, void *data)
|
|||
}
|
||||
|
||||
static void output_dst_handle_enable(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_state *state = wl_container_of(listener, state, output_dst_enable);
|
||||
struct wlr_mirror_v1 *mirror = state->mirror;
|
||||
struct wlr_mirror_state *state = wl_container_of(listener, state, output_dst_enable);
|
||||
struct wlr_mirror *mirror = state->mirror;
|
||||
|
||||
if (!state->output_dst->enabled) {
|
||||
wlr_log(WLR_DEBUG, "Mirror dst '%s' disabled", state->output_dst->name);
|
||||
wlr_mirror_v1_destroy(mirror);
|
||||
wlr_mirror_destroy(mirror);
|
||||
}
|
||||
}
|
||||
|
||||
static void output_dst_handle_destroy(struct wl_listener *listener, void *data) {
|
||||
struct wlr_mirror_v1_state *state = wl_container_of(listener, state, output_dst_destroy);
|
||||
struct wlr_mirror_v1 *mirror = state->mirror;
|
||||
struct wlr_mirror_state *state = wl_container_of(listener, state, output_dst_destroy);
|
||||
struct wlr_mirror *mirror = state->mirror;
|
||||
|
||||
wlr_log(WLR_DEBUG, "Mirror dst '%s' destroyed", state->output_dst->name);
|
||||
|
||||
wlr_mirror_v1_destroy(mirror);
|
||||
wlr_mirror_destroy(mirror);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -410,7 +410,7 @@ static void output_dst_handle_destroy(struct wl_listener *listener, void *data)
|
|||
* BEGIN public functions
|
||||
*/
|
||||
|
||||
struct wlr_mirror_v1 *wlr_mirror_v1_create(struct wlr_mirror_v1_params *params) {
|
||||
struct wlr_mirror *wlr_mirror_create(struct wlr_mirror_params *params) {
|
||||
if (!params->output_dst->enabled) {
|
||||
wlr_log(WLR_ERROR, "Mirror dst '%s' not enabled", params->output_dst->name);
|
||||
return NULL;
|
||||
|
|
@ -428,9 +428,9 @@ struct wlr_mirror_v1 *wlr_mirror_v1_create(struct wlr_mirror_v1_params *params)
|
|||
}
|
||||
}
|
||||
|
||||
struct wlr_mirror_v1 *mirror = calloc(1, sizeof(struct wlr_mirror_v1));
|
||||
mirror->state = calloc(1, sizeof(struct wlr_mirror_v1_state));
|
||||
struct wlr_mirror_v1_state *state = mirror->state;
|
||||
struct wlr_mirror *mirror = calloc(1, sizeof(struct wlr_mirror));
|
||||
mirror->state = calloc(1, sizeof(struct wlr_mirror_state));
|
||||
struct wlr_mirror_state *state = mirror->state;
|
||||
state->mirror = mirror;
|
||||
state->output_dst = params->output_dst;
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ struct wlr_mirror_v1 *wlr_mirror_v1_create(struct wlr_mirror_v1_params *params)
|
|||
wl_signal_init(&mirror->events.destroy);
|
||||
|
||||
// clone params
|
||||
memcpy(&state->params, params, sizeof(struct wlr_mirror_v1_params));
|
||||
memcpy(&state->params, params, sizeof(struct wlr_mirror_params));
|
||||
wl_array_init(&state->params.output_srcs);
|
||||
wl_array_copy(&state->params.output_srcs, ¶ms->output_srcs);
|
||||
|
||||
|
|
@ -459,8 +459,8 @@ struct wlr_mirror_v1 *wlr_mirror_v1_create(struct wlr_mirror_v1_params *params)
|
|||
|
||||
// srcs events
|
||||
wl_array_for_each(output_src_ptr, &state->params.output_srcs) {
|
||||
struct wlr_mirror_v1_output_src *m_output_src =
|
||||
calloc(1, sizeof(struct wlr_mirror_v1_output_src));
|
||||
struct wlr_mirror_output_src *m_output_src =
|
||||
calloc(1, sizeof(struct wlr_mirror_output_src));
|
||||
wl_list_insert(state->m_output_srcs.prev, &m_output_src->link);
|
||||
|
||||
m_output_src->state = state;
|
||||
|
|
@ -492,11 +492,11 @@ struct wlr_mirror_v1 *wlr_mirror_v1_create(struct wlr_mirror_v1_params *params)
|
|||
return mirror;
|
||||
}
|
||||
|
||||
void wlr_mirror_v1_destroy(struct wlr_mirror_v1 *mirror) {
|
||||
void wlr_mirror_destroy(struct wlr_mirror *mirror) {
|
||||
if (!mirror) {
|
||||
return;
|
||||
}
|
||||
struct wlr_mirror_v1_state *state = mirror->state;
|
||||
struct wlr_mirror_state *state = mirror->state;
|
||||
|
||||
wlr_log(WLR_DEBUG, "Mirror destroying dst '%s': "
|
||||
"requested_boxes:%ld, rendered_boxes:%ld, "
|
||||
|
|
@ -515,7 +515,7 @@ void wlr_mirror_v1_destroy(struct wlr_mirror_v1 *mirror) {
|
|||
wl_list_remove(&state->output_dst_destroy.link);
|
||||
|
||||
// all src output events
|
||||
struct wlr_mirror_v1_output_src *src, *next;
|
||||
struct wlr_mirror_output_src *src, *next;
|
||||
wl_list_for_each_safe(src, next, &state->m_output_srcs, link) {
|
||||
wl_list_remove(&src->commit.link);
|
||||
wl_list_remove(&src->enable.link);
|
||||
|
|
@ -546,8 +546,8 @@ void wlr_mirror_v1_destroy(struct wlr_mirror_v1 *mirror) {
|
|||
}
|
||||
}
|
||||
|
||||
void wlr_mirror_v1_request_blank(struct wlr_mirror_v1 *mirror) {
|
||||
struct wlr_mirror_v1_state *state = mirror->state;
|
||||
void wlr_mirror_request_blank(struct wlr_mirror *mirror) {
|
||||
struct wlr_mirror_state *state = mirror->state;
|
||||
|
||||
state->needs_blank = true;
|
||||
|
||||
|
|
@ -556,9 +556,9 @@ void wlr_mirror_v1_request_blank(struct wlr_mirror_v1 *mirror) {
|
|||
mirror->state->stats.requested_blanks++;
|
||||
}
|
||||
|
||||
void wlr_mirror_v1_request_box(struct wlr_mirror_v1 *mirror,
|
||||
void wlr_mirror_request_box(struct wlr_mirror *mirror,
|
||||
struct wlr_output *output_src, struct wlr_box box) {
|
||||
struct wlr_mirror_v1_state *state = mirror->state;
|
||||
struct wlr_mirror_state *state = mirror->state;
|
||||
|
||||
state->needs_blank = false;
|
||||
|
||||
|
|
@ -567,12 +567,12 @@ void wlr_mirror_v1_request_box(struct wlr_mirror_v1 *mirror,
|
|||
wlr_output_transformed_resolution(output_src, &box_output.width, &box_output.height);
|
||||
if (!wlr_box_intersection(&state->box_src, &box_output, &box)) {
|
||||
wlr_log(WLR_ERROR, "Mirror box not within src, ending session.");
|
||||
wlr_mirror_v1_destroy(mirror);
|
||||
wlr_mirror_destroy(mirror);
|
||||
return;
|
||||
}
|
||||
|
||||
// listen for a commit on the specified output only
|
||||
struct wlr_mirror_v1_output_src *m_output_src;
|
||||
struct wlr_mirror_output_src *m_output_src;
|
||||
wl_list_for_each(m_output_src, &state->m_output_srcs, link) {
|
||||
if (m_output_src->output == output_src) {
|
||||
wl_list_remove(&m_output_src->commit.link);
|
||||
Loading…
Add table
Add a link
Reference in a new issue