From 0bc625fdeac2d576201ec0f4d410b7d9b807a92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tin=20=C5=A0vagelj?= Date: Sat, 1 Jun 2024 16:38:16 +0200 Subject: [PATCH] Revert changes from #1926 & #1877 (#1949) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tin Å vagelj --- src/conky.cc | 13 ++++++------- src/display-wayland.cc | 2 +- src/display-x11.cc | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/conky.cc b/src/conky.cc index 2c89f4470..8fc6c9f04 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -858,13 +858,12 @@ void update_text_area() { if (fixed_size == 0) #endif { - text_size = conky::vec2i(minimum_width.get(*state), 0); + text_size = conky::vec2i(dpi_scale(minimum_width.get(*state)), 0); last_font_height = font_height(); for_each_line(text_buffer, text_size_updater); - text_size += conky::vec2i::UnitX(); - text_size = text_size.max(conky::vec2i(text_size.x(), minimum_height.get(*state))); - int mw = maximum_width.get(*state); + text_size = text_size.max(conky::vec2i(text_size.x() + 1, minimum_height.get(*state))); + int mw = dpi_scale(maximum_width.get(*state)); if (mw > 0) text_size = text_size.min(conky::vec2i(mw, text_size.y())); } @@ -983,7 +982,7 @@ static int text_size_updater(char *s, int special_index) { w += get_string_width(s); if (w > text_size.x()) { text_size.set_x(w); } - int mw = maximum_width.get(*state); + int mw = dpi_scale(maximum_width.get(*state)); if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); } text_size += conky::vec2i(0, last_font_height); @@ -1047,7 +1046,7 @@ static void draw_string(const char *s) { } #ifdef BUILD_GUI if (display_output() && display_output()->graphical()) { - int mw = maximum_width.get(*state); + int mw = dpi_scale(maximum_width.get(*state)); if (text_size.x() == mw) { /* this means the text is probably pushing the limit, * so we'll chop it */ @@ -1106,7 +1105,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) { #ifdef BUILD_GUI int font_h = 0; int cur_y_add = 0; - int mw = maximum_width.get(*state); + int mw = dpi_scale(maximum_width.get(*state)); #endif /* BUILD_GUI */ char *p = s; int orig_special_index = special_index; diff --git a/src/display-wayland.cc b/src/display-wayland.cc index ae80f5f9e..937c58c41 100644 --- a/src/display-wayland.cc +++ b/src/display-wayland.cc @@ -661,7 +661,7 @@ 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 = maximum_width.get(*state); + int mw = global_window->scale * maximum_width.get(*state); if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); } } diff --git a/src/display-x11.cc b/src/display-x11.cc index a7a4d98c6..59e707131 100644 --- a/src/display-x11.cc +++ b/src/display-x11.cc @@ -665,7 +665,7 @@ bool handle_event( text_size = window.geometry.size() - border_total; // don't apply dpi scaling to max pixel size - int mw = maximum_width.get(*state); + int mw = dpi_scale(maximum_width.get(*state)); if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); } }