Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dpi scaling of minimum_width & maximum_width #1926

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimum_width shouldn't scale either.

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);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't remove maximum_width scaling here.

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
Loading