Address review feedback

master
Drew DeVault 7 years ago
parent c4e92c81f5
commit 38bdd4bdeb

@ -319,7 +319,7 @@ void bar_setup(struct swaybar *bar,
} }
pointer->cursor_theme = wl_cursor_theme_load( pointer->cursor_theme = wl_cursor_theme_load(
NULL, 16 * (max_scale * 2), bar->shm); NULL, 24 * max_scale, bar->shm);
assert(pointer->cursor_theme); assert(pointer->cursor_theme);
struct wl_cursor *cursor; struct wl_cursor *cursor;
cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr");

@ -20,7 +20,7 @@ static const double BORDER_WIDTH = 1;
static uint32_t render_status_line_error(cairo_t *cairo, static uint32_t render_status_line_error(cairo_t *cairo,
struct swaybar_output *output, struct swaybar_config *config, struct swaybar_output *output, struct swaybar_config *config,
const char *error, double *x, uint32_t width, uint32_t surface_height) { const char *error, double *x, uint32_t surface_height) {
if (!error) { if (!error) {
return 0; return 0;
} }
@ -51,8 +51,7 @@ static uint32_t render_status_line_error(cairo_t *cairo,
static uint32_t render_status_line_text(cairo_t *cairo, static uint32_t render_status_line_text(cairo_t *cairo,
struct swaybar_output *output, struct swaybar_config *config, struct swaybar_output *output, struct swaybar_config *config,
const char *text, bool focused, double *x, const char *text, bool focused, double *x, uint32_t surface_height) {
uint32_t width, uint32_t surface_height) {
if (!text) { if (!text) {
return 0; return 0;
} }
@ -159,7 +158,7 @@ static uint32_t render_status_block(cairo_t *cairo,
get_text_size(cairo, config->font, &sep_width, &_height, get_text_size(cairo, config->font, &sep_width, &_height,
output->scale, false, "%s", config->sep_symbol); output->scale, false, "%s", config->sep_symbol);
uint32_t _ideal_height = _height + ws_vertical_padding * 2; uint32_t _ideal_height = _height + ws_vertical_padding * 2;
if (height < _ideal_height / output->scale) { if ((uint32_t)_height < _ideal_height / output->scale) {
return _height / output->scale; return _height / output->scale;
} }
if (sep_width > block->separator_block_width) { if (sep_width > block->separator_block_width) {
@ -256,7 +255,7 @@ static uint32_t render_status_block(cairo_t *cairo,
static uint32_t render_status_line_i3bar(cairo_t *cairo, static uint32_t render_status_line_i3bar(cairo_t *cairo,
struct swaybar_config *config, struct swaybar_output *output, struct swaybar_config *config, struct swaybar_output *output,
struct status_line *status, bool focused, struct status_line *status, bool focused,
double *x, uint32_t width, uint32_t surface_height) { double *x, uint32_t surface_height) {
uint32_t max_height = 0; uint32_t max_height = 0;
bool edge = true; bool edge = true;
struct i3bar_block *block; struct i3bar_block *block;
@ -272,17 +271,17 @@ static uint32_t render_status_line_i3bar(cairo_t *cairo,
static uint32_t render_status_line(cairo_t *cairo, static uint32_t render_status_line(cairo_t *cairo,
struct swaybar_config *config, struct swaybar_output *output, struct swaybar_config *config, struct swaybar_output *output,
struct status_line *status, bool focused, struct status_line *status, bool focused,
double *x, uint32_t width, uint32_t surface_height) { double *x, uint32_t surface_height) {
switch (status->protocol) { switch (status->protocol) {
case PROTOCOL_ERROR: case PROTOCOL_ERROR:
return render_status_line_error(cairo, output, config, return render_status_line_error(cairo, output, config,
status->text, x, width, surface_height); status->text, x, surface_height);
case PROTOCOL_TEXT: case PROTOCOL_TEXT:
return render_status_line_text(cairo, output, config, return render_status_line_text(cairo, output, config,
status->text, focused, x, width, surface_height); status->text, focused, x, surface_height);
case PROTOCOL_I3BAR: case PROTOCOL_I3BAR:
return render_status_line_i3bar(cairo, config, output, return render_status_line_i3bar(cairo, config, output,
status, focused, x, width, surface_height); status, focused, x, surface_height);
case PROTOCOL_UNDEF: case PROTOCOL_UNDEF:
return 0; return 0;
} }
@ -368,7 +367,7 @@ static uint32_t render_workspace_button(cairo_t *cairo,
box_colors = config->colors.inactive_workspace; box_colors = config->colors.inactive_workspace;
} }
uint32_t height = surface_height *output->scale; uint32_t height = surface_height * output->scale;
int text_width, text_height; int text_width, text_height;
get_text_size(cairo, config->font, &text_width, &text_height, get_text_size(cairo, config->font, &text_width, &text_height,
@ -442,8 +441,8 @@ static uint32_t render_to_cairo(cairo_t *cairo,
*/ */
double x = output->width * output->scale; double x = output->width * output->scale;
if (bar->status) { if (bar->status) {
uint32_t h = render_status_line(cairo, config, output, bar->status, uint32_t h = render_status_line(cairo, config, output,
output->focused, &x, output->width, output->height); bar->status, output->focused, &x, output->height);
max_height = h > max_height ? h : max_height; max_height = h > max_height ? h : max_height;
} }
x = 0; x = 0;

Loading…
Cancel
Save