mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-09 02:46:00 +03:00
feat(event): handle close event
This commit is contained in:
parent
d90000d0f2
commit
09d77e1ba2
@ -46,6 +46,10 @@ void EventInitialize(int32_t threadCount, int32_t netServer) {
|
|||||||
// OsInputSetEventPollProc(&sub_47DCA0);
|
// OsInputSetEventPollProc(&sub_47DCA0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventInitiateShutdown() {
|
||||||
|
IEvtSchedulerShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
int32_t EventIsControlKeyDown() {
|
int32_t EventIsControlKeyDown() {
|
||||||
return EventIsKeyDown(KEY_LCONTROL) || EventIsKeyDown(KEY_RCONTROL);
|
return EventIsKeyDown(KEY_LCONTROL) || EventIsKeyDown(KEY_RCONTROL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,8 @@ void EventDoMessageLoop();
|
|||||||
|
|
||||||
void EventInitialize(int32_t threadCount, int32_t netServer);
|
void EventInitialize(int32_t threadCount, int32_t netServer);
|
||||||
|
|
||||||
|
void EventInitiateShutdown();
|
||||||
|
|
||||||
int32_t EventIsControlKeyDown();
|
int32_t EventIsControlKeyDown();
|
||||||
|
|
||||||
int32_t EventIsKeyDown(KEY key);
|
int32_t EventIsKeyDown(KEY key);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "event/Input.hpp"
|
#include "event/Input.hpp"
|
||||||
|
#include "event/Event.hpp"
|
||||||
#include "event/EvtContext.hpp"
|
#include "event/EvtContext.hpp"
|
||||||
#include "event/Queue.hpp"
|
#include "event/Queue.hpp"
|
||||||
#include "gx/Window.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);
|
IEvtQueueDispatch(context, EVENT_ID_CHAR, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostClose() {
|
||||||
|
EventInitiateShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
void PostKeyDown(EvtContext* context, int32_t key, int32_t repeat, int32_t time) {
|
void PostKeyDown(EvtContext* context, int32_t key, int32_t repeat, int32_t time) {
|
||||||
if (key <= KEY_LASTMETAKEY) {
|
if (key <= KEY_LASTMETAKEY) {
|
||||||
if ((1 << key) & Input::s_metaKeyState) {
|
if ((1 << key) & Input::s_metaKeyState) {
|
||||||
@ -202,7 +207,10 @@ void ProcessInput(const int32_t param[], OSINPUT id, int32_t* shutdown, EvtConte
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OS_INPUT_CLOSE:
|
case OS_INPUT_CLOSE:
|
||||||
// TODO
|
// TODO ConfirmClose()
|
||||||
|
PostClose();
|
||||||
|
*shutdown = 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OS_INPUT_FOCUS:
|
case OS_INPUT_FOCUS:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user