Skip to content

Commit

Permalink
revert glfw
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Nov 18, 2024
1 parent b0195aa commit 0567709
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 41 deletions.
10 changes: 1 addition & 9 deletions glfw/include/GLFW/glfw3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
29 changes: 2 additions & 27 deletions glfw/src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions glfw/src/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

#define _GLFW_MESSAGE_SIZE 1024

typedef char GLFWbool;
typedef int GLFWbool;
typedef void (*GLFWproc)(void);

typedef struct _GLFWerror _GLFWerror;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions glfw/src/win32_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -977,15 +977,15 @@ 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;
}

case WM_MOUSEHWHEEL:
{
// 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;
}

Expand Down

0 comments on commit 0567709

Please sign in to comment.