Repository: godotengine/godot (language: cpp)

Issue:
[4.4 Beta 3] Embedded game window lags when changing positions and scale.
### Tested versions

- Reproductible in: v4.4.beta3.official [06acfccf8]

### System information

Godot v4.4.beta3 - Fedora Linux 41 (KDE Plasma) on Wayland - X11 display driver, Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 (nvidia; 565.77) - AMD Ryzen 9 7900X 12-Core Processor (24 threads)

### Issue description

When embedding the game window (either on a floating workspace or on the editor "Game" tab) and moving the "main" window, the embedded window will lag behind. This did not happen in earlier versions of the engine and I don't know if it happens on Windows.

BETA 2

https://github.com/user-attachments/assets/1e1b4f09-66a6-49bb-aee1-3af18d63956d

---

BETA 3

https://github.com/user-attachments/assets/c5c0705d-1ae6-49c4-82ec-fa4ead231005

### Steps to reproduce

- Run a project on 4.4.beta3 with `Embed game on Next Play` enabled;
- Move / scale the main window that's holding the embedded window around.

### Minimal reproduction project (MRP)

Not including an MRP since this can be replicated with an empty project.


Discussion / hints:
That's a side effect of #102251.
On low spec machine on Windows resizing the floating window was very slow. The embedded window is now updated less frequently, causing this out of sync effect. I'll try to think of another method to fix #102251 and still keep the embedded window in sync as much as possible.

Fix patch:
diff --git a/editor/plugins/embedded_process.cpp b/editor/plugins/embedded_process.cpp
index 72c87bfc1c6d..17c6ede2d248 100644
--- a/editor/plugins/embedded_process.cpp
+++ b/editor/plugins/embedded_process.cpp
@@ -40,6 +40,12 @@ void EmbeddedProcess::_notification(int p_what) {
 		case NOTIFICATION_ENTER_TREE: {
 			window = get_window();
 		} break;
+		case NOTIFICATION_PROCESS: {
+			if (updated_embedded_process_queued) {
+				updated_embedded_process_queued = false;
+				_update_embedded_process();
+			}
+		} break;
 		case NOTIFICATION_DRAW: {
 			_draw();
 		} break;
@@ -179,6 +185,7 @@ void EmbeddedProcess::embed_process(OS::ProcessID p_pid) {
 	start_embedding_time = OS::get_singleton()->get_ticks_msec();
 	embedding_grab_focus = has_focus();
 	timer_update_embedded_process->start();
+	set_process(true);
 	set_notify_transform(true);
 
 	// Attempt to embed the process, but if it has just started and the window is not ready yet,
@@ -196,6 +203,7 @@ void EmbeddedProcess::reset() {
 	embedding_grab_focus = false;
 	timer_embedding->stop();
 	timer_update_embedded_process->stop();
+	set_process(false);
 	set_notify_transform(false);
 	queue_redraw();
 }
@@ -251,11 +259,6 @@ void EmbeddedProcess::_timer_update_embedded_process_timeout() {
 			queue_update_embedded_process();
 		}
 	}
-
-	if (updated_embedded_process_queued) {
-		updated_embedded_process_queued = false;
-		_update_embedded_process();
-	}
 }
 
 void EmbeddedProcess::_update_embedded_process() {


Test patch: