| 980 | } |
| 981 | |
| 982 | bool onMouse(const MouseEvent& ev) override |
| 983 | { |
| 984 | #ifdef DPF_RUNTIME_TESTING |
| 985 | if (inSelfTest) return false; |
| 986 | #endif |
| 987 | |
| 988 | if (ev.press) |
| 989 | getWindow().focus(); |
| 990 | |
| 991 | const int action = ev.press ? GLFW_PRESS : GLFW_RELEASE; |
| 992 | int mods = glfwMods(ev.mod); |
| 993 | |
| 994 | int button; |
| 995 | |
| 996 | switch (ev.button) |
| 997 | { |
| 998 | case kMouseButtonLeft: button = GLFW_MOUSE_BUTTON_LEFT; break; |
| 999 | case kMouseButtonRight: button = GLFW_MOUSE_BUTTON_RIGHT; break; |
| 1000 | case kMouseButtonMiddle: button = GLFW_MOUSE_BUTTON_MIDDLE; break; |
| 1001 | default: |
| 1002 | button = ev.button; |
| 1003 | break; |
| 1004 | } |
| 1005 | |
| 1006 | #ifdef DISTRHO_OS_MAC |
| 1007 | // Remap Ctrl-left click to right click on macOS |
| 1008 | if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == GLFW_MOD_CONTROL) { |
| 1009 | button = GLFW_MOUSE_BUTTON_RIGHT; |
| 1010 | mods &= ~GLFW_MOD_CONTROL; |
| 1011 | } |
| 1012 | // Remap Ctrl-shift-left click to middle click on macOS |
| 1013 | if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == (GLFW_MOD_CONTROL | GLFW_MOD_SHIFT)) { |
| 1014 | button = GLFW_MOUSE_BUTTON_MIDDLE; |
| 1015 | mods &= ~(GLFW_MOD_CONTROL | GLFW_MOD_SHIFT); |
| 1016 | } |
| 1017 | #endif |
| 1018 | |
| 1019 | const ScopedContext sc(this, mods); |
| 1020 | return context->event->handleButton(lastMousePos, button, action, mods); |
| 1021 | } |
| 1022 | |
| 1023 | bool onMotion(const MotionEvent& ev) override |
| 1024 | { |
nothing calls this directly
no test coverage detected