Monitor scale values seem to be wrong.
When I created a window that is set to scale to monitor DPI, the 800x600 window was way too big. My 4k monitor is scaled at 150%, with a DPI of 144, thus the scale factor would be 1.5, but it returns 2.76 thus the window scale is larger than it should be.
In my own code I get 144 dpi, 1.5 scale (dividing 144/96.0). I resize by this value and the window is sized appropriately for the DPI.
I'm on win64, using opengl.
Thank you for telling me. I'll be looking into this asap.
Thank you for telling me. I'll be looking into this asap.
np.
Also, a few of the routines at the top do not have RGFWDEF on it so they won't get exported. I use this with Delphi so every update I have to remember to go in and add them.
Also, a few of the routines at the top do not have RGFWDEF on it so they won't get exported. I use this with Delphi so every update I have to remember to go in and add them.
Thanks, the RGFWDEF issue should be fixed now! Let me know if you find any more issues.
Thanks, the RGFWDEF issue should be fixed now! Let me know if you find any more issues.
Coolness. Thanks.
I'm not sure where the 2.76 scale is coming from, based on my tests the scale was always 1 because DPIAware was not enabled. It's now enabled via SetProcessDPIAware. Let me know if the issue still occurs.
Sadly, I'm getting the same value. The window is scaled by 2.76 rather than 1.5.
https://github.com/user-attachments/assets/e345405b-042a-4378-8835-1a5d9cfd0d56
if you change GetDpiForMonitor(src, MDT_ANGULAR_DPI, &x, &y) to GetDpiForMonitor(src, MDT_EFFECTIVE_DPI, &x, &y) then I get correct scaling values on my device.
However the automatic scale_to_depi does not seem to no work, nor directly calling RGFW_window_scaleToMonitor().
But if I do:
LArea.w := Round(LMonitor.scaleX * LWindow.r.w);
LArea.h := Round(LMonitor.scaleY * LWindow.r.h);
RGFW_window_resize(LWindow, LArea);
then it works. But this is what RGFW_window_scaleToMonitor is doing. So not sure what's going on else where.
Reference: https://learn.microsoft.com/en-us/windows/win32/api/shellscalingapi/ne-shellscalingapi-monitor_dpi_type
I was getting the proper values on my side. Although based on the documentation, that makes sense.
I'm not sure why the scale function isn't working, I'll look into it later today.
RGFW_window_scaleToMonitor doesn't work because the code looks something like this
((u32)scale) * width, (u32)scale would == 1
I'm changing it to look like this
(u32)(scale * (float)width)
Rather than rounding the value.
Ok, yea, that worked. The only remaining issues is the centering is off, I think centering is being calc first, then the window is resized. Centering should be calc after the resize to take into account the scaled window size.
Hmm, just so you know, RGFW_CENTER|RGFW_SCALE_TO_MONITO will not center the window and explained above. I just pulled the latest and the dpi is correct, but centering it still wrong. I have not looked at the code, and just going off what I think that is happening, the window is scaled after its centered and not taking the scale size into consideration. I can work around it, but just letting you know.
@jarroddavis68 yea I moved it and it should be fixed now. I can double check the code though.
Ahh yes, working now. Many thanks!
Thank you for bringing up the issue. I've been planning on revisiting the monitor code for a while.
Oh forgot to mention that this is how i'm using RGFW in Delphi. Using the new clang based toolchain in C++ Builder I can create and object .o and link then directly into Delphi. I recently added RGFW to the growing list.
https://github.com/tinyBigGAMES/CPas