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