Commit 901729e3 authored by runge's avatar runge

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

parent 6e2fa292
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,81 +196,83 @@ 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
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" -a "x$with_x" != "xno"; then
AC_MSG_ERROR([
==========================================================================
A working X window system build environment is required to build x11vnc.
Make sure any required X development packages are installed. If they are
installed in non-standard locations, one can use the --x-includes=DIR
and --x-libraries=DIR configure options or set the CPPFLAGS and LDFLAGS
environment variables to indicate where the X window system header files
and libraries may be found. On 64+32 bit machines you may need to point
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,
X_PRELIBS="$X_PRELIBS -lcrypt"
CRYPT_LIBS="-lcrypt"
[AC_DEFINE(HAVE_LIBCRYPT)], ,)
fi
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],,)
# 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],,)
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
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
fi
if test "x$with_ssl" != "xno"; then
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"
SSL_LIBS="-lssl -lcrypto"
[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,
-lcrypto)
else
AC_CHECK_LIB(ssl, SSL_library_init,
X_PRELIBS="$X_PRELIBS -lssl"
SSL_LIBS="-lssl"
[AC_DEFINE(HAVE_LIBSSL) HAVE_LIBSSL="true"], ,)
fi
fi
fi
AC_SUBST(SSL_LIBS)
if test "x$with_v4l" != "xno"; then
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
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
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
AC_MSG_ERROR([
==========================================================================
A working X window system build environment is required to build x11vnc.
Make sure any required X development packages are installed. If they are
installed in non-standard locations, one can use the --x-includes=DIR
and --x-libraries=DIR configure options or set the CPPFLAGS and LDFLAGS
environment variables to indicate where the X window system header files
and libraries may be found. On 64+32 bit machines you may need to point
to lib64 or lib32 directories to pick up the correct word size.
==========================================================================
])
fi
# Checks for libraries.
......
......@@ -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) {
......
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
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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,
}
return 1;
#endif /* NO_X11 */
}
static int scrollcopyrect_top, scrollcopyrect_bot;
......@@ -299,6 +303,7 @@ static void parse_wireframe_str(char *wf) {
XColor cdef;
Colormap cmap;
if (dpy && (bpp == 32 || bpp == 16)) {
#if !NO_X11
cmap = DefaultColormap (dpy, scr);
if (XParseColor(dpy, cmap, str, &cdef) &&
XAllocColor(dpy, cmap, &cdef)) {
......@@ -315,6 +320,7 @@ static void parse_wireframe_str(char *wf) {
wireframe_shade = n;
ok = 1;
}
#endif
}
if (ok) {
;
......
......@@ -536,6 +536,7 @@ char *choose_title(char *display) {
strncat(title, display, MAXN - strlen(title));
if (subwin && dpy && valid_window(subwin, NULL, 0)) {
char *name = NULL;
#if !NO_X11
if (XFetchName(dpy, subwin, &name)) {
if (name) {
strncat(title, " ", MAXN - strlen(title));
......@@ -543,6 +544,7 @@ char *choose_title(char *display) {
free(name);
}
}
#endif /* NO_X11 */
}
return title;
}
......@@ -6,6 +6,7 @@
#include "xinerama.h"
#include "screen.h"
#include "connections.h"
#include "keyboard.h"
#include "allowed_input_t.h"
#if LIBVNCSERVER_HAVE_LINUX_VIDEODEV_H
......
......@@ -36,6 +36,10 @@ Window parent_window(Window win, char **name) {
*name = NULL;
}
RAWFB_RET(None)
#if NO_X11
nox11_exit(1);
return None;
#else
old_handler = XSetErrorHandler(trap_xerror);
trapped_xerror = 0;
......@@ -55,6 +59,7 @@ Window parent_window(Window win, char **name) {
XFetchName(dpy, parent, name);
}
return parent;
#endif /* NO_X11 */
}
/* trapping utility to check for a valid window: */
......@@ -73,6 +78,10 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
return 0;
}
RAWFB_RET(0)
#if NO_X11
nox11_exit(1);
return 0;
#else
old_handler = XSetErrorHandler(trap_xerror);
trapped_xerror = 0;
......@@ -90,6 +99,7 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) {
trapped_xerror = 0;
return ok;
#endif /* NO_X11 */
}
Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x,
......@@ -98,6 +108,10 @@ Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x,
Bool ok = False;
RAWFB_RET(False)
#if NO_X11
nox11_exit(1);
return False;
#else
trapped_xerror = 0;
old_handler = XSetErrorHandler(trap_xerror);
......@@ -116,6 +130,7 @@ Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x,
trapped_xerror = 0;
return ok;
#endif /* NO_X11 */
}
int get_window_size(Window win, int *x, int *y) {
......@@ -165,6 +180,9 @@ void snapshot_stack_list(int free_only, double allowed_age) {
last_free = now;
RAWFB_RET_VOID
#if NO_X11
return;
#else
X_LOCK;
/* no need to trap error since rootwin */
......@@ -221,6 +239,7 @@ if (0) fprintf(stderr, "blackr: %d %dx%d+%d+%d\n", i,
XFree(list);
X_UNLOCK;
#endif /* NO_X11 */
}
void update_stack_list(void) {
......@@ -271,6 +290,9 @@ Window query_pointer(Window start) {
int rx, ry, wx, wy;
unsigned int mask;
RAWFB_RET(None)
#if NO_X11
return None;
#else
if (start == None) {
start = rootwin;
}
......@@ -279,6 +301,7 @@ Window query_pointer(Window start) {
} else {
return None;
}
#endif /* NO_X11 */
}
unsigned int mask_state(void) {
......@@ -287,12 +310,16 @@ unsigned int mask_state(void) {
unsigned int mask;
RAWFB_RET(0)
#if NO_X11
return 0;
#else
if (XQueryPointer(dpy, rootwin, &r, &c, &rx, &ry, &wx, &wy, &mask)) {
return mask;
} else {
return 0;
}
#endif /* NO_X11 */
}
int pick_windowid(unsigned long *num) {
......@@ -381,6 +408,9 @@ 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();
......@@ -481,6 +511,7 @@ Window descend_pointer(int depth, Window start, char *name_info, int len) {
}
return clast;
#endif /* NO_X11 */
}
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "July 2006" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.8.3, lastmod: 2006-07-15
version: 0.8.3, lastmod: 2006-07-17
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......
......@@ -2965,7 +2965,7 @@ int main(int argc, char* argv[]) {
}
overlay_present = 0;
#ifdef SOLARIS_OVERLAY
#if defined(SOLARIS_OVERLAY) && !NO_X11
if (! XQueryExtension(dpy, "SUN_OVL", &maj, &ev, &er)) {
if (! quiet && overlay) {
rfbLog("Disabling -overlay: SUN_OVL "
......@@ -2975,7 +2975,7 @@ int main(int argc, char* argv[]) {
overlay_present = 1;
}
#endif
#ifdef IRIX_OVERLAY
#if defined(IRIX_OVERLAY) && !NO_X11
if (! XReadDisplayQueryExtension(dpy, &ev, &er)) {
if (! quiet && overlay) {
rfbLog("Disabling -overlay: IRIX ReadDisplay "
......
......@@ -26,18 +26,31 @@
#include <time.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
/* we can now build under --without-x: */
#if LIBVNCSERVER_HAVE_X11
#define NO_X11 0
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#else
#include <rfb/rfb.h>
#include <rfb/rfbregion.h>
#define NO_X11 1
#include "nox11.h"
#include <rfb/keysym.h>
#endif
/****************************************************************************/
......@@ -497,6 +510,8 @@ typedef struct _ClientData {
} ClientData;
extern void nox11_exit(int rc);
#include "params.h"
#include "enums.h"
#include "options.h"
......
......@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.8.3 lastmod: 2006-07-15";
char lastmod[] = "0.8.3 lastmod: 2006-07-17";
/* X display info */
......
......@@ -42,17 +42,24 @@ static void grab_buster_watch(int parent, char *dstr);
void initialize_vnc_connect_prop(void) {
vnc_connect_str[0] = '\0';
RAWFB_RET_VOID
#if !NO_X11
vnc_connect_prop = XInternAtom(dpy, "VNC_CONNECT", False);
#endif
}
void initialize_x11vnc_remote_prop(void) {
x11vnc_remote_str[0] = '\0';
RAWFB_RET_VOID
#if !NO_X11
x11vnc_remote_prop = XInternAtom(dpy, "X11VNC_REMOTE", False);
#endif
}
void initialize_clipboard_atom(void) {
RAWFB_RET_VOID
#if NO_X11
return;
#else
clipboard_atom = XInternAtom(dpy, "CLIPBOARD", False);
if (clipboard_atom == None) {
if (! quiet) rfbLog("could not find atom CLIPBOARD\n");
......@@ -63,6 +70,7 @@ void initialize_clipboard_atom(void) {
set_clipboard = 0;
}
}
#endif /* NO_X11 */
}
static void initialize_xevents(int reset) {
......@@ -76,6 +84,9 @@ 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;
......@@ -136,6 +147,7 @@ static void initialize_xevents(int reset) {
initialize_xdamage();
did_xdamage = 1;
}
#endif /* NO_X11 */
}
static void print_xevent_bases(void) {
......@@ -163,6 +175,9 @@ static void get_prop(char *str, int len, Atom prop) {
return;
}
RAWFB_RET_VOID
#if NO_X11
return;
#else
slen = 0;
......@@ -184,6 +199,7 @@ static void get_prop(char *str, int len, Atom prop) {
XFree(data);
}
} while (bytes_after > 0);
#endif /* NO_X11 */
}
static void bust_grab(int reset) {
......@@ -200,6 +216,9 @@ static void bust_grab(int reset) {
bust_count = 0;
return;
}
#if NO_X11
return;
#else
x = 0;
y = 0;
......@@ -275,6 +294,7 @@ static void bust_grab(int reset) {
}
XFlush_wr(dpy);
last_bust = time(NULL);
#endif /* NO_X11 */
}
typedef struct _grabwatch {
......@@ -450,6 +470,9 @@ 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;
......@@ -510,6 +533,7 @@ static void grab_buster_watch(int parent, char *dstr) {
break;
}
}
#endif /* NO_X11 */
}
void spawn_grab_buster(void) {
......@@ -559,6 +583,9 @@ 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);
......@@ -601,6 +628,7 @@ void sync_tod_with_servertime(void) {
}
usleep(1000);
}
#endif /* NO_X11 */
}
void check_keycode_state(void) {
......@@ -717,6 +745,9 @@ void check_xevents(int reset) {
XErrorHandler old_handler;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (unixpw_in_progress) return;
......@@ -1079,6 +1110,7 @@ void check_xevents(int reset) {
X_UNLOCK;
last_call = now;
#endif /* NO_X11 */
}
/*
......@@ -1088,6 +1120,9 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) {
allowed_input_t input;
RAWFB_RET_VOID
#if NO_X11
return;
#else
if (unixpw_in_progress) {
rfbLog("xcut_receive: unixpw_in_progress, skipping.\n");
......@@ -1169,6 +1204,7 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) {
X_UNLOCK;
set_cutbuffer = 1;
#endif /* NO_X11 */
}
......@@ -5,6 +5,7 @@
#include "keyboard.h"
#include "xevents.h"
#include "connections.h"
#include "cleanup.h"
int xshm_present = 0;
int xtest_present = 0;
......@@ -103,11 +104,15 @@ int guess_bits_per_color(int bits_per_pixel) {
}
int XFlush_wr(Display *disp) {
#if NO_X11
return 1;
#else
if (disp) {
return XFlush(disp);
} else {
return 1;
}
#endif /* NO_X11 */
}
/*
......@@ -184,6 +189,10 @@ 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
return NULL;
#else
#ifdef SOLARIS_OVERLAY
return XReadScreen(disp, d, x, y, width, height,
show_cursor);
......@@ -201,12 +210,17 @@ XImage *xreadscreen(Display *disp, Drawable d, int x, int y,
return NULL;
# endif
#endif
#endif /* NO_X11 */
}
XImage *XGetSubImage_wr(Display *disp, Drawable d, int x, int y,
unsigned int width, unsigned int height, unsigned long plane_mask,
int format, XImage *dest_image, int dest_x, int dest_y) {
#if NO_X11
nox11_exit(1);
return NULL;
#else
ADJUST_ROOTSHIFT
if (overlay && dest_x == 0 && dest_y == 0) {
......@@ -231,11 +245,16 @@ XImage *XGetSubImage_wr(Display *disp, Drawable d, int x, int y,
}
return XGetSubImage(disp, d, x, y, width, height, plane_mask,
format, dest_image, dest_x, dest_y);
#endif /* NO_X11 */
}
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
nox11_exit(1);
return NULL;
#else
ADJUST_ROOTSHIFT
......@@ -244,6 +263,7 @@ XImage *XGetImage_wr(Display *disp, Drawable d, int x, int y,
(Bool) overlay_cursor);
}
return XGetImage(disp, d, x, y, width, height, plane_mask, format);
#endif /* NO_X11 */
}
XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth,
......@@ -275,6 +295,10 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth,
return xi;
}
#if NO_X11
nox11_exit(1);
return NULL;
#else
if (overlay) {
XImage *xi;
xi = xreadscreen(disp, window, 0, 0, width, height, False);
......@@ -290,6 +314,7 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth,
return XCreateImage(disp, visual, depth, format, offset, data,
width, height, bitmap_pad, bytes_per_line);
#endif /* NO_X11 */
}
static void copy_raw_fb_24_to_32(XImage *dest, int x, int y, unsigned int w,
......@@ -545,12 +570,15 @@ void init_track_keycode_state(void) {
static void upup_downdown_warning(KeyCode key, Bool down) {
RAWFB_RET_VOID
#if NO_X11
return;
#else
if ((down ? 1:0) == keycode_state[(int) key]) {
char *str = XKeysymToString(XKeycodeToKeysym(dpy, key, 0));
rfbLog("XTestFakeKeyEvent: keycode=0x%x \"%s\" is *already* "
"%s\n", key, str ? str : "null", down ? "down":"up");
}
#endif /* NO_X11 */
}
/*
......@@ -562,6 +590,10 @@ void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
unsigned long delay) {
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
return;
#else
if (! xtrap_present) {
DEBUG_SKIPPED_INPUT(debug_keyboard, "keyboard: no-XTRAP");
......@@ -580,6 +612,8 @@ void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
#else
DEBUG_SKIPPED_INPUT(debug_keyboard, "keyboard: no-XTRAP-build");
#endif
#endif /* NO_X11 */
}
void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
......@@ -588,6 +622,10 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
return;
#else
if (debug_keyboard) {
char *str = XKeysymToString(XKeycodeToKeysym(dpy, key, 0));
rfbLog("XTestFakeKeyEvent(dpy, keycode=0x%x \"%s\", %s)\n",
......@@ -633,12 +671,18 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
}
keycode_state[(int) key] = down ? 1 : 0;
#endif
#endif /* NO_X11 */
}
void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
unsigned long delay) {
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
return;
#else
if (! xtrap_present) {
DEBUG_SKIPPED_INPUT(debug_keyboard, "button: no-XTRAP");
......@@ -653,12 +697,18 @@ void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
#else
DEBUG_SKIPPED_INPUT(debug_keyboard, "button: no-XTRAP-build");
#endif
#endif /* NO_X11 */
}
void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
unsigned long delay) {
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
return;
#else
if (grab_ptr) {
XUngrabPointer(dpy, CurrentTime);
......@@ -686,6 +736,7 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
if (grab_ptr) {
adjust_grabs(1, 1);
}
#endif /* NO_X11 */
}
void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
......@@ -693,6 +744,10 @@ void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
return;
#else
if (! xtrap_present) {
DEBUG_SKIPPED_INPUT(debug_keyboard, "motion: no-XTRAP");
return;
......@@ -705,12 +760,18 @@ void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
#else
DEBUG_SKIPPED_INPUT(debug_keyboard, "motion: no-XTRAP-build");
#endif
#endif /* NO_X11 */
}
void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
unsigned long delay) {
RAWFB_RET_VOID
#if NO_X11
nox11_exit(1);
return;
#else
if (grab_ptr) {
XUngrabPointer(dpy, CurrentTime);
......@@ -734,6 +795,7 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
if (grab_ptr) {
adjust_grabs(1, 1);
}
#endif /* NO_X11 */
}
Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) {
......@@ -971,6 +1033,10 @@ Display *XOpenDisplay_wr(char *display_name) {
if (! xauth_raw(1)) {
return NULL;
}
#if NO_X11
rfbLog("This x11vnc was built without X11 support (-rawfb only).\n");
return NULL;
#else
d = XOpenDisplay(display_name);
if (db) fprintf(stderr, "XOpenDisplay_wr: %s %p\n", display_name, (void *)d);
......@@ -978,11 +1044,29 @@ Display *XOpenDisplay_wr(char *display_name) {
xauth_raw(0);
return d;
#endif /* NO_X11 */
}
int XCloseDisplay_wr(Display *display) {
int db = 0;
if (db) fprintf(stderr, "XCloseDisplay_wr: %p\n", (void *)display);
#if NO_X11
return 0;
#else
return XCloseDisplay(display);
#endif /* NO_X11 */
}
void nox11_exit(int rc) {
#if NO_X11
rfbLog("This x11vnc was not built with X11 support.\n");
clean_up_exit(rc);
#else
if (0) {rc = 0;}
#endif
}
#if NO_X11
#include "nox11_funcs.h"
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment