From 62b55920c9c33aade2718db13f44e6e4ec5dfa06 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 1 May 2022 01:41:47 +0100 Subject: [PATCH] Remap mouse clicks on macOS to deal with its silly "one button" UX Signed-off-by: falkTX --- dpf | 2 +- plugins/Fundamental | 2 +- src/CardinalUI.cpp | 18 ++++++++---------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dpf b/dpf index 68de732..d3d8f91 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 68de732eecbd1d8febf94e15558c5adaa45dfa9b +Subproject commit d3d8f910e35142b5289c073a36ef1c23becc2e46 diff --git a/plugins/Fundamental b/plugins/Fundamental index 1c03e61..71f4c72 160000 --- a/plugins/Fundamental +++ b/plugins/Fundamental @@ -1 +1 @@ -Subproject commit 1c03e618219e28566cb53382c1de843024cbc1f8 +Subproject commit 71f4c72ded3560639b4ff1df3bb827e31c7d61a0 diff --git a/src/CardinalUI.cpp b/src/CardinalUI.cpp index c787555..ae7918e 100644 --- a/src/CardinalUI.cpp +++ b/src/CardinalUI.cpp @@ -612,39 +612,37 @@ protected: bool onMouse(const MouseEvent& ev) override { const int action = ev.press ? GLFW_PRESS : GLFW_RELEASE; - const int mods = glfwMods(ev.mod); + int mods = glfwMods(ev.mod); int button; switch (ev.button) { case 1: button = GLFW_MOUSE_BUTTON_LEFT; break; -#ifdef DISTRHO_OS_MAC + #ifdef DISTRHO_OS_MAC case 2: button = GLFW_MOUSE_BUTTON_RIGHT; break; case 3: button = GLFW_MOUSE_BUTTON_MIDDLE; break; -#else + #else case 2: button = GLFW_MOUSE_BUTTON_MIDDLE; break; case 3: button = GLFW_MOUSE_BUTTON_RIGHT; break; -#endif + #endif default: button = ev.button; break; } - /* - #if defined ARCH_MAC - // Remap Ctrl-left click to right click on Mac + #ifdef DISTRHO_OS_MAC + // Remap Ctrl-left click to right click on macOS if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == GLFW_MOD_CONTROL) { button = GLFW_MOUSE_BUTTON_RIGHT; mods &= ~GLFW_MOD_CONTROL; } - // Remap Ctrl-shift-left click to middle click on Mac + // Remap Ctrl-shift-left click to middle click on macOS if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == (GLFW_MOD_CONTROL | GLFW_MOD_SHIFT)) { button = GLFW_MOUSE_BUTTON_MIDDLE; mods &= ~(GLFW_MOD_CONTROL | GLFW_MOD_SHIFT); } - #endif - */ + #endif const ScopedContext sc(this, mods); return context->event->handleButton(lastMousePos, button, action, mods);