Skip to content

Commit

Permalink
Cleanup remaining dpi scaling of min & max width (#1926)
Browse files Browse the repository at this point in the history
This was left over from #1877.
  • Loading branch information
Caellian committed May 22, 2024
1 parent 682db0c commit 7526e7e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/display-wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/display-x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ bool handle_event<x_event_handler::CONFIGURE>(

// 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
Expand Down

0 comments on commit 7526e7e

Please sign in to comment.