diff options
author | Simon Ser <contact@emersion.fr> | 2023-02-22 18:34:08 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2023-02-22 13:37:44 -0500 |
commit | d6cb4fa8de1e540c58b58d29d1520df296e46d1f (patch) | |
tree | e12cce906c4470fdd7a78e765f3cc6bc92ec7963 | |
parent | Adjust scale for fractional-scale-v1 (diff) | |
download | sway-d6cb4fa8de1e540c58b58d29d1520df296e46d1f.tar.gz sway-d6cb4fa8de1e540c58b58d29d1520df296e46d1f.tar.zst sway-d6cb4fa8de1e540c58b58d29d1520df296e46d1f.zip |
Constify pixman_region32_t for rendering functions
-rw-r--r-- | include/sway/input/seat.h | 4 | ||||
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | sway/desktop/render.c | 48 | ||||
-rw-r--r-- | sway/input/seat.c | 2 | ||||
-rw-r--r-- | sway/input/seatop_move_tiling.c | 2 |
5 files changed, 29 insertions, 29 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 227da78b..7b2d3d07 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -50,7 +50,7 @@ struct sway_seatop_impl { | |||
50 | void (*end)(struct sway_seat *seat); | 50 | void (*end)(struct sway_seat *seat); |
51 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | 51 | void (*unref)(struct sway_seat *seat, struct sway_container *con); |
52 | void (*render)(struct sway_seat *seat, struct sway_output *output, | 52 | void (*render)(struct sway_seat *seat, struct sway_output *output, |
53 | pixman_region32_t *damage); | 53 | const pixman_region32_t *damage); |
54 | bool allow_set_cursor; | 54 | bool allow_set_cursor; |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -357,7 +357,7 @@ void seatop_unref(struct sway_seat *seat, struct sway_container *con); | |||
357 | * (eg. dropzone for move-tiling) | 357 | * (eg. dropzone for move-tiling) |
358 | */ | 358 | */ |
359 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | 359 | void seatop_render(struct sway_seat *seat, struct sway_output *output, |
360 | pixman_region32_t *damage); | 360 | const pixman_region32_t *damage); |
361 | 361 | ||
362 | bool seatop_allows_set_cursor(struct sway_seat *seat); | 362 | bool seatop_allows_set_cursor(struct sway_seat *seat); |
363 | 363 | ||
diff --git a/include/sway/output.h b/include/sway/output.h index 28be6a1e..da625315 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -167,7 +167,7 @@ enum sway_container_layout output_get_default_layout( | |||
167 | struct sway_output *output); | 167 | struct sway_output *output); |
168 | 168 | ||
169 | void render_rect(struct sway_output *output, | 169 | void render_rect(struct sway_output *output, |
170 | pixman_region32_t *output_damage, const struct wlr_box *_box, | 170 | const pixman_region32_t *output_damage, const struct wlr_box *_box, |
171 | float color[static 4]); | 171 | float color[static 4]); |
172 | 172 | ||
173 | void premultiply_alpha(float color[4], float opacity); | 173 | void premultiply_alpha(float color[4], float opacity); |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 2b7214c3..dedaa967 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | struct render_data { | 34 | struct render_data { |
35 | pixman_region32_t *damage; | 35 | const pixman_region32_t *damage; |
36 | float alpha; | 36 | float alpha; |
37 | struct wlr_box *clip_box; | 37 | struct wlr_box *clip_box; |
38 | }; | 38 | }; |
@@ -102,7 +102,7 @@ static void set_scale_filter(struct wlr_output *wlr_output, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | static void render_texture(struct wlr_output *wlr_output, | 104 | static void render_texture(struct wlr_output *wlr_output, |
105 | pixman_region32_t *output_damage, struct wlr_texture *texture, | 105 | const pixman_region32_t *output_damage, struct wlr_texture *texture, |
106 | const struct wlr_fbox *src_box, const struct wlr_box *dst_box, | 106 | const struct wlr_fbox *src_box, const struct wlr_box *dst_box, |
107 | const float matrix[static 9], float alpha) { | 107 | const float matrix[static 9], float alpha) { |
108 | struct wlr_renderer *renderer = wlr_output->renderer; | 108 | struct wlr_renderer *renderer = wlr_output->renderer; |
@@ -139,7 +139,7 @@ static void render_surface_iterator(struct sway_output *output, | |||
139 | struct wlr_box *_box, void *_data) { | 139 | struct wlr_box *_box, void *_data) { |
140 | struct render_data *data = _data; | 140 | struct render_data *data = _data; |
141 | struct wlr_output *wlr_output = output->wlr_output; | 141 | struct wlr_output *wlr_output = output->wlr_output; |
142 | pixman_region32_t *output_damage = data->damage; | 142 | const pixman_region32_t *output_damage = data->damage; |
143 | float alpha = data->alpha; | 143 | float alpha = data->alpha; |
144 | 144 | ||
145 | struct wlr_texture *texture = wlr_surface_get_texture(surface); | 145 | struct wlr_texture *texture = wlr_surface_get_texture(surface); |
@@ -175,7 +175,7 @@ static void render_surface_iterator(struct sway_output *output, | |||
175 | } | 175 | } |
176 | 176 | ||
177 | static void render_layer_toplevel(struct sway_output *output, | 177 | static void render_layer_toplevel(struct sway_output *output, |
178 | pixman_region32_t *damage, struct wl_list *layer_surfaces) { | 178 | const pixman_region32_t *damage, struct wl_list *layer_surfaces) { |
179 | struct render_data data = { | 179 | struct render_data data = { |
180 | .damage = damage, | 180 | .damage = damage, |
181 | .alpha = 1.0f, | 181 | .alpha = 1.0f, |
@@ -185,7 +185,7 @@ static void render_layer_toplevel(struct sway_output *output, | |||
185 | } | 185 | } |
186 | 186 | ||
187 | static void render_layer_popups(struct sway_output *output, | 187 | static void render_layer_popups(struct sway_output *output, |
188 | pixman_region32_t *damage, struct wl_list *layer_surfaces) { | 188 | const pixman_region32_t *damage, struct wl_list *layer_surfaces) { |
189 | struct render_data data = { | 189 | struct render_data data = { |
190 | .damage = damage, | 190 | .damage = damage, |
191 | .alpha = 1.0f, | 191 | .alpha = 1.0f, |
@@ -196,7 +196,7 @@ static void render_layer_popups(struct sway_output *output, | |||
196 | 196 | ||
197 | #if HAVE_XWAYLAND | 197 | #if HAVE_XWAYLAND |
198 | static void render_unmanaged(struct sway_output *output, | 198 | static void render_unmanaged(struct sway_output *output, |
199 | pixman_region32_t *damage, struct wl_list *unmanaged) { | 199 | const pixman_region32_t *damage, struct wl_list *unmanaged) { |
200 | struct render_data data = { | 200 | struct render_data data = { |
201 | .damage = damage, | 201 | .damage = damage, |
202 | .alpha = 1.0f, | 202 | .alpha = 1.0f, |
@@ -207,7 +207,7 @@ static void render_unmanaged(struct sway_output *output, | |||
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | static void render_drag_icons(struct sway_output *output, | 209 | static void render_drag_icons(struct sway_output *output, |
210 | pixman_region32_t *damage, struct wl_list *drag_icons) { | 210 | const pixman_region32_t *damage, struct wl_list *drag_icons) { |
211 | struct render_data data = { | 211 | struct render_data data = { |
212 | .damage = damage, | 212 | .damage = damage, |
213 | .alpha = 1.0f, | 213 | .alpha = 1.0f, |
@@ -219,7 +219,7 @@ static void render_drag_icons(struct sway_output *output, | |||
219 | // _box.x and .y are expected to be layout-local | 219 | // _box.x and .y are expected to be layout-local |
220 | // _box.width and .height are expected to be output-buffer-local | 220 | // _box.width and .height are expected to be output-buffer-local |
221 | void render_rect(struct sway_output *output, | 221 | void render_rect(struct sway_output *output, |
222 | pixman_region32_t *output_damage, const struct wlr_box *_box, | 222 | const pixman_region32_t *output_damage, const struct wlr_box *_box, |
223 | float color[static 4]) { | 223 | float color[static 4]) { |
224 | struct wlr_output *wlr_output = output->wlr_output; | 224 | struct wlr_output *wlr_output = output->wlr_output; |
225 | struct wlr_renderer *renderer = wlr_output->renderer; | 225 | struct wlr_renderer *renderer = wlr_output->renderer; |
@@ -259,7 +259,7 @@ void premultiply_alpha(float color[4], float opacity) { | |||
259 | } | 259 | } |
260 | 260 | ||
261 | static void render_view_toplevels(struct sway_view *view, | 261 | static void render_view_toplevels(struct sway_view *view, |
262 | struct sway_output *output, pixman_region32_t *damage, float alpha) { | 262 | struct sway_output *output, const pixman_region32_t *damage, float alpha) { |
263 | struct render_data data = { | 263 | struct render_data data = { |
264 | .damage = damage, | 264 | .damage = damage, |
265 | .alpha = alpha, | 265 | .alpha = alpha, |
@@ -282,7 +282,7 @@ static void render_view_toplevels(struct sway_view *view, | |||
282 | } | 282 | } |
283 | 283 | ||
284 | static void render_view_popups(struct sway_view *view, | 284 | static void render_view_popups(struct sway_view *view, |
285 | struct sway_output *output, pixman_region32_t *damage, float alpha) { | 285 | struct sway_output *output, const pixman_region32_t *damage, float alpha) { |
286 | struct render_data data = { | 286 | struct render_data data = { |
287 | .damage = damage, | 287 | .damage = damage, |
288 | .alpha = alpha, | 288 | .alpha = alpha, |
@@ -292,7 +292,7 @@ static void render_view_popups(struct sway_view *view, | |||
292 | } | 292 | } |
293 | 293 | ||
294 | static void render_saved_view(struct sway_view *view, | 294 | static void render_saved_view(struct sway_view *view, |
295 | struct sway_output *output, pixman_region32_t *damage, float alpha) { | 295 | struct sway_output *output, const pixman_region32_t *damage, float alpha) { |
296 | struct wlr_output *wlr_output = output->wlr_output; | 296 | struct wlr_output *wlr_output = output->wlr_output; |
297 | 297 | ||
298 | if (wl_list_empty(&view->saved_buffers)) { | 298 | if (wl_list_empty(&view->saved_buffers)) { |
@@ -355,7 +355,7 @@ static void render_saved_view(struct sway_view *view, | |||
355 | /** | 355 | /** |
356 | * Render a view's surface and left/bottom/right borders. | 356 | * Render a view's surface and left/bottom/right borders. |
357 | */ | 357 | */ |
358 | static void render_view(struct sway_output *output, pixman_region32_t *damage, | 358 | static void render_view(struct sway_output *output, const pixman_region32_t *damage, |
359 | struct sway_container *con, struct border_colors *colors) { | 359 | struct sway_container *con, struct border_colors *colors) { |
360 | struct sway_view *view = con->view; | 360 | struct sway_view *view = con->view; |
361 | if (!wl_list_empty(&view->saved_buffers)) { | 361 | if (!wl_list_empty(&view->saved_buffers)) { |
@@ -429,7 +429,7 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage, | |||
429 | * The left side is: 1px border, 2px padding, title | 429 | * The left side is: 1px border, 2px padding, title |
430 | */ | 430 | */ |
431 | static void render_titlebar(struct sway_output *output, | 431 | static void render_titlebar(struct sway_output *output, |
432 | pixman_region32_t *output_damage, struct sway_container *con, | 432 | const pixman_region32_t *output_damage, struct sway_container *con, |
433 | int x, int y, int width, | 433 | int x, int y, int width, |
434 | struct border_colors *colors, struct wlr_texture *title_texture, | 434 | struct border_colors *colors, struct wlr_texture *title_texture, |
435 | struct wlr_texture *marks_texture) { | 435 | struct wlr_texture *marks_texture) { |
@@ -684,7 +684,7 @@ static void render_titlebar(struct sway_output *output, | |||
684 | * Render the top border line for a view using "border pixel". | 684 | * Render the top border line for a view using "border pixel". |
685 | */ | 685 | */ |
686 | static void render_top_border(struct sway_output *output, | 686 | static void render_top_border(struct sway_output *output, |
687 | pixman_region32_t *output_damage, struct sway_container *con, | 687 | const pixman_region32_t *output_damage, struct sway_container *con, |
688 | struct border_colors *colors) { | 688 | struct border_colors *colors) { |
689 | struct sway_container_state *state = &con->current; | 689 | struct sway_container_state *state = &con->current; |
690 | if (!state->border_top) { | 690 | if (!state->border_top) { |
@@ -714,7 +714,7 @@ struct parent_data { | |||
714 | }; | 714 | }; |
715 | 715 | ||
716 | static void render_container(struct sway_output *output, | 716 | static void render_container(struct sway_output *output, |
717 | pixman_region32_t *damage, struct sway_container *con, bool parent_focused); | 717 | const pixman_region32_t *damage, struct sway_container *con, bool parent_focused); |
718 | 718 | ||
719 | /** | 719 | /** |
720 | * Render a container's children using a L_HORIZ or L_VERT layout. | 720 | * Render a container's children using a L_HORIZ or L_VERT layout. |
@@ -723,7 +723,7 @@ static void render_container(struct sway_output *output, | |||
723 | * they'll apply their own borders to their children. | 723 | * they'll apply their own borders to their children. |
724 | */ | 724 | */ |
725 | static void render_containers_linear(struct sway_output *output, | 725 | static void render_containers_linear(struct sway_output *output, |
726 | pixman_region32_t *damage, struct parent_data *parent) { | 726 | const pixman_region32_t *damage, struct parent_data *parent) { |
727 | for (int i = 0; i < parent->children->length; ++i) { | 727 | for (int i = 0; i < parent->children->length; ++i) { |
728 | struct sway_container *child = parent->children->items[i]; | 728 | struct sway_container *child = parent->children->items[i]; |
729 | 729 | ||
@@ -779,7 +779,7 @@ static bool container_has_focused_child(struct sway_container *con) { | |||
779 | * Render a container's children using the L_TABBED layout. | 779 | * Render a container's children using the L_TABBED layout. |
780 | */ | 780 | */ |
781 | static void render_containers_tabbed(struct sway_output *output, | 781 | static void render_containers_tabbed(struct sway_output *output, |
782 | pixman_region32_t *damage, struct parent_data *parent) { | 782 | const pixman_region32_t *damage, struct parent_data *parent) { |
783 | if (!parent->children->length) { | 783 | if (!parent->children->length) { |
784 | return; | 784 | return; |
785 | } | 785 | } |
@@ -848,7 +848,7 @@ static void render_containers_tabbed(struct sway_output *output, | |||
848 | * Render a container's children using the L_STACKED layout. | 848 | * Render a container's children using the L_STACKED layout. |
849 | */ | 849 | */ |
850 | static void render_containers_stacked(struct sway_output *output, | 850 | static void render_containers_stacked(struct sway_output *output, |
851 | pixman_region32_t *damage, struct parent_data *parent) { | 851 | const pixman_region32_t *damage, struct parent_data *parent) { |
852 | if (!parent->children->length) { | 852 | if (!parent->children->length) { |
853 | return; | 853 | return; |
854 | } | 854 | } |
@@ -908,7 +908,7 @@ static void render_containers_stacked(struct sway_output *output, | |||
908 | } | 908 | } |
909 | 909 | ||
910 | static void render_containers(struct sway_output *output, | 910 | static void render_containers(struct sway_output *output, |
911 | pixman_region32_t *damage, struct parent_data *parent) { | 911 | const pixman_region32_t *damage, struct parent_data *parent) { |
912 | if (config->hide_lone_tab && parent->children->length == 1) { | 912 | if (config->hide_lone_tab && parent->children->length == 1) { |
913 | struct sway_container *child = parent->children->items[0]; | 913 | struct sway_container *child = parent->children->items[0]; |
914 | if (child->view) { | 914 | if (child->view) { |
@@ -933,7 +933,7 @@ static void render_containers(struct sway_output *output, | |||
933 | } | 933 | } |
934 | 934 | ||
935 | static void render_container(struct sway_output *output, | 935 | static void render_container(struct sway_output *output, |
936 | pixman_region32_t *damage, struct sway_container *con, bool focused) { | 936 | const pixman_region32_t *damage, struct sway_container *con, bool focused) { |
937 | struct parent_data data = { | 937 | struct parent_data data = { |
938 | .layout = con->current.layout, | 938 | .layout = con->current.layout, |
939 | .box = { | 939 | .box = { |
@@ -950,7 +950,7 @@ static void render_container(struct sway_output *output, | |||
950 | } | 950 | } |
951 | 951 | ||
952 | static void render_workspace(struct sway_output *output, | 952 | static void render_workspace(struct sway_output *output, |
953 | pixman_region32_t *damage, struct sway_workspace *ws, bool focused) { | 953 | const pixman_region32_t *damage, struct sway_workspace *ws, bool focused) { |
954 | struct parent_data data = { | 954 | struct parent_data data = { |
955 | .layout = ws->current.layout, | 955 | .layout = ws->current.layout, |
956 | .box = { | 956 | .box = { |
@@ -967,7 +967,7 @@ static void render_workspace(struct sway_output *output, | |||
967 | } | 967 | } |
968 | 968 | ||
969 | static void render_floating_container(struct sway_output *soutput, | 969 | static void render_floating_container(struct sway_output *soutput, |
970 | pixman_region32_t *damage, struct sway_container *con) { | 970 | const pixman_region32_t *damage, struct sway_container *con) { |
971 | if (con->view) { | 971 | if (con->view) { |
972 | struct sway_view *view = con->view; | 972 | struct sway_view *view = con->view; |
973 | struct border_colors *colors; | 973 | struct border_colors *colors; |
@@ -1002,7 +1002,7 @@ static void render_floating_container(struct sway_output *soutput, | |||
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | static void render_floating(struct sway_output *soutput, | 1004 | static void render_floating(struct sway_output *soutput, |
1005 | pixman_region32_t *damage) { | 1005 | const pixman_region32_t *damage) { |
1006 | for (int i = 0; i < root->outputs->length; ++i) { | 1006 | for (int i = 0; i < root->outputs->length; ++i) { |
1007 | struct sway_output *output = root->outputs->items[i]; | 1007 | struct sway_output *output = root->outputs->items[i]; |
1008 | for (int j = 0; j < output->current.workspaces->length; ++j) { | 1008 | for (int j = 0; j < output->current.workspaces->length; ++j) { |
@@ -1022,7 +1022,7 @@ static void render_floating(struct sway_output *soutput, | |||
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | static void render_seatops(struct sway_output *output, | 1024 | static void render_seatops(struct sway_output *output, |
1025 | pixman_region32_t *damage) { | 1025 | const pixman_region32_t *damage) { |
1026 | struct sway_seat *seat; | 1026 | struct sway_seat *seat; |
1027 | wl_list_for_each(seat, &server.input->seats, link) { | 1027 | wl_list_for_each(seat, &server.input->seats, link) { |
1028 | seatop_render(seat, output, damage); | 1028 | seatop_render(seat, output, damage); |
diff --git a/sway/input/seat.c b/sway/input/seat.c index bff425dd..14931ce0 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -1727,7 +1727,7 @@ void seatop_end(struct sway_seat *seat) { | |||
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | void seatop_render(struct sway_seat *seat, struct sway_output *output, | 1729 | void seatop_render(struct sway_seat *seat, struct sway_output *output, |
1730 | pixman_region32_t *damage) { | 1730 | const pixman_region32_t *damage) { |
1731 | if (seat->seatop_impl->render) { | 1731 | if (seat->seatop_impl->render) { |
1732 | seat->seatop_impl->render(seat, output, damage); | 1732 | seat->seatop_impl->render(seat, output, damage); |
1733 | } | 1733 | } |
diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index 223c6c08..5498e909 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c | |||
@@ -32,7 +32,7 @@ struct seatop_move_tiling_event { | |||
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void handle_render(struct sway_seat *seat, | 34 | static void handle_render(struct sway_seat *seat, |
35 | struct sway_output *output, pixman_region32_t *damage) { | 35 | struct sway_output *output, const pixman_region32_t *damage) { |
36 | struct seatop_move_tiling_event *e = seat->seatop_data; | 36 | struct seatop_move_tiling_event *e = seat->seatop_data; |
37 | if (!e->threshold_reached) { | 37 | if (!e->threshold_reached) { |
38 | return; | 38 | return; |