-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
HighDPI issues on linux #65
Comments
You can set an appropriate |
Shouldn't Will give it a try and let you know. |
Something like this - unfortunately I can't test this as I currently only have glfw 3.2 - I first to build a newer version. diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp
index 2485ead7..73ddedc1 100644
--- a/profiler/src/main.cpp
+++ b/profiler/src/main.cpp
@@ -242,6 +242,14 @@ int main( int argc, char** argv )
gl3wInit();
glfwSetWindowRefreshCallback( window, WindowRefreshCallback );
+#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3)
+ GLFWmonitor* monitor = glfwGetWindowMonitor(window);
+ if (monitor == nullptr) {
+ monitor = glfwGetPrimaryMonitor();
+ }
+ if (monitor != nullptr) {
+ float xscale, yscale;
+ glfwGetMonitorContentScale(monitor, &xscale, &yscale);
+ dpiScale = xscale > yscale ? xscale : yscale;
+ }
+#else
#ifdef _WIN32
typedef UINT(*GDFS)(void);
GDFS getDpiForSystem = nullptr;
@@ -250,6 +258,7 @@ int main( int argc, char** argv )
getDpiForSystem = (GDFS)GetProcAddress(dll, "GetDpiForSystem");
if (getDpiForSystem)
dpiScale = getDpiForSystem() / 96.f;
+#endif
#endif
// Setup ImGui binding
|
tested the above now - works quite nice now. Not sure which version of glfw you are targeting for. But if 3.3 is the min version - one can also remove the checks and the win32 code. |
I suppose I have to add the |
Then you have trouble with multiple monitors with different DPI settings, but this problem is already present right now (not on Windows, which scale the window-contents bitmap to match the target monitor DPI). Proper fix would be needed to be done on ImGui side, I believe @ocornut has it in the works. |
But it should at least do the (almost) same as the win32 specific code, no? I know that it doesn't deal with the edge cases. At least it fixes the problem for me in a way, that renders the profiler's ui readable. |
Or maybe provide a way to override the dpi scale factor with an env var? at least as a workaround... |
Implemented as proposed in 5abd4c8. |
it's not possible to use the profiler on my laptop's screen resolution (3840x2160).
The text was updated successfully, but these errors were encountered: