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 HANDLE thread;
61 HANDLE stopEvent;
62
63 /* the newest frame and what changed since it was last sent, under frameLock */
64 CRITICAL_SECTION frameLock;
65 CVPixelBufferRef frame;
66 REGION16 pending;
67 HANDLE frameEvent;
68 BOOL sizeWarned;
69
70 /* input state: mouse buttons down, modifiers down, the last click */
71 UINT32 buttonsDown;
72 CGEventFlags modifiers;
73 UINT64 lastClickTime;
74 CGMouseButton lastClickButton;
75 CGPoint lastClickPoint;
76 int64_t clickCount;
77 INT32 wheelRemainder[2];
78
79 /* sound: samples gathered into messages of 20 ms */
80 wStream *audioStream;
81
82 /* sound statistics, logged every few seconds at debug level */
83 UINT64 audioFrames;
84 UINT64 audioMessages;
85 float audioPeak;
86 UINT64 audioLogged;
87
88 /* the cursor: the clients draw it themselves, from its shape and position */
89 UINT32 cursorHash;
90 BOOL cursorKnown;
91 UINT64 cursorNext;
92
93 /* under clientLock: the clients connected (the display stays awake while
94 * there are any), when one last moved the pointer, and whether a client
95 * asked for the whole screen, cursor included */
96 CRITICAL_SECTION clientLock;
97 UINT32 clients;
98 IOPMAssertionID awake;
99 UINT64 pointerInput;
100 BOOL cursorResend;
101};
102
103#endif /* FREERDP_SERVER_SHADOW_MAC_SHADOW_H */