aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Dmitri Kourennyi <dkour@mykolab.com>2019-04-01 16:12:42 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-04-04 14:14:08 -0600
commit94dc57f3c5e147ebcb378104d51352c33f2fa9da (patch)
tree8e0d067c58f8969af0a52bd1edd3f1ee20ebf3c6 /swaybar
parentImplement handling of short_text field of i3 input protocol. (diff)
downloadsway-94dc57f3c5e147ebcb378104d51352c33f2fa9da.tar.gz
sway-94dc57f3c5e147ebcb378104d51352c33f2fa9da.tar.zst
sway-94dc57f3c5e147ebcb378104d51352c33f2fa9da.zip
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.
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/render.c5
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,
454 bool use_short_text = false; 454 bool use_short_text = false;
455 455
456 // TODO: Add margin here? 456 // TODO: Add margin here?
457 uint32_t reserved_width = predict_workspace_buttons_length(cairo, output) + 457 double reserved_width =
458 predict_workspace_buttons_length(cairo, output) +
458 predict_binding_mode_indicator_length(cairo, output); 459 predict_binding_mode_indicator_length(cairo, output);
459 460
460 uint32_t predicted_full_pos = 461 double predicted_full_pos =
461 predict_status_line_pos(cairo, output, *x); 462 predict_status_line_pos(cairo, output, *x);
462 463
463 if (predicted_full_pos < reserved_width) { 464 if (predicted_full_pos < reserved_width) {