Browse Source

Map Ctrl-left click to right click on Mac

tags/v0.3.1
Andrew Belt 7 years ago
parent
commit
f6b4c90e55
2 changed files with 13 additions and 1 deletions
  1. +5
    -1
      src/app/Knob.cpp
  2. +8
    -0
      src/gui.cpp

+ 5
- 1
src/app/Knob.cpp View File

@@ -15,8 +15,12 @@ void Knob::onDragStart() {
} }


void Knob::onDragMove(Vec mouseRel) { void Knob::onDragMove(Vec mouseRel) {
// Drag slower if Ctrl is held
// Drag slower if Ctrl is held (Command on Mac)
#ifdef ARCH_MAC
if (guiIsKeyPressed(GLFW_KEY_LEFT_SUPER) || guiIsKeyPressed(GLFW_KEY_RIGHT_SUPER))
#else
if (guiIsKeyPressed(GLFW_KEY_LEFT_CONTROL) || guiIsKeyPressed(GLFW_KEY_RIGHT_CONTROL)) if (guiIsKeyPressed(GLFW_KEY_LEFT_CONTROL) || guiIsKeyPressed(GLFW_KEY_RIGHT_CONTROL))
#endif
mouseRel = mouseRel.mult(0.1); mouseRel = mouseRel.mult(0.1);
setValue(value - KNOB_SENSITIVITY * (maxValue - minValue) * mouseRel.y); setValue(value - KNOB_SENSITIVITY * (maxValue - minValue) * mouseRel.y);
} }


+ 8
- 0
src/gui.cpp View File

@@ -35,6 +35,14 @@ void windowSizeCallback(GLFWwindow* window, int width, int height) {
} }


void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods) { void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods) {
#ifdef ARCH_MAC
// Ctrl-left click --> right click
if (button == GLFW_MOUSE_BUTTON_LEFT) {
if (guiIsKeyPressed(GLFW_KEY_LEFT_CONTROL) || guiIsKeyPressed(GLFW_KEY_RIGHT_CONTROL))
button = GLFW_MOUSE_BUTTON_RIGHT;
}
#endif

if (action == GLFW_PRESS) { if (action == GLFW_PRESS) {
// onMouseDown // onMouseDown
Widget *w = gScene->onMouseDown(gMousePos, button); Widget *w = gScene->onMouseDown(gMousePos, button);


Loading…
Cancel
Save