diff options
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 87eb80fe..f3416c03 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -41,6 +41,9 @@ static void rotate_child_position(double *sx, double *sy, double sw, double sh, | |||
41 | static void render_surface(struct wlr_surface *surface, | 41 | static void render_surface(struct wlr_surface *surface, |
42 | struct wlr_output *wlr_output, struct timespec *when, | 42 | struct wlr_output *wlr_output, struct timespec *when, |
43 | double lx, double ly, float rotation) { | 43 | double lx, double ly, float rotation) { |
44 | struct wlr_renderer *renderer = | ||
45 | wlr_backend_get_renderer(wlr_output->backend); | ||
46 | |||
44 | if (!wlr_surface_has_buffer(surface)) { | 47 | if (!wlr_surface_has_buffer(surface)) { |
45 | return; | 48 | return; |
46 | } | 49 | } |
@@ -65,8 +68,8 @@ static void render_surface(struct wlr_surface *surface, | |||
65 | float matrix[9]; | 68 | float matrix[9]; |
66 | wlr_matrix_project_box(matrix, &render_box, surface->current->transform, | 69 | wlr_matrix_project_box(matrix, &render_box, surface->current->transform, |
67 | 0, wlr_output->transform_matrix); | 70 | 0, wlr_output->transform_matrix); |
68 | wlr_render_texture_with_matrix(server.renderer, surface->texture, | 71 | wlr_render_texture_with_matrix(renderer, surface->texture, matrix, |
69 | matrix, 1.0f); // TODO: configurable alpha | 72 | 1.0f); // TODO: configurable alpha |
70 | 73 | ||
71 | wlr_surface_send_frame_done(surface, when); | 74 | wlr_surface_send_frame_done(surface, when); |
72 | } | 75 | } |
@@ -192,15 +195,14 @@ static void render_layer(struct sway_output *output, | |||
192 | } | 195 | } |
193 | } | 196 | } |
194 | 197 | ||
195 | static void output_frame_notify(struct wl_listener *listener, void *data) { | 198 | static void handle_output_frame(struct wl_listener *listener, void *data) { |
196 | struct sway_output *soutput = wl_container_of(listener, soutput, frame); | 199 | struct sway_output *soutput = wl_container_of(listener, soutput, frame); |
197 | struct wlr_output *wlr_output = data; | 200 | struct wlr_output *wlr_output = data; |
198 | struct sway_server *server = soutput->server; | 201 | struct wlr_renderer *renderer = |
199 | struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); | 202 | wlr_backend_get_renderer(wlr_output->backend); |
200 | 203 | ||
201 | int buffer_age = -1; | 204 | wlr_output_make_current(wlr_output, NULL); |
202 | wlr_output_make_current(wlr_output, &buffer_age); | 205 | wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); |
203 | wlr_renderer_begin(server->renderer, wlr_output->width, wlr_output->height); | ||
204 | 206 | ||
205 | float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; | 207 | float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; |
206 | wlr_renderer_clear(renderer, clear_color); | 208 | wlr_renderer_clear(renderer, clear_color); |
@@ -218,7 +220,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
218 | &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); | 220 | &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); |
219 | 221 | ||
220 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 222 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
221 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, soutput->swayc); | 223 | struct sway_container *focus = |
224 | sway_seat_get_focus_inactive(seat, soutput->swayc); | ||
222 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? | 225 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? |
223 | focus : | 226 | focus : |
224 | container_parent(focus, C_WORKSPACE)); | 227 | container_parent(focus, C_WORKSPACE)); |
@@ -248,7 +251,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
248 | render_layer(soutput, output_box, &now, | 251 | render_layer(soutput, output_box, &now, |
249 | &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); | 252 | &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]); |
250 | 253 | ||
251 | wlr_renderer_end(server->renderer); | 254 | wlr_renderer_end(renderer); |
252 | wlr_output_swap_buffers(wlr_output, &now, NULL); | 255 | wlr_output_swap_buffers(wlr_output, &now, NULL); |
253 | soutput->last_frame = now; | 256 | soutput->last_frame = now; |
254 | } | 257 | } |
@@ -306,7 +309,7 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
306 | sway_input_manager_configure_xcursor(input_manager); | 309 | sway_input_manager_configure_xcursor(input_manager); |
307 | 310 | ||
308 | wl_signal_add(&wlr_output->events.frame, &output->frame); | 311 | wl_signal_add(&wlr_output->events.frame, &output->frame); |
309 | output->frame.notify = output_frame_notify; | 312 | output->frame.notify = handle_output_frame; |
310 | wl_signal_add(&wlr_output->events.destroy, &output->destroy); | 313 | wl_signal_add(&wlr_output->events.destroy, &output->destroy); |
311 | output->destroy.notify = handle_output_destroy; | 314 | output->destroy.notify = handle_output_destroy; |
312 | wl_signal_add(&wlr_output->events.mode, &output->mode); | 315 | wl_signal_add(&wlr_output->events.mode, &output->mode); |