Skip to content

Commit

Permalink
Merge pull request ruckertm#9 from ascherer/main
Browse files Browse the repository at this point in the history
Add callback function for mouse scroll events.
  • Loading branch information
ruckertm authored Aug 27, 2023
2 parents 047e8fc + dc71d5d commit 45ba48f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hintview/Linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,21 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
}
}

void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
{
if (yoffset > 0.0)
{
pos=hint_page_prev();
hint_page();
clear_cursor();
} else if (yoffset < 0.0)
{
pos=hint_page_next();
hint_page();
clear_cursor();
}
}

void cursor_enter_callback(GLFWwindow* window, int entered)
{ if (entered && autoreload && new_file_time())
reload_file();
Expand Down Expand Up @@ -573,6 +588,7 @@ int create_window(void)
glfwSetKeyCallback(window, key_callback);
glfwSetCursorEnterCallback(window,cursor_enter_callback);
glfwSetMouseButtonCallback(window, mouse_button_callback);
glfwSetScrollCallback(window, scroll_callback);
glfwSetCursorPosCallback(window, cursor_position_callback);

glfwSetCursorPos(window, px_h/2, px_v/2);
Expand Down

0 comments on commit 45ba48f

Please sign in to comment.