mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-24 03:38:39 +00:00
refactor(macos): dedupe UI, pairing, and runtime helpers
This commit is contained in:
22
apps/macos/Sources/OpenClaw/TrackingAreaSupport.swift
Normal file
22
apps/macos/Sources/OpenClaw/TrackingAreaSupport.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import AppKit
|
||||
|
||||
enum TrackingAreaSupport {
|
||||
@MainActor
|
||||
static func resetMouseTracking(
|
||||
on view: NSView,
|
||||
tracking: inout NSTrackingArea?,
|
||||
owner: AnyObject)
|
||||
{
|
||||
if let tracking {
|
||||
view.removeTrackingArea(tracking)
|
||||
}
|
||||
let options: NSTrackingArea.Options = [
|
||||
.mouseEnteredAndExited,
|
||||
.activeAlways,
|
||||
.inVisibleRect,
|
||||
]
|
||||
let area = NSTrackingArea(rect: view.bounds, options: options, owner: owner, userInfo: nil)
|
||||
view.addTrackingArea(area)
|
||||
tracking = area
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user