godot
                                
                                
                                
                                    godot copied to clipboard
                            
                            
                            
                        Detached script editor can become frozen with multiple, differing resolution monitors on Windows
Godot version
4.1.stable
System information
Windows 11, geForce 3070 TI
Issue description
I have 3 monitors:
- Monitor1 - leftmost, windows primary monitor, no windows open on it, 2K resolution
 - Monitor2 - center, godot window, 4K resolution
 - Monitor3 - rightmost, detached script editor window, 4K resolution
 
After I press F1 key, then clicking on the script editor it can now no longer be used. Clicking on it doesn't do anything, can't access the File/Edit/Search etc menus. Pressing escape doesn't help. Pressing the cross at the top right doesn't do anything.
Only way to fix is to close and re-open Godot.
Steps to reproduce
Have multiple monitors with differing resolutions. Make your lower resolution monitor your primary monitor then open Godot and detach the script editor. Leave them on your higher resolution monitor. Press F1 then click on the script editor. If the F1 menu didn't appear on your primary monitor, you are now out of luck.
Minimal reproduction project
No project. I can confirm resolution is the problem with the F1 menu though, as if I DONT detach the script editor and press F1, I see this:
Clicking and drawwing the incorrectly sized F1 window at all resizes it to the correct resolution:
It really should open with the correct resolution and in the center of the same monitor as the script editor.
A simple fix for this could also be not allowing the script editor window to take focus whiel the F1 window is open.
A simple fix for this could also be not allowing the script editor window to take focus whiel the F1 window is open.
I think we should strive towards making less popups exclusive, not more :slightly_smiling_face:
The "Search Help" are modal, as well as all the settings windows. I can understand the need for the settings windows to be modal. But the "Search Help" might not need to be modal but a modeless window.
It really should open with the correct resolution and in the center of the same monitor as the script editor.
It makes more sense to me for it to open in the center of the script editor window rather than the center of the entire display. I don't need my script editor to take up the full width of my ultrawide, I can use the rest of that space for other stuff. Having the popup over the script editor makes more sense than it popping up over other content on that display.
This is caused by the following lines: https://github.com/godotengine/godot/blob/6588a4a29af1621086feac0117d5d4d37af957fd/editor/editor_help_search.cpp#L163-L165
That code doesn't take into account that the screen size may change, allowing saved_size to cross the screen borders, as happen in OP.
The simplest way to fix this is to discard the saved_size if it goes out of the screen (I'll PR this solution soon).
Another solution is to apply the same algorithm used for floating panels, which has the nice advantage of keeping the window rect ratio, but it's probably overkill in the help dialog.
I checked only the help dialog, but I think there are other places where this happens.
In general, I'd argue that the Window code should check this automatically (at least of modal windows) and raise an error, or does fallback in some way.
- Related to https://github.com/godotengine/godot/issues/74261.
 
This should have been fixed by #79617, could you test 4.3-dev5 or later to confirm?
This screenshot shows my 2k primary Monitor on left with secondary 4k monitor on right. Pressing F1 on the script editor brings up the 'Search Help' popup on my primary monitor (bottom left).
There are two issues the latter of which is a showstopper:
- It's scaled wrong (2x larger than it should by the looks of it). Moving the window in any way causes it to rescale itself so it appears correct.
 - It's so far down and left, I can't actually move the window because the minimize/maximize/close buttons extend to the very edge of the window. There's no titlebar I can click on to move it.
 
This is Godot 4.3-dev5 on Windows 11.