diff --git a/src/custom/glfw.cpp b/src/custom/glfw.cpp index b9c72b9..f069ac2 100644 --- a/src/custom/glfw.cpp +++ b/src/custom/glfw.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2024 Filipe Coelho + * Copyright (C) 2021-2025 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -17,6 +17,7 @@ #include "Application.hpp" #include "CardinalPluginContext.hpp" +#include "widget/event.hpp" #include @@ -207,3 +208,12 @@ GLFWAPI const char* glfwGetKeyName(const int key, int) default: return nullptr; } } + +int glfwGetKey(GLFWwindow*, const int key) +{ + CardinalPluginContext* const context = static_cast(APP); + DISTRHO_SAFE_ASSERT_RETURN(context != nullptr, GLFW_RELEASE); + DISTRHO_SAFE_ASSERT_RETURN(context->event != nullptr, GLFW_RELEASE); + + return context->event->heldKeys.find(key) != context->event->heldKeys.end() ? GLFW_PRESS : GLFW_RELEASE; +}