chatterino2
chatterino2 copied to clipboard
Display Scaling on Windows in Qt6 Builds is Broken
Checklist
- [X] I'm reporting a problem with Chatterino
- [X] I've verified that I'm running the most recent nightly build or stable release
- [X] I've looked for my problem on the wiki
- [X] 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
OS and Chatterino Version
Chatterino Nightly 2.4.2 (commit 20bdfaef) 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
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.
👍