1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  *
4  * Copyright 2011-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef FREERDP_SERVER_SHADOW_X11_H
20 #define FREERDP_SERVER_SHADOW_X11_H
21 
22 #include <freerdp/server/shadow.h>
23 
24 typedef struct x11_shadow_subsystem x11ShadowSubsystem;
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 <X11/Xlib.h>
33 
34 #ifdef WITH_XSHM
35 #include <X11/extensions/XShm.h>
36 #endif
37 
38 #ifdef WITH_XFIXES
39 #include <X11/extensions/Xfixes.h>
40 #endif
41 
42 #ifdef WITH_XTEST
43 #include <X11/extensions/XTest.h>
44 #endif
45 
46 #ifdef WITH_XDAMAGE
47 #include <X11/extensions/Xdamage.h>
48 #endif
49 
50 #ifdef WITH_XINERAMA
51 #include <X11/extensions/Xinerama.h>
52 #endif
53 
54 struct x11_shadow_subsystem
55 {
56 	rdpShadowSubsystem common;
57 
58 	HANDLE thread;
59 
60 	UINT32 bpp;
61 	int xfds;
62 	UINT32 depth;
63 	UINT32 width;
64 	UINT32 height;
65 	int number;
66 	XImage* image;
67 	Screen* screen;
68 	Visual* visual;
69 	Display* display;
70 	UINT32 scanline_pad;
71 	BOOL composite;
72 
73 	BOOL use_xshm;
74 	BOOL use_xfixes;
75 	BOOL use_xdamage;
76 	BOOL use_xinerama;
77 
78 	XImage* fb_image;
79 	Pixmap fb_pixmap;
80 	Window root_window;
81 	XShmSegmentInfo fb_shm_info;
82 
83 	UINT32 cursorHotX;
84 	UINT32 cursorHotY;
85 	UINT32 cursorWidth;
86 	UINT32 cursorHeight;
87 	UINT32 cursorId;
88 	BYTE* cursorPixels;
89 	UINT32 cursorMaxWidth;
90 	UINT32 cursorMaxHeight;
91 	rdpShadowClient* lastMouseClient;
92 
93 #ifdef WITH_XDAMAGE
94 	GC xshm_gc;
95 	Damage xdamage;
96 	int xdamage_notify_event;
97 	XserverRegion xdamage_region;
98 #endif
99 
100 #ifdef WITH_XFIXES
101 	int xfixes_cursor_notify_event;
102 #endif
103 };
104 
105 #ifdef __cplusplus
106 extern "C"
107 {
108 #endif
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif /* FREERDP_SERVER_SHADOW_X11_H */
115