diff --git a/CMakeLists.txt b/CMakeLists.txt index c8e9fae2eb..e287d3a099 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,7 +173,6 @@ if (UNIX) find_library (lib_ApplicationServices ApplicationServices) find_library (lib_Foundation Foundation) find_library (lib_Carbon Carbon) - find_library (lib_UserNotifications UserNotifications) list (APPEND libs ${lib_ScreenSaver} @@ -181,7 +180,6 @@ if (UNIX) ${lib_ApplicationServices} ${lib_Foundation} ${lib_Carbon} - ${lib_UserNotifications} ) else() # not-apple diff --git a/src/gui/src/OSXHelpers.h b/src/gui/src/OSXHelpers.h index d8bd31b825..15876aecfb 100644 --- a/src/gui/src/OSXHelpers.h +++ b/src/gui/src/OSXHelpers.h @@ -20,7 +20,6 @@ #define OSXHELPERS__H bool isOSXSecureInputEnabled(); -void OSXSendSecureInputNotification(); bool isOSXInterfaceStyleDark(); bool isOSXUseDarkIcons(); diff --git a/src/gui/src/OSXHelpers.mm b/src/gui/src/OSXHelpers.mm index 59298c8782..e9bd75a7d8 100644 --- a/src/gui/src/OSXHelpers.mm +++ b/src/gui/src/OSXHelpers.mm @@ -23,56 +23,9 @@ #import #import -NSString* runCommand(NSString* commandToRun) -{ - NSTask *task = [[NSTask alloc] init]; - [task setLaunchPath:@"/bin/sh"]; - - NSArray *arguments = [NSArray arrayWithObjects: - @"-c" , - [NSString stringWithFormat:@"%@", commandToRun], - nil]; - NSLog(@"run command:%@", commandToRun); - [task setArguments:arguments]; - - NSPipe *pipe = [NSPipe pipe]; - [task setStandardOutput:pipe]; - - NSFileHandle *file = [pipe fileHandleForReading]; - - [task launch]; - - NSData *data = [file readDataToEndOfFile]; - - NSString *output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - return output; -} - bool isOSXSecureInputEnabled() { - //NSString *output = runCommand(@"ioreg -l -w 0 | grep kCGSSessionSecureInputPID"); - //NSLog (@"grep returned:\n%@", output); - - /* - int pid = [[NSProcessInfo processInfo] processIdentifier]; - NSPipe *pipe = [NSPipe pipe]; - NSFileHandle *file = pipe.fileHandleForReading; - - NSTask *task = [[NSTask alloc] init]; - task.launchPath = @"/usr/sbin/ioreg"; - task.arguments = @[@"-l", @"-w", @"0"]; - task.standardOutput = pipe; - - [task launch]; - - NSData *data = [file readDataToEndOfFile]; - [file closeFile]; - - NSString *grepOutput = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; - NSLog (@"grep returned:\n%@", grepOutput); - */ - std::array buffer; std::string result; std::unique_ptr pipe(popen("ioreg -l -w 0 | grep kCGSSessionSecureInputPID", "r"), pclose); diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index e9bd90b8db..fcc0e20f8b 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -32,7 +32,6 @@ #include #include #include -#include extern "C" { typedef int CGSConnectionID; diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 234b42759a..bd3a69b069 100755 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -845,81 +845,9 @@ OSXScreen::disable() m_isOnScreen = m_isPrimary; } -std::string CFStringRefToStdString(const CFStringRef pCFStringRef) -{ - const char* pCStr = NULL; - - std::string sRet; - - if (pCFStringRef) - { - pCStr = CFStringGetCStringPtr(pCFStringRef, kCFStringEncodingMacRoman); - if(pCStr) - sRet.assign(pCStr); - } - return sRet; -} - -bool isSecureInput() { - NXEventHandle handle = MACH_PORT_NULL; - io_service_t service = MACH_PORT_NULL, service_p = MACH_PORT_NULL; - mach_port_t masterPort; - io_name_t n; - char buf[4096]; - uint32_t s = sizeof(buf); - - kern_return_t kr = IOMasterPort( MACH_PORT_NULL, &masterPort ); - if(kr != KERN_SUCCESS) return false; - - service = IORegistryEntryFromPath( masterPort, kIOServicePlane ":/" ); - IORegistryEntryGetParentEntry(service, kIOServicePlane, &service_p); - CFTypeRef consoleUsers = IORegistryEntrySearchCFProperty(service_p, kIOServicePlane, CFSTR("IOConsoleUsers"), NULL, kIORegistryIterateParents | kIORegistryIterateRecursively); - if(!consoleUsers) return false; - - CFTypeID type = CFGetTypeID(consoleUsers); - if(type != CFArrayGetTypeID()) - { - CFRelease(consoleUsers); - return false; - } - CFTypeRef dict = CFArrayGetValueAtIndex((CFArrayRef)consoleUsers, 0); - if(!dict) - { - CFRelease(consoleUsers); - return false; - } - type = CFGetTypeID(dict); - if(type != CFDictionaryGetTypeID()) - { - CFRelease(consoleUsers); - return false; - } - - CFIndex count = CFDictionaryGetCount((CFDictionaryRef)dict); - const void * keys [count]; - const void * values [count]; - CFDictionaryGetKeysAndValues((CFDictionaryRef)dict, reinterpret_cast(keys), reinterpret_cast(values)); - for(CFIndex i = 0; i < count; ++i) { - CFIndex keySize = CFStringGetMaximumSizeForEncoding(CFStringGetLength(reinterpret_cast(keys[i])), kCFStringEncodingASCII); - char key [keySize + 1]; - - if(!CFStringGetCString(reinterpret_cast(keys[i]), key, keySize + 1, kCFStringEncodingASCII)) { - continue; - } - LOG((CLOG_INFO "registry %s", key)); - } - - - CFIndex secureInputCount = CFDictionaryGetCountOfKey((CFDictionaryRef)dict, CFSTR("kCGSSessionSecureInputPID")); - CFRelease(consoleUsers); - return secureInputCount > 0; -} - void OSXScreen::enter() { - bool secure = isSecureInput(); - showCursor(); if (m_isPrimary) {