diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 8a4fb4a2..6cf5da48 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -75,7 +75,7 @@ static bool surface_intersect_output(struct wlr_surface *surface, | |||
75 | 75 | ||
76 | static void render_surface(struct wlr_surface *surface, | 76 | static void render_surface(struct wlr_surface *surface, |
77 | struct wlr_output *wlr_output, struct timespec *when, | 77 | struct wlr_output *wlr_output, struct timespec *when, |
78 | double ox, double oy, float rotation) { | 78 | double ox, double oy, float rotation, float alpha) { |
79 | struct wlr_renderer *renderer = | 79 | struct wlr_renderer *renderer = |
80 | wlr_backend_get_renderer(wlr_output->backend); | 80 | wlr_backend_get_renderer(wlr_output->backend); |
81 | 81 | ||
@@ -95,8 +95,8 @@ static void render_surface(struct wlr_surface *surface, | |||
95 | wlr_matrix_project_box(matrix, &box, transform, rotation, | 95 | wlr_matrix_project_box(matrix, &box, transform, rotation, |
96 | wlr_output->transform_matrix); | 96 | wlr_output->transform_matrix); |
97 | 97 | ||
98 | // TODO: configurable alpha | 98 | wlr_render_texture_with_matrix(renderer, surface->texture, |
99 | wlr_render_texture_with_matrix(renderer, surface->texture, matrix, 1.0f); | 99 | matrix, alpha); |
100 | 100 | ||
101 | wlr_surface_send_frame_done(surface, when); | 101 | wlr_surface_send_frame_done(surface, when); |
102 | } | 102 | } |
@@ -110,13 +110,13 @@ static void render_surface(struct wlr_surface *surface, | |||
110 | surface->current->width, surface->current->height, rotation); | 110 | surface->current->width, surface->current->height, rotation); |
111 | 111 | ||
112 | render_surface(subsurface->surface, wlr_output, when, | 112 | render_surface(subsurface->surface, wlr_output, when, |
113 | ox + sx, oy + sy, rotation); | 113 | ox + sx, oy + sy, rotation, alpha); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface, | 117 | static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface, |
118 | struct wlr_output *wlr_output, struct timespec *when, double base_x, | 118 | struct wlr_output *wlr_output, struct timespec *when, double base_x, |
119 | double base_y, float rotation) { | 119 | double base_y, float rotation, float alpha) { |
120 | double width = surface->surface->current->width; | 120 | double width = surface->surface->current->width; |
121 | double height = surface->surface->current->height; | 121 | double height = surface->surface->current->height; |
122 | 122 | ||
@@ -136,19 +136,19 @@ static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface, | |||
136 | width, height, rotation); | 136 | width, height, rotation); |
137 | 137 | ||
138 | render_surface(popup->surface, wlr_output, when, | 138 | render_surface(popup->surface, wlr_output, when, |
139 | base_x + popup_sx, base_y + popup_sy, rotation); | 139 | base_x + popup_sx, base_y + popup_sy, rotation, alpha); |
140 | render_xdg_v6_popups(popup, wlr_output, when, | 140 | render_xdg_v6_popups(popup, wlr_output, when, |
141 | base_x + popup_sx, base_y + popup_sy, rotation); | 141 | base_x + popup_sx, base_y + popup_sy, rotation, alpha); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, | 145 | static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, |
146 | struct wlr_output *wlr_output, struct timespec *when, | 146 | struct wlr_output *wlr_output, struct timespec *when, |
147 | double lx, double ly, float rotation, | 147 | double lx, double ly, float rotation, float alpha, |
148 | bool is_child) { | 148 | bool is_child) { |
149 | if (is_child || surface->state != WLR_WL_SHELL_SURFACE_STATE_POPUP) { | 149 | if (is_child || surface->state != WLR_WL_SHELL_SURFACE_STATE_POPUP) { |
150 | render_surface(surface->surface, wlr_output, when, | 150 | render_surface(surface->surface, wlr_output, when, |
151 | lx, ly, rotation); | 151 | lx, ly, rotation, alpha); |
152 | 152 | ||
153 | double width = surface->surface->current->width; | 153 | double width = surface->surface->current->width; |
154 | double height = surface->surface->current->height; | 154 | double height = surface->surface->current->height; |
@@ -164,7 +164,7 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, | |||
164 | width, height, rotation); | 164 | width, height, rotation); |
165 | 165 | ||
166 | render_wl_shell_surface(popup, wlr_output, when, | 166 | render_wl_shell_surface(popup, wlr_output, when, |
167 | lx + popup_x, ly + popup_y, rotation, true); | 167 | lx + popup_x, ly + popup_y, rotation, alpha, true); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } | 170 | } |
@@ -181,6 +181,7 @@ static void render_view(struct sway_container *view, void *data) { | |||
181 | struct wlr_output *wlr_output = output->wlr_output; | 181 | struct wlr_output *wlr_output = output->wlr_output; |
182 | struct sway_view *sway_view = view->sway_view; | 182 | struct sway_view *sway_view = view->sway_view; |
183 | struct wlr_surface *surface = sway_view->surface; | 183 | struct wlr_surface *surface = sway_view->surface; |
184 | float alpha = sway_view->swayc->alpha; | ||
184 | 185 | ||
185 | if (!surface) { | 186 | if (!surface) { |
186 | return; | 187 | return; |
@@ -191,17 +192,18 @@ static void render_view(struct sway_container *view, void *data) { | |||
191 | int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x; | 192 | int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x; |
192 | int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y; | 193 | int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y; |
193 | render_surface(surface, wlr_output, when, | 194 | render_surface(surface, wlr_output, when, |
194 | view->x - window_offset_x, view->y - window_offset_y, 0); | 195 | view->x - window_offset_x, view->y - window_offset_y, 0, alpha); |
195 | render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output, | 196 | render_xdg_v6_popups(sway_view->wlr_xdg_surface_v6, wlr_output, |
196 | when, view->x - window_offset_x, view->y - window_offset_y, 0); | 197 | when, view->x - window_offset_x, view->y - window_offset_y, 0, alpha); |
197 | break; | 198 | break; |
198 | } | 199 | } |
199 | case SWAY_WL_SHELL_VIEW: | 200 | case SWAY_WL_SHELL_VIEW: |
200 | render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, | 201 | render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, |
201 | when, view->x, view->y, 0, false); | 202 | when, view->x, view->y, 0, alpha, false); |
202 | break; | 203 | break; |
203 | case SWAY_XWAYLAND_VIEW: | 204 | case SWAY_XWAYLAND_VIEW: |
204 | render_surface(surface, wlr_output, when, view->x, view->y, 0); | 205 | render_surface(surface, wlr_output, when, view->x, view->y, |
206 | 0, alpha); | ||
205 | break; | 207 | break; |
206 | default: | 208 | default: |
207 | break; | 209 | break; |
@@ -214,7 +216,7 @@ static void render_layer(struct sway_output *output, struct timespec *when, | |||
214 | wl_list_for_each(sway_layer, layer, link) { | 216 | wl_list_for_each(sway_layer, layer, link) { |
215 | struct wlr_layer_surface *layer = sway_layer->layer_surface; | 217 | struct wlr_layer_surface *layer = sway_layer->layer_surface; |
216 | render_surface(layer->surface, output->wlr_output, when, | 218 | render_surface(layer->surface, output->wlr_output, when, |
217 | sway_layer->geo.x, sway_layer->geo.y, 0); | 219 | sway_layer->geo.x, sway_layer->geo.y, 0, 1.0f); |
218 | wlr_surface_send_frame_done(layer->surface, when); | 220 | wlr_surface_send_frame_done(layer->surface, when); |
219 | } | 221 | } |
220 | } | 222 | } |
@@ -288,7 +290,7 @@ static void render_output(struct sway_output *output, struct timespec *when, | |||
288 | } | 290 | } |
289 | 291 | ||
290 | render_surface(xsurface->surface, wlr_output, &output->last_frame, | 292 | render_surface(xsurface->surface, wlr_output, &output->last_frame, |
291 | view_box.x - output_box->x, view_box.y - output_box->y, 0); | 293 | view_box.x - output_box->x, view_box.y - output_box->y, 0, 1.0f); |
292 | } | 294 | } |
293 | 295 | ||
294 | // TODO: Consider revising this when fullscreen windows are supported | 296 | // TODO: Consider revising this when fullscreen windows are supported |