Remap mouse clicks on macOS to deal with its silly "one button" UX
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
f263212d7e
commit
62b55920c9
3 changed files with 10 additions and 12 deletions
2
dpf
2
dpf
|
@ -1 +1 @@
|
||||||
Subproject commit 68de732eecbd1d8febf94e15558c5adaa45dfa9b
|
Subproject commit d3d8f910e35142b5289c073a36ef1c23becc2e46
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1c03e618219e28566cb53382c1de843024cbc1f8
|
Subproject commit 71f4c72ded3560639b4ff1df3bb827e31c7d61a0
|
|
@ -612,39 +612,37 @@ protected:
|
||||||
bool onMouse(const MouseEvent& ev) override
|
bool onMouse(const MouseEvent& ev) override
|
||||||
{
|
{
|
||||||
const int action = ev.press ? GLFW_PRESS : GLFW_RELEASE;
|
const int action = ev.press ? GLFW_PRESS : GLFW_RELEASE;
|
||||||
const int mods = glfwMods(ev.mod);
|
int mods = glfwMods(ev.mod);
|
||||||
|
|
||||||
int button;
|
int button;
|
||||||
|
|
||||||
switch (ev.button)
|
switch (ev.button)
|
||||||
{
|
{
|
||||||
case 1: button = GLFW_MOUSE_BUTTON_LEFT; break;
|
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 2: button = GLFW_MOUSE_BUTTON_RIGHT; break;
|
||||||
case 3: button = GLFW_MOUSE_BUTTON_MIDDLE; break;
|
case 3: button = GLFW_MOUSE_BUTTON_MIDDLE; break;
|
||||||
#else
|
#else
|
||||||
case 2: button = GLFW_MOUSE_BUTTON_MIDDLE; break;
|
case 2: button = GLFW_MOUSE_BUTTON_MIDDLE; break;
|
||||||
case 3: button = GLFW_MOUSE_BUTTON_RIGHT; break;
|
case 3: button = GLFW_MOUSE_BUTTON_RIGHT; break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
button = ev.button;
|
button = ev.button;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#ifdef DISTRHO_OS_MAC
|
||||||
#if defined ARCH_MAC
|
// Remap Ctrl-left click to right click on macOS
|
||||||
// Remap Ctrl-left click to right click on Mac
|
|
||||||
if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == GLFW_MOD_CONTROL) {
|
if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == GLFW_MOD_CONTROL) {
|
||||||
button = GLFW_MOUSE_BUTTON_RIGHT;
|
button = GLFW_MOUSE_BUTTON_RIGHT;
|
||||||
mods &= ~GLFW_MOD_CONTROL;
|
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)) {
|
if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == (GLFW_MOD_CONTROL | GLFW_MOD_SHIFT)) {
|
||||||
button = GLFW_MOUSE_BUTTON_MIDDLE;
|
button = GLFW_MOUSE_BUTTON_MIDDLE;
|
||||||
mods &= ~(GLFW_MOD_CONTROL | GLFW_MOD_SHIFT);
|
mods &= ~(GLFW_MOD_CONTROL | GLFW_MOD_SHIFT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
const ScopedContext sc(this, mods);
|
const ScopedContext sc(this, mods);
|
||||||
return context->event->handleButton(lastMousePos, button, action, mods);
|
return context->event->handleButton(lastMousePos, button, action, mods);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue