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

Display Scaling on Windows in Qt6 Builds is Broken #4552

Closed
4 tasks done
Nerixyz opened this issue Apr 17, 2023 · 2 comments · Fixed by #4868
Closed
4 tasks done

Display Scaling on Windows in Qt6 Builds is Broken #4552

Nerixyz opened this issue Apr 17, 2023 · 2 comments · Fixed by #4868
Labels
bug Something isn't working as intended, or works in a confusing/unintuitive way for the user high dpi OS: Windows qt6 Issues related to our migration to qt6
Milestone

Comments

@Nerixyz
Copy link
Contributor

Nerixyz commented Apr 17, 2023

Checklist

  • I'm reporting a problem with Chatterino
  • I've verified that I'm running the most recent nightly build or stable release
  • I've looked for my problem on the wiki
  • I've searched the issues and pull requests for similar looking reports

Describe your issue

When using display scaling on Windows (for high-dpi monitors), Chatterino itself will be scaled (even though on Windows, it compensates for high-dpi). I'm pretty sure this is because Qt::AA_DisableHighDpiScaling was removed (it still exists, but doesn't have any effect). The new documentation on high-dpi doesn't mention any application-attribute that can be set. As far as I know, display-scaling on macOS and Linux is done "correctly". Something to keep in mind is that on Windows, a lot of native events are consumed that use native (non-scaled) coordinates.

A not-so-great-but-working workaround is this:

diff --git a/src/main.cpp b/src/main.cpp
index 303d8ea2..874643e4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,6 +24,9 @@ using namespace chatterino;
 
 int main(int argc, char **argv)
 {
+#ifdef Q_OS_WINDOWS
+    qputenv("QT_ENABLE_HIGHDPI_SCALING", "0");
+#endif
     QApplication a(argc, argv);
 
     QCoreApplication::setApplicationName("chatterino");

Not that QT_ENABLE_HIGHDPI_SCALING is described as "This variable is intended for testing purposes only, and we do not recommend setting it on a permanent basis.".

Screenshots

image

OS and Chatterino Version

Chatterino Nightly 2.4.2 (commit 20bdfae) built on 2023-04-16 with Qt 6.5.0, Windows SDK, MSVC 193431943, Crashpad Running on Windows 10 Version 22H2, kernel: 10.0.19045

@Nerixyz Nerixyz added the issue-report An issue reported by a user. label Apr 17, 2023
@Felanbird Felanbird added bug Something isn't working as intended, or works in a confusing/unintuitive way for the user qt6 Issues related to our migration to qt6 and removed issue-report An issue reported by a user. labels Apr 17, 2023
@Nerixyz
Copy link
Contributor Author

Nerixyz commented Apr 17, 2023

I experimented with some changes on fix/dpi. This attempts to use the same code for high-dpi as on Linux or macOS. There are obvious shortcomings:

  • Dragging the window from a monitor with DPR=1 to a monitor with DPR>1 increases the window size.
  • When starting, the window is too large.
  • Emotes (seemingly (?)) draw the 1x version (I don't know how this is handled on Linux and macOS).

It would be nice if users with high-dpi screens could test this and possibly attempt to make changes.

I created a minimal-reproducible-example for the drag issue here.


If you don't have a high-dpi monitor, you can set the display scale to something other than 100% for a monitor.

@TroyKomodo

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended, or works in a confusing/unintuitive way for the user high dpi OS: Windows qt6 Issues related to our migration to qt6
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants