diff options
author | 2017-06-14 18:53:40 -0400 | |
---|---|---|
committer | 2017-06-14 18:53:40 -0400 | |
commit | 298f56353ef155f6a2ccc977c96b2ff5d971e65e (patch) | |
tree | dcb3b74f1dde93bce8657b7509662ffd7db667d0 /swaybar/render.c | |
parent | Implement KDE's server-side decoration protocol (diff) | |
parent | Merge pull request #1234 from 4e554c4c/tray (diff) | |
download | sway-298f56353ef155f6a2ccc977c96b2ff5d971e65e.tar.gz sway-298f56353ef155f6a2ccc977c96b2ff5d971e65e.tar.zst sway-298f56353ef155f6a2ccc977c96b2ff5d971e65e.zip |
Merge branch 'master' into server-decoration
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 2eae997f..6ec47e79 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -8,6 +8,10 @@ | |||
8 | #include "swaybar/config.h" | 8 | #include "swaybar/config.h" |
9 | #include "swaybar/status_line.h" | 9 | #include "swaybar/status_line.h" |
10 | #include "swaybar/render.h" | 10 | #include "swaybar/render.h" |
11 | #ifdef ENABLE_TRAY | ||
12 | #include "swaybar/tray/tray.h" | ||
13 | #include "swaybar/tray/sni.h" | ||
14 | #endif | ||
11 | #include "log.h" | 15 | #include "log.h" |
12 | 16 | ||
13 | 17 | ||
@@ -297,6 +301,12 @@ void render(struct output *output, struct config *config, struct status_line *li | |||
297 | } | 301 | } |
298 | cairo_paint(cairo); | 302 | cairo_paint(cairo); |
299 | 303 | ||
304 | #ifdef ENABLE_TRAY | ||
305 | uint32_t tray_width = tray_render(output, config); | ||
306 | #else | ||
307 | const uint32_t tray_width = window->width * window->scale; | ||
308 | #endif | ||
309 | |||
300 | // Command output | 310 | // Command output |
301 | if (is_focused) { | 311 | if (is_focused) { |
302 | cairo_set_source_u32(cairo, config->colors.focused_statusline); | 312 | cairo_set_source_u32(cairo, config->colors.focused_statusline); |
@@ -309,12 +319,11 @@ void render(struct output *output, struct config *config, struct status_line *li | |||
309 | if (line->protocol == TEXT) { | 319 | if (line->protocol == TEXT) { |
310 | get_text_size(window->cairo, window->font, &width, &height, | 320 | get_text_size(window->cairo, window->font, &width, &height, |
311 | window->scale, config->pango_markup, "%s", line->text_line); | 321 | window->scale, config->pango_markup, "%s", line->text_line); |
312 | cairo_move_to(cairo, (window->width * window->scale) | 322 | cairo_move_to(cairo, tray_width - margin - width, margin); |
313 | - margin - width, margin); | ||
314 | pango_printf(window->cairo, window->font, window->scale, | 323 | pango_printf(window->cairo, window->font, window->scale, |
315 | config->pango_markup, "%s", line->text_line); | 324 | config->pango_markup, "%s", line->text_line); |
316 | } else if (line->protocol == I3BAR && line->block_line) { | 325 | } else if (line->protocol == I3BAR && line->block_line) { |
317 | double pos = (window->width * window->scale) - 0.5; | 326 | double pos = tray_width - 0.5; |
318 | bool edge = true; | 327 | bool edge = true; |
319 | for (i = line->block_line->length - 1; i >= 0; --i) { | 328 | for (i = line->block_line->length - 1; i >= 0; --i) { |
320 | struct status_block *block = line->block_line->items[i]; | 329 | struct status_block *block = line->block_line->items[i]; |