diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-04-10 07:17:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-10 07:17:47 -0400 |
commit | 5d3a02a7c624bbef07b1b228eb1bb60fade5248c (patch) | |
tree | 35860f43beb1ce46de5a3d780ca33830d4bc9ba4 /sway/border.c | |
parent | 60ce81e06adc9ea133e8cfd030465e94295a95ff (diff) | |
parent | 7fee555a462b001748352da1339c9bcc0e154a3b (diff) |
Merge branch 'master' into pretty-print-swaymsg
Diffstat (limited to 'sway/border.c')
-rw-r--r-- | sway/border.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sway/border.c b/sway/border.c index d79029a9..10ad92c2 100644 --- a/sway/border.c +++ b/sway/border.c @@ -1,8 +1,11 @@ +#define _XOPEN_SOURCE 500 #include <wlc/wlc-render.h> #include <cairo/cairo.h> #include <pango/pangocairo.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> +#include <strings.h> #include <arpa/inet.h> #include "sway/border.h" #include "sway/container.h" @@ -190,6 +193,26 @@ static void render_title_bar(swayc_t *view, cairo_t *cr, struct wlc_geometry *b, cairo_set_source_u32(cr, colors->text); pango_printf(cr, config->font, 1, false, "%s", view->name); } + // Marks + if (config->show_marks && view->marks) { + int total_len = 0; + + for(int i = view->marks->length - 1; i >= 0; --i) { + char *mark = (char *)view->marks->items[i]; + if (*mark != '_') { + int width, height; + get_text_size(cr, config->font, &width, &height, 1, false, "[%s]", mark); + total_len += width; + if ((int)tb->size.w + x - (total_len + 2) < x + 2) { + break; + } else { + cairo_move_to(cr, (int)tb->size.w + x - (total_len + 2), y + 2); + cairo_set_source_u32(cr, colors->text); + pango_printf(cr, config->font, 1, false, "[%s]", mark); + } + } + } + } // titlebars has a border all around for tabbed layouts if (view->parent->layout == L_TABBED) { |