feat(event): process focus input

This commit is contained in:
fallenoak 2023-03-15 23:54:59 -05:00
parent 27cab4814c
commit 2b791973b5
2 changed files with 21 additions and 1 deletions

View File

@ -75,6 +75,18 @@ void PostClose() {
EventInitiateShutdown();
}
void PostFocus(EvtContext* context, int32_t focus) {
Input::s_buttonState = 0;
Input::s_metaKeyState = 0;
EVENT_DATA_FOCUS data;
data.focus = focus;
IEvtQueueDispatch(context, EVENT_ID_FOCUS, &data);
CheckMouseModeState();
}
void PostKeyDown(EvtContext* context, int32_t key, int32_t repeat, int32_t time) {
if (key <= KEY_LASTMETAKEY) {
if ((1 << key) & Input::s_metaKeyState) {
@ -216,7 +228,11 @@ void ProcessInput(const int32_t param[], OSINPUT id, int32_t* shutdown, EvtConte
break;
case OS_INPUT_FOCUS:
// TODO
PostFocus(
context,
param[0]
);
break;
case OS_INPUT_KEY_DOWN:

View File

@ -220,6 +220,10 @@ struct EVENT_DATA_CHAR {
uint32_t repeat;
};
struct EVENT_DATA_FOCUS {
int32_t focus;
};
struct EVENT_DATA_IDLE {
float elapsedSec;
uint32_t time;