From b5da4e00ca1333328fddbc648613778a7e891715 Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Sun, 30 Oct 2022 14:20:46 +0100 Subject: [PATCH] refactor: pass correct param to private api --- src/api-wrappers/PrivateApis.swift | 4 ++-- src/logic/Window.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api-wrappers/PrivateApis.swift b/src/api-wrappers/PrivateApis.swift index a6e90701..1bbc1bfe 100644 --- a/src/api-wrappers/PrivateApis.swift +++ b/src/api-wrappers/PrivateApis.swift @@ -159,7 +159,7 @@ func CGSMoveWindowsToManagedSpace(_ cid: CGSConnectionID, _ windows: NSArray, _ // focuses the front process // * macOS 10.12+ @_silgen_name("_SLPSSetFrontProcessWithOptions") @discardableResult -func _SLPSSetFrontProcessWithOptions(_ psn: inout ProcessSerialNumber, _ wid: CGWindowID, _ mode: SLPSMode) -> CGError +func _SLPSSetFrontProcessWithOptions(_ psn: inout ProcessSerialNumber, _ wid: CGWindowID, _ mode: SLPSMode.RawValue) -> CGError // sends bytes to the WindowServer // more context: https://github.com/Hammerspoon/hammerspoon/issues/370#issuecomment-545545468 @@ -352,7 +352,7 @@ func CGSSpaceAddWindowsAndRemoveFromSpaces(_ cid: CGSConnectionID, _ sid: CGSSpa //// change window order. I tried with relativeToWindow=0, and place=.orderAbove, and it does nothing //// * macOS 10.10+ //@_silgen_name("CGSOrderWindow") @discardableResult -//func CGSOrderWindow(_ cid: CGSConnectionID, _ win: CGWindowID, _ place: CGSWindowOrderingMode, relativeTo: CGWindowID /* can be NULL */) -> OSStatus +//func CGSOrderWindow(_ cid: CGSConnectionID, _ win: CGWindowID, _ place: CGSWindowOrderingMode.RawValue, relativeTo: CGWindowID /* can be NULL */) -> OSStatus // //// Get on-screen window counts and lists. With targetCID=1 -> returns []. With targetCID=0 -> crashes, with targetCID=cid -> crashes //// * macOS 10.10+ diff --git a/src/logic/Window.swift b/src/logic/Window.swift index 3a65e883..6a68fd41 100644 --- a/src/logic/Window.swift +++ b/src/logic/Window.swift @@ -157,7 +157,7 @@ class Window { guard let self = self else { return } var psn = ProcessSerialNumber() GetProcessForPID(self.application.pid, &psn) - _SLPSSetFrontProcessWithOptions(&psn, self.cgWindowId!, .userGenerated) + _SLPSSetFrontProcessWithOptions(&psn, self.cgWindowId!, SLPSMode.userGenerated.rawValue) self.makeKeyWindow(psn) self.axUiElement.focusWindow() }