SYNERGY-1017 - Remove redundant code changes
This commit is contained in:
parent
aeeff84c6f
commit
11d5bbc1bc
5 changed files with 0 additions and 123 deletions
|
|
@ -173,7 +173,6 @@ if (UNIX)
|
||||||
find_library (lib_ApplicationServices ApplicationServices)
|
find_library (lib_ApplicationServices ApplicationServices)
|
||||||
find_library (lib_Foundation Foundation)
|
find_library (lib_Foundation Foundation)
|
||||||
find_library (lib_Carbon Carbon)
|
find_library (lib_Carbon Carbon)
|
||||||
find_library (lib_UserNotifications UserNotifications)
|
|
||||||
|
|
||||||
list (APPEND libs
|
list (APPEND libs
|
||||||
${lib_ScreenSaver}
|
${lib_ScreenSaver}
|
||||||
|
|
@ -181,7 +180,6 @@ if (UNIX)
|
||||||
${lib_ApplicationServices}
|
${lib_ApplicationServices}
|
||||||
${lib_Foundation}
|
${lib_Foundation}
|
||||||
${lib_Carbon}
|
${lib_Carbon}
|
||||||
${lib_UserNotifications}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
else() # not-apple
|
else() # not-apple
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#define OSXHELPERS__H
|
#define OSXHELPERS__H
|
||||||
|
|
||||||
bool isOSXSecureInputEnabled();
|
bool isOSXSecureInputEnabled();
|
||||||
void OSXSendSecureInputNotification();
|
|
||||||
bool isOSXInterfaceStyleDark();
|
bool isOSXInterfaceStyleDark();
|
||||||
bool isOSXUseDarkIcons();
|
bool isOSXUseDarkIcons();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,56 +23,9 @@
|
||||||
#import <array>
|
#import <array>
|
||||||
#import <string>
|
#import <string>
|
||||||
|
|
||||||
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
|
bool
|
||||||
isOSXSecureInputEnabled()
|
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<char, 128> buffer;
|
std::array<char, 128> buffer;
|
||||||
std::string result;
|
std::string result;
|
||||||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("ioreg -l -w 0 | grep kCGSSessionSecureInputPID", "r"), pclose);
|
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("ioreg -l -w 0 | grep kCGSSessionSecureInputPID", "r"), pclose);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
#include <mach/mach_init.h>
|
#include <mach/mach_init.h>
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
#include <IOKit/IOMessage.h>
|
#include <IOKit/IOMessage.h>
|
||||||
#include <IOKit/IOKitLib.h>
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
typedef int CGSConnectionID;
|
typedef int CGSConnectionID;
|
||||||
|
|
|
||||||
|
|
@ -845,81 +845,9 @@ OSXScreen::disable()
|
||||||
m_isOnScreen = m_isPrimary;
|
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<const void **>(keys), reinterpret_cast<const void **>(values));
|
|
||||||
for(CFIndex i = 0; i < count; ++i) {
|
|
||||||
CFIndex keySize = CFStringGetMaximumSizeForEncoding(CFStringGetLength(reinterpret_cast<CFStringRef>(keys[i])), kCFStringEncodingASCII);
|
|
||||||
char key [keySize + 1];
|
|
||||||
|
|
||||||
if(!CFStringGetCString(reinterpret_cast<CFStringRef>(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
|
void
|
||||||
OSXScreen::enter()
|
OSXScreen::enter()
|
||||||
{
|
{
|
||||||
bool secure = isSecureInput();
|
|
||||||
|
|
||||||
showCursor();
|
showCursor();
|
||||||
|
|
||||||
if (m_isPrimary) {
|
if (m_isPrimary) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue