mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
wlr_output: Make wlr_output_effective_resolution take state
This commit is contained in:
parent
c3b5e710f4
commit
34ec9319d0
11 changed files with 21 additions and 15 deletions
|
|
@ -86,7 +86,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
int width, height;
|
int width, height;
|
||||||
wlr_output_effective_resolution(output->wlr_output, &width, &height);
|
wlr_output_effective_resolution(output->wlr_output, NULL, &width, &height);
|
||||||
|
|
||||||
struct wlr_output_state state;
|
struct wlr_output_state state;
|
||||||
wlr_output_state_init(&state);
|
wlr_output_state_init(&state);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
wlr_output_effective_resolution(output->wlr_output, &width, &height);
|
wlr_output_effective_resolution(output->wlr_output, NULL, &width, &height);
|
||||||
|
|
||||||
struct wlr_render_pass *pass = wlr_output_begin_render_pass(output->wlr_output, &output_state, NULL);
|
struct wlr_render_pass *pass = wlr_output_begin_render_pass(output->wlr_output, &output_state, NULL);
|
||||||
wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
|
wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
wlr_output_effective_resolution(wlr_output, &width, &height);
|
wlr_output_effective_resolution(wlr_output, NULL, &width, &height);
|
||||||
|
|
||||||
struct wlr_output_state output_state;
|
struct wlr_output_state output_state;
|
||||||
wlr_output_state_init(&output_state);
|
wlr_output_state_init(&output_state);
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
|
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
wlr_output_effective_resolution(wlr_output, &width, &height);
|
wlr_output_effective_resolution(wlr_output, NULL, &width, &height);
|
||||||
|
|
||||||
struct wlr_output_state output_state;
|
struct wlr_output_state output_state;
|
||||||
wlr_output_state_init(&output_state);
|
wlr_output_state_init(&output_state);
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output *wlr_output = sample_output->output;
|
struct wlr_output *wlr_output = sample_output->output;
|
||||||
|
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
wlr_output_effective_resolution(wlr_output, &width, &height);
|
wlr_output_effective_resolution(wlr_output, NULL, &width, &height);
|
||||||
|
|
||||||
struct wlr_output_state output_state;
|
struct wlr_output_state output_state;
|
||||||
wlr_output_state_init(&output_state);
|
wlr_output_state_init(&output_state);
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ void wlr_output_transformed_resolution(struct wlr_output *output,
|
||||||
* Computes the transformed and scaled output resolution.
|
* Computes the transformed and scaled output resolution.
|
||||||
*/
|
*/
|
||||||
void wlr_output_effective_resolution(struct wlr_output *output,
|
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||||
int *width, int *height);
|
const struct wlr_output_state *state, int *width, int *height);
|
||||||
/**
|
/**
|
||||||
* Test whether this output state would be accepted by the backend. If this
|
* Test whether this output state would be accepted by the backend. If this
|
||||||
* function returns true, wlr_output_commit_state() will only fail due to a
|
* function returns true, wlr_output_commit_state() will only fail due to a
|
||||||
|
|
|
||||||
|
|
@ -457,10 +457,16 @@ void wlr_output_transformed_resolution(struct wlr_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_effective_resolution(struct wlr_output *output,
|
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||||
int *width, int *height) {
|
const struct wlr_output_state *state, int *width, int *height) {
|
||||||
wlr_output_transformed_resolution(output, NULL, width, height);
|
wlr_output_transformed_resolution(output, state, width, height);
|
||||||
*width /= output->scale;
|
|
||||||
*height /= output->scale;
|
float scale = output->scale;
|
||||||
|
if (state && state->committed & WLR_OUTPUT_STATE_SCALE) {
|
||||||
|
scale = state->scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
*width /= scale;
|
||||||
|
*height /= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output) {
|
struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output) {
|
||||||
|
|
|
||||||
|
|
@ -445,7 +445,7 @@ static void update_node_update_outputs(struct wlr_scene_node *node,
|
||||||
.x = scene_output->x,
|
.x = scene_output->x,
|
||||||
.y = scene_output->y,
|
.y = scene_output->y,
|
||||||
};
|
};
|
||||||
wlr_output_effective_resolution(scene_output->output,
|
wlr_output_effective_resolution(scene_output->output, NULL,
|
||||||
&output_box.width, &output_box.height);
|
&output_box.width, &output_box.height);
|
||||||
|
|
||||||
pixman_region32_t intersection;
|
pixman_region32_t intersection;
|
||||||
|
|
@ -2337,7 +2337,7 @@ static void scene_output_for_each_scene_buffer(const struct wlr_box *output_box,
|
||||||
void wlr_scene_output_for_each_buffer(struct wlr_scene_output *scene_output,
|
void wlr_scene_output_for_each_buffer(struct wlr_scene_output *scene_output,
|
||||||
wlr_scene_buffer_iterator_func_t iterator, void *user_data) {
|
wlr_scene_buffer_iterator_func_t iterator, void *user_data) {
|
||||||
struct wlr_box box = { .x = scene_output->x, .y = scene_output->y };
|
struct wlr_box box = { .x = scene_output->x, .y = scene_output->y };
|
||||||
wlr_output_effective_resolution(scene_output->output,
|
wlr_output_effective_resolution(scene_output->output, NULL,
|
||||||
&box.width, &box.height);
|
&box.width, &box.height);
|
||||||
scene_output_for_each_scene_buffer(&box, &scene_output->scene->tree.node, 0, 0,
|
scene_output_for_each_scene_buffer(&box, &scene_output->scene->tree.node, 0, 0,
|
||||||
iterator, user_data);
|
iterator, user_data);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ static void output_layout_output_get_box(
|
||||||
struct wlr_box *box) {
|
struct wlr_box *box) {
|
||||||
box->x = l_output->x;
|
box->x = l_output->x;
|
||||||
box->y = l_output->y;
|
box->y = l_output->y;
|
||||||
wlr_output_effective_resolution(l_output->output,
|
wlr_output_effective_resolution(l_output->output, NULL,
|
||||||
&box->width, &box->height);
|
&box->width, &box->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -584,7 +584,7 @@ static void capture_output(struct wl_client *wl_client,
|
||||||
buffer_box.height = output->height;
|
buffer_box.height = output->height;
|
||||||
} else {
|
} else {
|
||||||
int ow, oh;
|
int ow, oh;
|
||||||
wlr_output_effective_resolution(output, &ow, &oh);
|
wlr_output_effective_resolution(output, NULL, &ow, &oh);
|
||||||
|
|
||||||
buffer_box = *box;
|
buffer_box = *box;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ static void output_update(struct wlr_xdg_output_v1 *xdg_output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
wlr_output_effective_resolution(layout_output->output, &width, &height);
|
wlr_output_effective_resolution(layout_output->output, NULL, &width, &height);
|
||||||
if (xdg_output->width != width || xdg_output->height != height) {
|
if (xdg_output->width != width || xdg_output->height != height) {
|
||||||
xdg_output->width = width;
|
xdg_output->width = width;
|
||||||
xdg_output->height = height;
|
xdg_output->height = height;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue