Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / client / X11 / xf_window.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * X11 Windows
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 __XF_WINDOW_H
21 #define __XF_WINDOW_H
22
23 #include <X11/Xlib.h>
24 #include <freerdp/freerdp.h>
25 #include <freerdp/utils/memory.h>
26
27 typedef struct xf_localmove xfLocalMove;
28 typedef struct xf_window xfWindow;
29
30 #include "xfreerdp.h"
31
32 // Extended ICCM flags http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
33 #define _NET_WM_MOVERESIZE_SIZE_TOPLEFT      0
34 #define _NET_WM_MOVERESIZE_SIZE_TOP          1
35 #define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT     2
36 #define _NET_WM_MOVERESIZE_SIZE_RIGHT        3
37 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT  4
38 #define _NET_WM_MOVERESIZE_SIZE_BOTTOM       5
39 #define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT   6
40 #define _NET_WM_MOVERESIZE_SIZE_LEFT         7
41 #define _NET_WM_MOVERESIZE_MOVE              8   /* movement only */
42 #define _NET_WM_MOVERESIZE_SIZE_KEYBOARD     9   /* size via keyboard */
43 #define _NET_WM_MOVERESIZE_MOVE_KEYBOARD    10   /* move via keyboard */
44 #define _NET_WM_MOVERESIZE_CANCEL           11   /* cancel operation */
45
46 enum xf_localmove_state
47 {
48         LMS_NOT_ACTIVE,
49         LMS_STARTING,
50         LMS_ACTIVE,
51         LMS_TERMINATING
52 };
53
54 struct xf_localmove
55 {
56         int root_x;  // relative to root
57         int root_y;
58         int window_x; // relative to window
59         int window_y;
60         enum xf_localmove_state state;
61 };
62
63 struct xf_window
64 {
65         GC gc;
66         int left;
67         int top;
68         int right;
69         int bottom;
70         int width;
71         int height;
72         Window handle;
73         boolean fullscreen;
74         boolean decorations;
75         rdpWindow* window;
76         boolean is_mapped;
77         boolean is_transient;
78         xfLocalMove local_move;
79 };
80
81 void xf_ewmhints_init(xfInfo* xfi);
82
83 boolean xf_GetCurrentDesktop(xfInfo* xfi);
84 boolean xf_GetWorkArea(xfInfo* xfi);
85
86 void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, boolean fullscreen);
87 void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, boolean show);
88 void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window);
89
90 xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, boolean decorations);
91 void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height);
92
93 xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, uint32 id);
94 void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height);
95 void xf_ShowWindow(xfInfo* xfi, xfWindow* window, uint8 state);
96 void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon);
97 void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects);
98 void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects);
99 void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_style);
100 void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height);
101 boolean xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y);
102 void xf_DestroyWindow(xfInfo* xfi, xfWindow* window);
103
104 void xf_SetWindowMinMaxInfo(xfInfo* xfi, xfWindow* window, int maxWidth, int maxHeight,
105                 int maxPosX, int maxPosY, int minTrackWidth, int minTrackHeight, int maxTrackWidth, int maxTrackHeight);
106
107
108 void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, int y);
109 void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window);
110 void xf_SendClientEvent(xfInfo *xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...);
111
112 #endif /* __XF_WINDOW_H */