aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/drm.c7
-rw-r--r--backend/wayland/output.c4
-rw-r--r--include/wlr/types/wlr_box.h14
-rw-r--r--render/gles2/renderer.c4
-rw-r--r--rootston/output.c12
-rw-r--r--types/wlr_box.c15
-rw-r--r--types/wlr_output.c4
-rw-r--r--types/wlr_output_layout.c4
-rw-r--r--types/wlr_screencopy_v1.c2
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c2
-rw-r--r--types/xdg_shell_v6/wlr_xdg_surface_v6.c2
11 files changed, 34 insertions, 36 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 332abfe5..735b7c29 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -637,8 +637,9 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
plane->surf.height, output->transform);
struct wlr_box hotspot = { .x = hotspot_x, .y = hotspot_y };
- wlr_box_transform(&hotspot, wlr_output_transform_invert(output->transform),
- plane->surf.width, plane->surf.height, &hotspot);
+ wlr_box_transform(&hotspot, &hotspot,
+ wlr_output_transform_invert(output->transform),
+ plane->surf.width, plane->surf.height);
if (plane->cursor_hotspot_x != hotspot.x ||
plane->cursor_hotspot_y != hotspot.y) {
@@ -737,7 +738,7 @@ static bool drm_connector_move_cursor(struct wlr_output *output,
enum wl_output_transform transform =
wlr_output_transform_invert(output->transform);
- wlr_box_transform(&box, transform, width, height, &box);
+ wlr_box_transform(&box, &box, transform, width, height);
if (plane != NULL) {
box.x -= plane->cursor_hotspot_x;
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index 03322678..89d5b5c9 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -93,9 +93,9 @@ static bool output_set_cursor(struct wlr_output *wlr_output,
struct wlr_wl_backend *backend = output->backend;
struct wlr_box hotspot = { .x = hotspot_x, .y = hotspot_y };
- wlr_box_transform(&hotspot,
+ wlr_box_transform(&hotspot, &hotspot,
wlr_output_transform_invert(wlr_output->transform),
- output->cursor.width, output->cursor.height, &hotspot);
+ output->cursor.width, output->cursor.height);
// TODO: use output->wlr_output.transform to transform pixels and hotpot
output->cursor.hotspot_x = hotspot.x;
diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h
index 8e25918b..40fd69bd 100644
--- a/include/wlr/types/wlr_box.h
+++ b/include/wlr/types/wlr_box.h
@@ -21,8 +21,8 @@ struct wlr_box {
void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
double *dest_x, double *dest_y);
-bool wlr_box_intersection(const struct wlr_box *box_a,
- const struct wlr_box *box_b, struct wlr_box *dest);
+bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
+ const struct wlr_box *box_b);
bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
@@ -31,16 +31,14 @@ bool wlr_box_empty(const struct wlr_box *box);
/**
* Transforms a box inside a `width` x `height` box.
*/
-void wlr_box_transform(const struct wlr_box *box,
- enum wl_output_transform transform, int width, int height,
- struct wlr_box *dest);
+void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
+ enum wl_output_transform transform, int width, int height);
/**
* Creates the smallest box that contains the box rotated about its center.
*/
-void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
- struct wlr_box *dest);
+void wlr_box_rotated_bounds(struct wlr_box *dest, const struct wlr_box *box, float rotation);
-void wlr_box_from_pixman_box32(const pixman_box32_t box, struct wlr_box *dest);
+void wlr_box_from_pixman_box32(struct wlr_box *dest, const pixman_box32_t box);
#endif
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index a5521909..50689ad4 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -73,8 +73,8 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
PUSH_GLES2_DEBUG;
if (box != NULL) {
struct wlr_box gl_box;
- wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180,
- renderer->viewport_width, renderer->viewport_height, &gl_box);
+ wlr_box_transform(&gl_box, box, WL_OUTPUT_TRANSFORM_FLIPPED_180,
+ renderer->viewport_width, renderer->viewport_height);
glScissor(gl_box.x, gl_box.y, gl_box.width, gl_box.height);
glEnable(GL_SCISSOR_TEST);
diff --git a/rootston/output.c b/rootston/output.c
index 5819833b..f950d4dc 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -217,7 +217,7 @@ static bool surface_intersect_output(struct wlr_surface *surface,
.x = lx, .y = ly,
.width = surface->current.width, .height = surface->current.height,
};
- wlr_box_rotated_bounds(&layout_box, rotation, &layout_box);
+ wlr_box_rotated_bounds(&layout_box, &layout_box, rotation);
return wlr_output_layout_intersects(output_layout, wlr_output, &layout_box);
}
@@ -238,7 +238,7 @@ static void scissor_output(struct roots_output *output, pixman_box32_t *rect) {
enum wl_output_transform transform =
wlr_output_transform_invert(wlr_output->transform);
- wlr_box_transform(&box, transform, ow, oh, &box);
+ wlr_box_transform(&box, &box, transform, ow, oh);
wlr_renderer_scissor(renderer, &box);
}
@@ -269,7 +269,7 @@ static void render_surface(struct wlr_surface *surface, int sx, int sy,
}
struct wlr_box rotated;
- wlr_box_rotated_bounds(&box, rotation, &rotated);
+ wlr_box_rotated_bounds(&rotated, &box, rotation);
pixman_region32_t damage;
pixman_region32_init(&damage);
@@ -335,7 +335,7 @@ static void render_decorations(struct roots_view *view,
get_decoration_box(view, output, &box);
struct wlr_box rotated;
- wlr_box_rotated_bounds(&box, view->rotation, &rotated);
+ wlr_box_rotated_bounds(&rotated, &box, view->rotation);
pixman_region32_t damage;
pixman_region32_init(&damage);
@@ -605,7 +605,7 @@ static void damage_whole_surface(struct wlr_surface *surface, int sx, int sy,
return;
}
- wlr_box_rotated_bounds(&box, rotation, &box);
+ wlr_box_rotated_bounds(&box, &box, rotation);
wlr_output_damage_add_box(output->damage, &box);
}
@@ -628,7 +628,7 @@ static void damage_whole_decoration(struct roots_view *view,
struct wlr_box box;
get_decoration_box(view, output, &box);
- wlr_box_rotated_bounds(&box, view->rotation, &box);
+ wlr_box_rotated_bounds(&box, &box, view->rotation);
wlr_output_damage_add_box(output->damage, &box);
}
diff --git a/types/wlr_box.c b/types/wlr_box.c
index 44a80dc2..0020b7a4 100644
--- a/types/wlr_box.c
+++ b/types/wlr_box.c
@@ -31,8 +31,8 @@ bool wlr_box_empty(const struct wlr_box *box) {
return box == NULL || box->width <= 0 || box->height <= 0;
}
-bool wlr_box_intersection(const struct wlr_box *box_a,
- const struct wlr_box *box_b, struct wlr_box *dest) {
+bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
+ const struct wlr_box *box_b) {
bool a_empty = wlr_box_empty(box_a);
bool b_empty = wlr_box_empty(box_b);
@@ -66,9 +66,8 @@ bool wlr_box_contains_point(const struct wlr_box *box, double x, double y) {
}
}
-void wlr_box_transform(const struct wlr_box *box,
- enum wl_output_transform transform, int width, int height,
- struct wlr_box *dest) {
+void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
+ enum wl_output_transform transform, int width, int height) {
struct wlr_box src = *box;
if (transform % 2 == 0) {
@@ -115,8 +114,8 @@ void wlr_box_transform(const struct wlr_box *box,
}
}
-void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
- struct wlr_box *dest) {
+void wlr_box_rotated_bounds(struct wlr_box *dest, const struct wlr_box *box,
+ float rotation) {
if (rotation == 0) {
*dest = *box;
return;
@@ -144,7 +143,7 @@ void wlr_box_rotated_bounds(const struct wlr_box *box, float rotation,
dest->height = ceil(fmax(y1, y2) - fmin(y1, y2));
}
-void wlr_box_from_pixman_box32(const pixman_box32_t box, struct wlr_box *dest) {
+void wlr_box_from_pixman_box32(struct wlr_box *dest, const pixman_box32_t box) {
*dest = (struct wlr_box){
.x = box.x1,
.y = box.y1,
diff --git a/types/wlr_output.c b/types/wlr_output.c
index a778e5f2..9a21196e 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -545,7 +545,7 @@ static void output_scissor(struct wlr_output *output, pixman_box32_t *rect) {
enum wl_output_transform transform =
wlr_output_transform_invert(output->transform);
- wlr_box_transform(&box, transform, ow, oh, &box);
+ wlr_box_transform(&box, &box, transform, ow, oh);
wlr_renderer_scissor(renderer, &box);
}
@@ -665,7 +665,7 @@ static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
struct wlr_box intersection;
bool visible =
- wlr_box_intersection(&output_box, &cursor_box, &intersection);
+ wlr_box_intersection(&intersection, &output_box, &cursor_box);
if (cursor->surface != NULL) {
if (cursor->visible && !visible) {
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index 6ba856f8..553275d7 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -256,7 +256,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
wl_list_for_each(l_output, &layout->outputs, link) {
struct wlr_box *output_box =
output_layout_output_get_box(l_output);
- if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
+ if (wlr_box_intersection(&out_box, output_box, target_lbox)) {
return true;
}
}
@@ -269,7 +269,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
}
struct wlr_box *output_box = output_layout_output_get_box(l_output);
- return wlr_box_intersection(output_box, target_lbox, &out_box);
+ return wlr_box_intersection(&out_box, output_box, target_lbox);
}
}
diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c
index 1d8550fe..8beb650f 100644
--- a/types/wlr_screencopy_v1.c
+++ b/types/wlr_screencopy_v1.c
@@ -184,7 +184,7 @@ static void capture_output(struct wl_client *client,
buffer_box = *box;
- wlr_box_transform(&buffer_box, output->transform, ow, oh, &buffer_box);
+ wlr_box_transform(&buffer_box, &buffer_box, output->transform, ow, oh);
buffer_box.x *= output->scale;
buffer_box.y *= output->scale;
buffer_box.width *= output->scale;
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index 7046d5f0..17edbe47 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -647,5 +647,5 @@ void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface,
return;
}
- wlr_box_intersection(&surface->geometry, box, box);
+ wlr_box_intersection(box, &surface->geometry, box);
}
diff --git a/types/xdg_shell_v6/wlr_xdg_surface_v6.c b/types/xdg_shell_v6/wlr_xdg_surface_v6.c
index c4007c71..ed87d6fe 100644
--- a/types/xdg_shell_v6/wlr_xdg_surface_v6.c
+++ b/types/xdg_shell_v6/wlr_xdg_surface_v6.c
@@ -598,5 +598,5 @@ void wlr_xdg_surface_v6_get_geometry(struct wlr_xdg_surface_v6 *surface, struct
return;
}
- wlr_box_intersection(&surface->geometry, box, box);
+ wlr_box_intersection(box, &surface->geometry, box);
}