### 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
if (((mask & Button1Mask) || (mask & Button2Mask) || (mask & Button3Mask) || (mask & Button4Mask) || (mask & Button5Mask))) {
					List<WindowID>::Element *C = nullptr;
					List<WindowID>::Element *E = popup_list.back();
					
					while (E) {
						
						Rect2i win_rect = Rect2i(window_get_position(E->get()), window_get_size(E->get()));
						
						Rect2i safe_rect = window_get_popup_safe_rect(E->get());
						if (win_rect.has_point(pos)) {
							break;
						} else if (safe_rect != Rect2i() && safe_rect.has_point(pos)) {
							break;
						} else {
							C = E;
							E = E->prev();
						}
					}
					if (C) {
						_send_window_event(windows[C->get()], DisplayServerX11::WINDOW_EVENT_CLOSE_REQUEST);
						closed = true;
					}
				}
			}
			last_mouse_monitor_mask = mask;
		}
	}
	return closed;
}
void DisplayServerX11::process_events() {