[turbine/glfw] Fix to handle null click handler
All checks were successful
Build / build (push) Successful in 1m9s
All checks were successful
Build / build (push) Successful in 1m9s
This commit is contained in:
@@ -285,11 +285,11 @@ static void handleKeyPress(Context &ctx, int const key, bool const down) noexcep
|
||||
map[GLFW_KEY_ESCAPE] = Key::Escape;
|
||||
return map;
|
||||
}();
|
||||
auto const eventHandler = keyEventHandler(ctx);
|
||||
auto const keyIdx = static_cast<std::size_t>(key);
|
||||
if (keyIdx < keyMap.size()) {
|
||||
auto const k = keyMap[keyIdx];
|
||||
setKeyDownStatus(ctx, k, down);
|
||||
auto const eventHandler = keyEventHandler(ctx);
|
||||
if (eventHandler) {
|
||||
eventHandler(ctx, k, down);
|
||||
}
|
||||
@@ -306,7 +306,9 @@ static void handleGlfwMouseButtonEvent(
|
||||
int) noexcept {
|
||||
auto &ctx = *static_cast<Context*>(glfwGetWindowUserPointer(window));
|
||||
setMandatoryRefreshPeriod(ctx, ticksMs(ctx) + config::MandatoryRefreshPeriod);
|
||||
if (ctx.mouseButtonEventHandler) {
|
||||
ctx.mouseButtonEventHandler(ctx, btn, action == 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void handleGlfwKeyEvent(GLFWwindow *window, int const key, int, int const action, int) noexcept {
|
||||
|
||||
Reference in New Issue
Block a user