105b261ecSmrg/* 2ed6184dfSmrg * Xephyr - A kdrive X server that runs in a host X window. 305b261ecSmrg * Authored by Matthew Allum <mallum@o-hand.com> 435c4bbdfSmrg * 535c4bbdfSmrg * Copyright © 2004 Nokia 605b261ecSmrg * 705b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its 805b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that 905b261ecSmrg * the above copyright notice appear in all copies and that both that 1005b261ecSmrg * copyright notice and this permission notice appear in supporting 1105b261ecSmrg * documentation, and that the name of Nokia not be used in 1205b261ecSmrg * advertising or publicity pertaining to distribution of the software without 1305b261ecSmrg * specific, written prior permission. Nokia makes no 1405b261ecSmrg * representations about the suitability of this software for any purpose. It 1505b261ecSmrg * is provided "as is" without express or implied warranty. 1605b261ecSmrg * 1705b261ecSmrg * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1805b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 1905b261ecSmrg * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR 2005b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 2105b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 2205b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 2305b261ecSmrg * PERFORMANCE OF THIS SOFTWARE. 2405b261ecSmrg */ 2505b261ecSmrg 2605b261ecSmrg#ifndef _XLIBS_STUFF_H_ 2705b261ecSmrg#define _XLIBS_STUFF_H_ 2805b261ecSmrg 2905b261ecSmrg#include <X11/X.h> 3005b261ecSmrg#include <X11/Xmd.h> 3135c4bbdfSmrg#include <xcb/xcb.h> 3235c4bbdfSmrg#include <xcb/render.h> 3335c4bbdfSmrg#include "ephyr.h" 3405b261ecSmrg 3505b261ecSmrg#define EPHYR_WANT_DEBUG 0 3605b261ecSmrg 3705b261ecSmrg#if (EPHYR_WANT_DEBUG) 3805b261ecSmrg#define EPHYR_DBG(x, a...) \ 3905b261ecSmrg fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a) 4005b261ecSmrg#else 4135c4bbdfSmrg#define EPHYR_DBG(x, a...) do {} while (0) 4205b261ecSmrg#endif 4305b261ecSmrg 4435c4bbdfSmrgtypedef struct EphyrHostXVars EphyrHostXVars; 4535c4bbdfSmrg 464642e01fSmrgtypedef struct { 4735c4bbdfSmrg VisualID visualid; 4835c4bbdfSmrg int screen; 4935c4bbdfSmrg int depth; 5035c4bbdfSmrg int class; 5135c4bbdfSmrg unsigned long red_mask; 5235c4bbdfSmrg unsigned long green_mask; 5335c4bbdfSmrg unsigned long blue_mask; 5435c4bbdfSmrg int colormap_size; 5535c4bbdfSmrg int bits_per_rgb; 564642e01fSmrg} EphyrHostVisualInfo; 574642e01fSmrg 584642e01fSmrgtypedef struct { 594642e01fSmrg int x, y; 6035c4bbdfSmrg int width, height; 6135c4bbdfSmrg int visualid; 624642e01fSmrg} EphyrHostWindowAttributes; 634642e01fSmrg 644642e01fSmrgtypedef struct { 6535c4bbdfSmrg int x, y, width, height; 664642e01fSmrg} EphyrBox; 674642e01fSmrg 684642e01fSmrgtypedef struct { 6935c4bbdfSmrg short x1, y1, x2, y2; 704642e01fSmrg} EphyrRect; 714642e01fSmrg 7205b261ecSmrgint 7335c4bbdfSmrghostx_want_screen_geometry(KdScreenInfo *screen, int *width, int *height, int *x, int *y); 7405b261ecSmrg 7505b261ecSmrgint 7635c4bbdfSmrg hostx_want_host_cursor(void); 7735c4bbdfSmrg 7835c4bbdfSmrgvoid 7935c4bbdfSmrg hostx_use_sw_cursor(void); 8035c4bbdfSmrg 8135c4bbdfSmrgxcb_cursor_t 8235c4bbdfSmrg hostx_get_empty_cursor(void); 8305b261ecSmrg 8405b261ecSmrgvoid 8535c4bbdfSmrg hostx_get_output_geometry(const char *output, 8635c4bbdfSmrg int *x, int *y, 8735c4bbdfSmrg int *width, int *height); 8805b261ecSmrg 8905b261ecSmrgvoid 9035c4bbdfSmrg hostx_use_fullscreen(void); 9105b261ecSmrg 9205b261ecSmrgint 9335c4bbdfSmrg hostx_want_fullscreen(void); 9405b261ecSmrg 9505b261ecSmrgint 9635c4bbdfSmrghostx_want_preexisting_window(KdScreenInfo *screen); 9705b261ecSmrg 9805b261ecSmrgvoid 9935c4bbdfSmrg hostx_use_preexisting_window(unsigned long win_id); 10005b261ecSmrg 1014642e01fSmrgvoid 10235c4bbdfSmrg hostx_use_resname(char *name, int fromcmd); 1034642e01fSmrg 1046747b715Smrgvoid 10535c4bbdfSmrg hostx_set_title(char *name); 1066747b715Smrg 10735c4bbdfSmrgvoid 10835c4bbdfSmrg hostx_handle_signal(int signum); 10905b261ecSmrg 11005b261ecSmrgint 11135c4bbdfSmrg hostx_init(void); 11205b261ecSmrg 1134642e01fSmrgvoid 11435c4bbdfSmrghostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num, Bool use_geometry, const char *output); 1154642e01fSmrg 11605b261ecSmrgvoid 11735c4bbdfSmrg hostx_set_display_name(char *name); 11805b261ecSmrg 11905b261ecSmrgvoid 12035c4bbdfSmrghostx_set_screen_number(KdScreenInfo *screen, int number); 1214642e01fSmrg 1224642e01fSmrgvoid 12335c4bbdfSmrghostx_set_win_title(KdScreenInfo *screen, const char *extra_text); 12405b261ecSmrg 12505b261ecSmrgint 12635c4bbdfSmrg hostx_get_depth(void); 12705b261ecSmrg 12805b261ecSmrgint 12935c4bbdfSmrghostx_get_server_depth(KdScreenInfo *screen); 13005b261ecSmrg 13105b261ecSmrgint 13235c4bbdfSmrghostx_get_bpp(KdScreenInfo *screen); 13305b261ecSmrg 13405b261ecSmrgvoid 13535c4bbdfSmrghostx_get_visual_masks(KdScreenInfo *screen, 13635c4bbdfSmrg CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk); 13705b261ecSmrgvoid 13805b261ecSmrg 13935c4bbdfSmrghostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx, 14035c4bbdfSmrg unsigned char r, unsigned char g, unsigned char b); 1414642e01fSmrg 14235c4bbdfSmrgvoid *hostx_screen_init(KdScreenInfo *screen, 14335c4bbdfSmrg int x, int y, 14435c4bbdfSmrg int width, int height, int buffer_height, 14535c4bbdfSmrg int *bytes_per_line, int *bits_per_pixel); 14605b261ecSmrg 14705b261ecSmrgvoid 14835c4bbdfSmrghostx_paint_rect(KdScreenInfo *screen, 14935c4bbdfSmrg int sx, int sy, int dx, int dy, int width, int height); 15005b261ecSmrg 1511b5d61b8SmrgBool 1521b5d61b8Smrghostx_load_keymap(KeySymsPtr keySyms, CARD8 *modmap, XkbControlsPtr controls); 1531b5d61b8Smrg 15435c4bbdfSmrgvoid 1551b5d61b8Smrghostx_size_set_from_configure(Bool); 15605b261ecSmrg 15735c4bbdfSmrgxcb_connection_t * 15835c4bbdfSmrghostx_get_xcbconn(void); 1594642e01fSmrg 1601b5d61b8Smrgxcb_generic_event_t * 1611b5d61b8Smrghostx_get_event(Bool queued_only); 1621b5d61b8Smrg 1631b5d61b8SmrgBool 1641b5d61b8Smrghostx_has_queued_event(void); 1651b5d61b8Smrg 1664642e01fSmrgint 16735c4bbdfSmrghostx_get_screen(void); 1684642e01fSmrg 1694642e01fSmrgint 17035c4bbdfSmrg hostx_get_window(int a_screen_number); 1714642e01fSmrg 1724642e01fSmrgint 17335c4bbdfSmrg hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr); 1744642e01fSmrg 17535c4bbdfSmrgint 17635c4bbdfSmrg hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries); 1774642e01fSmrg 17835c4bbdfSmrgint hostx_create_window(int a_screen_number, 17935c4bbdfSmrg EphyrBox * a_geometry, 18035c4bbdfSmrg int a_visual_id, int *a_host_win /*out parameter */ ); 1814642e01fSmrg 18235c4bbdfSmrgint hostx_destroy_window(int a_win); 1834642e01fSmrg 18435c4bbdfSmrgint hostx_set_window_geometry(int a_win, EphyrBox * a_geo); 1854642e01fSmrg 18635c4bbdfSmrgint hostx_set_window_bounding_rectangles(int a_window, 18735c4bbdfSmrg EphyrRect * a_rects, int a_num_rects); 1884642e01fSmrg 18935c4bbdfSmrgint hostx_has_extension(xcb_extension_t *extension); 1904642e01fSmrg 1911b5d61b8Smrgint hostx_get_fd(void); 1924642e01fSmrg 1934642e01fSmrg#endif /*_XLIBS_STUFF_H_*/ 194