summaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-28 22:22:46 +0200
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-30 00:47:58 +0200
commitcefcce48aad4e452be9d081b1cd1521e2b042e97 (patch)
treea1baadb89b2d94f63175f61c2459d77cd2819ab4 /swaybar
parentMake pango: prefix optional for font config (diff)
downloadsway-cefcce48aad4e452be9d081b1cd1521e2b042e97.tar.gz
sway-cefcce48aad4e452be9d081b1cd1521e2b042e97.tar.zst
sway-cefcce48aad4e452be9d081b1cd1521e2b042e97.zip
Make client/pango.h not depend on client/window.h
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/render.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index 1573a373..fff47ab0 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -50,7 +50,7 @@ static void render_sharp_line(cairo_t *cairo, uint32_t color, double x, double y
50 50
51static void render_block(struct window *window, struct config *config, struct status_block *block, double *x, bool edge) { 51static void render_block(struct window *window, struct config *config, struct status_block *block, double *x, bool edge) {
52 int width, height, sep_width; 52 int width, height, sep_width;
53 get_text_size(window, &width, &height, "%s", block->full_text); 53 get_text_size(window->cairo, window->font, &width, &height, "%s", block->full_text);
54 54
55 int textwidth = width; 55 int textwidth = width;
56 double block_width = width; 56 double block_width = width;
@@ -74,7 +74,7 @@ static void render_block(struct window *window, struct config *config, struct st
74 // Add separator 74 // Add separator
75 if (!edge) { 75 if (!edge) {
76 if (config->sep_symbol) { 76 if (config->sep_symbol) {
77 get_text_size(window, &sep_width, &height, "%s", config->sep_symbol); 77 get_text_size(window->cairo, window->font, &sep_width, &height, "%s", config->sep_symbol);
78 if (sep_width > block->separator_block_width) { 78 if (sep_width > block->separator_block_width) {
79 block->separator_block_width = sep_width + margin * 2; 79 block->separator_block_width = sep_width + margin * 2;
80 } 80 }
@@ -136,7 +136,7 @@ static void render_block(struct window *window, struct config *config, struct st
136 136
137 cairo_move_to(window->cairo, offset, margin); 137 cairo_move_to(window->cairo, offset, margin);
138 cairo_set_source_u32(window->cairo, block->color); 138 cairo_set_source_u32(window->cairo, block->color);
139 pango_printf(window, "%s", block->full_text); 139 pango_printf(window->cairo, window->font, "%s", block->full_text);
140 140
141 pos += width; 141 pos += width;
142 142
@@ -159,7 +159,7 @@ static void render_block(struct window *window, struct config *config, struct st
159 if (config->sep_symbol) { 159 if (config->sep_symbol) {
160 offset = pos + (block->separator_block_width - sep_width) / 2; 160 offset = pos + (block->separator_block_width - sep_width) / 2;
161 cairo_move_to(window->cairo, offset, margin); 161 cairo_move_to(window->cairo, offset, margin);
162 pango_printf(window, "%s", config->sep_symbol); 162 pango_printf(window->cairo, window->font, "%s", config->sep_symbol);
163 } else { 163 } else {
164 cairo_set_line_width(window->cairo, 1); 164 cairo_set_line_width(window->cairo, 1);
165 cairo_move_to(window->cairo, pos + block->separator_block_width/2, 165 cairo_move_to(window->cairo, pos + block->separator_block_width/2,
@@ -201,7 +201,7 @@ static void render_workspace_button(struct window *window, struct config *config
201 char *name = handle_workspace_number(config->strip_workspace_numbers, ws->name); 201 char *name = handle_workspace_number(config->strip_workspace_numbers, ws->name);
202 202
203 int width, height; 203 int width, height;
204 get_text_size(window, &width, &height, "%s", name); 204 get_text_size(window->cairo, window->font, &width, &height, "%s", name);
205 struct box_colors box_colors; 205 struct box_colors box_colors;
206 if (ws->urgent) { 206 if (ws->urgent) {
207 box_colors = config->colors.urgent_workspace; 207 box_colors = config->colors.urgent_workspace;
@@ -228,7 +228,7 @@ static void render_workspace_button(struct window *window, struct config *config
228 // text 228 // text
229 cairo_set_source_u32(window->cairo, box_colors.text); 229 cairo_set_source_u32(window->cairo, box_colors.text);
230 cairo_move_to(window->cairo, (int)*x + ws_horizontal_padding, margin); 230 cairo_move_to(window->cairo, (int)*x + ws_horizontal_padding, margin);
231 pango_printf(window, "%s", name); 231 pango_printf(window->cairo, window->font, "%s", name);
232 232
233 *x += width + ws_horizontal_padding * 2 + ws_spacing; 233 *x += width + ws_horizontal_padding * 2 + ws_spacing;
234 234
@@ -237,7 +237,7 @@ static void render_workspace_button(struct window *window, struct config *config
237 237
238static void render_binding_mode_indicator(struct window *window, struct config *config, double pos) { 238static void render_binding_mode_indicator(struct window *window, struct config *config, double pos) {
239 int width, height; 239 int width, height;
240 get_text_size(window, &width, &height, "%s", config->mode); 240 get_text_size(window->cairo, window->font, &width, &height, "%s", config->mode);
241 241
242 // background 242 // background
243 cairo_set_source_u32(window->cairo, config->colors.binding_mode.background); 243 cairo_set_source_u32(window->cairo, config->colors.binding_mode.background);
@@ -254,7 +254,7 @@ static void render_binding_mode_indicator(struct window *window, struct config *
254 // text 254 // text
255 cairo_set_source_u32(window->cairo, config->colors.binding_mode.text); 255 cairo_set_source_u32(window->cairo, config->colors.binding_mode.text);
256 cairo_move_to(window->cairo, (int)pos + ws_horizontal_padding, margin); 256 cairo_move_to(window->cairo, (int)pos + ws_horizontal_padding, margin);
257 pango_printf(window, "%s", config->mode); 257 pango_printf(window->cairo, window->font, "%s", config->mode);
258} 258}
259 259
260void render(struct output *output, struct config *config, struct status_line *line) { 260void render(struct output *output, struct config *config, struct status_line *line) {
@@ -278,9 +278,9 @@ void render(struct output *output, struct config *config, struct status_line *li
278 int width, height; 278 int width, height;
279 279
280 if (line->protocol == TEXT) { 280 if (line->protocol == TEXT) {
281 get_text_size(window, &width, &height, "%s", line->text_line); 281 get_text_size(window->cairo, window->font, &width, &height, "%s", line->text_line);
282 cairo_move_to(cairo, window->width - margin - width, margin); 282 cairo_move_to(cairo, window->width - margin - width, margin);
283 pango_printf(window, "%s", line->text_line); 283 pango_printf(window->cairo, window->font, "%s", line->text_line);
284 } else if (line->protocol == I3BAR && line->block_line) { 284 } else if (line->protocol == I3BAR && line->block_line) {
285 double pos = window->width - 0.5; 285 double pos = window->width - 0.5;
286 bool edge = true; 286 bool edge = true;
@@ -312,7 +312,7 @@ void render(struct output *output, struct config *config, struct status_line *li
312 312
313void set_window_height(struct window *window, int height) { 313void set_window_height(struct window *window, int height) {
314 int text_width, text_height; 314 int text_width, text_height;
315 get_text_size(window, &text_width, &text_height, "Test string for measuring purposes"); 315 get_text_size(window->cairo, window->font, &text_width, &text_height, "Test string for measuring purposes");
316 if (height > 0) { 316 if (height > 0) {
317 margin = (height - text_height) / 2; 317 margin = (height - text_height) / 2;
318 ws_vertical_padding = margin - 1.5; 318 ws_vertical_padding = margin - 1.5;