SYNERGY-1017 - Simplify the check for secure input

This commit is contained in:
Igor Sikachyna 2021-06-07 13:30:39 +03:00
parent a9949fdd80
commit 3e5626e48a

View file

@ -22,21 +22,13 @@
#import <Cocoa/Cocoa.h>
#import <array>
#import <string>
#import <Carbon/Carbon.h>
bool
isOSXSecureInputEnabled()
{
std::array<char, 128> buffer;
std::string result;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen("ioreg -l -w 0 | grep kCGSSessionSecureInputPID", "r"), pclose);
if (!pipe) {
return false;
}
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr)
{
result += buffer.data();
}
return result.length() > 0;
return IsSecureEventInputEnabled();
}
bool