xref: /OK3568_Linux_fs/external/xserver/hw/kdrive/ephyr/hostx.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 #include <xcb/xcb.h>
32 #include <xcb/render.h>
33 #include "ephyr.h"
34 
35 #define EPHYR_WANT_DEBUG 0
36 
37 #if (EPHYR_WANT_DEBUG)
38 #define EPHYR_DBG(x, a...) \
39  fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
40 #else
41 #define EPHYR_DBG(x, a...) do {} while (0)
42 #endif
43 
44 typedef struct EphyrHostXVars EphyrHostXVars;
45 
46 typedef struct {
47     VisualID visualid;
48     int screen;
49     int depth;
50     int class;
51     unsigned long red_mask;
52     unsigned long green_mask;
53     unsigned long blue_mask;
54     int colormap_size;
55     int bits_per_rgb;
56 } EphyrHostVisualInfo;
57 
58 typedef struct {
59     int x, y;
60     int width, height;
61     int visualid;
62 } EphyrHostWindowAttributes;
63 
64 typedef struct {
65     int x, y, width, height;
66 } EphyrBox;
67 
68 typedef struct {
69     short x1, y1, x2, y2;
70 } EphyrRect;
71 
72 int
73 hostx_want_screen_geometry(KdScreenInfo *screen, int *width, int *height, int *x, int *y);
74 
75 int
76  hostx_want_host_cursor(void);
77 
78 void
79  hostx_use_sw_cursor(void);
80 
81 xcb_cursor_t
82  hostx_get_empty_cursor(void);
83 
84 void
85  hostx_get_output_geometry(const char *output,
86                            int *x, int *y,
87                            int *width, int *height);
88 
89 void
90  hostx_use_fullscreen(void);
91 
92 int
93  hostx_want_fullscreen(void);
94 
95 int
96 hostx_want_preexisting_window(KdScreenInfo *screen);
97 
98 void
99  hostx_use_preexisting_window(unsigned long win_id);
100 
101 void
102  hostx_use_resname(char *name, int fromcmd);
103 
104 void
105  hostx_set_title(char *name);
106 
107 void
108  hostx_handle_signal(int signum);
109 
110 int
111  hostx_init(void);
112 
113 void
114 hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num, Bool use_geometry, const char *output);
115 
116 void
117  hostx_set_display_name(char *name);
118 
119 void
120 hostx_set_screen_number(KdScreenInfo *screen, int number);
121 
122 void
123 hostx_set_win_title(KdScreenInfo *screen, const char *extra_text);
124 
125 int
126  hostx_get_depth(void);
127 
128 int
129 hostx_get_server_depth(KdScreenInfo *screen);
130 
131 int
132 hostx_get_bpp(KdScreenInfo *screen);
133 
134 void
135 hostx_get_visual_masks(KdScreenInfo *screen,
136                        CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
137 void
138 
139 hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
140                      unsigned char r, unsigned char g, unsigned char b);
141 
142 void *hostx_screen_init(KdScreenInfo *screen,
143                         int x, int y,
144                         int width, int height, int buffer_height,
145                         int *bytes_per_line, int *bits_per_pixel);
146 
147 void
148 hostx_paint_rect(KdScreenInfo *screen,
149                  int sx, int sy, int dx, int dy, int width, int height);
150 
151 Bool
152 hostx_load_keymap(KeySymsPtr keySyms, CARD8 *modmap, XkbControlsPtr controls);
153 
154 void
155 hostx_size_set_from_configure(Bool);
156 
157 xcb_connection_t *
158 hostx_get_xcbconn(void);
159 
160 xcb_generic_event_t *
161 hostx_get_event(Bool queued_only);
162 
163 Bool
164 hostx_has_queued_event(void);
165 
166 int
167 hostx_get_screen(void);
168 
169 int
170  hostx_get_window(int a_screen_number);
171 
172 int
173  hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
174 
175 int
176  hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
177 
178 int hostx_create_window(int a_screen_number,
179                         EphyrBox * a_geometry,
180                         int a_visual_id, int *a_host_win /*out parameter */ );
181 
182 int hostx_destroy_window(int a_win);
183 
184 int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
185 
186 int hostx_set_window_bounding_rectangles(int a_window,
187                                          EphyrRect * a_rects, int a_num_rects);
188 
189 int hostx_has_extension(xcb_extension_t *extension);
190 
191 int hostx_get_fd(void);
192 
193 #endif /*_XLIBS_STUFF_H_*/
194