diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-04-27 11:19:58 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-05-02 18:31:55 +0200 |
commit | d5cc474aef6bf5a23694053ab9c8770ea3f21e6f (patch) | |
tree | 9bead7ab099de9675204d82ae397746cec232ff8 /include | |
parent | xdg_shell: Fix crash if popup generates while toplevel is in the scratchpad (diff) | |
download | sway-d5cc474aef6bf5a23694053ab9c8770ea3f21e6f.tar.gz sway-d5cc474aef6bf5a23694053ab9c8770ea3f21e6f.tar.zst sway-d5cc474aef6bf5a23694053ab9c8770ea3f21e6f.zip |
render: pass rendering state together in a struct
This lets us easily add rendering state that we need in the future
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/input/seat.h | 7 | ||||
-rw-r--r-- | include/sway/output.h | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 7b2d3d07..6d29cf3b 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "sway/input/text_input.h" | 12 | #include "sway/input/text_input.h" |
13 | 13 | ||
14 | struct sway_seat; | 14 | struct sway_seat; |
15 | struct render_context; | ||
15 | 16 | ||
16 | struct sway_seatop_impl { | 17 | struct sway_seatop_impl { |
17 | void (*button)(struct sway_seat *seat, uint32_t time_msec, | 18 | void (*button)(struct sway_seat *seat, uint32_t time_msec, |
@@ -49,8 +50,7 @@ struct sway_seatop_impl { | |||
49 | uint32_t time_msec, enum wlr_tablet_tool_tip_state state); | 50 | uint32_t time_msec, enum wlr_tablet_tool_tip_state state); |
50 | void (*end)(struct sway_seat *seat); | 51 | void (*end)(struct sway_seat *seat); |
51 | void (*unref)(struct sway_seat *seat, struct sway_container *con); | 52 | void (*unref)(struct sway_seat *seat, struct sway_container *con); |
52 | void (*render)(struct sway_seat *seat, struct sway_output *output, | 53 | void (*render)(struct sway_seat *seat, struct render_context *ctx); |
53 | const pixman_region32_t *damage); | ||
54 | bool allow_set_cursor; | 54 | bool allow_set_cursor; |
55 | }; | 55 | }; |
56 | 56 | ||
@@ -356,8 +356,7 @@ void seatop_unref(struct sway_seat *seat, struct sway_container *con); | |||
356 | * Instructs a seatop to render anything that it needs to render | 356 | * Instructs a seatop to render anything that it needs to render |
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 render_context *ctx); |
360 | const pixman_region32_t *damage); | ||
361 | 360 | ||
362 | bool seatop_allows_set_cursor(struct sway_seat *seat); | 361 | bool seatop_allows_set_cursor(struct sway_seat *seat); |
363 | 362 | ||
diff --git a/include/sway/output.h b/include/sway/output.h index 04202976..b397c8e2 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -65,6 +65,12 @@ struct sway_output_non_desktop { | |||
65 | struct wl_listener destroy; | 65 | struct wl_listener destroy; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | struct render_context { | ||
69 | struct sway_output *output; | ||
70 | struct wlr_renderer *renderer; | ||
71 | const pixman_region32_t *output_damage; | ||
72 | }; | ||
73 | |||
68 | struct sway_output *output_create(struct wlr_output *wlr_output); | 74 | struct sway_output *output_create(struct wlr_output *wlr_output); |
69 | 75 | ||
70 | void output_destroy(struct sway_output *output); | 76 | void output_destroy(struct sway_output *output); |
@@ -115,7 +121,7 @@ bool output_has_opaque_overlay_layer_surface(struct sway_output *output); | |||
115 | 121 | ||
116 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); | 122 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); |
117 | 123 | ||
118 | void output_render(struct sway_output *output, pixman_region32_t *damage); | 124 | void output_render(struct render_context *ctx); |
119 | 125 | ||
120 | void output_surface_for_each_surface(struct sway_output *output, | 126 | void output_surface_for_each_surface(struct sway_output *output, |
121 | struct wlr_surface *surface, double ox, double oy, | 127 | struct wlr_surface *surface, double ox, double oy, |
@@ -168,8 +174,7 @@ void output_get_box(struct sway_output *output, struct wlr_box *box); | |||
168 | enum sway_container_layout output_get_default_layout( | 174 | enum sway_container_layout output_get_default_layout( |
169 | struct sway_output *output); | 175 | struct sway_output *output); |
170 | 176 | ||
171 | void render_rect(struct sway_output *output, | 177 | void render_rect(struct render_context *ctx, const struct wlr_box *_box, |
172 | const pixman_region32_t *output_damage, const struct wlr_box *_box, | ||
173 | float color[static 4]); | 178 | float color[static 4]); |
174 | 179 | ||
175 | void premultiply_alpha(float color[4], float opacity); | 180 | void premultiply_alpha(float color[4], float opacity); |