Compare source pid from event to detect local input on Mac
This commit is contained in:
parent
f83da9ae34
commit
9551329392
|
@ -1844,20 +1844,18 @@ OSXScreen::handleCGInputEventSecondary(
|
||||||
CGEventRef event,
|
CGEventRef event,
|
||||||
void* refcon)
|
void* refcon)
|
||||||
{
|
{
|
||||||
CGEventMask mask = kCGEventFlagMaskCommand;
|
static pid_t currentPid = getpid();
|
||||||
mask = CGEventGetFlags(event);
|
auto sourcePid = CGEventGetIntegerValueField(event, kCGEventSourceUnixProcessID);
|
||||||
LOG ((CLOG_INFO "%x", mask));
|
|
||||||
auto i = CGEventGetIntegerValueField(event, kCGEventSourceUnixProcessID);
|
|
||||||
LOG ((CLOG_INFO "Target PID:%lld", i));
|
|
||||||
|
|
||||||
|
if (currentPid != sourcePid) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case kCGEventLeftMouseDown:
|
case kCGEventLeftMouseDown:
|
||||||
case kCGEventRightMouseDown:
|
case kCGEventRightMouseDown:
|
||||||
case kCGEventOtherMouseDown:
|
case kCGEventOtherMouseDown:
|
||||||
case kCGEventScrollWheel:
|
|
||||||
case kCGEventKeyDown:
|
case kCGEventKeyDown:
|
||||||
case kCGEventFlagsChanged:
|
case kCGEventFlagsChanged:
|
||||||
;//LOG((CLOG_INFO "local input detected"));
|
LOG((CLOG_INFO "local input detected"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
|
|
Loading…
Reference in New Issue