-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
"Window Placement Centered" causes game window to appear offscreen on hi-DPI laptop #13017
Comments
Does this happen if you mark the editor executable as DPI-aware, by right-clicking its If the window is set to be DPI-aware, this should be fixable by getting the DPI from the engine (which is already possible), then placing and sizing the window accordingly. |
@Calinou - many thanks for the quick response. I can confirm that overriding the scaling mode to 'Application' does solve the issue, i.e. the window which appears on pressing 'Play Project' is now centred. One minor side effect which I noticed is that, after switching to 'Application' scaling mode, the Project Manager window which loads on startup is now a bit too small by default (a screenshot is attached). |
I have already reported that, so I'm adding the "confirmed" label to that issue. |
This is not limited to windows. I see the same on my mid 2014 macbook pro with retina display. Running Godot 3.0 beta 1 UPDATEI launched manually from the terminal and when executing my test scene I see the Values I see are: |
Motivated by the presentations at FOSDEM 2018 I downloaded Godot 3.0-stable on my Win 10 Lenovo Yoga 3 Pro hidpi laptop and started the getting started tutorial. It was most confusing to not find the play window despite repeated play button pushes. Only after some head-scratching and right-clicking on the taskbar icons did it become apparent that the window is somewhere far off to the bottom right of the desktop and needs to be dragged up with "Move" or "Maximise". This is not a good experience to the newbie trying to get started. |
I confirm this issue. In a 1920x1080 screen I need to put custom position like (420, 130) to the run screen be "centered". |
I have this issue on mac. took me forever to finally see a small sliver of the window bottom right. |
I no longer have this issue on 3.0.2 |
OS X 10.13.4 |
Same problem here. :/ |
Still having this problem in the latest version of Godot (3.0.2). macOS 10.13.4. Though if I go to Project Settings > Display > Window and enable "Allow Hidpi", this fixes it. |
I guess that would fix it: #23203 |
Can reproduce at 3440x1440 resolution. Apparently it's not related to the windows UI scaling, same offset for 100% scaling and 150% scaling. |
Same problem here. Setting Leaving System:
Project Settings:
Editor Settings:
Result:
The first row are the pixel values measured from a screenshot when running the game (I only measured the X axis, but I'm pretty sure vertically it's the same) Soooo... the measured window width of 2560 perfectly translates to the project setting of 1024, I guess the Editor Setting |
I was about to open a new issue for this, but since it already exists... I am experiencing the same problem. Godot Version: 3.2.1.stable.mono.official When the position is set to "Centred", it shows only the second quadrant of the game window at the bottom-right corner of the monitor. |
@HubKing Try enabling Display > Window > Allow Hidpi in the Project Settings. (For the record, this isn't done by default because your game must be configured to support multiple resolutions. Also, this may perform poorly on integrated graphics.) |
@Calinou That did make the game window appear at the centre. Thank you for the information. It may be helpful to show some kind of information message box like "Warning: high DPI option has not been enabled" (with "Do not show again" option, of course) when the user clicks the "Play" button for the first time and the system uses high DPI, so that the user would not think it as a bug of the editor. |
This IS a bug of the editor though and an annoying one, especially when you run lots of different projects and you have to set this option for each of them. |
Reopening, because it wasn't fixed (the PR was for Mac OS, while this is also Windows issue, maybe that's why). |
Unfortunately, multi-monitor and displays with different DPI make this more difficult than expected. There's a lot of code that needs to be changed to ensure setting the window position/size works the same regardless of the Allow Hidpi project setting. Also, the windowing system has changed in the
See #36390. |
A workround is to set the compatibility DPI mode on windows for the application to e.g. "System". So it handles like no UI scale applied on system. In my case I have a 200% scale. But the compatibility fix should not the solution for this issue. This issue is about the game itself which can be fixed by the project setting "Allow HiDPI" in window (display) and the most games goes fullscreen. ... I have more a problem with the project manager window which appears on Godot start and described in #42214. What do you think. Can we fix this soon? I could, but not experienced enough to this code. But can help with some ideas. Can we just use the same implementation as the "Allow HiDPI" for this launcher window? Or just rewrite the part of position initialization. How do other applications do that? Or just add a new parameter in a config file for the ui scale. Like 2 for 200% and compute it for the center position. |
To work around the project manager's positioning issue, you can specify the window position and size explicitly using the
Allow Hidpi is always enabled for the editor and project manager unless you pass the
This is already available in the Editor Settings (Interface > Editor > Display Scale). |
Ok thanks.
It's only about the project manager who isn't working (position only, scale works). But |
This is because the project manager code only sets the window size, not the position: godot/editor/project_manager.cpp Lines 2413 to 2414 in 1ceba6e
I'll look into it but I can't promise I'll manage to fix it.
It's |
The funny thing is that when I run Godot with just |
|
Hehe you're right. |
Ok wait. When I launch Godot with such argument it logs to the root path of its exe
But no further problems. But why is the window centered in this case? And all other stuff works like expected. The window size is ok like default (without args). The only effect I get with this error is that the window is centered and this issue fixed. ^^ So maybe there is code which is not exectued causing to the error above. I guess there is some code of window position which can just be removed to work. idk. |
See #38202 (comment). It's likely a race condition. Chery-picking #49661 to |
But does that mean there is code for the window position that won't execute when this error is caused? In other words: We can just remove the section of window position code to fix this issue? Or what do you think? Why is the window centered in this case? Not this line: godot/editor/project_manager.cpp Lines 2413 to 2414 in 1ceba6e
Because the widnow size is exactly the same as without the error / invalid argument. It's really only the position which is now fixed / centered. Or do you think this is the right line? But the window size does not differ between both states. 🤔 So just removing it will fix this? (Maybe not for all users?) |
Removing that line will cause the window to be too small on hiDPI displays, since it won't be resized to match the editor scale. This line was originally added in #20831 as a hack. The ideal way to solve this problem would be to scale created on Windows and Linux as is done on macOS, but it's not trivial to implement. |
So I encountered this problem as well on Windows 11 and a 4K monitor. I was able to hard code a window position in the editor settings, so that is an okay work around for now, but I think we should look into fixing it. I put together some code that appears to work fine on Windows 11 (and the APIs should be supported as far back as Windows 2000). Not sure if you tried this before, but it seems to work on my machine. Maybe that will help.
I can look into Linux later, but I'm going to assume it may be harder than Windows. |
So I spent the day trying to detect display scaling in Linux (Ubuntu Wayland and X11). It doesn't look like an easy thing. I was able to get some resolution values from the Xlib library, but they don't seem to make any sense. I tried everything I could think of, but it just wasn't working. I'll revisit this later because there has to be some way, maybe I'm missing something. I don't know. |
Actually, I was able to get it working with Xlib. At least on Ubuntu X11 GNOME. I can detect the proper screen scaling now. However, it doesn't seem to work under XWayland and I scoured the whole API. I also think that different desktop environments handle scaling differently, so I'm not sure it's portable to other distros. But it's a start and I will keep looking into it. |
It's working for 4k display with scaling at 250% |
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
Operating system or device, Godot version, GPU Model and driver (if graphics related):
OS: Windows 10
Device: Dell XPS 15 9560
GPU: Nvidia GTX 1050
GPU Driver: 388.00
Screen Resolution: 3840 x 2160 px
Godot version: 3.0 alpha 2
Issue description:
If Window Placement - Centred is selected in Editor Settings, when running a project using the 'Play Project' button, the game window opens outside the visible screen area (to the bottom-right). I have to move the window back onscreen to see it.
(However, Window Placement - Top Left works fine.)
The game window should be centred if Window Placement - Centred is selected in Editor Settings.
Steps to reproduce:
Load any project which runs windowed and ensure that Window Placement - Centred is selected in Editor Settings. Press 'Play Project'.
Link to minimal example project:
Bugsquad edit: Keywords for searching: Windows, window, placement, location, position, screen, scaling, incorrect, offscreen, bottom, right, corner, bottom-right, center, centered, 125%, 150%, 175%, 200%, expected, unexpected, resolution.
The text was updated successfully, but these errors were encountered: