1706f2543Smrg/* 2706f2543Smrg * Xephyr - A kdrive X server thats runs in a host X window. 3706f2543Smrg * Authored by Matthew Allum <mallum@o-hand.com> 4706f2543Smrg * 5706f2543Smrg * Copyright � 2004 Nokia 6706f2543Smrg * 7706f2543Smrg * Permission to use, copy, modify, distribute, and sell this software and its 8706f2543Smrg * documentation for any purpose is hereby granted without fee, provided that 9706f2543Smrg * the above copyright notice appear in all copies and that both that 10706f2543Smrg * copyright notice and this permission notice appear in supporting 11706f2543Smrg * documentation, and that the name of Nokia not be used in 12706f2543Smrg * advertising or publicity pertaining to distribution of the software without 13706f2543Smrg * specific, written prior permission. Nokia makes no 14706f2543Smrg * representations about the suitability of this software for any purpose. It 15706f2543Smrg * is provided "as is" without express or implied warranty. 16706f2543Smrg * 17706f2543Smrg * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 18706f2543Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 19706f2543Smrg * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR 20706f2543Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 21706f2543Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 22706f2543Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 23706f2543Smrg * PERFORMANCE OF THIS SOFTWARE. 24706f2543Smrg */ 25706f2543Smrg 26706f2543Smrg#ifndef _XLIBS_STUFF_H_ 27706f2543Smrg#define _XLIBS_STUFF_H_ 28706f2543Smrg 29706f2543Smrg#include <X11/X.h> 30706f2543Smrg#include <X11/Xmd.h> 31706f2543Smrg 32706f2543Smrg#define EPHYR_WANT_DEBUG 0 33706f2543Smrg 34706f2543Smrg#if (EPHYR_WANT_DEBUG) 35706f2543Smrg#define EPHYR_DBG(x, a...) \ 36706f2543Smrg fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a) 37706f2543Smrg#else 38706f2543Smrg#define EPHYR_DBG(x, a...) do {} while (0) 39706f2543Smrg#endif 40706f2543Smrg 41706f2543Smrgtypedef struct EphyrHostXVars EphyrHostXVars; 42706f2543Smrgtypedef struct EphyrHostXEvent EphyrHostXEvent; 43706f2543Smrgtypedef void* EphyrScreenInfo ; 44706f2543Smrgtypedef enum EphyrHostXEventType 45706f2543Smrg{ 46706f2543Smrg EPHYR_EV_MOUSE_MOTION, 47706f2543Smrg EPHYR_EV_MOUSE_PRESS, 48706f2543Smrg EPHYR_EV_MOUSE_RELEASE, 49706f2543Smrg EPHYR_EV_KEY_PRESS, 50706f2543Smrg EPHYR_EV_KEY_RELEASE, 51706f2543Smrg EPHYR_EV_EXPOSE 52706f2543Smrg} 53706f2543SmrgEphyrHostXEventType; 54706f2543Smrg 55706f2543Smrg/* I can't believe it's not a KeySymsRec. */ 56706f2543Smrgtypedef struct { 57706f2543Smrg int minKeyCode; 58706f2543Smrg int maxKeyCode; 59706f2543Smrg int mapWidth; 60706f2543Smrg CARD32 *map; 61706f2543Smrg} EphyrKeySyms; 62706f2543Smrg 63706f2543Smrgstruct EphyrHostXEvent 64706f2543Smrg{ 65706f2543Smrg EphyrHostXEventType type; 66706f2543Smrg 67706f2543Smrg union 68706f2543Smrg { 69706f2543Smrg struct mouse_motion { 70706f2543Smrg int x; 71706f2543Smrg int y; 72706f2543Smrg int screen; 73706f2543Smrg int window; 74706f2543Smrg } mouse_motion; 75706f2543Smrg 76706f2543Smrg struct mouse_down { 77706f2543Smrg int button_num; 78706f2543Smrg } mouse_down; 79706f2543Smrg 80706f2543Smrg struct mouse_up { 81706f2543Smrg int button_num; 82706f2543Smrg } mouse_up; 83706f2543Smrg 84706f2543Smrg struct key_up { 85706f2543Smrg int scancode; 86706f2543Smrg } key_up; 87706f2543Smrg 88706f2543Smrg struct key_down { 89706f2543Smrg int scancode; 90706f2543Smrg } key_down; 91706f2543Smrg 92706f2543Smrg struct expose { 93706f2543Smrg int window; 94706f2543Smrg } expose; 95706f2543Smrg 96706f2543Smrg } data; 97706f2543Smrg 98706f2543Smrg int key_state; 99706f2543Smrg}; 100706f2543Smrg 101706f2543Smrgtypedef struct { 102706f2543Smrg VisualID visualid; 103706f2543Smrg int screen; 104706f2543Smrg int depth; 105706f2543Smrg int class; 106706f2543Smrg unsigned long red_mask; 107706f2543Smrg unsigned long green_mask; 108706f2543Smrg unsigned long blue_mask; 109706f2543Smrg int colormap_size; 110706f2543Smrg int bits_per_rgb; 111706f2543Smrg} EphyrHostVisualInfo; 112706f2543Smrg 113706f2543Smrgtypedef struct { 114706f2543Smrg int x, y; 115706f2543Smrg int width, height ; 116706f2543Smrg int visualid ; 117706f2543Smrg} EphyrHostWindowAttributes; 118706f2543Smrg 119706f2543Smrgtypedef struct { 120706f2543Smrg int x,y,width,height; 121706f2543Smrg} EphyrBox; 122706f2543Smrg 123706f2543Smrgtypedef struct { 124706f2543Smrg short x1,y1,x2,y2; 125706f2543Smrg} EphyrRect; 126706f2543Smrg 127706f2543Smrgint 128706f2543Smrghostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height); 129706f2543Smrg 130706f2543Smrgint 131706f2543Smrghostx_want_host_cursor(void); 132706f2543Smrg 133706f2543Smrgvoid 134706f2543Smrghostx_use_host_cursor(void); 135706f2543Smrg 136706f2543Smrgvoid 137706f2543Smrghostx_use_fullscreen(void); 138706f2543Smrg 139706f2543Smrgint 140706f2543Smrghostx_want_fullscreen(void); 141706f2543Smrg 142706f2543Smrgint 143706f2543Smrghostx_want_preexisting_window(EphyrScreenInfo screen); 144706f2543Smrg 145706f2543Smrgvoid 146706f2543Smrghostx_use_preexisting_window(unsigned long win_id); 147706f2543Smrg 148706f2543Smrgvoid 149706f2543Smrghostx_use_resname (char *name, int fromcmd); 150706f2543Smrg 151706f2543Smrgvoid 152706f2543Smrghostx_set_title(char *name); 153706f2543Smrg 154706f2543Smrgvoid 155706f2543Smrghostx_handle_signal(int signum); 156706f2543Smrg 157706f2543Smrgint 158706f2543Smrghostx_init(void); 159706f2543Smrg 160706f2543Smrgvoid 161706f2543Smrghostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num); 162706f2543Smrg 163706f2543Smrgvoid 164706f2543Smrghostx_set_display_name(char *name); 165706f2543Smrg 166706f2543Smrgvoid 167706f2543Smrghostx_set_screen_number(EphyrScreenInfo screen, int number); 168706f2543Smrg 169706f2543Smrgvoid 170706f2543Smrghostx_set_win_title(EphyrScreenInfo screen, char *extra_text); 171706f2543Smrg 172706f2543Smrgint 173706f2543Smrghostx_get_depth (void); 174706f2543Smrg 175706f2543Smrgint 176706f2543Smrghostx_get_server_depth (EphyrScreenInfo screen); 177706f2543Smrg 178706f2543Smrgvoid 179706f2543Smrghostx_set_server_depth(EphyrScreenInfo screen, int depth); 180706f2543Smrg 181706f2543Smrgint 182706f2543Smrghostx_get_bpp(void *info); 183706f2543Smrg 184706f2543Smrgvoid 185706f2543Smrghostx_get_visual_masks (void *info, 186706f2543Smrg CARD32 *rmsk, 187706f2543Smrg CARD32 *gmsk, 188706f2543Smrg CARD32 *bmsk); 189706f2543Smrgvoid 190706f2543Smrghostx_set_cmap_entry(unsigned char idx, 191706f2543Smrg unsigned char r, 192706f2543Smrg unsigned char g, 193706f2543Smrg unsigned char b); 194706f2543Smrg 195706f2543Smrgvoid* 196706f2543Smrghostx_screen_init (EphyrScreenInfo screen, 197706f2543Smrg int width, int height, 198706f2543Smrg int buffer_height); 199706f2543Smrg 200706f2543Smrgvoid 201706f2543Smrghostx_paint_rect(EphyrScreenInfo screen, 202706f2543Smrg int sx, int sy, 203706f2543Smrg int dx, int dy, 204706f2543Smrg int width, int height); 205706f2543Smrg 206706f2543Smrg 207706f2543Smrgvoid 208706f2543Smrghostx_load_keymap (void); 209706f2543Smrg 210706f2543Smrgint 211706f2543Smrghostx_get_event (EphyrHostXEvent *ev); 212706f2543Smrg 213706f2543Smrgvoid* 214706f2543Smrghostx_get_display (void) ; 215706f2543Smrg 216706f2543Smrgint 217706f2543Smrghostx_get_window (int a_screen_number) ; 218706f2543Smrg 219706f2543Smrgint 220706f2543Smrghostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attr) ; 221706f2543Smrg 222706f2543Smrgint 223706f2543Smrghostx_get_extension_info (const char *a_ext_name, 224706f2543Smrg int *a_major_opcode, 225706f2543Smrg int *a_first_even, 226706f2543Smrg int *a_first_error) ; 227706f2543Smrgint 228706f2543Smrghostx_get_visuals_info (EphyrHostVisualInfo **a_visuals, 229706f2543Smrg int *a_num_entries) ; 230706f2543Smrg 231706f2543Smrgint hostx_create_window (int a_screen_number, 232706f2543Smrg EphyrBox *a_geometry, 233706f2543Smrg int a_visual_id, 234706f2543Smrg int *a_host_win /*out parameter*/) ; 235706f2543Smrg 236706f2543Smrgint hostx_destroy_window (int a_win) ; 237706f2543Smrg 238706f2543Smrgint hostx_set_window_geometry (int a_win, EphyrBox *a_geo) ; 239706f2543Smrg 240706f2543Smrg 241706f2543Smrgint hostx_set_window_bounding_rectangles (int a_window, 242706f2543Smrg EphyrRect *a_rects, 243706f2543Smrg int a_num_rects) ; 244706f2543Smrg 245706f2543Smrgint hostx_set_window_clipping_rectangles (int a_window, 246706f2543Smrg EphyrRect *a_rects, 247706f2543Smrg int a_num_rects) ; 248706f2543Smrgint hostx_has_xshape (void) ; 249706f2543Smrg 250706f2543Smrg#ifdef XF86DRI 251706f2543Smrgint hostx_lookup_peer_window (void *a_local_window, 252706f2543Smrg int *a_host_peer /*out parameter*/) ; 253706f2543Smrgint 254706f2543Smrghostx_allocate_resource_id_peer (int a_local_resource_id, 255706f2543Smrg int *a_remote_resource_id) ; 256706f2543Smrgint 257706f2543Smrghostx_get_resource_id_peer (int a_local_resource_id, 258706f2543Smrg int *a_remote_resource_id) ; 259706f2543Smrgint hostx_has_dri (void) ; 260706f2543Smrg 261706f2543Smrgint hostx_has_glx (void) ; 262706f2543Smrg#endif /* XF86DRI */ 263706f2543Smrg 264706f2543Smrg#endif /*_XLIBS_STUFF_H_*/ 265