x11vnc: enable --without-x builds for -rawfb only binaries.

pull/1/head
runge 17 years ago
parent 6e2fa29229
commit 901729e3e0
  1. 4
      ChangeLog
  2. 125
      configure.ac
  3. 28
      x11vnc/8to24.c
  4. 3
      x11vnc/ChangeLog
  5. 8
      x11vnc/Makefile.am
  6. 1470
      x11vnc/README
  7. 4
      x11vnc/cleanup.c
  8. 21
      x11vnc/connections.c
  9. 10
      x11vnc/cursor.c
  10. 12
      x11vnc/gui.c
  11. 39
      x11vnc/keyboard.c
  12. 2
      x11vnc/linuxfb.c
  13. 6665
      x11vnc/nox11.h
  14. 2820
      x11vnc/nox11_funcs.h
  15. 21
      x11vnc/pointer.c
  16. 8
      x11vnc/remote.c
  17. 22
      x11vnc/screen.c
  18. 12
      x11vnc/selection.c
  19. 20
      x11vnc/solid.c
  20. 14
      x11vnc/sslhelper.c
  21. 5
      x11vnc/uinput.c
  22. 6
      x11vnc/userinput.c
  23. 2
      x11vnc/util.c
  24. 1
      x11vnc/v4l.c
  25. 31
      x11vnc/win_utils.c
  26. 2
      x11vnc/x11vnc.1
  27. 4
      x11vnc/x11vnc.c
  28. 25
      x11vnc/x11vnc.h
  29. 2
      x11vnc/x11vnc_defs.c
  30. 36
      x11vnc/xevents.c
  31. 88
      x11vnc/xwrappers.c

@ -1,3 +1,7 @@
2006-07-17 Karl Runge <runge@karlrunge.com>
* configure.ac: move non-X11 tests out of HAVE_X: set
SSL_LIBS and CRYPT_LIBS and some header checks.
2006-07-12 Karl Runge <runge@karlrunge.com>
* libvncserver: release for CVE-2006-2450 fix.

@ -47,6 +47,7 @@ AC_CHECK_HEADER(thenonexistentheader.h, HAVE_THENONEXISTENTHEADER_H="true")
# Checks for X libraries
HAVE_X="false"
AC_PATH_XTRA
AH_TEMPLATE(HAVE_X11, [X11 build environment present])
AH_TEMPLATE(HAVE_XSHM, [MIT-SHM extension build environment present])
AH_TEMPLATE(HAVE_XTEST, [XTEST extension build environment present])
AH_TEMPLATE(HAVE_XTESTGRABCONTROL, [XTEST extension has XTestGrabControl])
@ -88,8 +89,10 @@ AC_ARG_WITH(fbdev,
AC_ARG_WITH(uinput,
[ --without-uinput disable linux uinput device support],,)
if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
AC_CHECK_LIB(X11, XGetImage, HAVE_X="true",
if test "x$with_x" = "xno"; then
HAVE_X="false"
elif test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
AC_CHECK_LIB(X11, XGetImage, [AC_DEFINE(HAVE_X11) HAVE_X="true"],
HAVE_X="false",
$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
@ -193,70 +196,14 @@ if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
esac
fi
# currently only x11vnc uses crypt() or libssl:
AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
AC_ARG_WITH(crypt,
[ --without-crypt disable support for libcrypt],,)
if test "x$with_crypt" != "xno"; then
AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true")
if test -z "$HAVE_LIBC_CRYPT"; then
AC_CHECK_LIB(crypt, crypt,
X_PRELIBS="$X_PRELIBS -lcrypt"
[AC_DEFINE(HAVE_LIBCRYPT)], ,)
fi
fi
# some OS's need both -lssl and -lcrypto on link line:
AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present])
AC_ARG_WITH(crypto,
[ --without-crypto disable support for openssl libcrypto],,)
AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present])
AC_ARG_WITH(ssl,
[ --without-ssl disable support for openssl libssl],,)
if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then
AC_CHECK_LIB(crypto, RAND_file_name,
[AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,)
fi
if test "x$with_ssl" != "xno"; then
if test "x$HAVE_LIBCRYPTO" = "xtrue"; then
AC_CHECK_LIB(ssl, SSL_library_init,
X_PRELIBS="$X_PRELIBS -lssl -lcrypto"
[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,
-lcrypto)
else
AC_CHECK_LIB(ssl, SSL_library_init,
X_PRELIBS="$X_PRELIBS -lssl"
[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,)
fi
fi
if test "x$with_v4l" != "xno"; then
AC_CHECK_HEADER(linux/videodev.h,
[AC_DEFINE(HAVE_LINUX_VIDEODEV_H)],,)
fi
if test "x$with_fbdev" != "xno"; then
AC_CHECK_HEADER(linux/fb.h,
[AC_DEFINE(HAVE_LINUX_FB_H)],,)
fi
if test "x$with_uinput" != "xno"; then
AC_CHECK_HEADER(linux/input.h,
[AC_DEFINE(HAVE_LINUX_INPUT_H) HAVE_LINUX_INPUT_H="true"],,)
if test "x$HAVE_LINUX_INPUT_H" = "xtrue"; then
AC_CHECK_HEADER(linux/uinput.h,
[AC_DEFINE(HAVE_LINUX_UINPUT_H)],, [#include <linux/input.h>])
fi
fi
X_LIBS="$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS"
fi
fi
AC_SUBST(X_LIBS)
AM_CONDITIONAL(HAVE_X, test $HAVE_X != "false")
if test "$PACKAGE_NAME" = "x11vnc" -a "x$HAVE_X" = "xfalse"; then
if test "$PACKAGE_NAME" = "x11vnc" -a "x$HAVE_X" = "xfalse" -a "x$with_x" != "xno"; then
AC_MSG_ERROR([
==========================================================================
A working X window system build environment is required to build x11vnc.
@ -270,6 +217,64 @@ to lib64 or lib32 directories to pick up the correct word size.
])
fi
AH_TEMPLATE(HAVE_LIBCRYPT, [libcrypt library present])
AC_ARG_WITH(crypt,
[ --without-crypt disable support for libcrypt],,)
if test "x$with_crypt" != "xno"; then
AC_CHECK_FUNCS([crypt], HAVE_LIBC_CRYPT="true")
if test -z "$HAVE_LIBC_CRYPT"; then
AC_CHECK_LIB(crypt, crypt,
CRYPT_LIBS="-lcrypt"
[AC_DEFINE(HAVE_LIBCRYPT)], ,)
fi
fi
AC_SUBST(CRYPT_LIBS)
# some OS's need both -lssl and -lcrypto on link line:
AH_TEMPLATE(HAVE_LIBCRYPTO, [openssl libcrypto library present])
AC_ARG_WITH(crypto,
[ --without-crypto disable support for openssl libcrypto],,)
AH_TEMPLATE(HAVE_LIBSSL, [openssl libssl library present])
AC_ARG_WITH(ssl,
[ --without-ssl disable support for openssl libssl],,)
if test "x$with_crypto" != "xno" -a "x$with_ssl" != "xno"; then
AC_CHECK_LIB(crypto, RAND_file_name,
[AC_DEFINE(HAVE_LIBCRYPTO) HAVE_LIBCRYPTO="true"], ,)
fi
if test "x$with_ssl" != "xno"; then
if test "x$HAVE_LIBCRYPTO" = "xtrue"; then
AC_CHECK_LIB(ssl, SSL_library_init,
SSL_LIBS="-lssl -lcrypto"
[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,
-lcrypto)
else
AC_CHECK_LIB(ssl, SSL_library_init,
SSL_LIBS="-lssl"
[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,)
fi
fi
AC_SUBST(SSL_LIBS)
if test "x$with_v4l" != "xno"; then
AC_CHECK_HEADER(linux/videodev.h,
[AC_DEFINE(HAVE_LINUX_VIDEODEV_H)],,)
fi
if test "x$with_fbdev" != "xno"; then
AC_CHECK_HEADER(linux/fb.h,
[AC_DEFINE(HAVE_LINUX_FB_H)],,)
fi
if test "x$with_uinput" != "xno"; then
AC_CHECK_HEADER(linux/input.h,
[AC_DEFINE(HAVE_LINUX_INPUT_H) HAVE_LINUX_INPUT_H="true"],,)
if test "x$HAVE_LINUX_INPUT_H" = "xtrue"; then
AC_CHECK_HEADER(linux/uinput.h,
[AC_DEFINE(HAVE_LINUX_UINPUT_H)],, [#include <linux/input.h>])
fi
fi
# Checks for libraries.
AC_ARG_WITH(jpeg,

@ -71,6 +71,9 @@ static void set_root_cmap(void) {
int redo = 0;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (now > last_set + 10) {
redo = 1;
@ -116,6 +119,7 @@ static void set_root_cmap(void) {
}
X_UNLOCK;
}
#endif /* NO_X11 */
}
/* fixed size array. Will primarily hold visible 8bpp windows */
@ -256,6 +260,9 @@ void check_for_multivis(void) {
double delay;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (now > last_parse + 1.0) {
last_parse = now;
@ -529,6 +536,7 @@ if (0) fprintf(stderr, "MV_count: %d hit: %d %.4f %10.2f\n", MV_count, MV_hit,
}
}
if (0) fprintf(stderr, "done: %.4f\n", dnow() - last_query);
#endif /* NO_X11 */
}
#define VW_CACHE_MAX 1024
@ -750,6 +758,9 @@ 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
return NULL;
#else
if (xi == NULL || *w < dpy_x) {
char *d;
if (xi) {
@ -765,6 +776,7 @@ static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) {
dpy_x, 1, 8, 0);
}
return xi;
#endif /* NO_X11 */
}
static int poll_line(int x1, int x2, int y1, int n, sraRegionPtr mod) {
@ -791,6 +803,9 @@ 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;
}
@ -912,6 +927,7 @@ if (db24 > 2) fprintf(stderr, "avoid bad match...\n");
sraRgnDestroy(rect);
}
return 1;
#endif /* NO_X11 */
}
static void poll_line_complement(int x1, int x2, int y1, sraRegionPtr mod) {
@ -1279,6 +1295,9 @@ static int get_cmap(int j, Colormap cmap) {
XErrorHandler old_handler = NULL;
RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (0) {
/* not working properly for depth 24... */
@ -1345,6 +1364,7 @@ if (db24 > 2) fprintf(stderr, " cmap[%02d][%03d]: %03d %03d %03d 0x%08x \n", j,
rgb[j][i] = red | green | blue;
}
return 1;
#endif /* NO_X11 */
}
static void do_8bpp_region(int n, sraRegionPtr mark) {
@ -1409,6 +1429,9 @@ static XImage *cmap_xi(XImage *xi, Window win, int win_depth) {
XWindowAttributes attr;
char *d;
#if NO_X11
return NULL;
#else
if (xi) {
XDestroyImage(xi);
}
@ -1426,6 +1449,7 @@ static XImage *cmap_xi(XImage *xi, Window win, int win_depth) {
}
return XCreateImage(dpy, attr.visual, win_depth, ZPixmap, 0, d, dpy_x,
dpy_y, 8, 0);
#endif /* NO_X11 */
}
@ -1446,6 +1470,9 @@ 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
/* now transform the pixels in this rectangle: */
n_off = main_bytes_per_line * rect.y1 + pixelsize * rect.x1;
@ -1649,6 +1676,7 @@ if (db24) fprintf(stderr, "xi: wrong depth: %d\n", xi->depth);
src += main_bytes_per_line * fac;
}
}
#endif /* NO_X11 */
}
void bpp8to24(int x1, int y1, int x2, int y2) {

@ -1,3 +1,6 @@
2006-07-17 Karl Runge <runge@karlrunge.com>
* x11vnc: enable --without-x builds for -rawfb only (NO_X11)
2006-07-11 Karl Runge <runge@karlrunge.com>
* x11vnc: more tweaks to UINPUT, mostly mouse motion.

@ -11,10 +11,12 @@ if CYGIPC
LD_CYGIPC=-lcygipc
endif
if HAVE_X
bin_PROGRAMS=x11vnc
x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c uinput.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h uinput.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h
x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c uinput.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h nox11.h nox11_funcs.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h uinput.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h
if HAVE_X
INCLUDES=@X_CFLAGS@
x11vnc_LDADD=$(LDADD) @X_LIBS@ $(LD_CYGIPC)
x11vnc_LDADD=$(LDADD) @SSL_LIBS@ @CRYPT_LIBS@ @X_LIBS@ $(LD_CYGIPC)
else
x11vnc_LDADD=$(LDADD) @SSL_LIBS@ @CRYPT_LIBS@ $(LD_CYGIPC)
endif

File diff suppressed because it is too large Load Diff

@ -427,10 +427,14 @@ void initialize_signals(void) {
signal(SIGPIPE, interrupted);
}
#if NO_X11
return;
#else
X_LOCK;
Xerror_def = XSetErrorHandler(Xerror);
XIOerr_def = XSetIOErrorHandler(XIOerr);
X_UNLOCK;
#endif /* NO_X11 */
}
void unset_signals(void) {

@ -911,6 +911,10 @@ 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");
@ -1168,6 +1172,7 @@ static unsigned char t2x2_bits[] = {
X_UNLOCK;
return ret;
#endif /* NO_X11 */
}
/*
@ -1659,14 +1664,18 @@ void reverse_connect(char *str) {
*/
void set_vnc_connect_prop(char *str) {
RAWFB_RET_VOID
#if !NO_X11
XChangeProperty(dpy, rootwin, vnc_connect_prop, XA_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str));
#endif /* NO_X11 */
}
void set_x11vnc_remote_prop(char *str) {
RAWFB_RET_VOID
#if !NO_X11
XChangeProperty(dpy, rootwin, x11vnc_remote_prop, XA_STRING, 8,
PropModeReplace, (unsigned char *)str, strlen(str));
#endif /* NO_X11 */
}
void read_vnc_connect_prop(int nomsg) {
@ -1684,6 +1693,9 @@ 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 {
@ -1713,6 +1725,7 @@ void read_vnc_connect_prop(int nomsg) {
} else {
rfbLog("read VNC_CONNECT: %s\n", vnc_connect_str);
}
#endif /* NO_X11 */
}
void read_x11vnc_remote_prop(int nomsg) {
@ -1730,6 +1743,9 @@ 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 {
@ -1777,6 +1793,7 @@ void read_x11vnc_remote_prop(int nomsg) {
} else {
rfbLog("read X11VNC_REMOTE: %s\n", x11vnc_remote_str);
}
#endif /* NO_X11 */
}
/*
@ -2176,6 +2193,9 @@ void send_client_info(char *str) {
void adjust_grabs(int grab, int quiet) {
RAWFB_RET_VOID
#if NO_X11
return;
#else
/* n.b. caller decides to X_LOCK or not. */
if (grab) {
if (grab_kbd) {
@ -2206,6 +2226,7 @@ void adjust_grabs(int grab, int quiet) {
XUngrabPointer(dpy, CurrentTime);
}
}
#endif /* NO_X11 */
}
void check_new_clients(void) {

@ -828,6 +828,9 @@ 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;
@ -914,6 +917,7 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) {
*depth = descend;
*w = wins[descend];
#endif /* NO_X11 */
}
void initialize_xfixes(void) {
@ -1456,6 +1460,7 @@ int get_which_cursor(void) {
unsigned int w, h, bw, d;
Window r;
#if !NO_X11
trapped_xerror = 0;
X_LOCK;
old_handler = XSetErrorHandler(trap_xerror);
@ -1470,6 +1475,7 @@ int get_which_cursor(void) {
XSetErrorHandler(old_handler);
X_UNLOCK;
trapped_xerror = 0;
#endif /* NO_X11 */
}
if (which == which0) {
/* the string "term" mean I-beam. */
@ -1781,6 +1787,9 @@ int check_x11_pointer(void) {
unsigned int mask;
RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (unixpw_in_progress) return 0;
@ -1811,5 +1820,6 @@ int check_x11_pointer(void) {
/* change the cursor shape if necessary */
return set_cursor(x, y, get_which_cursor());
#endif /* NO_X11 */
}

@ -46,6 +46,9 @@ static Window tweak_tk_window_id(Window win) {
char *name = NULL;
Window parent, new;
#if NO_X11
return None;
#else
/* hack for tk, does not report outermost window */
new = win;
parent = parent_window(win, &name);
@ -60,6 +63,7 @@ static Window tweak_tk_window_id(Window win) {
XFree(name);
}
return new;
#endif /* NO_X11 */
}
int tray_embed(Window iconwin, int remove) {
@ -73,6 +77,9 @@ 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)) {
@ -153,6 +160,7 @@ int tray_embed(Window iconwin, int remove) {
XSetErrorHandler(old_handler);
trapped_xerror = 0;
return 1;
#endif /* NO_X11 */
}
static int tray_manager_running(Display *d, Window *manager) {
@ -161,6 +169,9 @@ static int tray_manager_running(Display *d, Window *manager) {
Window tray_win;
RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (manager) {
*manager = None;
@ -182,6 +193,7 @@ static int tray_manager_running(Display *d, Window *manager) {
} else {
return 1;
}
#endif /* NO_X11 */
}
static char *gui_geometry = NULL;

@ -13,6 +13,7 @@
#include "unixpw.h"
#include "v4l.h"
#include "linuxfb.h"
#include "uinput.h"
void get_keystate(int *keystate);
void clear_modifiers(int init);
@ -58,6 +59,9 @@ void get_keystate(int *keystate) {
char keys[32];
RAWFB_RET_VOID
#if NO_X11
return;
#else
/* n.b. caller decides to X_LOCK or not. */
XQueryKeymap(dpy, keys);
@ -73,6 +77,7 @@ void get_keystate(int *keystate) {
c = c >> 1;
}
}
#endif /* NO_X11 */
}
/*
@ -90,6 +95,9 @@ 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) {
@ -144,6 +152,7 @@ void clear_modifiers(int init) {
XTestFakeKeyEvent_wr(dpy, keycode, False, CurrentTime);
}
XFlush_wr(dpy);
#endif /* NO_X11 */
}
static KeySym simple_mods[] = {
@ -251,11 +260,15 @@ int get_autorepeat_state(void) {
XKeyboardState kstate;
RAWFB_RET(0)
#if NO_X11
return 0;
#else
X_LOCK;
XGetKeyboardControl(dpy, &kstate);
X_UNLOCK;
return kstate.global_auto_repeat;
#endif /* NO_X11 */
}
int get_initial_autorepeat_state(void) {
@ -270,6 +283,9 @@ void autorepeat(int restore, int bequiet) {
XKeyboardControl kctrl;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (restore) {
if (save_auto_repeat < 0) {
@ -316,6 +332,7 @@ void autorepeat(int restore, int bequiet) {
}
}
}
#endif /* NO_X11 */
}
/*
@ -367,6 +384,9 @@ int add_keysym(KeySym keysym) {
}
RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (keysym == NoSymbol) {
return 0;
@ -440,6 +460,7 @@ int add_keysym(KeySym keysym) {
}
XFree(keymap);
return ret;
#endif /* NO_X11 */
}
static void delete_keycode(KeyCode kc, int bequiet) {
@ -449,6 +470,9 @@ static void delete_keycode(KeyCode kc, int bequiet) {
char *str;
RAWFB_RET_VOID
#if NO_X11
return;
#else
XDisplayKeycodes(dpy, &minkey, &maxkey);
keymap = XGetKeyboardMapping(dpy, minkey, (maxkey - minkey + 1),
@ -469,6 +493,7 @@ static void delete_keycode(KeyCode kc, int bequiet) {
XFree(keymap);
XFlush_wr(dpy);
#endif /* NO_X11 */
}
static int count_added_keycodes(void) {
@ -771,6 +796,9 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
}
RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (!down && !keycode_state[key] && !IsModifierKey(keysym)) {
int i, cnt = 0, downkey = -1;
@ -817,6 +845,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
}
}
return 0;
#endif /* NO_X11 */
}
#if !LIBVNCSERVER_HAVE_XKEYBOARD || SKIP_XKB
@ -2190,6 +2219,9 @@ void initialize_modtweak(void) {
}
RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK;
XDisplayKeycodes(dpy, &minkey, &maxkey);
@ -2267,6 +2299,7 @@ void initialize_modtweak(void) {
XFree ((void *) keymap);
X_UNLOCK;
#endif /* NO_X11 */
}
/*
@ -2331,6 +2364,9 @@ static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym,
int tweak = 0;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (use_xkb_modtweak) {
xkb_tweak_keyboard(down, keysym, client);
@ -2406,6 +2442,7 @@ static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym,
if ( tweak ) {
tweak_mod(modifiers[keysym], False);
}
#endif /* NO_X11 */
}
void initialize_keyboard_and_pointer(void) {
@ -2781,6 +2818,8 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
if (max_keyrepeat_always > 0.0) {
max_keyrepeat_time = max_keyrepeat_always;
}
#else
if (0) {max_keyrepeat_always=0;}
#endif
if (!down && skipped_last_down) {
int db = debug_scroll;

@ -7,6 +7,8 @@
#include "screen.h"
#include "pointer.h"
#include "allowed_input_t.h"
#include "uinput.h"
#include "keyboard.h"
#if LIBVNCSERVER_HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -13,6 +13,7 @@
#include "unixpw.h"
#include "v4l.h"
#include "linuxfb.h"
#include "uinput.h"
int pointer_queued_sent = 0;
@ -54,6 +55,9 @@ static void buttonparse(int from, char **s) {
int to, i;
int modisdown[256];
#if NO_X11
return;
#else
q = *s;
for (i=0; i<256; i++) {
@ -201,6 +205,7 @@ static void buttonparse(int from, char **s) {
/* advance the source pointer position */
(*s)++;
}
#endif /* NO_X11 */
}
/*
@ -216,6 +221,9 @@ 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);
@ -282,6 +290,7 @@ void initialize_pointer_map(char *pointer_remap) {
}
free(remap);
}
#endif /* NO_X11 */
}
/*
@ -291,6 +300,9 @@ static void update_x11_pointer_position(int x, int y) {
int rc;
RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK;
if (use_xwarppointer) {
@ -321,11 +333,15 @@ static void update_x11_pointer_position(int x, int y) {
cursor_changes += rc;
last_event = last_input = last_pointer_input = time(NULL);
#endif /* NO_X11 */
}
void do_button_mask_change(int mask, int button) {
int mb, k, i = button-1;
#if NO_X11
return;
#else
/*
* this expands to any pointer_map button -> keystrokes
* remappings. Usually just k=0 and we send one button event.
@ -383,6 +399,7 @@ void do_button_mask_change(int mask, int button) {
}
}
}
#endif /* NO_X11 */
}
/*
@ -394,6 +411,9 @@ static void update_x11_pointer_mask(int mask) {
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();
@ -508,6 +528,7 @@ if (debug_scroll > 1) fprintf(stderr, "internal scrollbar: %dx%d\n", w, h);
*/
button_mask_prev = button_mask;
button_mask = mask;
#endif /* NO_X11 */
}
/* for -pipeinput */

@ -492,6 +492,9 @@ static void reset_rfbport(int old, int new) {
int remote_control_access_ok(void) {
struct stat sbuf;
#if NO_X11
return 0;
#else
if (client_connect_file) {
if (stat(client_connect_file, &sbuf) == 0) {
if (sbuf.st_mode & S_IWOTH) {
@ -614,6 +617,7 @@ int remote_control_access_ok(void) {
}
return 1;
#endif /* NO_X11 */
}
static int hack_val = 0;
@ -3082,9 +3086,11 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
grab_kbd = 0;
if (orig && dpy) {
#if !NO_X11
X_LOCK;
XUngrabKeyboard(dpy, CurrentTime);
X_UNLOCK;
#endif
}
rfbLog("disabled grab_kbd\n");
} else if (!strcmp(p, "grabptr")) {
@ -3102,9 +3108,11 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
grab_ptr = 0;
if (orig && dpy) {
#if !NO_X11
X_LOCK;
XUngrabPointer(dpy, CurrentTime);
X_UNLOCK;
#endif
}
rfbLog("disabled grab_ptr\n");

@ -168,6 +168,9 @@ if (0) fprintf(stderr, "unset_colormap: %d\n", reset);
}
RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK;
@ -274,6 +277,7 @@ if (0) fprintf(stderr, "unset_colormap: %d\n", reset);
}
init = 0;
#endif /* NO_X11 */
}
static void debug_colormap(XImage *fb) {
@ -336,6 +340,9 @@ static void set_visual(char *str) {
char *p, *vstring = strdup(str);
RAWFB_RET_VOID
#if NO_X11
return;
#else
defdepth = DefaultDepth(dpy, scr);
visual_id = (VisualID) 0;
@ -406,6 +413,7 @@ static void set_visual(char *str) {
/* set numerical visual id. */
visual_id = vinfo.visualid;
#endif /* NO_X11 */
}
void set_nofb_params(int restore) {
@ -1356,6 +1364,9 @@ static int wait_until_mapped(Window win) {
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) {
@ -1373,6 +1384,7 @@ static int wait_until_mapped(Window win) {
usleep(ms * 1000);
}
return 0;
#endif /* NO_X11 */
}
/*
@ -1388,6 +1400,9 @@ XImage *initialize_xdisplay_fb(void) {
if (raw_fb_str) {
return initialize_raw_fb(0);
}
#if NO_X11
return NULL;
#else
X_LOCK;
if (subwin) {
@ -1638,6 +1653,7 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_
rfbLog("warning: 24 bpp may have poor performance.\n");
}
return fb;
#endif /* NO_X11 */
}
void parse_scale_string(char *str, double *factor, int *scaling, int *blend,
@ -1983,7 +1999,11 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
have_masks = 2;
/* need to fetch TrueColor visual */
X_LOCK;
if (dpy && XMatchVisualInfo(dpy, scr, 24, TrueColor, &vinfo)) {
if (dpy
#if !NO_X11
&& XMatchVisualInfo(dpy, scr, 24, TrueColor, &vinfo)
#endif
) {
main_red_mask = vinfo.red_mask;
main_green_mask = vinfo.green_mask;
main_blue_mask = vinfo.blue_mask;

@ -61,6 +61,9 @@ 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
@ -134,6 +137,7 @@ void selection_request(XEvent *ev, char *type) {
trapped_xerror = 0;
XFlush_wr(dpy);
#endif /* NO_X11 */
}
int check_sel_direction(char *dir, char *label, char *sel, int len) {
@ -185,6 +189,9 @@ void cutbuffer_send(void) {
slen = 0;
RAWFB_RET_VOID
#if NO_X11
return;
#else
/* read the property value into cutbuffer_str: */
do {
@ -230,6 +237,7 @@ void cutbuffer_send(void) {
if (check_sel_direction("send", "cutbuffer_send", cutbuffer_str, len)) {
rfbSendServerCutText(screen, cutbuffer_str, len);
}
#endif /* NO_X11 */
}
/*
@ -255,6 +263,9 @@ 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.
@ -368,6 +379,7 @@ if (debug_sel) fprintf(stderr, "selection_send: data: '%s' dlen: %d nitems: %lu
if (check_sel_direction("send", "selection_send", selection_str, len)) {
rfbSendServerCutText(screen, selection_str, len);
}
#endif /* NO_X11 */
}

@ -123,6 +123,9 @@ 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");
@ -216,6 +219,7 @@ static void solid_root(char *color) {
XMapWindow(dpy, expose);
XSync(dpy, False);
XDestroyWindow(dpy, expose);
#endif /* NO_X11 */
}
static void solid_cde(char *color) {
@ -236,6 +240,9 @@ 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");
@ -476,6 +483,7 @@ static void solid_cde(char *color) {
XMapWindow(dpy, expose);
XSync(dpy, False);
XDestroyWindow(dpy, expose);
#endif /* NO_X11 */
}
static void solid_gnome(char *color) {
@ -492,6 +500,9 @@ static void solid_gnome(char *color) {
char *cmd;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (! color) {
if (! orig_color) {
@ -562,6 +573,7 @@ static void solid_gnome(char *color) {
sprintf(cmd, set_option, "none");
dt_cmd(cmd);
free(cmd);
#endif /* NO_X11 */
}
static void solid_kde(char *color) {
@ -575,6 +587,9 @@ static void solid_kde(char *color) {
int len;
RAWFB_RET_VOID
#if NO_X11
return;
#else
user = get_user_name();
if (strstr(user, "'") != NULL) {
@ -611,12 +626,16 @@ static void solid_kde(char *color) {
dt_cmd(cmd);
free(cmd);
free(user);
#endif /* NO_X11 */
}
char *guess_desktop(void) {
Atom prop;
RAWFB_RET("root")
#if NO_X11
return "root";
#else
if (wmdt_str && *wmdt_str != '\0') {
char *s = wmdt_str;
@ -662,6 +681,7 @@ char *guess_desktop(void) {
if (prop != None) return "cde";
}
return "root";
#endif /* NO_X11 */
}
void solid_bg(int restore) {

@ -1543,27 +1543,27 @@ void accept_openssl(int mode) {
* instead of a direct SSL connection.
*/
rfbLog("Handling VNC request via https GET. [%d]\n", getpid());
/* AUDIT */
if (strstr(buf, "/reverse.proxy")) {
char *buf;
char *buf2;
int n, ptr;
SSL_write(ssl, reply, strlen(reply));
buf = (char *) calloc((8192+1), 1);
buf2 = (char *) calloc((8192+1), 1);
n = 0;
ptr = 0;
while (ptr < 8192) {
n = SSL_read(ssl, buf + ptr, 1);
n = SSL_read(ssl, buf2 + ptr, 1);
if (n > 0) {
ptr += n;
}
if (db) fprintf(stderr, "buf2: '%s'\n", buf);
if (db) fprintf(stderr, "buf2: '%s'\n", buf2);
if (strstr(buf, "\r\n\r\n")) {
if (strstr(buf2, "\r\n\r\n")) {
break;
}
}
free(buf2);
}
goto write_cookie;
@ -1672,6 +1672,7 @@ if (db) fprintf(stderr, "iface: %s\n", iface);
exit(0);
}
/* parent here */
if (mode != OPENSSL_INETD) {
close(sock);
@ -2106,6 +2107,7 @@ static void ssl_xfer(int csock, int s_in, int s_out, int is_https) {
/* used to see if SSL_pending() should be checked: */
check_pending = 0;
/* AUDIT */
if (c_wr && FD_ISSET(csock, &wr)) {

@ -6,6 +6,7 @@
#include "xinerama.h"
#include "screen.h"
#include "pointer.h"
#include "keyboard.h"
#include "allowed_input_t.h"
#if LIBVNCSERVER_HAVE_SYS_IOCTL_H
@ -120,6 +121,7 @@ static void init_key_tracker(void) {
static int mod_is_down(void) {
int i;
if (0) {key_is_down();}
for (i = 0; i < 256; i++) {
if (key_pressed[i] && key_ismod[i]) {
return 1;
@ -281,7 +283,7 @@ void set_uinput_reset(int ms) {
rfbLog("set_uinput_reset: %d\n", ms);
}
int set_uinput_always(int a) {
void set_uinput_always(int a) {
uinput_always = a;
}
@ -315,7 +317,6 @@ void parse_uinput_str(char *in) {
}
uinput_dev = strdup(p);
} else if (strstr(p, "accel=") == p) {
double fx, fy;
q = p + strlen("accel=");
if (! set_uinput_accel(q)) {
clean_up_exit(1);

@ -97,6 +97,9 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h,
unsigned int mask;
RAWFB_RET(0)
#if NO_X11
return 0;
#else
ret = XQueryPointer(dpy, rootwin, &r, &c, &rootx, &rooty, &wx, &wy,
&mask);
@ -127,6 +130,7 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h,