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