| 225 | } |
| 226 | |
| 227 | bool CardinalRemoteUI::onMouse(const MouseEvent& ev) |
| 228 | { |
| 229 | if (ev.press) |
| 230 | getWindow().focus(); |
| 231 | |
| 232 | const int action = ev.press ? GLFW_PRESS : GLFW_RELEASE; |
| 233 | int mods = glfwMods(ev.mod); |
| 234 | |
| 235 | int button; |
| 236 | |
| 237 | switch (ev.button) |
| 238 | { |
| 239 | case 1: button = GLFW_MOUSE_BUTTON_LEFT; break; |
| 240 | case 2: button = GLFW_MOUSE_BUTTON_RIGHT; break; |
| 241 | case 3: button = GLFW_MOUSE_BUTTON_MIDDLE; break; |
| 242 | default: |
| 243 | button = ev.button; |
| 244 | break; |
| 245 | } |
| 246 | |
| 247 | #ifdef DISTRHO_OS_MAC |
| 248 | // Remap Ctrl-left click to right click on macOS |
| 249 | if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == GLFW_MOD_CONTROL) { |
| 250 | button = GLFW_MOUSE_BUTTON_RIGHT; |
| 251 | mods &= ~GLFW_MOD_CONTROL; |
| 252 | } |
| 253 | // Remap Ctrl-shift-left click to middle click on macOS |
| 254 | if (button == GLFW_MOUSE_BUTTON_LEFT && (mods & RACK_MOD_MASK) == (GLFW_MOD_CONTROL | GLFW_MOD_SHIFT)) { |
| 255 | button = GLFW_MOUSE_BUTTON_MIDDLE; |
| 256 | mods &= ~(GLFW_MOD_CONTROL | GLFW_MOD_SHIFT); |
| 257 | } |
| 258 | #endif |
| 259 | |
| 260 | CardinalPluginContext* context = static_cast<CardinalPluginContext*>(rack::contextGet()); |
| 261 | const ScopedContext sc(context, mods); |
| 262 | return context->event->handleButton(lastMousePos, button, action, mods); |
| 263 | } |
| 264 | |
| 265 | bool CardinalRemoteUI::onMotion(const MotionEvent& ev) |
| 266 | { |
nothing calls this directly
no test coverage detected