xref: /OK3568_Linux_fs/external/xserver/hw/kdrive/ephyr/hostx.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Xephyr - A kdrive X server thats runs in a host X window.
3*4882a593Smuzhiyun  *          Authored by Matthew Allum <mallum@o-hand.com>
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright © 2004 Nokia
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Permission to use, copy, modify, distribute, and sell this software and its
8*4882a593Smuzhiyun  * documentation for any purpose is hereby granted without fee, provided that
9*4882a593Smuzhiyun  * the above copyright notice appear in all copies and that both that
10*4882a593Smuzhiyun  * copyright notice and this permission notice appear in supporting
11*4882a593Smuzhiyun  * documentation, and that the name of Nokia not be used in
12*4882a593Smuzhiyun  * advertising or publicity pertaining to distribution of the software without
13*4882a593Smuzhiyun  * specific, written prior permission. Nokia makes no
14*4882a593Smuzhiyun  * representations about the suitability of this software for any purpose.  It
15*4882a593Smuzhiyun  * is provided "as is" without express or implied warranty.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18*4882a593Smuzhiyun  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19*4882a593Smuzhiyun  * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20*4882a593Smuzhiyun  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21*4882a593Smuzhiyun  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22*4882a593Smuzhiyun  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23*4882a593Smuzhiyun  * PERFORMANCE OF THIS SOFTWARE.
24*4882a593Smuzhiyun  */
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #ifndef _XLIBS_STUFF_H_
27*4882a593Smuzhiyun #define _XLIBS_STUFF_H_
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #include <X11/X.h>
30*4882a593Smuzhiyun #include <X11/Xmd.h>
31*4882a593Smuzhiyun #include <xcb/xcb.h>
32*4882a593Smuzhiyun #include <xcb/render.h>
33*4882a593Smuzhiyun #include "ephyr.h"
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #define EPHYR_WANT_DEBUG 0
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #if (EPHYR_WANT_DEBUG)
38*4882a593Smuzhiyun #define EPHYR_DBG(x, a...) \
39*4882a593Smuzhiyun  fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
40*4882a593Smuzhiyun #else
41*4882a593Smuzhiyun #define EPHYR_DBG(x, a...) do {} while (0)
42*4882a593Smuzhiyun #endif
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun typedef struct EphyrHostXVars EphyrHostXVars;
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun typedef struct {
47*4882a593Smuzhiyun     VisualID visualid;
48*4882a593Smuzhiyun     int screen;
49*4882a593Smuzhiyun     int depth;
50*4882a593Smuzhiyun     int class;
51*4882a593Smuzhiyun     unsigned long red_mask;
52*4882a593Smuzhiyun     unsigned long green_mask;
53*4882a593Smuzhiyun     unsigned long blue_mask;
54*4882a593Smuzhiyun     int colormap_size;
55*4882a593Smuzhiyun     int bits_per_rgb;
56*4882a593Smuzhiyun } EphyrHostVisualInfo;
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun typedef struct {
59*4882a593Smuzhiyun     int x, y;
60*4882a593Smuzhiyun     int width, height;
61*4882a593Smuzhiyun     int visualid;
62*4882a593Smuzhiyun } EphyrHostWindowAttributes;
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun typedef struct {
65*4882a593Smuzhiyun     int x, y, width, height;
66*4882a593Smuzhiyun } EphyrBox;
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun typedef struct {
69*4882a593Smuzhiyun     short x1, y1, x2, y2;
70*4882a593Smuzhiyun } EphyrRect;
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun int
73*4882a593Smuzhiyun hostx_want_screen_geometry(KdScreenInfo *screen, int *width, int *height, int *x, int *y);
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun int
76*4882a593Smuzhiyun  hostx_want_host_cursor(void);
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun void
79*4882a593Smuzhiyun  hostx_use_sw_cursor(void);
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun xcb_cursor_t
82*4882a593Smuzhiyun  hostx_get_empty_cursor(void);
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun void
85*4882a593Smuzhiyun  hostx_get_output_geometry(const char *output,
86*4882a593Smuzhiyun                            int *x, int *y,
87*4882a593Smuzhiyun                            int *width, int *height);
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun void
90*4882a593Smuzhiyun  hostx_use_fullscreen(void);
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun int
93*4882a593Smuzhiyun  hostx_want_fullscreen(void);
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun int
96*4882a593Smuzhiyun hostx_want_preexisting_window(KdScreenInfo *screen);
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun void
99*4882a593Smuzhiyun  hostx_use_preexisting_window(unsigned long win_id);
100*4882a593Smuzhiyun 
101*4882a593Smuzhiyun void
102*4882a593Smuzhiyun  hostx_use_resname(char *name, int fromcmd);
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun void
105*4882a593Smuzhiyun  hostx_set_title(char *name);
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun void
108*4882a593Smuzhiyun  hostx_handle_signal(int signum);
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun int
111*4882a593Smuzhiyun  hostx_init(void);
112*4882a593Smuzhiyun 
113*4882a593Smuzhiyun void
114*4882a593Smuzhiyun hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num, Bool use_geometry, const char *output);
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun void
117*4882a593Smuzhiyun  hostx_set_display_name(char *name);
118*4882a593Smuzhiyun 
119*4882a593Smuzhiyun void
120*4882a593Smuzhiyun hostx_set_screen_number(KdScreenInfo *screen, int number);
121*4882a593Smuzhiyun 
122*4882a593Smuzhiyun void
123*4882a593Smuzhiyun hostx_set_win_title(KdScreenInfo *screen, const char *extra_text);
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun int
126*4882a593Smuzhiyun  hostx_get_depth(void);
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun int
129*4882a593Smuzhiyun hostx_get_server_depth(KdScreenInfo *screen);
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun int
132*4882a593Smuzhiyun hostx_get_bpp(KdScreenInfo *screen);
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun void
135*4882a593Smuzhiyun hostx_get_visual_masks(KdScreenInfo *screen,
136*4882a593Smuzhiyun                        CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
137*4882a593Smuzhiyun void
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
140*4882a593Smuzhiyun                      unsigned char r, unsigned char g, unsigned char b);
141*4882a593Smuzhiyun 
142*4882a593Smuzhiyun void *hostx_screen_init(KdScreenInfo *screen,
143*4882a593Smuzhiyun                         int x, int y,
144*4882a593Smuzhiyun                         int width, int height, int buffer_height,
145*4882a593Smuzhiyun                         int *bytes_per_line, int *bits_per_pixel);
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun void
148*4882a593Smuzhiyun hostx_paint_rect(KdScreenInfo *screen,
149*4882a593Smuzhiyun                  int sx, int sy, int dx, int dy, int width, int height);
150*4882a593Smuzhiyun 
151*4882a593Smuzhiyun Bool
152*4882a593Smuzhiyun hostx_load_keymap(KeySymsPtr keySyms, CARD8 *modmap, XkbControlsPtr controls);
153*4882a593Smuzhiyun 
154*4882a593Smuzhiyun void
155*4882a593Smuzhiyun hostx_size_set_from_configure(Bool);
156*4882a593Smuzhiyun 
157*4882a593Smuzhiyun xcb_connection_t *
158*4882a593Smuzhiyun hostx_get_xcbconn(void);
159*4882a593Smuzhiyun 
160*4882a593Smuzhiyun xcb_generic_event_t *
161*4882a593Smuzhiyun hostx_get_event(Bool queued_only);
162*4882a593Smuzhiyun 
163*4882a593Smuzhiyun Bool
164*4882a593Smuzhiyun hostx_has_queued_event(void);
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun int
167*4882a593Smuzhiyun hostx_get_screen(void);
168*4882a593Smuzhiyun 
169*4882a593Smuzhiyun int
170*4882a593Smuzhiyun  hostx_get_window(int a_screen_number);
171*4882a593Smuzhiyun 
172*4882a593Smuzhiyun int
173*4882a593Smuzhiyun  hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun int
176*4882a593Smuzhiyun  hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
177*4882a593Smuzhiyun 
178*4882a593Smuzhiyun int hostx_create_window(int a_screen_number,
179*4882a593Smuzhiyun                         EphyrBox * a_geometry,
180*4882a593Smuzhiyun                         int a_visual_id, int *a_host_win /*out parameter */ );
181*4882a593Smuzhiyun 
182*4882a593Smuzhiyun int hostx_destroy_window(int a_win);
183*4882a593Smuzhiyun 
184*4882a593Smuzhiyun int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
185*4882a593Smuzhiyun 
186*4882a593Smuzhiyun int hostx_set_window_bounding_rectangles(int a_window,
187*4882a593Smuzhiyun                                          EphyrRect * a_rects, int a_num_rects);
188*4882a593Smuzhiyun 
189*4882a593Smuzhiyun int hostx_has_extension(xcb_extension_t *extension);
190*4882a593Smuzhiyun 
191*4882a593Smuzhiyun int hostx_get_fd(void);
192*4882a593Smuzhiyun 
193*4882a593Smuzhiyun #endif /*_XLIBS_STUFF_H_*/
194