### Godot version

 Latest 4.0.dev (a3a42159e31db27f8ae7c1ecad6a9ed417cb05de)

### System information

Ubuntu 22.04.1 LTS

### Issue description

![image](https://user-images.githubusercontent.com/85438892/214476911-0ce83a43-b959-4b13-88fd-d6b9af0cd63a.png)

### Steps to reproduce

Open any script

### Minimal reproduction project

N/A
_THREAD_SAFE_METHOD_
	if (p_mode == mouse_mode) {
		return;
	}
	if (mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
		XUngrabPointer(x11_display, CurrentTime);
	}
	
	bool show_cursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED);
	bool previously_shown = (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED);
	if (show_cursor && !previously_shown) {
		WindowID window_id = get_window_at_screen_position(mouse_get_position());
		if (window_id != INVALID_WINDOW_ID) {
			_send_window_event(windows[window_id], WINDOW_EVENT_MOUSE_ENTER);
		}
	}
	for (const KeyValue<WindowID, WindowData> &E : windows) {
		if (show_cursor) {
			XDefineCursor(x11_display, E.value.x11_window, cursors[current_cursor]); 
		} else {
			XDefineCursor(x11_display, E.value.x11_window, null_cursor);