fix: parallels windows wouldn't switch sometimes (closes #1213)

This commit is contained in:
Zachary Wander authored and lwouis committed 2021-11-13 01:39:28 +09:00
1 parent e2d26f2abc
commit 21133ce118
1 file changed
+1 -3
+1 -3
View File
@@ -158,10 +158,8 @@ class Window {
// You can reproduce this buggy behaviour by clicking on the dock icon, proving it's an OS bug // You can reproduce this buggy behaviour by clicking on the dock icon, proving it's an OS bug
BackgroundWork.accessibilityCommandsQueue.asyncWithCap { [weak self] in BackgroundWork.accessibilityCommandsQueue.asyncWithCap { [weak self] in
guard let self = self else { return } guard let self = self else { return }
var elementConnection = UInt32(0)
CGSGetWindowOwner(cgsMainConnectionId, self.cgWindowId, &elementConnection)
var psn = ProcessSerialNumber() var psn = ProcessSerialNumber()
CGSGetConnectionPSN(elementConnection, &psn) GetProcessForPID(self.application.pid, &psn)
_SLPSSetFrontProcessWithOptions(&psn, self.cgWindowId, .userGenerated) _SLPSSetFrontProcessWithOptions(&psn, self.cgWindowId, .userGenerated)
self.makeKeyWindow(psn) self.makeKeyWindow(psn)
self.axUiElement.focusWindow() self.axUiElement.focusWindow()