Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: godotengine/godot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 149f218cabd0533eda632df7011b0109c1fe2624
Choose a base ref
..
head repository: godotengine/godot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 93aba07e829d96d371de6b774a6e00424eb6ef5f
Choose a head ref
Showing with 10 additions and 0 deletions.
  1. +9 −0 editor/plugins/embedded_process.cpp
  2. +1 −0 editor/plugins/embedded_process.h
9 changes: 9 additions & 0 deletions editor/plugins/embedded_process.cpp
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ void EmbeddedProcess::_notification(int p_what) {
} break;
case NOTIFICATION_APPLICATION_FOCUS_IN: {
application_has_focus = true;
last_application_focus_time = OS::get_singleton()->get_ticks_msec();
} break;
case NOTIFICATION_APPLICATION_FOCUS_OUT: {
application_has_focus = false;
@@ -287,6 +288,14 @@ void EmbeddedProcess::_check_mouse_over() {
return;
}

// Before checking whether the mouse is truly inside the embedded process, ensure
// the editor has enough time to re-render. When a breakpoint is hit in the script editor,
// `_check_mouse_over` may be triggered before the editor hides the game workspace.
// This prevents the embedded process from regaining focus immediately after the editor has taken it.
if (OS::get_singleton()->get_ticks_msec() - last_application_focus_time < 500) {
return;
}

// Input::is_mouse_button_pressed is not sufficient to detect the mouse button state
// while the floating game window is being resized.
BitField<MouseButtonMask> mouse_button_mask = DisplayServer::get_singleton()->mouse_get_button_state();
1 change: 1 addition & 0 deletions editor/plugins/embedded_process.h
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ class EmbeddedProcess : public Control {
GDCLASS(EmbeddedProcess, Control);

bool application_has_focus = true;
uint64_t last_application_focus_time = 0;
OS::ProcessID focused_process_id = 0;
OS::ProcessID current_process_id = 0;
bool embedding_grab_focus = false;