Skip to content

Commit

Permalink
ImGui now passes events on to main window
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCherno committed May 14, 2021
1 parent 73b0301 commit d08ca55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/imgui_impl_glfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)

void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
{
if (g_PrevUserCallbackMousebutton != NULL && window == g_Window)
g_PrevUserCallbackMousebutton(window, button, action, mods);
if (g_PrevUserCallbackMousebutton != NULL)
g_PrevUserCallbackMousebutton(g_Window, button, action, mods);

if (action == GLFW_PRESS && button >= 0 && button < IM_ARRAYSIZE(g_MouseJustPressed))
g_MouseJustPressed[button] = true;
}

void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
{
if (g_PrevUserCallbackScroll != NULL && window == g_Window)
g_PrevUserCallbackScroll(window, xoffset, yoffset);
if (g_PrevUserCallbackScroll != NULL)
g_PrevUserCallbackScroll(g_Window, xoffset, yoffset);

ImGuiIO& io = ImGui::GetIO();
io.MouseWheelH += (float)xoffset;
Expand All @@ -130,8 +130,8 @@ void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yo

void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (g_PrevUserCallbackKey != NULL && window == g_Window)
g_PrevUserCallbackKey(window, key, scancode, action, mods);
if (g_PrevUserCallbackKey != NULL)
g_PrevUserCallbackKey(g_Window, key, scancode, action, mods);

ImGuiIO& io = ImGui::GetIO();
if (action == GLFW_PRESS)
Expand Down

0 comments on commit d08ca55

Please sign in to comment.