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