FreeRDP
Loading...
Searching...
No Matches
mac_shadow.h
1
19#ifndef FREERDP_SERVER_SHADOW_MAC_SHADOW_H
20#define FREERDP_SERVER_SHADOW_MAC_SHADOW_H
21
22#include <freerdp/server/shadow.h>
23
24typedef struct mac_shadow_subsystem macShadowSubsystem;
25
26#include <winpr/crt.h>
27#include <winpr/synch.h>
28#include <winpr/thread.h>
29#include <winpr/stream.h>
30#include <winpr/collections.h>
31
32#include <freerdp/codec/region.h>
33
34#include <CoreGraphics/CoreGraphics.h>
35#include <CoreVideo/CoreVideo.h>
36#include <IOKit/pwr_mgt/IOPMLib.h>
37
38#include "mac_capture.h"
39#include "mac_cursor.h"
40
41#define MAC_SHADOW_MAX_DISPLAYS 16
42
44{
45 rdpShadowSubsystem common;
46
47 /* the display shared, in global display coordinates (points) */
48 CGDirectDisplayID display;
49 CGRect bounds;
50 /* the size of the surface and of the captured frames, in pixels */
51 UINT32 width;
52 UINT32 height;
53
54 /* the stream, how it was made (to make it again) and the event its end
55 * sets: it ends when the display turns off, and starts again once the
56 * display is back */
57 macCapture *capture;
58 macCaptureConfig config;
59 HANDLE lostEvent;
60 /* when the displays were last looked at */
61 UINT64 displaysChecked;
62 HANDLE thread;
63 HANDLE stopEvent;
64
65 /* the newest frame and what changed since it was last sent, under frameLock */
66 CRITICAL_SECTION frameLock;
67 CVPixelBufferRef frame;
68 REGION16 pending;
69 HANDLE frameEvent;
70 BOOL sizeWarned;
71
72 /* input state: mouse buttons down, modifiers down, the last click */
73 UINT32 buttonsDown;
74 CGEventFlags modifiers;
75 UINT64 lastClickTime;
76 CGMouseButton lastClickButton;
77 CGPoint lastClickPoint;
78 int64_t clickCount;
79 INT32 wheelRemainder[2];
80
81 /* sound: samples gathered into messages of 20 ms */
82 wStream *audioStream;
83
84 /* sound statistics, logged every few seconds at debug level */
85 UINT64 audioFrames;
86 UINT64 audioMessages;
87 float audioPeak;
88 UINT64 audioLogged;
89
90 /* the cursor: the clients draw it themselves, from its shape and position */
91 UINT32 cursorHash;
92 BOOL cursorKnown;
93 UINT64 cursorNext;
94
95 /* under clientLock: the clients connected (the display stays awake while
96 * there are any), when one last moved the pointer, and whether a client
97 * asked for the whole screen, cursor included */
98 CRITICAL_SECTION clientLock;
99 UINT32 clients;
100 IOPMAssertionID awake;
101 UINT64 pointerInput;
102 BOOL cursorResend;
103};
104
105#endif /* FREERDP_SERVER_SHADOW_MAC_SHADOW_H */