Skip to content

Commit

Permalink
refactor: pass correct param to private api
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Nov 2, 2022
1 parent 4c3688d commit b5da4e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/api-wrappers/PrivateApis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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+
Expand Down
2 changes: 1 addition & 1 deletion src/logic/Window.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit b5da4e0

Please sign in to comment.