diff --git a/src/event/Event.cpp b/src/event/Event.cpp index e27d367..7255315 100644 --- a/src/event/Event.cpp +++ b/src/event/Event.cpp @@ -46,6 +46,10 @@ void EventInitialize(int32_t threadCount, int32_t netServer) { // OsInputSetEventPollProc(&sub_47DCA0); } +void EventInitiateShutdown() { + IEvtSchedulerShutdown(); +} + int32_t EventIsControlKeyDown() { return EventIsKeyDown(KEY_LCONTROL) || EventIsKeyDown(KEY_RCONTROL); } diff --git a/src/event/Event.hpp b/src/event/Event.hpp index 22cc108..031ee1e 100644 --- a/src/event/Event.hpp +++ b/src/event/Event.hpp @@ -39,6 +39,8 @@ void EventDoMessageLoop(); void EventInitialize(int32_t threadCount, int32_t netServer); +void EventInitiateShutdown(); + int32_t EventIsControlKeyDown(); int32_t EventIsKeyDown(KEY key); diff --git a/src/event/Input.cpp b/src/event/Input.cpp index e3f3fef..be6704c 100644 --- a/src/event/Input.cpp +++ b/src/event/Input.cpp @@ -1,4 +1,5 @@ #include "event/Input.hpp" +#include "event/Event.hpp" #include "event/EvtContext.hpp" #include "event/Queue.hpp" #include "gx/Window.hpp" @@ -65,6 +66,10 @@ void PostChar(EvtContext* context, int32_t ch, int32_t repeat) { IEvtQueueDispatch(context, EVENT_ID_CHAR, &data); } +void PostClose() { + EventInitiateShutdown(); +} + void PostKeyDown(EvtContext* context, int32_t key, int32_t repeat, int32_t time) { if (key <= KEY_LASTMETAKEY) { if ((1 << key) & Input::s_metaKeyState) { @@ -202,7 +207,10 @@ void ProcessInput(const int32_t param[], OSINPUT id, int32_t* shutdown, EvtConte break; case OS_INPUT_CLOSE: - // TODO + // TODO ConfirmClose() + PostClose(); + *shutdown = 1; + break; case OS_INPUT_FOCUS: