Files
SnapGo/native_overlay_callbacks_darwin.go
T
mamamiyear c45864e44c feat(app): support to edit screenshot area
- relocate or resize the area
- add anotations on the area
2026-06-02 09:01:53 +08:00

41 lines
788 B
Go

//go:build darwin
package main
import "C"
//export nativeOverlayConfirm
func nativeOverlayConfirm(x, y, w, h C.int, annotationsJSON *C.char) {
nativeOverlayState.Lock()
app := nativeOverlayState.app
nativeOverlayState.app = nil
nativeOverlayState.Unlock()
if app == nil {
return
}
rawAnnotations := C.GoString(annotationsJSON)
go func() {
_ = app.ConfirmNativeRegion(CaptureResult{
Rect: RegionRect{
X: int(x),
Y: int(y),
W: int(w),
H: int(h),
},
Annotations: parseNativeAnnotations(rawAnnotations),
})
}()
}
//export nativeOverlayCancel
func nativeOverlayCancel() {
nativeOverlayState.Lock()
app := nativeOverlayState.app
nativeOverlayState.app = nil
nativeOverlayState.Unlock()
if app == nil {
return
}
go app.CancelNativeRegion()
}