From 0567709aa823876f2d3e4a81be400444b057d5b4 Mon Sep 17 00:00:00 2001 From: Unreal Karaulov Date: Mon, 18 Nov 2024 18:35:39 +0300 Subject: [PATCH] revert glfw --- glfw/include/GLFW/glfw3.h | 10 +--------- glfw/src/input.c | 29 ++--------------------------- glfw/src/internal.h | 4 ++-- glfw/src/win32_window.c | 6 +++--- 4 files changed, 8 insertions(+), 41 deletions(-) diff --git a/glfw/include/GLFW/glfw3.h b/glfw/include/GLFW/glfw3.h index 74eac460..79b06288 100644 --- a/glfw/include/GLFW/glfw3.h +++ b/glfw/include/GLFW/glfw3.h @@ -1869,7 +1869,7 @@ typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered); * * @ingroup input */ -typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset, int mods); +typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset); /*! @brief The function pointer type for keyboard key callbacks. * @@ -5206,8 +5206,6 @@ GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor); */ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback); -GLFWAPI GLFWkeyfun glfwGetKeyCallback(GLFWwindow* handle); - /*! @brief Sets the Unicode character callback. * * This function sets the character callback of the specified window, which is @@ -5335,8 +5333,6 @@ GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmods */ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback); -GLFWAPI GLFWmousebuttonfun glfwGetMouseButtonCallback(GLFWwindow* handle); - /*! @brief Sets the cursor position callback. * * This function sets the cursor position callback of the specified window, @@ -5369,8 +5365,6 @@ GLFWAPI GLFWmousebuttonfun glfwGetMouseButtonCallback(GLFWwindow* handle); */ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback); -GLFWAPI GLFWcursorposfun glfwGetCursorPosCallback(GLFWwindow* handle); - /*! @brief Sets the cursor enter/leave callback. * * This function sets the cursor boundary crossing callback of the specified @@ -5436,7 +5430,6 @@ GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcu */ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback); -GLFWAPI GLFWscrollfun glfwGetScrollCallback(GLFWwindow* handle); /*! @brief Sets the path drop callback. * * This function sets the path drop callback of the specified window, which is @@ -6380,7 +6373,6 @@ GLFWAPI int glfwVulkanSupported(void); */ GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count); -GLFWAPI int getKeyMods(); #if defined(VK_VERSION_1_0) /*! @brief Returns the address of the specified Vulkan instance function. diff --git a/glfw/src/input.c b/glfw/src/input.c index 5b0430cb..c619eefc 100644 --- a/glfw/src/input.c +++ b/glfw/src/input.c @@ -330,7 +330,7 @@ void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool // Notifies shared code of a scroll event // -void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset, int mods) +void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) { assert(window != NULL); assert(xoffset > -FLT_MAX); @@ -339,7 +339,7 @@ void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset, int m assert(yoffset < FLT_MAX); if (window->callbacks.scroll) - window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset, mods); + window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset); } // Notifies shared code of a mouse button click event @@ -964,14 +964,6 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun) return cbfun; } -GLFWAPI GLFWkeyfun glfwGetKeyCallback(GLFWwindow* handle) { - _GLFWwindow* window = ((_GLFWwindow*) handle); - assert(window != NULL); - - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - return ((_GLFWwindow*) handle)->callbacks.key; -} - GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun cbfun) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); @@ -1006,12 +998,6 @@ GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle, return cbfun; } -GLFWAPI GLFWmousebuttonfun glfwGetMouseButtonCallback(GLFWwindow* handle) { - assert(handle); - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - return ((_GLFWwindow*) handle)->callbacks.mouseButton; -} - GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle, GLFWcursorposfun cbfun) { @@ -1024,13 +1010,6 @@ GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle, return cbfun; } -GLFWAPI GLFWcursorposfun glfwGetCursorPosCallback(GLFWwindow* handle) { - assert(handle); - - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - return ((_GLFWwindow*) handle)->callbacks.cursorPos; -} - GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle, GLFWcursorenterfun cbfun) { @@ -1055,10 +1034,6 @@ GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle, return cbfun; } -GLFWAPI GLFWscrollfun glfwGetScrollCallback(GLFWwindow* handle) { - _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - return ((_GLFWwindow*) handle)->callbacks.scroll; -} GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* handle, GLFWdropfun cbfun) { _GLFW_REQUIRE_INIT_OR_RETURN(NULL); diff --git a/glfw/src/internal.h b/glfw/src/internal.h index bf94245b..4f097aa8 100644 --- a/glfw/src/internal.h +++ b/glfw/src/internal.h @@ -60,7 +60,7 @@ #define _GLFW_MESSAGE_SIZE 1024 -typedef char GLFWbool; +typedef int GLFWbool; typedef void (*GLFWproc)(void); typedef struct _GLFWerror _GLFWerror; @@ -934,7 +934,7 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods); void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain); -void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset, int mods); +void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset); void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos); void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered); diff --git a/glfw/src/win32_window.c b/glfw/src/win32_window.c index a48c8971..d014944b 100644 --- a/glfw/src/win32_window.c +++ b/glfw/src/win32_window.c @@ -406,7 +406,7 @@ static void updateFramebufferTransparency(const _GLFWwindow* window) // Retrieves and translates modifier keys // -int getKeyMods(void) +static int getKeyMods(void) { int mods = 0; @@ -977,7 +977,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l case WM_MOUSEWHEEL: { - _glfwInputScroll(window, 0.0, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA, getKeyMods()); + _glfwInputScroll(window, 0.0, (SHORT) HIWORD(wParam) / (double) WHEEL_DELTA); return 0; } @@ -985,7 +985,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l { // This message is only sent on Windows Vista and later // NOTE: The X-axis is inverted for consistency with macOS and X11 - _glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0, getKeyMods()); + _glfwInputScroll(window, -((SHORT) HIWORD(wParam) / (double) WHEEL_DELTA), 0.0); return 0; }