FreeRDP
xf_window.h
1 
20 #ifndef FREERDP_CLIENT_X11_WINDOW_H
21 #define FREERDP_CLIENT_X11_WINDOW_H
22 
23 #include <X11/Xlib.h>
24 
25 #include <winpr/platform.h>
26 #include <freerdp/freerdp.h>
27 #include <freerdp/gdi/gfx.h>
28 
29 typedef struct xf_app_window xfAppWindow;
30 
31 typedef struct xf_localmove xfLocalMove;
32 typedef struct xf_window xfWindow;
33 
34 #include "xf_client.h"
35 #include "xf_floatbar.h"
36 #include "xfreerdp.h"
37 
38 // Extended ICCM flags http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
39 WINPR_PRAGMA_DIAG_PUSH
40 WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
41 
42 #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
43 #define _NET_WM_MOVERESIZE_SIZE_TOP 1
44 #define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
45 #define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
46 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
47 #define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
48 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
49 #define _NET_WM_MOVERESIZE_SIZE_LEFT 7
50 #define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
51 #define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
52 #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
53 #define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
54 
55 #define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
56 #define _NET_WM_STATE_ADD 1 /* add/set property */
57 #define _NET_WM_STATE_TOGGLE 2 /* toggle property */
58 
59 WINPR_PRAGMA_DIAG_POP
60 
61 enum xf_localmove_state
62 {
63  LMS_NOT_ACTIVE,
64  LMS_STARTING,
65  LMS_ACTIVE,
66  LMS_TERMINATING
67 };
68 
70 {
71  int root_x;
72  int root_y;
73  int window_x;
74  int window_y;
75  enum xf_localmove_state state;
76  int direction;
77 };
78 
79 struct xf_window
80 {
81  GC gc;
82  int left;
83  int top;
84  int right;
85  int bottom;
86  int width;
87  int height;
88  int shmid;
89  Window handle;
90  Window* xfwin;
91  xfFloatbar* floatbar;
92  BOOL decorations;
93  BOOL is_mapped;
94  BOOL is_transient;
95 };
96 
98 {
99  xfContext* xfc;
100 
101  int x;
102  int y;
103  int width;
104  int height;
105  char* title;
106 
107  UINT32 surfaceId;
108  UINT64 windowId;
109  UINT32 ownerWindowId;
110 
111  UINT32 dwStyle;
112  UINT32 dwExStyle;
113  UINT32 showState;
114 
115  INT32 clientOffsetX;
116  INT32 clientOffsetY;
117  UINT32 clientAreaWidth;
118  UINT32 clientAreaHeight;
119 
120  INT32 windowOffsetX;
121  INT32 windowOffsetY;
122  INT32 windowClientDeltaX;
123  INT32 windowClientDeltaY;
124  UINT32 windowWidth;
125  UINT32 windowHeight;
126  UINT32 numWindowRects;
127  RECTANGLE_16* windowRects;
128 
129  INT32 visibleOffsetX;
130  INT32 visibleOffsetY;
131  UINT32 numVisibilityRects;
132  RECTANGLE_16* visibilityRects;
133 
134  UINT32 localWindowOffsetCorrX;
135  UINT32 localWindowOffsetCorrY;
136 
137  UINT32 resizeMarginLeft;
138  UINT32 resizeMarginTop;
139  UINT32 resizeMarginRight;
140  UINT32 resizeMarginBottom;
141 
142  GC gc;
143  int shmid;
144  Window handle;
145  Window* xfwin;
146  BOOL fullscreen;
147  BOOL decorations;
148  BOOL is_mapped;
149  BOOL is_transient;
150  xfLocalMove local_move;
151  BYTE rail_state;
152  BOOL maxVert;
153  BOOL maxHorz;
154  BOOL minimized;
155  BOOL rail_ignore_configure;
156 
157  Pixmap pixmap;
158  XImage* image;
159 };
160 
161 void xf_ewmhints_init(xfContext* xfc);
162 
163 BOOL xf_GetWorkArea(xfContext* xfc);
164 
165 void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen);
166 void xf_SetWindowMinimized(xfContext* xfc, xfWindow* window);
167 void xf_SetWindowDecorations(xfContext* xfc, Window window, BOOL show);
168 void xf_SetWindowUnlisted(xfContext* xfc, Window window);
169 
170 xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int height);
171 void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height);
172 void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window);
173 
174 Window xf_CreateDummyWindow(xfContext* xfc);
175 void xf_DestroyDummyWindow(xfContext* xfc, Window window);
176 
177 BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int length,
178  unsigned long* nitems, unsigned long* bytes, BYTE** prop);
179 void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int numArgs, ...);
180 
181 BOOL xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow);
182 int xf_AppWindowInit(xfContext* xfc, xfAppWindow* appWindow);
183 
184 BOOL xf_AppWindowResize(xfContext* xfc, xfAppWindow* appWindow);
185 
186 void xf_SetWindowText(xfContext* xfc, xfAppWindow* appWindow, const char* name);
187 void xf_MoveWindow(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width, int height);
188 void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state);
189 // void xf_SetWindowIcon(xfContext* xfc, xfAppWindow* appWindow, rdpIcon* icon);
190 void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rects, int nrects);
191 void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32 rectsOffsetX,
192  UINT32 rectsOffsetY, RECTANGLE_16* rects, int nrects);
193 void xf_SetWindowStyle(xfContext* xfc, xfAppWindow* appWindow, UINT32 style, UINT32 ex_style);
194 void xf_SetWindowActions(xfContext* xfc, xfAppWindow* appWindow);
195 void xf_UpdateWindowArea(xfContext* xfc, xfAppWindow* appWindow, int x, int y, int width,
196  int height);
197 UINT xf_AppUpdateWindowFromSurface(xfContext* xfc, gdiGfxSurface* surface);
198 
199 void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow);
200 void xf_SetWindowMinMaxInfo(xfContext* xfc, xfAppWindow* appWindow, int maxWidth, int maxHeight,
201  int maxPosX, int maxPosY, int minTrackWidth, int minTrackHeight,
202  int maxTrackWidth, int maxTrackHeight);
203 void xf_StartLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow, int direction, int x, int y);
204 void xf_EndLocalMoveSize(xfContext* xfc, xfAppWindow* appWindow);
205 xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd);
206 
207 const char* window_styles_to_string(UINT32 style, char* buffer, size_t length);
208 const char* window_styles_ex_to_string(UINT32 styleEx, char* buffer, size_t length);
209 
210 #endif /* FREERDP_CLIENT_X11_WINDOW_H */