diff --git a/src/Include/editor/engine.hpp b/src/Include/editor/engine.hpp index 14c19a9f317..ee88b45892e 100644 --- a/src/Include/editor/engine.hpp +++ b/src/Include/editor/engine.hpp @@ -24,6 +24,7 @@ class engine_base virtual void pause(bool const& value) = 0; virtual void capture_input(bool const& value) = 0; virtual void disconnect() = 0; + virtual bool quit_requested() const = 0; // shared_str support virtual void value(LPCSTR value, shared_str& result) = 0; virtual LPCSTR value(shared_str const& value) = 0; diff --git a/src/editors/xrWeatherEditor/entry_point.cpp b/src/editors/xrWeatherEditor/entry_point.cpp index 69a3d6f700c..205762e95f0 100644 --- a/src/editors/xrWeatherEditor/entry_point.cpp +++ b/src/editors/xrWeatherEditor/entry_point.cpp @@ -55,7 +55,7 @@ private ref class window_ide_final : public editor::window_ide { m_engine->on_idle(); impl->on_idle(); - } while (m_engine&&!PeekMessage(&message, HWND(0), 0, 0, 0)); + } while (m_engine && !m_engine->quit_requested() && !PeekMessage(&message, HWND(0), 0, 0, 0)); impl->on_idle_end(); } diff --git a/src/xrEngine/device.cpp b/src/xrEngine/device.cpp index ef3b3a20abd..dffaab537e2 100644 --- a/src/xrEngine/device.cpp +++ b/src/xrEngine/device.cpp @@ -100,7 +100,7 @@ void CRenderDevice::End(void) if (g_pGamePersistent->GameType() == 1) // haCk { Uint32 flags = SDL_GetWindowFlags(m_sdlWnd); - if (flags & SDL_WINDOW_INPUT_GRABBED) + if (flags & SDL_WINDOW_INPUT_FOCUS) Pause(TRUE, TRUE, TRUE, "application start"); } } diff --git a/src/xrEngine/engine_impl.cpp b/src/xrEngine/engine_impl.cpp index 964f3450111..52f38ca3ab9 100644 --- a/src/xrEngine/engine_impl.cpp +++ b/src/xrEngine/engine_impl.cpp @@ -25,7 +25,12 @@ engine_impl::~engine_impl() capture_input(false); xr_delete(m_input_receiver); } -void engine_impl::on_idle() { Device.on_idle(); } + +void engine_impl::on_idle() +{ + SDL_PumpEvents(); + Device.on_idle(); +} void engine_impl::on_resize() { if (Console) @@ -54,6 +59,12 @@ void engine_impl::capture_input(bool const& value) } void engine_impl::disconnect() { Console->Execute("quit"); } + +bool engine_impl::quit_requested() const +{ + return SDL_QuitRequested(); +} + void engine_impl::value(LPCSTR value, shared_str& result) { result = value; } LPCSTR engine_impl::value(shared_str const& value) { return (value.c_str()); } void engine_impl::weather(LPCSTR value) diff --git a/src/xrEngine/engine_impl.hpp b/src/xrEngine/engine_impl.hpp index af8858ead8d..f9086740e10 100644 --- a/src/xrEngine/engine_impl.hpp +++ b/src/xrEngine/engine_impl.hpp @@ -23,6 +23,7 @@ class engine_impl : public XRay::Editor::engine_base virtual void pause(bool const& value); virtual void capture_input(bool const& value); virtual void disconnect(); + bool quit_requested() const override; virtual void value(LPCSTR value, shared_str& result); virtual LPCSTR value(shared_str const& value); diff --git a/src/xrEngine/main.cpp b/src/xrEngine/main.cpp index e22341a1a89..e6a473dba6c 100644 --- a/src/xrEngine/main.cpp +++ b/src/xrEngine/main.cpp @@ -110,7 +110,7 @@ ENGINE_API void InitConsole() ENGINE_API void InitInput() { - bool captureInput = !strstr(Core.Params, "-i"); + bool captureInput = !strstr(Core.Params, "-i") && !GEnv.isEditor; pInput = new CInput(captureInput); } @@ -321,7 +321,7 @@ bool CheckBenchmark() const u32 sz = xr_strlen(sashName); string512 sashArg; sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg); -#if !defined(LOINUX) +#if !defined(LINUX) g_SASH.Init(sashArg); g_SASH.MainLoop(); #endif