capture_messages.go RawHistoryFolder
1package ports
2
3import (
4 "image"
5 "time"
6)
7
8// CaptureRequest transfers ownership of Dst.File to the output goroutine.
9type CaptureRequest struct {
10 ID uint64
11 Output string
12 Region image.Rectangle // clipped output buffer coordinates
13 Cursor bool
14 Dst SHMBuffer
15 Width, Height, Stride int
16 Format uint32
17 // Mapped, when set, is the destination instead of Dst.File (nil then):
18 // the image is written at Mapped[Dst.Offset:] with Stride. The sender
19 // keeps the mapping alive until CaptureDone; the output never maps,
20 // unmaps or closes it.
21 Mapped []byte
22 // Session is the registered capture session (CaptureSessionOpen) the
23 // request belongs to, 0 for wlr-screencopy. It is informational, except
24 // with Exclude.
25 Session uint64
26 // Exclude asks for a capture without the exclusion's HUD layers and
27 // popups (SceneCapture.Excluded). Wayland sets it, with Session and
28 // CaptureRevision, only on requests of the session that owns the
29 // exclusion. A renderer fails such a request unless its scene's
30 // Capture.Session is Session and Capture.Revision at least
31 // CaptureRevision (CaptureSessionState).
32 Exclude bool
33 CaptureRevision uint64
34 // Workspace is not 0 for the capture of a workspace's frame. On screen
35 // (OffScreen false) it is an ordinary region of the displayed frame, and
36 // fails unless the scene's Capture.Shown is Workspace. OffScreen is set
37 // when the workspace was not on screen when the request was made: it is
38 // served from Scene.CaptureScene, whole (Region is the whole child
39 // image), and fails unless the scene's Capture.Workspace is Workspace.
40 // Either way a workspace that moved since fails instead of returning
41 // another crop.
42 Workspace uint64
43 OffScreen bool
44 // Window is not 0 for the capture of a window: always OffScreen, served
45 // whole from Scene.CaptureScene, and failed unless the scene's
46 // Capture.Window is Window.
47 Window WindowID
48 // Indicate is set by wayland on every capture it requests: core shows the
49 // capture indicator for it (CaptureFrameTaken), and the output owner
50 // serves the request only from a scene that shows the mark it needs (a
51 // pill for OffScreen, else a border covering Region), so the indicator is
52 // on screen in the same frame as the capture or an earlier one. It holds
53 // the request for a bounded time, then fails it.
54 Indicate bool
55 // Since is when the output owner took the request (monotonic), to bound
56 // that wait. Only the output owner sets it.
57 Since time.Time
58}
59
60// CaptureDone is attempted once after the output closes the destination.
61// Time holds CLOCK_MONOTONIC seconds and nanoseconds since boot, not wall time.
62type CaptureDone struct {
63 ID uint64
64 Output string
65 Err error
66 Time time.Time
67}
68
69// CaptureIDInternal is the bit set in the ID of captures requested by the
70// compositor itself (hint scanning) rather than by a Wayland client. Wayland
71// IDs start at 1 and increment, so they never set it. Replies carrying it are
72// demultiplexed away from the Wayland consumer.
73const CaptureIDInternal uint64 = 1 << 63