aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/render.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2023-02-22 18:34:08 +0100
committerLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2023-02-22 13:37:44 -0500
commitd6cb4fa8de1e540c58b58d29d1520df296e46d1f (patch)
treee12cce906c4470fdd7a78e765f3cc6bc92ec7963 /sway/desktop/render.c
parentAdjust scale for fractional-scale-v1 (diff)
downloadsway-d6cb4fa8de1e540c58b58d29d1520df296e46d1f.tar.gz
sway-d6cb4fa8de1e540c58b58d29d1520df296e46d1f.tar.zst
sway-d6cb4fa8de1e540c58b58d29d1520df296e46d1f.zip
Constify pixman_region32_t for rendering functions
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r--sway/desktop/render.c48
1 files changed, 24 insertions, 24 deletions
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
34struct render_data { 34struct 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
104static void render_texture(struct wlr_output *wlr_output, 104static 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
177static void render_layer_toplevel(struct sway_output *output, 177static 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
187static void render_layer_popups(struct sway_output *output, 187static 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
198static void render_unmanaged(struct sway_output *output, 198static 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
209static void render_drag_icons(struct sway_output *output, 209static 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
221void render_rect(struct sway_output *output, 221void 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
261static void render_view_toplevels(struct sway_view *view, 261static 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
284static void render_view_popups(struct sway_view *view, 284static 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
294static void render_saved_view(struct sway_view *view, 294static 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 */
358static void render_view(struct sway_output *output, pixman_region32_t *damage, 358static 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 */
431static void render_titlebar(struct sway_output *output, 431static 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 */
686static void render_top_border(struct sway_output *output, 686static 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
716static void render_container(struct sway_output *output, 716static 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 */
725static void render_containers_linear(struct sway_output *output, 725static 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 */
781static void render_containers_tabbed(struct sway_output *output, 781static 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 */
850static void render_containers_stacked(struct sway_output *output, 850static 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
910static void render_containers(struct sway_output *output, 910static 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
935static void render_container(struct sway_output *output, 935static 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
952static void render_workspace(struct sway_output *output, 952static 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
969static void render_floating_container(struct sway_output *soutput, 969static 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
1004static void render_floating(struct sway_output *soutput, 1004static 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
1024static void render_seatops(struct sway_output *output, 1024static 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);