[client] app: add ability to receive keyboard typing in overlays

This commit is contained in:
Quantum 2021-08-14 00:18:43 -04:00 committed by Geoffrey McRae
parent 5f3bd778c0
commit 9414449408
2 changed files with 21 additions and 0 deletions

View File

@ -43,6 +43,7 @@ bool app_inputEnabled(void);
bool app_isCaptureMode(void); bool app_isCaptureMode(void);
bool app_isCaptureOnlyMode(void); bool app_isCaptureOnlyMode(void);
bool app_isFormatValid(void); bool app_isFormatValid(void);
bool app_isOverlayMode(void);
void app_updateCursorPos(double x, double y); void app_updateCursorPos(double x, double y);
void app_updateWindowPos(int x, int y); void app_updateWindowPos(int x, int y);
void app_handleResizeEvent(int w, int h, double scale, const struct Border border); void app_handleResizeEvent(int w, int h, double scale, const struct Border border);
@ -59,6 +60,8 @@ void app_handleButtonRelease(int button);
void app_handleWheelMotion(double motion); void app_handleWheelMotion(double motion);
void app_handleKeyPress(int scancode); void app_handleKeyPress(int scancode);
void app_handleKeyRelease(int scancode); void app_handleKeyRelease(int scancode);
void app_handleKeyboardTyped(const char * typed);
void app_handleKeyboardModifiers(bool ctrl, bool shift, bool alt, bool super);
void app_handleEnterEvent(bool entered); void app_handleEnterEvent(bool entered);
void app_handleFocusEvent(bool focused); void app_handleFocusEvent(bool focused);
void app_handleCloseEvent(void); void app_handleCloseEvent(void);

View File

@ -63,6 +63,11 @@ bool app_isFormatValid(void)
return g_state.formatValid; return g_state.formatValid;
} }
bool app_isOverlayMode(void)
{
return g_state.overlayInput;
}
void app_updateCursorPos(double x, double y) void app_updateCursorPos(double x, double y)
{ {
g_cursor.pos.x = x; g_cursor.pos.x = x;
@ -394,6 +399,19 @@ void app_handleKeyRelease(int sc)
} }
} }
void app_handleKeyboardTyped(const char * typed)
{
ImGuiIO_AddInputCharactersUTF8(g_state.io, typed);
}
void app_handleKeyboardModifiers(bool ctrl, bool shift, bool alt, bool super)
{
g_state.io->KeyCtrl = ctrl;
g_state.io->KeyShift = shift;
g_state.io->KeyAlt = alt;
g_state.io->KeySuper = super;
}
void app_handleMouseRelative(double normx, double normy, void app_handleMouseRelative(double normx, double normy,
double rawx, double rawy) double rawx, double rawy)
{ {