From b15a26e357a9d3ae7538447a79b1a62f6b569073 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Wed, 23 Nov 2016 21:41:53 +0900 Subject: [PATCH] Fix mouse button state management. --- examples/glview/glview.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/glview/glview.cc b/examples/glview/glview.cc index dd9c80d..cf7c995 100644 --- a/examples/glview/glview.cc +++ b/examples/glview/glview.cc @@ -184,6 +184,8 @@ void clickFunc(GLFWwindow *window, int button, int action, int mods) { if ((button == GLFW_MOUSE_BUTTON_LEFT) && (!shiftPressed) && (!ctrlPressed)) { mouseLeftPressed = true; + mouseMiddlePressed = false; + mouseRightPressed = false; if (action == GLFW_PRESS) { int id = -1; // int id = ui.Proc(x, y); @@ -197,6 +199,8 @@ void clickFunc(GLFWwindow *window, int button, int action, int mods) { if ((button == GLFW_MOUSE_BUTTON_RIGHT) || ((button == GLFW_MOUSE_BUTTON_LEFT) && ctrlPressed)) { if (action == GLFW_PRESS) { mouseRightPressed = true; + mouseLeftPressed = false; + mouseMiddlePressed = false; } else if (action == GLFW_RELEASE) { mouseRightPressed = false; } @@ -204,6 +208,8 @@ void clickFunc(GLFWwindow *window, int button, int action, int mods) { if ((button == GLFW_MOUSE_BUTTON_MIDDLE) || ((button == GLFW_MOUSE_BUTTON_LEFT) && shiftPressed)) { if (action == GLFW_PRESS) { mouseMiddlePressed = true; + mouseLeftPressed = false; + mouseRightPressed = false; } else if (action == GLFW_RELEASE) { mouseMiddlePressed = false; }