1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-06 05:58:36 +00:00

Revert changes from #1926 & #1877 (#1949)

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
This commit is contained in:
Tin Švagelj 2024-06-01 16:38:16 +02:00 committed by GitHub
parent e99d9171de
commit 0bc625fdea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 9 deletions

View File

@ -858,13 +858,12 @@ void update_text_area() {
if (fixed_size == 0) if (fixed_size == 0)
#endif #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(); last_font_height = font_height();
for_each_line(text_buffer, text_size_updater); 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))); text_size = text_size.max(conky::vec2i(text_size.x() + 1, minimum_height.get(*state)));
int mw = maximum_width.get(*state); int mw = dpi_scale(maximum_width.get(*state));
if (mw > 0) text_size = text_size.min(conky::vec2i(mw, text_size.y())); 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); w += get_string_width(s);
if (w > text_size.x()) { text_size.set_x(w); } 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())); } if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); }
text_size += conky::vec2i(0, last_font_height); text_size += conky::vec2i(0, last_font_height);
@ -1047,7 +1046,7 @@ static void draw_string(const char *s) {
} }
#ifdef BUILD_GUI #ifdef BUILD_GUI
if (display_output() && display_output()->graphical()) { 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) { if (text_size.x() == mw) {
/* this means the text is probably pushing the limit, /* this means the text is probably pushing the limit,
* so we'll chop it */ * 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 #ifdef BUILD_GUI
int font_h = 0; int font_h = 0;
int cur_y_add = 0; int cur_y_add = 0;
int mw = maximum_width.get(*state); int mw = dpi_scale(maximum_width.get(*state));
#endif /* BUILD_GUI */ #endif /* BUILD_GUI */
char *p = s; char *p = s;
int orig_special_index = special_index; int orig_special_index = special_index;

View File

@ -661,7 +661,7 @@ bool display_output_wayland::main_loop_wait(double t) {
text_size.y() + 2 * border_total != height || scale_changed)) { text_size.y() + 2 * border_total != height || scale_changed)) {
/* clamp text_width to configured maximum */ /* clamp text_width to configured maximum */
if (maximum_width.get(*state)) { 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())); } if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); }
} }

View File

@ -665,7 +665,7 @@ bool handle_event<x_event_handler::CONFIGURE>(
text_size = window.geometry.size() - border_total; text_size = window.geometry.size() - border_total;
// don't apply dpi scaling to max pixel size // 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())); } if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); }
} }