1/*
2 * Xephyr - A kdrive X server that 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
44typedef struct EphyrHostXVars EphyrHostXVars;
45
46typedef 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
58typedef struct {
59    int x, y;
60    int width, height;
61    int visualid;
62} EphyrHostWindowAttributes;
63
64typedef struct {
65    int x, y, width, height;
66} EphyrBox;
67
68typedef struct {
69    short x1, y1, x2, y2;
70} EphyrRect;
71
72int
73hostx_want_screen_geometry(KdScreenInfo *screen, int *width, int *height, int *x, int *y);
74
75int
76 hostx_want_host_cursor(void);
77
78void
79 hostx_use_sw_cursor(void);
80
81xcb_cursor_t
82 hostx_get_empty_cursor(void);
83
84void
85 hostx_get_output_geometry(const char *output,
86                           int *x, int *y,
87                           int *width, int *height);
88
89void
90 hostx_use_fullscreen(void);
91
92int
93 hostx_want_fullscreen(void);
94
95int
96hostx_want_preexisting_window(KdScreenInfo *screen);
97
98void
99 hostx_use_preexisting_window(unsigned long win_id);
100
101void
102 hostx_use_resname(char *name, int fromcmd);
103
104void
105 hostx_set_title(char *name);
106
107void
108 hostx_handle_signal(int signum);
109
110int
111 hostx_init(void);
112
113void
114hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num, Bool use_geometry, const char *output);
115
116void
117 hostx_set_display_name(char *name);
118
119void
120hostx_set_screen_number(KdScreenInfo *screen, int number);
121
122void
123hostx_set_win_title(KdScreenInfo *screen, const char *extra_text);
124
125int
126 hostx_get_depth(void);
127
128int
129hostx_get_server_depth(KdScreenInfo *screen);
130
131int
132hostx_get_bpp(KdScreenInfo *screen);
133
134void
135hostx_get_visual_masks(KdScreenInfo *screen,
136                       CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
137void
138
139hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
140                     unsigned char r, unsigned char g, unsigned char b);
141
142void *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
147void
148hostx_paint_rect(KdScreenInfo *screen,
149                 int sx, int sy, int dx, int dy, int width, int height);
150
151Bool
152hostx_load_keymap(KeySymsPtr keySyms, CARD8 *modmap, XkbControlsPtr controls);
153
154void
155hostx_size_set_from_configure(Bool);
156
157xcb_connection_t *
158hostx_get_xcbconn(void);
159
160xcb_generic_event_t *
161hostx_get_event(Bool queued_only);
162
163Bool
164hostx_has_queued_event(void);
165
166int
167hostx_get_screen(void);
168
169int
170 hostx_get_window(int a_screen_number);
171
172int
173 hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr);
174
175int
176 hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries);
177
178int hostx_create_window(int a_screen_number,
179                        EphyrBox * a_geometry,
180                        int a_visual_id, int *a_host_win /*out parameter */ );
181
182int hostx_destroy_window(int a_win);
183
184int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
185
186int hostx_set_window_bounding_rectangles(int a_window,
187                                         EphyrRect * a_rects, int a_num_rects);
188
189int hostx_has_extension(xcb_extension_t *extension);
190
191int hostx_get_fd(void);
192
193#endif /*_XLIBS_STUFF_H_*/
194