aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-03 22:52:40 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-04-03 22:52:40 -0400
commit38bdd4bdebc4938f25af90bc4f79e278f61808e0 (patch)
treef7500132c44c86713b4be66bcb8a6fd854678b20 /swaybar
parentAdjust height calculation, naming (diff)
downloadsway-38bdd4bdebc4938f25af90bc4f79e278f61808e0.tar.gz
sway-38bdd4bdebc4938f25af90bc4f79e278f61808e0.tar.zst
sway-38bdd4bdebc4938f25af90bc4f79e278f61808e0.zip
Address review feedback
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/bar.c2
-rw-r--r--swaybar/render.c23
2 files changed, 12 insertions, 13 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index b617f9ab..ea0141cc 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -319,7 +319,7 @@ void bar_setup(struct swaybar *bar,
319 } 319 }
320 320
321 pointer->cursor_theme = wl_cursor_theme_load( 321 pointer->cursor_theme = wl_cursor_theme_load(
322 NULL, 16 * (max_scale * 2), bar->shm); 322 NULL, 24 * max_scale, bar->shm);
323 assert(pointer->cursor_theme); 323 assert(pointer->cursor_theme);
324 struct wl_cursor *cursor; 324 struct wl_cursor *cursor;
325 cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); 325 cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr");
diff --git a/swaybar/render.c b/swaybar/render.c
index 1f84fdba..be58301d 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -20,7 +20,7 @@ static const double BORDER_WIDTH = 1;
20 20
21static uint32_t render_status_line_error(cairo_t *cairo, 21static uint32_t render_status_line_error(cairo_t *cairo,
22 struct swaybar_output *output, struct swaybar_config *config, 22 struct swaybar_output *output, struct swaybar_config *config,
23 const char *error, double *x, uint32_t width, uint32_t surface_height) { 23 const char *error, double *x, uint32_t surface_height) {
24 if (!error) { 24 if (!error) {
25 return 0; 25 return 0;
26 } 26 }
@@ -51,8 +51,7 @@ static uint32_t render_status_line_error(cairo_t *cairo,
51 51
52static uint32_t render_status_line_text(cairo_t *cairo, 52static uint32_t render_status_line_text(cairo_t *cairo,
53 struct swaybar_output *output, struct swaybar_config *config, 53 struct swaybar_output *output, struct swaybar_config *config,
54 const char *text, bool focused, double *x, 54 const char *text, bool focused, double *x, uint32_t surface_height) {
55 uint32_t width, uint32_t surface_height) {
56 if (!text) { 55 if (!text) {
57 return 0; 56 return 0;
58 } 57 }
@@ -159,7 +158,7 @@ static uint32_t render_status_block(cairo_t *cairo,
159 get_text_size(cairo, config->font, &sep_width, &_height, 158 get_text_size(cairo, config->font, &sep_width, &_height,
160 output->scale, false, "%s", config->sep_symbol); 159 output->scale, false, "%s", config->sep_symbol);
161 uint32_t _ideal_height = _height + ws_vertical_padding * 2; 160 uint32_t _ideal_height = _height + ws_vertical_padding * 2;
162 if (height < _ideal_height / output->scale) { 161 if ((uint32_t)_height < _ideal_height / output->scale) {
163 return _height / output->scale; 162 return _height / output->scale;
164 } 163 }
165 if (sep_width > block->separator_block_width) { 164 if (sep_width > block->separator_block_width) {
@@ -256,7 +255,7 @@ static uint32_t render_status_block(cairo_t *cairo,
256static uint32_t render_status_line_i3bar(cairo_t *cairo, 255static uint32_t render_status_line_i3bar(cairo_t *cairo,
257 struct swaybar_config *config, struct swaybar_output *output, 256 struct swaybar_config *config, struct swaybar_output *output,
258 struct status_line *status, bool focused, 257 struct status_line *status, bool focused,
259 double *x, uint32_t width, uint32_t surface_height) { 258 double *x, uint32_t surface_height) {
260 uint32_t max_height = 0; 259 uint32_t max_height = 0;
261 bool edge = true; 260 bool edge = true;
262 struct i3bar_block *block; 261 struct i3bar_block *block;
@@ -272,17 +271,17 @@ static uint32_t render_status_line_i3bar(cairo_t *cairo,
272static uint32_t render_status_line(cairo_t *cairo, 271static uint32_t render_status_line(cairo_t *cairo,
273 struct swaybar_config *config, struct swaybar_output *output, 272 struct swaybar_config *config, struct swaybar_output *output,
274 struct status_line *status, bool focused, 273 struct status_line *status, bool focused,
275 double *x, uint32_t width, uint32_t surface_height) { 274 double *x, uint32_t surface_height) {
276 switch (status->protocol) { 275 switch (status->protocol) {
277 case PROTOCOL_ERROR: 276 case PROTOCOL_ERROR:
278 return render_status_line_error(cairo, output, config, 277 return render_status_line_error(cairo, output, config,
279 status->text, x, width, surface_height); 278 status->text, x, surface_height);
280 case PROTOCOL_TEXT: 279 case PROTOCOL_TEXT:
281 return render_status_line_text(cairo, output, config, 280 return render_status_line_text(cairo, output, config,
282 status->text, focused, x, width, surface_height); 281 status->text, focused, x, surface_height);
283 case PROTOCOL_I3BAR: 282 case PROTOCOL_I3BAR:
284 return render_status_line_i3bar(cairo, config, output, 283 return render_status_line_i3bar(cairo, config, output,
285 status, focused, x, width, surface_height); 284 status, focused, x, surface_height);
286 case PROTOCOL_UNDEF: 285 case PROTOCOL_UNDEF:
287 return 0; 286 return 0;
288 } 287 }
@@ -368,7 +367,7 @@ static uint32_t render_workspace_button(cairo_t *cairo,
368 box_colors = config->colors.inactive_workspace; 367 box_colors = config->colors.inactive_workspace;
369 } 368 }
370 369
371 uint32_t height = surface_height *output->scale; 370 uint32_t height = surface_height * output->scale;
372 371
373 int text_width, text_height; 372 int text_width, text_height;
374 get_text_size(cairo, config->font, &text_width, &text_height, 373 get_text_size(cairo, config->font, &text_width, &text_height,
@@ -442,8 +441,8 @@ static uint32_t render_to_cairo(cairo_t *cairo,
442 */ 441 */
443 double x = output->width * output->scale; 442 double x = output->width * output->scale;
444 if (bar->status) { 443 if (bar->status) {
445 uint32_t h = render_status_line(cairo, config, output, bar->status, 444 uint32_t h = render_status_line(cairo, config, output,
446 output->focused, &x, output->width, output->height); 445 bar->status, output->focused, &x, output->height);
447 max_height = h > max_height ? h : max_height; 446 max_height = h > max_height ? h : max_height;
448 } 447 }
449 x = 0; 448 x = 0;