x11vnc_defs.c 5.41 KB
Newer Older
runge's avatar
runge committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* -- x11vnc_defs.c -- */

#include "x11vnc.h"

int overlay_present = 0;

int xrandr_base_event_type = 0;

int xfixes_base_event_type = 0;
int xtest_base_event_type = 0;
#if LIBVNCSERVER_HAVE_LIBXTRAP
XETC *trap_ctx = NULL;
#endif
int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;

/*               date +'lastmod: %Y-%m-%d' */
18
char lastmod[] = "0.8.4 lastmod: 2007-01-10";
runge's avatar
runge committed
19 20 21 22 23

/* X display info */

Display *dpy = NULL;		/* the single display screen we connect to */
int scr = 0;
24 25
char *xauth_raw_data = NULL;
int xauth_raw_len = 0;
runge's avatar
runge committed
26 27 28 29
Window window = None, rootwin = None;	/* polled window, root window (usu. same) */
Visual *default_visual = NULL;	/* the default visual (unless -visual) */
int bpp = 0, depth = 0;
int indexed_color = 0;
30 31
int dpy_x = 0, dpy_y = 0;		/* size of display */
int fb_x = 0, fb_y = 0, fb_b = 0;	/* fb size and bpp guesses at display */
runge's avatar
runge committed
32 33 34 35 36 37 38
int off_x, off_y;		/* offsets for -sid */
int wdpy_x, wdpy_y;		/* for actual sizes in case of -clip */
int cdpy_x, cdpy_y, coff_x, coff_y;	/* the -clip params */
int button_mask = 0;		/* button state and info */
int button_mask_prev = 0;
int num_buttons = -1;

39 40
long xselectinput_rootwin = 0;

41 42 43
unsigned int display_button_mask = 0;
unsigned int display_mod_mask = 0;

runge's avatar
runge committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
/* image structures */
XImage *scanline = NULL;
XImage *fullscreen = NULL;
XImage **tile_row = NULL;	/* for all possible row runs */
XImage *snaprect = NULL;	/* for XShmGetImage (fs_factor) */
XImage *snap = NULL;		/* the full snap fb */
XImage *raw_fb_image = NULL;	/* the raw fb */

/* corresponding shm structures */
XShmSegmentInfo scanline_shm;
XShmSegmentInfo fullscreen_shm;
XShmSegmentInfo *tile_row_shm;	/* for all possible row runs */
XShmSegmentInfo snaprect_shm;

/* rfb screen info */
rfbScreenInfoPtr screen = NULL;
char *rfb_desktop_name = NULL;
char *http_dir = NULL;
char vnc_desktop_name[256];
char *main_fb = NULL;		/* our copy of the X11 fb */
char *rfb_fb = NULL;		/* same as main_fb unless transformation */
char *fake_fb = NULL;		/* used under -padgeom */
char *snap_fb = NULL;		/* used under -snapfb */
67
char *cmap8to24_fb = NULL;	/* used under -8to24 */
runge's avatar
runge committed
68
char *rot_fb = NULL;
69
char *raw_fb = NULL;		/* when used should be main_fb */
runge's avatar
runge committed
70 71 72 73 74 75
char *raw_fb_addr = NULL;
int raw_fb_offset = 0;
int raw_fb_shm = 0;
int raw_fb_mmap = 0;
int raw_fb_seek = 0;
int raw_fb_fd = -1;
76
int raw_fb_back_to_X = 0;	/* kludge for testing rawfb -> X */
runge's avatar
runge committed
77

78 79
int rfb_bytes_per_line = 0;
int main_bytes_per_line = 0;
runge's avatar
runge committed
80
int rot_bytes_per_line = 0;
81 82 83
unsigned long  main_red_mask = 0,  main_green_mask = 0,  main_blue_mask = 0;
unsigned short main_red_max = 0,   main_green_max = 0,   main_blue_max = 0;
unsigned short main_red_shift = 0, main_green_shift = 0, main_blue_shift = 0;
runge's avatar
runge committed
84

85 86
int raw_fb_bytes_per_line = 0;

runge's avatar
runge committed
87 88 89 90 91 92 93 94 95 96
/* scaling parameters */
char *scale_str = NULL;
double scale_fac = 1.0;
int scaling = 0;
int scaling_blend = 1;		/* for no blending option (very course) */
int scaling_nomult4 = 0;	/* do not require width = n * 4 */
int scaling_pad = 0;		/* pad out scaled sizes to fit denominator */
int scaling_interpolate = 0;	/* use interpolation scheme when shrinking */
int scaled_x = 0, scaled_y = 0;	/* dimensions of scaled display */
int scale_numer = 0, scale_denom = 0;	/* n/m */
runge's avatar
runge committed
97 98 99 100
char *rotating_str = NULL;
int rotating = 0;
int rotating_same = 0;
int rotating_cursors = 0;
runge's avatar
runge committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

/* scale cursor */
char *scale_cursor_str = NULL;
double scale_cursor_fac = 1.0;
int scaling_cursor = 0;
int scaling_cursor_blend = 1;
int scaling_cursor_interpolate = 0;
int scale_cursor_numer = 0, scale_cursor_denom = 0;

/* size of the basic tile unit that is polled for changes: */
int tile_x = 32;
int tile_y = 32;
int ntiles, ntiles_x, ntiles_y;

/* arrays that indicate changed or checked tiles. */
unsigned char *tile_has_diff = NULL, *tile_tried = NULL, *tile_copied = NULL;
unsigned char *tile_has_xdamage_diff = NULL, *tile_row_has_xdamage_diff = NULL;

/* times of recent events */
time_t last_event, last_input = 0, last_client = 0;
121
time_t last_local_input = 0;
runge's avatar
runge committed
122 123 124 125 126 127 128 129 130
time_t last_keyboard_input = 0, last_pointer_input = 0; 
time_t last_fb_bytes_sent = 0;
double last_keyboard_time = 0.0;
double last_pointer_time = 0.0;
double last_pointer_click_time = 0.0;
double last_pointer_motion_time = 0.0;
double last_key_to_button_remap_time = 0.0;
double last_copyrect = 0.0;
double last_copyrect_fix = 0.0;
131
double last_wireframe = 0.0;
runge's avatar
runge committed
132 133
double servertime_diff = 0.0;
double x11vnc_start = 0.0;
134
double g_now = 0.0;
runge's avatar
runge committed
135

136 137
double last_get_wm_frame_time = 0.0;
Window last_get_wm_frame = None;
138 139 140 141
double last_bs_restore = 0.0;
double last_su_restore = 0.0;
double last_bs_save = 0.0;
double last_su_save = 0.0;
142

143 144
int hack_val = 0;

runge's avatar
runge committed
145 146
/* last client to move pointer */
rfbClientPtr last_pointer_client = NULL;
147
rfbClientPtr latest_client = NULL;
runge's avatar
runge committed
148 149 150 151 152

int client_count = 0;
int clients_served = 0;

/* more transient kludge variables: */
153 154
int cursor_x = 0, cursor_y = 0;		/* x and y from the viewer(s) */
int button_change_x = 0, button_change_y = 0;
runge's avatar
runge committed
155 156
int got_user_input = 0;
int got_pointer_input = 0;
157
int got_local_pointer_input = 0;
runge's avatar
runge committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
int got_pointer_calls = 0;
int got_keyboard_input = 0;
int got_keyboard_calls = 0;
int urgent_update = 0;
int last_keyboard_keycode = 0;
rfbBool last_rfb_down = FALSE;
rfbBool last_rfb_key_accepted = FALSE;
rfbKeySym last_rfb_keysym = 0;
double last_rfb_keytime = 0.0;
int fb_copy_in_progress = 0;	
int drag_in_progress = 0;	
int shut_down = 0;	
int do_copy_screen = 0;	
time_t damage_time = 0;
int damage_delay = 0;

int program_pid = 0;
char *program_name = NULL;
char *program_cmdline = NULL;

struct utsname UT;