Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MouseDelta.x/y become 0.0 when right mouse button is held down - imgui_impl_opengl3.h + imgui_impl_osx.h #3762

Closed
jparismorgan opened this issue Jan 26, 2021 · 2 comments

Comments

@jparismorgan
Copy link

jparismorgan commented Jan 26, 2021

Full info

Dear ImGui 1.80 WIP (17911)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201703
define: __APPLE__
define: __GNUC__=4
define: __clang_version__=12.0.0 (clang-1200.0.32.28)
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_osx
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000040
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigMacOSXBehaviors
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMoveFromTitleBarOnly
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000100A
 HasMouseCursors
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------

Version/Branch of Dear ImGui:

Version: 1.80 WIP - commit 388ca563dbb0fa683d2a8fbf1daaf2ab77f98a21
Branch: docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_opengl3.h + imgui_impl_osx.h
Compiler: clang-1200.0.32.28
Operating System: OS X

My Issue/Question:

My goal is to determine the mouse delta when holding the right mouse button down. But I have found that when holding the right mouse button down, the io.MouseDelta.x and io.MouseDelta.y values become 0.0.

Screenshots/Video

rmb_bug_osx.mp4

Standalone, minimal, complete and verifiable example: (see #2261)

void rmbRepro() {
   ImGuiIO &io = ImGui::GetIO();
   ImGui::Text("io.MouseDelta.x: %f io.MouseDelta.y: %f\nImGui::GetMouseDragDelta(1).x: %f ImGui::GetMouseDragDelta(1).y: %f", io.MouseDelta.x, io.MouseDelta.y, ImGui::GetMouseDragDelta(1).x, ImGui::GetMouseDragDelta(1).y);
   if (ImGui::IsMouseDown(1)) {
      ImGui::Text("Right: Down");
   }
   else {
      ImGui::Text("Right: Up");

   }
   if (ImGui::IsMouseDown(0)) {
      ImGui::Text("Left: Down");
   }
   else {
      ImGui::Text("Right: Up");
   }
}
rokups added a commit to rokups/imgui that referenced this issue Jan 27, 2021
rokups added a commit to rokups/imgui that referenced this issue Jan 27, 2021
ocornut pushed a commit that referenced this issue Jan 27, 2021
…ns other than left one are down. (#3762)

# Conflicts:
#	docs/CHANGELOG.txt
@ocornut
Copy link
Owner

ocornut commented Jan 27, 2021

Fixed by @rokups with commit 066406b
Thanks for the report! (such a bug shows how little exercised the OSX backend is. As mentioned in our earlier conversation, I would suggest using the SDL or GLFW backends in order to build a portable app)

@ocornut ocornut closed this as completed Jan 27, 2021
@nbutko
Copy link

nbutko commented Jan 27, 2021

Thanks for fixing this! For context, part of the appeal of imgui is that third party libraries and frameworks are not required (it just works by itself! which we love). We want to avoid extra third party dependencies if we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants