Browse Source

Merge pull request #102618 from Hilderin/fix-slow-resize-embedded-game-v2

Fix lag when resizing Floating Game Window
Rémi Verschelde 6 months ago
parent
commit
fa85645c1a
1 changed files with 8 additions and 5 deletions
  1. 8 5
      editor/plugins/embedded_process.cpp

+ 8 - 5
editor/plugins/embedded_process.cpp

@@ -40,6 +40,12 @@ void EmbeddedProcess::_notification(int p_what) {
 		case NOTIFICATION_ENTER_TREE: {
 		case NOTIFICATION_ENTER_TREE: {
 			window = get_window();
 			window = get_window();
 		} break;
 		} break;
+		case NOTIFICATION_PROCESS: {
+			if (updated_embedded_process_queued) {
+				updated_embedded_process_queued = false;
+				_update_embedded_process();
+			}
+		} break;
 		case NOTIFICATION_DRAW: {
 		case NOTIFICATION_DRAW: {
 			_draw();
 			_draw();
 		} break;
 		} break;
@@ -179,6 +185,7 @@ void EmbeddedProcess::embed_process(OS::ProcessID p_pid) {
 	start_embedding_time = OS::get_singleton()->get_ticks_msec();
 	start_embedding_time = OS::get_singleton()->get_ticks_msec();
 	embedding_grab_focus = has_focus();
 	embedding_grab_focus = has_focus();
 	timer_update_embedded_process->start();
 	timer_update_embedded_process->start();
+	set_process(true);
 	set_notify_transform(true);
 	set_notify_transform(true);
 
 
 	// Attempt to embed the process, but if it has just started and the window is not ready yet,
 	// 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;
 	embedding_grab_focus = false;
 	timer_embedding->stop();
 	timer_embedding->stop();
 	timer_update_embedded_process->stop();
 	timer_update_embedded_process->stop();
+	set_process(false);
 	set_notify_transform(false);
 	set_notify_transform(false);
 	queue_redraw();
 	queue_redraw();
 }
 }
@@ -251,11 +259,6 @@ void EmbeddedProcess::_timer_update_embedded_process_timeout() {
 			queue_update_embedded_process();
 			queue_update_embedded_process();
 		}
 		}
 	}
 	}
-
-	if (updated_embedded_process_queued) {
-		updated_embedded_process_queued = false;
-		_update_embedded_process();
-	}
 }
 }
 
 
 void EmbeddedProcess::_update_embedded_process() {
 void EmbeddedProcess::_update_embedded_process() {