hostx.h revision 05b261ec
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 32#define EPHYR_WANT_DEBUG 0 33 34#if (EPHYR_WANT_DEBUG) 35#define EPHYR_DBG(x, a...) \ 36 fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a) 37#else 38#define EPHYR_DBG(x, a...) do {} while (0) 39#endif 40 41typedef struct EphyrHostXVars EphyrHostXVars; 42typedef struct EphyrHostXEvent EphyrHostXEvent; 43 44typedef enum EphyrHostXEventType 45{ 46 EPHYR_EV_MOUSE_MOTION, 47 EPHYR_EV_MOUSE_PRESS, 48 EPHYR_EV_MOUSE_RELEASE, 49 EPHYR_EV_KEY_PRESS, 50 EPHYR_EV_KEY_RELEASE 51} 52EphyrHostXEventType; 53 54/* I can't believe it's not a KeySymsRec. */ 55typedef struct { 56 int minKeyCode; 57 int maxKeyCode; 58 int mapWidth; 59 CARD32 *map; 60} EphyrKeySyms; 61 62struct EphyrHostXEvent 63{ 64 EphyrHostXEventType type; 65 66 union 67 { 68 struct mouse_motion { 69 int x; 70 int y; 71 } mouse_motion; 72 73 struct mouse_down { 74 int button_num; 75 } mouse_down; 76 77 struct mouse_up { 78 int button_num; 79 } mouse_up; 80 81 struct key_up { 82 int scancode; 83 } key_up; 84 85 struct key_down { 86 int scancode; 87 } key_down; 88 89 } data; 90 91 int key_state; 92}; 93 94int 95hostx_want_screen_size(int *width, int *height); 96 97int 98hostx_want_host_cursor(void); 99 100void 101hostx_use_host_cursor(void); 102 103void 104hostx_use_fullscreen(void); 105 106int 107hostx_want_fullscreen(void); 108 109int 110hostx_want_preexisting_window(void); 111 112void 113hostx_use_preexisting_window(unsigned long win_id); 114 115void 116hostx_handle_signal(int signum); 117 118int 119hostx_init(void); 120 121void 122hostx_set_display_name(char *name); 123 124void 125hostx_set_win_title(char *extra_text); 126 127int 128hostx_get_depth (void); 129 130int 131hostx_get_server_depth (void); 132 133void 134hostx_set_server_depth(int depth); 135 136int 137hostx_get_bpp(void); 138 139void 140hostx_get_visual_masks (CARD32 *rmsk, 141 CARD32 *gmsk, 142 CARD32 *bmsk); 143void 144hostx_set_cmap_entry(unsigned char idx, 145 unsigned char r, 146 unsigned char g, 147 unsigned char b); 148 149void* 150hostx_screen_init (int width, int height, int buffer_height); 151 152void 153hostx_paint_rect(int sx, int sy, 154 int dx, int dy, 155 int width, int height); 156void 157hostx_paint_debug_rect(int x, int y, 158 int width, int height); 159 160void 161hostx_load_keymap(void); 162 163int 164hostx_get_event(EphyrHostXEvent *ev); 165 166#endif 167