diff options
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 327a6f5f..6f370077 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -108,11 +108,11 @@ static void render_sharp_line(cairo_t *cairo, uint32_t color, | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | static void block_hotspot_callback(struct swaybar_output *output, | 111 | static enum hotspot_event_handling block_hotspot_callback(struct swaybar_output *output, |
112 | int x, int y, uint32_t button, void *data) { | 112 | int x, int y, enum x11_button button, void *data) { |
113 | struct i3bar_block *block = data; | 113 | struct i3bar_block *block = data; |
114 | struct status_line *status = output->bar->status; | 114 | struct status_line *status = output->bar->status; |
115 | i3bar_block_send_click(status, block, x, y, button); | 115 | return i3bar_block_send_click(status, block, x, y, button); |
116 | } | 116 | } |
117 | 117 | ||
118 | static uint32_t render_status_block(cairo_t *cairo, | 118 | static uint32_t render_status_block(cairo_t *cairo, |
@@ -298,7 +298,8 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo, | |||
298 | 298 | ||
299 | int text_width, text_height; | 299 | int text_width, text_height; |
300 | get_text_size(cairo, config->font, &text_width, &text_height, | 300 | get_text_size(cairo, config->font, &text_width, &text_height, |
301 | output->scale, config->pango_markup, "%s", mode); | 301 | output->scale, config->mode_pango_markup, |
302 | "%s", mode); | ||
302 | 303 | ||
303 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; | 304 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; |
304 | int ws_horizontal_padding = WS_HORIZONTAL_PADDING * output->scale; | 305 | int ws_horizontal_padding = WS_HORIZONTAL_PADDING * output->scale; |
@@ -329,7 +330,7 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo, | |||
329 | double text_y = height / 2.0 - text_height / 2.0; | 330 | double text_y = height / 2.0 - text_height / 2.0; |
330 | cairo_set_source_u32(cairo, config->colors.binding_mode.text); | 331 | cairo_set_source_u32(cairo, config->colors.binding_mode.text); |
331 | cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); | 332 | cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); |
332 | pango_printf(cairo, config->font, output->scale, config->pango_markup, | 333 | pango_printf(cairo, config->font, output->scale, config->mode_pango_markup, |
333 | "%s", mode); | 334 | "%s", mode); |
334 | return surface_height; | 335 | return surface_height; |
335 | } | 336 | } |
@@ -347,9 +348,13 @@ static const char *strip_workspace_number(const char *ws_name) { | |||
347 | return ws_name; | 348 | return ws_name; |
348 | } | 349 | } |
349 | 350 | ||
350 | static void workspace_hotspot_callback(struct swaybar_output *output, | 351 | static enum hotspot_event_handling workspace_hotspot_callback(struct swaybar_output *output, |
351 | int x, int y, uint32_t button, void *data) { | 352 | int x, int y, enum x11_button button, void *data) { |
353 | if (button != LEFT) { | ||
354 | return HOTSPOT_PROCESS; | ||
355 | } | ||
352 | ipc_send_workspace_command(output->bar, (const char *)data); | 356 | ipc_send_workspace_command(output->bar, (const char *)data); |
357 | return HOTSPOT_IGNORE; | ||
353 | } | 358 | } |
354 | 359 | ||
355 | static uint32_t render_workspace_button(cairo_t *cairo, | 360 | static uint32_t render_workspace_button(cairo_t *cairo, |
@@ -496,12 +501,15 @@ void render_frame(struct swaybar *bar, struct swaybar_output *output) { | |||
496 | // different height than what we asked for | 501 | // different height than what we asked for |
497 | wl_surface_commit(output->surface); | 502 | wl_surface_commit(output->surface); |
498 | wl_display_roundtrip(bar->display); | 503 | wl_display_roundtrip(bar->display); |
499 | } else { | 504 | } else if (height > 0) { |
500 | // Replay recording into shm and send it off | 505 | // Replay recording into shm and send it off |
501 | output->current_buffer = get_next_buffer(bar->shm, | 506 | output->current_buffer = get_next_buffer(bar->shm, |
502 | output->buffers, | 507 | output->buffers, |
503 | output->width * output->scale, | 508 | output->width * output->scale, |
504 | output->height * output->scale); | 509 | output->height * output->scale); |
510 | if (!output->current_buffer) { | ||
511 | return; | ||
512 | } | ||
505 | cairo_t *shm = output->current_buffer->cairo; | 513 | cairo_t *shm = output->current_buffer->cairo; |
506 | 514 | ||
507 | cairo_save(shm); | 515 | cairo_save(shm); |