mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
WLR MR 3421 fix: wlr_mirror_v1 -> wlr_mirror
This commit is contained in:
parent
d39d8180c8
commit
494388bcd2
4 changed files with 19 additions and 19 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef _SWAY_MIRROR_H
|
#ifndef _SWAY_MIRROR_H
|
||||||
#define _SWAY_MIRROR_H
|
#define _SWAY_MIRROR_H
|
||||||
|
|
||||||
#include <wlr/types/wlr_mirror_v1.h>
|
#include <wlr/types/wlr_mirror.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
* Allows mirroring: rendering some contents of one output (the src) on another
|
* 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.
|
* output (the dst). dst is fixed for the duration of the session, src may vary.
|
||||||
*
|
*
|
||||||
* See wlr_mirror_v1.h for full details.
|
* See wlr_mirror.h for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum sway_mirror_flavour {
|
enum sway_mirror_flavour {
|
||||||
|
|
@ -35,7 +35,7 @@ enum sway_mirror_flavour {
|
||||||
*/
|
*/
|
||||||
struct sway_mirror_params {
|
struct sway_mirror_params {
|
||||||
|
|
||||||
struct wlr_mirror_v1_params wlr_params;
|
struct wlr_mirror_params wlr_params;
|
||||||
|
|
||||||
enum sway_mirror_flavour flavour;
|
enum sway_mirror_flavour flavour;
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ struct sway_mirror {
|
||||||
*/
|
*/
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
|
|
||||||
struct wlr_mirror_v1 *wlr_mirror_v1;
|
struct wlr_mirror *wlr_mirror;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
#include <wlr/types/wlr_drm_lease_v1.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
#include <wlr/types/wlr_mirror_v1.h>
|
#include <wlr/types/wlr_mirror.h>
|
||||||
#include <wlr/types/wlr_output_management_v1.h>
|
#include <wlr/types/wlr_output_management_v1.h>
|
||||||
#include <wlr/types/wlr_output_power_management_v1.h>
|
#include <wlr/types/wlr_output_power_management_v1.h>
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
#include <wlr/types/wlr_presentation_time.h>
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,11 @@ bool build_dst_params(struct sway_mirror_params *params, char *dst_name_or_id,
|
||||||
"Invalid scale.");
|
"Invalid scale.");
|
||||||
return false;
|
return false;
|
||||||
} else if (strcmp(scale_str, "full") == 0) {
|
} else if (strcmp(scale_str, "full") == 0) {
|
||||||
params->wlr_params.scale = WLR_MIRROR_V1_SCALE_FULL;
|
params->wlr_params.scale = WLR_MIRROR_SCALE_FULL;
|
||||||
} else if (strcmp(scale_str, "aspect") == 0) {
|
} else if (strcmp(scale_str, "aspect") == 0) {
|
||||||
params->wlr_params.scale = WLR_MIRROR_V1_SCALE_ASPECT;
|
params->wlr_params.scale = WLR_MIRROR_SCALE_ASPECT;
|
||||||
} else if (strcmp(scale_str, "center") == 0) {
|
} else if (strcmp(scale_str, "center") == 0) {
|
||||||
params->wlr_params.scale = WLR_MIRROR_V1_SCALE_CENTER;
|
params->wlr_params.scale = WLR_MIRROR_SCALE_CENTER;
|
||||||
} else {
|
} else {
|
||||||
snprintf(params_failure_message, sizeof(params_failure_message),
|
snprintf(params_failure_message, sizeof(params_failure_message),
|
||||||
"Invalid scale '%s', expected <full|aspect|center>.", scale_str);
|
"Invalid scale '%s', expected <full|aspect|center>.", scale_str);
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ static void handle_ready_entire(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_box box_output = { 0 };
|
struct wlr_box box_output = { 0 };
|
||||||
wlr_output_transformed_resolution(output, &box_output.width, &box_output.height);
|
wlr_output_transformed_resolution(output, &box_output.width, &box_output.height);
|
||||||
|
|
||||||
wlr_mirror_v1_request_box(mirror->wlr_mirror_v1, output, box_output);
|
wlr_mirror_request_box(mirror->wlr_mirror, output, box_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_ready_box(struct wl_listener *listener, void *data) {
|
static void handle_ready_box(struct wl_listener *listener, void *data) {
|
||||||
|
|
@ -88,7 +88,7 @@ static void handle_ready_box(struct wl_listener *listener, void *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_mirror_v1_request_box(mirror->wlr_mirror_v1, output, mirror->params.box);
|
wlr_mirror_request_box(mirror->wlr_mirror, output, mirror->params.box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_ready_container(struct wl_listener *listener, void *data) {
|
static void handle_ready_container(struct wl_listener *listener, void *data) {
|
||||||
|
|
@ -99,14 +99,14 @@ static void handle_ready_container(struct wl_listener *listener, void *data) {
|
||||||
struct sway_container *container = root_find_container(test_con_id, &mirror->params.con_id);
|
struct sway_container *container = root_find_container(test_con_id, &mirror->params.con_id);
|
||||||
if (!container) {
|
if (!container) {
|
||||||
sway_log(SWAY_DEBUG, "Mirror container %ld destroyed, stopping", mirror->params.con_id);
|
sway_log(SWAY_DEBUG, "Mirror container %ld destroyed, stopping", mirror->params.con_id);
|
||||||
wlr_mirror_v1_destroy(mirror->wlr_mirror_v1);
|
wlr_mirror_destroy(mirror->wlr_mirror);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the container visible?
|
// is the container visible?
|
||||||
struct sway_view *view = container->view;
|
struct sway_view *view = container->view;
|
||||||
if (!view_is_visible(view)) {
|
if (!view_is_visible(view)) {
|
||||||
wlr_mirror_v1_request_blank(mirror->wlr_mirror_v1);
|
wlr_mirror_request_blank(mirror->wlr_mirror);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ static void handle_ready_container(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_box box_src_intersected;
|
struct wlr_box box_src_intersected;
|
||||||
wlr_box_intersection(&box_src_intersected, &view->last_destination, &box_output);
|
wlr_box_intersection(&box_src_intersected, &view->last_destination, &box_output);
|
||||||
|
|
||||||
wlr_mirror_v1_request_box(mirror->wlr_mirror_v1, output, box_src_intersected);
|
wlr_mirror_request_box(mirror->wlr_mirror, output, box_src_intersected);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
@ -167,7 +167,7 @@ bool mirror_create(struct sway_mirror_params *params) {
|
||||||
struct sway_mirror *mirror = calloc(1, sizeof(struct sway_mirror));
|
struct sway_mirror *mirror = calloc(1, sizeof(struct sway_mirror));
|
||||||
|
|
||||||
memcpy(&mirror->params, params, sizeof(struct sway_mirror_params));
|
memcpy(&mirror->params, params, sizeof(struct sway_mirror_params));
|
||||||
struct wlr_mirror_v1_params *wlr_params = &mirror->params.wlr_params;
|
struct wlr_mirror_params *wlr_params = &mirror->params.wlr_params;
|
||||||
wl_array_init(&wlr_params->output_srcs);
|
wl_array_init(&wlr_params->output_srcs);
|
||||||
|
|
||||||
switch (mirror->params.flavour) {
|
switch (mirror->params.flavour) {
|
||||||
|
|
@ -211,18 +211,18 @@ bool mirror_create(struct sway_mirror_params *params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the session
|
// start the session
|
||||||
mirror->wlr_mirror_v1 = wlr_mirror_v1_create(&mirror->params.wlr_params);
|
mirror->wlr_mirror = wlr_mirror_create(&mirror->params.wlr_params);
|
||||||
if (!mirror->wlr_mirror_v1) {
|
if (!mirror->wlr_mirror) {
|
||||||
goto error_create;
|
goto error_create;
|
||||||
}
|
}
|
||||||
|
|
||||||
vacate_output(output_dst);
|
vacate_output(output_dst);
|
||||||
|
|
||||||
// ready events from all srcs
|
// ready events from all srcs
|
||||||
wl_signal_add(&mirror->wlr_mirror_v1->events.ready, &mirror->ready);
|
wl_signal_add(&mirror->wlr_mirror->events.ready, &mirror->ready);
|
||||||
|
|
||||||
// mirror session end
|
// mirror session end
|
||||||
wl_signal_add(&mirror->wlr_mirror_v1->events.destroy, &mirror->destroy);
|
wl_signal_add(&mirror->wlr_mirror->events.destroy, &mirror->destroy);
|
||||||
mirror->destroy.notify = handle_destroy;
|
mirror->destroy.notify = handle_destroy;
|
||||||
|
|
||||||
// add to the global server list
|
// add to the global server list
|
||||||
|
|
@ -243,7 +243,7 @@ void mirror_destroy(struct sway_mirror *mirror) {
|
||||||
}
|
}
|
||||||
sway_log(SWAY_DEBUG, "Mirror destroying dst '%s'", mirror->params.wlr_params.output_dst->name);
|
sway_log(SWAY_DEBUG, "Mirror destroying dst '%s'", mirror->params.wlr_params.output_dst->name);
|
||||||
|
|
||||||
wlr_mirror_v1_destroy(mirror->wlr_mirror_v1);
|
wlr_mirror_destroy(mirror->wlr_mirror);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mirror_destroy_all() {
|
void mirror_destroy_all() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue