upgrade for xorg-server 1.12.99.905 (for 1.13 RC)
[framework/uifw/xorg/server/xorg-server.git] / hw / kdrive / ephyr / hostx.h
1 /*
2  * Xephyr - A kdrive X server thats runs in a host X window.
3  *          Authored by Matthew Allum <mallum@o-hand.com>
4  * 
5  * Copyright © 2004 Nokia 
6  *
7  * Permission to use, copy, modify, distribute, and sell this software and its
8  * documentation for any purpose is hereby granted without fee, provided that
9  * the above copyright notice appear in all copies and that both that
10  * copyright notice and this permission notice appear in supporting
11  * documentation, and that the name of Nokia not be used in
12  * advertising or publicity pertaining to distribution of the software without
13  * specific, written prior permission. Nokia makes no
14  * representations about the suitability of this software for any purpose.  It
15  * is provided "as is" without express or implied warranty.
16  *
17  * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19  * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23  * PERFORMANCE OF THIS SOFTWARE.
24  */
25
26 #ifndef _XLIBS_STUFF_H_
27 #define _XLIBS_STUFF_H_
28
29 #include <X11/X.h>
30 #include <X11/Xmd.h>
31
32 #define EPHYR_WANT_DEBUG 0
33
34 #if (EPHYR_WANT_DEBUG)
35 #define EPHYR_DBG(x, a...) \
36  fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
37 #else
38 #define EPHYR_DBG(x, a...) do {} while (0)
39 #endif
40
41 typedef struct EphyrHostXVars EphyrHostXVars;
42 typedef struct EphyrHostXEvent EphyrHostXEvent;
43 typedef void *EphyrScreenInfo;
44 typedef enum EphyrHostXEventType {
45     EPHYR_EV_MOUSE_MOTION,
46     EPHYR_EV_MOUSE_PRESS,
47     EPHYR_EV_MOUSE_RELEASE,
48     EPHYR_EV_KEY_PRESS,
49     EPHYR_EV_KEY_RELEASE,
50     EPHYR_EV_EXPOSE,
51     EPHYR_EV_CONFIGURE,
52 } EphyrHostXEventType;
53
54 /* I can't believe it's not a KeySymsRec. */
55 typedef struct {
56     int minKeyCode;
57     int maxKeyCode;
58     int mapWidth;
59     CARD32 *map;
60 } EphyrKeySyms;
61
62 struct EphyrHostXEvent {
63     EphyrHostXEventType type;
64
65     union {
66         struct mouse_motion {
67             int x;
68             int y;
69             int screen;
70             int window;
71         } mouse_motion;
72
73         struct mouse_down {
74             int button_num;
75         } mouse_down;
76
77         struct mouse_up {
78             int button_num;
79         } mouse_up;
80
81         struct key_up {
82             int scancode;
83         } key_up;
84
85         struct key_down {
86             int scancode;
87         } key_down;
88
89         struct expose {
90             int window;
91         } expose;
92
93         struct configure {
94             int width;
95             int height;
96             int screen;
97             int window;
98         } configure;
99
100     } data;
101
102     int key_state;
103 };
104
105 typedef struct {
106     VisualID visualid;
107     int screen;
108     int depth;
109     int class;
110     unsigned long red_mask;
111     unsigned long green_mask;
112     unsigned long blue_mask;
113     int colormap_size;
114     int bits_per_rgb;
115 } EphyrHostVisualInfo;
116
117 typedef struct {
118     int x, y;
119     int width, height;
120     int visualid;
121 } EphyrHostWindowAttributes;
122
123 typedef struct {
124     int x, y, width, height;
125 } EphyrBox;
126
127 typedef struct {
128     short x1, y1, x2, y2;
129 } EphyrRect;
130
131 int
132  hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height);
133
134 int
135  hostx_want_host_cursor(void);
136
137 void
138  hostx_use_host_cursor(void);
139
140 void
141  hostx_use_fullscreen(void);
142
143 int
144  hostx_want_fullscreen(void);
145
146 int
147  hostx_want_preexisting_window(EphyrScreenInfo screen);
148
149 void
150  hostx_use_preexisting_window(unsigned long win_id);
151
152 void
153  hostx_use_resname(char *name, int fromcmd);
154
155 void
156  hostx_set_title(char *name);
157
158 void
159  hostx_handle_signal(int signum);
160
161 int
162  hostx_init(void);
163
164 void
165  hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num);
166
167 void
168  hostx_set_display_name(char *name);
169
170 void
171  hostx_set_screen_number(EphyrScreenInfo screen, int number);
172
173 void
174  hostx_set_win_title(EphyrScreenInfo screen, char *extra_text);
175
176 int
177  hostx_get_depth(void);
178
179 int
180  hostx_get_server_depth(EphyrScreenInfo screen);
181
182 void
183  hostx_set_server_depth(EphyrScreenInfo screen, int depth);
184
185 int
186  hostx_get_bpp(void *info);
187
188 void
189  hostx_get_visual_masks(void *info, CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
190 void
191
192 hostx_set_cmap_entry(unsigned char idx,
193                      unsigned char r, unsigned char g, unsigned char b);
194
195 void *hostx_screen_init(EphyrScreenInfo screen,
196                         int width, int height, int buffer_height);
197
198 void
199
200 hostx_paint_rect(EphyrScreenInfo screen,
201                  int sx, int sy, int dx, int dy, int width, int height);
202
203 void
204  hostx_load_keymap(void);
205
206 int
207  hostx_get_event(EphyrHostXEvent * ev);
208
209 void *hostx_get_display(void);
210
211 int
212  hostx_get_window(int a_screen_number);
213
214 int
215  hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
216
217 int
218
219 hostx_get_extension_info(const char *a_ext_name,
220                          int *a_major_opcode,
221                          int *a_first_even, int *a_first_error);
222 int
223  hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
224
225 int hostx_create_window(int a_screen_number,
226                         EphyrBox * a_geometry,
227                         int a_visual_id, int *a_host_win /*out parameter */ );
228
229 int hostx_destroy_window(int a_win);
230
231 int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
232
233 int hostx_set_window_bounding_rectangles(int a_window,
234                                          EphyrRect * a_rects, int a_num_rects);
235
236 int hostx_set_window_clipping_rectangles(int a_window,
237                                          EphyrRect * a_rects, int a_num_rects);
238 int hostx_has_xshape(void);
239
240 #ifdef XF86DRI
241 int hostx_lookup_peer_window(void *a_local_window,
242                              int *a_host_peer /*out parameter */ );
243 int
244
245 hostx_allocate_resource_id_peer(int a_local_resource_id,
246                                 int *a_remote_resource_id);
247 int
248  hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id);
249 int hostx_has_dri(void);
250
251 int hostx_has_glx(void);
252 #endif                          /* XF86DRI */
253
254 #endif /*_XLIBS_STUFF_H_*/