diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-02 17:00:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 17:00:33 +0200 |
commit | 4e4d0c519140ae9c7c90e358d18bd6cd75413e30 (patch) | |
tree | c2c92b7a400a669b7232b825bb73ddbe980f2802 /swaybar/i3bar.c | |
parent | Merge pull request #2745 from RyanDwyer/fix-focus-inactive-on-destroy (diff) | |
parent | swaybar: add leading comma to click event JSON (diff) | |
download | sway-4e4d0c519140ae9c7c90e358d18bd6cd75413e30.tar.gz sway-4e4d0c519140ae9c7c90e358d18bd6cd75413e30.tar.zst sway-4e4d0c519140ae9c7c90e358d18bd6cd75413e30.zip |
Merge pull request #2749 from ianyfan/swaybar
swaybar: add leading comma to click event JSON
Diffstat (limited to 'swaybar/i3bar.c')
-rw-r--r-- | swaybar/i3bar.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index 8e9b038b..1d754808 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c | |||
@@ -260,7 +260,7 @@ bool i3bar_handle_readable(struct status_line *status) { | |||
260 | 260 | ||
261 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | 261 | enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, |
262 | struct i3bar_block *block, int x, int y, enum x11_button button) { | 262 | struct i3bar_block *block, int x, int y, enum x11_button button) { |
263 | wlr_log(WLR_DEBUG, "block %s clicked", block->name ? block->name : "(nil)"); | 263 | wlr_log(WLR_DEBUG, "block %s clicked", block->name); |
264 | if (!block->name || !status->click_events) { | 264 | if (!block->name || !status->click_events) { |
265 | return HOTSPOT_PROCESS; | 265 | return HOTSPOT_PROCESS; |
266 | } | 266 | } |
@@ -276,10 +276,11 @@ enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, | |||
276 | json_object_object_add(event_json, "button", json_object_new_int(button)); | 276 | json_object_object_add(event_json, "button", json_object_new_int(button)); |
277 | json_object_object_add(event_json, "x", json_object_new_int(x)); | 277 | json_object_object_add(event_json, "x", json_object_new_int(x)); |
278 | json_object_object_add(event_json, "y", json_object_new_int(y)); | 278 | json_object_object_add(event_json, "y", json_object_new_int(y)); |
279 | if (dprintf(status->write_fd, "%s,\n", | 279 | if (dprintf(status->write_fd, "%s%s\n", status->clicked ? "," : "", |
280 | json_object_to_json_string(event_json)) < 0) { | 280 | json_object_to_json_string(event_json)) < 0) { |
281 | status_error(status, "[failed to write click event]"); | 281 | status_error(status, "[failed to write click event]"); |
282 | } | 282 | } |
283 | status->clicked = true; | ||
283 | json_object_put(event_json); | 284 | json_object_put(event_json); |
284 | return HOTSPOT_IGNORE; | 285 | return HOTSPOT_IGNORE; |
285 | } | 286 | } |