Repository: godot
Issue: 4.0, FileSystem panel, Renaming file dialog unfocused after alt+tab twice
Labels: bug,topic:editor,usability,topic:gui

### Godot version

v4.0.rc3.official [7e79aead9]

### System information

Windows 10 22H2, Compatibility, GeForce GTX 550 Ti

### Issue description

### Issue: v4.0.rc3.official [7e79aead9]
The `FileSystem` panels, `Renaming file...` dialog, loses focus to the main Godot window, 
when switching (`alt + tab`) to another application and back (`alt + tab`) to Godot.

Screen recording:
- `FileSystem` panel, `icon.svg` right-clicked
- `Rename...` left-clicked, `Renaming file...` dialog opens and becomes focused
- `alt + tab` pressed, `MS Paint` focused
- `alt + tab` pressed, Main `Godot` window focused (unexpected)
- `Renaming file...` dialogs title bar left-clicked, the dialog becomes focused
- `alt + tab` pressed, `MS Paint` focused
- `alt + tab` pressed, `Renaming file...` dialog focused (expected)
- Main `Godot` title bar left-clicked, it becomes focused
- `alt + tab` pressed, `MS Paint` focused
- `alt + tab` pressed, Main `Godot` title bar becomes focused



https://user-images.githubusercontent.com/13420573/220925811-bf83fdca-d511-42dc-a959-05be4eec6d12.mp4


### Not an issue: v3.5.2.rc2.official [1a2bf3eb4] and v3.5.1.stable.official [6fed1ffa3]
- The `Renaming file: icon.png` dialogs input box remains focused after `alt + tab` twice.
- The main Godot window remains focused (blue title bar for me),
when the `Renaming file: icon.png` dialog opens, and after pressing `alt + tab` twice.
- The focus doesn't change when one clicks on the main window or on the dialogs title bar.
- The main Godot window is dimmed (darker) when the dialog is open.
- Mouse clicking outside the dialog, cancels the dialog.

Screenshot. Godot behaves and looks the same after pressing `alt + tab` twice.

![Godot_v3 5 2-rc2_win64_hoiSD39wuu](https://user-images.githubusercontent.com/13420573/220925939-32eb1e1d-5dcb-4963-92db-8e9e32ad78e0.png)


### Steps to reproduce

- open the attached project: [issue, renaming file dialog unfocused after alt tab twice.zip](https://github.com/godotengine/godot/files/10815497/issue.renaming.file.dialog.unfocused.after.alt.tab.twice.zip)

- in the `FileSystem` panel
- right-click on: `icon.svg`
- on the context menu, left-click on: `Rename...`
A dialog opens and is focused: `Renaming file...`
The name `icon` is selected, and the cursor blinks at the beginning of the selection
- switch to another application: `Alt + Tab`
- switch back to Godot: `Alt + Tab`

### Expected
The `Renaming file...` dialog should become focused again, 
so that the name can be changed without having to 
mouse-click on the `Renaming file...` dialog to focus it manually first.


### Observed
The `Renaming file...` dialog is unfocused, 
and the main Godot window is focused behind the dialog.

The dialog has to be mouse clicked manually to continue editing the name.

### Notes
The behavior in 3.5.x seems better (see the issue description above).

But if the behavior was changed for a specific reason.
Then an alternative fix might be to not allow the main Godot window 
to become focused while a dialog is open.

I can't think of an example at the moment, 
but I might have seen other applications blink (twice?) the dialogs window (a thick border?) or title bar, 
when the main window is clicked while a dialog is open.

Possibly to make it more obvious that the open dialog needs to be handled,
before the main window can be interacted with, and to make the dialog visible, 
if, for example, it was moved away to read/see the content behind the dialog.

### Minimal reproduction project

[issue, renaming file dialog unfocused after alt tab twice.zip](https://github.com/godotengine/godot/files/10815497/issue.renaming.file.dialog.unfocused.after.alt.tab.twice.zip)