Skip to content

Commit

Permalink
Revert changes from #1926 & #1877 (#1949)
Browse files Browse the repository at this point in the history
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
  • Loading branch information
Caellian authored Jun 1, 2024
1 parent e99d917 commit 0bc625f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/display-wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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())); }
}

Expand Down
2 changes: 1 addition & 1 deletion src/display-x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ bool handle_event<x_event_handler::CONFIGURE>(
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())); }
}

Expand Down

0 comments on commit 0bc625f

Please sign in to comment.