still more compiler warnings; ssvnc 1.0.9 sync.

pull/1/head
runge 18 years ago
parent f9baaf1ee4
commit 5c9ba4bb03

@ -65,6 +65,9 @@ static Colormap root_cmap = 0;
static unsigned int root_rgb[NCOLOR]; static unsigned int root_rgb[NCOLOR];
static void set_root_cmap(void) { static void set_root_cmap(void) {
#if NO_X11
return;
#else
static time_t last_set = 0; static time_t last_set = 0;
time_t now = time(NULL); time_t now = time(NULL);
XWindowAttributes attr; XWindowAttributes attr;
@ -72,9 +75,6 @@ static void set_root_cmap(void) {
int redo = 0; int redo = 0;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (now > last_set + 10) { if (now > last_set + 10) {
redo = 1; redo = 1;
@ -244,6 +244,9 @@ int MV_hit;
double MV_start; double MV_start;
void check_for_multivis(void) { void check_for_multivis(void) {
#if NO_X11
return;
#else
XWindowAttributes attr; XWindowAttributes attr;
int doall = 0; int doall = 0;
int k, i, cnt, diff; int k, i, cnt, diff;
@ -261,9 +264,6 @@ void check_for_multivis(void) {
double delay; double delay;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (now > last_parse + 1.0) { if (now > last_parse + 1.0) {
last_parse = now; last_parse = now;
@ -758,10 +758,11 @@ if (db24 > 1) fprintf(stderr, " ------------ 0x%lx i=%d\n", windows_8bp
} }
static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) { static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) {
RAWFB_RET(NULL)
#if NO_X11 #if NO_X11
if (!xi || !visual || !win_depth || !w) {}
return NULL; return NULL;
#else #else
RAWFB_RET(NULL)
if (xi == NULL || *w < dpy_x) { if (xi == NULL || *w < dpy_x) {
char *d; char *d;
if (xi) { if (xi) {
@ -781,6 +782,10 @@ static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) {
} }
static int poll_line(int x1, int x2, int y1, int n, sraRegionPtr mod) { static int poll_line(int x1, int x2, int y1, int n, sraRegionPtr mod) {
#if NO_X11
if (!x1 || !x2 || !y1 || !n || !mod) {}
return 1;
#else
int fac, n_off, w, xo, yo; int fac, n_off, w, xo, yo;
char *poll_fb, *dst, *src; char *poll_fb, *dst, *src;
int w2, xl, xh, stride = 32; int w2, xl, xh, stride = 32;
@ -804,9 +809,6 @@ static int poll_line(int x1, int x2, int y1, int n, sraRegionPtr mod) {
RAWFB_RET(1) RAWFB_RET(1)
#if NO_X11
return 1;
#else
if (win == None) { if (win == None) {
return 1; return 1;
} }
@ -1292,13 +1294,14 @@ static int cmap_failed[CMAPMAX];
int histo[256]; int histo[256];
static int get_cmap(int j, Colormap cmap) { static int get_cmap(int j, Colormap cmap) {
#if NO_X11
if (!j || !cmap) {}
return 0;
#else
int i, ncells; int i, ncells;
XErrorHandler old_handler = NULL; XErrorHandler old_handler = NULL;
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (0) { if (0) {
/* not working properly for depth 24... */ /* not working properly for depth 24... */
@ -1427,12 +1430,13 @@ if (db24 > 1) fprintf(stderr, "ncmaps: %d\n", ncmaps);
} }
static XImage *cmap_xi(XImage *xi, Window win, int win_depth) { static XImage *cmap_xi(XImage *xi, Window win, int win_depth) {
XWindowAttributes attr;
char *d;
#if NO_X11 #if NO_X11
if (!xi || !win || !win_depth) {}
return NULL; return NULL;
#else #else
XWindowAttributes attr;
char *d;
if (xi) { if (xi) {
XDestroyImage(xi); XDestroyImage(xi);
} }
@ -1455,6 +1459,10 @@ static XImage *cmap_xi(XImage *xi, Window win, int win_depth) {
static void transform_rect(sraRect rect, Window win, int win_depth, int cm) { static void transform_rect(sraRect rect, Window win, int win_depth, int cm) {
#if NO_X11
if (!rect.x1 || !win || !win_depth || !cm) {}
return;
#else
char *src, *dst, *poll; char *src, *dst, *poll;
unsigned int *ui; unsigned int *ui;
@ -1471,9 +1479,6 @@ static void transform_rect(sraRect rect, Window win, int win_depth, int cm) {
if (db24 > 1) fprintf(stderr, "transform %4d %4d %4d %4d cm: %d\n", rect.x1, rect.y1, rect.x2, rect.y2, cm); if (db24 > 1) fprintf(stderr, "transform %4d %4d %4d %4d cm: %d\n", rect.x1, rect.y1, rect.x2, rect.y2, cm);
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
attr.width = 0; attr.width = 0;
attr.height = 0; attr.height = 0;

@ -1,5 +1,5 @@
x11vnc README file Date: Thu Dec 28 12:53:07 EST 2006 x11vnc README file Date: Thu Dec 28 14:49:09 EST 2006
The following information is taken from these URLs: The following information is taken from these URLs:

@ -908,6 +908,12 @@ static int check_access(char *addr) {
*/ */
static int ugly_window(char *addr, char *userhost, int X, int Y, static int ugly_window(char *addr, char *userhost, int X, int Y,
int timeout, char *mode, int accept) { int timeout, char *mode, int accept) {
#if NO_X11
if (!addr || !userhost || !X || !Y || !timeout || !mode || !accept) {}
RAWFB_RET(0)
nox11_exit(1);
return 0;
#else
#define t2x2_width 16 #define t2x2_width 16
#define t2x2_height 16 #define t2x2_height 16
@ -961,10 +967,6 @@ static unsigned char t2x2_bits[] = {
KeyCode key_o; KeyCode key_o;
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11
nox11_exit(1);
return 0;
#else
if (! accept) { if (! accept) {
sprintf(str_y, "OK"); sprintf(str_y, "OK");
@ -1740,6 +1742,8 @@ void set_vnc_connect_prop(char *str) {
#if !NO_X11 #if !NO_X11
XChangeProperty(dpy, rootwin, vnc_connect_prop, XA_STRING, 8, XChangeProperty(dpy, rootwin, vnc_connect_prop, XA_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str)); PropModeReplace, (unsigned char *)str, strlen(str));
#else
if (!str) {}
#endif /* NO_X11 */ #endif /* NO_X11 */
} }
@ -1748,10 +1752,17 @@ void set_x11vnc_remote_prop(char *str) {
#if !NO_X11 #if !NO_X11
XChangeProperty(dpy, rootwin, x11vnc_remote_prop, XA_STRING, 8, XChangeProperty(dpy, rootwin, x11vnc_remote_prop, XA_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str)); PropModeReplace, (unsigned char *)str, strlen(str));
#else
if (!str) {}
#endif /* NO_X11 */ #endif /* NO_X11 */
} }
void read_vnc_connect_prop(int nomsg) { void read_vnc_connect_prop(int nomsg) {
#if NO_X11
RAWFB_RET_VOID
if (!nomsg) {}
return;
#else
Atom type; Atom type;
int format, slen, dlen; int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0; unsigned long nitems = 0, bytes_after = 0;
@ -1766,9 +1777,6 @@ void read_vnc_connect_prop(int nomsg) {
return; return;
} }
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
/* read the property value into vnc_connect_str: */ /* read the property value into vnc_connect_str: */
do { do {
@ -1802,6 +1810,11 @@ void read_vnc_connect_prop(int nomsg) {
} }
void read_x11vnc_remote_prop(int nomsg) { void read_x11vnc_remote_prop(int nomsg) {
#if NO_X11
RAWFB_RET_VOID
if (!nomsg) {}
return;
#else
Atom type; Atom type;
int format, slen, dlen; int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0; unsigned long nitems = 0, bytes_after = 0;
@ -1816,9 +1829,6 @@ void read_x11vnc_remote_prop(int nomsg) {
return; return;
} }
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
/* read the property value into x11vnc_remote_str: */ /* read the property value into x11vnc_remote_str: */
do { do {
@ -2293,6 +2303,7 @@ void send_client_info(char *str) {
void adjust_grabs(int grab, int quiet) { void adjust_grabs(int grab, int quiet) {
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11 #if NO_X11
if (!grab || !quiet) {}
return; return;
#else #else
/* n.b. caller decides to X_LOCK or not. */ /* n.b. caller decides to X_LOCK or not. */

@ -837,6 +837,11 @@ void setup_cursors_and_push(void) {
* *
*/ */
static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) { static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) {
#if NO_X11
RAWFB_RET_VOID
if (!depth || !w || !winfo) {}
return;
#else
Window r, c; Window r, c;
int i, rx, ry, wx, wy; int i, rx, ry, wx, wy;
unsigned int mask; unsigned int mask;
@ -848,9 +853,6 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) {
XErrorHandler old_handler; XErrorHandler old_handler;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK; X_LOCK;
@ -1540,6 +1542,8 @@ int get_which_cursor(void) {
XSetErrorHandler(old_handler); XSetErrorHandler(old_handler);
X_UNLOCK; X_UNLOCK;
trapped_xerror = 0; trapped_xerror = 0;
#else
if (!r || !d || !bw || !h || !w || !y || !x || !ratio || !old_handler) {}
#endif /* NO_X11 */ #endif /* NO_X11 */
} }
if (which == which0) { if (which == which0) {
@ -1895,6 +1899,8 @@ int check_x11_pointer(void) {
&win_x, &win_y, &mask); &win_x, &win_y, &mask);
X_UNLOCK; X_UNLOCK;
} }
#else
if (!mask || !win_y || !win_x || !child_w || !root_w) {}
#endif /* NO_X11 */ #endif /* NO_X11 */
if (0) fprintf(stderr, "check_x11_pointer %d %d\n", root_x, root_y); if (0) fprintf(stderr, "check_x11_pointer %d %d\n", root_x, root_y);

@ -43,12 +43,13 @@ char *get_gui_code(void) {
} }
static Window tweak_tk_window_id(Window win) { static Window tweak_tk_window_id(Window win) {
char *name = NULL;
Window parent, new;
#if NO_X11 #if NO_X11
if (!win) {}
return None; return None;
#else #else
char *name = NULL;
Window parent, new;
/* hack for tk, does not report outermost window */ /* hack for tk, does not report outermost window */
new = win; new = win;
parent = parent_window(win, &name); parent = parent_window(win, &name);
@ -67,6 +68,11 @@ static Window tweak_tk_window_id(Window win) {
} }
int tray_embed(Window iconwin, int remove) { int tray_embed(Window iconwin, int remove) {
#if NO_X11
RAWFB_RET(0)
if (!iconwin || !remove) {}
return 0;
#else
XEvent ev; XEvent ev;
XErrorHandler old_handler; XErrorHandler old_handler;
Window manager; Window manager;
@ -77,9 +83,6 @@ int tray_embed(Window iconwin, int remove) {
long data = 0; long data = 0;
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (remove) { if (remove) {
if (!valid_window(iconwin, &attr, 1)) { if (!valid_window(iconwin, &attr, 1)) {
@ -164,14 +167,16 @@ int tray_embed(Window iconwin, int remove) {
} }
static int tray_manager_running(Display *d, Window *manager) { static int tray_manager_running(Display *d, Window *manager) {
#if NO_X11
RAWFB_RET(0)
if (!d || !manager) {}
return 0;
#else
char tray_string[100]; char tray_string[100];
Atom tray_manager; Atom tray_manager;
Window tray_win; Window tray_win;
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (manager) { if (manager) {
*manager = None; *manager = None;

@ -56,13 +56,15 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client);
* Routine to retreive current state keyboard. 1 means down, 0 up. * Routine to retreive current state keyboard. 1 means down, 0 up.
*/ */
void get_keystate(int *keystate) { void get_keystate(int *keystate) {
#if NO_X11
RAWFB_RET_VOID
if (!keystate) {}
return;
#else
int i, k; int i, k;
char keys[32]; char keys[32];
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
/* n.b. caller decides to X_LOCK or not. */ /* n.b. caller decides to X_LOCK or not. */
XQueryKeymap(dpy, keys); XQueryKeymap(dpy, keys);
@ -85,6 +87,11 @@ void get_keystate(int *keystate) {
* Try to KeyRelease any non-Lock modifiers that are down. * Try to KeyRelease any non-Lock modifiers that are down.
*/ */
void clear_modifiers(int init) { void clear_modifiers(int init) {
#if NO_X11
RAWFB_RET_VOID
if (!init) {}
return;
#else
static KeyCode keycodes[256]; static KeyCode keycodes[256];
static KeySym keysyms[256]; static KeySym keysyms[256];
static char *keystrs[256]; static char *keystrs[256];
@ -96,9 +103,6 @@ void clear_modifiers(int init) {
KeyCode keycode; KeyCode keycode;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
/* n.b. caller decides to X_LOCK or not. */ /* n.b. caller decides to X_LOCK or not. */
if (first) { if (first) {
@ -258,12 +262,13 @@ void clear_keys(void) {
static int save_auto_repeat = -1; static int save_auto_repeat = -1;
int get_autorepeat_state(void) { int get_autorepeat_state(void) {
XKeyboardState kstate;
RAWFB_RET(0)
#if NO_X11 #if NO_X11
RAWFB_RET(0)
return 0; return 0;
#else #else
XKeyboardState kstate;
RAWFB_RET(0)
X_LOCK; X_LOCK;
XGetKeyboardControl(dpy, &kstate); XGetKeyboardControl(dpy, &kstate);
@ -280,13 +285,15 @@ int get_initial_autorepeat_state(void) {
} }
void autorepeat(int restore, int bequiet) { void autorepeat(int restore, int bequiet) {
#if NO_X11
RAWFB_RET_VOID
if (!restore || !bequiet) {}
return;
#else
int global_auto_repeat; int global_auto_repeat;
XKeyboardControl kctrl; XKeyboardControl kctrl;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (restore) { if (restore) {
if (save_auto_repeat < 0) { if (save_auto_repeat < 0) {
@ -372,9 +379,21 @@ static int alltime_len = 1024;
static int alltime_num = 0; static int alltime_num = 0;
int add_keysym(KeySym keysym) { int add_keysym(KeySym keysym) {
int minkey, maxkey, syms_per_keycode;
int kc, n, ret = 0;
static int first = 1; static int first = 1;
int n;
#if NO_X11
if (first) {
for (n=0; n < 0x100; n++) {
added_keysyms[n] = NoSymbol;
}
first = 0;
}
RAWFB_RET(0)
if (!keysym) {}
return 0;
#else
int minkey, maxkey, syms_per_keycode;
int kc, ret = 0;
KeySym *keymap; KeySym *keymap;
if (first) { if (first) {
@ -385,9 +404,6 @@ int add_keysym(KeySym keysym) {
} }
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (keysym == NoSymbol) { if (keysym == NoSymbol) {
return 0; return 0;
@ -465,15 +481,17 @@ int add_keysym(KeySym keysym) {
} }
static void delete_keycode(KeyCode kc, int bequiet) { static void delete_keycode(KeyCode kc, int bequiet) {
#if NO_X11
RAWFB_RET_VOID
if (!kc || !bequiet) {}
return;
#else
int minkey, maxkey, syms_per_keycode, i; int minkey, maxkey, syms_per_keycode, i;
KeySym *keymap; KeySym *keymap;
KeySym ksym, new[8]; KeySym ksym, new[8];
char *str; char *str;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
XDisplayKeycodes(dpy, &minkey, &maxkey); XDisplayKeycodes(dpy, &minkey, &maxkey);
keymap = XGetKeyboardMapping(dpy, minkey, (maxkey - minkey + 1), keymap = XGetKeyboardMapping(dpy, minkey, (maxkey - minkey + 1),
@ -659,6 +677,8 @@ static void add_dead_keysyms(char *str) {
} }
} }
} }
#else
if ((ksym2 = 0)) {}
#endif #endif
if (! inmap) { if (! inmap) {
add_remap(p); add_remap(p);
@ -798,6 +818,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11 #if NO_X11
if (!key || !down || !keysym || !new) {}
return 0; return 0;
#else #else
@ -855,6 +876,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
static void initialize_xkb_modtweak(void) {} static void initialize_xkb_modtweak(void) {}
static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym, static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
rfbClientPtr client) { rfbClientPtr client) {
if (!client || !down || !keysym) {} /* unused vars warning: */
} }
void switch_to_xkb_if_better(void) {} void switch_to_xkb_if_better(void) {}
@ -1465,7 +1487,7 @@ static void xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
static int Kc_last_down = -1; static int Kc_last_down = -1;
static KeySym Ks_last_down = NoSymbol; static KeySym Ks_last_down = NoSymbol;
if (client) {} /* unused vars warning: */ if (!client || !down || !keysym) {} /* unused vars warning: */
RAWFB_RET_VOID RAWFB_RET_VOID
@ -2207,6 +2229,10 @@ rfbLog("allowed_input_view_only: %s\n", allowed_input_view_only);
} }
void initialize_modtweak(void) { void initialize_modtweak(void) {
#if NO_X11
RAWFB_RET_VOID
return;
#else
KeySym keysym, *keymap; KeySym keysym, *keymap;
int i, j, minkey, maxkey, syms_per_keycode; int i, j, minkey, maxkey, syms_per_keycode;
@ -2220,9 +2246,6 @@ void initialize_modtweak(void) {
} }
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK; X_LOCK;
XDisplayKeycodes(dpy, &minkey, &maxkey); XDisplayKeycodes(dpy, &minkey, &maxkey);
@ -2361,13 +2384,15 @@ static void tweak_mod(signed char mod, rfbBool down) {
*/ */
static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym, static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym,
rfbClientPtr client) { rfbClientPtr client) {
#if NO_X11
RAWFB_RET_VOID
if (!down || !keysym || !client) {}
return;
#else
KeyCode k; KeyCode k;
int tweak = 0; int tweak = 0;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (use_xkb_modtweak) { if (use_xkb_modtweak) {
xkb_tweak_keyboard(down, keysym, client); xkb_tweak_keyboard(down, keysym, client);

@ -24,6 +24,7 @@
#include "macosxCGP.h" #include "macosxCGP.h"
#include "macosxCGS.h" #include "macosxCGS.h"
void macosx_log(char *);
char *macosx_console_guess(char *str, int *fd); char *macosx_console_guess(char *str, int *fd);
void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client);
void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client); void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client);
@ -45,6 +46,10 @@ void macosx_add_destroy(Window win, int level);
void macosx_add_visnotify(Window win, int level, int obscured); void macosx_add_visnotify(Window win, int level, int obscured);
int macosx_checkevent(XEvent *ev); int macosx_checkevent(XEvent *ev);
void macosx_log(char *str) {
rfbLog(str);
}
#if (! DOMAC) #if (! DOMAC)
void macosx_event_loop(void) { void macosx_event_loop(void) {

@ -3,6 +3,7 @@
/* -- macosx.h -- */ /* -- macosx.h -- */
extern void macosx_log(char *);
extern char *macosx_console_guess(char *str, int *fd); extern char *macosx_console_guess(char *str, int *fd);
extern char *macosx_get_fb_addr(void); extern char *macosx_get_fb_addr(void);
extern void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); extern void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client);

@ -34,6 +34,7 @@ void macosxCG_key_inject(int down, unsigned int keysym);
CGDirectDisplayID displayID = NULL; CGDirectDisplayID displayID = NULL;
extern void macosx_log(char *);
extern int collect_macosx_damage(int x_in, int y_in, int w_in, int h_in, int call); extern int collect_macosx_damage(int x_in, int y_in, int w_in, int h_in, int call);
static void macosxCG_callback(CGRectCount n, const CGRect *rects, void *dum) { static void macosxCG_callback(CGRectCount n, const CGRect *rects, void *dum) {
@ -76,7 +77,7 @@ void macosxCG_refresh_callback_on(void) {
} }
if (! callback_set) { if (! callback_set) {
if (1) fprintf(stderr, "macosxCG_callback: register\n"); if (1) macosx_log("macosxCG_callback: register\n");
CGRegisterScreenRefreshCallback(macosxCG_callback, NULL); CGRegisterScreenRefreshCallback(macosxCG_callback, NULL);
} }
callback_set = 1; callback_set = 1;
@ -84,7 +85,7 @@ void macosxCG_refresh_callback_on(void) {
void macosxCG_refresh_callback_off(void) { void macosxCG_refresh_callback_off(void) {
if (callback_set) { if (callback_set) {
if (1) fprintf(stderr, "macosxCG_callback: unregister\n"); if (1) macosx_log("macosxCG_callback: unregister\n");
CGUnregisterScreenRefreshCallback(macosxCG_callback, NULL); CGUnregisterScreenRefreshCallback(macosxCG_callback, NULL);
} }
callback_set = 0; callback_set = 0;
@ -100,7 +101,7 @@ extern void macosxCGP_screensaver_timer_on(void);
void macosxCG_init(void) { void macosxCG_init(void) {
if (displayID == NULL) { if (displayID == NULL) {
fprintf(stderr, "macosxCG_init: initializing display.\n"); macosx_log("macosxCG_init: initializing display.\n");
#if 0 #if 0
dragum(); dragum();
#endif #endif
@ -140,6 +141,7 @@ extern int macosx_wait_for_switch, macosx_resize;
extern void macosxGCS_poll_pb(void); extern void macosxGCS_poll_pb(void);
extern void usleep(unsigned long usec); extern void usleep(unsigned long usec);
extern unsigned int sleep(unsigned int seconds); extern unsigned int sleep(unsigned int seconds);
extern void clean_up_exit (int ret);
void macosxCG_event_loop(void) { void macosxCG_event_loop(void) {
OSStatus rc; OSStatus rc;
@ -177,14 +179,14 @@ void macosxCG_event_loop(void) {
} }
} }
if ((cnt++ % 120) == 0) { if ((cnt++ % 120) == 0) {
fprintf(stderr, "waiting for user to " macosx_log("waiting for user to "
"switch back..\n"); "switch back..\n");
} }
sleep(1); sleep(1);
} }
if (wdpy_x == (int) CGDisplayPixelsWide(displayID)) { if (wdpy_x == (int) CGDisplayPixelsWide(displayID)) {
if (wdpy_y == (int) CGDisplayPixelsHigh(displayID)) { if (wdpy_y == (int) CGDisplayPixelsHigh(displayID)) {
fprintf(stderr, "we're back...\n"); macosx_log("we're back...\n");
return; return;
} }
} }
@ -247,11 +249,14 @@ static CGPoint current_cursor_pos(void) {
pos.y = 0; pos.y = 0;
if (! conn) { if (! conn) {
if (CGSNewConnection(NULL, &conn) != kCGErrorSuccess) { if (CGSNewConnection(NULL, &conn) != kCGErrorSuccess) {
fprintf(stderr, "CGSNewConnection error\n"); macosx_log("CGSNewConnection error.\n");
if (!dpy_x || !dpy_y || !wdpy_x || !wdpy_y) {
clean_up_exit(1);
}
} }
} }
if (CGSGetCurrentCursorLocation(conn, &pos) != kCGErrorSuccess) { if (CGSGetCurrentCursorLocation(conn, &pos) != kCGErrorSuccess) {
fprintf(stderr, "CGSGetCurrentCursorLocation error\n"); macosx_log("CGSGetCurrentCursorLocation error\n");
} }
display_button_mask = GetCurrentButtonState(); display_button_mask = GetCurrentButtonState();
@ -304,7 +309,10 @@ int macosxCG_get_cursor(void) {
if (! conn) { if (! conn) {
if (CGSNewConnection(NULL, &conn) != kCGErrorSuccess) { if (CGSNewConnection(NULL, &conn) != kCGErrorSuccess) {
fprintf(stderr, "CGSNewConnection error\n"); macosx_log("CGSNewConnection error.\n");
if (!dpy_x || !dpy_y || !wdpy_x || !wdpy_y) {
clean_up_exit(1);
}
return which; return which;
} }
} }
@ -319,7 +327,7 @@ int macosxCG_get_cursor(void) {
last_fetch = now; last_fetch = now;
if (CGSGetGlobalCursorDataSize(conn, &datasize) != kCGErrorSuccess) { if (CGSGetGlobalCursorDataSize(conn, &datasize) != kCGErrorSuccess) {
fprintf(stderr, "CGSGetGlobalCursorDataSize error\n"); macosx_log("CGSGetGlobalCursorDataSize error\n");
return which; return which;
} }
@ -328,7 +336,7 @@ int macosxCG_get_cursor(void) {
err = CGSGetGlobalCursorData(conn, data, &datasize, &row_bytes, err = CGSGetGlobalCursorData(conn, data, &datasize, &row_bytes,
&rect, &hot, &cdepth, &comps, &bpcomp); &rect, &hot, &cdepth, &comps, &bpcomp);
if (err != kCGErrorSuccess) { if (err != kCGErrorSuccess) {
fprintf(stderr, "CGSGetGlobalCursorData error\n"); macosx_log("CGSGetGlobalCursorData error\n");
return which; return which;
} }

@ -53,6 +53,8 @@ extern OSStatus CGSOrderWindow(const CGSConnectionID cid,
static CGSConnectionID cid = NULL; static CGSConnectionID cid = NULL;
extern void macosx_log(char *);
int macwinmax = 0; int macwinmax = 0;
typedef struct windat { typedef struct windat {
int win; int win;
@ -493,7 +495,7 @@ void macosxGCS_initpb(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
pblock = [[NSLock alloc] init]; pblock = [[NSLock alloc] init];
if (![NSPasteboard generalPasteboard]) { if (![NSPasteboard generalPasteboard]) {
fprintf(stderr, "macosxGCS_initpb: pasteboard inaccessible.\n"); macosx_log("macosxGCS_initpb: pasteboard inaccessible.\n");
pbcnt = 0; pbcnt = 0;
pbstr = [[NSString alloc] initWithString:@"\e<PASTEBOARD INACCESSIBLE>\e"]; pbstr = [[NSString alloc] initWithString:@"\e<PASTEBOARD INACCESSIBLE>\e"];
} }

@ -118,7 +118,7 @@ Unix and Mac OS X:
Unpack the archive: Unpack the archive:
% gzip -dc ssvnc-1.0.8.tar.gz | tar xvf - % gzip -dc ssvnc-1.0.9.tar.gz | tar xvf -
Run the GUI: Run the GUI:
@ -126,15 +126,18 @@ Unix and Mac OS X:
% ./ssvnc/MacOSX/ssvnc (for Mac OS X) % ./ssvnc/MacOSX/ssvnc (for Mac OS X)
The smaller file "ssvnc_no_windows-1.0.8.tar.gz" On MacOSX you could also click on the SSVNC app in the Finder.
The smaller file "ssvnc_no_windows-1.0.9.tar.gz"
could have been used as well. could have been used as well.
Windows: Windows:
Unzip, using WinZip or a similar utility, the zip file: Unzip, using WinZip or a similar utility, the zip file:
ssvnc-1.0.8.zip ssvnc-1.0.9.zip
Run the GUI, e.g.: Run the GUI, e.g.:
@ -146,7 +149,7 @@ Windows:
select Open, and then OK to launch it. select Open, and then OK to launch it.
The smaller file "ssvnc_windows_only-1.0.8.zip" The smaller file "ssvnc_windows_only-1.0.9.zip"
could have been used as well. could have been used as well.
You can make a Windows shortcut to this program if you want to. You can make a Windows shortcut to this program if you want to.

@ -104,7 +104,7 @@ use_ours=0
if [ "X$VNCVIEWERCMD" = "X" ]; then if [ "X$VNCVIEWERCMD" = "X" ]; then
VNCVIEWERCMD="vncviewer" VNCVIEWERCMD="vncviewer"
export VNCVIEWERCMD export VNCVIEWERCMD
if [ "X$DARWIN_COTVNC" != "X" ]; then if [ "X$DARWIN_COTVNC" = "X" ]; then
use_ours=1 use_ours=1
fi fi
fi fi

@ -64,6 +64,16 @@ proc scroll_text_dismiss {fr {w 80} {h 35}} {
pack $fr -side top -fill both -expand 1 pack $fr -side top -fill both -expand 1
} }
proc jiggle_text {w} {
global uname
if {$uname == "Darwin"} {
$w yview scroll 1 pages
update idletasks
$w yview scroll -1 pages
update idletasks
}
}
proc help {} { proc help {} {
catch {destroy .h} catch {destroy .h}
toplevel .h toplevel .h
@ -104,6 +114,15 @@ proc help {} {
need to terminate STUNNEL manually from the System Tray (right click need to terminate STUNNEL manually from the System Tray (right click
on dark green icon) and selecting "Exit". on dark green icon) and selecting "Exit".
VNC Password:
On Unix or MacOSX if there is a VNC password for the server you
can enter it in the "VNC Password:" entry box. This is required on
MacOSX when Chicken of the VNC (the default) is used. On Unix if
you choose not to enter the password you will be prompted for it in
the terminal running TightVNC viewer. On Windows TightVNC viewer
should prompt you. When you Save a VNC profile, the password is
not saved (you need to enter it each time).
SSH: SSH:
@ -232,6 +251,7 @@ proc help {} {
} }
.h.f.t insert end $msg .h.f.t insert end $msg
jiggle_text .h.f.t
} }
proc help_certs {} { proc help_certs {} {
@ -316,6 +336,7 @@ proc help_certs {} {
} }
.ch.f.t insert end $msg .ch.f.t insert end $msg
jiggle_text .ch.f.t
} }
proc help_opts {} { proc help_opts {} {
@ -450,6 +471,7 @@ set msg {
Advanced: Bring up the Advanced Options dialog. Advanced: Bring up the Advanced Options dialog.
} }
.oh.f.t insert end $msg .oh.f.t insert end $msg
jiggle_text .oh.f.t
} }
proc win_nokill_msg {} { proc win_nokill_msg {} {
@ -688,6 +710,9 @@ proc set_defaults {} {
set $var $defs($var) set $var $defs($var)
} }
global vncauth_passwd
set vncauth_passwd ""
ssl_ssh_adjust ssl ssl_ssh_adjust ssl
} }
@ -1633,6 +1658,10 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
puts $fh { echo try-2: termpid=$termpid mypid=$$} puts $fh { echo try-2: termpid=$termpid mypid=$$}
puts $fh {fi} puts $fh {fi}
puts $fh {if [ "X$termpid" = "X" ]; then} puts $fh {if [ "X$termpid" = "X" ]; then}
puts $fh { termpid=`ps wwwwaux | grep -w Terminal | grep $tmp | grep -v grep | awk '{print $2}' | sort -n | tail -1`}
puts $fh { echo try-3: termpid=$termpid mypid=$$}
puts $fh {fi}
puts $fh {if [ "X$termpid" = "X" ]; then}
puts $fh { termpid=$$} puts $fh { termpid=$$}
puts $fh { echo termpid-find-fail: termpid=$termpid mypid=$$} puts $fh { echo termpid-find-fail: termpid=$termpid mypid=$$}
puts $fh {fi} puts $fh {fi}
@ -1916,6 +1945,7 @@ proc direct_connect_msg {} {
proc launch_unix {hp} { proc launch_unix {hp} {
global smb_redir_0 smb_mounts env global smb_redir_0 smb_mounts env
global vncauth_passwd
globalize globalize
@ -2118,6 +2148,19 @@ proc launch_unix {hp} {
set realvnc3 1 set realvnc3 1
} }
set passwdfile ""
if {$vncauth_passwd != ""} {
set passwdfile "$env(HOME)/.vncauth_tmp.[pid]"
catch {exec vncstorepw $vncauth_passwd $passwdfile}
catch {exec chmod 600 $passwdfile}
catch {exec sh -c "sleep 15; rm $passwdfile" &}
if {$darwin_cotvnc} {
set cmd "$cmd --PasswordFile $passwdfile"
} else {
set cmd "$cmd -passwd $passwdfile"
}
}
if {$use_viewonly} { if {$use_viewonly} {
if {$darwin_cotvnc} { if {$darwin_cotvnc} {
set cmd "$cmd --ViewOnly" set cmd "$cmd --ViewOnly"
@ -2236,6 +2279,9 @@ proc launch_unix {hp} {
catch {exec sh -c "pkill -x $daemon" >/dev/null 2>/dev/null </dev/null &} catch {exec sh -c "pkill -x $daemon" >/dev/null 2>/dev/null </dev/null &}
} }
} }
if {$passwdfile != ""} {
catch {file delete $passwdfile}
}
wm deiconify . wm deiconify .
mesg "Disconnected from $hp" mesg "Disconnected from $hp"
if {[regexp {FINISH} $port_knocking_list]} { if {[regexp {FINISH} $port_knocking_list]} {
@ -5746,6 +5792,7 @@ proc help_advanced_opts {} {
} }
.ah.f.t insert end $msg .ah.f.t insert end $msg
jiggle_text .ah.f.t
} }
proc set_viewer_path {} { proc set_viewer_path {} {
@ -6885,6 +6932,7 @@ set skip_pre 0
set vncdisplay "" set vncdisplay ""
set vncproxy "" set vncproxy ""
set remote_ssh_cmd "" set remote_ssh_cmd ""
set vncauth_passwd ""
label .l -text "SSL/SSH VNC Viewer" -relief ridge label .l -text "SSL/SSH VNC Viewer" -relief ridge
@ -6902,26 +6950,32 @@ pack .f0.e -side left -expand 1 -fill x
bind .f0.e <Return> launch bind .f0.e <Return> launch
frame .f1 frame .f1
label .f1.l -width $wl -anchor w -text "Proxy/Gateway:" -relief ridge label .f1.l -width $wl -anchor w -text "VNC Password:" -relief ridge
entry .f1.e -width $we -textvariable vncproxy entry .f1.e -width $we -textvariable vncauth_passwd -show *
pack .f1.l -side left pack .f1.l -side left
pack .f1.e -side left -expand 1 -fill x pack .f1.e -side left -expand 1 -fill x
frame .f2 frame .f2
label .f2.l -width $wl -anchor w -text "Remote SSH Command:" -relief ridge label .f2.l -width $wl -anchor w -text "Proxy/Gateway:" -relief ridge
entry .f2.e -width $we -textvariable remote_ssh_cmd entry .f2.e -width $we -textvariable vncproxy
pack .f2.l -side left pack .f2.l -side left
pack .f2.e -side left -expand 1 -fill x pack .f2.e -side left -expand 1 -fill x
.f2.l configure -state disabled
.f2.e configure -state disabled
set remote_ssh_cmd_list {.f2.e .f2.l}
frame .f3 frame .f3
radiobutton .f3.ssl -anchor w -variable sshssl_sw -value ssl -command {ssl_ssh_adjust ssl} -text "Use SSL" label .f3.l -width $wl -anchor w -text "Remote SSH Command:" -relief ridge
radiobutton .f3.ssh -anchor w -variable sshssl_sw -value ssh -command {ssl_ssh_adjust ssh} -text "Use SSH" entry .f3.e -width $we -textvariable remote_ssh_cmd
radiobutton .f3.sshssl -anchor w -variable sshssl_sw -value sshssl -command {ssl_ssh_adjust sshssl} -text "Use SSH and SSL" pack .f3.l -side left
pack .f3.ssl .f3.ssh .f3.sshssl -side left -fill x pack .f3.e -side left -expand 1 -fill x
.f3.l configure -state disabled
.f3.e configure -state disabled
set remote_ssh_cmd_list {.f3.e .f3.l}
frame .f4
radiobutton .f4.ssl -anchor w -variable sshssl_sw -value ssl -command {ssl_ssh_adjust ssl} -text "Use SSL"
radiobutton .f4.ssh -anchor w -variable sshssl_sw -value ssh -command {ssl_ssh_adjust ssh} -text "Use SSH"
radiobutton .f4.sshssl -anchor w -variable sshssl_sw -value sshssl -command {ssl_ssh_adjust sshssl} -text "Use SSH and SSL"
pack .f4.ssl .f4.ssh .f4.sshssl -side left -fill x
ssl_ssh_adjust ssl ssl_ssh_adjust ssl
@ -6937,7 +6991,11 @@ button .b.exit -text "Exit" -command {destroy .; exit}
pack .b.certs .b.opts .b.load .b.conn .b.help .b.exit -side left -expand 1 -fill x pack .b.certs .b.opts .b.load .b.conn .b.help .b.exit -side left -expand 1 -fill x
if {$multientry} { if {$multientry} {
pack .l .f0 .f1 .f2 .f3 .b -side top -fill x if {! $is_windows} {
pack .l .f0 .f1 .f2 .f3 .f4 .b -side top -fill x
} else {
pack .l .f0 .f2 .f3 .f4 .b -side top -fill x
}
} else { } else {
pack .l .f0 .b -side top -fill x pack .l .f0 .b -side top -fill x
} }

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
rm -rf ./src/tmp/* || exit 1 rm -rf ./src/tmp/* || exit 1
vers=1.0.8 vers=1.0.9
cd .. || exit 1 cd .. || exit 1

@ -2807,10 +2807,12 @@ char *XKeysymToString(KeySym k) {
} }
KeySym XKeycodeToKeysym(Display *display, KeyCode keycode, int index) { KeySym XKeycodeToKeysym(Display *display, KeyCode keycode, int index) {
if (!display || !keycode || !index) {}
return NoSymbol; return NoSymbol;
} }
KeyCode XKeysymToKeycode(Display *display, KeySym keysym) { KeyCode XKeysymToKeycode(Display *display, KeySym keysym) {
if (!display || !keysym) {}
return NoSymbol; return NoSymbol;
} }

@ -53,13 +53,14 @@ static prtremap_t pointer_map[MAX_BUTTONS+1][MAX_BUTTON_EVENTS];
* For parsing the -buttonmap sections, e.g. "4" or ":Up+Up+Up:" * For parsing the -buttonmap sections, e.g. "4" or ":Up+Up+Up:"
*/ */
static void buttonparse(int from, char **s) { static void buttonparse(int from, char **s) {
#if NO_X11
if (!from || !s) {}
return;
#else
char *q; char *q;
int to, i; int to, i;
int modisdown[256]; int modisdown[256];
#if NO_X11
return;
#else
q = *s; q = *s;
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
@ -214,6 +215,10 @@ static void buttonparse(int from, char **s) {
* process the -buttonmap string * process the -buttonmap string
*/ */
void initialize_pointer_map(char *pointer_remap) { void initialize_pointer_map(char *pointer_remap) {
#if NO_X11
if (!pointer_remap) {}
return;
#else
unsigned char map[MAX_BUTTONS]; unsigned char map[MAX_BUTTONS];
int i, k; int i, k;
/* /*
@ -223,9 +228,6 @@ void initialize_pointer_map(char *pointer_remap) {
* from -buttonmap option. * from -buttonmap option.
*/ */
#if NO_X11
return;
#else
if (!raw_fb_str) { if (!raw_fb_str) {
X_LOCK; X_LOCK;
num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS); num_buttons = XGetPointerMapping(dpy, map, MAX_BUTTONS);
@ -299,12 +301,14 @@ void initialize_pointer_map(char *pointer_remap) {
* Send a pointer position event to the X server. * Send a pointer position event to the X server.
*/ */
static void update_x11_pointer_position(int x, int y) { static void update_x11_pointer_position(int x, int y) {
int rc;
RAWFB_RET_VOID
#if NO_X11 #if NO_X11
RAWFB_RET_VOID
if (!x || !y) {}
return; return;
#else #else
int rc;
RAWFB_RET_VOID
X_LOCK; X_LOCK;
if (use_xwarppointer) { if (use_xwarppointer) {
@ -339,11 +343,12 @@ static void update_x11_pointer_position(int x, int y) {
} }
void do_button_mask_change(int mask, int button) { void do_button_mask_change(int mask, int button) {
int mb, k, i = button-1;
#if NO_X11 #if NO_X11
if (!mask || !button) {}
return; return;
#else #else
int mb, k, i = button-1;
/* /*
* this expands to any pointer_map button -> keystrokes * this expands to any pointer_map button -> keystrokes
* remappings. Usually just k=0 and we send one button event. * remappings. Usually just k=0 and we send one button event.
@ -408,14 +413,16 @@ void do_button_mask_change(int mask, int button) {
* Send a pointer button event to the X server. * Send a pointer button event to the X server.
*/ */
static void update_x11_pointer_mask(int mask) { static void update_x11_pointer_mask(int mask) {
#if NO_X11
RAWFB_RET_VOID
if (!mask) {}
return;
#else
int snapped = 0, xr_mouse = 1, i; int snapped = 0, xr_mouse = 1, i;
last_event = last_input = last_pointer_input = time(NULL); last_event = last_input = last_pointer_input = time(NULL);
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (mask != button_mask) { if (mask != button_mask) {
last_pointer_click_time = dnow(); last_pointer_click_time = dnow();

@ -498,11 +498,11 @@ static void reset_rfbport(int old, int new) {
* libXau yet. * libXau yet.
*/ */
int remote_control_access_ok(void) { int remote_control_access_ok(void) {
struct stat sbuf;
#if NO_X11 #if NO_X11
return 0; return 0;
#else #else
struct stat sbuf;
if (client_connect_file) { if (client_connect_file) {
if (stat(client_connect_file, &sbuf) == 0) { if (stat(client_connect_file, &sbuf) == 0) {
if (sbuf.st_mode & S_IWOTH) { if (sbuf.st_mode & S_IWOTH) {

@ -347,6 +347,8 @@ void shm_delete(XShmSegmentInfo *shm) {
if (shm != NULL && shm->shmid != -1) { if (shm != NULL && shm->shmid != -1) {
shmctl(shm->shmid, IPC_RMID, 0); shmctl(shm->shmid, IPC_RMID, 0);
} }
#else
if (!shm) {}
#endif #endif
} }
@ -2866,7 +2868,6 @@ static int scan_display(int ystart, int rescan) {
#ifndef NO_NCACHE #ifndef NO_NCACHE
/* XXX Y test */ /* XXX Y test */
if (ncache > 0) { if (ncache > 0) {
XEvent ev;
int gotone = 0; int gotone = 0;
if (macosx_console) { if (macosx_console) {
if (macosx_checkevent(NULL)) { if (macosx_checkevent(NULL)) {
@ -2874,6 +2875,7 @@ if (ncache > 0) {
} }
} else { } else {
#if !NO_X11 #if !NO_X11
XEvent ev;
if (raw_fb_str) { if (raw_fb_str) {
; ;
} else if (XCheckTypedEvent(dpy, MapNotify, &ev)) { } else if (XCheckTypedEvent(dpy, MapNotify, &ev)) {

@ -141,6 +141,10 @@ if (0) fprintf(stderr, "unset_colormap: %s\n", raw_fb_pixfmt);
} }
void set_colormap(int reset) { void set_colormap(int reset) {
#if NO_X11
if (!reset) {}
return;
#else
static int init = 1; static int init = 1;
static XColor color[NCOLOR], prev[NCOLOR]; static XColor color[NCOLOR], prev[NCOLOR];
Colormap cmap; Colormap cmap;
@ -171,9 +175,6 @@ if (0) fprintf(stderr, "unset_colormap: %d\n", reset);
} }
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK; X_LOCK;
@ -338,14 +339,16 @@ static void debug_colormap(XImage *fb) {
* visual_id and possibly visual_depth are set. * visual_id and possibly visual_depth are set.
*/ */
static void set_visual(char *str) { static void set_visual(char *str) {
#if NO_X11
RAWFB_RET_VOID
if (!str) {}
return;
#else
int vis, vdepth, defdepth; int vis, vdepth, defdepth;
XVisualInfo vinfo; XVisualInfo vinfo;
char *p, *vstring = strdup(str); char *p, *vstring = strdup(str);
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
defdepth = DefaultDepth(dpy, scr); defdepth = DefaultDepth(dpy, scr);
visual_id = (VisualID) 0; visual_id = (VisualID) 0;
@ -1432,13 +1435,14 @@ static void initialize_clipshift(void) {
} }
static int wait_until_mapped(Window win) { static int wait_until_mapped(Window win) {
#if NO_X11
if (!win) {}
return 0;
#else
int ms = 50, waittime = 30; int ms = 50, waittime = 30;
time_t start = time(NULL); time_t start = time(NULL);
XWindowAttributes attr; XWindowAttributes attr;
#if NO_X11
return 0;
#else
while (1) { while (1) {
if (! valid_window(win, NULL, 0)) { if (! valid_window(win, NULL, 0)) {
if (time(NULL) > start + waittime) { if (time(NULL) > start + waittime) {
@ -1463,6 +1467,9 @@ static int wait_until_mapped(Window win) {
* initialize a fb for the X display * initialize a fb for the X display
*/ */
XImage *initialize_xdisplay_fb(void) { XImage *initialize_xdisplay_fb(void) {
#if NO_X11
return NULL;
#else
XImage *fb; XImage *fb;
char *vis_str = visual_str; char *vis_str = visual_str;
int try = 0, subwin_tries = 3; int try = 0, subwin_tries = 3;
@ -1472,9 +1479,6 @@ XImage *initialize_xdisplay_fb(void) {
if (raw_fb_str) { if (raw_fb_str) {
return initialize_raw_fb(0); return initialize_raw_fb(0);
} }
#if NO_X11
return NULL;
#else
X_LOCK; X_LOCK;
if (subwin) { if (subwin) {
@ -2165,6 +2169,9 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
if (cmap8to24 && depth == 8 && dpy) { if (cmap8to24 && depth == 8 && dpy) {
XVisualInfo vinfo; XVisualInfo vinfo;
vinfo.red_mask = 0;
vinfo.green_mask = 0;
vinfo.blue_mask = 0;
/* more cooking up... */ /* more cooking up... */
have_masks = 2; have_masks = 2;
/* need to fetch TrueColor visual */ /* need to fetch TrueColor visual */

@ -51,6 +51,11 @@ static char clipboard_str[PROP_MAX+1];
* n.b.: our caller already has the X_LOCK. * n.b.: our caller already has the X_LOCK.
*/ */
void selection_request(XEvent *ev, char *type) { void selection_request(XEvent *ev, char *type) {
#if NO_X11
RAWFB_RET_VOID
if (!ev || !type) {}
return;
#else
XSelectionEvent notify_event; XSelectionEvent notify_event;
XSelectionRequestEvent *req_event; XSelectionRequestEvent *req_event;
XErrorHandler old_handler; XErrorHandler old_handler;
@ -61,9 +66,7 @@ void selection_request(XEvent *ev, char *type) {
unsigned long XA_LENGTH; unsigned long XA_LENGTH;
#endif #endif
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
#ifndef XA_LENGTH #ifndef XA_LENGTH
XA_LENGTH = XInternAtom(dpy, "LENGTH", True); XA_LENGTH = XInternAtom(dpy, "LENGTH", True);
#endif #endif
@ -180,6 +183,10 @@ int check_sel_direction(char *dir, char *label, char *sel, int len) {
* n.b.: our caller already has the X_LOCK. * n.b.: our caller already has the X_LOCK.
*/ */
void cutbuffer_send(void) { void cutbuffer_send(void) {
#if NO_X11
RAWFB_RET_VOID
return;
#else
Atom type; Atom type;
int format, slen, dlen, len; int format, slen, dlen, len;
unsigned long nitems = 0, bytes_after = 0; unsigned long nitems = 0, bytes_after = 0;
@ -189,9 +196,6 @@ void cutbuffer_send(void) {
slen = 0; slen = 0;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
/* read the property value into cutbuffer_str: */ /* read the property value into cutbuffer_str: */
do { do {
@ -254,6 +258,11 @@ void cutbuffer_send(void) {
*/ */
#define CHKSZ 32 #define CHKSZ 32
void selection_send(XEvent *ev) { void selection_send(XEvent *ev) {
#if NO_X11
RAWFB_RET_VOID
if (!ev) {}
return;
#else
Atom type; Atom type;
int format, slen, dlen, oldlen, newlen, toobig = 0, len; int format, slen, dlen, oldlen, newlen, toobig = 0, len;
static int err = 0, sent_one = 0; static int err = 0, sent_one = 0;
@ -263,9 +272,6 @@ void selection_send(XEvent *ev) {
char *selection_str; char *selection_str;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
/* /*
* remember info about our last value of PRIMARY (or CUT_BUFFER0) * remember info about our last value of PRIMARY (or CUT_BUFFER0)
* so we can check for any changes below. * so we can check for any changes below.

@ -114,6 +114,11 @@ static char *cmd_output(char *cmd) {
} }
static void solid_root(char *color) { static void solid_root(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
#else
Window expose; Window expose;
static XImage *image = NULL; static XImage *image = NULL;
Pixmap pixmap; Pixmap pixmap;
@ -126,9 +131,6 @@ static void solid_root(char *color) {
Colormap cmap; Colormap cmap;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (subwin || window != rootwin) { if (subwin || window != rootwin) {
rfbLog("cannot set subwin to solid color, must be rootwin\n"); rfbLog("cannot set subwin to solid color, must be rootwin\n");
@ -226,6 +228,11 @@ static void solid_root(char *color) {
} }
static void solid_cde(char *color) { static void solid_cde(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
#else
int wsmax = 16; int wsmax = 16;
static XImage *image[16]; static XImage *image[16];
static Window ws_wins[16]; static Window ws_wins[16];
@ -243,9 +250,6 @@ static void solid_cde(char *color) {
int n; int n;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (subwin || window != rootwin) { if (subwin || window != rootwin) {
rfbLog("cannot set subwin to solid color, must be rootwin\n"); rfbLog("cannot set subwin to solid color, must be rootwin\n");
@ -490,6 +494,11 @@ static void solid_cde(char *color) {
} }
static void solid_gnome(char *color) { static void solid_gnome(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
#else
char get_color[] = "gconftool-2 --get " char get_color[] = "gconftool-2 --get "
"/desktop/gnome/background/primary_color"; "/desktop/gnome/background/primary_color";
char set_color[] = "gconftool-2 --set " char set_color[] = "gconftool-2 --set "
@ -503,9 +512,6 @@ static void solid_gnome(char *color) {
char *cmd; char *cmd;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (! color) { if (! color) {
if (! orig_color) { if (! orig_color) {
@ -580,6 +586,11 @@ static void solid_gnome(char *color) {
} }
static void solid_kde(char *color) { static void solid_kde(char *color) {
#if NO_X11
RAWFB_RET_VOID
if (!color) {}
return;
#else
char set_color[] = char set_color[] =
"dcop --user '%s' kdesktop KBackgroundIface setColor '%s' 1"; "dcop --user '%s' kdesktop KBackgroundIface setColor '%s' 1";
char bg_off[] = char bg_off[] =
@ -590,9 +601,6 @@ static void solid_kde(char *color) {
int len; int len;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
user = get_user_name(); user = get_user_name();
if (strstr(user, "'") != NULL) { if (strstr(user, "'") != NULL) {
@ -633,12 +641,13 @@ static void solid_kde(char *color) {
} }
char *guess_desktop(void) { char *guess_desktop(void) {
Atom prop;
RAWFB_RET("root")
#if NO_X11 #if NO_X11
RAWFB_RET("root")
return "root"; return "root";
#else #else
Atom prop;
RAWFB_RET("root")
if (wmdt_str && *wmdt_str != '\0') { if (wmdt_str && *wmdt_str != '\0') {
char *s = wmdt_str; char *s = wmdt_str;

@ -98,11 +98,13 @@ int lookup_win_index(Window);
*/ */
int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h,
Window *frame, Window *win) { Window *frame, Window *win) {
#if !NO_X11
Window r, c; Window r, c;
XWindowAttributes attr; XWindowAttributes attr;
Bool ret; Bool ret;
int rootx, rooty, wx, wy; int rootx, rooty, wx, wy;
unsigned int mask; unsigned int mask;
#endif
#ifdef MACOSX #ifdef MACOSX
if (macosx_console) { if (macosx_console) {
@ -113,6 +115,7 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h,
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11 #if NO_X11
if (!px || !py || !x || !y || !w || !h || !frame || !win) {}
return 0; return 0;
#else #else
@ -336,6 +339,10 @@ static void parse_wireframe_str(char *wf) {
wireframe_shade = n; wireframe_shade = n;
ok = 1; ok = 1;
} }
#else
r = g = b = 0;
cmap = 0;
cdef.pixel = 0;
#endif #endif
} }
if (ok) { if (ok) {
@ -7061,6 +7068,7 @@ void xselectinput(Window w, unsigned long evmask, int sync) {
#if NO_X11 #if NO_X11
trapped_xerror = 0; trapped_xerror = 0;
trapped_xioerror = 0; trapped_xioerror = 0;
if (!evmask) {}
#else #else
XErrorHandler old_handler1; XErrorHandler old_handler1;
XIOErrorHandler old_handler2; XIOErrorHandler old_handler2;
@ -7108,6 +7116,7 @@ Bool xcheckmaskevent(Display *d, long mask, XEvent *ev) {
RAWFB_RET(False); RAWFB_RET(False);
#if NO_X11 #if NO_X11
if (!d || !mask) {}
return False; return False;
#else #else
return XCheckMaskEvent(d, mask, ev); return XCheckMaskEvent(d, mask, ev);

@ -557,6 +557,8 @@ char *choose_title(char *display) {
free(name); free(name);
} }
} }
#else
if (!name) {}
#endif /* NO_X11 */ #endif /* NO_X11 */
} }
return title; return title;

@ -29,11 +29,13 @@ Window descend_pointer(int depth, Window start, char *name_info, int len);
Window parent_window(Window win, char **name) { Window parent_window(Window win, char **name) {
#if !NO_X11
Window r, parent; Window r, parent;
Window *list; Window *list;
XErrorHandler old_handler; XErrorHandler old_handler;
unsigned int nchild; unsigned int nchild;
int rc; int rc;
#endif
if (name != NULL) { if (name != NULL) {
*name = NULL; *name = NULL;
@ -41,6 +43,7 @@ Window parent_window(Window win, char **name) {
RAWFB_RET(None) RAWFB_RET(None)
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!name || !win) {}
return None; return None;
#else #else
@ -67,9 +70,11 @@ Window parent_window(Window win, char **name) {
/* trapping utility to check for a valid window: */ /* trapping utility to check for a valid window: */
int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) { int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
XErrorHandler old_handler;
XWindowAttributes attr, *pattr; XWindowAttributes attr, *pattr;
#if !NO_X11
XErrorHandler old_handler;
int ok = 0; int ok = 0;
#endif
if (attr_ret == NULL) { if (attr_ret == NULL) {
pattr = &attr; pattr = &attr;
@ -89,6 +94,7 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!win || !attr_ret || !bequiet) {}
return 0; return 0;
#else #else
@ -113,12 +119,14 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x, Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x,
int *dst_y, Window *child, int bequiet) { int *dst_y, Window *child, int bequiet) {
XErrorHandler old_handler; XErrorHandler old_handler = NULL;
Bool ok = False; Bool ok = False;
RAWFB_RET(False) RAWFB_RET(False)
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!src || !dst || !src_x || !src_y || !dst_x || !dst_y || !child || !bequiet) {}
if (!old_handler || !ok) {}
return False; return False;
#else #else
@ -318,18 +326,22 @@ if (0) fprintf(stderr, "update_stack_list[%d]: %.4f %.4f\n", stack_list_num, no
} }
Window query_pointer(Window start) { Window query_pointer(Window start) {
int rx, ry;
#if !NO_X11
Window r, c; Window r, c;
int rx, ry, wx, wy; int wx, wy;
unsigned int mask; unsigned int mask;
#endif
#ifdef MACOSX #ifdef MACOSX
if (macosx_console) { if (macosx_console) {
macosx_get_cursor_pos(&rx, &rx); macosx_get_cursor_pos(&rx, &ry);
} }
#endif #endif
RAWFB_RET(None) RAWFB_RET(None)
#if NO_X11 #if NO_X11
if (!start) {}
return None; return None;
#else #else
if (start == None) { if (start == None) {
@ -344,14 +356,15 @@ Window query_pointer(Window start) {
} }
unsigned int mask_state(void) { unsigned int mask_state(void) {
#if NO_X11
RAWFB_RET(0)
return 0;
#else
Window r, c; Window r, c;
int rx, ry, wx, wy; int rx, ry, wx, wy;
unsigned int mask; unsigned int mask;
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (XQueryPointer_wr(dpy, rootwin, &r, &c, &rx, &ry, &wx, &wy, &mask)) { if (XQueryPointer_wr(dpy, rootwin, &r, &c, &rx, &ry, &wx, &wy, &mask)) {
return mask; return mask;
@ -437,6 +450,11 @@ int pick_windowid(unsigned long *num) {
} }
Window descend_pointer(int depth, Window start, char *name_info, int len) { Window descend_pointer(int depth, Window start, char *name_info, int len) {
#if NO_X11
RAWFB_RET(None)
if (!depth || !start || !name_info || !len) {}
return None;
#else
Window r, c, clast = None; Window r, c, clast = None;
int i, rx, ry, wx, wy; int i, rx, ry, wx, wy;
int written = 0, filled = 0; int written = 0, filled = 0;
@ -448,9 +466,6 @@ Window descend_pointer(int depth, Window start, char *name_info, int len) {
static Window prev_start = None; static Window prev_start = None;
RAWFB_RET(None) RAWFB_RET(None)
#if NO_X11
return None;
#else
if (! classhint) { if (! classhint) {
classhint = XAllocClassHint(); classhint = XAllocClassHint();

@ -75,6 +75,11 @@ void initialize_clipboard_atom(void) {
} }
static void initialize_xevents(int reset) { static void initialize_xevents(int reset) {
#if NO_X11
RAWFB_RET_VOID
if (!reset) {}
return;
#else
static int did_xselect_input = 0; static int did_xselect_input = 0;
static int did_xcreate_simple_window = 0; static int did_xcreate_simple_window = 0;
static int did_vnc_connect_prop = 0; static int did_vnc_connect_prop = 0;
@ -85,9 +90,6 @@ static void initialize_xevents(int reset) {
static int did_xrandr = 0; static int did_xrandr = 0;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (reset) { if (reset) {
did_xselect_input = 0; did_xselect_input = 0;
@ -165,10 +167,13 @@ static void print_xevent_bases(void) {
} }
static void get_prop(char *str, int len, Atom prop) { static void get_prop(char *str, int len, Atom prop) {
int i;
#if !NO_X11
Atom type; Atom type;
int format, slen, dlen, i; int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0; unsigned long nitems = 0, bytes_after = 0;
unsigned char* data = NULL; unsigned char* data = NULL;
#endif
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
str[i] = '\0'; str[i] = '\0';
@ -205,6 +210,10 @@ static void get_prop(char *str, int len, Atom prop) {
} }
static void bust_grab(int reset) { static void bust_grab(int reset) {
#if NO_X11
if (!reset) {}
return;
#else
static int bust_count = 0; static int bust_count = 0;
static time_t last_bust = 0; static time_t last_bust = 0;
time_t now = time(NULL); time_t now = time(NULL);
@ -218,9 +227,6 @@ static void bust_grab(int reset) {
bust_count = 0; bust_count = 0;
return; return;
} }
#if NO_X11
return;
#else
x = 0; x = 0;
y = 0; y = 0;
@ -465,6 +471,11 @@ static int process_watch(char *str, int parent, int db) {
} }
static void grab_buster_watch(int parent, char *dstr) { static void grab_buster_watch(int parent, char *dstr) {
#if NO_X11
RAWFB_RET_VOID
if (!parent || !dstr) {}
return;
#else
Atom ticker_atom = None; Atom ticker_atom = None;
int sleep = sync_tod_delay * 921 * 1000; int sleep = sync_tod_delay * 921 * 1000;
char propval[200]; char propval[200];
@ -472,9 +483,6 @@ static void grab_buster_watch(int parent, char *dstr) {
int db = 0; int db = 0;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (grab_buster > 1) { if (grab_buster > 1) {
db = 1; db = 1;
@ -577,6 +585,10 @@ void spawn_grab_buster(void) {
} }
void sync_tod_with_servertime(void) { void sync_tod_with_servertime(void) {
#if NO_X11
RAWFB_RET_VOID
return;
#else
static Atom ticker_atom = None; static Atom ticker_atom = None;
XEvent xev; XEvent xev;
char diff[128]; char diff[128];
@ -585,9 +597,6 @@ void sync_tod_with_servertime(void) {
int i, db = 0; int i, db = 0;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (! ticker_atom) { if (! ticker_atom) {
ticker_atom = XInternAtom(dpy, "X11VNC_TICKER", False); ticker_atom = XInternAtom(dpy, "X11VNC_TICKER", False);
@ -733,6 +742,11 @@ void check_autorepeat(void) {
* and other X11 events and respond to them as needed. * and other X11 events and respond to them as needed.
*/ */
void check_xevents(int reset) { void check_xevents(int reset) {
#if NO_X11
RAWFB_RET_VOID
if (!reset) {}
return;
#else
XEvent xev; XEvent xev;
int tmp, have_clients = 0; int tmp, have_clients = 0;
static int sent_some_sel = 0; static int sent_some_sel = 0;
@ -748,9 +762,6 @@ void check_xevents(int reset) {
if (unixpw_in_progress) return; if (unixpw_in_progress) return;
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11
return;
#else
if (now > last_init_check+1 || reset) { if (now > last_init_check+1 || reset) {
last_init_check = now; last_init_check = now;

@ -207,6 +207,8 @@ int check_xrandr_event(char *msg) {
" caller...\n"); " caller...\n");
return do_change; return do_change;
} }
#else
xev.type = 0;
#endif #endif
return 0; return 0;
} }

@ -84,7 +84,7 @@ int trap_record_xerror(Display *d, XErrorEvent *error) {
static void xrecord_grabserver(int start) { static void xrecord_grabserver(int start) {
XErrorHandler old_handler = NULL; XErrorHandler old_handler = NULL;
int rc; int rc = 0;
if (debug_grabs) { if (debug_grabs) {
fprintf(stderr, "xrecord_grabserver%d/%d %.5f\n", fprintf(stderr, "xrecord_grabserver%d/%d %.5f\n",
@ -136,6 +136,8 @@ static void xrecord_grabserver(int start) {
} }
XSetErrorHandler(old_handler); XSetErrorHandler(old_handler);
XFlush_wr(gdpy_data); XFlush_wr(gdpy_data);
#else
if (!rc || !old_handler) {}
#endif #endif
if (debug_grabs) { if (debug_grabs) {
fprintf(stderr, "xrecord_grabserver-done: %.5f\n", dnowx()); fprintf(stderr, "xrecord_grabserver-done: %.5f\n", dnowx());
@ -1299,9 +1301,9 @@ static void record_grab(XPointer ptr, XRecordInterceptData *rec_data) {
#endif #endif
static void check_xrecord_grabserver(void) { static void check_xrecord_grabserver(void) {
#if LIBVNCSERVER_HAVE_RECORD
int last_val, cnt = 0, i, max = 10; int last_val, cnt = 0, i, max = 10;
double d; double d;
#if LIBVNCSERVER_HAVE_RECORD
if (!gdpy_ctrl || !gdpy_data) { if (!gdpy_ctrl || !gdpy_data) {
return; return;
} }
@ -1415,7 +1417,7 @@ void check_xrecord_reset(int force) {
static double last_reset = 0.0; static double last_reset = 0.0;
int reset_time = 60, require_idle = 10; int reset_time = 60, require_idle = 10;
int reset_time2 = 600, require_idle2 = 40; int reset_time2 = 600, require_idle2 = 40;
double now; double now = 0.0;
XErrorHandler old_handler = NULL; XErrorHandler old_handler = NULL;
if (gdpy_ctrl) { if (gdpy_ctrl) {
@ -1486,6 +1488,8 @@ void check_xrecord_reset(int force) {
X_UNLOCK; X_UNLOCK;
last_reset = now; last_reset = now;
#else
if (!old_handler || now == 0.0 || !last_reset || !force) {}
#endif #endif
} }
@ -1500,15 +1504,18 @@ void check_xrecord_reset(int force) {
} }
void xrecord_watch(int start, int setby) { void xrecord_watch(int start, int setby) {
#if LIBVNCSERVER_HAVE_RECORD
Window focus, wm, c, clast; Window focus, wm, c, clast;
static double create_time = 0.0; static double create_time = 0.0;
double now; int rc;
static double last_error = 0.0;
int rc, db = debug_scroll;
int do_shutdown = 0; int do_shutdown = 0;
int reopen_dpys = 1; int reopen_dpys = 1;
XErrorHandler old_handler = NULL; XErrorHandler old_handler = NULL;
static Window last_win = None, last_result = None; static Window last_win = None, last_result = None;
#endif
int db = debug_scroll;
double now;
static double last_error = 0.0;
if (0) db = 1; if (0) db = 1;

@ -117,6 +117,7 @@ int guess_bits_per_color(int bits_per_pixel) {
int XFlush_wr(Display *disp) { int XFlush_wr(Display *disp) {
#if NO_X11 #if NO_X11
if (!disp) {}
return 1; return 1;
#else #else
if (disp) { if (disp) {
@ -157,6 +158,7 @@ Status XShmGetImage_wr(Display *disp, Drawable d, XImage *image, int x, int y,
#if LIBVNCSERVER_HAVE_XSHM #if LIBVNCSERVER_HAVE_XSHM
return XShmGetImage(disp, d, image, x, y, mask); return XShmGetImage(disp, d, image, x, y, mask);
#else #else
if (!disp || !d || !image || !x || !y || !mask) {}
return (Status) 0; return (Status) 0;
#endif #endif
} }
@ -169,6 +171,7 @@ XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth,
return XShmCreateImage(disp, vis, depth, format, data, shminfo, return XShmCreateImage(disp, vis, depth, format, data, shminfo,
width, height); width, height);
#else #else
if (!disp || !vis || !depth || !format || !data || !shminfo || !width || !height) {}
return (XImage *) 0; return (XImage *) 0;
#endif #endif
} }
@ -177,6 +180,7 @@ Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) {
#if LIBVNCSERVER_HAVE_XSHM #if LIBVNCSERVER_HAVE_XSHM
return XShmAttach(disp, shminfo); return XShmAttach(disp, shminfo);
#else #else
if (!disp || !shminfo) {}
return (Status) 0; return (Status) 0;
#endif #endif
} }
@ -185,6 +189,7 @@ Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) {
#if LIBVNCSERVER_HAVE_XSHM #if LIBVNCSERVER_HAVE_XSHM
return XShmDetach(disp, shminfo); return XShmDetach(disp, shminfo);
#else #else
if (!disp || !shminfo) {}
return (Status) 0; return (Status) 0;
#endif #endif
} }
@ -193,6 +198,7 @@ Bool XShmQueryExtension_wr(Display *disp) {
#if LIBVNCSERVER_HAVE_XSHM #if LIBVNCSERVER_HAVE_XSHM
return XShmQueryExtension(disp); return XShmQueryExtension(disp);
#else #else
if (!disp) {}
return False; return False;
#endif #endif
} }
@ -202,6 +208,7 @@ Bool XShmQueryExtension_wr(Display *disp) {
XImage *xreadscreen(Display *disp, Drawable d, int x, int y, XImage *xreadscreen(Display *disp, Drawable d, int x, int y,
unsigned int width, unsigned int height, Bool show_cursor) { unsigned int width, unsigned int height, Bool show_cursor) {
#if NO_X11 #if NO_X11
if (!disp || !d || !x || !y || !width || !height || !show_cursor) {}
return NULL; return NULL;
#else #else
@ -231,6 +238,7 @@ XImage *XGetSubImage_wr(Display *disp, Drawable d, int x, int y,
int format, XImage *dest_image, int dest_x, int dest_y) { int format, XImage *dest_image, int dest_x, int dest_y) {
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!disp || !d || !x || !y || !width || !height || !plane_mask || !format || !dest_image || !dest_x || !dest_y) {}
return NULL; return NULL;
#else #else
ADJUST_ROOTSHIFT ADJUST_ROOTSHIFT
@ -264,6 +272,7 @@ XImage *XGetImage_wr(Display *disp, Drawable d, int x, int y,
unsigned int width, unsigned int height, unsigned long plane_mask, unsigned int width, unsigned int height, unsigned long plane_mask,
int format) { int format) {
#if NO_X11 #if NO_X11
if (!disp || !d || !x || !y || !width || !height || !plane_mask || !format) {}
nox11_exit(1); nox11_exit(1);
return NULL; return NULL;
#else #else
@ -309,6 +318,7 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth,
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!disp || !visual || !depth || !format || !offset || !data || !width || !height || !width || !bitmap_pad || !bytes_per_line) {}
return NULL; return NULL;
#else #else
if (overlay) { if (overlay) {
@ -589,6 +599,7 @@ void init_track_keycode_state(void) {
static void upup_downdown_warning(KeyCode key, Bool down) { static void upup_downdown_warning(KeyCode key, Bool down) {
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11 #if NO_X11
if (!key || !down) {}
return; return;
#else #else
if ((down ? 1:0) == keycode_state[(int) key]) { if ((down ? 1:0) == keycode_state[(int) key]) {
@ -610,6 +621,7 @@ void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!dpy || !key || !down || !delay) {}
return; return;
#else #else
@ -642,6 +654,7 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!dpy || !key || !down || !delay || !first) {}
return; return;
#else #else
if (debug_keyboard) { if (debug_keyboard) {
@ -699,6 +712,7 @@ void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!dpy || !button || !is_press || !delay) {}
return; return;
#else #else
@ -725,6 +739,7 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!dpy || !button || !is_press || !delay) {}
return; return;
#else #else
@ -764,6 +779,7 @@ void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!dpy || !screen || !x || !y || !delay) {}
return; return;
#else #else
if (! xtrap_present) { if (! xtrap_present) {
@ -788,6 +804,7 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
RAWFB_RET_VOID RAWFB_RET_VOID
#if NO_X11 #if NO_X11
nox11_exit(1); nox11_exit(1);
if (!dpy || !screen || !x || !y || !delay) {}
return; return;
#else #else
@ -825,6 +842,7 @@ Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) {
#if LIBVNCSERVER_HAVE_XTEST #if LIBVNCSERVER_HAVE_XTEST
return XTestCompareCurrentCursorWithWindow(dpy, w); return XTestCompareCurrentCursorWithWindow(dpy, w);
#else #else
if (!w) {}
return False; return False;
#endif #endif
} }
@ -837,6 +855,7 @@ Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor) {
#if LIBVNCSERVER_HAVE_XTEST #if LIBVNCSERVER_HAVE_XTEST
return XTestCompareCursorWithWindow(dpy, w, cursor); return XTestCompareCursorWithWindow(dpy, w, cursor);
#else #else
if (!dpy || !w || !cursor) {}
return False; return False;
#endif #endif
} }
@ -847,6 +866,7 @@ Bool XTestQueryExtension_wr(Display *dpy, int *ev, int *er, int *maj,
#if LIBVNCSERVER_HAVE_XTEST #if LIBVNCSERVER_HAVE_XTEST
return XTestQueryExtension(dpy, ev, er, maj, min); return XTestQueryExtension(dpy, ev, er, maj, min);
#else #else
if (!dpy || !ev || !er || !maj || !min) {}
return False; return False;
#endif #endif
} }
@ -858,6 +878,8 @@ void XTestDiscard_wr(Display *dpy) {
RAWFB_RET_VOID RAWFB_RET_VOID
#if LIBVNCSERVER_HAVE_XTEST #if LIBVNCSERVER_HAVE_XTEST
XTestDiscard(dpy); XTestDiscard(dpy);
#else
if (!dpy) {}
#endif #endif
} }
@ -882,6 +904,7 @@ int XTestGrabControl_wr(Display *dpy, Bool impervious) {
XTestGrabControl(dpy, impervious); XTestGrabControl(dpy, impervious);
return 1; return 1;
#else #else
if (!dpy || !impervious) {}
return 0; return 0;
#endif #endif
} }
@ -991,6 +1014,7 @@ Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min) {
#if LIBVNCSERVER_HAVE_RECORD #if LIBVNCSERVER_HAVE_RECORD
return XRecordQueryVersion(dpy, maj, min); return XRecordQueryVersion(dpy, maj, min);
#else #else
if (!dpy || !maj || !min) {}
return False; return False;
#endif #endif
} }
@ -1045,7 +1069,7 @@ int xauth_raw(int on) {
} }
Display *XOpenDisplay_wr(char *display_name) { Display *XOpenDisplay_wr(char *display_name) {
Display *d; Display *d = NULL;
int db = 0; int db = 0;
if (! xauth_raw(1)) { if (! xauth_raw(1)) {
@ -1053,6 +1077,7 @@ Display *XOpenDisplay_wr(char *display_name) {
} }
#if NO_X11 #if NO_X11
rfbLog("This x11vnc was built without X11 support (-rawfb only).\n"); rfbLog("This x11vnc was built without X11 support (-rawfb only).\n");
if (!display_name || !d || !db) {}
return NULL; return NULL;
#else #else
@ -1086,12 +1111,13 @@ static int last_local_y = 0;
Bool XQueryPointer_wr(Display *display, Window w, Window *root_return, Bool XQueryPointer_wr(Display *display, Window w, Window *root_return,
Window *child_return, int *root_x_return, int *root_y_return, Window *child_return, int *root_x_return, int *root_y_return,
int *win_x_return, int *win_y_return, unsigned int *mask_return) { int *win_x_return, int *win_y_return, unsigned int *mask_return) {
Bool rc;
XErrorHandler old_handler;
#if NO_X11 #if NO_X11
if (!display || !w || !root_return || !child_return || !root_x_return || !root_y_return || !win_x_return || !win_y_return || !mask_return) {}
return False; return False;
#else #else
Bool rc;
XErrorHandler old_handler;
if (! display) { if (! display) {
return False; return False;
@ -1137,6 +1163,7 @@ Status XQueryTree_wr(Display *display, Window w, Window *root_return,
} }
#endif #endif
#if NO_X11 #if NO_X11
if (!display || !w || !root_return || !parent_return || !children_return || !nchildren_return) {}
return (Status) 0; return (Status) 0;
#else #else
if (! display) { if (! display) {
@ -1164,6 +1191,7 @@ int XFree_wr(void *data) {
int XSelectInput_wr(Display *display, Window w, long event_mask) { int XSelectInput_wr(Display *display, Window w, long event_mask) {
#if NO_X11 #if NO_X11
if (!display || !w || !event_mask) {}
return 0; return 0;
#else #else
int rc; int rc;

Loading…
Cancel
Save