├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .travis.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── README.md ├── autogen.sh ├── configure.ac ├── doc ├── FAQ.md ├── OPTIONS.md ├── SSL-PORTAL.md ├── SSL.md ├── SSVNC.md └── SUNRAY.md ├── m4 ├── .gitignore └── ax_type_socklen_t.m4 ├── misc ├── .cvsignore ├── LICENSE ├── Makefile.am ├── README ├── Xdummy.c ├── Xdummy.in ├── blockdpy.c ├── connect_switch ├── deskshot ├── desktop.cgi ├── dtVncPopup ├── enhanced_tightvnc_viewer │ ├── COPYING │ ├── README │ ├── Windows │ │ ├── README.txt │ │ ├── sshvnc.bat │ │ ├── tsvnc.bat │ │ └── util │ │ │ ├── connect_br.tcl │ │ │ ├── info │ │ │ ├── esound │ │ │ │ └── download.url │ │ │ ├── openssl │ │ │ │ ├── download.url │ │ │ │ └── location.url │ │ │ ├── plink │ │ │ │ ├── download.url │ │ │ │ └── licence.url │ │ │ ├── stunnel │ │ │ │ ├── download.url │ │ │ │ └── location.url │ │ │ └── vncviewer │ │ │ │ ├── download.url │ │ │ │ └── location.url │ │ │ ├── stunnel-client.conf │ │ │ ├── stunnel-server.conf │ │ │ └── w98 │ │ │ └── location.url │ ├── bin │ │ ├── Darwin.Power.Macintosh │ │ │ ├── .cpover │ │ │ └── vncviewer.sh │ │ ├── Darwin.i386 │ │ │ └── .cpover │ │ ├── sshvnc │ │ ├── ssvnc │ │ ├── ssvnc_cmd │ │ ├── tsvnc │ │ └── util │ │ │ ├── ss_vncviewer │ │ │ ├── ssvnc.tcl │ │ │ └── stunnel-server.conf │ ├── build.unix │ ├── filelist.txt │ ├── man │ │ └── man1 │ │ │ ├── ssvnc.1 │ │ │ └── ssvncviewer.1 │ ├── src │ │ ├── README │ │ ├── patches │ │ │ ├── README │ │ │ ├── _bundle │ │ │ ├── _getpatches │ │ │ ├── _vncpatchapplied │ │ │ ├── stunnel-maxconn.patch │ │ │ ├── tight-vncviewer-full.patch │ │ │ ├── tight-vncviewer-fullscreen.patch │ │ │ └── tight-vncviewer-newfbsize.patch │ │ └── zips │ │ │ └── README │ └── ssvnc.desktop ├── inet6to4 ├── panner.pl ├── qt_tslib_inject.pl ├── ranfb.pl ├── rx11vnc ├── rx11vnc.pl ├── shm_clear ├── slide.pl ├── turbovnc │ ├── Makefile.am │ ├── README │ ├── apply_turbovnc │ ├── convert │ ├── convert_rfbserver │ ├── tight.c │ ├── turbojpeg.h │ └── undo_turbovnc ├── uinput.pl ├── ultravnc_repeater.pl ├── vcinject.pl ├── x11vnc_loop └── x11vnc_pw ├── src ├── 8to24.c ├── 8to24.h ├── Makefile.am ├── allowed_input_t.h ├── appshare.c ├── avahi.c ├── avahi.h ├── blackout_t.h ├── cleanup.c ├── cleanup.h ├── connections.c ├── connections.h ├── cursor.c ├── cursor.h ├── default8x16.h ├── enc.h ├── enums.h ├── gui.c ├── gui.h ├── help.c ├── help.h ├── inet.c ├── inet.h ├── keyboard.c ├── keyboard.h ├── linuxfb.c ├── linuxfb.h ├── macosx.c ├── macosx.h ├── macosxCG.c ├── macosxCG.h ├── macosxCGP.c ├── macosxCGP.h ├── macosxCGS.c ├── macosxCGS.h ├── macosx_opengl.c ├── macosx_opengl.h ├── nox11.h ├── nox11_funcs.h ├── options.c ├── options.h ├── params.h ├── pm.c ├── pm.h ├── pointer.c ├── pointer.h ├── rates.c ├── rates.h ├── remote.c ├── remote.h ├── scan.c ├── scan.h ├── screen.c ├── screen.h ├── scrollevent_t.h ├── selection.c ├── selection.h ├── solid.c ├── solid.h ├── sslcmds.c ├── sslcmds.h ├── sslhelper.c ├── sslhelper.h ├── ssltools.h ├── tkx11vnc.h ├── uinput.c ├── uinput.h ├── unixpw.c ├── unixpw.h ├── user.c ├── user.h ├── userinput.c ├── userinput.h ├── util.c ├── util.h ├── v4l.c ├── v4l.h ├── win_utils.c ├── win_utils.h ├── winattr_t.h ├── x11vnc.c ├── x11vnc.h ├── x11vnc_defs.c ├── xdamage.c ├── xdamage.h ├── xevents.c ├── xevents.h ├── xi2_devices.c ├── xi2_devices.h ├── xinerama.c ├── xinerama.h ├── xkb_bell.c ├── xkb_bell.h ├── xrandr.c ├── xrandr.h ├── xrecord.c ├── xrecord.h ├── xwrappers.c └── xwrappers.h ├── tightvnc-1.3dev5-vncviewer-alpha-cursor.patch ├── tkx11vnc ├── x11vnc.1 └── x11vnc.desktop /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | issuehunt: LibVNC/x11vnc 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | If you'd like to put out an incentive for fixing this bug, you can do so at https://issuehunt.io/r/LibVNC/x11vnc 11 | 12 | **Describe the bug** 13 | 14 | 15 | **To Reproduce** 16 | 22 | 23 | **Expected Behavior** 24 | 25 | 26 | **Screenshots** 27 | 28 | 29 | **Desktop (please complete the following information):** 30 | - OS and version: 31 | - Xorg version used: 32 | - Wayland version used: 33 | 34 | 35 | **Additional context** 36 | 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature-request 6 | assignees: '' 7 | 8 | --- 9 | 10 | If you'd like to put out an incentive for implementing this feature, you can do so at https://issuehunt.io/r/LibVNC/x11vnc 11 | 12 | **Is your feature request related to a problem? Please describe.** 13 | 14 | 15 | **Describe the solution you'd like** 16 | 17 | 18 | **Describe alternatives you've considered** 19 | 20 | 21 | **Additional context** 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw[nop] 2 | INSTALL 3 | Makefile.in 4 | aclocal.m4 5 | autom4te.cache/ 6 | compile 7 | config.guess 8 | config.h.in 9 | config.h.in~ 10 | config.sub 11 | configure 12 | depcomp 13 | install-sh 14 | ltmain.sh 15 | missing 16 | .deps/ 17 | Makefile 18 | config.h 19 | *.log 20 | config.status 21 | libtool 22 | stamp-h1 23 | x11vnc 24 | *.o 25 | Xdummy 26 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | dist: trusty 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | compiler: 10 | - gcc 11 | - clang 12 | 13 | env: 14 | - CONFIGURE_ARGS= 15 | - CONFIGURE_ARGS=--without-x 16 | 17 | # install all vnc-related dependencies 18 | before_install: 19 | - 'if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; sudo apt-get build-dep x11vnc; fi' 20 | - 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CFLAGS="-I/usr/local/opt/openssl/include $CFLAGS" LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS" PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH"; fi' 21 | - 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget https://github.com/LibVNC/libvncserver/archive/LibVNCServer-0.9.11.tar.gz; tar xzf LibVNCServer-0.9.11.tar.gz; cd libvncserver-LibVNCServer-0.9.11; autoreconf -fi; ./configure; make; sudo make install; cd ..; fi' 22 | 23 | 24 | # before build script, run autoreconf 25 | before_script: autoreconf -fiv 26 | 27 | # Default is "./configure && make && make test", but no tests yet 28 | script: "./configure $CONFIGURE_ARGS && make" 29 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LibVNC/x11vnc/e2b726a8c0464051afda01648072af6835aaa5f7/AUTHORS -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LibVNC/x11vnc/e2b726a8c0464051afda01648072af6835aaa5f7/ChangeLog -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = \ 4 | src \ 5 | misc 6 | 7 | desktopdir = $(datadir)/applications 8 | desktop_DATA = x11vnc.desktop 9 | 10 | man_MANS = x11vnc.1 11 | 12 | EXTRA_DIST = \ 13 | ChangeLog \ 14 | README \ 15 | NEWS \ 16 | tkx11vnc \ 17 | $(man_MANS) \ 18 | $(desktop_DATA) 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | README -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | srcdir=$(dirname "$0") 4 | test -z "$srcdir" && srcdir=. 5 | 6 | ORIGDIR=$(pwd) 7 | cd "$srcdir" 8 | 9 | test -d m4 || mkdir m4 10 | autoreconf -v --install || exit 1 11 | cd "$ORIGDIR" || exit $? 12 | 13 | "$srcdir"/configure "$@" 14 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LibVNC/x11vnc/e2b726a8c0464051afda01648072af6835aaa5f7/m4/.gitignore -------------------------------------------------------------------------------- /m4/ax_type_socklen_t.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # http://www.gnu.org/software/autoconf-archive/ax_type_socklen_t.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_TYPE_SOCKLEN_T 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether sys/socket.h defines type socklen_t. Please note that some 12 | # systems require sys/types.h to be included before sys/socket.h can be 13 | # compiled. 14 | # 15 | # LICENSE 16 | # 17 | # Copyright (c) 2008 Lars Brinkhoff 18 | # 19 | # This program is free software; you can redistribute it and/or modify it 20 | # under the terms of the GNU General Public License as published by the 21 | # Free Software Foundation; either version 2 of the License, or (at your 22 | # option) any later version. 23 | # 24 | # This program is distributed in the hope that it will be useful, but 25 | # WITHOUT ANY WARRANTY; without even the implied warranty of 26 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 27 | # Public License for more details. 28 | # 29 | # You should have received a copy of the GNU General Public License along 30 | # with this program. If not, see . 31 | # 32 | # As a special exception, the respective Autoconf Macro's copyright owner 33 | # gives unlimited permission to copy, distribute and modify the configure 34 | # scripts that are the output of Autoconf when processing the Macro. You 35 | # need not follow the terms of the GNU General Public License when using 36 | # or distributing such scripts, even though portions of the text of the 37 | # Macro appear in them. The GNU General Public License (GPL) does govern 38 | # all other use of the material that constitutes the Autoconf Macro. 39 | # 40 | # This special exception to the GPL applies to versions of the Autoconf 41 | # Macro released by the Autoconf Archive. When you make and distribute a 42 | # modified version of the Autoconf Macro, you may extend this special 43 | # exception to the GPL to apply to your modified version as well. 44 | 45 | #serial 5 46 | 47 | AU_ALIAS([TYPE_SOCKLEN_T], [AX_TYPE_SOCKLEN_T]) 48 | AC_DEFUN([AX_TYPE_SOCKLEN_T], 49 | [AC_CACHE_CHECK([for socklen_t], ac_cv_ax_type_socklen_t, 50 | [ 51 | AC_TRY_COMPILE( 52 | [#include 53 | #include ], 54 | [socklen_t len = 42; return 0;], 55 | ac_cv_ax_type_socklen_t=yes, 56 | ac_cv_ax_type_socklen_t=no) 57 | ]) 58 | if test $ac_cv_ax_type_socklen_t != yes; then 59 | AC_DEFINE(socklen_t, int, [Substitute for socklen_t]) 60 | fi 61 | ]) 62 | -------------------------------------------------------------------------------- /misc/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | 4 | -------------------------------------------------------------------------------- /misc/LICENSE: -------------------------------------------------------------------------------- 1 | The following files in this directory: 2 | 3 | Makefile.am 4 | README 5 | Xdummy 6 | blockdpy.c 7 | ranfb.pl 8 | rx11vnc 9 | rx11vnc.pl 10 | shm_clear 11 | slide.pl 12 | vcinject.pl 13 | x11vnc_loop 14 | x11vnc_pw 15 | 16 | are all Copyright (C) 2002-2009 Karl J. Runge 17 | and are all released under this license: 18 | 19 | This is free software; you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation; version 2 of the License. 22 | 23 | This software is distributed in the hope that it will be useful, 24 | but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | GNU General Public License for more details. 27 | 28 | You should have received a copy of the GNU General Public License 29 | along with this software; if not, write to the Free Software 30 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 31 | USA or see . 32 | -------------------------------------------------------------------------------- /misc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = turbovnc 2 | 3 | EXTRA_DIST = \ 4 | blockdpy.c \ 5 | connect_switch \ 6 | deskshot \ 7 | desktop.cgi \ 8 | dtVncPopup \ 9 | inet6to4 \ 10 | panner.pl \ 11 | qt_tslib_inject.pl \ 12 | ranfb.pl \ 13 | README \ 14 | rx11vnc \ 15 | rx11vnc.pl \ 16 | shm_clear \ 17 | slide.pl \ 18 | uinput.pl \ 19 | ultravnc_repeater.pl \ 20 | vcinject.pl \ 21 | x11vnc_loop 22 | 23 | if HAVE_X11 24 | EXTRA_DIST += \ 25 | Xdummy.c \ 26 | Xdummy.in 27 | 28 | bin_SCRIPTS = Xdummy 29 | CLEANFILES = $(bin_SCRIPTS) 30 | 31 | do_dummy_c_subst = $(SED) \ 32 | -e '/Will be substituted by Xdummy\.c/d' \ 33 | -e '/"XDUMMY_C"/r $(srcdir)/Xdummy.c' 34 | 35 | Xdummy: $(srcdir)/Xdummy.in $(srcdir)/Xdummy.c 36 | $(do_dummy_c_subst) < $< > $@.tmp 37 | mv -f $@.tmp $@ 38 | endif 39 | -------------------------------------------------------------------------------- /misc/README: -------------------------------------------------------------------------------- 1 | 2 | In this directory you'll find a hodgepodge of wrapper scripts and 3 | utility programs that have found some use with x11vnc. 4 | 5 | Some are on the rough side and will need some customization for your 6 | use. Many of them are described on the webpage: 7 | 8 | http://www.karlrunge.com/x11vnc 9 | 10 | (use your browser's Find action to find them!). Some of them also have 11 | documentation near the top of the file. 12 | 13 | x11vnc -accept scripts: 14 | 15 | blockdpy.c try to lock screen if local person knocks monitor out of DPMS 16 | dtVncPopup CDE/dtksh by Stefan Radman to accept connections, lock screen 17 | 18 | x11vnc launch wrappers: 19 | 20 | rx11vnc simple ssh/rsh x11vnc launcher. -S option needs work... 21 | rx11vnc.pl perl script tries to do rx11vnc -S tunnelling better. 22 | 23 | x11vnc -pipeinput/-rawfb utilities: 24 | 25 | vcinject.pl perl script like LinuxVNC.c, for x11vnc viewing of linux console 26 | slide.pl amusing example using x11vnc -rawfb for jpeg slideshow. 27 | ranfb.pl example -rawfb setup:./ranfb.pl to set up a framebuffer. 28 | 29 | uinput.pl test perl script for Linux uinput injection. 30 | 31 | qt_tslib_inject.pl touchscreen -pipeinput helper for tslib on qtmoko. 32 | 33 | Misc. scripts: 34 | 35 | shm_clear list or remove orphaned shm slots from hard x11vnc crashes. 36 | x11vnc_loop kludge to run in bg attaching x11vnc to X login. Better to 37 | use Xsetup mechanism. 38 | Xdummy An LD_PRELOAD kludge to run the Xorg "dummy" device driver 39 | like Xvfb. 40 | 41 | ultravnc_repeater.pl: Unix script to act as UltraVNC repeater proxy. 42 | 43 | connect_switch: Share HTTPS, VNC, SSH, etc. through a single port (e.g. 443) 44 | 45 | panner.pl Allows a small rectangle to pan around a desktop more or less. 46 | 47 | desktop.cgi CGI script for creating multi-user virtual desktops on a 48 | server. Also can do port-redirection to internal machines. 49 | 50 | inet6to4 ipv6 to ipv4 relay (i.e. until libvncserver supports ipv6) 51 | 52 | deskshot A screenshot utility for configurations that lack other screen 53 | capture techniques built into x11vnc. This is primarily intended 54 | for Wayland desktop sessions. 55 | -------------------------------------------------------------------------------- /misc/deskshot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # A screenshot utility for configurations that lack other screen capture 4 | # techniques built into x11vnc. This is primarily intended for Wayland 5 | # desktop sessions. 6 | # 7 | # Requires dbus and netpbm packages. 8 | # 9 | # Copyright (C) 2015 Christian Beier 10 | # 11 | # This is free software; you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation; version 2 of the License. 14 | # 15 | # This software is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this software; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 23 | # USA or see . 24 | # 25 | # 26 | 27 | DELAY="$1" 28 | DEST="$2" 29 | 30 | ([ -z "$DELAY" ] || [ -z "$DEST" ] )&& { echo "usage: $0 "; exit 1; } 31 | 32 | DESKTOP=$XDG_CURRENT_DESKTOP 33 | 34 | echo "detected desktop: $DESKTOP" 35 | 36 | IS_INFO_SHOWN="" 37 | 38 | while true 39 | do 40 | case "$DESKTOP" in 41 | "GNOME") 42 | dbus-send --session --type=method_call --dest='org.gnome.Shell.Screenshot' '/org/gnome/Shell/Screenshot' \ 43 | org.gnome.Shell.Screenshot.Screenshot boolean:true boolean:false string:"$DEST" 44 | # convert to pnm readable by x11vnc 45 | pngtopnm "$DEST" > "$DEST".pnm 46 | 47 | ;; 48 | *) 49 | echo "not implemented yet for $DESKTOP, please add and file a PR at https://github.com/LibVNC/x11vnc" 50 | ;; 51 | esac 52 | 53 | [ -z "$IS_INFO_SHOWN" ] && { 54 | echo "run x11vnc with: -rawfb file:$DEST.pnm@$(head -2 $DEST.pnm | tail -1 | sed 's/ /x/')x24" 55 | IS_INFO_SHOWN=y 56 | } 57 | 58 | sleep $DELAY 59 | done 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /misc/dtVncPopup: -------------------------------------------------------------------------------- 1 | #!/usr/dt/bin/dtksh 2 | # 3 | # accept dialog script for x11vnc 4 | # 2004-07-13 stefan.radman@ctbto.org 5 | # should work in any CDE environment (Sun,HP,IBM,...) 6 | # 7 | # when called without parameters shows a CDE question dialog: 8 | # Do you want to accept a VNC connection 9 | # from IP address $RFB_CLIENT_IP to your desktop? 10 | # Note: 11 | # After 30 seconds the screen will 12 | # be locked and the connection will be 13 | # accepted automatically." 14 | # [Yes} {__No__] [View/Only] 15 | # and counts down a timer in the dialog title bar 16 | # when the timer is down to 0, it locks the display and returns 0 17 | # (if the screenlock was successful or if the login prompt was active) 18 | # 19 | # buttons=retcode: 20 | # Yes = 0 21 | # No = 1 (same as closing the dialog windows) 22 | # View/Only = 3 23 | # 24 | # usage: x11vnc -forever -shared -accept "yes:0,no:*,view:3 dtVncPopup" -gone "dtVncPopup lock" 25 | # 26 | # security considerations: when you return to your console and unlock the display 27 | # you can never know if enyone else is connected to your display 28 | # 29 | 30 | # timeout until accept 31 | timeout=30 32 | 33 | # dialog message 34 | test -z "${RFB_CLIENT_IP}" && unknown="an unknown " || ip="$RFB_CLIENT_IP " 35 | message="\ 36 | Do you want to accept a VNC connection 37 | from ${unknown}IP address ${ip}to your desktop? 38 | Note: 39 | After $timeout seconds the screen will 40 | be locked and the connection will be 41 | accepted automatically." 42 | 43 | # action functions 44 | accept () { 45 | exit 0 46 | } 47 | reject () { 48 | exit 1 49 | } 50 | view () { 51 | exit 3 52 | } 53 | lock () { 54 | # lock only if dtsession active 55 | xrdb -query | grep -c '^dtsession*' || accept 56 | # accept only if lock succeeds 57 | /usr/dt/bin/dtaction LockDisplay && accept || reject 58 | } 59 | 60 | # main 61 | 62 | # actions can be called directly 63 | test $# -gt 0 && $@ 64 | 65 | # initialize the display 66 | XtInitialize TOPLEVEL vncPopup VncPopup "$0" "$@" 67 | 68 | # create a message dialog containing the contents of the specified file 69 | XmCreateQuestionDialog DIALOG $TOPLEVEL dialog \ 70 | dialogTitle:"$DTKSH_APPNAME" \ 71 | messageString:"$message" \ 72 | unmapCallback:reject \ 73 | # symbolPixmap:/usr/dt/appconfig/icons/C/DtFlag.m.pm 74 | 75 | # change the OK button to "Yes" 76 | XmMessageBoxGetChild OK_BUTTON $DIALOG DIALOG_OK_BUTTON 77 | XtSetValues $OK_BUTTON \ 78 | labelString:"Yes" \ 79 | activateCallback:accept 80 | 81 | # change the Cancel Button to "No" 82 | XmMessageBoxGetChild CANCEL_BUTTON $DIALOG DIALOG_CANCEL_BUTTON 83 | XtSetValues $CANCEL_BUTTON \ 84 | labelString:"No" \ 85 | activateCallback:reject 86 | 87 | # change Help button to View-Only, set focus and make it the default 88 | XmMessageBoxGetChild HELP_BUTTON $DIALOG DIALOG_HELP_BUTTON 89 | XtSetValues $HELP_BUTTON \ 90 | labelString:"View\nOnly" \ 91 | activateCallback:view 92 | 93 | # make "No" the default (for unmap as well) 94 | XtSetValues $DIALOG \ 95 | defaultButton:$CANCEL_BUTTON initialFocus:$CANCEL_BUTTON \ 96 | 97 | # create the ticker 98 | ticker () { 99 | test $timeout -eq 0 && lock 100 | XtSetValues $DIALOG dialogTitle:"accepting in $timeout seconds" 101 | XtAddTimeOut TICKER 1000 ticker 102 | timeout=`expr $timeout - 1` 103 | } 104 | 105 | # display dialog and activate ticker 106 | XtAddTimeOut TICKER 1000 ticker 107 | XtManageChild $DIALOG 108 | XtMainLoop 109 | 110 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/README.txt: -------------------------------------------------------------------------------- 1 | 2 | This is a Windows utility to automatically start up STUNNEL to redirect 3 | SSL VNC connections to a remote host. Then TightVNC Viewer (included) 4 | is launched to use this SSL tunnel. 5 | 6 | An example server would be "x11vnc -ssl", or any VNC server with a 7 | 2nd STUNNEL program running on the server side. 8 | 9 | Just click on the program "ssvnc.exe", and then enter the remote 10 | VNC Server and click "Connect". Click on "Help" for more information 11 | information. You can also set some simple options under "Options ..." 12 | 13 | If you want that application to run in "SSH-ONLY" mode, click on 14 | the "sshvnc.bat" wrapper instead. Or enter SSH_ONLY. 15 | 16 | Note that on Windows when the TightVNC viewer disconnects you may need to 17 | terminate the STUNNEL program manually. To do this: Click on the STUNNEL 18 | icon (dark green) on the System Tray and then click "Exit". Before that, 19 | however, you will be prompted if you want ssvnc.exe to try to terminate 20 | STUNNEL for you. (Note that even if STUNNEL termination is successful, 21 | the Tray Icon may not go away until the mouse hovers over it!) 22 | 23 | With this STUNNEL and TightVNC Viewer wrapper you can also enable using 24 | SSL Certificates with STUNNEL, and so the connection is not only encrypted 25 | but it is also not susceptible to man-in-the-middle attacks. 26 | 27 | See the STUNNEL and x11vnc documentation for how to create and add SSL 28 | Certificates (PEM files) for authentication. Click on the "Certs ..." 29 | button to specify the certificate(s). See the Help there for more info 30 | and also: 31 | 32 | http://www.karlrunge.com/x11vnc 33 | http://www.tightvnc.com 34 | http://www.stunnel.org 35 | http://www.openssl.org 36 | http://www.chiark.greenend.org.uk/~sgtatham/putty/ 37 | 38 | You can use x11vnc to create certificates if you like: 39 | 40 | http://www.karlrunge.com/x11vnc/faq.html#faq-ssl-ca 41 | 42 | 43 | Misc: 44 | 45 | The openssl.exe stunnel.exe vncviewer.exe libeay32.dll 46 | libssl32.dll programs came from the websites mentioned above. 47 | 48 | IMPORTANT: some of these binaries may have cryptographic 49 | software that you may not be allowed to download or use. 50 | See the above websites for more information and also the 51 | util/info subdirectories. 52 | 53 | Also, the kill.exe and tlist.exe programs in the w98 directory 54 | came from diagnostic tools ftp site of Microsoft's. 55 | 56 | 57 | 58 | Important Note for Windows Vista: One user reports that on Windows Vista 59 | if you move or extract the "ssvnc" folder down to the "Program Files" 60 | folder you will be prompted to do this as the Administrator. But then 61 | when you start up ssvnc, as a regular user, it cannot create files in 62 | that folder and so it fails to run properly. We recommend to not copy 63 | or extract the "ssvnc" folder into "Program Files". Rather, extract 64 | it to somewhere you have write permission (e.g. C:\ or your User dir) 65 | and create a Shortcut to ssvnc.exe on the desktop. 66 | 67 | If you must put a launcher file down in "Program Files", perhaps an 68 | "ssvnc.bat" that looks like this: 69 | C: 70 | cd \ssvnc\Windows 71 | ssvnc.exe 72 | 73 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/sshvnc.bat: -------------------------------------------------------------------------------- 1 | start ssvnc.exe -ssh %1 %2 %3 %4 %5 %6 %7 %8 %9 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/tsvnc.bat: -------------------------------------------------------------------------------- 1 | start ssvnc.exe -ts %1 %2 %3 %4 %5 %6 %7 %8 %9 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/esound/download.url: -------------------------------------------------------------------------------- 1 | http://www.tux.org/~ricdude/EsounD.html 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/openssl/download.url: -------------------------------------------------------------------------------- 1 | http://www.stunnel.org/download/stunnel/win32/ 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/openssl/location.url: -------------------------------------------------------------------------------- 1 | http://www.stunnel.org/download/binaries.html 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/plink/download.url: -------------------------------------------------------------------------------- 1 | http://www.chiark.greenend.org.uk/%7esgtatham/putty/download.html 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/plink/licence.url: -------------------------------------------------------------------------------- 1 | http://www.chiark.greenend.org.uk/%7esgtatham/putty/licence.html 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/stunnel/download.url: -------------------------------------------------------------------------------- 1 | http://www.stunnel.org/download/stunnel/win32/ 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/stunnel/location.url: -------------------------------------------------------------------------------- 1 | http://www.stunnel.org/download/binaries.html 2 | http://stunnel.mirt.net/ 3 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/vncviewer/download.url: -------------------------------------------------------------------------------- 1 | http://www.tightvnc.com/download.html 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/info/vncviewer/location.url: -------------------------------------------------------------------------------- 1 | http://www.tightvnc.com 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/stunnel-client.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Example SSL stunnel CLIENT configuration file. (you run stunnel on 3 | # this machine and point your vnc viewer to it, it goes to remote VNC 4 | # server via SSL) 5 | # 6 | # To use this file you will need to edit it. Then you will need 7 | # to manually start up stunnel using it. 8 | # (e.g. /path/to/stunnel stunnel-server.conf) 9 | # 10 | # This is just an example and is not used by the tools in this package. 11 | # It is here to show how to create outgoing SSL connections to remote 12 | # VNC servers when not using the tools in this package. 13 | # 14 | client = yes 15 | options = ALL 16 | RNDbytes = 2048 17 | RNDfile = bananarand.bin 18 | RNDoverwrite = yes 19 | # 20 | # Remote server certs could go here: 21 | # CApath = /path/to/.../crt-dir 22 | # CAfile = /path/to/.../foo.crt 23 | # verify = 2 24 | # My cert could go here: 25 | # cert = /path/to/.../my.pem 26 | # 27 | [vnc] 28 | # 29 | # Set to local listening port number (e.g. 5900 for vnc display 0): 30 | # 31 | accept = localhost:5900 32 | # 33 | # Set to remote host:port to connect to (e.g. far-away.east:5900): 34 | # (this is where the VNC server is. :0 -> port 5900, etc) 35 | # 36 | connect = HOST:PORT 37 | delay = no 38 | # 39 | # You could add additional ones going to other VNC servers: 40 | # [vnc2] 41 | # accept = localhost:5901 42 | # connect = HOST2:PORT2 43 | # etc ... 44 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/stunnel-server.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Example SSL stunnel SERVER configuration file. (e.g. for your VNC 3 | # server on this same machine.) 4 | # 5 | # To use this file you may need to edit it. Then you will need 6 | # to manually start up stunnel using it. 7 | # (e.g. /path/to/stunnel stunnel-server.conf) 8 | # 9 | # This is just an example and is not used by the tools in this package. 10 | # It is here in case you wanted to see how to add SSL support to any 11 | # VNC server you have. 12 | # 13 | RNDbytes = 2048 14 | RNDfile = bananarand.bin 15 | RNDoverwrite = yes 16 | # 17 | # Remote client certs could go here: 18 | # CApath = /path/to/.../crt-dir 19 | # CAfile = /path/to/.../foo.crt 20 | # verify = 2 21 | # My server cert could go here: 22 | # cert = /path/to/.../my.pem 23 | # 24 | [vnc] 25 | # 26 | # Set to local listening port number (e.g. 5901 for vnc display 1): 27 | # so the remote viewers would connect to: yourmachine:1 28 | # 29 | accept = 5901 30 | # 31 | # Set to localhost:port to connect to VNC server on this same machine: 32 | # (E.g. you run WinVNC on :0, preferably listening on localhost). 33 | # 34 | connect = localhost:5900 35 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/Windows/util/w98/location.url: -------------------------------------------------------------------------------- 1 | ftp://ftp.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/DIAGNOSE/ 2 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/bin/Darwin.Power.Macintosh/.cpover: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp -p vncviewer.sh vncviewer 4 | pwd 5 | ls -l vncviewer.sh vncviewer 6 | 7 | (cd ../Darwin.i386; .cpover) 8 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/bin/Darwin.Power.Macintosh/vncviewer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # copy "vncviewer.sh" back over to "vncviewer" in case you delete or overwrite it 4 | # via build.unix. etc 5 | 6 | dir=`dirname "$0"` 7 | 8 | if [ "X$SSVNC_DYLD_LIBRARY_PATH" != "X" ]; then 9 | if [ "X$DYLD_LIBRARY_PATH" = "X" ] ; then 10 | DYLD_LIBRARY_PATH=$SSVNC_DYLD_LIBRARY_PATH 11 | else 12 | DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$SSVNC_DYLD_LIBRARY_PATH 13 | fi 14 | export DYLD_LIBRARY_PATH 15 | fi 16 | 17 | if [ "X$DISPLAY" != "X" -a "X$DARWIN_COTVNC" != "X1" ]; then 18 | "$dir/vncviewer.x11" "$@" 19 | else 20 | args="" 21 | for a in "$@" 22 | do 23 | if echo "$a" | grep '^-' > /dev/null; then 24 | args="$args $a" 25 | elif echo "$a" | grep ':' > /dev/null; then 26 | h=`echo "$a" | awk -F: '{print $1}'` 27 | p=`echo "$a" | awk -F: '{print $2}'` 28 | if [ "X$p" != "X" ]; then 29 | if [ $p -lt 5900 ]; then 30 | p=`expr $p + 5900` 31 | fi 32 | fi 33 | args="$args $h:$p" 34 | else 35 | args="$args $a" 36 | fi 37 | done 38 | "$dir/../../MacOSX/Chicken of the VNC.app/Contents/MacOS/Chicken of the VNC" $args 39 | fi 40 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/bin/Darwin.i386/.cpover: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp -p ../Darwin.Power.Macintosh/vncviewer.sh . 4 | cp -p vncviewer.sh vncviewer 5 | pwd 6 | ls -l vncviewer.sh vncviewer 7 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/bin/sshvnc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # wrapper for SSH_ONLY mode 4 | # 5 | PATH=`dirname "$0"`:$PATH; export PATH 6 | SSVNC_SSH_ONLY=1; export SSVNC_SSH_ONLY 7 | exec ssvnc -ssh "$@" 8 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/bin/tsvnc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # wrapper for TS_ONLY mode 4 | # 5 | PATH=`dirname "$0"`:$PATH; export PATH 6 | SSVNC_TS_ONLY=1; export SSVNC_TS_ONLY 7 | exec ssvnc -ts "$@" 8 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/bin/util/stunnel-server.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Example SSL stunnel SERVER configuration file. (e.g. for your VNC 3 | # server on this same machine.) 4 | # 5 | # To use this file you may need to edit it. Then you will need 6 | # to manually start up stunnel using it. 7 | # (e.g. /path/to/stunnel stunnel-server.conf) 8 | # 9 | # NOTE: You MUST specify a cert = PEM file line for server mode. 10 | # SSVNC or x11vnc can be used to create one if you like. 11 | # 12 | # This is just an example and is not used by the tools in this package. 13 | # It is here in case you wanted to see how to add SSL support to any 14 | # VNC server you have. 15 | # 16 | RNDbytes = 2048 17 | RNDfile = bananarand.bin 18 | RNDoverwrite = yes 19 | # 20 | # Remote client certs could go here: 21 | # CApath = /path/to/.../crt-dir 22 | # CAfile = /path/to/.../foo.crt 23 | # verify = 2 24 | # 25 | # The server cert goes here (**IT MUST BE SPECIFIED IN SERVER MODE**): 26 | # cert = /path/to/.../my.pem 27 | # 28 | [vnc] 29 | # 30 | # Set to local listening port number (e.g. 5901 for vnc display 1): 31 | # so the remote viewers would connect to: yourmachine:1 32 | # 33 | accept = 5901 34 | # 35 | # Set to localhost:port to connect to VNC server on this same machine: 36 | # (E.g. you run WinVNC on :0, preferably listening on localhost). 37 | # 38 | connect = localhost:5900 39 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/README: -------------------------------------------------------------------------------- 1 | 2 | In this directory we have source zip/tgz files in zip/, the patches 3 | we created in patches/, a temporary build dir (used by build.unix) 4 | in tmp/, and unpacked sources in vnc_unixsrc/ and stunnel-4.14/ (used 5 | by the build.unix script). 6 | 7 | See the README in the directory one level up for more information. 8 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/patches/README: -------------------------------------------------------------------------------- 1 | All of the patch files and scripts in this directory are 2 | 3 | Copyright (c) 2006 by Karl J. Runge 4 | 5 | and are licensed by the GPL. See the README and COPYING files two 6 | directories up for more information. 7 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/patches/_bundle: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -rf ./src/tmp/* || exit 1 4 | vers=1.0.28 5 | 6 | cd .. || exit 1 7 | 8 | cp -p ssvnc/bin/ssvnc_cmd ssvnc/bin/tightvncviewer 9 | 10 | ########################################### 11 | dest=./t.unix_only 12 | rm -rf $dest 13 | mkdir -p $dest || exit 1 14 | 15 | tar cvf - ssvnc/{README,COPYING,ssvnc.desktop} ssvnc/bin ssvnc/Unix | (cd $dest; tar xvf -) 16 | rm -f $dest/ssvnc/bin/.linkin 17 | 18 | tar=ssvnc_unix_only-${vers}.tar.gz 19 | (cd $dest; tar czvf ../$tar ssvnc) 20 | ls -l $tar 21 | rm -rf $dest 22 | 23 | ########################################### 24 | dest=./t.unix_minimal 25 | rm -rf $dest 26 | mkdir -p $dest || exit 1 27 | 28 | tar cvf - ssvnc/{README,COPYING,ssvnc.desktop} ssvnc/bin/{ss*,util/ss*} | (cd $dest; tar xvf -) 29 | 30 | tar=ssvnc_unix_minimal-${vers}.tar.gz 31 | (cd $dest; tar czvf ../$tar ssvnc) 32 | ls -l $tar 33 | rm -rf $dest 34 | 35 | top='#!/bin/sh 36 | n=11 37 | tmp=`mktemp -d "/tmp/ssvnc.XXXXXX"` || exit 1 38 | if [ "X$tmp" = "X" -o ! -d "$tmp" ]; then exit 1; fi 39 | trap "cd /tmp; rm -rf $tmp" 0 2 15 40 | 41 | tail +$n "$0" | (cd $tmp; tar xf -) || exit 1 42 | $tmp/bin/ssvnc "$@" 43 | exit 0 44 | data__() {' 45 | 46 | scr=./ssvnc.sh 47 | echo "$top" > $scr 48 | (cd ssvnc; tar cvf - README COPYING ssvnc.desktop bin/{ss*,util/ss*}) >> $scr 49 | chmod 755 $scr 50 | ls -l $scr 51 | 52 | if [ "X$1" = "Xquick" ]; then 53 | exit 0 54 | fi 55 | 56 | ########################################### 57 | rm -f ssvnc_all-$vers.zip 58 | rm -f ssvnc-$vers.zip 59 | zip -9 -r ssvnc_all-$vers.zip ssvnc 60 | zip -9 -r ssvnc-$vers.zip ssvnc -x '*.zip' '*.tar.gz' 61 | tar cvf - --exclude='*.zip' --exclude='*.tar.gz' ssvnc | gzip -9 > ssvnc-$vers.tar.gz 62 | tar cvf - --exclude='*.zip' --exclude='*.tar.gz' --exclude='*.dll' --exclude='*.exe' --exclude ssvnc/Windows/util ssvnc | gzip -9 > ssvnc_no_windows-$vers.tar.gz 63 | 64 | echo 65 | ls -l ssvnc*-$vers.* 66 | echo 67 | 68 | 69 | ########################################### 70 | dest=./t.windows_only 71 | rm -rf ${dest} 72 | mkdir -p $dest || exit 1 73 | 74 | cp -pR ssvnc $dest 75 | rm -rf $dest/ssvnc/{src,bin,man} 76 | rm -rf $dest/ssvnc/MacOSX 77 | rm -rf $dest/ssvnc/Unix 78 | rm -f $dest/ssvnc/build.unix 79 | rm -f $dest/ssvnc/filelist.txt 80 | cp -p ssvnc/bin/util/ssvnc.tcl $dest/ssvnc/Windows/util 81 | 82 | zip=ssvnc_windows_only-${vers}.zip 83 | rm -f $zip 84 | (cd $dest; zip -9 -r ../$zip ssvnc) 85 | 86 | ls -l $zip 87 | rm -rf $dest 88 | 89 | 90 | sync 91 | echo 92 | for g in ssvnc*-$vers*.gz 93 | do 94 | md5sum $g 95 | gzip -t $g || (tput bel; sleep 2) 96 | done 97 | for g in ssvnc*-$vers*.zip 98 | do 99 | md5sum $g 100 | done 101 | 102 | sleep 3 103 | echo 104 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/patches/_getpatches: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ ! -f ./_getpatches ]; then 4 | ls -l ./_getpatches 5 | exit 1 6 | fi 7 | 8 | cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/tight-vncviewer*patch . 9 | cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/vnc_unixsrc_vncviewer.patched.tar ../zips/ 10 | 11 | cp -p /dist/src/apps/VNC/etc/libvncserver_cvs/expts/java_ssl/ultra/ultraftp.tar ../zips/ 12 | cp -p /dist/src/apps/VNC/etc/libvncserver_cvs/expts/vncstorepw.tar ../zips/ 13 | 14 | cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/vnc_unixsrc/vncviewer/vncviewer.man ../../man/man1/ssvncviewer.1 15 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/patches/_vncpatchapplied: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | make clean 4 | rm -f *.o 5 | cd ../.. 6 | tar -cvf ../../zips/vnc_unixsrc_vncviewer.patched.tar vnc_unixsrc/vncviewer 7 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/patches/stunnel-maxconn.patch: -------------------------------------------------------------------------------- 1 | diff -Naur stunnel.orig/src/client.c stunnel/src/client.c 2 | --- stunnel.orig/src/client.c 2010-04-04 17:00:29.000000000 -0400 3 | +++ stunnel/src/client.c 2010-04-12 17:12:47.000000000 -0400 4 | @@ -187,6 +187,7 @@ 5 | enter_critical_section(CRIT_CLIENTS); /* for multi-cpu machines */ 6 | s_log(LOG_DEBUG, "Service %s finished (%d left)", c->opt->servname, 7 | --num_clients); 8 | + if (getenv("STUNNEL_ONCE")) {fprintf(stderr, "stunnel: exiting.\n"); exit(0);} 9 | leave_critical_section(CRIT_CLIENTS); 10 | #endif 11 | } 12 | diff -Naur stunnel.orig/src/network.c stunnel/src/network.c 13 | --- stunnel.orig/src/network.c 2010-02-04 05:31:45.000000000 -0500 14 | +++ stunnel/src/network.c 2010-04-12 17:13:53.000000000 -0400 15 | @@ -437,6 +437,7 @@ 16 | if((pid=wait(&status))>0) { 17 | --num_clients; /* one client less */ 18 | #endif 19 | + if (getenv("STUNNEL_ONCE")) exit(0); 20 | #ifdef WIFSIGNALED 21 | if(WIFSIGNALED(status)) { 22 | s_log(LOG_DEBUG, "Process %d terminated on signal %d (%d left)", 23 | diff -Naur stunnel.orig/src/options.c stunnel/src/options.c 24 | --- stunnel.orig/src/options.c 2010-04-05 14:44:43.000000000 -0400 25 | +++ stunnel/src/options.c 2010-04-12 17:19:18.000000000 -0400 26 | @@ -470,6 +470,7 @@ 27 | switch(cmd) { 28 | case CMD_INIT: 29 | new_global_options.option.syslog=1; 30 | + if (getenv("STUNNEL_NO_SYSLOG")) new_global_options.option.syslog=0; 31 | break; 32 | case CMD_EXEC: 33 | if(strcasecmp(opt, "syslog")) 34 | diff -Naur stunnel.orig/src/stunnel.c stunnel/src/stunnel.c 35 | --- stunnel.orig/src/stunnel.c 2010-02-25 04:57:11.000000000 -0500 36 | +++ stunnel/src/stunnel.c 2010-04-12 17:16:33.000000000 -0400 37 | @@ -306,6 +306,7 @@ 38 | max_clients=0; 39 | s_log(LOG_NOTICE, "No limit detected for the number of clients"); 40 | } 41 | + if (getenv("STUNNEL_MAX_CLIENTS")) max_clients = atoi(getenv("STUNNEL_MAX_CLIENTS")); 42 | } 43 | 44 | #ifdef HAVE_CHROOT 45 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-fullscreen.patch: -------------------------------------------------------------------------------- 1 | --- vnc_unixsrc.orig/vncviewer/fullscreen.c 2003-10-09 05:23:49.000000000 -0400 2 | +++ vnc_unixsrc/vncviewer/fullscreen.c 2004-12-26 21:21:44.000000000 -0500 3 | @@ -173,9 +173,15 @@ 4 | XtVaSetValues(popup, XtNoverrideRedirect, True, NULL); 5 | 6 | /* Try to get the input focus. */ 7 | - 8 | + 9 | +#if 0 10 | XSetInputFocus(dpy, DefaultRootWindow(dpy), RevertToPointerRoot, 11 | CurrentTime); 12 | +#else 13 | + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, 14 | + CurrentTime); 15 | +#endif 16 | + 17 | 18 | /* Optionally, grab the keyboard. */ 19 | 20 | @@ -184,6 +190,10 @@ 21 | GrabModeAsync, CurrentTime) != GrabSuccess) { 22 | fprintf(stderr, "XtGrabKeyboard() failed.\n"); 23 | } 24 | +if (getenv("VNCVIEWER_GRAB_SERVER") != NULL) { /* runge bot of FullScreenOn */ 25 | + fprintf(stderr, "calling XGrabServer(dpy)\n"); 26 | + XGrabServer(dpy); 27 | +} 28 | } 29 | 30 | 31 | @@ -210,6 +220,11 @@ 32 | 33 | appData.fullScreen = False; 34 | 35 | +if (getenv("VNCVIEWER_GRAB_SERVER") != NULL) { /* runge top of FullScreenOff */ 36 | + fprintf(stderr, "calling XUngrabServer(dpy)\n"); 37 | + XUngrabServer(dpy); 38 | +} 39 | + 40 | if (appData.grabKeyboard) 41 | XtUngrabKeyboard(desktop, CurrentTime); 42 | 43 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/src/zips/README: -------------------------------------------------------------------------------- 1 | This is where we keep the 3rd party source zip and tar.gz files used 2 | to build this package. 3 | 4 | www.stunnel.org source 488512 Jul 25 15:09 stunnel-4.14.tar.gz 5 | http://stunnel.mirt.net 6 | www.tightvnc.com source 2182134 Jul 25 15:11 tightvnc-1.3dev7_unixsrc.tar.gz 7 | www.tightvnc.com windows 8 | standalone viewer binary: 209149 Jul 25 15:10 tightvnc-1.3dev7_x86_viewer.zip 9 | 10 | To save space they may not be included in the package you downloaded. 11 | The should be included in the "ssvnc_all-.zip" file. 12 | Go to the websites indicated above or contact me if you cannot find them. 13 | 14 | The stunnel.patched.tar vnc_unixsrc_vncviewer.patched.tar 15 | files are tarballs of the original sources above with patches applied 16 | (used by build.unix script when patching fails). 17 | -------------------------------------------------------------------------------- /misc/enhanced_tightvnc_viewer/ssvnc.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | # Copy this file to "/usr/shared/applications/ssvnc.desktop" then SSVNC will 3 | # appear in desktop menus (once they are updated; e.g. update-menus command). 4 | Name=SSL/SSH VNC Viewer 5 | Comment=SSVNC - access remote VNC desktops 6 | Exec=ssvnc -noenc 7 | Icon=computer 8 | Terminal=false 9 | Type=Application 10 | StartupWMClass=Ssvnc.tcl 11 | Categories=Network;RemoteAccess; 12 | -------------------------------------------------------------------------------- /misc/panner.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # panner.pl: start up x11vnc in '-clip' mode viewing a small (WxH) 4 | # rectangular region of the screen. Allow the viewer user 5 | # to 'pan' around the display region by moving the mouse. 6 | # 7 | # Remote interaction with applications, e.g. clicking a 8 | # button though the VNC viewer, will be very difficult. 9 | # This may be useful in a 'demo' mode where the user sitting 10 | # at the physical display is the only one moving the mouse. 11 | # Depending on your usage the following x11vnc options may 12 | # be useful: -nonap 13 | # 14 | # Usage: panner.pl WxH (e.g. -display ...) 15 | # or panner.pl WxH:0.05 (e.g. 0.05 is polling time in secs.) 16 | 17 | use strict; 18 | 19 | my $WxH = shift; 20 | my $poll_time; 21 | 22 | # split off poll time: 23 | # 24 | ($WxH, $poll_time) = split(/:/, $WxH); 25 | my ($W, $H) = split(/x/, $WxH); 26 | 27 | $poll_time = 0.1 unless $poll_time ne ''; 28 | 29 | # set to x11vnc command (e.g. full PATH) 30 | # 31 | my $x11vnc = "x11vnc"; 32 | 33 | # check if display was given: 34 | # 35 | my $query_args = ""; 36 | for (my $i=0; $i < @ARGV; $i++) { 37 | if ($ARGV[$i] eq '-display') { 38 | $query_args = "-display $ARGV[$i+1]"; 39 | } 40 | } 41 | 42 | # find the size of display and the current mouse position: 43 | my %v; 44 | vset("DIRECT:wdpy_x,wdpy_y,pointer_x,pointer_y,pointer_same"); 45 | 46 | # set a -clip argument based on the above: 47 | # 48 | my $clip = ''; 49 | clip_set(); 50 | $clip = "${W}x${H}+0+0" unless $v{pointer_same}; 51 | 52 | # launch x11vnc with -clip in the background: 53 | # 54 | my $cmd = "$x11vnc -clip $clip -bg " . join(" ", @ARGV); 55 | print STDERR "running: $cmd\n"; 56 | system $cmd; 57 | 58 | # user can hit Ctrl-C or kill this script to quit (and stop x11vnc) 59 | # 60 | sub quit { 61 | system("$x11vnc $query_args -R stop"); 62 | exit 0; 63 | } 64 | 65 | $SIG{INT} = \&quit; 66 | $SIG{TERM} = \&quit; 67 | 68 | # loop forever waiting for mouse position to change, then shift -clip: 69 | # 70 | my $clip_old = $clip; 71 | while (1) { 72 | fsleep($poll_time); 73 | vset("pointer_x,pointer_y,pointer_same"); 74 | next unless $v{pointer_same}; 75 | clip_set(); 76 | if ($clip ne $clip_old) { 77 | system("$x11vnc $query_args -R clip:$clip"); 78 | $clip_old = $clip 79 | } 80 | } 81 | 82 | exit 0; 83 | 84 | # short sleep: 85 | # 86 | sub fsleep { 87 | my ($time) = @_; 88 | select(undef, undef, undef, $time) if $time; 89 | } 90 | 91 | # set the -clip string, making sure view doesn't go off edges of display: 92 | # 93 | sub clip_set { 94 | my $x = int($v{pointer_x} - $W/2); 95 | my $y = int($v{pointer_y} - $H/2); 96 | $x = 0 if $x < 0; 97 | $y = 0 if $y < 0; 98 | $x = $v{wdpy_x} - $W if $x + $W > $v{wdpy_x}; 99 | $y = $v{wdpy_y} - $H if $y + $H > $v{wdpy_y}; 100 | $clip = "${W}x${H}+$x+$y"; 101 | } 102 | 103 | # query x11vnc for values, put results in the %v hash: 104 | # 105 | sub vset { 106 | my $str = shift; 107 | my $out = `$x11vnc $query_args -Q $str 2>/dev/null`; 108 | chomp $out; 109 | foreach my $pair (split(/,/, $out)) { 110 | $pair =~ s/^a..=//; 111 | my ($k, $v) = split(/:/, $pair, 2); 112 | if ($k ne '' && $v ne '') { 113 | print STDERR "k=$k v=$v\n" if $ENV{DEBUG}; 114 | $v{$k} = $v; 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /misc/ranfb.pl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -- # A comment mentioning perl 2 | eval 'exec perl -S $0 ${1+"$@"}' 3 | if 0; 4 | 5 | # ranfb.pl: example -rawfb setup program. 6 | # E.g. x11vnc -rawfb setup:./ranfb.pl 7 | 8 | # can supply WxH or W H on cmd line: 9 | if ($ARGV[0] =~ /^(\d+)x(\d+)$/) { 10 | $W = $1; 11 | $H = $2; 12 | } else { 13 | $W = shift; 14 | $H = shift; 15 | } 16 | 17 | $W = 480 unless $W; 18 | $H = 360 unless $H; 19 | 20 | $fb = "/tmp/ranfb.$$"; 21 | open(FB, ">$fb") || die "$!"; 22 | 23 | $ones = "\377" x ($W * 4); 24 | for ($y = 0; $y < $H; $y++) { 25 | print FB $ones; 26 | } 27 | 28 | if (fork) { 29 | print "map:$fb\@${W}x${H}x32\n"; 30 | exit 0; 31 | } 32 | 33 | srand(); 34 | while (1) { 35 | showpic(); 36 | if (! kill 0, $ENV{X11VNC_PID}) { 37 | print STDERR "PID $ENV{X11VNC_PID} gone\n"; 38 | unlink($fb); 39 | exit; 40 | } 41 | } 42 | 43 | sub showpic { 44 | 45 | # 0 < x,y < 1; R1, R2, ... B4 random & scaled so R,G,B < 255: 46 | # R(x,y) = R1 + R2 * x + R3 * y + R4 * x * y 47 | # G(x,y) = G1 + G2 * x + G3 * y + G4 * x * y 48 | # B(x,y) = B1 + B2 * x + B3 * y + B4 * x * y 49 | 50 | $minfac = 0.25; 51 | foreach $c ('R', 'G', 'B') { 52 | $a1 = rand() * $minfac; 53 | $a2 = rand(); 54 | $a3 = rand(); 55 | $a4 = rand(); 56 | $at = $a1 + $a2 + $a3 + $a4; 57 | $a1 = 255 * ($a1/$at); 58 | $a2 = 255 * ($a2/$at); 59 | $a3 = 255 * ($a3/$at); 60 | $a4 = 255 * ($a4/$at); 61 | # invert axes randomly 62 | $ax = 0; $ax = 1 if rand() < 0.5; 63 | $ay = 0; $ay = 1 if rand() < 0.5; 64 | eval "\$${c}1 = \$a1"; 65 | eval "\$${c}2 = \$a2"; 66 | eval "\$${c}3 = \$a3"; 67 | eval "\$${c}4 = \$a4"; 68 | eval "\$${c}x = \$ax"; 69 | eval "\$${c}y = \$ay"; 70 | } 71 | 72 | for ($i = 0; $i < 256; $i++) { 73 | $p[$i] = pack("c", $i); 74 | } 75 | 76 | $Winv = 1.0/$W; 77 | $Hinv = 1.0/$H; 78 | 79 | $str = ''; 80 | for ($y = 0; $y < $H; $y++) { 81 | $yr = $yg = $yb = $y; 82 | $yr = $H - $yr if $Ry; 83 | $yg = $H - $yg if $Gy; 84 | $yb = $H - $yb if $By; 85 | $yr = $yr * $Hinv; 86 | $yg = $yg * $Hinv; 87 | $yb = $yb * $Hinv; 88 | 89 | $Y[3*$y+0] = $yr; 90 | $Y[3*$y+1] = $yg; 91 | $Y[3*$y+2] = $yb; 92 | } 93 | 94 | for ($x = 0; $x < $W; $x++) { 95 | $xr = $xg = $xb = $x; 96 | $xr = $W - $xr if $Rx; 97 | $xg = $W - $xg if $Gx; 98 | $xb = $W - $xb if $Bx; 99 | $xr = $xr * $Winv; 100 | $xg = $xg * $Winv; 101 | $xb = $xb * $Winv; 102 | 103 | $X[3*$x+0] = $xr; 104 | $X[3*$x+1] = $xg; 105 | $X[3*$x+2] = $xb; 106 | } 107 | 108 | for ($y = 0; $y < $H; $y++) { 109 | #$yr = $yg = $yb = $y; 110 | #$yr = $H - $yr if $Ry; 111 | #$yg = $H - $yg if $Gy; 112 | #$yb = $H - $yb if $By; 113 | #$yr = $yr * $Hinv; 114 | #$yg = $yg * $Hinv; 115 | #$yb = $yb * $Hinv; 116 | 117 | $yr = $Y[3*$y+0]; 118 | $yg = $Y[3*$y+1]; 119 | $yb = $Y[3*$y+2]; 120 | 121 | $RY1 = $R1 + $yr * $R3; 122 | $GY1 = $G1 + $yg * $G3; 123 | $BY1 = $B1 + $yb * $B3; 124 | 125 | $RY2 = $R2 + $yr * $R4; 126 | $GY2 = $G2 + $yg * $G4; 127 | $BY2 = $B2 + $yb * $B4; 128 | 129 | for ($x = 0; $x < $W; $x++) { 130 | #$xr = $xg = $xb = $x; 131 | #$xr = $W - $xr if $Rx; 132 | #$xg = $W - $xg if $Gx; 133 | #$xb = $W - $xb if $Bx; 134 | #$xr = $xr * $Winv; 135 | #$xg = $xg * $Winv; 136 | #$xb = $xb * $Winv; 137 | 138 | $n = 3 * $x; 139 | 140 | #$v = int($R1 + $xr*$R2 + $yr*$R3 + $xr*$yr*$R4); 141 | $v = int($RY1 + $X[$n]*$RY2); 142 | $str .= $p[$v]; 143 | 144 | #$v = int($G1 + $xg*$G2 + $yg*$G3 + $xg*$yg*$G4); 145 | $v = int($GY1 + $X[$n+1]*$GY2); 146 | $str .= $p[$v]; 147 | 148 | #$v = int($B1 + $xb*$B2 + $yb*$B3 + $xb*$yb*$B4); 149 | $v = int($BY1 + $X[$n+2]*$BY2); 150 | $str .= $p[$v]; 151 | 152 | $str .= "\0"; 153 | } 154 | } 155 | seek(FB, 0, 0); 156 | print FB $str; 157 | } 158 | -------------------------------------------------------------------------------- /misc/rx11vnc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # usage: rx11vnc [-s] : 4 | # rx11vnc [-s] (assumes xdisplay is 0) 5 | # 6 | # -s means use ssh instead of rsh. 7 | # -S tries to tunnel the vnc traffic thru ssh. (experimental...) 8 | # 9 | #set -xv 10 | 11 | # 12 | # Place your x11vnc cmd + options here (must have -bg and -display 13 | # with -display as the last one) 14 | # 15 | cmd="x11vnc -nap -q -bg -display" 16 | viewer="vncviewer" 17 | rsh=rsh 18 | 19 | # 20 | # The following two settings are only used under -S (ssh tunnel) 21 | # 22 | # Unfortunately, we have to set up the ssh port redirection *before* 23 | # x11vnc has started and selected its listening port. 24 | # tunnel_ports is a list of ports we expect/hope to be free on both 25 | # the local and remote machines: 26 | # 27 | tunnel_ports="5900 5901 5902 5903" 28 | # 29 | # VNC has a poor default in that if the client appears to be emanating 30 | # from the local machine, then raw encoding is preferred. With ssh port 31 | # redirection we appear to be coming from the localhost, but we are not. 32 | # We pass this encoding list to the viewer to give lowest preference to 33 | # raw encoding: 34 | # 35 | tunnel_encodings="copyrect tight zrle hextile zlib corre rre" 36 | 37 | if [ "$USER" = "runge" ]; then 38 | cmd="x11vnc.expt -nap -q -bg -rfbauth .vnc/passwd -display" 39 | viewer="vncviewerz" 40 | fi 41 | 42 | if [ "X$1" = "X-s" ]; then 43 | shift 44 | rsh=ssh 45 | elif [ "X$1" = "X-S" ]; then 46 | shift 47 | rsh=ssh 48 | tunnel=1 49 | cmd=`echo "$cmd" | sed -e 's/ / -localhost /'` 50 | fi 51 | 52 | remote=$1 53 | if echo "$remote" | grep ':' > /dev/null; then 54 | : 55 | else 56 | remote="$remote:0" 57 | fi 58 | 59 | host=`echo "$remote" | awk -F: '{print $1}'` 60 | disp=`echo "$remote" | awk -F: '{print $2}'` 61 | disp=":$disp" 62 | if [ "X$host" = "X" ]; then 63 | echo "bad host." 64 | exit 1 65 | fi 66 | 67 | # start the remote x11vnc: 68 | if [ $tunnel ]; then 69 | # much more kludgy for tunnelling: 70 | tmp=/tmp/rx11vnc.$$ 71 | redir="" 72 | used_ports=`netstat -an | egrep '(ESTABLISHED|LISTEN) *$' \ 73 | | sed -e 's/^[ ]*//' -e 's/^tcp[ 0-9][ 0-9]*//' \ 74 | -e 's/[ ].*$//' -e 's/^.*[^0-9]//' | sort -nu` 75 | for p in $tunnel_ports 76 | do 77 | ok=1 78 | for u in $used_ports 79 | do 80 | if [ "X$p" = "X$u" ]; then 81 | echo "port $u is in use. skipping it" 82 | ok= 83 | break 84 | fi 85 | done 86 | if [ $ok ]; then 87 | redir="$redir -L $p:localhost:$p" 88 | fi 89 | done 90 | # 91 | # Have ssh put the command in the bg, then we look for PORT= 92 | # in the tmp file. The sleep at the end is to give us enough 93 | # time to connect thru the port redir, otherwise ssh will exit 94 | # before we can connect. 95 | # 96 | time=15 97 | $rsh -t -f $redir $host "$cmd $disp; echo END; sleep $time" > $tmp 98 | 99 | i=0 100 | while [ $i -lt $time ] 101 | do 102 | sleep 1 103 | if grep '^PORT=' $tmp > /dev/null; then 104 | port=`grep '^PORT=' $tmp | sed -e 's/PORT=//'` 105 | if [ "X$port" != "X" ]; then 106 | break 107 | fi 108 | fi 109 | i=`expr $i + 1` 110 | done 111 | cat $tmp 112 | rm -f $tmp 113 | else 114 | port=`$rsh $host "$cmd $disp" | grep '^PORT=' | sed -e 's/PORT=//'` 115 | fi 116 | 117 | echo "x11vnc port is '$port'" 118 | 119 | # now start up the viewer on this end: 120 | if echo "$port" | grep '^[0-9][0-9]*$' > /dev/null; then 121 | if [ $port -lt 6000 -a $port -ge 5900 ]; then 122 | # vncviewer special cases 0-99 123 | port=`expr $port - 5900` 124 | fi 125 | if [ $tunnel ]; then 126 | $viewer -encodings "$tunnel_encodings" "localhost:$port" 127 | else 128 | $viewer "$host:$port" 129 | fi 130 | else 131 | echo "bad port." 132 | exit 1 133 | fi 134 | -------------------------------------------------------------------------------- /misc/rx11vnc.pl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -- # A comment mentioning perl 2 | eval 'exec perl -S $0 ${1+"$@"}' 3 | if 0; 4 | # 5 | # Here is the remote x11vnc command. 6 | # Modify to your needs, required to have %DISP item that expands to X display 7 | # and the -bg option to go into the background. 8 | # 9 | $x11vnc_cmd = "x11vnc -localhost -nap -q -bg -display %DISP"; 10 | 11 | # 12 | # We will redir local ports to these remote ports hoping the remote 13 | # x11vnc selects one of them: 14 | # 15 | @tunnel_ports = qw(5900 5901 5902 5903 5904); 16 | 17 | # 18 | # We need to specify the encoding preferences since vncviewer will 19 | # mistakeningly prefer "raw" encoding for local connection. required to 20 | # have %VNC_ITEM to expand to localhost: 21 | 22 | # One really needs an -encodings option otherwise the vncviewer will 23 | # prefer 'raw' which is very slow. 24 | # 25 | $viewer_cmd = "vncviewer -encodings 'copyrect tight zrle hextile zlib corre rre' %VNC_DISP"; 26 | $sleep_time = 15; 27 | 28 | if ($ENV{USER} eq 'runge') { 29 | # my personal kludges: 30 | $viewer_cmd =~ s/vncviewer/vncviewerz/; # for tight 31 | $x11vnc_cmd .= ' -rfbauth .vnc/passwd'; # I always want rfbauth 32 | } 33 | 34 | chop($Program = `basename $0`); 35 | 36 | $Usage = <<"END"; 37 | 38 | $Program: wrapper to tunnel vncviewer <-> x11vnc VNC traffic through a ssh 39 | encrypted tunnel port redirection. 40 | 41 | Usage: $Program 42 | 43 | Options: 44 | -l ssh login as remote user 45 | 46 | -rfbauth this option is passed to the remote 47 | x11vnc command for passwd file. 48 | 49 | Notes: 50 | 51 | Example: $Program snoopy:0 52 | 53 | END 54 | 55 | LOOP: 56 | while (@ARGV) { 57 | $_ = shift; 58 | CASE: { 59 | /^-display$/ && ($remote_xdisplay = shift, last CASE); 60 | /^-rfbauth$/ && ($x11vnc_cmd .= ' -rfbauth ' . shift, last CASE); 61 | /^-l$/ && ($remote_user = ' -l ' . shift, last CASE); 62 | /^--$/ && (last LOOP); # -- means end of switches 63 | /^-(-.*)$/ && (unshift(@ARGV, $1), last CASE); 64 | /^(-h|-help)$/ && ((print STDOUT $Usage), exit 0, last CASE); 65 | if ( /^-(..+)$/ ) { # split bundled switches: 66 | local($y, $x) = ($1, ''); 67 | (unshift(@ARGV, $y), last CASE) if $y =~ /^-/; 68 | foreach $x (reverse(split(//, $y))) { unshift(@ARGV,"-$x") }; 69 | last CASE; 70 | } 71 | /^-/ && ((print STDERR "Invalid arg: $_\n$Usage"), exit 1, last CASE); 72 | unshift(@ARGV,$_); 73 | last LOOP; 74 | } 75 | } 76 | 77 | select(STDERR); $| = 1; 78 | select(STDOUT); $| = 1; 79 | 80 | # Determine the remote X display to connect to: 81 | $remote_xdisplay = shift if $remote_xdisplay eq ''; 82 | if ($remote_xdisplay !~ /:/) { 83 | $remote_xdisplay .= ':0'; # assume they mean :0 over there. 84 | } 85 | if ($remote_xdisplay =~ /:/) { 86 | $host = $`; 87 | $disp = ':' . $'; 88 | } else { 89 | die "bad X display: $remote_xdisplay, must be :\n"; 90 | } 91 | 92 | # 93 | # Get list of local ports in use so we can avoid them: 94 | # (tested on Linux and Solaris) 95 | # 96 | open(NETSTAT, "netstat -an|") || die "netstat -an: $!"; 97 | while () { 98 | chomp ($line = $_); 99 | next unless $line =~ /(ESTABLISHED|LISTEN|WAIT2?)\s*$/; 100 | $line =~ s/^\s*//; 101 | $line =~ s/^tcp[\s\d]*//; 102 | $line =~ s/\s.*$//; 103 | $line =~ s/^.*\D//; 104 | if ($line !~ /^\d+$/) { 105 | die "bad netstat line: $line from $_"; 106 | } 107 | $used_port{$line} = 1; 108 | } 109 | close(NETSTAT); 110 | 111 | # 112 | # Now match up free local ports with the desired remote ports 113 | # (note that the remote ones could be in use but that won't stop 114 | # the ssh with port redirs from succeeding) 115 | # 116 | $lport = 5900; 117 | $cnt = 0; 118 | foreach $rport (@tunnel_ports) { 119 | while ($used_port{$lport}) { 120 | $lport++; 121 | $cnt++; 122 | die "too hard to find local ports 5900-$lport" if $cnt > 200; 123 | } 124 | $port_map{$rport} = $lport; 125 | $lport++; 126 | } 127 | 128 | $redir = ''; 129 | foreach $rport (@tunnel_ports) { 130 | $redir .= " -L $port_map{$rport}:localhost:$rport"; 131 | } 132 | 133 | # 134 | # Have ssh put the command in the bg, then we look for PORT= in the 135 | # tmp file. The sleep at the end is to give us enough time to connect 136 | # thru the port redir, otherwise ssh will exit before we can connect. 137 | # 138 | 139 | # This is the x11vnc cmd for the remote side: 140 | $cmd = $x11vnc_cmd; 141 | $cmd =~ s/%DISP/$disp/; 142 | 143 | # This is the ssh cmd for the local side (this machine): 144 | $ssh_cmd = "ssh -t -f $remote_user $redir $host '$cmd; echo END; sleep $sleep_time'"; 145 | $ssh_cmd =~ s/ / /g; 146 | print STDERR "running ssh command:\n\n$ssh_cmd\n\n"; 147 | 148 | # 149 | # Run ssh and redir into a tmp file (assumes ssh will use /dev/tty 150 | # for password/passphrase dialog) 151 | # 152 | $tmp = "/tmp/rx.$$"; 153 | system("$ssh_cmd > $tmp"); 154 | 155 | # Now watch for the PORT=XXXX message: 156 | $sleep = 0; 157 | $rport = ''; 158 | print STDERR "\nWaiting for x11vnc to indicate its port .."; 159 | while ($sleep < $sleep_time + 10) { 160 | print STDERR "."; 161 | sleep(1); 162 | $sleep++; 163 | if (`cat $tmp` =~ /PORT=(\d+)/) { 164 | $rport = $1; 165 | # wait 1 more second for output: 166 | sleep(1); 167 | if (`cat $tmp` =~ /PORT=(\d+)/) { 168 | $rport = $1; 169 | } 170 | last; 171 | } 172 | } 173 | print STDERR "\n"; 174 | 175 | if (! $rport) { 176 | print STDERR `cat $tmp`; 177 | unlink($tmp); 178 | die "could not determine remote port.\n"; 179 | } 180 | unlink($tmp); 181 | 182 | # Find the remote to local mapping: 183 | $lport = $port_map{$rport}; 184 | print STDERR "remote port is: $rport (corresponds to port $lport here)\n"; 185 | if (! $lport) { 186 | die "could not determine local port redir.\n"; 187 | } 188 | 189 | # Apply the special casing vncviewer does for 5900 <= port < 6000 190 | if ($lport < 6000 && $lport >= 5900) { 191 | $lport = $lport - 5900; 192 | } 193 | 194 | # Finally, run the viewer. 195 | $cmd = $viewer_cmd; 196 | $cmd =~ s/%VNC_DISP/localhost:$lport/; 197 | 198 | print STDERR "running vncviewer command:\n\n$cmd\n\n"; 199 | system($cmd); 200 | -------------------------------------------------------------------------------- /misc/shm_clear: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # shm_clear: clean out unattached (NATTACH=0) shm segments. 4 | # See ipcs(1) and ipcrm(1). Tested on Linux, Solaris, and OpenBSD. 5 | # 6 | # Usage: 7 | # shm_clear list and prompt for removal of your unattached shm segments. 8 | # shm_clear -y assume "yes" to all the removal prompts. 9 | # shm_clear -l only list (all of) your shm segments and exit. 10 | # 11 | 12 | #set -xv 13 | if echo "$1" | grep '^-h' > /dev/null; then 14 | # -h or -help 15 | tail +3 $0 | head -9 16 | exit 17 | fi 18 | 19 | if [ "X$USER" = "X" ]; then 20 | USER=$LOGNAME 21 | fi 22 | l_arg="shmid.*owner|CREATOR|$USER" 23 | 24 | # set up OS dependent cmdline opts, etc. 25 | if [ `uname` = "Linux" ]; then 26 | m_arg="-m" 27 | r_arg="shm" 28 | g_arg="^0x" 29 | s_cmd="ipcs $m_arg -i %ID" 30 | awkcut='{print $2, $6}' 31 | elif [ `uname` = "SunOS" -o `uname` = "OpenBSD" ]; then 32 | m_arg="-ma" 33 | r_arg="-m" 34 | g_arg="^m" 35 | s_cmd="ipcs $m_arg | egrep ' %ID |CREATOR' | grep -v IPC.status" 36 | awkcut='{print $2, $9}' 37 | else 38 | echo unsupported OS: `uname` 39 | exit 1 40 | fi 41 | 42 | list() { 43 | if [ "X$1" = "X-L" ]; then 44 | l_arg="$l_arg|." 45 | echo "All shm segments for all:" 46 | else 47 | echo "All shm segments for $USER:" 48 | fi 49 | ipcs $m_arg | egrep "$l_arg" 50 | echo 51 | } 52 | 53 | show() { 54 | cmd=`echo "$s_cmd" | sed -e "s/%ID/$1/g"` 55 | eval $cmd 56 | } 57 | 58 | remove() { 59 | echo ipcrm $r_arg $1 60 | ipcrm $r_arg $1 61 | } 62 | 63 | if [ "X$1" = "X-l" -o "X$1" = "X-L" ]; then 64 | # list only. both attached and unattached listed. 65 | list $1 66 | exit 0 67 | fi 68 | 69 | if [ "X$1" = "X-y" ]; then 70 | shift 71 | yes=1 # assume "yes" to all delete questions. 72 | else 73 | yes="" 74 | fi 75 | 76 | list 77 | 78 | ids=`ipcs $m_arg | grep "$g_arg" | grep $USER | awk "$awkcut" | grep ' 0$' | awk '{print $1}'` 79 | if [ "X$ids" = "X" ]; then 80 | echo "No unattached shmids for $USER." 81 | fi 82 | 83 | for id in $ids 84 | do 85 | if [ $yes ]; then 86 | : 87 | else 88 | echo "-------------------------------------" 89 | show $id 90 | printf "\nDelete? [y]/n " 91 | read x 92 | if echo "$x" | grep -i n > /dev/null; then 93 | continue 94 | fi 95 | fi 96 | remove $id 97 | done 98 | -------------------------------------------------------------------------------- /misc/slide.pl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -- # A comment mentioning perl 2 | eval 'exec perl -S $0 ${1+"$@"}' 3 | if 0; 4 | # 5 | # slide.pl: amusing example slideshow program for use with x11vnc -rawfb mode. 6 | # 7 | # E.g. x11vnc -rawfb map:/tmp/foo@640x480x32:ff/ff00/ff0000 -pipeinput slide.pl 8 | # 9 | # requires: jpegtopnm(1), (maybe LSB too). 10 | # 11 | 12 | @jpegs = qw( 13 | dr_fun_new.jpg canon.jpg go_microsoft.jpg jonathan2.jpg 14 | michelle1.jpg novm.jpg photo-008.jpg presrange.jpg 15 | ); 16 | 17 | # Or: 18 | # @jpegs = @ARGV; 19 | # @jpegs = <*.jpg>; 20 | 21 | # this is x11vnc's -rawfb value: 22 | if ($ENV{X11VNC_RAWFB_STR} =~ m,:(.*)@(\d+)x(\d+)x(\d+),) { 23 | $fb = $1; # filename 24 | $W = $2; # width 25 | $H = $3; # height 26 | } else { 27 | die "No usable X11VNC_RAWFB_STR\n"; 28 | } 29 | 30 | open(FB, ">$fb") || die "$!"; 31 | 32 | # make a solid background: 33 | $ones = "\377" x ($W * 4); 34 | $grey = "\340" x ($W * 4); 35 | for ($y = 0; $y < $H; $y++) { 36 | print FB $grey; 37 | } 38 | 39 | # this is rather slow with many jpegs... oh well. 40 | foreach $pic (@jpegs) { 41 | print STDERR "loading '$pic' please wait ...\n"; 42 | open(JPEG, "jpegtopnm '$pic' 2>/dev/null|") || die "$!"; 43 | while () { 44 | next if /^P\d/; 45 | if (/^(\d+)\s+(\d+)\s*$/) { 46 | $Jpeg{$pic}{w} = $1; 47 | $Jpeg{$pic}{h} = $2; 48 | } 49 | last if /^255$/; 50 | } 51 | $data = ''; 52 | while () { 53 | $data .= $_; 54 | } 55 | close(JPEG); 56 | 57 | # need to put in a 4th 0 byte after RGB for 32bpp. 24bpp doesn't work. 58 | # (MSB might be other way around). 59 | 60 | $new = ''; 61 | for ($l = 0; $l < int(length($data)/3); $l++) { 62 | $new .= substr($data, $l * 3, 3) . "\0"; 63 | } 64 | $Jpeg{$pic}{data} = $new; 65 | $data = ''; $new = ''; 66 | 67 | if ($pic eq $jpegs[0]) { 68 | showpic(0); 69 | } 70 | } 71 | 72 | $N = scalar(@jpegs); 73 | print STDERR "\nFinished loading $N images. Click Button or Spacebar for next.\n"; 74 | $I = 0; 75 | 76 | while (<>) { 77 | # read the next user input event, watch for button press or spacebar: 78 | ###last if /^Keysym.* [qQ] /; 79 | next unless /^(Pointer.*ButtonPress|Keysym.*space.*KeyPress)/; 80 | $I = ($I + 1) % $N; 81 | showpic($I); 82 | } 83 | 84 | sub showpic { 85 | my($i) = @_; 86 | 87 | my $pic = $jpegs[$i]; 88 | my $h = $Jpeg{$pic}{h}; 89 | my $w = $Jpeg{$pic}{w}; 90 | 91 | my $dy = int(($H - $h)/2); 92 | my $dx = int(($W - $w)/2); 93 | 94 | print STDERR "showing pic $i: $pic\t$w x $h +$dy+$dx\n"; 95 | 96 | # clear screen: 97 | seek(FB, 0, 0); 98 | for ($y = 0; $y < $H; $y++) { 99 | print FB $ones; 100 | } 101 | 102 | # insert new picture: 103 | for ($y = 0; $y < $h; $y++) { 104 | seek(FB, (($y + $dy) * $W + $dx) * 4, 0); 105 | $line = substr($Jpeg{$pic}{data}, $y * $w * 4, $w * 4); 106 | print FB $line; 107 | } 108 | } 109 | 110 | close(FB); 111 | ###unlink($fb); # this (probably) won't kill x11vnc 112 | print STDERR "$0 done.\n"; 113 | -------------------------------------------------------------------------------- /misc/turbovnc/Makefile.am: -------------------------------------------------------------------------------- 1 | # This file has been (or is hereby) released into the public domain by 2 | # its author, Karl J. Runge . This applies worldwide. 3 | # 4 | # In case this is not legally possible: Karl J. Runge grants anyone the 5 | # right to use this work for any purpose, without any conditions, unless 6 | # such conditions are required by law. 7 | 8 | EXTRA_DIST= \ 9 | README \ 10 | apply_turbovnc \ 11 | convert \ 12 | convert_rfbserver \ 13 | tight.c \ 14 | turbojpeg.h \ 15 | undo_turbovnc 16 | -------------------------------------------------------------------------------- /misc/turbovnc/README: -------------------------------------------------------------------------------- 1 | # 2 | # This work has been (or is hereby) released into the public domain by 3 | # its author, Karl J. Runge . This applies worldwide. 4 | # 5 | # In case this is not legally possible: Karl J. Runge grants anyone the 6 | # right to use this work for any purpose, without any conditions, unless 7 | # such conditions are required by law. 8 | # 9 | 10 | INTRO: 11 | ------ 12 | 13 | This is a "patch" to make x11vnc/libvncserver work with TurboVNC: 14 | 15 | http://www.virtualgl.org/About/TurboVNC 16 | http://www.karlrunge.com/x11vnc/faq.html#faq-turbovnc 17 | 18 | It is very experimental/kludgy. Not all TurboVNC features may be enabled. 19 | We are currently evaluating whether TurboVNC support should be officially 20 | put into x11vnc/libvncserver. 21 | 22 | TurboVNC is an optimized VNC for fast refresh rates on fast networks. 23 | 24 | It does pretty well on good broadband as well. But it is not as fast 25 | as regular TightVNC on slow links. 26 | 27 | 28 | TURBOJPEG: 29 | --------- 30 | 31 | TurboVNC uses the TurboJPEG library based on a fast proprietary JPEG 32 | implementation. You will need to download it from the VirtualGL 33 | sourceforge site: 34 | 35 | http://sourceforge.net/project/showfiles.php?group_id=117509&package_id=166100 36 | 37 | Either install it or simply unpack the .deb or .rpm file into a directory. 38 | 39 | N.B. you can unpack a .deb via 'ar x package.deb' and the extracting 40 | from the data.tar.gz file. rpm2cpio can be used to unpack .rpm's. 41 | 42 | 43 | QUICK-START: 44 | ------------ 45 | 46 | For those in a hurry: 47 | 48 | cd x11vnc-x.y.z/x11vnc/misc/turbovnc 49 | ./apply_turbovnc 50 | cd ../../.. 51 | env LDFLAGS='-L/DIR -Xlinker --rpath=/DIR' ./configure 52 | make AM_LDFLAGS='-lturbojpeg' 53 | 54 | where you replace /DIR with your directory containing libturbojpeg.so. 55 | 56 | 57 | PATCHING AND BUILDING: 58 | ---------------------- 59 | 60 | After unpacking your x11vnc-x.y.z.tar.gz tarball cd to the 61 | x11vnc-x.y.z/x11vnc/misc/turbovnc (where this README file is) and from 62 | that directory run: 63 | 64 | ./apply_turbovnc 65 | 66 | that will modify files in the libvncserver and x11vnc directories above 67 | this directory. (To undo these changes run: ./undo_turbovnc) The input 68 | sources, tight.c and turbojpeg.h are from the TurboVNC source package. 69 | 70 | After applying, go back to the top level source directory and run: 71 | 72 | env LDFLAGS='-L/path/to/turbojpeg -Xlinker --rpath=/path/to/turbojpeg' ./configure 73 | 74 | where the turbojpeg library is: 75 | 76 | /path/to/turbojpeg/libturbojpeg.so 77 | 78 | (change /path/to/turbojpeg to the directory where you installed or 79 | unpacked it.) 80 | 81 | If you are not using gnu gcc and gnu linker the options may be a little 82 | different (e.g. -R instead of -Xlinker --rpath). 83 | 84 | If you need additional ./configure options or env. var. settings, 85 | add them too. 86 | 87 | 88 | Next, run this make command: 89 | 90 | make AM_LDFLAGS='-lturbojpeg' 91 | 92 | This is a hack and may not always work, if it doesn't edit x11vnc/Makefile 93 | and add '-lturbojpeg' to the LIBS variable. 94 | 95 | This should create a binary: 96 | 97 | ./x11vnc/x11vnc 98 | 99 | that supports VirtualGL's TurboVNC. 100 | 101 | You will need a TurboVNC viewer, you can get one here: 102 | 103 | http://sourceforge.net/project/showfiles.php?group_id=117509&package_id=128130 104 | 105 | Let us know how it goes. 106 | 107 | 108 | PERFORMANCE: 109 | ------------ 110 | 111 | Note that x11vnc has to read the display's screen pixels from the 112 | graphics card memory. This can be slow, e.g. 10 MB/sec. 113 | 114 | There is not a big need for graphics card manufacturers to optimize the 115 | read rate; the write rate is the one they optimize greatly. 116 | 117 | http://www.karlrunge.com/x11vnc/#limitations 118 | 119 | If you run x11vnc and see lines like this: 120 | 121 | 28/02/2009 00:52:07 Autoprobing selected port 5900 122 | 28/02/2009 00:52:07 fb read rate: 10 MB/sec 123 | 28/02/2009 00:52:07 screen setup finished. 124 | 125 | you have a typical slow one. 126 | 127 | Whereas if you see this: 128 | 129 | 28/02/2009 00:54:46 Autoprobing selected port 5900 130 | 28/02/2009 00:54:46 fb read rate: 321 MB/sec 131 | 28/02/2009 00:54:46 fast read: reset wait ms to: 10 132 | 28/02/2009 00:54:46 fast read: reset defer ms to: 10 133 | 28/02/2009 00:54:46 screen setup finished. 134 | 135 | that is very fast. In such a situation you may want to dial down 136 | x11vnc's delay, e.g.: -wait 5 -defer 5, or even smaller to push things 137 | out more quickly. 138 | 139 | We have only seen it this fast on Linux by using the nvidia proprietary 140 | graphics drivers. The Xorg drivers are typically slow 10 MB/sec. 141 | 142 | It will also be fast if the X server is virtual: Xvfb or Xdummy 143 | since the screen pixels are stored in RAM: 144 | 145 | http://www.karlrunge.com/x11vnc/faq.html#faq-xvfb 146 | 147 | And it will be fast if the ShadowFB xorg.conf option is enabled (if the 148 | card supports it.) 149 | 150 | 151 | The point we are trying to make is that even though TurboVNC uses a 152 | wicked fast JPEG implementation, and cuts out overhead in its attempt to 153 | pump out as many frames per second as it can, if it is slow for x11vnc 154 | to read the screen pixels in the first place then you might not even 155 | notice the TurboVNC speedup. 156 | 157 | So TurboVNC+x11vnc will be faster than TightVNC+x11vnc, but if there is 158 | a large overhead/bottleneck from reading the graphics card framebuffer, 159 | then the speedup will be marginal. 160 | -------------------------------------------------------------------------------- /misc/turbovnc/apply_turbovnc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script has been (or is hereby) released into the public domain by 4 | # its author, Karl J. Runge . This applies worldwide. 5 | # 6 | # In case this is not legally possible: Karl J. Runge grants anyone the 7 | # right to use this work for any purpose, without any conditions, unless 8 | # such conditions are required by law. 9 | 10 | ldir="../../../libvncserver" 11 | 12 | fail="" 13 | if [ ! -f "./tight.c" ]; then 14 | fail=1 15 | fi 16 | if [ ! -f "./turbojpeg.h" ]; then 17 | fail=1 18 | fi 19 | if [ ! -f "./convert" ]; then 20 | fail=1 21 | fi 22 | if [ ! -f "$ldir/tight.c" ]; then 23 | ls -l "$ldir/tight.c" 24 | fail=1 25 | fi 26 | if [ ! -f "$ldir/rfbserver.c" ]; then 27 | ls -l "$ldir/rfbserver.c" 28 | fail=1 29 | fi 30 | if [ "X$fail" = "X1" ]; then 31 | echo "Must be run from inside the directory containing 'apply_turbovnc'" 32 | exit 1 33 | fi 34 | 35 | set -x 36 | if [ ! -f "$ldir/tight.c.ORIG" ]; then 37 | cp -p "$ldir/tight.c" "$ldir/tight.c.ORIG" 38 | fi 39 | if [ ! -f "$ldir/rfbserver.c.ORIG" ]; then 40 | cp -p "$ldir/rfbserver.c" "$ldir/rfbserver.c.ORIG" 41 | fi 42 | 43 | perl ./convert ./tight.c > "$ldir/tight.c" 44 | perl ./convert_rfbserver $ldir/rfbserver.c.ORIG > "$ldir/rfbserver.c" 45 | cp -p ./turbojpeg.h "$ldir" 46 | ls -l $ldir/tight.c* $ldir/rfbserver.c* $ldir/turbojpeg.h 47 | -------------------------------------------------------------------------------- /misc/turbovnc/convert: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # This script has been (or is hereby) released into the public domain by 4 | # its author, Karl J. Runge . This applies worldwide. 5 | # 6 | # In case this is not legally possible: Karl J. Runge grants anyone the 7 | # right to use this work for any purpose, without any conditions, unless 8 | # such conditions are required by law. 9 | 10 | while (<>) { 11 | if (/^#include.*"rfb.h"/) { 12 | print < 14 | #define Bool rfbBool 15 | #define CARD32 uint32_t 16 | #define CARD16 uint16_t 17 | #define CARD8 uint8_t 18 | #define xalloc malloc 19 | #define xrealloc realloc 20 | #define rfbTightNoZlib 0x0A 21 | #define tightSubsampLevel correMaxWidth 22 | 23 | #if LIBVNCSERVER_HAVE_LIBPTHREAD && LIBVNCSERVER_HAVE_TLS 24 | #define TLS __thread 25 | #else 26 | #define TLS 27 | #endif 28 | 29 | END 30 | next; 31 | } 32 | foreach $func (qw(FindBestSolidArea ExtendSolidArea CheckSolidTile CheckSolidTile##bpp CheckSolidTile8 CheckSolidTile16 CheckSolidTile32 Pack24)) { 33 | if (/static.*\b\Q$func\E\b/ && !exists $did_static{$func}) { 34 | $_ =~ s/\b\Q$func\E\b(\s*)\(/$func$1(rfbClientPtr cl, /; 35 | $did_static{$func} = 1; 36 | } elsif (/\b\Q$func\E\b\s*\(/) { 37 | $_ =~ s/\b\Q$func\E\b(\s*)\(/$func$1(cl, /; 38 | } 39 | } 40 | 41 | # if (/^\s*subsampLevel\s*=\s*cl/) { 42 | # $_ = "//$_"; 43 | # print "subsampLevel = 0;\n"; 44 | # } 45 | 46 | # $_ =~ s/cl->tightQualityLevel;/cl->tightQualityLevel * 10;/; 47 | 48 | if (/^static\s+(Bool|int|CARD32|PALETTE|char|unsigned|tjhandle)\s+[^()]*;\s*$/) { 49 | $_ =~ s/^static/static TLS /; 50 | } 51 | 52 | $_ =~ s/rfbScreen.pfbMemory/cl->scaledScreen->frameBuffer/g; 53 | $_ =~ s/rfbScreen.paddedWidthInBytes/cl->scaledScreen->paddedWidthInBytes/g; 54 | $_ =~ s/rfbScreen.bitsPerPixel/cl->scaledScreen->bitsPerPixel/g; 55 | $_ =~ s/rfbServerFormat/cl->screen->serverFormat/g; 56 | 57 | if (/^(FindBestSolidArea|ExtendSolidArea|static void Pack24|CheckSolidTile)\(cl/) { 58 | $_ .= "rfbClientPtr cl;\n"; 59 | } 60 | if (/^(CheckSolidTile##bpp)\(cl/) { 61 | $_ .= "rfbClientPtr cl; \\\n"; 62 | } 63 | $_ =~ s/\bublen\b/cl->ublen/; 64 | $_ =~ s/\bupdateBuf\b/cl->updateBuf/; 65 | 66 | if (/cl->(rfbRectanglesSent|rfbBytesSent)/) { 67 | $_ = "//$_"; 68 | } 69 | print; 70 | } 71 | 72 | print <. This applies worldwide. 5 | # 6 | # In case this is not legally possible: Karl J. Runge grants anyone the 7 | # right to use this work for any purpose, without any conditions, unless 8 | # such conditions are required by law. 9 | 10 | $saw_mark = 0; 11 | $done = 0; 12 | 13 | while (<>) { 14 | if (! $saw_mark && /case rfbEncodingServerIdentity:/) { 15 | $saw_mark = 1; 16 | } 17 | if ($saw_mark && !$done && /default:/) { 18 | print; 19 | 20 | print <= (uint32_t)rfbJpegSubsamp1X && 30 | enc <= (uint32_t)rfbJpegSubsampGray ) { 31 | /* XXX member really should be tightSubsample not correMaxWidth */ 32 | cl->correMaxWidth = enc & 0xFF; 33 | rfbLog("Using JPEG subsampling %d for client %s\\n", 34 | cl->correMaxWidth, cl->host); 35 | } else if ( enc >= (uint32_t)rfbEncodingQualityLevel0 && 36 | enc <= (uint32_t)rfbEncodingQualityLevel9 ) { 37 | static int JPEG_QUAL[10] = { 38 | 5, 10, 15, 25, 37, 50, 60, 70, 75, 80 39 | }; 40 | cl->tightQualityLevel = JPEG_QUAL[enc & 0x0F]; 41 | /* XXX member really should be tightSubsample not correMaxWidth */ 42 | cl->correMaxWidth = 2; 43 | rfbLog("Using image level Subsample %d Quality %d for client %s\\n", 44 | cl->correMaxWidth, cl->tightQualityLevel, cl->host); 45 | } else if ( enc >= (uint32_t)rfbJpegQualityLevel1 && 46 | enc <= (uint32_t)rfbJpegQualityLevel100 ) { 47 | cl->tightQualityLevel = enc & 0xFF; 48 | rfbLog("Using image quality level %d for client %s\\n", 49 | cl->tightQualityLevel, cl->host); 50 | } else 51 | END 52 | $done = 1; 53 | next; 54 | } 55 | print; 56 | } 57 | -------------------------------------------------------------------------------- /misc/turbovnc/undo_turbovnc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script has been (or is hereby) released into the public domain by 4 | # its author, Karl J. Runge . This applies worldwide. 5 | # 6 | # In case this is not legally possible: Karl J. Runge grants anyone the 7 | # right to use this work for any purpose, without any conditions, unless 8 | # such conditions are required by law. 9 | 10 | ldir="../../../libvncserver" 11 | 12 | if [ ! -f "$ldir/tight.c.ORIG" ]; then 13 | ls -l "$ldir/tight.c.ORIG" 14 | exit 1 15 | fi 16 | if [ ! -f "$ldir/rfbserver.c.ORIG" ]; then 17 | ls -l "$ldir/rfbserver.c.ORIG" 18 | exit 1 19 | fi 20 | 21 | set -xv 22 | rm -f "$ldir/tight.c" "$ldir/turbojpeg.h" 23 | mv "$ldir/tight.c.ORIG" "$ldir/tight.c" 24 | mv "$ldir/rfbserver.c.ORIG" "$ldir/rfbserver.c" 25 | ls -l $ldir/tight.c* $ldir/rfbserver.c* 26 | -------------------------------------------------------------------------------- /misc/vcinject.pl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -- # A comment mentioning perl 2 | eval 'exec perl -S $0 ${1+"$@"}' 3 | if 0; 4 | # 5 | # vcinject.pl: simple hack to inject keystrokes into Linux VC tty. 6 | # See LinuxVNC.c for a more careful treatment using C and public API. 7 | # 8 | # Usage: vcinject.pl (or /dev/ttyN) 9 | # 10 | # This is an example x11vnc -pipeinput program E.g.: 11 | # 12 | # x11vnc -rawfb map:/dev/fb0@1024x768x16 -pipeinput "vcinject.pl /dev/tty3" 13 | # 14 | # (see fbset(8) for obtaining fb info). 15 | # 16 | # It reads lines like this from STDIN: 17 | # 18 | # Keysym ... 19 | # 20 | # is ignored, it uses the rest to deduce the keystrokes to send 21 | # to the console. 22 | # 23 | 24 | $tty = shift; 25 | $tty = "/dev/tty$tty" if $tty =~ /^\d+$/; 26 | 27 | warn "strange tty device: $tty\n" if $tty !~ m,^/dev/tty\d+$,; 28 | 29 | open(TTY, ">$tty") || die "open $tty: $!\n"; 30 | $fd = fileno(TTY); 31 | 32 | $linux_ioctl_syscall = 54; # common knowledge, eh? :-) 33 | $TIOCSTI = 0x5412; 34 | 35 | %Map = qw( 36 | Escape 27 37 | Tab 9 38 | Return 13 39 | BackSpace 8 40 | Home 1 41 | End 5 42 | Up 16 43 | Down 14 44 | Right 6 45 | Left 2 46 | Next 6 47 | Prior 2 48 | ); 49 | # the latter few above seem to be vi specials. (since they are normally 50 | # escape sequences, e.g. ESC [ 5 ~) 51 | 52 | sub lookup { 53 | my($down, $key, $name) = @_; 54 | 55 | my $n = -1; 56 | $name =~ s/^KP_//; 57 | 58 | # algorithm borrowed from LinuxVNC.c: 59 | if (! $down) { 60 | if ($name =~ /^Control/) { 61 | $control--; 62 | } 63 | return $n; 64 | } 65 | 66 | if ($name =~ /^Control/) { 67 | $control++; 68 | } else { 69 | if (exists($Map{$name})) { 70 | $n = $Map{$name}; 71 | } 72 | if ($control && $name =~ /^[A-z]$/) { 73 | $n = ord($name); 74 | # shift down to the Control zone: 75 | if ($name =~ /[a-z]/) { 76 | $n -= (ord("a") - 1); 77 | } else { 78 | $n -= (ord("A") - 1); 79 | } 80 | } 81 | if ($n < 0 && $key < 256) { 82 | $n = $key; 83 | } 84 | } 85 | return $n; 86 | } 87 | 88 | $control = 0; 89 | $debug = 0; 90 | 91 | while (<>) { 92 | chomp; 93 | if (/^\w+$/) { 94 | # for debugging, you type the keysym in manually. 95 | $_ = "Keysym 1 0 999 $_ None"; 96 | } 97 | next unless /^Keysym/; 98 | 99 | my ($j, $id, $down, $k, $keysym, $rest) = split(' ', $_); 100 | 101 | $n = lookup($down, $k, $keysym); 102 | if ($n < 0 || $n > 255) { 103 | print STDERR "skip: '$keysym' -> $n\n" if $down && $debug; 104 | next; 105 | } 106 | 107 | $n_p = pack("c", $n); 108 | $ret = syscall($linux_ioctl_syscall, $fd, $TIOCSTI, $n_p); 109 | 110 | print STDERR "ctrl=$control $keysym/$k syscall(" . 111 | "$linux_ioctl_syscall, $fd, $TIOCSTI, $n) = $ret\n" if $debug; 112 | 113 | } 114 | -------------------------------------------------------------------------------- /misc/x11vnc_loop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # x11vnc_loop: 4 | # 5 | # Example startup script for connecting x11vnc to an X display 6 | # at system boot up and having it reconnect when the X server restarts. 7 | # 8 | # Run, in rc.local say, via, e.g.: 9 | # 10 | # /path/to/x11vnc_loop 1>> /var/tmp/x11vnc_loop.log 2>&1 & 11 | # 12 | # call with argument "once" or a number to limit the number of loops. 13 | # 14 | ########################################################################## 15 | # The following needs to be customized: 16 | x11vnc_cmd=x11vnc # or use full path (or set PATH). 17 | pwfile=/path/to/vnc/passwd # always use a password 18 | display=:0 # display of interest 19 | restart_sleep=5 # pause between X server restarts. 20 | 21 | # modify cmdline args if desired: 22 | x11vnc_args="-display $display -rfbauth $pwfile -forever -nap" 23 | 24 | # you may need to customize the "grep", etc, below in get_xauthority_file() 25 | ########################################################################## 26 | 27 | if [ "X$1" != "X" ]; then 28 | max=$1 29 | shift 30 | fi 31 | 32 | get_xauthority_file() { 33 | # 34 | # We need to find the MIT-COOKIE file... this not portable at all, 35 | # depends on OS, distro, desktop, phase of moon, etc... 36 | # 37 | # If the cookie file was fixed and you knew it, you could just 38 | # return it here e.g.: 39 | # 40 | ## echo "/var/gdm/:0.Xauth"; return 41 | # 42 | # or, if you knew the directory, you could look for the youngest 43 | # file there and return it e.g.: 44 | # 45 | ## echo `ls -t /var/lib/xdm/authdir/authfiles/* | head -1`; return 46 | 47 | # this hack tries to grep it out of ps output... 48 | xauth="" 49 | for i in 1 2 3 50 | do 51 | # very linux specific, and you likely need to tweak.. 52 | patt="X11R6.*/X.*-auth" 53 | xauth=`ps wwwaux | grep "$patt" \ 54 | | egrep -v 'grep|Xprt' | head -1 \ 55 | | sed -e 's/^.*-auth//' | awk '{print $1}'` 56 | 57 | if [ "X$xauth" != "X" ]; then 58 | break 59 | fi 60 | sleep 2 # wait a bit in case X server is restarting slowly. 61 | done 62 | echo $xauth 63 | } 64 | 65 | try=1 66 | while [ 1 ] 67 | do 68 | echo "`date` $0 try number: $try"; try=`expr $try + 1` 69 | 70 | auth=`get_xauthority_file` 71 | if [ ! -r "$auth" ]; then 72 | echo "`date` bad auth file: \"$auth\"" 73 | else 74 | cmd="$x11vnc_cmd $x11vnc_args" 75 | sleep 1 76 | echo "`date` running: $cmd -auth $auth" 77 | # run x11vnc: 78 | $cmd -auth $auth 79 | if [ "X$max" = "Xonce" ]; then 80 | exit $? 81 | fi 82 | fi 83 | if echo "$max" | grep '[0-9]' > /dev/null; then 84 | if [ $try -gt $max ]; then 85 | exit 86 | fi 87 | fi 88 | sleep $restart_sleep 89 | done 90 | -------------------------------------------------------------------------------- /misc/x11vnc_pw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # usage: x11vnc_pw [file] (default: ~/.vnc/passwd) 3 | 4 | if [ "X$1" = "X" ]; then 5 | file=$HOME/.vnc/passwd 6 | else 7 | file=$1 8 | fi 9 | 10 | stty -echo 11 | printf "Password: " 12 | read pw1; echo "" 13 | printf "Verify: " 14 | read pw2; echo "" 15 | stty echo 16 | 17 | if [ "X$pw1" != "X$pw2" ]; then 18 | echo "passwords do not match." 19 | exit 1 20 | fi 21 | 22 | x11vnc -help > /dev/null 2>&1 23 | x11vnc -storepasswd "$pw1" "$file" 24 | ls -l "$file" 25 | -------------------------------------------------------------------------------- /src/8to24.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_8TO24_H 34 | #define _X11VNC_8TO24_H 35 | 36 | /* -- 8to24.h -- */ 37 | 38 | extern int multivis_count; 39 | extern int multivis_24count; 40 | 41 | extern void check_for_multivis(void); 42 | extern void bpp8to24(int, int, int, int); 43 | extern void mark_8bpp(int); 44 | 45 | #endif /* _X11VNC_8TO24_H */ 46 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | LDADD = \ 2 | @LIBVNCSERVER_LIBS@ \ 3 | @LIBVNCCLIENT_LIBS@ \ 4 | @WSOCKLIB@ 5 | 6 | if OSX 7 | FRAMEWORKS = \ 8 | -framework ApplicationServices \ 9 | -framework Carbon \ 10 | -framework IOKit \ 11 | -framework Cocoa 12 | 13 | if OSX_OPENGL 14 | FRAMEWORKS += -framework OpenGL 15 | if HAVE_X11 16 | GL = /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib 17 | FRAMEWORKS += -dylib_file $(GL):$(GL) 18 | endif 19 | endif 20 | 21 | x11vnc_LDFLAGS = $(FRAMEWORKS) 22 | x11vnc_CFLAGS = -ObjC 23 | endif # OSX 24 | 25 | if CYGIPC 26 | LD_CYGIPC = -lcygipc 27 | endif 28 | 29 | bin_PROGRAMS = x11vnc 30 | x11vnc_SOURCES = \ 31 | 8to24.c \ 32 | 8to24.h \ 33 | allowed_input_t.h \ 34 | appshare.c \ 35 | avahi.c \ 36 | avahi.h \ 37 | blackout_t.h \ 38 | cleanup.c \ 39 | cleanup.h \ 40 | connections.c \ 41 | connections.h \ 42 | cursor.c \ 43 | cursor.h \ 44 | default8x16.h \ 45 | enc.h \ 46 | gui.c \ 47 | gui.h \ 48 | help.c \ 49 | help.h \ 50 | inet.c \ 51 | inet.h \ 52 | keyboard.c \ 53 | keyboard.h \ 54 | linuxfb.c \ 55 | linuxfb.h \ 56 | macosx.c \ 57 | macosxCG.c \ 58 | macosxCG.h \ 59 | macosxCGP.c \ 60 | macosxCGP.h \ 61 | macosxCGS.c \ 62 | macosxCGS.h \ 63 | macosx.h \ 64 | macosx_opengl.c \ 65 | macosx_opengl.h \ 66 | nox11_funcs.h \ 67 | nox11.h \ 68 | options.c \ 69 | options.h \ 70 | params.h \ 71 | pm.c \ 72 | pm.h \ 73 | pointer.c \ 74 | pointer.h \ 75 | rates.c \ 76 | rates.h \ 77 | remote.c \ 78 | remote.h \ 79 | scan.c \ 80 | scan.h \ 81 | screen.c \ 82 | screen.h \ 83 | scrollevent_t.h \ 84 | selection.c \ 85 | selection.h \ 86 | solid.c \ 87 | solid.h \ 88 | sslcmds.c \ 89 | sslcmds.h \ 90 | sslhelper.c \ 91 | sslhelper.h \ 92 | ssltools.h \ 93 | tkx11vnc.h \ 94 | uinput.c \ 95 | uinput.h \ 96 | unixpw.c \ 97 | unixpw.h \ 98 | user.c \ 99 | user.h \ 100 | userinput.c \ 101 | userinput.h \ 102 | util.c \ 103 | util.h \ 104 | v4l.c \ 105 | v4l.h \ 106 | winattr_t.h \ 107 | win_utils.c \ 108 | win_utils.h \ 109 | x11vnc.c \ 110 | x11vnc_defs.c \ 111 | x11vnc.h \ 112 | xdamage.c \ 113 | xdamage.h \ 114 | xevents.c \ 115 | xevents.h \ 116 | xi2_devices.c \ 117 | xi2_devices.h \ 118 | xinerama.c \ 119 | xinerama.h \ 120 | xkb_bell.c \ 121 | xkb_bell.h \ 122 | xrandr.c \ 123 | xrandr.h \ 124 | xrecord.c \ 125 | xrecord.h \ 126 | xwrappers.c \ 127 | xwrappers.h 128 | 129 | INCLUDES_LIBVNCSERVER = \ 130 | @LIBVNCSERVER_CFLAGS@ \ 131 | @LIBVNCCLIENT_CFLAGS@ 132 | 133 | AM_CPPFLAGS = \ 134 | $(INCLUDES_LIBVNCSERVER) \ 135 | @X_CFLAGS@ \ 136 | @AVAHI_CFLAGS@ \ 137 | @XI2_CFLAGS@ \ 138 | @CAIRO_CFLAGS@ 139 | 140 | x11vnc_LDADD = \ 141 | $(LDADD) \ 142 | @SSL_LIBS@ \ 143 | @DRM_LIBS@ \ 144 | @CRYPT_LIBS@ \ 145 | @X_LIBS@ \ 146 | @AVAHI_LIBS@ \ 147 | @XI2_LIBS@ \ 148 | @CAIRO_LIBS@ \ 149 | $(LD_CYGIPC) 150 | -------------------------------------------------------------------------------- /src/allowed_input_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_ALLOWED_INPUT_T_H 34 | #define _X11VNC_ALLOWED_INPUT_T_H 35 | 36 | /* -- allowed_input_t.h -- */ 37 | 38 | typedef struct allowed_input { 39 | int keystroke; 40 | int motion; 41 | int button; 42 | int clipboard; 43 | int files; 44 | } allowed_input_t; 45 | 46 | #endif /* _X11VNC_ALLOWED_INPUT_T_H */ 47 | -------------------------------------------------------------------------------- /src/avahi.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_AVAHI_H 34 | #define _X11VNC_AVAHI_H 35 | 36 | /* -- avahi.h -- */ 37 | 38 | extern void avahi_initialise(void); 39 | extern void avahi_advertise(char *name, char *host, uint16_t port); 40 | extern void avahi_reset(void); 41 | extern void avahi_cleanup(void); 42 | 43 | #endif /* _X11VNC_AVAHI_H */ 44 | -------------------------------------------------------------------------------- /src/blackout_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_BLACKOUT_T_H 34 | #define _X11VNC_BLACKOUT_T_H 35 | 36 | /* -- blackout_t.h -- */ 37 | 38 | typedef struct bout { 39 | int x1, y1, x2, y2; 40 | } blackout_t; 41 | 42 | #define BO_MAX 32 43 | typedef struct tbout { 44 | blackout_t bo[BO_MAX]; /* hardwired max rectangles. */ 45 | int cover; 46 | int count; 47 | } tile_blackout_t; 48 | 49 | #endif /* _X11VNC_BLACKOUT_T_H */ 50 | -------------------------------------------------------------------------------- /src/cleanup.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_CLEANUP_H 34 | #define _X11VNC_CLEANUP_H 35 | 36 | /* -- cleanup.h -- */ 37 | 38 | extern int trapped_xerror; 39 | extern int trapped_xioerror; 40 | extern int trapped_getimage_xerror; 41 | extern int trapped_record_xerror; 42 | extern XErrorEvent *trapped_xerror_event; 43 | 44 | extern int crash_debug; 45 | 46 | extern void clean_shm(int quick); 47 | extern void clean_up_exit(int ret); 48 | 49 | extern int trap_xerror(Display *d, XErrorEvent *error); 50 | extern int trap_xioerror(Display *d); 51 | extern int trap_getimage_xerror(Display *d, XErrorEvent *error); 52 | extern char *xerror_string(XErrorEvent *error); 53 | extern void initialize_crash_handler(void); 54 | extern void initialize_signals(void); 55 | extern void unset_signals(void); 56 | extern void close_exec_fds(void); 57 | extern int known_sigpipe_mode(char *s); 58 | 59 | #endif /* _X11VNC_CLEANUP_H */ 60 | -------------------------------------------------------------------------------- /src/connections.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_CONNECTIONS_H 34 | #define _X11VNC_CONNECTIONS_H 35 | 36 | /* -- connections.h -- */ 37 | 38 | extern char vnc_connect_str[]; 39 | extern Atom vnc_connect_prop; 40 | extern char x11vnc_remote_str[]; 41 | extern Atom x11vnc_remote_prop; 42 | extern rfbClientPtr inetd_client; 43 | 44 | 45 | extern int all_clients_initialized(void); 46 | extern char *list_clients(void); 47 | extern int new_fb_size_clients(rfbScreenInfoPtr s); 48 | extern void close_all_clients(void); 49 | extern void close_clients(char *str); 50 | extern void set_client_input(char *str); 51 | extern void set_child_info(void); 52 | extern int cmd_ok(char *cmd); 53 | extern void client_gone(rfbClientPtr client); 54 | extern void client_gone_chat_helper(rfbClientPtr client); 55 | extern void reverse_connect(char *str); 56 | extern void set_vnc_connect_prop(char *str); 57 | extern void read_vnc_connect_prop(int); 58 | extern void set_x11vnc_remote_prop(char *str); 59 | extern void read_x11vnc_remote_prop(int); 60 | extern void check_connect_inputs(void); 61 | extern void check_gui_inputs(void); 62 | extern rfbClientPtr create_new_client(int sock, int start_thread); 63 | extern enum rfbNewClientAction new_client(rfbClientPtr client); 64 | extern enum rfbNewClientAction new_client_chat_helper(rfbClientPtr client); 65 | extern rfbBool password_check_chat_helper(rfbClientPtr cl, const char* response, int len); 66 | extern void start_client_info_sock(char *host_port_cookie); 67 | extern void send_client_info(char *str); 68 | extern void adjust_grabs(int grab, int quiet); 69 | extern void check_new_clients(void); 70 | extern int accept_client(rfbClientPtr client); 71 | extern void check_ipv6_listen(long usec); 72 | extern void check_unix_sock(long usec); 73 | extern int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input, 74 | int len, FILE *output); 75 | extern int check_access(char *addr); 76 | extern void client_set_net(rfbClientPtr client); 77 | extern char *get_xprop(char *prop, Window win); 78 | extern int set_xprop(char *prop, Window win, char *value); 79 | extern char *bcx_xattach(char *str, int *pg_init, int *kg_init); 80 | extern void grab_state(int *ptr_grabbed, int *kbd_grabbed); 81 | extern char *wininfo(Window win, int show_children); 82 | 83 | #endif /* _X11VNC_CONNECTIONS_H */ 84 | -------------------------------------------------------------------------------- /src/cursor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_CURSOR_H 34 | #define _X11VNC_CURSOR_H 35 | 36 | /* -- cursor.h -- */ 37 | 38 | extern int xfixes_present; 39 | extern int xfixes_first_initialized; 40 | extern int use_xfixes; 41 | extern int got_xfixes_cursor_notify; 42 | extern int cursor_changes; 43 | extern int alpha_threshold; 44 | extern double alpha_frac; 45 | extern int alpha_remove; 46 | extern int alpha_blend; 47 | extern int alt_arrow; 48 | extern int alt_arrow_max; 49 | 50 | extern void first_cursor(void); 51 | extern void setup_cursors_and_push(void); 52 | extern void initialize_xfixes(void); 53 | extern int known_cursors_mode(char *s); 54 | extern void initialize_cursors_mode(void); 55 | extern int get_which_cursor(void); 56 | extern void restore_cursor_shape_updates(rfbScreenInfoPtr s); 57 | extern void disable_cursor_shape_updates(rfbScreenInfoPtr s); 58 | extern int cursor_shape_updates_clients(rfbScreenInfoPtr s); 59 | extern int cursor_noshape_updates_clients(rfbScreenInfoPtr s); 60 | extern int cursor_pos_updates_clients(rfbScreenInfoPtr s); 61 | extern void cursor_position(int x, int y, rfbClientPtr client); 62 | extern void set_no_cursor(void); 63 | extern void set_warrow_cursor(void); 64 | extern int set_cursor(int x, int y, int which); 65 | extern int check_x11_pointer(void); 66 | extern int store_cursor(int serial, uint32_t *data, int w, int h, int cbpp, int xhot, int yhot); 67 | extern unsigned long get_cursor_serial(int mode); 68 | extern rfbCursorPtr pixels2curs(uint32_t *pixels, int w, int h, int xhot, int yhot, int Bpp); 69 | void save_under_cursor_buffer(rfbClientPtr cl); 70 | void draw_cursor(rfbClientPtr cl); 71 | void restore_under_cursor_buffer(rfbClientPtr cl); 72 | 73 | #endif /* _X11VNC_CURSOR_H */ 74 | -------------------------------------------------------------------------------- /src/enums.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_ENUMS_H 34 | #define _X11VNC_ENUMS_H 35 | 36 | /* -- enums.h -- */ 37 | 38 | enum { 39 | LR_UNSET = 0, 40 | LR_UNKNOWN, 41 | LR_DIALUP, 42 | LR_BROADBAND, 43 | LR_LAN 44 | }; 45 | 46 | enum scroll_types { 47 | SCR_NONE = 0, 48 | SCR_MOUSE, 49 | SCR_KEY, 50 | SCR_FAIL, 51 | SCR_SUCCESS 52 | }; 53 | 54 | #endif /* _X11VNC_ENUMS_H */ 55 | -------------------------------------------------------------------------------- /src/gui.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_GUI_H 34 | #define _X11VNC_GUI_H 35 | 36 | /* -- gui.h -- */ 37 | 38 | extern int icon_mode; 39 | extern char *icon_mode_file; 40 | extern FILE *icon_mode_fh; 41 | extern int icon_mode_socks[]; 42 | extern int tray_manager_ok; 43 | extern Window tray_request; 44 | extern Window tray_window; 45 | extern int tray_unembed; 46 | extern pid_t run_gui_pid; 47 | extern pid_t gui_pid; 48 | 49 | extern char *get_gui_code(void); 50 | extern int tray_embed(Window iconwin, int remove); 51 | extern void do_gui(char *opts, int sleep); 52 | 53 | #endif /* _X11VNC_GUI_H */ 54 | -------------------------------------------------------------------------------- /src/help.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_HELP_H 34 | #define _X11VNC_HELP_H 35 | 36 | /* -- help.h -- */ 37 | 38 | extern void print_help(int mode); 39 | extern void print_license(void); 40 | extern void xopen_display_fail_message(char *disp); 41 | extern void nopassword_warning_msg(int gotloc); 42 | 43 | #endif /* _X11VNC_HELP_H */ 44 | -------------------------------------------------------------------------------- /src/inet.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_INET_H 34 | #define _X11VNC_INET_H 35 | 36 | /* -- inet.h -- */ 37 | 38 | extern char *host2ip(char *host); 39 | extern char *raw2host(char *raw, int len); 40 | extern char *raw2ip(char *raw); 41 | extern char *ip2host(char *ip); 42 | extern int ipv6_ip(char *host); 43 | extern int dotted_ip(char *host, int partial); 44 | extern int get_remote_port(int sock); 45 | extern int get_local_port(int sock); 46 | extern char *get_remote_host(int sock); 47 | extern char *get_local_host(int sock); 48 | extern char *ident_username(rfbClientPtr client); 49 | extern int find_free_port(int start, int end); 50 | extern int find_free_port6(int start, int end); 51 | extern int have_ssh_env(void); 52 | extern char *ipv6_getnameinfo(struct sockaddr *paddr, int addrlen); 53 | extern char *ipv6_getipaddr(struct sockaddr *paddr, int addrlen); 54 | extern int listen6(int port); 55 | extern int listen_unix(char *file); 56 | extern int accept_unix(int s); 57 | extern int connect_tcp(char *host, int port); 58 | extern int listen_tcp(int port, in_addr_t iface, int try6); 59 | 60 | #endif /* _X11VNC_INET_H */ 61 | -------------------------------------------------------------------------------- /src/keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_KEYBOARD_H 34 | #define _X11VNC_KEYBOARD_H 35 | 36 | /* -- keyboard.h -- */ 37 | #include "allowed_input_t.h" 38 | 39 | extern void get_keystate(int *keystate); 40 | extern void clear_modifiers(int init); 41 | extern int track_mod_state(rfbKeySym keysym, rfbBool down, rfbBool set); 42 | extern void clear_keys(void); 43 | extern void clear_locks(void); 44 | extern int get_autorepeat_state(void); 45 | extern int get_initial_autorepeat_state(void); 46 | extern void autorepeat(int restore, int bequiet); 47 | extern void check_add_keysyms(void); 48 | extern int add_keysym(KeySym keysym); 49 | extern void delete_added_keycodes(int bequiet); 50 | extern void initialize_remap(char *infile); 51 | extern int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new_kc); 52 | extern void switch_to_xkb_if_better(void); 53 | extern char *short_kmbcf(char *str); 54 | extern void initialize_allowed_input(void); 55 | extern void initialize_modtweak(void); 56 | extern void initialize_keyboard_and_pointer(void); 57 | extern void get_allowed_input(rfbClientPtr client, allowed_input_t *input); 58 | extern double typing_rate(double time_window, int *repeating); 59 | extern int skip_cr_when_scaling(char *mode); 60 | extern void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client); 61 | 62 | #endif /* _X11VNC_KEYBOARD_H */ 63 | -------------------------------------------------------------------------------- /src/linuxfb.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_LINUXFB_H 34 | #define _X11VNC_LINUXFB_H 35 | 36 | /* -- linuxfb.h -- */ 37 | extern char *console_guess(char *str, int *fd); 38 | extern void console_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); 39 | extern void console_pointer_command(int mask, int x, int y, rfbClientPtr client); 40 | extern int rawfb_get_offset(int *fd); 41 | 42 | 43 | #endif /* _X11VNC_LINUXFB_H */ 44 | -------------------------------------------------------------------------------- /src/macosx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_MACOSX_H 34 | #define _X11VNC_MACOSX_H 35 | 36 | /* -- macosx.h -- */ 37 | 38 | extern void macosx_log(char *); 39 | extern char *macosx_console_guess(char *str, int *fd); 40 | extern char *macosx_get_fb_addr(void); 41 | extern void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); 42 | extern void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client); 43 | extern void macosx_event_loop(void); 44 | extern int macosx_get_cursor(void); 45 | extern int macosx_get_cursor_pos(int *, int *); 46 | extern int macosx_valid_window(Window, XWindowAttributes*); 47 | extern Status macosx_xquerytree(Window w, Window *root_return, Window *parent_return, 48 | Window **children_return, unsigned int *nchildren_return); 49 | extern int macosx_get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, 50 | Window *frame, Window *win); 51 | extern void macosx_send_sel(char *, int); 52 | extern void macosx_set_sel(char *, int); 53 | 54 | extern void macosx_add_mapnotify(Window win, int level, int map); 55 | extern void macosx_add_create(Window win, int level); 56 | extern void macosx_add_destroy(Window win, int level); 57 | extern void macosx_add_visnotify(Window win, int level, int obscured); 58 | extern int macosx_checkevent(XEvent *ev); 59 | 60 | extern Window macosx_click_frame; 61 | 62 | 63 | #endif /* _X11VNC_MACOSX_H */ 64 | -------------------------------------------------------------------------------- /src/macosxCG.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_MACOSXCG_H 34 | #define _X11VNC_MACOSXCG_H 35 | 36 | /* -- macosxCG.h -- */ 37 | 38 | extern void macosxCG_init(void); 39 | extern void macosxCG_fini(void); 40 | extern void macosxCG_event_loop(void); 41 | extern char *macosxCG_get_fb_addr(void); 42 | 43 | extern int macosxCG_CGDisplayPixelsWide(void); 44 | extern int macosxCG_CGDisplayPixelsHigh(void); 45 | extern int macosxCG_CGDisplayBitsPerPixel(void); 46 | extern int macosxCG_CGDisplayBitsPerSample(void); 47 | extern int macosxCG_CGDisplaySamplesPerPixel(void); 48 | extern int macosxCG_CGDisplayBytesPerRow(void); 49 | 50 | extern void macosxCG_pointer_inject(int mask, int x, int y); 51 | extern int macosxCG_get_cursor_pos(int *x, int *y); 52 | extern int macosxCG_get_cursor(void); 53 | extern void macosxCG_init_key_table(void); 54 | extern void macosxCG_keysym_inject(int down, unsigned int keysym); 55 | extern void macosxCG_keycode_inject(int down, int keycode); 56 | 57 | extern void macosxCG_refresh_callback_off(void); 58 | extern void macosxCG_refresh_callback_on(void); 59 | 60 | 61 | 62 | #endif /* _X11VNC_MACOSXCG_H */ 63 | -------------------------------------------------------------------------------- /src/macosxCGP.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | /* -- macosxCGP.c -- */ 34 | 35 | void macosxCGP_unused(void) {} 36 | 37 | #if (defined(__MACH__) && defined(__APPLE__)) 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | int macosxCGP_save_dim(void); 44 | int macosxCGP_restore_dim(void); 45 | int macosxCGP_save_sleep(void); 46 | int macosxCGP_restore_sleep(void); 47 | int macosxCGP_init_dimming(void); 48 | int macosxCGP_undim(void); 49 | int macosxCGP_dim_shutdown(void); 50 | void macosxCGP_screensaver_timer_off(void); 51 | void macosxCGP_screensaver_timer_on(void); 52 | 53 | #include 54 | #include 55 | 56 | extern CGDirectDisplayID displayID; 57 | 58 | static unsigned long dim_time; 59 | static unsigned long sleep_time; 60 | static int dim_time_saved = 0; 61 | static int sleep_time_saved = 0; 62 | static int initialized = 0; 63 | static mach_port_t master_dev_port; 64 | static io_connect_t power_mgt; 65 | 66 | extern int client_count; 67 | extern int macosx_nodimming; 68 | extern int macosx_nosleep; 69 | extern int macosx_noscreensaver; 70 | 71 | static EventLoopTimerUPP sstimerUPP; 72 | static EventLoopTimerRef sstimer; 73 | 74 | void macosxCG_screensaver_timer(EventLoopTimerRef timer, void *data) { 75 | if (0) fprintf(stderr, "macosxCG_screensaver_timer: %d\n", (int) time(0)); 76 | if (!timer || !data) {} 77 | if (macosx_nosleep && client_count) { 78 | if (0) fprintf(stderr, "UpdateSystemActivity: %d\n", (int) time(0)); 79 | UpdateSystemActivity(IdleActivity); 80 | } 81 | } 82 | 83 | void macosxCGP_screensaver_timer_off(void) { 84 | if (0) fprintf(stderr, "macosxCGP_screensaver_timer_off: %d\n", (int) time(0)); 85 | RemoveEventLoopTimer(sstimer); 86 | DisposeEventLoopTimerUPP(sstimerUPP); 87 | } 88 | 89 | void macosxCGP_screensaver_timer_on(void) { 90 | if (0) fprintf(stderr, "macosxCGP_screensaver_timer_on: %d\n", (int) time(0)); 91 | sstimerUPP = NewEventLoopTimerUPP(macosxCG_screensaver_timer); 92 | InstallEventLoopTimer(GetMainEventLoop(), kEventDurationSecond * 30, 93 | kEventDurationSecond * 30, sstimerUPP, NULL, &sstimer); 94 | } 95 | 96 | int macosxCGP_save_dim(void) { 97 | if (IOPMGetAggressiveness(power_mgt, kPMMinutesToDim, 98 | &dim_time) != kIOReturnSuccess) { 99 | return 0; 100 | } 101 | dim_time_saved = 1; 102 | return 1; 103 | } 104 | 105 | int macosxCGP_restore_dim(void) { 106 | if (! dim_time_saved) { 107 | return 0; 108 | } 109 | if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 110 | dim_time) != kIOReturnSuccess) { 111 | return 0; 112 | } 113 | dim_time_saved = 0; 114 | dim_time = 0; 115 | return 1; 116 | } 117 | 118 | int macosxCGP_save_sleep(void) { 119 | if (IOPMGetAggressiveness(power_mgt, kPMMinutesToSleep, 120 | &sleep_time) != kIOReturnSuccess) { 121 | return 0; 122 | } 123 | sleep_time_saved = 1; 124 | return 1; 125 | } 126 | 127 | int macosxCGP_restore_sleep(void) { 128 | if (! sleep_time_saved) { 129 | return 0; 130 | } 131 | if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 132 | dim_time) != kIOReturnSuccess) { 133 | return 0; 134 | } 135 | sleep_time_saved = 0; 136 | sleep_time = 0; 137 | return 1; 138 | } 139 | 140 | int macosxCGP_init_dimming(void) { 141 | if (IOMasterPort(bootstrap_port, &master_dev_port) != 142 | kIOReturnSuccess) { 143 | return 0; 144 | } 145 | if (!(power_mgt = IOPMFindPowerManagement(master_dev_port))) { 146 | return 0; 147 | } 148 | if (macosx_nodimming) { 149 | if (! macosxCGP_save_dim()) { 150 | return 0; 151 | } 152 | if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) 153 | != kIOReturnSuccess) { 154 | return 0; 155 | } 156 | } 157 | if (macosx_nosleep) { 158 | if (! macosxCGP_save_sleep()) { 159 | return 0; 160 | } 161 | if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) 162 | != kIOReturnSuccess) { 163 | return 0; 164 | } 165 | } 166 | 167 | initialized = 1; 168 | return 1; 169 | } 170 | 171 | int macosxCGP_undim(void) { 172 | if (! initialized) { 173 | return 0; 174 | } 175 | if (! macosx_nodimming) { 176 | if (! macosxCGP_save_dim()) { 177 | return 0; 178 | } 179 | if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) 180 | != kIOReturnSuccess) { 181 | return 0; 182 | } 183 | if (! macosxCGP_restore_dim()) { 184 | return 0; 185 | } 186 | } 187 | if (! macosx_nosleep) { 188 | if (! macosxCGP_save_sleep()) { 189 | return 0; 190 | } 191 | if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) 192 | != kIOReturnSuccess) { 193 | return 0; 194 | } 195 | if (! macosxCGP_restore_sleep()) { 196 | return 0; 197 | } 198 | } 199 | return 1; 200 | } 201 | 202 | int macosxCGP_dim_shutdown(void) { 203 | if (! initialized) { 204 | return 0; 205 | } 206 | if (dim_time_saved) { 207 | if (! macosxCGP_restore_dim()) { 208 | return 0; 209 | } 210 | } 211 | if (sleep_time_saved) { 212 | if (! macosxCGP_restore_sleep()) { 213 | return 0; 214 | } 215 | } 216 | return 1; 217 | } 218 | 219 | #endif /* __APPLE__ */ 220 | 221 | 222 | -------------------------------------------------------------------------------- /src/macosxCGP.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_MACOSXCGP_H 34 | #define _X11VNC_MACOSXCGP_H 35 | 36 | /* -- macosxCGP.h -- */ 37 | 38 | extern int macosxCGP_save_dim(void); 39 | extern int macosxCGP_restore_dim(void); 40 | extern int macosxCGP_save_sleep(void); 41 | extern int macosxCGP_restore_sleep(void); 42 | extern int macosxCGP_init_dimming(void); 43 | extern int macosxCGP_undim(void); 44 | extern int macosxCGP_dim_shutdown(void); 45 | extern void macosxCGP_screensaver_timer_off(void); 46 | extern void macosxCGP_screensaver_timer_on(void); 47 | 48 | 49 | #endif /* _X11VNC_MACOSXCGP_H */ 50 | -------------------------------------------------------------------------------- /src/macosxCGS.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_MACOSXCGS_H 34 | #define _X11VNC_MACOSXCGS_H 35 | 36 | /* -- macosxCGS.h -- */ 37 | 38 | extern void macosxCGS_get_all_windows(void); 39 | extern int macosxCGS_get_qlook(int); 40 | extern void macosxGCS_set_pasteboard(char *str, int len); 41 | extern int macosxCGS_follow_animation_win(int win, int idx, int grow); 42 | extern int macosxCGS_find_index(int w); 43 | 44 | 45 | #endif /* _X11VNC_MACOSXCGS_H */ 46 | -------------------------------------------------------------------------------- /src/macosx_opengl.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | /* -- macosx_opengl.c -- */ 34 | 35 | #if (defined(__MACH__) && defined(__APPLE__)) 36 | 37 | #include 38 | #include 39 | 40 | #include "config.h" 41 | #include 42 | #if HAVE_MACOSX_OPENGL_H 43 | #include 44 | #include 45 | #endif 46 | 47 | extern int macosx_no_opengl, macosx_read_opengl; 48 | extern CGDirectDisplayID displayID; 49 | 50 | static CGLContextObj glContextObj; 51 | 52 | int macosx_opengl_width = 0; 53 | int macosx_opengl_height = 0; 54 | int macosx_opengl_bpp = 0; 55 | 56 | int macosx_opengl_get_width(void) { 57 | GLint viewport[4]; 58 | 59 | glGetIntegerv(GL_VIEWPORT, viewport); 60 | return (int) viewport[2]; 61 | } 62 | 63 | int macosx_opengl_get_height(void) { 64 | GLint viewport[4]; 65 | 66 | glGetIntegerv(GL_VIEWPORT, viewport); 67 | return (int) viewport[3]; 68 | } 69 | 70 | int macosx_opengl_get_bpp(void) { 71 | return 32; 72 | } 73 | 74 | int macosx_opengl_get_bps(void) { 75 | return 8; 76 | } 77 | 78 | int macosx_opengl_get_spp(void) { 79 | return 3; 80 | } 81 | 82 | void macosx_opengl_init(void) { 83 | CGLPixelFormatObj pixelFormatObj; 84 | GLint numPixelFormats; 85 | CGLPixelFormatAttribute attribs[] = { 86 | kCGLPFAFullScreen, 87 | kCGLPFADisplayMask, 88 | 0, 89 | 0 90 | }; 91 | 92 | if (macosx_no_opengl) { 93 | return; 94 | } 95 | 96 | attribs[2] = CGDisplayIDToOpenGLDisplayMask(displayID); 97 | 98 | CGLChoosePixelFormat(attribs, &pixelFormatObj, &numPixelFormats); 99 | if (pixelFormatObj == NULL) { 100 | rfbLog("macosx_opengl_init: CGLChoosePixelFormat failed. Not using OpenGL.\n"); 101 | return; 102 | } 103 | 104 | CGLCreateContext(pixelFormatObj, NULL, &glContextObj); 105 | CGLDestroyPixelFormat(pixelFormatObj); 106 | 107 | if (glContextObj == NULL) { 108 | rfbLog("macosx_opengl_init: CGLCreateContext failed. Not using OpenGL.\n"); 109 | return; 110 | } 111 | 112 | CGLSetCurrentContext(glContextObj); 113 | CGLSetFullScreen(glContextObj); 114 | 115 | macosx_opengl_width = macosx_opengl_get_width(); 116 | macosx_opengl_height = macosx_opengl_get_height(); 117 | 118 | macosx_opengl_bpp = macosx_opengl_get_bpp(); 119 | 120 | glFinish(); 121 | 122 | glPixelStorei(GL_PACK_ALIGNMENT, 4); 123 | glPixelStorei(GL_PACK_ROW_LENGTH, 0); 124 | glPixelStorei(GL_PACK_SKIP_ROWS, 0); 125 | glPixelStorei(GL_PACK_SKIP_PIXELS, 0); 126 | 127 | rfbLog("macosx_opengl_init: Using OpenGL for screen capture.\n"); 128 | macosx_read_opengl = 1; 129 | } 130 | 131 | void macosx_opengl_fini(void) { 132 | if (!macosx_read_opengl) { 133 | return; 134 | } 135 | CGLSetCurrentContext(NULL); 136 | CGLClearDrawable(glContextObj); 137 | CGLDestroyContext(glContextObj); 138 | } 139 | 140 | void macosx_copy_opengl(char *dest, int x, int y, unsigned int w, unsigned int h) { 141 | int yflip = macosx_opengl_height - y - h; 142 | 143 | CGLSetCurrentContext(glContextObj); 144 | 145 | glReadPixels((GLint) x, (GLint) yflip, (int) w, (int) h, 146 | GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, dest); 147 | 148 | if (h > 1) { 149 | static char *pbuf = NULL; 150 | static int buflen = 0; 151 | int top = 0, bot = h - 1, rowlen = w * macosx_opengl_bpp/8; 152 | char *ptop, *pbot; 153 | 154 | if (rowlen > buflen || buflen == 0) { 155 | buflen = rowlen + 128; 156 | if (pbuf) { 157 | free(pbuf); 158 | } 159 | pbuf = (char *) malloc(buflen); 160 | } 161 | while (top < bot) { 162 | ptop = dest + top * rowlen; 163 | pbot = dest + bot * rowlen; 164 | memcpy(pbuf, ptop, rowlen); 165 | memcpy(ptop, pbot, rowlen); 166 | memcpy(pbot, pbuf, rowlen); 167 | top++; 168 | bot--; 169 | } 170 | } 171 | } 172 | 173 | 174 | #else 175 | 176 | #endif /* __APPLE__ */ 177 | 178 | -------------------------------------------------------------------------------- /src/macosx_opengl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_MACOSX_OPENGL_H 34 | #define _X11VNC_MACOSX_OPENGL_H 35 | 36 | /* -- macosx_opengl.h -- */ 37 | 38 | extern void macosx_opengl_init(void); 39 | 40 | 41 | #endif /* _X11VNC_MACOSX_OPENGL_H */ 42 | -------------------------------------------------------------------------------- /src/params.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_PARAMS_H 34 | #define _X11VNC_PARAMS_H 35 | 36 | /* -- params.h -- */ 37 | 38 | #define ICON_MODE_SOCKS 16 39 | 40 | /* had lw=3 for a long time */ 41 | #ifndef WIREFRAME_PARMS 42 | #define WIREFRAME_PARMS "0xff,2,0,32+8+8+8,all,0.15+0.30+5.0+0.125" 43 | #endif 44 | 45 | #ifndef SCROLL_COPYRECT_PARMS 46 | #define SCROLL_COPYRECT_PARMS "0+64+32+32,0.02+0.10+0.9,0.03+0.06+0.5+0.1+5.0" 47 | #endif 48 | 49 | #ifndef POLL_8TO24_DELAY 50 | #define POLL_8TO24_DELAY 0.05 51 | #endif 52 | 53 | #define LATENCY0 20 /* 20ms */ 54 | #define NETRATE0 20 /* 20KB/sec */ 55 | 56 | #define POINTER_MODE_NOFB 2 57 | 58 | /* scan pattern jitter from x0rfbserver */ 59 | #define NSCAN 32 60 | 61 | #define FB_COPY 0x1 62 | #define FB_MOD 0x2 63 | #define FB_REQ 0x4 64 | 65 | #define VNC_CONNECT_MAX 16384 66 | #define X11VNC_REMOTE_MAX 65536 67 | #define PROP_MAX (262144L) 68 | 69 | #define MAXN 256 70 | 71 | #define PIPEINPUT_NONE 0x0 72 | #define PIPEINPUT_VID 0x1 73 | #define PIPEINPUT_CONSOLE 0x2 74 | #define PIPEINPUT_UINPUT 0x3 75 | #define PIPEINPUT_MACOSX 0x4 76 | #define PIPEINPUT_VNC 0x5 77 | 78 | #define MAX_BUTTONS 8 79 | 80 | #define ROTATE_NONE 0 81 | #define ROTATE_X 1 82 | #define ROTATE_Y 2 83 | #define ROTATE_XY 3 84 | #define ROTATE_90 4 85 | #define ROTATE_90X 5 86 | #define ROTATE_90Y 6 87 | #define ROTATE_270 7 88 | 89 | #define VENCRYPT_NONE 0 90 | #define VENCRYPT_SUPPORT 1 91 | #define VENCRYPT_SOLE 2 92 | #define VENCRYPT_FORCE 3 93 | 94 | #define VENCRYPT_BOTH 0 95 | #define VENCRYPT_NODH 1 96 | #define VENCRYPT_NOX509 2 97 | 98 | #define ANONTLS_NONE 0 99 | #define ANONTLS_SUPPORT 1 100 | #define ANONTLS_SOLE 2 101 | #define ANONTLS_FORCE 3 102 | 103 | #endif /* _X11VNC_PARAMS_H */ 104 | -------------------------------------------------------------------------------- /src/pm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_PM_H 34 | #define _X11VNC_PM_H 35 | 36 | /* -- pm.h -- */ 37 | extern void check_pm(void); 38 | extern void set_dpms_mode(char *mode); 39 | 40 | #endif /* _X11VNC_PM_H */ 41 | -------------------------------------------------------------------------------- /src/pointer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_POINTER_H 34 | #define _X11VNC_POINTER_H 35 | 36 | /* -- pointer.h -- */ 37 | 38 | extern int pointer_queued_sent; 39 | 40 | extern void initialize_pointer_map(char *pointer_remap); 41 | extern void do_button_mask_change(int mask, int button, rfbClientPtr client); 42 | extern void pointer_event(int mask, int x, int y, rfbClientPtr client); 43 | extern int check_pipeinput(void); 44 | extern void initialize_pipeinput(void); 45 | extern void update_x11_pointer_position(int x, int y, rfbClientPtr client); 46 | 47 | #endif /* _X11VNC_POINTER_H */ 48 | -------------------------------------------------------------------------------- /src/rates.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_RATES_H 34 | #define _X11VNC_RATES_H 35 | 36 | /* -- rates.h -- */ 37 | 38 | extern int measure_speeds; 39 | extern int speeds_net_rate; 40 | extern int speeds_net_rate_measured; 41 | extern int speeds_net_latency; 42 | extern int speeds_net_latency_measured; 43 | extern int speeds_read_rate; 44 | extern int speeds_read_rate_measured; 45 | 46 | extern int get_cmp_rate(void); 47 | extern int get_raw_rate(void); 48 | extern void initialize_speeds(void); 49 | extern int get_read_rate(void); 50 | extern int link_rate(int *latency, int *netrate); 51 | extern int get_net_rate(void); 52 | extern int get_net_latency(void); 53 | extern void measure_send_rates(int init); 54 | 55 | #endif /* _X11VNC_RATES_H */ 56 | -------------------------------------------------------------------------------- /src/remote.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_REMOTE_H 34 | #define _X11VNC_REMOTE_H 35 | 36 | /* -- remote.h -- */ 37 | 38 | extern int send_remote_cmd(char *cmd, int query, int wait); 39 | extern int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync, 40 | int qdefault); 41 | extern void check_black_fb(void); 42 | extern int check_httpdir(void); 43 | extern void http_connections(int on); 44 | extern int remote_control_access_ok(void); 45 | extern char *process_remote_cmd(char *cmd, int stringonly); 46 | 47 | extern char *query_result; 48 | 49 | 50 | #endif /* _X11VNC_REMOTE_H */ 51 | -------------------------------------------------------------------------------- /src/scan.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SCAN_H 34 | #define _X11VNC_SCAN_H 35 | 36 | /* -- scan.h -- */ 37 | 38 | extern int nap_ok; 39 | extern int scanlines[]; 40 | 41 | extern void initialize_tiles(void); 42 | extern void free_tiles(void); 43 | extern void shm_delete(XShmSegmentInfo *shm); 44 | extern void shm_clean(XShmSegmentInfo *shm, XImage *xim); 45 | extern void initialize_polling_images(void); 46 | extern void scale_rect(double factor_x, double factor_y, int blend, int interpolate, int Bpp, 47 | char *src_fb, int src_bytes_per_line, char *dst_fb, int dst_bytes_per_line, 48 | int Nx, int Ny, int nx, int ny, int X1, int Y1, int X2, int Y2, int mark); 49 | extern void scale_and_mark_rect(int X1, int Y1, int X2, int Y2, int mark); 50 | extern void mark_rect_as_modified(int x1, int y1, int x2, int y2, int force); 51 | extern int copy_screen(void); 52 | extern int copy_snap(void); 53 | extern void nap_sleep(int ms, int split); 54 | extern void set_offset(void); 55 | extern int scan_for_updates(int count_only); 56 | extern void rotate_curs(char *dst_0, char *src_0, int Dx, int Dy, int Bpp); 57 | extern void rotate_coords(int x, int y, int *xo, int *yo, int dxi, int dyi); 58 | extern void rotate_coords_inverse(int x, int y, int *xo, int *yo, int dxi, int dyi); 59 | extern void rotate_cursor_coords(int x, int y, int *xo, int *yo, int dxi, int dyi); 60 | 61 | #endif /* _X11VNC_SCAN_H */ 62 | -------------------------------------------------------------------------------- /src/screen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SCREEN_H 34 | #define _X11VNC_SCREEN_H 35 | 36 | /* -- screen.h -- */ 37 | 38 | extern void set_greyscale_colormap(void); 39 | extern void set_hi240_colormap(void); 40 | extern void unset_colormap(void); 41 | extern void set_colormap(int reset); 42 | extern void set_nofb_params(int restore); 43 | extern void set_raw_fb_params(int restore); 44 | extern void do_new_fb(int reset_mem); 45 | extern void free_old_fb(void); 46 | extern void check_padded_fb(void); 47 | extern void install_padded_fb(char *geom); 48 | extern XImage *initialize_xdisplay_fb(void); 49 | extern XImage *initialize_raw_fb(int); 50 | extern void parse_scale_string(char *str, double *factor_x, double *factor_y, int *scaling, int *blend, 51 | int *nomult4, int *pad, int *interpolate, int *numer, int *denom, int w_in, int h_in); 52 | extern int parse_rotate_string(char *str, int *mode); 53 | extern int scale_round(int len, double fac); 54 | extern void initialize_screen(int *argc, char **argv, XImage *fb); 55 | extern void set_vnc_desktop_name(void); 56 | extern void announce(int lport, int ssl, char *iface); 57 | 58 | extern char *vnc_reflect_guess(char *str, char **raw_fb_addr); 59 | extern void vnc_reflect_process_client(void); 60 | extern rfbBool vnc_reflect_send_pointer(int x, int y, int mask); 61 | extern rfbBool vnc_reflect_send_key(uint32_t key, rfbBool down); 62 | extern rfbBool vnc_reflect_send_cuttext(char *str, int len); 63 | 64 | extern int rawfb_reset; 65 | extern int rawfb_dev_video; 66 | extern int rawfb_vnc_reflect; 67 | 68 | #endif /* _X11VNC_SCREEN_H */ 69 | -------------------------------------------------------------------------------- /src/scrollevent_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SCROLLEVENT_T_H 34 | #define _X11VNC_SCROLLEVENT_T_H 35 | 36 | /* -- scrollevent_t.h -- */ 37 | 38 | typedef struct scroll_event { 39 | Window win, frame; 40 | int dx, dy; 41 | int x, y, w, h; 42 | double t; 43 | int win_x, win_y, win_w, win_h; 44 | int new_x, new_y, new_w, new_h; 45 | } scroll_event_t; 46 | 47 | #endif /* _X11VNC_SCROLLEVENT_T_H */ 48 | -------------------------------------------------------------------------------- /src/selection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SELECTION_H 34 | #define _X11VNC_SELECTION_H 35 | 36 | /* -- selection.h -- */ 37 | 38 | extern char *xcut_str_primary; 39 | extern char *xcut_str_clipboard; 40 | extern int own_primary; 41 | extern int set_primary; 42 | extern int own_clipboard; 43 | extern int set_clipboard; 44 | extern int set_cutbuffer; 45 | extern int sel_waittime; 46 | extern Window selwin; 47 | extern Atom clipboard_atom; 48 | 49 | extern void selection_request(XEvent *ev, char *type); 50 | extern int check_sel_direction(char *dir, char *label, char *sel, int len); 51 | extern void cutbuffer_send(void); 52 | extern void selection_send(XEvent *ev); 53 | extern void resend_selection(char *type); 54 | 55 | #endif /* _X11VNC_SELECTION_H */ 56 | -------------------------------------------------------------------------------- /src/solid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SOLID_H 34 | #define _X11VNC_SOLID_H 35 | 36 | /* -- solid.h -- */ 37 | 38 | extern char *guess_desktop(void); 39 | extern unsigned long get_pixel(char *color); 40 | extern XImage *solid_image(char *color); 41 | extern void solid_bg(int restore); 42 | extern char *dbus_session(void); 43 | extern XImage *solid_root(char *color); 44 | extern void kde_no_animate(int restore); 45 | extern void gnome_no_animate(void); 46 | 47 | #endif /* _X11VNC_SOLID_H */ 48 | -------------------------------------------------------------------------------- /src/sslcmds.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SSLCMDS_H 34 | #define _X11VNC_SSLCMDS_H 35 | 36 | /* -- sslcmds.h -- */ 37 | 38 | extern void check_stunnel(void); 39 | extern int start_stunnel(int stunnel_port, int x11vnc_port, int hport, int x11vnc_hport); 40 | extern void stop_stunnel(void); 41 | extern void setup_stunnel(int rport, int *argc, char **argv); 42 | extern char *get_Cert_dir(char *cdir_in, char **tmp_in); 43 | extern void sslScripts(void); 44 | extern void sslGenCA(char *cdir); 45 | extern void sslGenCert(char *ty, char *nm); 46 | extern void sslEncKey(char *path, int info_only); 47 | 48 | 49 | #endif /* _X11VNC_SSLCMDS_H */ 50 | -------------------------------------------------------------------------------- /src/sslhelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_SSLHELPER_H 34 | #define _X11VNC_SSLHELPER_H 35 | 36 | /* -- sslhelper.h -- */ 37 | 38 | 39 | #define OPENSSL_INETD 1 40 | #define OPENSSL_VNC 2 41 | #define OPENSSL_VNC6 3 42 | #define OPENSSL_HTTPS 4 43 | #define OPENSSL_HTTPS6 5 44 | #define OPENSSL_REVERSE 6 45 | 46 | extern int openssl_sock; 47 | extern int openssl_sock6; 48 | extern int openssl_port_num; 49 | extern int https_sock; 50 | extern int https_sock6; 51 | extern pid_t openssl_last_helper_pid; 52 | extern char *openssl_last_ip; 53 | extern char *certret_str; 54 | extern char *dhret_str; 55 | extern char *new_dh_params; 56 | 57 | extern void raw_xfer(int csock, int s_in, int s_out); 58 | 59 | extern int openssl_present(void); 60 | extern void openssl_init(int); 61 | extern void openssl_port(int); 62 | extern void https_port(int); 63 | extern void check_openssl(void); 64 | extern void check_https(void); 65 | extern void ssl_helper_pid(pid_t pid, int sock); 66 | extern void accept_openssl(int mode, int presock); 67 | extern char *find_openssl_bin(void); 68 | extern char *get_saved_pem(char *string, int create); 69 | extern char *get_ssl_verify_file(char *str_in); 70 | extern char *create_tmp_pem(char *path, int prompt); 71 | 72 | 73 | #endif /* _X11VNC_SSLHELPER_H */ 74 | -------------------------------------------------------------------------------- /src/uinput.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_UINPUT_H 34 | #define _X11VNC_UINPUT_H 35 | 36 | /* -- uinput.h -- */ 37 | 38 | extern int check_uinput(void); 39 | extern int initialize_uinput(void); 40 | extern void shutdown_uinput(void); 41 | extern int set_uinput_accel(char *str); 42 | extern int set_uinput_thresh(char *str); 43 | extern void set_uinput_reset(int ms); 44 | extern void set_uinput_always(int); 45 | extern void set_uinput_touchscreen(int); 46 | extern void set_uinput_abs(int); 47 | extern char *get_uinput_accel(); 48 | extern char *get_uinput_thresh(); 49 | extern int get_uinput_reset(); 50 | extern int get_uinput_always(); 51 | extern int get_uinput_touchscreen(); 52 | extern int get_uinput_abs(); 53 | extern void parse_uinput_str(char *str); 54 | extern void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client); 55 | extern void uinput_key_command(int down, int keysym, rfbClientPtr client); 56 | 57 | 58 | 59 | #endif /* _X11VNC_UINPUT_H */ 60 | -------------------------------------------------------------------------------- /src/unixpw.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_UNIXPW_H 34 | #define _X11VNC_UNIXPW_H 35 | 36 | /* -- unixpw.h -- */ 37 | 38 | extern int white_pixel(void); 39 | extern void unixpw_screen(int init); 40 | extern void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init); 41 | extern void unixpw_accept(char *user); 42 | extern void unixpw_deny(void); 43 | extern void unixpw_msg(char *msg, int delay); 44 | extern int su_verify(char *user, char *pass, char *cmd, char *rbuf, int *rbuf_size, int nodisp); 45 | extern int unixpw_cmd_run(char *user, char *pass, char *cmd, char *line, int *n); 46 | extern int crypt_verify(char *user, char *pass); 47 | extern int cmd_verify(char *user, char *pass); 48 | extern int unixpw_verify(char *user, char *pass); 49 | extern void unixpw_verify_screen(char *user, char *pass); 50 | 51 | extern int unixpw_in_progress; 52 | extern int unixpw_denied; 53 | extern int unixpw_in_rfbPE; 54 | extern int unixpw_login_viewonly; 55 | extern int unixpw_tightvnc_xfer_save; 56 | extern rfbBool unixpw_file_xfer_save; 57 | extern time_t unixpw_last_try_time; 58 | extern rfbClientPtr unixpw_client; 59 | extern int keep_unixpw; 60 | extern char *keep_unixpw_user; 61 | extern char *keep_unixpw_pass; 62 | extern char *keep_unixpw_opts; 63 | 64 | #endif /* _X11VNC_UNIXPW_H */ 65 | -------------------------------------------------------------------------------- /src/user.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_USER_H 34 | #define _X11VNC_USER_H 35 | 36 | /* -- user.h -- */ 37 | 38 | extern void check_switched_user(void); 39 | extern void lurk_loop(char *str); 40 | extern int switch_user(char *, int); 41 | extern int read_passwds(char *passfile); 42 | extern void install_passwds(void); 43 | extern void check_new_passwds(int force); 44 | extern void progress_client(void); 45 | extern int wait_for_client(int *argc, char** argv, int http); 46 | extern rfbBool custom_passwd_check(rfbClientPtr cl, const char *response, int len); 47 | extern char *xdmcp_insert; 48 | 49 | #endif /* _X11VNC_USER_H */ 50 | -------------------------------------------------------------------------------- /src/userinput.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_USERINPUT_H 34 | #define _X11VNC_USERINPUT_H 35 | 36 | /* -- userinput.h -- */ 37 | 38 | extern int defer_update_nofb; 39 | extern int last_scroll_type; 40 | 41 | extern int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, 42 | Window *frame, Window *win); 43 | extern void parse_scroll_copyrect(void); 44 | extern void parse_fixscreen(void); 45 | extern void parse_wireframe(void); 46 | 47 | extern void set_wirecopyrect_mode(char *str); 48 | extern void set_scrollcopyrect_mode(char *str); 49 | extern void initialize_scroll_keys(void); 50 | extern void initialize_scroll_matches(void); 51 | extern void initialize_scroll_term(void); 52 | extern void initialize_max_keyrepeat(void); 53 | 54 | extern int direct_fb_copy(int x1, int y1, int x2, int y2, int mark); 55 | extern void fb_push(void); 56 | extern int fb_push_wait(double max_wait, int flags); 57 | extern void eat_viewonly_input(int max_eat, int keep); 58 | 59 | extern void mark_for_xdamage(int x, int y, int w, int h); 60 | extern void mark_region_for_xdamage(sraRegionPtr region); 61 | extern void set_xdamage_mark(int x, int y, int w, int h); 62 | extern int near_wm_edge(int x, int y, int w, int h, int px, int py); 63 | extern int near_scrollbar_edge(int x, int y, int w, int h, int px, int py); 64 | 65 | extern void check_fixscreen(void); 66 | extern int check_xrecord(void); 67 | extern int check_wireframe(void); 68 | extern int fb_update_sent(int *count); 69 | extern int check_user_input(double dt, double dtr, int tile_diffs, int *cnt); 70 | extern void do_copyregion(sraRegionPtr region, int dx, int dy, int mode); 71 | 72 | extern int check_ncache(int reset, int mode); 73 | extern int find_rect(int idx, int x, int y, int w, int h); 74 | extern int lookup_win_index(Window); 75 | extern void set_ncache_xrootpmap(void); 76 | 77 | #endif /* _X11VNC_USERINPUT_H */ 78 | -------------------------------------------------------------------------------- /src/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_UTIL_H 34 | #define _X11VNC_UTIL_H 35 | 36 | /* -- util.h -- */ 37 | 38 | extern int nfix(int i, int n); 39 | extern int nmin(int n, int m); 40 | extern int nmax(int n, int m); 41 | extern int nabs(int n); 42 | extern double dabs(double x); 43 | extern void lowercase(char *str); 44 | extern void uppercase(char *str); 45 | extern char *lblanks(char *str); 46 | extern void strzero(char *str); 47 | extern int scan_hexdec(char *str, unsigned long *num); 48 | extern int parse_geom(char *str, int *wp, int *hp, int *xp, int *yp, int W, int H); 49 | extern void set_env(char *name, char *value); 50 | extern char *bitprint(unsigned int st, int nbits); 51 | extern char *get_user_name(void); 52 | extern char *get_home_dir(void); 53 | extern char *get_shell(void); 54 | extern char *this_host(void); 55 | 56 | extern int match_str_list(char *str, char **list); 57 | extern char **create_str_list(char *cslist); 58 | 59 | extern double dtime(double *); 60 | extern double dtime0(double *); 61 | extern double dnow(void); 62 | extern double dnowx(void); 63 | extern double rnow(void); 64 | extern double rfac(void); 65 | 66 | extern int rfbPE(long usec); 67 | extern void rfbCFD(long usec); 68 | extern double rect_overlap(int x1, int y1, int x2, int y2, int X1, int Y1, 69 | int X2, int Y2); 70 | extern char *choose_title(char *display); 71 | 72 | 73 | #define NONUL(x) ((x != NULL) ? (x) : "") 74 | 75 | /* 76 | Put this in usleep2() for debug printout. 77 | fprintf(stderr, "_mysleep: %08d %10.6f %s:%d\n", (x), dnow() - x11vnc_start, __FILE__, __LINE__); \ 78 | */ 79 | 80 | /* XXX usleep(3) is not thread safe on some older systems... */ 81 | extern struct timeval _mysleep; 82 | #define usleep2(x) \ 83 | _mysleep.tv_sec = (x) / 1000000; \ 84 | _mysleep.tv_usec = (x) % 1000000; \ 85 | select(0, NULL, NULL, NULL, &_mysleep); 86 | #if !defined(X11VNC_USLEEP) 87 | #undef usleep 88 | #define usleep usleep2 89 | #endif 90 | 91 | /* 92 | * following is based on IsModifierKey in Xutil.h 93 | */ 94 | #define ismodkey(keysym) \ 95 | ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R) && \ 96 | ((KeySym)(keysym) != XK_Caps_Lock) && ((KeySym)(keysym) != XK_Shift_Lock))) 97 | 98 | /* 99 | * When threaded we have to mutex our X11 calls to avoid XIO crashes 100 | * due to callbacks. 101 | */ 102 | #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD 103 | extern MUTEX(x11Mutex); 104 | extern MUTEX(scrollMutex); 105 | extern MUTEX(clientMutex); 106 | extern MUTEX(inputMutex); 107 | extern MUTEX(pointerMutex); 108 | #endif 109 | 110 | #define X_INIT INIT_MUTEX(x11Mutex) 111 | 112 | #if 1 113 | #define X_LOCK LOCK(x11Mutex) 114 | #define X_UNLOCK UNLOCK(x11Mutex) 115 | #else 116 | extern int hxl; 117 | #define X_LOCK fprintf(stderr, "*** X_LOCK** %d%s %s:%d\n", \ 118 | hxl, hxl ? " BAD-PRE-LOCK":"", __FILE__, __LINE__); LOCK(x11Mutex); hxl = 1; 119 | #define X_UNLOCK fprintf(stderr, " x_unlock %d%s %s:%d\n", \ 120 | hxl, !hxl ? " BAD-PRE-UNLOCK":"", __FILE__, __LINE__); UNLOCK(x11Mutex); hxl = 0; 121 | #endif 122 | 123 | #define SCR_LOCK if (use_threads) {LOCK(scrollMutex);} 124 | #define SCR_UNLOCK if (use_threads) {UNLOCK(scrollMutex);} 125 | #define SCR_INIT INIT_MUTEX(scrollMutex) 126 | 127 | #define CLIENT_LOCK if (use_threads) {LOCK(clientMutex);} 128 | #define CLIENT_UNLOCK if (use_threads) {UNLOCK(clientMutex);} 129 | #define CLIENT_INIT INIT_MUTEX(clientMutex) 130 | 131 | #if 1 132 | #define INPUT_LOCK if (use_threads) {LOCK(inputMutex);} 133 | #define INPUT_UNLOCK if (use_threads) {UNLOCK(inputMutex);} 134 | #else 135 | #define INPUT_LOCK 136 | #define INPUT_UNLOCK 137 | #endif 138 | #define INPUT_INIT INIT_MUTEX(inputMutex) 139 | 140 | #define POINTER_LOCK if (use_threads) {LOCK(pointerMutex);} 141 | #define POINTER_UNLOCK if (use_threads) {UNLOCK(pointerMutex);} 142 | #define POINTER_INIT INIT_MUTEX(pointerMutex) 143 | 144 | /* 145 | * The sendMutex member was added to libvncserver 0.9.8 146 | * rfb/rfb.h sets LIBVNCSERVER_SEND_MUTEX if present. 147 | */ 148 | #if LIBVNCSERVER_HAVE_LIBPTHREAD && defined(LIBVNCSERVER_SEND_MUTEX) 149 | #define SEND_LOCK(cl) if (use_threads) LOCK((cl)->sendMutex); 150 | #define SEND_UNLOCK(cl) if (use_threads) UNLOCK((cl)->sendMutex); 151 | #else 152 | #define SEND_LOCK(cl) 153 | #define SEND_UNLOCK(cl) 154 | #endif 155 | 156 | #endif /* _X11VNC_UTIL_H */ 157 | -------------------------------------------------------------------------------- /src/v4l.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_V4L_H 34 | #define _X11VNC_V4L_H 35 | 36 | /* -- v4l.h -- */ 37 | extern char *v4l_guess(char *str, int *fd); 38 | extern void v4l_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); 39 | extern void v4l_pointer_command(int mask, int x, int y, rfbClientPtr client); 40 | 41 | 42 | #endif /* _X11VNC_V4L_H */ 43 | -------------------------------------------------------------------------------- /src/win_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_WIN_UTILS_H 34 | #define _X11VNC_WIN_UTILS_H 35 | 36 | /* -- win_utils.h -- */ 37 | #include "xinerama.h" 38 | #include "winattr_t.h" 39 | 40 | extern winattr_t *stack_list; 41 | extern int stack_list_len; 42 | extern int stack_list_num; 43 | 44 | extern Window parent_window(Window win, char **name); 45 | extern int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet); 46 | extern Bool xtranslate(Window src, Window dst, int src_x, int src_y, int *dst_x, 47 | int *dst_y, Window *child, int bequiet); 48 | extern int get_window_size(Window win, int *w, int *h); 49 | extern void snapshot_stack_list(int free_only, double allowed_age); 50 | extern int get_boff(void); 51 | extern int get_bwin(void); 52 | extern void update_stack_list(void); 53 | extern Window query_pointer(Window start); 54 | extern unsigned int mask_state(void); 55 | extern int pick_windowid(unsigned long *num); 56 | extern Window descend_pointer(int depth, Window start, char *name_info, int len); 57 | extern void id_cmd(char *cmd); 58 | 59 | /** 60 | * Find a client window, either subwin itself or one of its children. 61 | */ 62 | extern Window find_client(Display * dpy, Window root, Window subwin); 63 | 64 | /** 65 | * Check if window has given property. 66 | */ 67 | extern Bool window_has_property(Display * dpy, Window win, Atom atom); 68 | 69 | /** 70 | * Check if window is viewable. 71 | */ 72 | extern Bool window_is_viewable(Display * dpy, Window win); 73 | 74 | 75 | #endif /* _X11VNC_WIN_UTILS_H */ 76 | -------------------------------------------------------------------------------- /src/winattr_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_WINATTR_T_H 34 | #define _X11VNC_WINATTR_T_H 35 | 36 | /* -- winattr_t.h -- */ 37 | 38 | typedef struct winattr { 39 | Window win; 40 | int fetched; 41 | int valid; 42 | int x, y; 43 | int width, height; 44 | int border_width; 45 | int depth; 46 | int class; 47 | int backing_store; 48 | int map_state; 49 | int rx, ry; 50 | double time; 51 | double bs_time; 52 | double su_time; 53 | double vis_obs_time; 54 | double vis_unobs_time; 55 | int bs_x, bs_y, bs_w, bs_h; 56 | int su_x, su_y, su_w, su_h; 57 | Window above; 58 | short vis_state; 59 | short selectinput; 60 | short map_cnt; 61 | short unmap_cnt; 62 | short vis_cnt; 63 | short create_cnt; 64 | } winattr_t; 65 | 66 | #endif /* _X11VNC_WINATTR_T_H */ 67 | -------------------------------------------------------------------------------- /src/xdamage.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XDAMAGE_H 34 | #define _X11VNC_XDAMAGE_H 35 | 36 | /* -- xdamage.h -- */ 37 | 38 | #if HAVE_LIBXDAMAGE 39 | extern Damage xdamage; 40 | #endif 41 | extern int use_xdamage; 42 | extern int xdamage_present; 43 | extern int xdamage_max_area; 44 | extern double xdamage_memory; 45 | extern int xdamage_tile_count, xdamage_direct_count; 46 | extern double xdamage_scheduled_mark; 47 | extern double xdamage_crazy_time; 48 | extern double xdamage_crazy_delay; 49 | extern sraRegionPtr xdamage_scheduled_mark_region; 50 | extern sraRegionPtr *xdamage_regions; 51 | extern int xdamage_ticker; 52 | extern int XD_skip, XD_tot, XD_des; 53 | 54 | extern void add_region_xdamage(sraRegionPtr new_region); 55 | extern void clear_xdamage_mark_region(sraRegionPtr markregion, int flush); 56 | extern int collect_non_X_xdamage(int x_in, int y_in, int w_in, int h_in, int call); 57 | extern int collect_xdamage(int scancnt, int call); 58 | extern int xdamage_hint_skip(int y); 59 | extern void initialize_xdamage(void); 60 | extern void create_xdamage_if_needed(int force); 61 | extern void destroy_xdamage_if_needed(void); 62 | extern void check_xdamage_state(void); 63 | 64 | #endif /* _X11VNC_XDAMAGE_H */ 65 | -------------------------------------------------------------------------------- /src/xevents.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XEVENTS_H 34 | #define _X11VNC_XEVENTS_H 35 | 36 | /* -- xevents.h -- */ 37 | 38 | extern int grab_buster; 39 | extern int grab_kbd; 40 | extern int grab_ptr; 41 | extern int grab_always; 42 | extern int ungrab_both; 43 | extern int grab_local; 44 | extern int sync_tod_delay; 45 | 46 | extern void initialize_vnc_connect_prop(void); 47 | extern void initialize_x11vnc_remote_prop(void); 48 | extern void initialize_clipboard_atom(void); 49 | extern void spawn_grab_buster(void); 50 | extern void sync_tod_with_servertime(void); 51 | extern void check_keycode_state(void); 52 | extern void check_autorepeat(void); 53 | extern void set_prop_atom(Atom atom); 54 | extern void check_xevents(int reset); 55 | extern void xcut_receive(char *text, int len, rfbClientPtr cl); 56 | 57 | extern void kbd_release_all_keys(rfbClientPtr cl); 58 | extern void set_single_window(rfbClientPtr cl, int x, int y); 59 | extern void set_server_input(rfbClientPtr cl, int s); 60 | extern void set_text_chat(rfbClientPtr cl, int l, char *t); 61 | extern int get_keyboard_led_state_hook(rfbScreenInfoPtr s); 62 | extern int get_file_transfer_permitted(rfbClientPtr cl); 63 | extern void get_prop(char *str, int len, Atom prop, Window w); 64 | extern int guess_dm_gone(int t1, int t2); 65 | 66 | 67 | #endif /* _X11VNC_XEVENTS_H */ 68 | -------------------------------------------------------------------------------- /src/xi2_devices.h: -------------------------------------------------------------------------------- 1 | /* 2 | XInput2 device handling routines for x11vnc. 3 | 4 | Copyright (C) 2009-2010 Christian Beier 5 | All rights reserved. 6 | 7 | This file is part of x11vnc. 8 | 9 | x11vnc is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or (at 12 | your option) any later version. 13 | 14 | x11vnc is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with x11vnc; if not, write to the Free Software 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 22 | or see . 23 | */ 24 | 25 | #ifndef _X11VNC_XI2_DEVICES 26 | #define _X11VNC_XI2_DEVICES 27 | 28 | #ifdef HAVE_XI2 29 | #include 30 | #endif 31 | 32 | extern int xinput2_present; 33 | extern int use_multipointer; 34 | extern int xi2_device_creation_in_progress; 35 | 36 | 37 | /* 38 | create xi2 master device with given name 39 | returns device_id, -1 on error 40 | */ 41 | extern int createMD(Display* dpy, char* name); 42 | 43 | /* 44 | remove master device 45 | returns 1 on success, 0 on failure 46 | */ 47 | extern int removeMD(Display* dpy, int dev_id); 48 | 49 | 50 | /** 51 | removes all created xi2 master devices. 52 | */ 53 | void removeAllMDs(Display *dpy); 54 | 55 | 56 | /* 57 | gets the paired pointer/keyboard id to dev_id 58 | returns -1 on error 59 | */ 60 | extern int getPairedMD(Display* dpy, int dev_id); 61 | 62 | 63 | /* 64 | set cursor of pointer dev 65 | */ 66 | extern rfbCursorPtr setClientCursor(Display *dpy, int dev_id, float r, float g, float b, char *label); 67 | 68 | /* 69 | Sets the paired keyboard's focus to the window underneath the given pointer. 70 | returns 1 on success, 0 on fail 71 | */ 72 | extern int setDeviceFocus(Display* dpy, int ptr_id); 73 | 74 | /* 75 | sets the XI client pointer for client window underneath this pointer. 76 | returns 1 on success, 0 on fail 77 | */ 78 | int setXIClientPointer(Display* dpy, int dev_id); 79 | 80 | 81 | #endif /* _X11VNC_XI2_DEVICES */ 82 | -------------------------------------------------------------------------------- /src/xinerama.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XINERAMA_H 34 | #define _X11VNC_XINERAMA_H 35 | 36 | /* -- xinerama.h -- */ 37 | #include "blackout_t.h" 38 | 39 | extern blackout_t blackr[]; 40 | extern tile_blackout_t *tile_blackout; 41 | extern int blackouts; 42 | 43 | extern void initialize_blackouts_and_xinerama(void); 44 | extern void push_sleep(int n); 45 | extern void push_black_screen(int n); 46 | extern void refresh_screen(int push); 47 | extern void zero_fb(int x1, int y1, int x2, int y2); 48 | extern void check_xinerama_clip(void); 49 | 50 | #endif /* _X11VNC_XINERAMA_H */ 51 | -------------------------------------------------------------------------------- /src/xkb_bell.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | /* -- xkb_bell.c -- */ 34 | 35 | #include "x11vnc.h" 36 | #include "xwrappers.h" 37 | #include "connections.h" 38 | 39 | /* 40 | * Bell event handling. Requires XKEYBOARD extension. 41 | */ 42 | int xkb_base_event_type = 0; 43 | 44 | void initialize_xkb(void); 45 | void initialize_watch_bell(void); 46 | void check_bell_event(void); 47 | 48 | 49 | #if HAVE_XKEYBOARD 50 | 51 | /* 52 | * check for XKEYBOARD, set up xkb_base_event_type 53 | */ 54 | void initialize_xkb(void) { 55 | int op, er, maj, min; 56 | 57 | RAWFB_RET_VOID 58 | 59 | if (xkbcompat) { 60 | xkb_present = 0; 61 | } else if (! XkbQueryExtension(dpy, &op, &xkb_base_event_type, &er, &maj, &min)) { 62 | if (! quiet) { 63 | rfbLog("warning: XKEYBOARD extension not present.\n"); 64 | } 65 | xkb_present = 0; 66 | xkb_base_event_type = 0; 67 | } else { 68 | xkb_present = 1; 69 | } 70 | } 71 | 72 | void initialize_watch_bell(void) { 73 | if (! xkb_present) { 74 | if (! quiet) { 75 | rfbLog("warning: disabling bell. XKEYBOARD ext. " 76 | "not present.\n"); 77 | } 78 | watch_bell = 0; 79 | sound_bell = 0; 80 | return; 81 | } 82 | 83 | RAWFB_RET_VOID 84 | 85 | XkbSelectEvents(dpy, XkbUseCoreKbd, XkbBellNotifyMask, 0); 86 | 87 | if (! watch_bell) { 88 | return; 89 | } 90 | if (! XkbSelectEvents(dpy, XkbUseCoreKbd, XkbBellNotifyMask, 91 | XkbBellNotifyMask) ) { 92 | if (! quiet) { 93 | rfbLog("warning: disabling bell. XkbSelectEvents" 94 | " failed.\n"); 95 | } 96 | watch_bell = 0; 97 | sound_bell = 0; 98 | } 99 | } 100 | 101 | /* 102 | * We call this periodically to process any bell events that have 103 | * taken place. 104 | */ 105 | void check_bell_event(void) { 106 | XEvent xev; 107 | XkbAnyEvent *xkb_ev; 108 | int got_bell = 0; 109 | 110 | if (! xkb_base_event_type) { 111 | return; 112 | } 113 | RAWFB_RET_VOID 114 | 115 | /* caller does X_LOCK */ 116 | if (! XCheckTypedEvent(dpy, xkb_base_event_type, &xev)) { 117 | return; 118 | } 119 | if (! watch_bell) { 120 | /* we return here to avoid xkb events piling up */ 121 | return; 122 | } 123 | 124 | xkb_ev = (XkbAnyEvent *) &xev; 125 | if (xkb_ev->xkb_type == XkbBellNotify) { 126 | got_bell = 1; 127 | } 128 | 129 | if (got_bell && sound_bell) { 130 | if (! all_clients_initialized()) { 131 | rfbLog("check_bell_event: not sending bell: " 132 | "uninitialized clients\n"); 133 | } else { 134 | if (screen && client_count) { 135 | rfbSendBell(screen); 136 | } 137 | } 138 | } 139 | } 140 | #else 141 | void initialize_watch_bell(void) { 142 | watch_bell = 0; 143 | sound_bell = 0; 144 | } 145 | void check_bell_event(void) {} 146 | #endif 147 | 148 | 149 | -------------------------------------------------------------------------------- /src/xkb_bell.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XKB_BELL_H 34 | #define _X11VNC_XKB_BELL_H 35 | 36 | /* -- xkb_bell.h -- */ 37 | 38 | extern int xkb_base_event_type; 39 | 40 | extern void initialize_xkb(void); 41 | extern void initialize_watch_bell(void); 42 | extern void check_bell_event(void); 43 | 44 | #endif /* _X11VNC_XKB_BELL_H */ 45 | -------------------------------------------------------------------------------- /src/xrandr.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XRANDR_H 34 | #define _X11VNC_XRANDR_H 35 | 36 | /* -- xrandr.h -- */ 37 | 38 | extern time_t last_subwin_trap; 39 | extern int subwin_trap_count; 40 | extern XErrorHandler old_getimage_handler; 41 | 42 | extern int xrandr_present; 43 | extern int xrandr_width; 44 | extern int xrandr_height; 45 | extern int xrandr_rotation; 46 | extern Time xrandr_timestamp; 47 | extern Time xrandr_cfg_time; 48 | 49 | extern void initialize_xrandr(void); 50 | extern int check_xrandr_event(char *msg); 51 | extern int known_xrandr_mode(char *s); 52 | 53 | #define XRANDR_SET_TRAP_RET(x,y) \ 54 | if (subwin || xrandr) { \ 55 | trapped_getimage_xerror = 0; \ 56 | old_getimage_handler = XSetErrorHandler(trap_getimage_xerror); \ 57 | if (check_xrandr_event(y)) { \ 58 | trapped_getimage_xerror = 0; \ 59 | XSetErrorHandler(old_getimage_handler); \ 60 | X_UNLOCK; \ 61 | return(x); \ 62 | } \ 63 | } 64 | #define XRANDR_CHK_TRAP_RET(x,y) \ 65 | if (subwin || xrandr) { \ 66 | if (trapped_getimage_xerror) { \ 67 | if (subwin) { \ 68 | static int last = 0; \ 69 | subwin_trap_count++; \ 70 | if (time(NULL) > last_subwin_trap + 60) { \ 71 | rfbLog("trapped GetImage xerror" \ 72 | " in SUBWIN mode. [%d]\n", \ 73 | subwin_trap_count); \ 74 | last_subwin_trap = time(NULL); \ 75 | last = subwin_trap_count; \ 76 | } \ 77 | if (subwin_trap_count - last > 30) { \ 78 | /* window probably iconified */ \ 79 | usleep(1000*1000); \ 80 | } \ 81 | } else { \ 82 | rfbLog("trapped GetImage xerror" \ 83 | " in XRANDR mode.\n"); \ 84 | } \ 85 | trapped_getimage_xerror = 0; \ 86 | XSetErrorHandler(old_getimage_handler); \ 87 | XFlush_wr(dpy); \ 88 | check_xrandr_event(y); \ 89 | X_UNLOCK; \ 90 | return(x); \ 91 | } \ 92 | } 93 | 94 | #endif /* _X11VNC_XRANDR_H */ 95 | -------------------------------------------------------------------------------- /src/xrecord.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XRECORD_H 34 | #define _X11VNC_XRECORD_H 35 | 36 | /* -- xrecord.h -- */ 37 | #include "scrollevent_t.h" 38 | #include "winattr_t.h" 39 | 40 | extern scroll_event_t scr_ev[]; 41 | extern int scr_ev_cnt; 42 | extern int xrecording; 43 | extern int xrecord_set_by_keys; 44 | extern int xrecord_set_by_mouse; 45 | extern Window xrecord_focus_window; 46 | extern Window xrecord_wm_window; 47 | extern Window xrecord_ptr_window; 48 | extern KeySym xrecord_keysym; 49 | extern char xrecord_name_info[]; 50 | 51 | extern winattr_t scr_attr_cache[]; 52 | 53 | extern Display *rdpy_data; 54 | extern Display *rdpy_ctrl; 55 | 56 | extern Display *gdpy_ctrl; 57 | extern int xserver_grabbed; 58 | 59 | extern void initialize_xrecord(void); 60 | extern void zerodisp_xrecord(void); 61 | extern void shutdown_xrecord(void); 62 | extern int xrecord_skip_keysym(rfbKeySym keysym); 63 | extern int xrecord_skip_button(int newb, int old); 64 | extern int xrecord_scroll_keysym(rfbKeySym keysym); 65 | extern void check_xrecord_reset(int force); 66 | extern void xrecord_watch(int start, int setby); 67 | 68 | #endif /* _X11VNC_XRECORD_H */ 69 | -------------------------------------------------------------------------------- /src/xwrappers.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2002-2010 Karl J. Runge 3 | All rights reserved. 4 | 5 | This file is part of x11vnc. 6 | 7 | x11vnc is free software; you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation; either version 2 of the License, or (at 10 | your option) any later version. 11 | 12 | x11vnc is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with x11vnc; if not, write to the Free Software 19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA 20 | or see . 21 | 22 | In addition, as a special exception, Karl J. Runge 23 | gives permission to link the code of its release of x11vnc with the 24 | OpenSSL project's "OpenSSL" library (or with modified versions of it 25 | that use the same license as the "OpenSSL" library), and distribute 26 | the linked executables. You must obey the GNU General Public License 27 | in all respects for all of the code used other than "OpenSSL". If you 28 | modify this file, you may extend this exception to your version of the 29 | file, but you are not obligated to do so. If you do not wish to do 30 | so, delete this exception statement from your version. 31 | */ 32 | 33 | #ifndef _X11VNC_XWRAPPERS_H 34 | #define _X11VNC_XWRAPPERS_H 35 | 36 | #ifdef HAVE_XI2 37 | #include 38 | #endif 39 | 40 | /* -- xwrappers.h -- */ 41 | 42 | extern int xshm_present; 43 | extern int xshm_opcode; 44 | extern int xtest_present; 45 | extern int xtrap_present; 46 | extern int xrecord_present; 47 | extern int xkb_present; 48 | extern int xinerama_present; 49 | 50 | extern int keycode_state[]; 51 | extern int rootshift; 52 | extern int clipshift; 53 | 54 | 55 | extern int guess_bits_per_color(int bits_per_pixel); 56 | 57 | extern int XFlush_wr(Display *disp); 58 | 59 | extern Status XShmGetImage_wr(Display *disp, Drawable d, XImage *image, int x, int y, 60 | unsigned long mask); 61 | extern XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth, 62 | int format, char* data, XShmSegmentInfo* shminfo, unsigned int width, 63 | unsigned int height); 64 | extern Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo); 65 | extern Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo); 66 | extern Bool XShmQueryExtension_wr(Display *disp); 67 | extern int XShmGetEventBase_wr(Display *disp); 68 | 69 | extern XImage *xreadscreen(Display *disp, Drawable d, int x, int y, 70 | unsigned int width, unsigned int height, Bool show_cursor); 71 | extern XImage *XGetSubImage_wr(Display *disp, Drawable d, int x, int y, 72 | unsigned int width, unsigned int height, unsigned long plane_mask, 73 | int format, XImage *dest_image, int dest_x, int dest_y); 74 | extern XImage *XGetImage_wr(Display *disp, Drawable d, int x, int y, 75 | unsigned int width, unsigned int height, unsigned long plane_mask, 76 | int format); 77 | extern XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth, 78 | int format, int offset, char *data, unsigned int width, 79 | unsigned int height, int bitmap_pad, int bytes_per_line); 80 | extern void copy_image(XImage *dest, int x, int y, unsigned int w, unsigned int h); 81 | extern void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h); 82 | extern void init_track_keycode_state(void); 83 | 84 | extern void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, 85 | unsigned long delay); 86 | extern void XTestFakeKeyEvent_wr(Display* dpy, int dev_id, KeyCode key, Bool down, 87 | unsigned long delay); 88 | extern void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, 89 | unsigned long delay); 90 | extern void XTestFakeButtonEvent_wr(Display* dpy, int dev_id, unsigned int button, Bool is_press, 91 | unsigned long delay); 92 | extern void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y, 93 | unsigned long delay); 94 | extern void XTestFakeMotionEvent_wr(Display* dpy, int dev_id, int screen, int x, int y, 95 | unsigned long delay); 96 | 97 | extern Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w); 98 | extern Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor); 99 | extern Bool XTestQueryExtension_wr(Display *dpy, int *ev, int *er, int *maj, 100 | int *min); 101 | extern void XTestDiscard_wr(Display *dpy); 102 | extern Bool XETrapQueryExtension_wr(Display *dpy, int *ev, int *er, int *op); 103 | extern int XTestGrabControl_wr(Display *dpy, Bool impervious); 104 | extern int XTRAP_GrabControl_wr(Display *dpy, Bool impervious); 105 | extern void disable_grabserver(Display *in_dpy, int change); 106 | 107 | extern Bool XRecordQueryVersion_wr(Display *dpy, int *maj, int *min); 108 | extern Bool XInputQueryVersion_wr(Display *dpy, int *maj, int *min); 109 | 110 | extern int xauth_raw(int on); 111 | extern Display *XOpenDisplay_wr(char *display_name); 112 | extern int XCloseDisplay_wr(Display *display); 113 | 114 | extern Bool XQueryPointer_wr(Display *display, Window w, Window *root_return, 115 | Window *child_return, int *root_x_return, int *root_y_return, 116 | int *win_x_return, int *win_y_return, unsigned int *mask_return); 117 | 118 | #ifdef HAVE_XI2 119 | extern Bool XIQueryPointer_wr( Display *display, 120 | int deviceid, 121 | Window win, 122 | Window *root_return, 123 | Window *child_return, 124 | double *root_x_return, 125 | double *root_y_return, 126 | double *win_x_return, 127 | double *win_y_return, 128 | XIButtonState *buttons_return, 129 | XIModifierState *modifiers_return, 130 | XIGroupState *group_return); 131 | 132 | extern Bool XIWarpPointer_wr(Display *display, 133 | int deviceid, 134 | Window src_w, 135 | Window dest_w, 136 | double src_x, 137 | double src_y, 138 | int src_width, 139 | int src_height, 140 | double dest_x, 141 | double dest_y); 142 | #endif 143 | 144 | extern Status XQueryTree_wr(Display *display, Window w, Window *root_return, 145 | Window *parent_return, Window **children_return, 146 | unsigned int *nchildren_return); 147 | 148 | extern int XFree_wr(void *data); 149 | extern int XSelectInput_wr(Display *display, Window w, long event_mask); 150 | extern KeySym XKeycodeToKeysym_wr(Display *display, KeyCode keycode, int index); 151 | 152 | #endif /* _X11VNC_XWRAPPERS_H */ 153 | -------------------------------------------------------------------------------- /tightvnc-1.3dev5-vncviewer-alpha-cursor.patch: -------------------------------------------------------------------------------- 1 | --- vnc_unixsrc.orig/vncviewer/cursor.c 2003-01-15 04:46:52.000000000 -0500 2 | +++ vnc_unixsrc/vncviewer/cursor.c 2005-02-05 12:28:10.000000000 -0500 3 | @@ -472,6 +472,140 @@ 4 | int offset, bytesPerPixel; 5 | char *pos; 6 | 7 | +#define alphahack 8 | +#ifdef alphahack 9 | + /* hack to have cursor transparency at 32bpp */ 10 | + static int alphablend = -1; 11 | + 12 | + if (alphablend < 0) { 13 | + /* you have to set NO_ALPHABLEND=1 in your environment to disable */ 14 | + if (getenv("NO_ALPHABLEND")) { 15 | + alphablend = 0; 16 | + } else { 17 | + alphablend = 1; 18 | + } 19 | + } 20 | + 21 | + bytesPerPixel = myFormat.bitsPerPixel / 8; 22 | + 23 | + if (alphablend && bytesPerPixel == 4) { 24 | + unsigned long pixel, put, *upos, *upix; 25 | + int got_alpha = 0, rsX, rsY, rsW, rsH; 26 | + static XImage *image = NULL; 27 | + static int iwidth = 128; 28 | + 29 | + if (! image) { 30 | + /* watch out for tiny fb (rare) */ 31 | + if (iwidth > si.framebufferWidth) { 32 | + iwidth = si.framebufferWidth; 33 | + } 34 | + if (iwidth > si.framebufferHeight) { 35 | + iwidth = si.framebufferHeight; 36 | + } 37 | + 38 | + /* initialize an XImage with a chunk of desktopWin */ 39 | + image = XGetImage(dpy, desktopWin, 0, 0, iwidth, iwidth, 40 | + AllPlanes, ZPixmap); 41 | + } 42 | + 43 | + /* first check if there is any non-zero alpha channel data at all: */ 44 | + for (y = 0; y < rcHeight; y++) { 45 | + for (x = 0; x < rcWidth; x++) { 46 | + int alpha; 47 | + 48 | + offset = y * rcWidth + x; 49 | + pos = (char *)&rcSource[offset * bytesPerPixel]; 50 | + 51 | + upos = (unsigned long *) pos; 52 | + alpha = (*upos & 0xff000000) >> 24; 53 | + if (alpha) { 54 | + got_alpha = 1; 55 | + break; 56 | + } 57 | + } 58 | + if (got_alpha) { 59 | + break; 60 | + } 61 | + } 62 | + 63 | + if (!got_alpha) { 64 | + /* no alpha channel data, fallback to the old way */ 65 | + goto oldway; 66 | + } 67 | + 68 | + /* load the saved fb patch in to image (faster way?) */ 69 | + XGetSubImage(dpy, rcSavedArea, 0, 0, rcWidth, rcHeight, 70 | + AllPlanes, ZPixmap, image, 0, 0); 71 | + upix = (unsigned long *)image->data; 72 | + 73 | + /* if the richcursor is clipped, the fb patch will be smaller */ 74 | + rsW = rcWidth; 75 | + rsX = 0; /* used to denote a shift from the left side */ 76 | + x = rcCursorX - rcHotX; 77 | + if (x < 0) { 78 | + rsW += x; 79 | + rsX = -x; 80 | + } else if (x + rsW > si.framebufferWidth) { 81 | + rsW = si.framebufferWidth - x; 82 | + } 83 | + rsH = rcHeight; 84 | + rsY = 0; /* used to denote a shift from the top side */ 85 | + y = rcCursorY - rcHotY; 86 | + if (y < 0) { 87 | + rsH += y; 88 | + rsY = -y; 89 | + } else if (y + rsH > si.framebufferHeight) { 90 | + rsH = si.framebufferHeight - y; 91 | + } 92 | + 93 | + /* 94 | + * now loop over the cursor data, blend in the fb values, 95 | + * and then overwrite the fb (CopyDataToScreen()) 96 | + */ 97 | + for (y = 0; y < rcHeight; y++) { 98 | + y0 = rcCursorY - rcHotY + y; 99 | + if (y0 < 0 || y0 >= si.framebufferHeight) { 100 | + continue; /* clipped */ 101 | + } 102 | + for (x = 0; x < rcWidth; x++) { 103 | + int alpha, color_curs, color_fb, i; 104 | + 105 | + x0 = rcCursorX - rcHotX + x; 106 | + if (x0 < 0 || x0 >= si.framebufferWidth) { 107 | + continue; /* clipped */ 108 | + } 109 | + 110 | + offset = y * rcWidth + x; 111 | + pos = (char *)&rcSource[offset * bytesPerPixel]; 112 | + 113 | + /* extract secret alpha byte from rich cursor: */ 114 | + upos = (unsigned long *) pos; 115 | + alpha = (*upos & 0xff000000) >> 24; /* XXX MSB? */ 116 | + 117 | + /* extract the pixel from the fb: */ 118 | + pixel = *(upix + (y-rsY)*iwidth + (x-rsX)); 119 | + 120 | + put = 0; 121 | + /* for simplicity, blend all 4 bytes */ 122 | + for (i = 0; i < 4; i++) { 123 | + int sh = i*8; 124 | + color_curs = ((0xff << sh) & *upos) >> sh; 125 | + color_fb = ((0xff << sh) & pixel) >> sh; 126 | + 127 | + /* XXX assumes pre-multipled color_curs */ 128 | + color_fb = color_curs 129 | + + ((0xff - alpha) * color_fb)/0xff; 130 | + put |= color_fb << sh; 131 | + } 132 | + /* place in the fb: */ 133 | + CopyDataToScreen((char *)&put, x0, y0, 1, 1); 134 | + } 135 | + } 136 | + return; 137 | + } 138 | +oldway: 139 | +#endif 140 | + 141 | bytesPerPixel = myFormat.bitsPerPixel / 8; 142 | 143 | /* FIXME: Speed optimization is possible. */ 144 | -------------------------------------------------------------------------------- /x11vnc.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=X11VNC Server 3 | Comment=Share this desktop by VNC 4 | Exec=x11vnc -gui tray=setpass -rfbport PROMPT -bg -o %%HOME/.x11vnc.log.%%VNCDISPLAY 5 | Icon=computer 6 | Terminal=false 7 | Type=Application 8 | StartupNotify=false 9 | #StartupWMClass=x11vnc_port_prompt 10 | Categories=Network;RemoteAccess; 11 | Keywords=VNC;Server;Screencast 12 | --------------------------------------------------------------------------------