diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2022-07-21 21:41:02 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2022-07-21 21:47:05 +0200 |
commit | 033001375fcfd40edcf52264acc6e3d3c5c78f86 (patch) | |
tree | 9dedc5fbafd833a5ff64689fb6c051142dc3d6c2 /core | |
parent | e44a2f16805b09a9a858ba5e8ebec7e598feb4d8 (diff) |
Fix editor re-focus on debugger break on Windows
Diffstat (limited to 'core')
-rw-r--r-- | core/debugger/engine_debugger.cpp | 6 | ||||
-rw-r--r-- | core/debugger/engine_debugger.h | 4 | ||||
-rw-r--r-- | core/debugger/remote_debugger.cpp | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index 263c75760b..d495a8ee20 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -43,6 +43,8 @@ HashMap<StringName, EngineDebugger::Profiler> EngineDebugger::profilers; HashMap<StringName, EngineDebugger::Capture> EngineDebugger::captures; HashMap<String, EngineDebugger::CreatePeerFunc> EngineDebugger::protocols; +void (*EngineDebugger::allow_focus_steal_fn)(); + void EngineDebugger::register_profiler(const StringName &p_name, const Profiler &p_func) { ERR_FAIL_COND_MSG(profilers.has(p_name), "Profiler already registered: " + p_name); profilers.insert(p_name, p_func); @@ -133,7 +135,7 @@ void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_process_ticks, singleton->poll_events(true); } -void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Vector<String> p_breakpoints) { +void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Vector<String> p_breakpoints, void (*p_allow_focus_steal_fn)()) { register_uri_handler("tcp://", RemoteDebuggerPeerTCP::create); // TCP is the default protocol. Platforms/modules can add more. if (p_uri.is_empty()) { return; @@ -174,6 +176,8 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Ve singleton_script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp)); } + + allow_focus_steal_fn = p_allow_focus_steal_fn; } void EngineDebugger::deinitialize() { diff --git a/core/debugger/engine_debugger.h b/core/debugger/engine_debugger.h index a8a791f9b0..236d5e5f63 100644 --- a/core/debugger/engine_debugger.h +++ b/core/debugger/engine_debugger.h @@ -100,13 +100,15 @@ protected: static HashMap<StringName, Capture> captures; static HashMap<String, CreatePeerFunc> protocols; + static void (*allow_focus_steal_fn)(); + public: _FORCE_INLINE_ static EngineDebugger *get_singleton() { return singleton; } _FORCE_INLINE_ static bool is_active() { return singleton != nullptr && script_debugger != nullptr; } _FORCE_INLINE_ static ScriptDebugger *get_script_debugger() { return script_debugger; }; - static void initialize(const String &p_uri, bool p_skip_breakpoints, Vector<String> p_breakpoints); + static void initialize(const String &p_uri, bool p_skip_breakpoints, Vector<String> p_breakpoints, void (*p_allow_focus_steal_fn)()); static void deinitialize(); static void register_profiler(const StringName &p_name, const Profiler &p_profiler); static void unregister_profiler(const StringName &p_name); diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index c73e2eb3fb..23ee977df4 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -452,6 +452,9 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { msg.push_back(error_str); ERR_FAIL_COND(!script_lang); msg.push_back(script_lang->debug_get_stack_level_count() > 0); + if (allow_focus_steal_fn) { + allow_focus_steal_fn(); + } send_message("debug_enter", msg); Input::MouseMode mouse_mode = Input::get_singleton()->get_mouse_mode(); |