Commit ffcc52b2 authored by Guido Günther's avatar Guido Günther

New upstream version 0.9.0

parent 83183cfa
......@@ -107,6 +107,7 @@ Steven Carr <Steven.Carr@scaa-usa.com>
Sébastien Granjoux <seb.sfo@free.fr>
Takeshi AIHANA <takeshi.aihana@gmail.com>
Victor Ibragimov <victor.ibragimov@gmail.com>
Victor Toso <me@victortoso.com>
Yaron Shahrabani <sh.yaron@gmail.com>
Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
anthony@rhesus <anthony@codemonkey.ws>
......
2018-08-17 Daniel P. Berrangé <berrange@redhat.com>
Update NEWS for 0.9.0 release
Bump next version to 0.9.0
Avoid uint8_t type as that's not always defined
Remove obsolete --without-python arg from mingw RPM
Reallow python2 usage
The keycodemapdb generator in fact works with python 2 or 3 so there is
no reason to force python 3 at this time.
Update bug tracker URL
Require glib2 >= 2.42.0
Based on targetted distros it is reasonable to require glib >= 2.42.0
RHEL-7: 2.50.3
Debian (Stretch): 2.50.3
Debian (Jessie): 2.42.1
OpenBSD (Ports): 2.54.3
FreeBSD (Ports): 2.50.3
OpenSUSE Leap 15: 2.54.3
SLE12-SP2: 2.48.2
Ubuntu (Xenial): 2.48.0
macOS (Homebrew): 2.56.0
Require libgcrypt >= 1.5.0
libgcrypt 1.5.0 was released in 2011 and all the distros that are build
target platforms for GTK-VNC include it:
RHEL-7: 1.5.3
Debian (Stretch): 1.7.6
Debian (Jessie): 1.6.3
OpenBSD (ports): 1.8.2
FreeBSD (ports): 1.8.3
OpenSUSE Leap 15: 1.8.2
Ubuntu (Xenial): 1.6.5
macOS (Homebrew): 1.8.3
Based on this, it is reasonable to require libgcrypt >= 1.5.0 in QEMU
which allows for some conditional version checks in the code to be
removed.
Require gnutls >= 3.1.18
gnutls 3.0.0 was released in 2011 and all the distros that are build
target platforms for GTK-VNC include it:
RHEL-7: 3.1.18
Debian (Stretch): 3.5.8
Debian (Jessie): 3.3.8
OpenBSD (ports): 3.5.18
FreeBSD (ports): 3.5.18
OpenSUSE Leap 15: 3.6.2
Ubuntu (Xenial): 3.4.10
macOS (Homebrew): 3.5.19
Based on this, it is reasonable to require gnutls >= 3.1.18 in GTK-VNC
which allows for all conditional version checks in the code to be
removed.
Protect against divide by zero in MSLogon auth
Support new code for ultravnc mslogon auth type
The old AUTH_MSLOGON code is only used with vnc 3.3 protocol version.
The new auth type code functions in exactly the same way as the old
version.
Check for error after reading mslogon params
Add missing cipher close calls for ARD auth
Convert to use gcrypt for d3des routines
By munging the DES key we can use the standard APIs for DES
2018-08-01 Piotr Drąg <piotrdrag@gmail.com>
Add POTFILES.skip
2018-08-01 Daniel P. Berrangé <berrange@redhat.com>
rpm: remove obsolete defattr statements
rpm: skip gtk2-devel if gtk2 is not enabled
configure: post release version bump
README: update outdated notes about GTK/python
Update NEWS for 0.8.0 release
Pull in latest keycodemapdb content
2018-07-23 Daniel P. Berrangé <berrange@redhat.com>
Remove unused variable from configure script
Allow gtk2 build to be disabled
2018-07-16 Victor Toso <me@victortoso.com>
build-sys: Disable -Wcast-function-type
Previous commit fixed one -Wcast-function-type but the remaining ones
are related to g_source_set_callback() which cannot be solved with
intermediate wrappers as the callback signature will vary depending on
the source it's called on.
This commit suppress the following:
| vncconnection.c: In function 'g_io_wait':
| vncconnection.c:343:32: warning: cast between incompatible function types from
| 'gboolean (*)(GSocket *, GIOCondition, void *)' ... to
| 'gboolean (*)(void *)' ...
|
| g_source_set_callback(src, (GSourceFunc)g_io_wait_helper, coroutine_self(), NULL);
| ^
|
| vncconnection.c: In function 'g_io_wait_interruptable':
| vncconnection.c:379:32: warning: cast between incompatible function types from
| 'gboolean (*)(GSocket *, GIOCondition, void *)' ... to
| 'gboolean (*)(void *)' ...
|
| g_source_set_callback(src, (GSourceFunc)g_io_wait_helper,
| ^
Fix -Wcast-function-type on vnc_base_framebuffer_rgb24_blt_*
The y axis is uint16 on vnc_base_framebuffer_rgb24_blt_func()
2018-07-16 Daniel P. Berrangé <berrange@redhat.com>
Delete old manual python binding
All applications should use the GObject Introspection dynamic binding
2018-03-23 Daniel P. Berrangé <berrange@redhat.com>
Update NEWS for 0.7.2 release
......
......@@ -291,7 +291,7 @@ GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@
GIOUNIX_LIBS = @GIOUNIX_LIBS@
GIO_CFLAGS = @GIO_CFLAGS@
GIO_LIBS = @GIO_LIBS@
GIO_REQUIRED = @GIO_REQUIRED@
GLIB_REQUIRED = @GLIB_REQUIRED@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
......@@ -299,7 +299,6 @@ GNUTLS_LIBS = @GNUTLS_LIBS@
GNUTLS_REQUIRED = @GNUTLS_REQUIRED@
GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
GOBJECT_LIBS = @GOBJECT_LIBS@
GOBJECT_REQUIRED = @GOBJECT_REQUIRED@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
......@@ -377,11 +376,8 @@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
......
GTK VNC News
============
Aug 17, 2018: Release 0.9.0
===========================
Note that the next release (1.0.0) will drop support for GTK-2
o Requires gnutls >= 3.1.18
o Requires libgcrypt >= 1.5.0
o Requires glib2 >= 2.42.0
o Use libgcrypt for DES routines
o Add missing cipher close calls in ARD auth
o Check for errors after reading mslogon params
o Support newer UltraVNC mslogon auth type code
o Avoid divide by zero in mslogin auth from bogus params
o Re-allow python2 accidentally blocked when removing
python binding
Aug 1, 2018: Release 0.8.0
===========================
o Deleted the python2 binding in favour of GObject introspection
o Pull in latest keycodemapdb content
o Disable/fix -Wcast-function-type warnings
Mar 23, 2018: Release 0.7.2
===========================
......
......@@ -9,8 +9,7 @@ asynchronous while remaining single threaded. It provides
two core C libraries, libgvnc for interacting with the core
RFB protocol and libgtk-vnc for a GTK display widget.
There is a traditional Python binding built on PyGTK, and
evolving support for arbitrary languages via the GObject
Access from non-C languages is available using the GObject
Introspection system.
For information about the project visit the webpage at:
......@@ -21,32 +20,26 @@ To contact developers use the project mailing list at:
http://mail.gnome.org/mailman/listinfo/gtk-vnc-list
To browse or report bugs, go to our bugzilla page at:
http://bugzilla.gnome.org/browse.cgi?product=gtk-vnc
To browse or report bugs, go to our bug tracker page at:
https://gitlab.gnome.org/GNOME/gtk-vnc/issues
Installation notes
------------------
* GTK2/GTK3: The build currently defaults to using GTK2.
To enable GTK3 support the flag '--with-gtk=3.0' must
* GTK2/GTK3: The build currently defaults to using GTK3.
To enable legacy GTK2 support the flag '--with-gtk=2.0' must
be passed to configure.
./configure --with-gtk=3.0
Notes on GTK3 support:
- The traditional python bindings are disabled when GTK3
is used. Applications should use the GObject introspection
bindings instead.
./configure --with-gtk=2.0
- When built against GTK3, the library name for gtk-vnc
will become 'gtk-vnc-2.0.so' and the pkg-config file will
also be 'gtk-vnc-2.0'.
Note that when built against GTK3 the library name for gtk-vnc
will become 'gtk-vnc-2.0.so' and the pkg-config file will
also be 'gtk-vnc-2.0', rather than 'gtk-vnc-1.0.so' and 'gtk-vnc-1.0'
for the GTK2 build.
- The gvnc library is unaffected by GTK2/GTK3 build
since it only depends on GLib/GIO
The gvnc library is unaffected by GTK2/GTK3 build choice since it
only depends on GLib/GIO
* NetBSD: You must run configure using
......
......@@ -47,7 +47,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
#
# Modified to require ngettext
# Matthias Clasen <mclasen@redhat.com> 08/06/2004
#
# Increment this whenever this file is changed.
#serial 1
# We need this here as well, since someone might use autoconf-2.5x
# to configure GLib then an older version to configure a package
# using AM_GLIB_GNU_GETTEXT
......
#! /bin/sh
#!/bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2016-01-11.22; # UTC
......
#! /bin/sh
#!/bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2017 Free Software Foundation, Inc.
......
#! /bin/sh
#!/bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2017 Free Software Foundation, Inc.
......
#! /bin/sh
#!/bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2016-01-11.22; # UTC
......
......@@ -7272,10 +7272,12 @@ func_mode_link ()
# -tp=* Portland pgcc target processor selection
# --sysroot=* for sysroot support
# -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
# -specs=* GCC specs files
# -stdlib=* select c++ std lib with clang
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
-specs=*)
func_quote_for_eval "$arg"
arg=$func_quote_for_eval_result
func_append compile_command " $arg"
......
#! /bin/sh
#!/bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2016-01-11.22; # UTC
......
#! /bin/sh
#!/bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2016-01-11.22; # UTC
......
......@@ -36,9 +36,6 @@
/* Whether GIO UNIX is available */
#undef HAVE_GIOUNIX
/* whether gnutls uses gcrypt */
#undef HAVE_GNUTLS_GCRYPT
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
AC_PREREQ(2.63)
AC_INIT([gtk-vnc],[0.7.2],[https://bugzilla.gnome.org/enter_bug.cgi?product=gtk-vnc],[gtk-vnc],[https://wiki.gnome.org/Projects/gtk-vnc])
AC_INIT([gtk-vnc],[0.9.0],[https://gitlab.gnome.org/GNOME/gtk-vnc/issues],[gtk-vnc],[https://wiki.gnome.org/Projects/gtk-vnc])
AC_CONFIG_SRCDIR([src/vncconnection.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
......@@ -27,21 +27,16 @@ dnl ****************************************************************************
dnl Declare required library versions
dnl *******************************************************************************
GOBJECT_REQUIRED=2.10.0
AC_SUBST(GOBJECT_REQUIRED)
GIO_REQUIRED=2.10.0
AC_SUBST(GIO_REQUIRED)
GLIB_REQUIRED=2.42.0
AC_SUBST(GLIB_REQUIRED)
GDK_PIXBUF_REQUIRED=2.10.0
AC_SUBST(GDK_PIXBUF_REQUIRED)
GCRYPT_REQUIRED=1.4.0
GCRYPT_REQUIRED=1.5.0
AC_SUBST(GCRYPT_REQUIRED)
GNUTLS_REQUIRED=2.2.0
GNUTLS_REQUIRED=3.1.18
AC_SUBST(GNUTLS_REQUIRED)
PYGTK_REQUIRED=2.0.0
VIEW_REQUIRED=0.6.0
GTHREAD_REQUIRED=2.0.0
PYTHON_REQUIRED=2.4
CAIRO_REQUIRED=1.2.0
dnl *******************************************************************************
......@@ -118,20 +113,6 @@ AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
AC_CHECK_HEADERS([pwd.h termios.h])
AC_ARG_WITH(python,
[ --with-python build python bindings],
[case "${withval}" in
yes|no) ;;
*) AC_MSG_ERROR([bad value ${withval} for python option]) ;;
esac],[withval=yes])
if test "$with_gtk" = "3.0"
then
WITH_PYTHON=no
else
WITH_PYTHON=$withval
fi
GTK_VNC_COMPILE_WARNINGS
AC_ARG_WITH(examples,
......@@ -169,15 +150,15 @@ AC_SUBST([NO_UNDEFINED_FLAGS])
AC_SUBST([VERSION_SCRIPT_FLAGS])
AM_CONDITIONAL([USE_VERSION_DEFS], [test "$USE_VERSION_DEFS" = "1"])
PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= $GOBJECT_REQUIRED)
PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)
PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
PKG_CHECK_MODULES(GIO, gio-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= $GIO_REQUIRED, [have_giounix=yes], [have_giounix=no])
PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= $GLIB_REQUIRED, [have_giounix=yes], [have_giounix=no])
AC_SUBST(GIOUNIX_CFLAGS)
AC_SUBST(GIOUNIX_LIBS)
if test $have_giounix = "yes" ; then
......@@ -261,21 +242,6 @@ PKG_CHECK_MODULES(GNUTLS, gnutls >= $GNUTLS_REQUIRED)
AC_SUBST(GNUTLS_CFLAGS)
AC_SUBST(GNUTLS_LIBS)
if $PKG_CONFIG --exists 'gnutls >= 3.0'; then
GNUTLS_GCRYPT=no
elif $PKG_CONFIG --exists 'gnutls >= 2.12'; then
case `$PKG_CONFIG --libs --static gnutls` in
*gcrypt*) GNUTLS_GCRYPT=yes ;;
*nettle*) GNUTLS_GCRYPT=no ;;
*) GNUTLS_GCRYPT=yes ;;
esac
else
GNUTLS_GCRYPT=yes
fi
if test "x$GNUTLS_GCRYPT" = "xyes"; then
AC_DEFINE_UNQUOTED([HAVE_GNUTLS_GCRYPT], [1], [whether gnutls uses gcrypt])
fi
dnl Cyrus SASL
AC_ARG_WITH([sasl],
......@@ -356,7 +322,7 @@ if test "$with_coroutine" = "ucontext"; then
fi
if test "$with_coroutine" = "gthread"; then
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 > $GTHREAD_REQUIRED)
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 > $GLIB_REQUIRED)
WITH_UCONTEXT=0
fi
AC_SUBST(GTHREAD_CFLAGS)
......@@ -365,33 +331,7 @@ AC_DEFINE_UNQUOTED([WITH_UCONTEXT],[$WITH_UCONTEXT], [Whether to use ucontext co
AM_CONDITIONAL(WITH_UCONTEXT, [test "$WITH_UCONTEXT" != "0"])
# Needed for keycodemap generator
AM_PATH_PYTHON
if test "$WITH_PYTHON" = "yes"; then
PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= $PYGTK_REQUIRED)
AC_SUBST(PYGTK_CFLAGS)
AC_SUBST(PYGTK_LIBS)
AC_MSG_CHECKING([whether $PYTHON version >= $PYTHON_REQUIRED])
HAVE_PYTHON_REQUIRED=no
AM_PYTHON_CHECK_VERSION([$PYTHON], [$PYTHON_REQUIRED],
[HAVE_PYTHON_REQUIRED="yes"],
[HAVE_PYTHON_REQUIRED="no"])
AC_MSG_RESULT($HAVE_PYTHON_REQUIRED)
if test "x$HAVE_PYTHON_REQUIRED" != "xyes"
then
AC_MSG_ERROR("No suitable python found")
fi
AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
if test "x$have_python_headers" != "xyes"
then
AC_MSG_ERROR("No python development headers found")
fi
fi
AM_PATH_PYTHON()
dnl define a MAINT-like variable REBUILD which is set
dnl if Perl, so autogenerated sources can be rebuilt
......@@ -406,8 +346,6 @@ fi
AC_SUBST(REBUILD)
AM_CONDITIONAL(WITH_PYTHON, [test "$WITH_PYTHON" = "yes"])
AM_CONDITIONAL(WITH_EXAMPLES, [test "$WITH_EXAMPLES" = "yes"])
GOBJECT_INTROSPECTION_CHECK([0.9.4])
......@@ -461,18 +399,9 @@ Configure summary:
Extra Link Flags ...........: ${VERSION_SCRIPT_FLAGS} ${NO_UNDEFINED_FLAGS}
Prefix......................: ${prefix}
Python binding .............: ${WITH_PYTHON}
Install example programs ...: ${WITH_EXAMPLES}
SASL support................: ${enable_sasl}
PulseAudio support..........: ${HAVE_PULSEAUDIO}
GTK+ version................: ${GTK_API_VERSION}
TLS priority................: ${with_tls_priority}
"
if test ${WITH_PYTHON} = "yes" ; then
echo "WARNING:"
echo "WARNING: The python2 binding will be deleted in the next release."
echo "WARNING: Please use the GObject Introspection dynamic bindings."
echo "WARNING:"
echo
fi
......@@ -19,7 +19,6 @@ gvncviewer_CFLAGS = $(GTK_CFLAGS) \
$(WARN_CFLAGS) \
$(VIEW_CFLAGS) -I$(top_srcdir)/src/
EXTRA_DIST = gvncviewer-bindings.py gvncviewer-introspection.py \
gvncviewer.js gvncviewer.pl
EXTRA_DIST = gvncviewer.py gvncviewer.js gvncviewer.pl
-include $(top_srcdir)/git.mk
......@@ -226,7 +226,7 @@ GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@
GIOUNIX_LIBS = @GIOUNIX_LIBS@
GIO_CFLAGS = @GIO_CFLAGS@
GIO_LIBS = @GIO_LIBS@
GIO_REQUIRED = @GIO_REQUIRED@
GLIB_REQUIRED = @GLIB_REQUIRED@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
......@@ -234,7 +234,6 @@ GNUTLS_LIBS = @GNUTLS_LIBS@
GNUTLS_REQUIRED = @GNUTLS_REQUIRED@
GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
GOBJECT_LIBS = @GOBJECT_LIBS@
GOBJECT_REQUIRED = @GOBJECT_REQUIRED@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
......@@ -312,11 +311,8 @@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
PYGTK_CFLAGS = @PYGTK_CFLAGS@
PYGTK_LIBS = @PYGTK_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
......@@ -406,9 +402,7 @@ gvncviewer_CFLAGS = $(GTK_CFLAGS) \
$(WARN_CFLAGS) \
$(VIEW_CFLAGS) -I$(top_srcdir)/src/
EXTRA_DIST = gvncviewer-bindings.py gvncviewer-introspection.py \
gvncviewer.js gvncviewer.pl
EXTRA_DIST = gvncviewer.py gvncviewer.js gvncviewer.pl
all: all-am
.SUFFIXES:
......
#!/usr/bin/python
# GTK VNC Widget
#
# Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.0 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import gtk
import gtkvnc
import sys
if len(sys.argv) != 2 and len(sys.argv) != 3:
print "syntax: gvncviewer.py host:display [password]"
sys.exit(1)
def set_title(vnc, window, grabbed):
name = vnc.get_name()
keys = vnc.get_grab_keys()
keystr = None
for k in keys:
if keystr is None:
keystr = gtk.gdk.keyval_name(k)
else:
keystr = keystr + "+" + gtk.gdk.keyval_name(k)
if grabbed:
subtitle = "(Press %s to release pointer) " % keystr
else:
subtitle = ""
window.set_title("%s%s - GVncViewer" % (subtitle, name))
def vnc_screenshot(src, ev, vnc):
if ev.keyval == gtk.gdk.keyval_from_name("F11"):
pix = vnc.get_pixbuf()
pix.save("gvncviewer.png", "png", { "tEXt::Generator App": "gvncviewer.py" })
print "Screenshot saved to gvncviewer.png"
return False
def vnc_grab(src, window):
set_title(src, window, True)
def vnc_ungrab(src, window):
set_title(src, window, False)
def vnc_connected(src):
print "Connected to server"
def vnc_initialized(src, window):
print "Connection initialized"
set_title(src, window, False)
window.show_all()
def vnc_disconnected(src):
print "Disconnected from server"
gtk.main_quit()
def send_caf1(src, vnc):
print "Send Ctrl+Alt+F1"
vnc.send_keys(["Control_L", "Alt_L", "F1"])
def send_caf7(src, vnc):
print "Send Ctrl+Alt+F7"
vnc.send_keys(["Control_L", "Alt_L", "F7"])
def send_cad(src, vnc):
print "Send Ctrl+Alt+Del"
vnc.send_keys(["Control_L", "Alt_L", "Del"])
def send_cab(src, vnc):
print "Send Ctrl+Alt+BackSpace"
vnc.send_keys(["Control_L", "Alt_L", "BackSpace"])
def vnc_auth_cred(src, credList):
prompt = 0
data = []
for i in range(len(credList)):
data.append(None)
if credList[i] in (gtkvnc.CREDENTIAL_USERNAME, gtkvnc.CREDENTIAL_PASSWORD):
prompt = prompt + 1
elif credList[i] == gtkvnc.CREDENTIAL_CLIENTNAME:
data[i] = "gvncviewer"
if prompt:
dialog = gtk.Dialog("Authentication required", None, 0, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)
label = []
entry = []
box = gtk.Table(2, prompt)
row = 0
for i in range(len(credList)):
entry.append(gtk.Entry())
if credList[i] == gtkvnc.CREDENTIAL_USERNAME:
label.append(gtk.Label("Username:"))
elif credList[i] == gtkvnc.CREDENTIAL_PASSWORD:
label.append(gtk.Label("Password:"))
entry[-1].set_visibility(False)
entry[-1].set_activates_default(True)
else:
entry[-1].destroy()
continue
box.attach(label[row], 0, 1, row, row+1, 0, 0, 3, 3)
box.attach(entry[row], 1, 2, row, row+1, 0, 0, 3, 3)
row = row + 1
vbox = dialog.get_child()
vbox.add(box)
dialog.show_all()
res = dialog.run()
dialog.hide()
if res == gtk.RESPONSE_OK:
row = 0
for i in range(len(credList)):
if credList[i] in (gtkvnc.CREDENTIAL_USERNAME, gtkvnc.CREDENTIAL_PASSWORD):
data[i] = entry[row].get_text()
row = row + 1
dialog.destroy()
for i in range(len(credList)):
if i < len(data) and data[i] != None:
if src.set_credential(credList[i], data[i]):
print "Cannot set credential type %d" % (credList[i])
src.close()
else:
print "Unsupported credential type %d" % (credList[i])
src.close()
window = gtk.Window()
vnc = gtkvnc.Display()
layout = gtk.VBox()
window.add(layout)
menubar = gtk.MenuBar()
sendkeys = gtk.MenuItem("_Send keys")
menubar.append(sendkeys)
buttons = gtk.HBox()
caf1 = gtk.MenuItem("Ctrl+Alt+F_1")
caf7 = gtk.MenuItem("Ctrl+Alt+F_7")
cad = gtk.MenuItem("Ctrl+Alt+_Del")
cab = gtk.MenuItem("Ctrl+Alt+_Backspace")
submenu = gtk.Menu()
submenu.append(caf1)
submenu.append(caf7)
submenu.append(cad)
submenu.append(cab)
sendkeys.set_submenu(submenu)
caf1.connect("activate", send_caf1, vnc)
caf7.connect("activate", send_caf7, vnc)
cad.connect("activate", send_cad, vnc)
cab.connect("activate", send_cab, vnc)
layout.add(menubar)
layout.add(vnc)
vnc.realize()
vnc.set_pointer_grab(True)
vnc.set_keyboard_grab(True)
# Example to change grab key combination to Ctrl+Alt+g
grab_keys = [ gtk.keysyms.Control_L, gtk.keysyms.Alt_L, gtk.keysyms.g ]
vnc.set_grab_keys(grab_keys)
#v.set_pointer_local(True)
if len(sys.argv) == 3:
vnc.set_credential(gtkvnc.CREDENTIAL_PASSWORD, sys.argv[2])
disp = sys.argv[1].find(":")
if disp != -1:
host = sys.argv[1][:disp]
port = str(5900 + int(sys.argv[1][disp+1:]))
else:
host = sys.argv[1]
port = "5900"
print "Connecting to %s %s" % (host, port)
vnc.open_host(host, port)
vnc.connect("vnc-pointer-grab", vnc_grab, window)
vnc.connect("vnc-pointer-ungrab", vnc_ungrab, window)
vnc.connect("vnc-connected", vnc_connected)
vnc.connect("vnc-initialized", vnc_initialized, window)