From 4289343e17615509fba5fe389d855f2292ba09bc Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 19 Sep 2018 11:03:25 +0200 Subject: Fix segfault in output_render --- sway/desktop/render.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sway') diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 1d2f445d..af4e2905 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -914,12 +914,17 @@ void output_render(struct sway_output *output, struct timespec *when, struct wlr_output *wlr_output = output->wlr_output; struct wlr_renderer *renderer = - wlr_backend_get_renderer(wlr_output->backend); + wlr_backend_get_renderer(wlr_output->backend); if (!sway_assert(renderer != NULL, "expected the output backend to have a renderer")) { return; } + struct sway_workspace *workspace = output->current.active_workspace; + if (workspace == NULL) { + return; + } + wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); if (!pixman_region32_not_empty(damage)) { @@ -935,13 +940,11 @@ void output_render(struct sway_output *output, struct timespec *when, pixman_region32_union_rect(damage, damage, 0, 0, width, height); } - struct sway_workspace *workspace = output->current.active_workspace; - struct sway_container *fullscreen_con = workspace->current.fullscreen; - if (output_has_opaque_overlay_layer_surface(output)) { goto render_overlay; } + struct sway_container *fullscreen_con = workspace->current.fullscreen; if (fullscreen_con) { float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; -- cgit v1.2.3 From 37e51a20cc9f3ff9afebdabdcd3a82b9a08d3302 Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Fri, 21 Sep 2018 21:25:03 +1000 Subject: Fix compilation against wlroots without X11 backend --- sway/commands/create_output.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sway') diff --git a/sway/commands/create_output.c b/sway/commands/create_output.c index a852c2a0..1c2464ea 100644 --- a/sway/commands/create_output.c +++ b/sway/commands/create_output.c @@ -1,6 +1,9 @@ +#include #include #include +#ifdef WLR_HAS_X11_BACKEND #include +#endif #include "sway/commands.h" #include "sway/server.h" #include "log.h" @@ -14,10 +17,13 @@ static void create_output(struct wlr_backend *backend, void *data) { if (wlr_backend_is_wl(backend)) { wlr_wl_output_create(backend); *done = true; - } else if (wlr_backend_is_x11(backend)) { + } +#ifdef WLR_HAS_X11_BACKEND + else if (wlr_backend_is_x11(backend)) { wlr_x11_output_create(backend); *done = true; } +#endif } /** -- cgit v1.2.3