diff --git a/src/conky.cc b/src/conky.cc index 2a60adf2..6de676c3 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -858,7 +858,7 @@ void update_text_area() { if (fixed_size == 0) #endif { - text_size = conky::vec2i(dpi_scale(minimum_width.get(*state)), 0); + text_size = conky::vec2i(minimum_width.get(*state), 0); last_font_height = font_height(); for_each_line(text_buffer, text_size_updater); text_size += conky::vec2i::UnitX(); @@ -984,7 +984,7 @@ static int text_size_updater(char *s, int special_index) { if (w > text_size.x()) { text_size.set_x(w); } int mw = maximum_width.get(*state); - if (text_size.x() > mw && mw > 0) { text_size.set_x(mw); } + if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); } text_size += conky::vec2i(0, last_font_height); last_font_height = font_height(); diff --git a/src/display-wayland.cc b/src/display-wayland.cc index e1c2f9d0..ae80f5f9 100644 --- a/src/display-wayland.cc +++ b/src/display-wayland.cc @@ -661,8 +661,8 @@ bool display_output_wayland::main_loop_wait(double t) { text_size.y() + 2 * border_total != height || scale_changed)) { /* clamp text_width to configured maximum */ if (maximum_width.get(*state)) { - int mw = global_window->scale * maximum_width.get(*state); - if (text_size.x() > mw && mw > 0) { text_size.set_x(mw); } + int mw = maximum_width.get(*state); + if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); } } /* pending scale will be applied by resizing the window */ diff --git a/src/display-x11.cc b/src/display-x11.cc index bda18b0f..a7a4d98c 100644 --- a/src/display-x11.cc +++ b/src/display-x11.cc @@ -666,7 +666,7 @@ bool handle_event( // don't apply dpi scaling to max pixel size int mw = maximum_width.get(*state); - if (text_size.x() > mw && mw > 0) { text_size.set_x(mw); } + if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); } } /* if position isn't what expected, set fixed pos