SYNERGY-1017 - Simplify the check for secure input
This commit is contained in:
parent
a9949fdd80
commit
3e5626e48a
1 changed files with 3 additions and 11 deletions
|
|
@ -22,21 +22,13 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <array>
|
#import <array>
|
||||||
#import <string>
|
#import <string>
|
||||||
|
#import <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isOSXSecureInputEnabled()
|
isOSXSecureInputEnabled()
|
||||||
{
|
{
|
||||||
std::array<char, 128> buffer;
|
return IsSecureEventInputEnabled();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue