From 6368207dec27ff2a7d76d2358171bc0eb11b3582 Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Wed, 13 Dec 2017 11:47:26 -0500 Subject: [PATCH] Release quartz event tap in screen Dtor --- src/lib/platform/OSXScreen.mm | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 43fe7615..9049f33c 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -251,6 +251,13 @@ OSXScreen::~OSXScreen() delete m_keyState; delete m_screensaver; + if (m_eventTapRLSR) { + LOG((CLOG_DEBUG "releasing quartz event tap")); + CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode); + CFRelease(m_eventTapRLSR); + m_eventTapRLSR = nullptr; + } + if (m_eventTapPort) { CGEventTapEnable(m_eventTapPort, false); CFRelease(m_eventTapPort); @@ -755,20 +762,7 @@ OSXScreen::disable() showCursor(); } - // FIXME -- stop watching jump zones, stop capturing input - - if (m_eventTapRLSR) { - LOG((CLOG_DEBUG "releasing quartz event tap")); - CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode); - CFRelease(m_eventTapRLSR); - m_eventTapRLSR = nullptr; - } - - if (m_eventTapPort) { - CGEventTapEnable(m_eventTapPort, false); - CFRelease(m_eventTapPort); - m_eventTapPort = nullptr; - } + // FIXME -- stop watching jump zones, stop capturing input // FIXME -- allow system to enter power saving mode // disable drag handling