Merge pull request #120 from llyzs/cliprdr
[platform/upstream/freerdp.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 <X11/Xlib.h>
24 #include <X11/Xutil.h>
25 #include <freerdp/freerdp.h>
26 #include <freerdp/chanman/chanman.h>
27 #include <freerdp/gdi/gdi.h>
28 #include <freerdp/gdi/dc.h>
29 #include <freerdp/gdi/region.h>
30 #include <freerdp/rail/rail.h>
31 #include <freerdp/cache/cache.h>
32
33 typedef struct xf_info xfInfo;
34
35 #include "xf_window.h"
36 #include "xf_monitor.h"
37
38 #define SET_XFI(_instance, _xfi) (_instance)->param1 = _xfi
39 #define GET_XFI(_instance) ((xfInfo*) ((_instance)->param1))
40
41 #define SET_CHANMAN(_instance, _chanman) (_instance)->param2 = _chanman
42 #define GET_CHANMAN(_instance) ((rdpChanMan*) ((_instance)->param2))
43
44 struct xf_WorkArea
45 {
46         uint32 x;
47         uint32 y;
48         uint32 width;
49         uint32 height;
50 };
51 typedef struct xf_WorkArea xfWorkArea;
52
53 struct xf_info
54 {
55         GC gc;
56         int bpp;
57         int xfds;
58         int depth;
59         int width;
60         int height;
61         int srcBpp;
62         GC gc_mono;
63         Screen* screen;
64         XImage* image;
65         Pixmap primary;
66         Pixmap drawing;
67         Visual* visual;
68         Display* display;
69         Drawable drawable;
70         Pixmap bitmap_mono;
71         Colormap colormap;
72         int screen_number;
73         int scanline_pad;
74         boolean big_endian;
75         boolean fullscreen;
76         boolean unobscured;
77         boolean decoration;
78         freerdp* instance;
79         xfWindow* window;
80         xfWorkArea workArea;
81         int current_desktop;
82         boolean remote_app;
83         HCLRCONV clrconv;
84         rdpRail* rail;
85         rdpCache* cache;
86
87         HGDI_DC hdc;
88         boolean sw_gdi;
89         uint8* primary_buffer;
90
91         boolean focused;
92         boolean mouse_active;
93         boolean mouse_motion;
94         boolean fullscreen_toggle;
95         uint32 keyboard_layout_id;
96         boolean pressed_keys[256];
97         XModifierKeymap* modifier_map;
98         XSetWindowAttributes attribs;
99         boolean complex_regions;
100         VIRTUAL_SCREEN vscreen;
101         uint8* bmp_codec_none;
102         void* rfx_context;
103         void* xv_context;
104         void* clipboard_context;
105
106         Atom _NET_WM_ICON;
107         Atom _MOTIF_WM_HINTS;
108         Atom _NET_CURRENT_DESKTOP;
109         Atom _NET_WORKAREA;
110
111         Atom _NET_WM_STATE;
112         Atom _NET_WM_STATE_FULLSCREEN;
113         Atom _NET_WM_STATE_SKIP_TASKBAR;
114         Atom _NET_WM_STATE_SKIP_PAGER;
115
116         Atom _NET_WM_WINDOW_TYPE;
117         Atom _NET_WM_WINDOW_TYPE_NORMAL;
118         Atom _NET_WM_WINDOW_TYPE_DIALOG;
119         Atom _NET_WM_WINDOW_TYPE_UTILITY;
120
121         Atom _NET_WM_MOVERESIZE;
122
123         Atom WM_PROTOCOLS;
124         Atom WM_DELETE_WINDOW;
125 };
126
127 void xf_toggle_fullscreen(xfInfo* xfi);
128 boolean xf_post_connect(freerdp* instance);
129
130 #ifdef WITH_DEBUG_X11
131 #define DEBUG_X11(fmt, ...) DEBUG_CLASS(X11, fmt, ## __VA_ARGS__)
132 #else
133 #define DEBUG_X11(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
134 #endif
135
136 #ifdef WITH_DEBUG_X11_LOCAL_MOVESIZE
137 #define DEBUG_X11_LMS(fmt, ...) DEBUG_CLASS(X11_LMS, fmt, ## __VA_ARGS__)
138 #else
139 #define DEBUG_X11_LMS(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
140 #endif
141
142
143 #endif /* __XFREERDP_H */