From 4289343e17615509fba5fe389d855f2292ba09bc Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 19 Sep 2018 11:03:25 +0200 Subject: [PATCH 1/7] Fix segfault in output_render --- sway/desktop/render.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 1d2f445d1..af4e29057 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}; From 37e51a20cc9f3ff9afebdabdcd3a82b9a08d3302 Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Fri, 21 Sep 2018 21:25:03 +1000 Subject: [PATCH 2/7] Fix compilation against wlroots without X11 backend --- sway/commands/create_output.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sway/commands/create_output.c b/sway/commands/create_output.c index a852c2a0e..1c2464ea2 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 } /** From e6a52ae387ff3db64cc0867415368bd711c41566 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 21 Sep 2018 08:51:50 -0400 Subject: [PATCH 3/7] Update stability notice in README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e277e6bd8..57bc4b796 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ Read the [FAQ](https://github.com/swaywm/sway/wiki). Join the [IRC channel](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on irc.freenode.net). -**Notice**: You are viewing the **unstable** and **unsupported** master branch -of sway, where work is ongoing to port it to -[wlroots](https://github.com/swaywm/wlroots). The supported branch is the 0.15 -branch, and end users are encouraged to use the stable releases cut from it. +**Notice**: work is well underway to port sway to +[wlroots](https://github.com/swaywm/wlroots). This is **unstable** and +**unsupported** - we accept patches, but are not fond of bug reports. We are no +longer accepting bugs for 0.15. If you'd like to support sway development, please contribute to [SirCmpwn's Patreon page](https://patreon.com/sircmpwn). From dbda5d35eb448a7c2f846c3ade8c9659be9928ef Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Wed, 19 Sep 2018 15:16:19 +0100 Subject: [PATCH 4/7] swaybar: update buffer_pos when moving object to start of buffer --- swaybar/i3bar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index 884047034..4ea9c4c17 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c @@ -204,6 +204,7 @@ bool i3bar_handle_readable(struct status_line *status) { status->buffer_index -= buffer_pos; memmove(status->buffer, &status->buffer[buffer_pos], status->buffer_index); + buffer_pos = 0; } else { // expand buffer status->buffer_size *= 2; From ccdec2a329794356fdf559560261e5626a7e2098 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Fri, 21 Sep 2018 14:59:01 +0100 Subject: [PATCH 5/7] swaybar: reset tokener if json is incomplete If the tokener parses incomplete json, it sets its error value to json_tokener_continue. This means that extra json should be provided, but the code was providing the entire object again. In the interest of simplicity, the tokener is reset so that buffer_pos always points to the start of the current object. --- swaybar/i3bar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index 4ea9c4c17..02b68a2a2 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c @@ -199,6 +199,7 @@ bool i3bar_handle_readable(struct status_line *status) { } buffer_pos = status->buffer_index = 0; } else if (json_tokener_get_error(status->tokener) == json_tokener_continue) { + json_tokener_reset(status->tokener); if (status->buffer_index < status->buffer_size) { // move the object to the start of the buffer status->buffer_index -= buffer_pos; From a2326661e190bd759dc0a99f34a3d69dcdf8dc57 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Fri, 21 Sep 2018 12:06:25 +0100 Subject: [PATCH 6/7] swaybar: log invalid i3bar json --- swaybar/i3bar.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index 02b68a2a2..325aa61ae 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c @@ -117,7 +117,9 @@ bool i3bar_handle_readable(struct status_line *status) { memmove(status->buffer, &status->buffer[c], status->buffer_index); break; } else if (!isspace(status->buffer[c])) { - status_error(status, "[invalid json]"); + wlr_log(WLR_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'", + status->buffer[c]); + status_error(status, "[invalid i3bar json]"); return true; } } @@ -155,6 +157,8 @@ bool i3bar_handle_readable(struct status_line *status) { ++buffer_pos; break; } else if (!isspace(status->buffer[buffer_pos])) { + wlr_log(WLR_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'", + status->buffer[buffer_pos]); status_error(status, "[invalid i3bar json]"); return true; } @@ -166,7 +170,8 @@ bool i3bar_handle_readable(struct status_line *status) { } else { test_object = json_tokener_parse_ex(status->tokener, &status->buffer[buffer_pos], status->buffer_index - buffer_pos); - if (json_tokener_get_error(status->tokener) == json_tokener_success) { + enum json_tokener_error err = json_tokener_get_error(status->tokener); + if (err == json_tokener_success) { if (json_object_get_type(test_object) == json_type_array) { if (last_object) { json_object_put(last_object); @@ -198,7 +203,7 @@ bool i3bar_handle_readable(struct status_line *status) { continue; // look for comma without reading more input } buffer_pos = status->buffer_index = 0; - } else if (json_tokener_get_error(status->tokener) == json_tokener_continue) { + } else if (err == json_tokener_continue) { json_tokener_reset(status->tokener); if (status->buffer_index < status->buffer_size) { // move the object to the start of the buffer @@ -219,6 +224,10 @@ bool i3bar_handle_readable(struct status_line *status) { } } } else { + char last_char = status->buffer[status->buffer_index - 1]; + status->buffer[status->buffer_index - 1] = '\0'; + wlr_log(WLR_DEBUG, "Failed to parse i3bar json - %s: '%s%c'", + json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char); status_error(status, "[failed to parse i3bar json]"); return true; } From cf370539e5b0224e3b56e544a9bf9805372a187d Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 21 Sep 2018 23:26:01 +0900 Subject: [PATCH 7/7] =?UTF-8?q?stability=E3=81=AB=E9=96=A2=E3=81=99?= =?UTF-8?q?=E3=82=8B=E6=B3=A8=E8=A8=98=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.ja.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.ja.md b/README.ja.md index 75d29c73a..b0488c530 100644 --- a/README.ja.md +++ b/README.ja.md @@ -5,7 +5,7 @@ i3互換な[Wayland](http://wayland.freedesktop.org/)コンポジタです。 [FAQ](https://github.com/swaywm/sway/wiki)も合わせてご覧ください。 [IRC チャンネル](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on irc.freenode.net)もあります。 -**注意**: Swayは現在*凍結中*であり、Swayとwlrootsの統合が完了するまで、新たな機能は追加されません。バグフィックスは行われます。詳しくは[この記事](https://drewdevault.com/2017/10/09/Future-of-sway.html)をご覧ください。wlrootsとの統合状況については、[このチケット](https://github.com/swaywm/sway/issues/1390)をご覧ください。 +**注意**: Swayは現在*凍結中*であり、wlcからwlrootsへの移植が完了するまで新たな機能は追加されません。2018年9月以降に発見されるバグは0.15では対応されません。詳しくは[この記事](https://drewdevault.com/2017/10/09/Future-of-sway.html)をご覧ください。wlrootsとの統合状況については、[このチケット](https://github.com/swaywm/sway/issues/1390)をご覧ください。 [![](https://sr.ht/ICd5.png)](https://sr.ht/ICd5.png)