From aef2da675b91418a3b602064ff44b1f9efe42845 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 7 Feb 2022 10:13:01 -0600 Subject: [PATCH] libweston: Convert weston_output_move to weston_coord Signed-off-by: Derek Foreman --- compositor/main.c | 4 +++- include/libweston/libweston.h | 3 ++- libweston/compositor.c | 27 +++++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/compositor/main.c b/compositor/main.c index 00525d8d..e8ed3835 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -3103,6 +3103,7 @@ rdp_handle_layout(struct weston_compositor *ec) int scale = 1; while ((head = weston_compositor_iterate_heads(ec, head))) { + struct weston_coord_global pos; struct weston_output *output = head->output; struct weston_mode new_mode = {}; @@ -3133,7 +3134,8 @@ rdp_handle_layout(struct weston_compositor *ec) weston_output_set_scale(output, scale); weston_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); - weston_output_move(output, config.x, config.y); + pos.c = weston_coord(config.x, config.y); + weston_output_move(output, pos); } } diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 50d30aef..eabd1634 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -2343,7 +2343,8 @@ weston_output_init(struct weston_output *output, const char *name); void -weston_output_move(struct weston_output *output, int x, int y); +weston_output_move(struct weston_output *output, + struct weston_coord_global pos); int weston_output_enable(struct weston_output *output); diff --git a/libweston/compositor.c b/libweston/compositor.c index 5aa63197..8f077bb4 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -6273,7 +6273,8 @@ weston_head_get_destroy_listener(struct weston_head *head, } static void -weston_output_set_position(struct weston_output *output, int x, int y); +weston_output_set_position(struct weston_output *output, + struct weston_coord_global pos); /* Move other outputs when one is resized so the space remains contiguous. */ static void @@ -6296,7 +6297,11 @@ weston_compositor_reflow_outputs(struct weston_compositor *compositor, } if (start_resizing) { - weston_output_set_position(output, output->x + delta_width, output->y); + struct weston_coord_global pos; + + pos.c = weston_coord(output->x + delta_width, + output->y); + weston_output_set_position(output, pos); } } } @@ -6364,25 +6369,26 @@ weston_output_init_geometry(struct weston_output *output, int x, int y) * \ingroup output */ static void -weston_output_set_position(struct weston_output *output, int x, int y) +weston_output_set_position(struct weston_output *output, + struct weston_coord_global pos) { struct weston_head *head; struct wl_resource *resource; int ver; if (!output->enabled) { - output->x = x; - output->y = y; + output->x = pos.c.x; + output->y = pos.c.y; return; } - output->move_x = x - output->x; - output->move_y = y - output->y; + output->move_x = pos.c.x - output->x; + output->move_y = pos.c.y - output->y; if (output->move_x == 0 && output->move_y == 0) return; - weston_output_init_geometry(output, x, y); + weston_output_init_geometry(output, pos.c.x, pos.c.y); weston_output_update_matrix(output); @@ -6420,7 +6426,8 @@ weston_output_set_position(struct weston_output *output, int x, int y) * \ingroup output */ WL_EXPORT void -weston_output_move(struct weston_output *output, int x, int y) +weston_output_move(struct weston_output *output, + struct weston_coord_global pos) { /* XXX: we should probably perform some sanity checking here * as we do for weston_output_enable, and allow moves to fail. @@ -6435,7 +6442,7 @@ weston_output_move(struct weston_output *output, int x, int y) */ output->compositor->output_flow_dirty = true; - weston_output_set_position(output, x, y); + weston_output_set_position(output, pos); } /** Signal that a pending output is taken into use.