diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2019-04-01 16:12:42 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2019-04-01 16:12:42 -0400 |
| commit | cd0fa93c451d30040d1d447401e5e59bdb5408e2 (patch) | |
| tree | 8e0d067c58f8969af0a52bd1edd3f1ee20ebf3c6 | |
| parent | c0336c0d0ce586d208d7d7ed52bafa2114741113 (diff) | |
Ensure predicted position for short text handling doesn't overflow.
- Predicted status line can be negative, so corresponding variables should
not be unsigned. Changed to double as position is actually calculated as
double.
| -rw-r--r-- | swaybar/render.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index faf17509..a0200f0d 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -454,10 +454,11 @@ static uint32_t render_status_line_i3bar(cairo_t *cairo, bool use_short_text = false; // TODO: Add margin here? - uint32_t reserved_width = predict_workspace_buttons_length(cairo, output) + + double reserved_width = + predict_workspace_buttons_length(cairo, output) + predict_binding_mode_indicator_length(cairo, output); - uint32_t predicted_full_pos = + double predicted_full_pos = predict_status_line_pos(cairo, output, *x); if (predicted_full_pos < reserved_width) { |
