### Godot version

Latest 4.0.dev (a3a42159e31db27f8ae7c1ecad6a9ed417cb05de)

### System information

Ubuntu 22.04.1 LTS

### Issue description

Ctrl+Shift+F (Find in Files) in the text editor, for example, causes my laptop to freeze consistently. I also reproduced it with F1 and Ctrl+Shift+R, as well as by using the dropdown instead of shortcuts.

### Steps to reproduce

Trivial

### Minimal reproduction project

N/A
for (const KeyValue<WindowID, WindowData> &E : windows) {
		if (window_get_mode(E.key) != WINDOW_MODE_MINIMIZED) {
			return true;
		}
	}
	return false;
}
void DisplayServerX11::window_set_ime_active(const bool p_active, WindowID p_window) {
	_THREAD_SAFE_METHOD_
	ERR_FAIL_COND(!windows.has(p_window));
	WindowData &wd = windows[p_window];
	if (!wd.xic) {
		return;
	}
	if (!wd.focused) {
		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);
		}
		XSetICFocus(wd.xic);