### Godot version

v4.0.beta15.mono.official [4fa6edc88]

### System information

Linux, Xorg

### Issue description

The entire window loses focus if you ungrab focus from a Control. 
This doesn't seem to happen in Beta 14 and older betas.

### Steps to reproduce

1. Create a Control that can grab focus (tested with LineEdit and TextEdit)
2. Grab focus
3. Release focus via release_focus() or hiding the node

### Minimal reproduction project

[FocusMinimal.zip](https://github.com/godotengine/godot/files/10498175/FocusMinimal.zip)

_THREAD_SAFE_METHOD_
	ERR_FAIL_COND(!windows.has(p_window));
	WindowData &wd = windows[p_window];
	if (!wd.xic) {
		return;
	}
	if (!wd.focused) {
		wd.ime_active = false;
		im_text = String();
		im_selection = Vector2i();
		return;
	}
	
	
	if (p_active) {
		MutexLock mutex_lock(events_mutex);
		wd.ime_active = true;
		XMapWindow(x11_display, wd.x11_xim_window);
		XWindowAttributes xwa;
		XSync(x11_display, False);
		XGetWindowAttributes(x11_display, wd.x11_xim_window, &xwa);
		if (xwa.map_state == IsViewable) {
			XSetInputFocus(x11_display, wd.x11_xim_window, RevertToPointerRoot, CurrentTime);
		}