void COSXScreen::disable() { if (m_autoShowHideCursor) { showCursor(); } // FIXME -- stop watching jump zones, stop capturing input if (m_eventTapRLSR) { CFRelease(m_eventTapRLSR); m_eventTapRLSR = nullptr; } if (m_eventTapPort) { CFRelease(m_eventTapPort); m_eventTapPort = nullptr; } // FIXME -- allow system to enter power saving mode // disable drag handling m_dragNumButtonsDown = 0; enableDragTimer(false); // uninstall clipboard timer if (m_clipboardTimer != NULL) { m_events->removeHandler(CEvent::kTimer, m_clipboardTimer); m_events->deleteTimer(m_clipboardTimer); m_clipboardTimer = NULL; } m_isOnScreen = m_isPrimary; }
void COSXScreen::disable() { if (m_isPrimary) { // FIXME -- stop watching jump zones, stop capturing input } else { // show cursor if (m_cursorHidden) { // CGDisplayShowCursor(m_displayID); m_cursorHidden = false; } // FIXME -- allow system to enter power saving mode } // disable drag handling m_dragNumButtonsDown = 0; enableDragTimer(false); // uninstall clipboard timer if (m_clipboardTimer != NULL) { EVENTQUEUE->removeHandler(CEvent::kTimer, m_clipboardTimer); EVENTQUEUE->deleteTimer(m_clipboardTimer); m_clipboardTimer = NULL; } m_isOnScreen = m_isPrimary; }
bool COSXScreen::onMouseButton(bool pressed, UInt16 macButton) { // Buttons 2 and 3 are inverted on the mac ButtonID button = mapMacButtonToSynergy(macButton); if (pressed) { LOG((CLOG_DEBUG1 "event: button press button=%d", button)); if (button != kButtonNone) { KeyModifierMask mask = m_keyState->getActiveModifiers(); sendEvent(m_events->forIPrimaryScreen().buttonDown(), CButtonInfo::alloc(button, mask)); } } else { LOG((CLOG_DEBUG1 "event: button release button=%d", button)); if (button != kButtonNone) { KeyModifierMask mask = m_keyState->getActiveModifiers(); sendEvent(m_events->forIPrimaryScreen().buttonUp(), CButtonInfo::alloc(button, mask)); } } // handle drags with any button other than button 1 or 2 if (macButton > 2) { if (pressed) { // one more button if (m_dragNumButtonsDown++ == 0) { enableDragTimer(true); } } else { // one less button if (--m_dragNumButtonsDown == 0) { enableDragTimer(false); } } } return true; }