Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / client / X11 / xfreerdp.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * X11 Client
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __XFREERDP_H
21 #define __XFREERDP_H
22
23 #include <freerdp/freerdp.h>
24 #include <freerdp/channels/channels.h>
25 #include <freerdp/gdi/gdi.h>
26 #include <freerdp/gdi/dc.h>
27 #include <freerdp/gdi/region.h>
28 #include <freerdp/rail/rail.h>
29 #include <freerdp/cache/cache.h>
30
31 typedef struct xf_info xfInfo;
32
33 #include "xf_window.h"
34 #include "xf_monitor.h"
35
36 struct xf_WorkArea
37 {
38         uint32 x;
39         uint32 y;
40         uint32 width;
41         uint32 height;
42 };
43 typedef struct xf_WorkArea xfWorkArea;
44
45 struct xf_pointer
46 {
47         rdpPointer pointer;
48         Cursor cursor;
49 };
50 typedef struct xf_pointer xfPointer;
51
52 struct xf_bitmap
53 {
54         rdpBitmap bitmap;
55         Pixmap pixmap;
56 };
57 typedef struct xf_bitmap xfBitmap;
58
59 struct xf_glyph
60 {
61         rdpGlyph glyph;
62         Pixmap pixmap;
63 };
64 typedef struct xf_glyph xfGlyph;
65
66 struct xf_context
67 {
68         rdpContext _p;
69
70         xfInfo* xfi;
71         rdpSettings* settings;
72 };
73 typedef struct xf_context xfContext;
74
75 struct xf_info
76 {
77         freerdp* instance;
78         xfContext* context;
79         rdpContext* _context;
80
81         GC gc;
82         int bpp;
83         int xfds;
84         int depth;
85         int width;
86         int height;
87         int srcBpp;
88         GC gc_mono;
89         Screen* screen;
90         XImage* image;
91         Pixmap primary;
92         Pixmap drawing;
93         Visual* visual;
94         Display* display;
95         Drawable drawable;
96         Pixmap bitmap_mono;
97         Colormap colormap;
98         int screen_number;
99         int scanline_pad;
100         boolean big_endian;
101         boolean fullscreen;
102         boolean grab_keyboard;
103         boolean unobscured;
104         boolean decorations;
105         boolean debug;
106         xfWindow* window;
107         xfWorkArea workArea;
108         int current_desktop;
109         boolean remote_app;
110         boolean disconnect;
111         HCLRCONV clrconv;
112         Window parent_window;
113
114         HGDI_DC hdc;
115         boolean sw_gdi;
116         uint8* primary_buffer;
117
118         boolean focused;
119         boolean mouse_active;
120         boolean mouse_motion;
121         boolean fullscreen_toggle;
122         uint32 keyboard_layout_id;
123         boolean pressed_keys[256];
124         XModifierKeymap* modifier_map;
125         XSetWindowAttributes attribs;
126         boolean complex_regions;
127         VIRTUAL_SCREEN vscreen;
128         uint8* bmp_codec_none;
129         uint8* bmp_codec_nsc;
130         void* rfx_context;
131         void* nsc_context;
132         void* xv_context;
133         void* clipboard_context;
134
135         Atom _NET_WM_ICON;
136         Atom _MOTIF_WM_HINTS;
137         Atom _NET_CURRENT_DESKTOP;
138         Atom _NET_WORKAREA;
139
140         Atom _NET_WM_STATE;
141         Atom _NET_WM_STATE_FULLSCREEN;
142         Atom _NET_WM_STATE_SKIP_TASKBAR;
143         Atom _NET_WM_STATE_SKIP_PAGER;
144
145         Atom _NET_WM_WINDOW_TYPE;
146         Atom _NET_WM_WINDOW_TYPE_NORMAL;
147         Atom _NET_WM_WINDOW_TYPE_DIALOG;
148         Atom _NET_WM_WINDOW_TYPE_UTILITY;
149         Atom _NET_WM_WINDOW_TYPE_POPUP;
150         Atom _NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
151
152         Atom _NET_WM_MOVERESIZE;
153         Atom _NET_MOVERESIZE_WINDOW;
154
155         Atom WM_PROTOCOLS;
156         Atom WM_DELETE_WINDOW;
157 };
158
159 void xf_toggle_fullscreen(xfInfo* xfi);
160 boolean xf_post_connect(freerdp* instance);
161
162 enum XF_EXIT_CODE
163 {
164         /* section 0-15: protocol-independent codes */
165         XF_EXIT_SUCCESS = 0,
166         XF_EXIT_DISCONNECT = 1,
167         XF_EXIT_LOGOFF = 2,
168         XF_EXIT_IDLE_TIMEOUT = 3,
169         XF_EXIT_LOGON_TIMEOUT = 4,
170         XF_EXIT_CONN_REPLACED = 5,
171         XF_EXIT_OUT_OF_MEMORY = 6,
172         XF_EXIT_CONN_DENIED = 7,
173         XF_EXIT_CONN_DENIED_FIPS = 8,
174         XF_EXIT_USER_PRIVILEGES = 9,
175         XF_EXIT_FRESH_CREDENTIALS_REQUIRED = 10,
176         XF_EXIT_DISCONNECT_BY_USER = 11,
177
178         /* section 16-31: license error set */
179         XF_EXIT_LICENSE_INTERNAL = 16,
180         XF_EXIT_LICENSE_NO_LICENSE_SERVER = 17,
181         XF_EXIT_LICENSE_NO_LICENSE = 18,
182         XF_EXIT_LICENSE_BAD_CLIENT_MSG = 19,
183         XF_EXIT_LICENSE_HWID_DOESNT_MATCH = 20,
184         XF_EXIT_LICENSE_BAD_CLIENT = 21,
185         XF_EXIT_LICENSE_CANT_FINISH_PROTOCOL = 22,
186         XF_EXIT_LICENSE_CLIENT_ENDED_PROTOCOL = 23,
187         XF_EXIT_LICENSE_BAD_CLIENT_ENCRYPTION = 24,
188         XF_EXIT_LICENSE_CANT_UPGRADE = 25,
189         XF_EXIT_LICENSE_NO_REMOTE_CONNECTIONS = 26,
190
191         /* section 32-127: RDP protocol error set */
192         XF_EXIT_RDP = 32,
193
194         /* section 128-254: xfreerdp specific exit codes */
195         XF_EXIT_PARSE_ARGUMENTS = 128,
196         XF_EXIT_MEMORY = 129,
197         XF_EXIT_PROTOCOL = 130,
198         XF_EXIT_CONN_FAILED = 131,
199
200         XF_EXIT_UNKNOWN = 255,
201 };
202
203 #ifdef WITH_DEBUG_X11
204 #define DEBUG_X11(fmt, ...) DEBUG_CLASS(X11, fmt, ## __VA_ARGS__)
205 #else
206 #define DEBUG_X11(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
207 #endif
208
209 #ifdef WITH_DEBUG_X11_LOCAL_MOVESIZE
210 #define DEBUG_X11_LMS(fmt, ...) DEBUG_CLASS(X11_LMS, fmt, ## __VA_ARGS__)
211 #else
212 #define DEBUG_X11_LMS(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
213 #endif
214
215 #endif /* __XFREERDP_H */