summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <RedSoxFan@users.noreply.github.com>2018-09-21 15:28:53 -0400
committerLibravatar GitHub <noreply@github.com>2018-09-21 15:28:53 -0400
commit04862e2121203965dad834b731a5c32b1d1f4e84 (patch)
tree56f257c17c0d97666c498d2eb35012838c82b451
parentswaybar: don't wl_display_roundtrip on each frame (diff)
parentMerge pull request #2672 from ianyfan/swaybar (diff)
downloadsway-04862e2121203965dad834b731a5c32b1d1f4e84.tar.gz
sway-04862e2121203965dad834b731a5c32b1d1f4e84.tar.zst
sway-04862e2121203965dad834b731a5c32b1d1f4e84.zip
Merge branch 'master' into swaybar-hotplug
-rw-r--r--README.ja.md2
-rw-r--r--README.md8
-rw-r--r--sway/commands/create_output.c8
-rw-r--r--sway/desktop/render.c11
-rw-r--r--swaybar/i3bar.c17
5 files changed, 33 insertions, 13 deletions
diff --git a/README.ja.md b/README.ja.md
index 75d29c73..b0488c53 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -5,7 +5,7 @@ i3互換な[Wayland](http://wayland.freedesktop.org/)コンポジタです。
5[FAQ](https://github.com/swaywm/sway/wiki)も合わせてご覧ください。 5[FAQ](https://github.com/swaywm/sway/wiki)も合わせてご覧ください。
6[IRC チャンネル](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on irc.freenode.net)もあります。 6[IRC チャンネル](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on irc.freenode.net)もあります。
7 7
8**注意**: Swayは現在*凍結中*であり、Swayとwlrootsの統合が完了するまで、新たな機能は追加されません。バグフィックスは行われます。詳しくは[この記事](https://drewdevault.com/2017/10/09/Future-of-sway.html)をご覧ください。wlrootsとの統合状況については、[このチケット](https://github.com/swaywm/sway/issues/1390)をご覧ください。 8**注意**: 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)をご覧ください。
9 9
10[![](https://sr.ht/ICd5.png)](https://sr.ht/ICd5.png) 10[![](https://sr.ht/ICd5.png)](https://sr.ht/ICd5.png)
11 11
diff --git a/README.md b/README.md
index e277e6bd..57bc4b79 100644
--- a/README.md
+++ b/README.md
@@ -9,10 +9,10 @@ Read the [FAQ](https://github.com/swaywm/sway/wiki). Join the
9[IRC channel](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on 9[IRC channel](http://webchat.freenode.net/?channels=sway&uio=d4) (#sway on
10irc.freenode.net). 10irc.freenode.net).
11 11
12**Notice**: You are viewing the **unstable** and **unsupported** master branch 12**Notice**: work is well underway to port sway to
13of sway, where work is ongoing to port it to 13[wlroots](https://github.com/swaywm/wlroots). This is **unstable** and
14[wlroots](https://github.com/swaywm/wlroots). The supported branch is the 0.15 14**unsupported** - we accept patches, but are not fond of bug reports. We are no
15branch, and end users are encouraged to use the stable releases cut from it. 15longer accepting bugs for 0.15.
16 16
17If you'd like to support sway development, please contribute to [SirCmpwn's 17If you'd like to support sway development, please contribute to [SirCmpwn's
18Patreon page](https://patreon.com/sircmpwn). 18Patreon page](https://patreon.com/sircmpwn).
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 @@
1#include <wlr/config.h>
1#include <wlr/backend/multi.h> 2#include <wlr/backend/multi.h>
2#include <wlr/backend/wayland.h> 3#include <wlr/backend/wayland.h>
4#ifdef WLR_HAS_X11_BACKEND
3#include <wlr/backend/x11.h> 5#include <wlr/backend/x11.h>
6#endif
4#include "sway/commands.h" 7#include "sway/commands.h"
5#include "sway/server.h" 8#include "sway/server.h"
6#include "log.h" 9#include "log.h"
@@ -14,10 +17,13 @@ static void create_output(struct wlr_backend *backend, void *data) {
14 if (wlr_backend_is_wl(backend)) { 17 if (wlr_backend_is_wl(backend)) {
15 wlr_wl_output_create(backend); 18 wlr_wl_output_create(backend);
16 *done = true; 19 *done = true;
17 } else if (wlr_backend_is_x11(backend)) { 20 }
21#ifdef WLR_HAS_X11_BACKEND
22 else if (wlr_backend_is_x11(backend)) {
18 wlr_x11_output_create(backend); 23 wlr_x11_output_create(backend);
19 *done = true; 24 *done = true;
20 } 25 }
26#endif
21} 27}
22 28
23/** 29/**
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,
914 struct wlr_output *wlr_output = output->wlr_output; 914 struct wlr_output *wlr_output = output->wlr_output;
915 915
916 struct wlr_renderer *renderer = 916 struct wlr_renderer *renderer =
917 wlr_backend_get_renderer(wlr_output->backend); 917 wlr_backend_get_renderer(wlr_output->backend);
918 if (!sway_assert(renderer != NULL, 918 if (!sway_assert(renderer != NULL,
919 "expected the output backend to have a renderer")) { 919 "expected the output backend to have a renderer")) {
920 return; 920 return;
921 } 921 }
922 922
923 struct sway_workspace *workspace = output->current.active_workspace;
924 if (workspace == NULL) {
925 return;
926 }
927
923 wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); 928 wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height);
924 929
925 if (!pixman_region32_not_empty(damage)) { 930 if (!pixman_region32_not_empty(damage)) {
@@ -935,13 +940,11 @@ void output_render(struct sway_output *output, struct timespec *when,
935 pixman_region32_union_rect(damage, damage, 0, 0, width, height); 940 pixman_region32_union_rect(damage, damage, 0, 0, width, height);
936 } 941 }
937 942
938 struct sway_workspace *workspace = output->current.active_workspace;
939 struct sway_container *fullscreen_con = workspace->current.fullscreen;
940
941 if (output_has_opaque_overlay_layer_surface(output)) { 943 if (output_has_opaque_overlay_layer_surface(output)) {
942 goto render_overlay; 944 goto render_overlay;
943 } 945 }
944 946
947 struct sway_container *fullscreen_con = workspace->current.fullscreen;
945 if (fullscreen_con) { 948 if (fullscreen_con) {
946 float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; 949 float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
947 950
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c
index 88404703..325aa61a 100644
--- a/swaybar/i3bar.c
+++ b/swaybar/i3bar.c
@@ -117,7 +117,9 @@ bool i3bar_handle_readable(struct status_line *status) {
117 memmove(status->buffer, &status->buffer[c], status->buffer_index); 117 memmove(status->buffer, &status->buffer[c], status->buffer_index);
118 break; 118 break;
119 } else if (!isspace(status->buffer[c])) { 119 } else if (!isspace(status->buffer[c])) {
120 status_error(status, "[invalid json]"); 120 wlr_log(WLR_DEBUG, "Invalid i3bar json: expected '[' but encountered '%c'",
121 status->buffer[c]);
122 status_error(status, "[invalid i3bar json]");
121 return true; 123 return true;
122 } 124 }
123 } 125 }
@@ -155,6 +157,8 @@ bool i3bar_handle_readable(struct status_line *status) {
155 ++buffer_pos; 157 ++buffer_pos;
156 break; 158 break;
157 } else if (!isspace(status->buffer[buffer_pos])) { 159 } else if (!isspace(status->buffer[buffer_pos])) {
160 wlr_log(WLR_DEBUG, "Invalid i3bar json: expected ',' but encountered '%c'",
161 status->buffer[buffer_pos]);
158 status_error(status, "[invalid i3bar json]"); 162 status_error(status, "[invalid i3bar json]");
159 return true; 163 return true;
160 } 164 }
@@ -166,7 +170,8 @@ bool i3bar_handle_readable(struct status_line *status) {
166 } else { 170 } else {
167 test_object = json_tokener_parse_ex(status->tokener, 171 test_object = json_tokener_parse_ex(status->tokener,
168 &status->buffer[buffer_pos], status->buffer_index - buffer_pos); 172 &status->buffer[buffer_pos], status->buffer_index - buffer_pos);
169 if (json_tokener_get_error(status->tokener) == json_tokener_success) { 173 enum json_tokener_error err = json_tokener_get_error(status->tokener);
174 if (err == json_tokener_success) {
170 if (json_object_get_type(test_object) == json_type_array) { 175 if (json_object_get_type(test_object) == json_type_array) {
171 if (last_object) { 176 if (last_object) {
172 json_object_put(last_object); 177 json_object_put(last_object);
@@ -198,12 +203,14 @@ bool i3bar_handle_readable(struct status_line *status) {
198 continue; // look for comma without reading more input 203 continue; // look for comma without reading more input
199 } 204 }
200 buffer_pos = status->buffer_index = 0; 205 buffer_pos = status->buffer_index = 0;
201 } else if (json_tokener_get_error(status->tokener) == json_tokener_continue) { 206 } else if (err == json_tokener_continue) {
207 json_tokener_reset(status->tokener);
202 if (status->buffer_index < status->buffer_size) { 208 if (status->buffer_index < status->buffer_size) {
203 // move the object to the start of the buffer 209 // move the object to the start of the buffer
204 status->buffer_index -= buffer_pos; 210 status->buffer_index -= buffer_pos;
205 memmove(status->buffer, &status->buffer[buffer_pos], 211 memmove(status->buffer, &status->buffer[buffer_pos],
206 status->buffer_index); 212 status->buffer_index);
213 buffer_pos = 0;
207 } else { 214 } else {
208 // expand buffer 215 // expand buffer
209 status->buffer_size *= 2; 216 status->buffer_size *= 2;
@@ -217,6 +224,10 @@ bool i3bar_handle_readable(struct status_line *status) {
217 } 224 }
218 } 225 }
219 } else { 226 } else {
227 char last_char = status->buffer[status->buffer_index - 1];
228 status->buffer[status->buffer_index - 1] = '\0';
229 wlr_log(WLR_DEBUG, "Failed to parse i3bar json - %s: '%s%c'",
230 json_tokener_error_desc(err), &status->buffer[buffer_pos], last_char);
220 status_error(status, "[failed to parse i3bar json]"); 231 status_error(status, "[failed to parse i3bar json]");
221 return true; 232 return true;
222 } 233 }