[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;
|
map[GLFW_KEY_ESCAPE] = Key::Escape;
|
||||||
return map;
|
return map;
|
||||||
}();
|
}();
|
||||||
auto const eventHandler = keyEventHandler(ctx);
|
|
||||||
auto const keyIdx = static_cast<std::size_t>(key);
|
auto const keyIdx = static_cast<std::size_t>(key);
|
||||||
if (keyIdx < keyMap.size()) {
|
if (keyIdx < keyMap.size()) {
|
||||||
auto const k = keyMap[keyIdx];
|
auto const k = keyMap[keyIdx];
|
||||||
setKeyDownStatus(ctx, k, down);
|
setKeyDownStatus(ctx, k, down);
|
||||||
|
auto const eventHandler = keyEventHandler(ctx);
|
||||||
if (eventHandler) {
|
if (eventHandler) {
|
||||||
eventHandler(ctx, k, down);
|
eventHandler(ctx, k, down);
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,9 @@ static void handleGlfwMouseButtonEvent(
|
|||||||
int) noexcept {
|
int) noexcept {
|
||||||
auto &ctx = *static_cast<Context*>(glfwGetWindowUserPointer(window));
|
auto &ctx = *static_cast<Context*>(glfwGetWindowUserPointer(window));
|
||||||
setMandatoryRefreshPeriod(ctx, ticksMs(ctx) + config::MandatoryRefreshPeriod);
|
setMandatoryRefreshPeriod(ctx, ticksMs(ctx) + config::MandatoryRefreshPeriod);
|
||||||
ctx.mouseButtonEventHandler(ctx, btn, action == 1);
|
if (ctx.mouseButtonEventHandler) {
|
||||||
|
ctx.mouseButtonEventHandler(ctx, btn, action == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleGlfwKeyEvent(GLFWwindow *window, int const key, int, int const action, int) noexcept {
|
static void handleGlfwKeyEvent(GLFWwindow *window, int const key, int, int const action, int) noexcept {
|
||||||
|
|||||||
Reference in New Issue
Block a user