feat(agent): add screen blackout feature
- Physical displays blanked via overlay - Remote video and input keep working - Exclude overlay from screen capture - Add blackout API and UI toggle - Wire flag through capture protocol
This commit is contained in:
@@ -16,6 +16,18 @@ import (
|
||||
|
||||
var ErrMonitorNotFound = errors.New("monitor not found")
|
||||
|
||||
const (
|
||||
srcCopy = 0x00CC0020
|
||||
captureBlt = 0x40000000
|
||||
)
|
||||
|
||||
var omitLayeredWindows bool
|
||||
|
||||
// SetOmitLayered skips CAPTUREBLT so WS_EX_LAYERED overlays (blackout) stay off the bitmap.
|
||||
func SetOmitLayered(omit bool) {
|
||||
omitLayeredWindows = omit
|
||||
}
|
||||
|
||||
var (
|
||||
user32 = syscall.NewLazyDLL("user32.dll")
|
||||
gdi32 = syscall.NewLazyDLL("gdi32.dll")
|
||||
@@ -210,8 +222,11 @@ func captureRect(r rect) (*image.RGBA, error) {
|
||||
defer procDeleteObject.Call(bitmap)
|
||||
old, _, _ := procSelectObject.Call(memDC, bitmap)
|
||||
defer procSelectObject.Call(memDC, old)
|
||||
const srccopy = 0x00CC0020 | 0x40000000 // SRCCOPY | CAPTUREBLT
|
||||
ok, _, err := procBitBlt.Call(memDC, 0, 0, uintptr(width), uintptr(height), screenDC, uintptr(int64(r.Left)), uintptr(int64(r.Top)), srccopy)
|
||||
blit := uintptr(srcCopy)
|
||||
if !omitLayeredWindows {
|
||||
blit |= captureBlt
|
||||
}
|
||||
ok, _, err := procBitBlt.Call(memDC, 0, 0, uintptr(width), uintptr(height), screenDC, uintptr(int64(r.Left)), uintptr(int64(r.Top)), blit)
|
||||
if ok == 0 {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user