summaryrefslogtreecommitdiffstats
path: root/x11vnc
diff options
context:
space:
mode:
Diffstat (limited to 'x11vnc')
-rw-r--r--x11vnc/8to24.c43
-rw-r--r--x11vnc/README2
-rw-r--r--x11vnc/connections.c31
-rw-r--r--x11vnc/cursor.c12
-rw-r--r--x11vnc/gui.c23
-rw-r--r--x11vnc/keyboard.c79
-rw-r--r--x11vnc/macosx.c5
-rw-r--r--x11vnc/macosx.h1
-rw-r--r--x11vnc/macosxCG.c28
-rw-r--r--x11vnc/macosxCGS.c4
-rw-r--r--x11vnc/misc/enhanced_tightvnc_viewer/README11
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd2
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl84
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle2
-rw-r--r--x11vnc/nox11_funcs.h2
-rw-r--r--x11vnc/pointer.c35
-rw-r--r--x11vnc/remote.c4
-rw-r--r--x11vnc/scan.c4
-rw-r--r--x11vnc/screen.c31
-rw-r--r--x11vnc/selection.c24
-rw-r--r--x11vnc/solid.c39
-rw-r--r--x11vnc/userinput.c9
-rw-r--r--x11vnc/util.c2
-rw-r--r--x11vnc/win_utils.c35
-rw-r--r--x11vnc/xevents.c43
-rw-r--r--x11vnc/xrandr.c2
-rw-r--r--x11vnc/xrecord.c19
-rw-r--r--x11vnc/xwrappers.c36
28 files changed, 424 insertions, 188 deletions
diff --git a/x11vnc/8to24.c b/x11vnc/8to24.c
index 1d071a8..a25cbf4 100644
--- a/x11vnc/8to24.c
+++ b/x11vnc/8to24.c
@@ -65,6 +65,9 @@ static Colormap root_cmap = 0;
static unsigned int root_rgb[NCOLOR];
static void set_root_cmap(void) {
+#if NO_X11
+ return;
+#else
static time_t last_set = 0;
time_t now = time(NULL);
XWindowAttributes attr;
@@ -72,9 +75,6 @@ static void set_root_cmap(void) {
int redo = 0;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (now > last_set + 10) {
redo = 1;
@@ -244,6 +244,9 @@ int MV_hit;
double MV_start;
void check_for_multivis(void) {
+#if NO_X11
+ return;
+#else
XWindowAttributes attr;
int doall = 0;
int k, i, cnt, diff;
@@ -261,9 +264,6 @@ void check_for_multivis(void) {
double delay;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (now > last_parse + 1.0) {
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) {
- RAWFB_RET(NULL)
#if NO_X11
+ if (!xi || !visual || !win_depth || !w) {}
return NULL;
#else
+ RAWFB_RET(NULL)
if (xi == NULL || *w < dpy_x) {
char *d;
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) {
+#if NO_X11
+ if (!x1 || !x2 || !y1 || !n || !mod) {}
+ return 1;
+#else
int fac, n_off, w, xo, yo;
char *poll_fb, *dst, *src;
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)
-#if NO_X11
- return 1;
-#else
if (win == None) {
return 1;
}
@@ -1292,13 +1294,14 @@ static int cmap_failed[CMAPMAX];
int histo[256];
static int get_cmap(int j, Colormap cmap) {
+#if NO_X11
+ if (!j || !cmap) {}
+ return 0;
+#else
int i, ncells;
XErrorHandler old_handler = NULL;
RAWFB_RET(0)
-#if NO_X11
- return 0;
-#else
if (0) {
/* 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) {
- XWindowAttributes attr;
- char *d;
-
#if NO_X11
+ if (!xi || !win || !win_depth) {}
return NULL;
#else
+ XWindowAttributes attr;
+ char *d;
+
if (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) {
+#if NO_X11
+ if (!rect.x1 || !win || !win_depth || !cm) {}
+ return;
+#else
char *src, *dst, *poll;
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);
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
attr.width = 0;
attr.height = 0;
diff --git a/x11vnc/README b/x11vnc/README
index a9864f3..e6569a0 100644
--- a/x11vnc/README
+++ b/x11vnc/README
@@ -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:
diff --git a/x11vnc/connections.c b/x11vnc/connections.c
index 343f11f..71d4487 100644
--- a/x11vnc/connections.c
+++ b/x11vnc/connections.c
@@ -908,6 +908,12 @@ static int check_access(char *addr) {
*/
static int ugly_window(char *addr, char *userhost, int X, int Y,
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_height 16
@@ -961,10 +967,6 @@ static unsigned char t2x2_bits[] = {
KeyCode key_o;
RAWFB_RET(0)
-#if NO_X11
- nox11_exit(1);
- return 0;
-#else
if (! accept) {
sprintf(str_y, "OK");
@@ -1740,6 +1742,8 @@ void set_vnc_connect_prop(char *str) {
#if !NO_X11
XChangeProperty(dpy, rootwin, vnc_connect_prop, XA_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str));
+#else
+ if (!str) {}
#endif /* NO_X11 */
}
@@ -1748,10 +1752,17 @@ void set_x11vnc_remote_prop(char *str) {
#if !NO_X11
XChangeProperty(dpy, rootwin, x11vnc_remote_prop, XA_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str));
+#else
+ if (!str) {}
#endif /* NO_X11 */
}
void read_vnc_connect_prop(int nomsg) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!nomsg) {}
+ return;
+#else
Atom type;
int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0;
@@ -1766,9 +1777,6 @@ void read_vnc_connect_prop(int nomsg) {
return;
}
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
/* read the property value into vnc_connect_str: */
do {
@@ -1802,6 +1810,11 @@ void read_vnc_connect_prop(int nomsg) {
}
void read_x11vnc_remote_prop(int nomsg) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!nomsg) {}
+ return;
+#else
Atom type;
int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0;
@@ -1816,9 +1829,6 @@ void read_x11vnc_remote_prop(int nomsg) {
return;
}
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
/* read the property value into x11vnc_remote_str: */
do {
@@ -2293,6 +2303,7 @@ void send_client_info(char *str) {
void adjust_grabs(int grab, int quiet) {
RAWFB_RET_VOID
#if NO_X11
+ if (!grab || !quiet) {}
return;
#else
/* n.b. caller decides to X_LOCK or not. */
diff --git a/x11vnc/cursor.c b/x11vnc/cursor.c
index 54ac152..da7e93c 100644
--- a/x11vnc/cursor.c
+++ b/x11vnc/cursor.c
@@ -837,6 +837,11 @@ void setup_cursors_and_push(void) {
*
*/
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;
int i, rx, ry, wx, wy;
unsigned int mask;
@@ -848,9 +853,6 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) {
XErrorHandler old_handler;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
X_LOCK;
@@ -1540,6 +1542,8 @@ int get_which_cursor(void) {
XSetErrorHandler(old_handler);
X_UNLOCK;
trapped_xerror = 0;
+#else
+ if (!r || !d || !bw || !h || !w || !y || !x || !ratio || !old_handler) {}
#endif /* NO_X11 */
}
if (which == which0) {
@@ -1895,6 +1899,8 @@ int check_x11_pointer(void) {
&win_x, &win_y, &mask);
X_UNLOCK;
}
+#else
+ if (!mask || !win_y || !win_x || !child_w || !root_w) {}
#endif /* NO_X11 */
if (0) fprintf(stderr, "check_x11_pointer %d %d\n", root_x, root_y);
diff --git a/x11vnc/gui.c b/x11vnc/gui.c
index 28f4109..d6c9fd6 100644
--- a/x11vnc/gui.c
+++ b/x11vnc/gui.c
@@ -43,12 +43,13 @@ char *get_gui_code(void) {
}
static Window tweak_tk_window_id(Window win) {
- char *name = NULL;
- Window parent, new;
-
#if NO_X11
+ if (!win) {}
return None;
#else
+ char *name = NULL;
+ Window parent, new;
+
/* hack for tk, does not report outermost window */
new = win;
parent = parent_window(win, &name);
@@ -67,6 +68,11 @@ static Window tweak_tk_window_id(Window win) {
}
int tray_embed(Window iconwin, int remove) {
+#if NO_X11
+ RAWFB_RET(0)
+ if (!iconwin || !remove) {}
+ return 0;
+#else
XEvent ev;
XErrorHandler old_handler;
Window manager;
@@ -77,9 +83,6 @@ int tray_embed(Window iconwin, int remove) {
long data = 0;
RAWFB_RET(0)
-#if NO_X11
- return 0;
-#else
if (remove) {
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) {
+#if NO_X11
+ RAWFB_RET(0)
+ if (!d || !manager) {}
+ return 0;
+#else
char tray_string[100];
Atom tray_manager;
Window tray_win;
RAWFB_RET(0)
-#if NO_X11
- return 0;
-#else
if (manager) {
*manager = None;
diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c
index a13a1b0..29aa9f4 100644
--- a/x11vnc/keyboard.c
+++ b/x11vnc/keyboard.c
@@ -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.
*/
void get_keystate(int *keystate) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!keystate) {}
+ return;
+#else
int i, k;
char keys[32];
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
/* n.b. caller decides to X_LOCK or not. */
XQueryKeymap(dpy, keys);
@@ -85,6 +87,11 @@ void get_keystate(int *keystate) {
* Try to KeyRelease any non-Lock modifiers that are down.
*/
void clear_modifiers(int init) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!init) {}
+ return;
+#else
static KeyCode keycodes[256];
static KeySym keysyms[256];
static char *keystrs[256];
@@ -96,9 +103,6 @@ void clear_modifiers(int init) {
KeyCode keycode;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
/* n.b. caller decides to X_LOCK or not. */
if (first) {
@@ -258,12 +262,13 @@ void clear_keys(void) {
static int save_auto_repeat = -1;
int get_autorepeat_state(void) {
- XKeyboardState kstate;
-
- RAWFB_RET(0)
#if NO_X11
+ RAWFB_RET(0)
return 0;
#else
+ XKeyboardState kstate;
+
+ RAWFB_RET(0)
X_LOCK;
XGetKeyboardControl(dpy, &kstate);
@@ -280,13 +285,15 @@ int get_initial_autorepeat_state(void) {
}
void autorepeat(int restore, int bequiet) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!restore || !bequiet) {}
+ return;
+#else
int global_auto_repeat;
XKeyboardControl kctrl;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (restore) {
if (save_auto_repeat < 0) {
@@ -372,9 +379,21 @@ static int alltime_len = 1024;
static int alltime_num = 0;
int add_keysym(KeySym keysym) {
- int minkey, maxkey, syms_per_keycode;
- int kc, n, ret = 0;
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;
if (first) {
@@ -385,9 +404,6 @@ int add_keysym(KeySym keysym) {
}
RAWFB_RET(0)
-#if NO_X11
- return 0;
-#else
if (keysym == NoSymbol) {
return 0;
@@ -465,15 +481,17 @@ int add_keysym(KeySym keysym) {
}
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;
KeySym *keymap;
KeySym ksym, new[8];
char *str;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
XDisplayKeycodes(dpy, &minkey, &maxkey);
keymap = XGetKeyboardMapping(dpy, minkey, (maxkey - minkey + 1),
@@ -659,6 +677,8 @@ static void add_dead_keysyms(char *str) {
}
}
}
+#else
+ if ((ksym2 = 0)) {}
#endif
if (! inmap) {
add_remap(p);
@@ -798,6 +818,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
RAWFB_RET(0)
#if NO_X11
+ if (!key || !down || !keysym || !new) {}
return 0;
#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 xkb_tweak_keyboard(rfbBool down, rfbKeySym keysym,
rfbClientPtr client) {
+ if (!client || !down || !keysym) {} /* unused vars warning: */
}
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 KeySym Ks_last_down = NoSymbol;
- if (client) {} /* unused vars warning: */
+ if (!client || !down || !keysym) {} /* unused vars warning: */
RAWFB_RET_VOID
@@ -2207,6 +2229,10 @@ rfbLog("allowed_input_view_only: %s\n", allowed_input_view_only);
}
void initialize_modtweak(void) {
+#if NO_X11
+ RAWFB_RET_VOID
+ return;
+#else
KeySym keysym, *keymap;
int i, j, minkey, maxkey, syms_per_keycode;
@@ -2220,9 +2246,6 @@ void initialize_modtweak(void) {
}
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
X_LOCK;
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,
rfbClientPtr client) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!down || !keysym || !client) {}
+ return;
+#else
KeyCode k;
int tweak = 0;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (use_xkb_modtweak) {
xkb_tweak_keyboard(down, keysym, client);
diff --git a/x11vnc/macosx.c b/x11vnc/macosx.c
index 59aa92e..450cf50 100644
--- a/x11vnc/macosx.c
+++ b/x11vnc/macosx.c
@@ -24,6 +24,7 @@
#include "macosxCGP.h"
#include "macosxCGS.h"
+void macosx_log(char *);
char *macosx_console_guess(char *str, int *fd);
void macosx_key_command(rfbBool down, rfbKeySym keysym, 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);
int macosx_checkevent(XEvent *ev);
+void macosx_log(char *str) {
+ rfbLog(str);
+}
+
#if (! DOMAC)
void macosx_event_loop(void) {
diff --git a/x11vnc/macosx.h b/x11vnc/macosx.h
index 907c723..db96e83 100644
--- a/x11vnc/macosx.h
+++ b/x11vnc/macosx.h
@@ -3,6 +3,7 @@
/* -- macosx.h -- */
+extern void macosx_log(char *);
extern char *macosx_console_guess(char *str, int *fd);
extern char *macosx_get_fb_addr(void);
extern void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client);
diff --git a/x11vnc/macosxCG.c b/x11vnc/macosxCG.c
index 086451a..6e56e9f 100644
--- a/x11vnc/macosxCG.c
+++ b/x11vnc/macosxCG.c
@@ -34,6 +34,7 @@ void macosxCG_key_inject(int down, unsigned int keysym);
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);
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 (1) fprintf(stderr, "macosxCG_callback: register\n");
+ if (1) macosx_log("macosxCG_callback: register\n");
CGRegisterScreenRefreshCallback(macosxCG_callback, NULL);
}
callback_set = 1;
@@ -84,7 +85,7 @@ void macosxCG_refresh_callback_on(void) {
void macosxCG_refresh_callback_off(void) {
if (callback_set) {
- if (1) fprintf(stderr, "macosxCG_callback: unregister\n");
+ if (1) macosx_log("macosxCG_callback: unregister\n");
CGUnregisterScreenRefreshCallback(macosxCG_callback, NULL);
}
callback_set = 0;
@@ -100,7 +101,7 @@ extern void macosxCGP_screensaver_timer_on(void);
void macosxCG_init(void) {
if (displayID == NULL) {
- fprintf(stderr, "macosxCG_init: initializing display.\n");
+ macosx_log("macosxCG_init: initializing display.\n");
#if 0
dragum();
#endif
@@ -140,6 +141,7 @@ extern int macosx_wait_for_switch, macosx_resize;
extern void macosxGCS_poll_pb(void);
extern void usleep(unsigned long usec);
extern unsigned int sleep(unsigned int seconds);
+extern void clean_up_exit (int ret);
void macosxCG_event_loop(void) {
OSStatus rc;
@@ -177,14 +179,14 @@ void macosxCG_event_loop(void) {
}
}
if ((cnt++ % 120) == 0) {
- fprintf(stderr, "waiting for user to "
+ macosx_log("waiting for user to "
"switch back..\n");
}
sleep(1);
}
if (wdpy_x == (int) CGDisplayPixelsWide(displayID)) {
if (wdpy_y == (int) CGDisplayPixelsHigh(displayID)) {
- fprintf(stderr, "we're back...\n");
+ macosx_log("we're back...\n");
return;
}
}
@@ -247,11 +249,14 @@ static CGPoint current_cursor_pos(void) {
pos.y = 0;
if (! conn) {
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) {
- fprintf(stderr, "CGSGetCurrentCursorLocation error\n");
+ macosx_log("CGSGetCurrentCursorLocation error\n");
}
display_button_mask = GetCurrentButtonState();
@@ -304,7 +309,10 @@ int macosxCG_get_cursor(void) {
if (! conn) {
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;
}
}
@@ -319,7 +327,7 @@ int macosxCG_get_cursor(void) {
last_fetch = now;
if (CGSGetGlobalCursorDataSize(conn, &datasize) != kCGErrorSuccess) {
- fprintf(stderr, "CGSGetGlobalCursorDataSize error\n");
+ macosx_log("CGSGetGlobalCursorDataSize error\n");
return which;
}
@@ -328,7 +336,7 @@ int macosxCG_get_cursor(void) {
err = CGSGetGlobalCursorData(conn, data, &datasize, &row_bytes,
&rect, &hot, &cdepth, &comps, &bpcomp);
if (err != kCGErrorSuccess) {
- fprintf(stderr, "CGSGetGlobalCursorData error\n");
+ macosx_log("CGSGetGlobalCursorData error\n");
return which;
}
diff --git a/x11vnc/macosxCGS.c b/x11vnc/macosxCGS.c
index b492ef6..3f6c05c 100644
--- a/x11vnc/macosxCGS.c
+++ b/x11vnc/macosxCGS.c
@@ -53,6 +53,8 @@ extern OSStatus CGSOrderWindow(const CGSConnectionID cid,
static CGSConnectionID cid = NULL;
+extern void macosx_log(char *);
+
int macwinmax = 0;
typedef struct windat {
int win;
@@ -493,7 +495,7 @@ void macosxGCS_initpb(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
pblock = [[NSLock alloc] init];
if (![NSPasteboard generalPasteboard]) {
- fprintf(stderr, "macosxGCS_initpb: pasteboard inaccessible.\n");
+ macosx_log("macosxGCS_initpb: pasteboard inaccessible.\n");
pbcnt = 0;
pbstr = [[NSString alloc] initWithString:@"\e<PASTEBOARD INACCESSIBLE>\e"];
}
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/README b/x11vnc/misc/enhanced_tightvnc_viewer/README
index ede14d7..f15dbda 100644
--- a/x11vnc/misc/enhanced_tightvnc_viewer/README
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/README
@@ -118,7 +118,7 @@ Unix and Mac OS X:
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:
@@ -126,15 +126,18 @@ Unix and 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.
+
Windows:
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.:
@@ -146,7 +149,7 @@ Windows:
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.
You can make a Windows shortcut to this program if you want to.
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd b/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd
index 6bc7303..3c7158f 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd
@@ -104,7 +104,7 @@ use_ours=0
if [ "X$VNCVIEWERCMD" = "X" ]; then
VNCVIEWERCMD="vncviewer"
export VNCVIEWERCMD
- if [ "X$DARWIN_COTVNC" != "X" ]; then
+ if [ "X$DARWIN_COTVNC" = "X" ]; then
use_ours=1
fi
fi
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
index d3a905c..4ff7b1a 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
@@ -64,6 +64,16 @@ proc scroll_text_dismiss {fr {w 80} {h 35}} {
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 {} {
catch {destroy .h}
toplevel .h
@@ -104,6 +114,15 @@ proc help {} {
need to terminate STUNNEL manually from the System Tray (right click
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:
@@ -232,6 +251,7 @@ proc help {} {
}
.h.f.t insert end $msg
+ jiggle_text .h.f.t
}
proc help_certs {} {
@@ -316,6 +336,7 @@ proc help_certs {} {
}
.ch.f.t insert end $msg
+ jiggle_text .ch.f.t
}
proc help_opts {} {
@@ -450,6 +471,7 @@ set msg {
Advanced: Bring up the Advanced Options dialog.
}
.oh.f.t insert end $msg
+ jiggle_text .oh.f.t
}
proc win_nokill_msg {} {
@@ -688,6 +710,9 @@ proc set_defaults {} {
set $var $defs($var)
}
+ global vncauth_passwd
+ set vncauth_passwd ""
+
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 {fi}
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 { echo termpid-find-fail: termpid=$termpid mypid=$$}
puts $fh {fi}
@@ -1916,6 +1945,7 @@ proc direct_connect_msg {} {
proc launch_unix {hp} {
global smb_redir_0 smb_mounts env
+ global vncauth_passwd
globalize
@@ -2118,6 +2148,19 @@ proc launch_unix {hp} {
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 {$darwin_cotvnc} {
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 &}
}
}
+ if {$passwdfile != ""} {
+ catch {file delete $passwdfile}
+ }
wm deiconify .
mesg "Disconnected from $hp"
if {[regexp {FINISH} $port_knocking_list]} {
@@ -5746,6 +5792,7 @@ proc help_advanced_opts {} {
}
.ah.f.t insert end $msg
+ jiggle_text .ah.f.t
}
proc set_viewer_path {} {
@@ -6885,6 +6932,7 @@ set skip_pre 0
set vncdisplay ""
set vncproxy ""
set remote_ssh_cmd ""
+set vncauth_passwd ""
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
frame .f1
-label .f1.l -width $wl -anchor w -text "Proxy/Gateway:" -relief ridge
-entry .f1.e -width $we -textvariable vncproxy
+label .f1.l -width $wl -anchor w -text "VNC Password:" -relief ridge
+entry .f1.e -width $we -textvariable vncauth_passwd -show *
pack .f1.l -side left
pack .f1.e -side left -expand 1 -fill x
frame .f2
-label .f2.l -width $wl -anchor w -text "Remote SSH Command:" -relief ridge
-entry .f2.e -width $we -textvariable remote_ssh_cmd
+label .f2.l -width $wl -anchor w -text "Proxy/Gateway:" -relief ridge
+entry .f2.e -width $we -textvariable vncproxy
pack .f2.l -side left
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
-radiobutton .f3.ssl -anchor w -variable sshssl_sw -value ssl -command {ssl_ssh_adjust ssl} -text "Use SSL"
-radiobutton .f3.ssh -anchor w -variable sshssl_sw -value ssh -command {ssl_ssh_adjust ssh} -text "Use SSH"
-radiobutton .f3.sshssl -anchor w -variable sshssl_sw -value sshssl -command {ssl_ssh_adjust sshssl} -text "Use SSH and SSL"
-pack .f3.ssl .f3.ssh .f3.sshssl -side left -fill x
+label .f3.l -width $wl -anchor w -text "Remote SSH Command:" -relief ridge
+entry .f3.e -width $we -textvariable remote_ssh_cmd
+pack .f3.l -side left
+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
@@ -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
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 {
pack .l .f0 .b -side top -fill x
}
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle
index 54010b1..de111a5 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle
@@ -1,7 +1,7 @@
#!/bin/sh
rm -rf ./src/tmp/* || exit 1
-vers=1.0.8
+vers=1.0.9
cd .. || exit 1
diff --git a/x11vnc/nox11_funcs.h b/x11vnc/nox11_funcs.h
index e127309..6e3ac57 100644
--- a/x11vnc/nox11_funcs.h
+++ b/x11vnc/nox11_funcs.h
@@ -2807,10 +2807,12 @@ char *XKeysymToString(KeySym k) {
}
KeySym XKeycodeToKeysym(Display *display, KeyCode keycode, int index) {
+ if (!display || !keycode || !index) {}
return NoSymbol;
}
KeyCode XKeysymToKeycode(Display *display, KeySym keysym) {
+ if (!display || !keysym) {}
return NoSymbol;
}
diff --git a/x11vnc/pointer.c b/x11vnc/pointer.c
index d550160..617da83 100644
--- a/x11vnc/pointer.c
+++ b/x11vnc/pointer.c
@@ -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:"
*/
static void buttonparse(int from, char **s) {
+#if NO_X11
+ if (!from || !s) {}
+ return;
+#else
char *q;
int to, i;
int modisdown[256];
-#if NO_X11
- return;
-#else
q = *s;
for (i=0; i<256; i++) {
@@ -214,6 +215,10 @@ static void buttonparse(int from, char **s) {
* process the -buttonmap string
*/
void initialize_pointer_map(char *pointer_remap) {
+#if NO_X11
+ if (!pointer_remap) {}
+ return;
+#else
unsigned char map[MAX_BUTTONS];
int i, k;
/*
@@ -223,9 +228,6 @@ void initialize_pointer_map(char *pointer_remap) {
* from -buttonmap option.
*/
-#if NO_X11
- return;
-#else
if (!raw_fb_str) {
X_LOCK;
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.
*/
static void update_x11_pointer_position(int x, int y) {
- int rc;
-
- RAWFB_RET_VOID
#if NO_X11
+ RAWFB_RET_VOID
+ if (!x || !y) {}
return;
#else
+ int rc;
+
+ RAWFB_RET_VOID
X_LOCK;
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) {
- int mb, k, i = button-1;
-
#if NO_X11
+ if (!mask || !button) {}
return;
#else
+ int mb, k, i = button-1;
+
/*
* this expands to any pointer_map button -> keystrokes
* 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.
*/
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;
last_event = last_input = last_pointer_input = time(NULL);
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (mask != button_mask) {
last_pointer_click_time = dnow();
diff --git a/x11vnc/remote.c b/x11vnc/remote.c
index 03016d6..775816c 100644
--- a/x11vnc/remote.c
+++ b/x11vnc/remote.c
@@ -498,11 +498,11 @@ static void reset_rfbport(int old, int new) {
* libXau yet.
*/
int remote_control_access_ok(void) {
- struct stat sbuf;
-
#if NO_X11
return 0;
#else
+ struct stat sbuf;
+
if (client_connect_file) {
if (stat(client_connect_file, &sbuf) == 0) {
if (sbuf.st_mode & S_IWOTH) {
diff --git a/x11vnc/scan.c b/x11vnc/scan.c
index 61706d7..7ffc24f 100644
--- a/x11vnc/scan.c
+++ b/x11vnc/scan.c
@@ -347,6 +347,8 @@ void shm_delete(XShmSegmentInfo *shm) {
if (shm != NULL && shm->shmid != -1) {
shmctl(shm->shmid, IPC_RMID, 0);
}
+#else
+ if (!shm) {}
#endif
}
@@ -2866,7 +2868,6 @@ static int scan_display(int ystart, int rescan) {
#ifndef NO_NCACHE
/* XXX Y test */
if (ncache > 0) {
- XEvent ev;
int gotone = 0;
if (macosx_console) {
if (macosx_checkevent(NULL)) {
@@ -2874,6 +2875,7 @@ if (ncache > 0) {
}
} else {
#if !NO_X11
+ XEvent ev;
if (raw_fb_str) {
;
} else if (XCheckTypedEvent(dpy, MapNotify, &ev)) {
diff --git a/x11vnc/screen.c b/x11vnc/screen.c
index e627026..51705dc 100644
--- a/x11vnc/screen.c
+++ b/x11vnc/screen.c
@@ -141,6 +141,10 @@ if (0) fprintf(stderr, "unset_colormap: %s\n", raw_fb_pixfmt);
}
void set_colormap(int reset) {
+#if NO_X11
+ if (!reset) {}
+ return;
+#else
static int init = 1;
static XColor color[NCOLOR], prev[NCOLOR];
Colormap cmap;
@@ -171,9 +175,6 @@ if (0) fprintf(stderr, "unset_colormap: %d\n", reset);
}
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
X_LOCK;
@@ -338,14 +339,16 @@ static void debug_colormap(XImage *fb) {
* visual_id and possibly visual_depth are set.
*/
static void set_visual(char *str) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!str) {}
+ return;
+#else
int vis, vdepth, defdepth;
XVisualInfo vinfo;
char *p, *vstring = strdup(str);
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
defdepth = DefaultDepth(dpy, scr);
visual_id = (VisualID) 0;
@@ -1432,13 +1435,14 @@ static void initialize_clipshift(void) {
}
static int wait_until_mapped(Window win) {
+#if NO_X11
+ if (!win) {}
+ return 0;
+#else
int ms = 50, waittime = 30;
time_t start = time(NULL);
XWindowAttributes attr;
-#if NO_X11
- return 0;
-#else
while (1) {
if (! valid_window(win, NULL, 0)) {
if (time(NULL) > start + waittime) {
@@ -1463,6 +1467,9 @@ static int wait_until_mapped(Window win) {
* initialize a fb for the X display
*/
XImage *initialize_xdisplay_fb(void) {
+#if NO_X11
+ return NULL;
+#else
XImage *fb;
char *vis_str = visual_str;
int try = 0, subwin_tries = 3;
@@ -1472,9 +1479,6 @@ XImage *initialize_xdisplay_fb(void) {
if (raw_fb_str) {
return initialize_raw_fb(0);
}
-#if NO_X11
- return NULL;
-#else
X_LOCK;
if (subwin) {
@@ -2165,6 +2169,9 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
if (cmap8to24 && depth == 8 && dpy) {
XVisualInfo vinfo;
+ vinfo.red_mask = 0;
+ vinfo.green_mask = 0;
+ vinfo.blue_mask = 0;
/* more cooking up... */
have_masks = 2;
/* need to fetch TrueColor visual */
diff --git a/x11vnc/selection.c b/x11vnc/selection.c
index 0d183dc..0630aea 100644
--- a/x11vnc/selection.c
+++ b/x11vnc/selection.c
@@ -51,6 +51,11 @@ static char clipboard_str[PROP_MAX+1];
* n.b.: our caller already has the X_LOCK.
*/
void selection_request(XEvent *ev, char *type) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!ev || !type) {}
+ return;
+#else
XSelectionEvent notify_event;
XSelectionRequestEvent *req_event;
XErrorHandler old_handler;
@@ -61,9 +66,7 @@ void selection_request(XEvent *ev, char *type) {
unsigned long XA_LENGTH;
#endif
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
+
#ifndef XA_LENGTH
XA_LENGTH = XInternAtom(dpy, "LENGTH", True);
#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.
*/
void cutbuffer_send(void) {
+#if NO_X11
+ RAWFB_RET_VOID
+ return;
+#else
Atom type;
int format, slen, dlen, len;
unsigned long nitems = 0, bytes_after = 0;
@@ -189,9 +196,6 @@ void cutbuffer_send(void) {
slen = 0;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
/* read the property value into cutbuffer_str: */
do {
@@ -254,6 +258,11 @@ void cutbuffer_send(void) {
*/
#define CHKSZ 32
void selection_send(XEvent *ev) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!ev) {}
+ return;
+#else
Atom type;
int format, slen, dlen, oldlen, newlen, toobig = 0, len;
static int err = 0, sent_one = 0;
@@ -263,9 +272,6 @@ void selection_send(XEvent *ev) {
char *selection_str;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
/*
* remember info about our last value of PRIMARY (or CUT_BUFFER0)
* so we can check for any changes below.
diff --git a/x11vnc/solid.c b/x11vnc/solid.c
index a2bb3cf..be00264 100644
--- a/x11vnc/solid.c
+++ b/x11vnc/solid.c
@@ -114,6 +114,11 @@ static char *cmd_output(char *cmd) {
}
static void solid_root(char *color) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!color) {}
+ return;
+#else
Window expose;
static XImage *image = NULL;
Pixmap pixmap;
@@ -126,9 +131,6 @@ static void solid_root(char *color) {
Colormap cmap;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (subwin || window != rootwin) {
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) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!color) {}
+ return;
+#else
int wsmax = 16;
static XImage *image[16];
static Window ws_wins[16];
@@ -243,9 +250,6 @@ static void solid_cde(char *color) {
int n;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (subwin || window != rootwin) {
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) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!color) {}
+ return;
+#else
char get_color[] = "gconftool-2 --get "
"/desktop/gnome/background/primary_color";
char set_color[] = "gconftool-2 --set "
@@ -503,9 +512,6 @@ static void solid_gnome(char *color) {
char *cmd;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (! color) {
if (! orig_color) {
@@ -580,6 +586,11 @@ static void solid_gnome(char *color) {
}
static void solid_kde(char *color) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!color) {}
+ return;
+#else
char set_color[] =
"dcop --user '%s' kdesktop KBackgroundIface setColor '%s' 1";
char bg_off[] =
@@ -590,9 +601,6 @@ static void solid_kde(char *color) {
int len;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
user = get_user_name();
if (strstr(user, "'") != NULL) {
@@ -633,12 +641,13 @@ static void solid_kde(char *color) {
}
char *guess_desktop(void) {
- Atom prop;
-
- RAWFB_RET("root")
#if NO_X11
+ RAWFB_RET("root")
return "root";
#else
+ Atom prop;
+
+ RAWFB_RET("root")
if (wmdt_str && *wmdt_str != '\0') {
char *s = wmdt_str;
diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c
index e19ab8d..00b9dcf 100644
--- a/x11vnc/userinput.c
+++ b/x11vnc/userinput.c
@@ -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,
Window *frame, Window *win) {
+#if !NO_X11
Window r, c;
XWindowAttributes attr;
Bool ret;
int rootx, rooty, wx, wy;
unsigned int mask;
+#endif
#ifdef MACOSX
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)
#if NO_X11
+ if (!px || !py || !x || !y || !w || !h || !frame || !win) {}
return 0;
#else
@@ -336,6 +339,10 @@ static void parse_wireframe_str(char *wf) {
wireframe_shade = n;
ok = 1;
}
+#else
+ r = g = b = 0;
+ cmap = 0;
+ cdef.pixel = 0;
#endif
}
if (ok) {
@@ -7061,6 +7068,7 @@ void xselectinput(Window w, unsigned long evmask, int sync) {
#if NO_X11
trapped_xerror = 0;
trapped_xioerror = 0;
+ if (!evmask) {}
#else
XErrorHandler old_handler1;
XIOErrorHandler old_handler2;
@@ -7108,6 +7116,7 @@ Bool xcheckmaskevent(Display *d, long mask, XEvent *ev) {
RAWFB_RET(False);
#if NO_X11
+ if (!d || !mask) {}
return False;
#else
return XCheckMaskEvent(d, mask, ev);
diff --git a/x11vnc/util.c b/x11vnc/util.c
index 079d53c..7b030d7 100644
--- a/x11vnc/util.c
+++ b/x11vnc/util.c
@@ -557,6 +557,8 @@ char *choose_title(char *display) {
free(name);
}
}
+#else
+ if (!name) {}
#endif /* NO_X11 */
}
return title;
diff --git a/x11vnc/win_utils.c b/x11vnc/win_utils.c
index 35862f7..9f70349 100644
--- a/x11vnc/win_utils.c
+++ b/x11vnc/win_utils.c
@@ -29,11 +29,13 @@ Window descend_pointer(int depth, Window start, char *name_info, int len);
Window parent_window(Window win, char **name) {
+#if !NO_X11
Window r, parent;
Window *list;
XErrorHandler old_handler;
unsigned int nchild;
int rc;
+#endif
if (name != NULL) {
*name = NULL;
@@ -41,6 +43,7 @@ Window parent_window(Window win, char **name) {
RAWFB_RET(None)
#if NO_X11
nox11_exit(1);
+ if (!name || !win) {}
return None;
#else
@@ -67,9 +70,11 @@ Window parent_window(Window win, char **name) {
/* trapping utility to check for a valid window: */
int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
- XErrorHandler old_handler;
XWindowAttributes attr, *pattr;
+#if !NO_X11
+ XErrorHandler old_handler;
int ok = 0;
+#endif
if (attr_ret == NULL) {
pattr = &attr;
@@ -89,6 +94,7 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
#if NO_X11
nox11_exit(1);
+ if (!win || !attr_ret || !bequiet) {}
return 0;
#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,
int *dst_y, Window *child, int bequiet) {
- XErrorHandler old_handler;
+ XErrorHandler old_handler = NULL;
Bool ok = False;
RAWFB_RET(False)
#if NO_X11
nox11_exit(1);
+ if (!src || !dst || !src_x || !src_y || !dst_x || !dst_y || !child || !bequiet) {}
+ if (!old_handler || !ok) {}
return False;
#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) {
+ int rx, ry;
+#if !NO_X11
Window r, c;
- int rx, ry, wx, wy;
+ int wx, wy;
unsigned int mask;
+#endif
#ifdef MACOSX
if (macosx_console) {
- macosx_get_cursor_pos(&rx, &rx);
+ macosx_get_cursor_pos(&rx, &ry);
}
#endif
RAWFB_RET(None)
#if NO_X11
+ if (!start) {}
return None;
#else
if (start == None) {
@@ -344,14 +356,15 @@ Window query_pointer(Window start) {
}
unsigned int mask_state(void) {
+#if NO_X11
+ RAWFB_RET(0)
+ return 0;
+#else
Window r, c;
int rx, ry, wx, wy;
unsigned int mask;
RAWFB_RET(0)
-#if NO_X11
- return 0;
-#else
if (XQueryPointer_wr(dpy, rootwin, &r, &c, &rx, &ry, &wx, &wy, &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) {
+#if NO_X11
+ RAWFB_RET(None)
+ if (!depth || !start || !name_info || !len) {}
+ return None;
+#else
Window r, c, clast = None;
int i, rx, ry, wx, wy;
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;
RAWFB_RET(None)
-#if NO_X11
- return None;
-#else
if (! classhint) {
classhint = XAllocClassHint();
diff --git a/x11vnc/xevents.c b/x11vnc/xevents.c
index 50c96bf..1e24b39 100644
--- a/x11vnc/xevents.c
+++ b/x11vnc/xevents.c
@@ -75,6 +75,11 @@ void initialize_clipboard_atom(void) {
}
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_xcreate_simple_window = 0;
static int did_vnc_connect_prop = 0;
@@ -85,9 +90,6 @@ static void initialize_xevents(int reset) {
static int did_xrandr = 0;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (reset) {
did_xselect_input = 0;
@@ -165,10 +167,13 @@ static void print_xevent_bases(void) {
}
static void get_prop(char *str, int len, Atom prop) {
+ int i;
+#if !NO_X11
Atom type;
- int format, slen, dlen, i;
+ int format, slen, dlen;
unsigned long nitems = 0, bytes_after = 0;
unsigned char* data = NULL;
+#endif
for (i=0; i<len; i++) {
str[i] = '\0';
@@ -205,6 +210,10 @@ static void get_prop(char *str, int len, Atom prop) {
}
static void bust_grab(int reset) {
+#if NO_X11
+ if (!reset) {}
+ return;
+#else
static int bust_count = 0;
static time_t last_bust = 0;
time_t now = time(NULL);
@@ -218,9 +227,6 @@ static void bust_grab(int reset) {
bust_count = 0;
return;
}
-#if NO_X11
- return;
-#else
x = 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) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!parent || !dstr) {}
+ return;
+#else
Atom ticker_atom = None;
int sleep = sync_tod_delay * 921 * 1000;
char propval[200];
@@ -472,9 +483,6 @@ static void grab_buster_watch(int parent, char *dstr) {
int db = 0;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (grab_buster > 1) {
db = 1;
@@ -577,6 +585,10 @@ void spawn_grab_buster(void) {
}
void sync_tod_with_servertime(void) {
+#if NO_X11
+ RAWFB_RET_VOID
+ return;
+#else
static Atom ticker_atom = None;
XEvent xev;
char diff[128];
@@ -585,9 +597,6 @@ void sync_tod_with_servertime(void) {
int i, db = 0;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (! ticker_atom) {
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.
*/
void check_xevents(int reset) {
+#if NO_X11
+ RAWFB_RET_VOID
+ if (!reset) {}
+ return;
+#else
XEvent xev;
int tmp, have_clients = 0;
static int sent_some_sel = 0;
@@ -748,9 +762,6 @@ void check_xevents(int reset) {
if (unixpw_in_progress) return;
RAWFB_RET_VOID
-#if NO_X11
- return;
-#else
if (now > last_init_check+1 || reset) {
last_init_check = now;
diff --git a/x11vnc/xrandr.c b/x11vnc/xrandr.c
index 0c860ca..1486efb 100644
--- a/x11vnc/xrandr.c
+++ b/x11vnc/xrandr.c
@@ -207,6 +207,8 @@ int check_xrandr_event(char *msg) {
" caller...\n");
return do_change;
}
+#else
+ xev.type = 0;
#endif
return 0;
}
diff --git a/x11vnc/xrecord.c b/x11vnc/xrecord.c
index 26630fd..b01de3c 100644
--- a/x11vnc/xrecord.c
+++ b/x11vnc/xrecord.c
@@ -84,7 +84,7 @@ int trap_record_xerror(Display *d, XErrorEvent *error) {
static void xrecord_grabserver(int start) {
XErrorHandler old_handler = NULL;
- int rc;
+ int rc = 0;
if (debug_grabs) {
fprintf(stderr, "xrecord_grabserver%d/%d %.5f\n",
@@ -136,6 +136,8 @@ static void xrecord_grabserver(int start) {
}
XSetErrorHandler(old_handler);
XFlush_wr(gdpy_data);
+#else
+ if (!rc || !old_handler) {}
#endif
if (debug_grabs) {
fprintf(stderr, "xrecord_grabserver-done: %.5f\n", dnowx());
@@ -1299,9 +1301,9 @@ static void record_grab(XPointer ptr, XRecordInterceptData *rec_data) {
#endif
static void check_xrecord_grabserver(void) {
+#if LIBVNCSERVER_HAVE_RECORD
int last_val, cnt = 0, i, max = 10;
double d;
-#if LIBVNCSERVER_HAVE_RECORD
if (!gdpy_ctrl || !gdpy_data) {
return;
}
@@ -1415,7 +1417,7 @@ void check_xrecord_reset(int force) {
static double last_reset = 0.0;
int reset_time = 60, require_idle = 10;
int reset_time2 = 600, require_idle2 = 40;
- double now;
+ double now = 0.0;
XErrorHandler old_handler = NULL;
if (gdpy_ctrl) {
@@ -1486,6 +1488,8 @@ void check_xrecord_reset(int force) {
X_UNLOCK;
last_reset = now;
+#else
+ if (!old_handler || now == 0.0 || !last_reset || !force) {}
#endif
}
@@ -1500,15 +1504,18 @@ void check_xrecord_reset(int force) {
}
void xrecord_watch(int start, int setby) {
+#if LIBVNCSERVER_HAVE_RECORD
Window focus, wm, c, clast;
static double create_time = 0.0;
- double now;
- static double last_error = 0.0;
- int rc, db = debug_scroll;
+ int rc;
int do_shutdown = 0;
int reopen_dpys = 1;
XErrorHandler old_handler = NULL;
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;
diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c
index 0b70705..4c6982b 100644
--- a/x11vnc/xwrappers.c
+++ b/x11vnc/xwrappers.c
@@ -117,6 +117,7 @@ int guess_bits_per_color(int bits_per_pixel) {
int XFlush_wr(Display *disp) {
#if NO_X11
+ if (!disp) {}
return 1;
#else
if (disp) {
@@ -157,6 +158,7 @@ Status XShmGetImage_wr(Display *disp, Drawable d, XImage *image, int x, int y,
#if LIBVNCSERVER_HAVE_XSHM
return XShmGetImage(disp, d, image, x, y, mask);
#else
+ if (!disp || !d || !image || !x || !y || !mask) {}
return (Status) 0;
#endif
}
@@ -169,6 +171,7 @@ XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth,
return XShmCreateImage(disp, vis, depth, format, data, shminfo,
width, height);
#else
+ if (!disp || !vis || !depth || !format || !data || !shminfo || !width || !height) {}
return (XImage *) 0;
#endif
}
@@ -177,6 +180,7 @@ Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) {
#if LIBVNCSERVER_HAVE_XSHM
return XShmAttach(disp, shminfo);
#else
+ if (!disp || !shminfo) {}
return (Status) 0;
#endif
}
@@ -185,6 +189,7 @@ Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) {
#if LIBVNCSERVER_HAVE_XSHM
return XShmDetach(disp, shminfo);
#else
+ if (!disp || !shminfo) {}
return (Status) 0;
#endif
}
@@ -193,6 +198,7 @@ Bool XShmQueryExtension_wr(Display *disp) {
#if LIBVNCSERVER_HAVE_XSHM
return XShmQueryExtension(disp);
#else
+ if (!disp) {}
return False;
#endif
}
@@ -202,6 +208,7 @@ Bool XShmQueryExtension_wr(Display *disp) {
XImage *xreadscreen(Display *disp, Drawable d, int x, int y,
unsigned int width, unsigned int height, Bool show_cursor) {
#if NO_X11
+ if (!disp || !d || !x || !y || !width || !height || !show_cursor) {}
return NULL;
#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) {
#if NO_X11
nox11_exit(1);
+ if (!disp || !d || !x || !y || !width || !height || !plane_mask || !format || !dest_image || !dest_x || !dest_y) {}
return NULL;
#else
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,
int format) {
#if NO_X11
+ if (!disp || !d || !x || !y || !width || !height || !plane_mask || !format) {}
nox11_exit(1);
return NULL;
#else
@@ -309,6 +318,7 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth,
#if NO_X11
nox11_exit(1);
+ if (!disp || !visual || !depth || !format || !offset || !data || !width || !height || !width || !bitmap_pad || !bytes_per_line) {}
return NULL;
#else
if (overlay) {
@@ -589,6 +599,7 @@ void init_track_keycode_state(void) {
static void upup_downdown_warning(KeyCode key, Bool down) {
RAWFB_RET_VOID
#if NO_X11
+ if (!key || !down) {}
return;
#else
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
#if NO_X11
nox11_exit(1);
+ if (!dpy || !key || !down || !delay) {}
return;
#else
@@ -642,6 +654,7 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
#if NO_X11
nox11_exit(1);
+ if (!dpy || !key || !down || !delay || !first) {}
return;
#else
if (debug_keyboard) {
@@ -699,6 +712,7 @@ void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
+ if (!dpy || !button || !is_press || !delay) {}
return;
#else
@@ -725,6 +739,7 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
+ if (!dpy || !button || !is_press || !delay) {}
return;
#else
@@ -764,6 +779,7 @@ void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
#if NO_X11
nox11_exit(1);
+ if (!dpy || !screen || !x || !y || !delay) {}
return;
#else
if (! xtrap_present) {
@@ -788,6 +804,7 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
+ if (!dpy || !screen || !x || !y || !delay) {}
return;
#else
@@ -825,6 +842,7 @@ Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) {
#if LIBVNCSERVER_HAVE_XTEST
return XTestCompareCurrentCursorWithWindow(dpy, w);
#else
+ if (!w) {}
return False;
#endif
}
@@ -837,6 +855,7 @@ Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor) {
#if LIBVNCSERVER_HAVE_XTEST
return XTestCompareCursorWithWindow(dpy, w, cursor);
#else
+ if (!dpy || !w || !cursor) {}
return False;
#endif
}
@@ -847,6 +866,7 @@ Bool XTestQueryExtension_wr(Display *dpy, int *ev, int *er, int *maj,
#if LIBVNCSERVER_HAVE_XTEST
return XTestQueryExtension(dpy, ev, er, maj, min);
#else
+ if (!dpy || !ev || !er || !maj || !min) {}
return False;
#endif
}
@@ -858,6 +878,8 @@ void XTestDiscard_wr(Display *dpy) {
RAWFB_RET_VOID
#if LIBVNCSERVER_HAVE_XTEST
XTestDiscard(dpy);
+#else
+ if (!dpy) {}
#endif
}
@@ -882,6 +904,7 @@ int XTestGrabControl_wr(Display *dpy, Bool impervious) {
XTestGrabControl(dpy, impervious);
return 1;
#else
+ if (!dpy || !impervious) {}
return 0;
#endif
}
@@ -991,6 +1014,7 @@ Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min) {
#if LIBVNCSERVER_HAVE_RECORD
return XRecordQueryVersion(dpy, maj, min);
#else
+ if (!dpy || !maj || !min) {}
return False;
#endif
}
@@ -1045,7 +1069,7 @@ int xauth_raw(int on) {
}
Display *XOpenDisplay_wr(char *display_name) {
- Display *d;
+ Display *d = NULL;
int db = 0;
if (! xauth_raw(1)) {
@@ -1053,6 +1077,7 @@ Display *XOpenDisplay_wr(char *display_name) {
}
#if NO_X11
rfbLog("This x11vnc was built without X11 support (-rawfb only).\n");
+ if (!display_name || !d || !db) {}
return NULL;
#else
@@ -1086,12 +1111,13 @@ static int last_local_y = 0;
Bool XQueryPointer_wr(Display *display, Window w, Window *root_return,
Window *child_return, int *root_x_return, int *root_y_return,
int *win_x_return, int *win_y_return, unsigned int *mask_return) {
- Bool rc;
- XErrorHandler old_handler;
-
#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;
#else
+ Bool rc;
+ XErrorHandler old_handler;
+
if (! display) {
return False;
@@ -1137,6 +1163,7 @@ Status XQueryTree_wr(Display *display, Window w, Window *root_return,
}
#endif
#if NO_X11
+ if (!display || !w || !root_return || !parent_return || !children_return || !nchildren_return) {}
return (Status) 0;
#else
if (! display) {
@@ -1164,6 +1191,7 @@ int XFree_wr(void *data) {
int XSelectInput_wr(Display *display, Window w, long event_mask) {
#if NO_X11
+ if (!display || !w || !event_mask) {}
return 0;
#else
int rc;