Merge pull request #103052 from Hilderin/fix-embedded-game-mouse-over-not-focused-windows
Fix Embedded Game does not focus when mouse over on Windows
This commit is contained in:
@ -321,11 +321,16 @@ void EmbeddedProcess::_check_mouse_over() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When there's a modal window, we don't want to grab the focus to prevent
|
// Check if there's an exclusive popup, an open menu, or a tooltip.
|
||||||
// the game window to go in front of the modal window.
|
// We don't want to grab focus to prevent the game window from coming to the front of the modal window
|
||||||
if (_get_current_modal_window()) {
|
// or the open menu from closing when the mouse cursor moves outside the menu and over the embedded game.
|
||||||
|
Vector<DisplayServer::WindowID> wl = DisplayServer::get_singleton()->get_window_list();
|
||||||
|
for (const DisplayServer::WindowID &window_id : wl) {
|
||||||
|
Window *w = Window::get_from_id(window_id);
|
||||||
|
if (w && (w->is_exclusive() || w->get_flag(Window::FLAG_POPUP))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Force "regrabbing" the game window focus.
|
// Force "regrabbing" the game window focus.
|
||||||
last_updated_embedded_process_focused = false;
|
last_updated_embedded_process_focused = false;
|
||||||
|
|||||||
@ -3000,6 +3000,7 @@ Error DisplayServerWindows::embed_process(WindowID p_window, OS::ProcessID p_pid
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p_grab_focus) {
|
if (p_grab_focus) {
|
||||||
|
SetForegroundWindow(ep->window_handle);
|
||||||
SetFocus(ep->window_handle);
|
SetFocus(ep->window_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user