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

[Bug]: use_xft = true breaks window sizing #1528

Closed
simotek opened this issue May 9, 2023 · 4 comments · Fixed by #1877
Closed

[Bug]: use_xft = true breaks window sizing #1528

simotek opened this issue May 9, 2023 · 4 comments · Fixed by #1877
Labels
bug Bug report or bug fix PR display: x11 Issue related to X11 backend rendering Issue or PR related to rendering

Comments

@simotek
Copy link
Contributor

simotek commented May 9, 2023

What happened?

Window sizing is smaller when use_xft = true is set then when it is not, if a window is a forced size with min_width and max_width being the same then the window size will be slightly smaller then that.

This first image is with use_xft=true the colored temperature shape should be centered
shot-2023-05-09_18-54-42

This second shot is showing everything working properly with it disabled
shot-2023-05-09_18-55-23

Issue is seen running a few day old version of conky from git on openSUSE Tumbleweed

Version

git

Which OS/distro are you seeing the problem on?

Linux (other)

Conky config

https://github.com/philer/polycore  `/opt/conky/bin/conky -c  conkyrc.lua` I had to comment out line 45 of layout.lua to stop a crash as I don't have gpu support.

Stack trace

No response

Relevant log output

No response

@simotek simotek added bug Bug report or bug fix PR triage Issue that hasn't been verified labels May 9, 2023
simotek added a commit to simotek/conky-bubbles that referenced this issue May 9, 2023
Currently it breaks everything lua based on my machine
brndnmtthws/conky#1528 Still manually
use it for the main config though
simotek added a commit to simotek/conky-bubbles that referenced this issue May 9, 2023
Currently it breaks everything lua based on my machine
brndnmtthws/conky#1528 Still manually
use it for the main config though
@Caellian Caellian added wontfix Won't be fixed: not a conky bug, unreasonable effort or can't fix due to external limitations rendering Issue or PR related to rendering and removed triage Issue that hasn't been verified wontfix Won't be fixed: not a conky bug, unreasonable effort or can't fix due to external limitations labels Apr 19, 2024
@Caellian
Copy link
Collaborator

My guess was that font size (glyph width) gets used for window width calculation somehow, but that's not the case.

Closing for now as I can't reproduce (Openbox) with:

conky.config = {
  own_window = true,
  own_window_type = 'override',
  own_window_hints = 'undecorated,sticky,skip_taskbar,skip_pager',
  minimum_width = 500,
  maximum_width = 500,
  use_xft = true,
  font = 'Ubuntu:pixelsize=200',
}
conky.text = [[
  $conky_version
  $conky_version
  $conky_version
]]

Not sure if I'm missing something, but use_xft doesn't have any interaction with window size (besides making it larger if maximum_width not set).

Reopen the issue if you still have it and add which WM you're using.

@Caellian Caellian closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
@Caellian
Copy link
Collaborator

Nvm, reopening the issue, you can close it if it's fixed. Try it with minimal example so we can tell whether something else is at play as well (templates?).

@Caellian Caellian reopened this Apr 19, 2024
@Caellian
Copy link
Collaborator

Caellian commented Apr 20, 2024

I believe I found what causes this.

In configure event handler there's this:

int mw = surface->dpi_scale(maximum_width.get(*state));
if (text_width > mw && mw > 0) { text_width = mw; }

I don't think expected width in pixels should be affected by DPI. So even though it doesn't affect min_width, by affecting max_width it shrinks the window.

surface->dpi_scale is defined as:

int display_output_x11::dpi_scale(int value) {
#if defined(BUILD_XFT)
  if (use_xft.get(*state) && xft_dpi > 0) {
    return (value * xft_dpi + (value > 0 ? 48 : -48)) / 96;
  } else {
    return value;
  }
#else  /* defined(BUILD_XFT) */
  return value;
#endif /* defined(BUILD_XFT) */
}

There's a few things that might be improved:

  • According to a comment on this SO answer, conky should receive resize or move event if DPI changes while it's running.
    • Maybe conky starts on your system before DPI is set to a correct value.
    • That answer said we'd need to reopen temporary connections to the server in order to get up-to-date Xresources.
  • According to this SO answer, Xft dpi is a property that has to be set somewhere correctly so it might be wrong.
    • It also includes a function for computing DPI manually.

... and there I was, eagerly closing issues 😨

@Caellian Caellian added the display: x11 Issue related to X11 backend label Apr 20, 2024
@Caellian Caellian linked a pull request Apr 25, 2024 that will close this issue
2 tasks
@Caellian Caellian removed a link to a pull request Apr 30, 2024
2 tasks
@Caellian
Copy link
Collaborator

Let me know if the issue needs to be reopened. I believe the linked PR fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR display: x11 Issue related to X11 backend rendering Issue or PR related to rendering
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants