[gtk-vnc] Delete support for GTK2



commit 86c68cd8ba1c43af28a6308c64b80d302689ba09
Author: Daniel P. Berrangé <berrange redhat com>
Date:   Mon Dec 3 11:45:29 2018 +0000

    Delete support for GTK2
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 autobuild.sh              |  60 +-----------
 configure.ac              |  36 +------
 gtk-vnc-1.0.pc.in         |  11 ---
 gtk-vnc.spec.in           | 125 +++----------------------
 mingw-gtk-vnc.spec.in     |  82 ++++------------
 src/Makefile.am           |  46 +--------
 src/gtk-vnc.h             |   3 -
 src/vncdisplay.c          | 125 ++++---------------------
 src/vncimageframebuffer.c | 234 ----------------------------------------------
 src/vncimageframebuffer.h |  83 ----------------
 10 files changed, 58 insertions(+), 747 deletions(-)
---
diff --git a/autobuild.sh b/autobuild.sh
index 2338e4d..361bdf0 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -14,8 +14,7 @@ mkdir build
 cd build
 
 ../autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT \
-    --enable-werror \
-    --with-gtk=2.0
+    --enable-werror
 
 make
 make install
@@ -29,19 +28,6 @@ st=$(
 exec 3>&-
 test "$st" = 0
 
-
-# Test GTK3 build too if available
-pkg-config gtk+-3.0 1>/dev/null 2>&1
-if test $? = 0 ; then
-  make distclean
-  ../configure --prefix=$AUTOBUILD_INSTALL_ROOT \
-    --enable-werror \
-    --without-python \
-    --with-gtk=3.0
-  make
-  make install
-fi
-
 rm -f *.tar.gz
 make dist
 
@@ -71,30 +57,10 @@ if [ -x /usr/bin/i686-w64-mingw32-gcc ]; then
     --without-python \
     --without-sasl \
     --prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
-    --enable-werror \
-    --with-gtk=2.0
+    --enable-werror
 
   make
   make install
-
-  # Test GTK3 build too if available
-  PKG_CONFIG_LIBDIR=/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig pkg-config gtk+-3.0 1>/dev/null 2>&1
-  if test $? = 0 ; then
-    make distclean
-    PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
-    PATH="/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH" \
-    CC="i686-w64-mingw32-gcc" \
-    ../configure --prefix=$AUTOBUILD_INSTALL_ROOT \
-      --build=$(uname -m)-w64-linux \
-      --host=i686-w64-mingw32 \
-      --without-python \
-      --without-sasl \
-      --prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
-      --enable-werror \
-      --with-gtk=3.0
-    make
-    make install
-  fi
 fi
 
 
@@ -110,30 +76,10 @@ if [ -x /usr/bin/x86_64-w64-mingw32-gcc ]; then
     --without-python \
     --without-sasl \
     --prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
-    --enable-werror \
-    --with-gtk=2.0
+    --enable-werror
 
   make
   make install
-
-  # Test GTK3 build too if available
-  PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig pkg-config gtk+-3.0 1>/dev/null 2>&1
-  if test $? = 0 ; then
-    make distclean
-    PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
-    PATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH" \
-    CC="x86_64-w64-mingw32-gcc" \
-    ../configure --prefix=$AUTOBUILD_INSTALL_ROOT \
-      --build=$(uname -m)-w64-linux \
-      --host=x86_64-w64-mingw32 \
-      --without-python \
-      --without-sasl \
-      --prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
-      --enable-werror \
-      --with-gtk=3.0
-    make
-    make install
-  fi
 fi
 
 if test -x /usr/bin/i686-w64-mingw32-gcc && test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
diff --git a/configure.ac b/configure.ac
index f5e7859..a27f54e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,32 +83,13 @@ dnl ****************************************************************************
 # GTK+
 ################################################################################
 
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
-  [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 3.0)])],
-  [case "$with_gtk" in
-     2.0|3.0) ;;
-     *) AC_MSG_ERROR([invalid gtk version specified]) ;;
-   esac],
-  [with_gtk=3.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
-  2.0) GTK_API_VERSION=2.0
-       GTK_REQUIRED=2.18.0
-       GTK_VNC_API_VERSION=1.0
-       ;;
-  3.0) GTK_API_VERSION=3.0
-       GTK_REQUIRED=3.0.0
-       GTK_VNC_API_VERSION=2.0
-       ;;
-esac
+GTK_API_VERSION=3.0
+GTK_REQUIRED=3.0.0
+GTK_VNC_API_VERSION=2.0
 
 AC_SUBST([GTK_API_VERSION])
 AC_SUBST([GTK_REQUIRED])
 AC_SUBST([GTK_VNC_API_VERSION])
-AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
-AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
 
 AC_CHECK_HEADERS([pwd.h termios.h])
 
@@ -169,7 +150,7 @@ PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED)
 AC_SUBST(GDK_PIXBUF_CFLAGS)
 AC_SUBST(GDK_PIXBUF_LIBS)
 
-PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
@@ -349,15 +330,9 @@ AM_CONDITIONAL(WITH_EXAMPLES, [test "$WITH_EXAMPLES" = "yes"])
 
 GOBJECT_INTROSPECTION_CHECK([0.9.4])
 
-if test "x$with_gtk" = "x3.0"; then
-        default_vala=check
-else
-        default_vala=no
-fi
-
 AC_ARG_ENABLE([vala],
               AS_HELP_STRING([--enable-vala], [enable Vala binding generation]),
-              [], [enable_vala="$default_vala"])
+              [], [enable_vala="check"])
 if test "x$found_introspection" = "xyes" ; then
         if test "x$enable_vala" != "xno" ; then
                 AC_PATH_PROG(VAPIGEN, vapigen, no)
@@ -382,7 +357,6 @@ AC_CONFIG_FILES(
   vapi/Makefile
   gvnc-1.0.pc
   gvncpulse-1.0.pc
-  gtk-vnc-1.0.pc
   gtk-vnc-2.0.pc
   gtk-vnc.spec
   mingw-gtk-vnc.spec
diff --git a/gtk-vnc.spec.in b/gtk-vnc.spec.in
index 04f8502..db4ef6f 100644
--- a/gtk-vnc.spec.in
+++ b/gtk-vnc.spec.in
@@ -1,27 +1,10 @@
 # -*- rpm-spec -*-
 
 # This spec file assumes you are building for Fedora 26 or newer,
-# or for RHEL 6 or newer. It may need some tweaks for other distros.
+# or for RHEL 7 or newer. It may need some tweaks for other distros.
 
-%global with_gir 0
-%if 0%{?fedora} || 0%{?rhel} >= 7
 %global with_gir 1
-%endif
-
-%global with_gtk2 1
-%if 0%{?rhel} >= 8
-%global with_gtk2 0
-%endif
-
-%global with_gtk3 0
-%if 0%{?fedora} || 0%{?rhel} >= 7
-%global with_gtk3 1
-%endif
-
-%global with_vala 0
-%if 0%{with_gtk3}
 %global with_vala 1
-%endif
 
 %if 0%{?fedora} || 0%{?rhel} >= 8
     %global tls_priority "@LIBVIRT,SYSTEM"
@@ -29,7 +12,7 @@
     %global tls_priority "NORMAL"
 %endif
 
-Summary: A GTK2 widget for VNC clients
+Summary: A GTK widget for VNC clients
 Name: gtk-vnc
 Version: @VERSION@
 Release: 1%{?dist}%{?extra_release}
@@ -37,9 +20,6 @@ License: LGPLv2+
 Source: http://ftp.gnome.org/pub/GNOME/sources/%{name}/0.5/%{name}-%{version}.tar.xz
 URL: https://wiki.gnome.org/Projects/gtk-vnc
 Requires: gvnc = %{version}-%{release}
-%if %{with_gtk2}
-BuildRequires: gtk2-devel >= 2.14
-%endif
 %if 0%{?fedora}
 BuildRequires: python3
 %else
@@ -53,9 +33,7 @@ BuildRequires: gnutls-devel libgcrypt-devel cyrus-sasl-devel zlib-devel intltool
 %if %{with_gir}
 BuildRequires: gobject-introspection-devel
 %endif
-%if %{with_gtk3}
 BuildRequires: gtk3-devel
-%endif
 %if %{with_vala}
 BuildRequires: vala-tools
 %endif
@@ -63,23 +41,9 @@ BuildRequires: pulseaudio-libs-devel
 BuildRequires: /usr/bin/pod2man
 
 %description
-gtk-vnc is a VNC viewer widget for GTK2. It is built using coroutines
-allowing it to be completely asynchronous while remaining single threaded.
-
-%if %{with_gtk2}
-%package devel
-Summary: Development files to build GTK2 applications with gtk-vnc
-Requires: %{name} = %{version}-%{release}
-Requires: pkgconfig
-Requires: gtk2-devel
-
-%description devel
-gtk-vnc is a VNC viewer widget for GTK2. It is built using coroutines
+gtk-vnc is a VNC viewer widget for GTK. It is built using coroutines
 allowing it to be completely asynchronous while remaining single threaded.
 
-Libraries, includes, etc. to compile with the gtk-vnc library
-%endif
-
 %package -n gvnc
 Summary: A GObject for VNC connections
 
@@ -130,7 +94,6 @@ Provides useful command line utilities for interacting with
 VNC servers. Includes the gvnccapture program for capturing
 screenshots of a VNC desktop
 
-%if %{with_gtk3}
 %package -n gtk-vnc2
 Summary: A GTK3 widget for VNC clients
 Requires: gvnc = %{version}-%{release}
@@ -150,13 +113,9 @@ gtk-vnc is a VNC viewer widget for GTK3. It is built using coroutines
 allowing it to be completely asynchronous while remaining single threaded.
 
 Libraries, includes, etc. to compile with the gtk-vnc library
-%endif
 
 %prep
-%autosetup -n gtk-vnc-%{version} -c
-%if %{with_gtk3}
-cp -a gtk-vnc-%{version} gtk-vnc2-%{version}
-%endif
+%autosetup -n gtk-vnc-%{version}
 
 %build
 %if %{with_gir}
@@ -165,38 +124,15 @@ cp -a gtk-vnc-%{version} gtk-vnc2-%{version}
 %define gir_arg --enable-introspection=no
 %endif
 
-%if %{with_gtk2}
-cd gtk-vnc-%{version}
-%configure --with-gtk=2.0 %{gir_arg} \
-          --with-tls-priority=%{tls_priority}
-%__make %{?_smp_mflags} V=1
-chmod -x examples/*.pl examples/*.js examples/*.py
-cd ..
-%endif
-
-%if %{with_gtk3}
-cd gtk-vnc2-%{version}
-
-%configure --with-gtk=3.0 %{gir_arg} \
+%configure %{gir_arg} \
           --with-tls-priority=%{tls_priority}
 %__make %{?_smp_mflags} V=1
 chmod -x examples/*.pl examples/*.js examples/*.py
-cd ..
-%endif
 
 %install
 rm -fr %{buildroot}
-%if %{with_gtk2}
-cd gtk-vnc-%{version}
-%__make install DESTDIR=%{buildroot}
-cd ..
-%endif
 
-%if %{with_gtk3}
-cd gtk-vnc2-%{version}
 %__make install DESTDIR=%{buildroot}
-cd ..
-%endif
 
 rm -f %{buildroot}%{_libdir}/*.a
 rm -f %{buildroot}%{_libdir}/*.la
@@ -215,42 +151,13 @@ rm -f %{buildroot}%{_libdir}/*.la
 
 %postun -n gvncpulse -p /sbin/ldconfig
 
-%if %{with_gtk3}
 %post -n gtk-vnc2 -p /sbin/ldconfig
 
 %postun -n gtk-vnc2 -p /sbin/ldconfig
-%endif
 
 %check
-%if %{with_gtk2}
-cd gtk-vnc-%{version}
-make %{?_smp_mflags} check
-cd ..
-%endif
-
-%if %{with_gtk3}
-cd gtk-vnc2-%{version}
 make %{?_smp_mflags} check
-cd ..
-%endif
-
-%if %{with_gtk2}
-%files
-%{_libdir}/libgtk-vnc-1.0.so.*
-%if %{with_gir}
-%{_libdir}/girepository-1.0/GtkVnc-1.0.typelib
-%endif
 
-%files devel
-%doc gtk-vnc-%{version}/examples/gvncviewer.c
-%{_libdir}/libgtk-vnc-1.0.so
-%dir %{_includedir}/%{name}-1.0/
-%{_includedir}/%{name}-1.0/*.h
-%{_libdir}/pkgconfig/%{name}-1.0.pc
-%if %{with_gir}
-%{_datadir}/gir-1.0/GtkVnc-1.0.gir
-%endif
-%endif
 
 %files -n gvnc -f %{name}.lang
 %{_libdir}/libgvnc-1.0.so.*
@@ -291,16 +198,15 @@ cd ..
 %endif
 
 %files -n gvnc-tools
-%doc gtk-vnc-%{version}/AUTHORS
-%doc gtk-vnc-%{version}/ChangeLog
-%doc gtk-vnc-%{version}/ChangeLog-old
-%doc gtk-vnc-%{version}/NEWS
-%doc gtk-vnc-%{version}/README
-%doc gtk-vnc-%{version}/COPYING.LIB
+%doc AUTHORS
+%doc ChangeLog
+%doc ChangeLog-old
+%doc NEWS
+%doc README
+%doc COPYING.LIB
 %{_bindir}/gvnccapture
 %{_mandir}/man1/gvnccapture.1*
 
-%if %{with_gtk3}
 %files -n gtk-vnc2
 %{_libdir}/libgtk-vnc-2.0.so.*
 %if %{with_gir}
@@ -312,11 +218,11 @@ cd ..
 %endif
 
 %files -n gtk-vnc2-devel
-%doc gtk-vnc2-%{version}/examples/gvncviewer.c
+%doc examples/gvncviewer.c
 %if %{with_gir}
-%doc gtk-vnc2-%{version}/examples/gvncviewer.js
-%doc gtk-vnc2-%{version}/examples/gvncviewer.pl
-%doc gtk-vnc2-%{version}/examples/gvncviewer.py
+%doc examples/gvncviewer.js
+%doc examples/gvncviewer.pl
+%doc examples/gvncviewer.py
 %endif
 %{_libdir}/libgtk-vnc-2.0.so
 %dir %{_includedir}/%{name}-2.0/
@@ -325,6 +231,5 @@ cd ..
 %if %{with_gir}
 %{_datadir}/gir-1.0/GtkVnc-2.0.gir
 %endif
-%endif
 
 %changelog
diff --git a/mingw-gtk-vnc.spec.in b/mingw-gtk-vnc.spec.in
index d0ed2e9..3e736ad 100644
--- a/mingw-gtk-vnc.spec.in
+++ b/mingw-gtk-vnc.spec.in
@@ -26,8 +26,6 @@ BuildRequires: mingw32-libgcrypt
 BuildRequires: mingw64-libgcrypt
 BuildRequires: mingw32-gnutls
 BuildRequires: mingw64-gnutls
-BuildRequires: mingw32-gtk2
-BuildRequires: mingw64-gtk2
 BuildRequires: mingw32-gtk3
 BuildRequires: mingw64-gtk3
 
@@ -41,10 +39,6 @@ gtk-vnc is a VNC viewer widget for GTK. It is built using coroutines
 allowing it to be completely asynchronous while remaining single threaded.
 
 # Mingw32
-%package -n mingw32-gtk-vnc
-Summary:        MinGW Windows zlib compression library for the win32 target
-Requires:       pkgconfig
-
 %package -n mingw32-gvnc
 Summary: MinGW Windows port of VNC GObject
 
@@ -55,10 +49,6 @@ Summary: Command line VNC tools
 Summary: A GTK3 widget for VNC clients
 Requires: pkgconfig
 
-%description -n mingw32-gtk-vnc
-gtk-vnc is a VNC viewer widget for GTK. It is built using coroutines
-allowing it to be completely asynchronous while remaining single threaded.
-
 %description -n mingw32-gvnc
 gvnc is a GObject for managing a VNC connection. It provides all the
 infrastructure required to build a VNC client without having to deal
@@ -74,10 +64,6 @@ gtk-vnc is a VNC viewer widget for GTK. It is built using coroutines
 allowing it to be completely asynchronous while remaining single threaded.
 
 # Mingw64
-%package -n mingw64-gtk-vnc
-Summary:        MinGW Windows zlib compression library for the win64 target
-Requires:       pkgconfig
-
 %package -n mingw64-gvnc
 Summary: MinGW Windows port of VNC GObject
 
@@ -88,10 +74,6 @@ Summary: Command line VNC tools
 Summary: A GTK3 widget for VNC clients
 Requires: pkgconfig
 
-%description -n mingw64-gtk-vnc
-gtk-vnc is a VNC viewer widget for GTK. It is built using coroutines
-allowing it to be completely asynchronous while remaining single threaded.
-
 %description -n mingw64-gvnc
 gvnc is a GObject for managing a VNC connection. It provides all the
 infrastructure required to build a VNC client without having to deal
@@ -110,39 +92,21 @@ allowing it to be completely asynchronous while remaining single threaded.
 
 
 %prep
-%autosetup -n gtk-vnc-%{version} -c
-touch gtk-vnc-%{version}/GNUmakefile
-cp -a gtk-vnc-%{version} gtk-vnc2-%{version}
+%autosetup -n gtk-vnc-%{version}
 
 
 %build
-cd gtk-vnc-%{version}
-%mingw_configure --with-examples --without-sasl --with-gtk=2.0
-rm build_win{32,64}/GNUmakefile
+%mingw_configure --without-examples --without-sasl
 %mingw_make %{?_smp_mflags} V=1
-cd ..
-
-cd gtk-vnc2-%{version}
-%mingw_configure --without-examples --without-sasl --with-gtk=3.0
-rm build_win{32,64}/GNUmakefile
-%mingw_make %{?_smp_mflags} V=1
-cd ..
 
 
 %install
-cd gtk-vnc-%{version}
-%mingw_make_install DESTDIR=$RPM_BUILD_ROOT
-cd ..
-cd gtk-vnc2-%{version}
 %mingw_make_install DESTDIR=$RPM_BUILD_ROOT
-cd ..
 
 # Remove static libraries but DON'T remove *.dll.a files.
-rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/libgtk-vnc-1.0.a
 rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/libgtk-vnc-2.0.a
 rm -f $RPM_BUILD_ROOT%{mingw32_libdir}/libgvnc-1.0.a
 rm -f $RPM_BUILD_ROOT%{mingw32_mandir}/man1/gvnccapture.1*
-rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/libgtk-vnc-1.0.a
 rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/libgtk-vnc-2.0.a
 rm -f $RPM_BUILD_ROOT%{mingw64_libdir}/libgvnc-1.0.a
 rm -f $RPM_BUILD_ROOT%{mingw64_mandir}/man1/gvnccapture.1*
@@ -154,20 +118,13 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
 
 
 # Mingw32
-%files -n mingw32-gtk-vnc -f gtk-vnc.lang
-%{mingw32_bindir}/gvncviewer.exe
-%{mingw32_bindir}/libgtk-vnc-1.0-0.dll
-%{mingw32_libdir}/libgtk-vnc-1.0.dll.a
-%{mingw32_libdir}/pkgconfig/gtk-vnc-1.0.pc
-%{mingw32_includedir}/gtk-vnc-1.0
-
-%files -n mingw32-gvnc
-%doc gtk-vnc-%{version}/AUTHORS
-%doc gtk-vnc-%{version}/ChangeLog
-%doc gtk-vnc-%{version}/ChangeLog-old
-%doc gtk-vnc-%{version}/NEWS
-%doc gtk-vnc-%{version}/README
-%doc gtk-vnc-%{version}/COPYING.LIB
+%files -n mingw32-gvnc -f gtk-vnc.lang
+%doc AUTHORS
+%doc ChangeLog
+%doc ChangeLog-old
+%doc NEWS
+%doc README
+%doc COPYING.LIB
 %{mingw32_bindir}/libgvnc-1.0-0.dll
 %{mingw32_libdir}/libgvnc-1.0.dll.a
 %{mingw32_libdir}/pkgconfig/gvnc-1.0.pc
@@ -183,20 +140,13 @@ find $RPM_BUILD_ROOT -name "*.la" -delete
 %{mingw32_bindir}/gvnccapture.exe
 
 # Mingw64
-%files -n mingw64-gtk-vnc -f gtk-vnc.lang
-%{mingw64_bindir}/gvncviewer.exe
-%{mingw64_bindir}/libgtk-vnc-1.0-0.dll
-%{mingw64_libdir}/libgtk-vnc-1.0.dll.a
-%{mingw64_libdir}/pkgconfig/gtk-vnc-1.0.pc
-%{mingw64_includedir}/gtk-vnc-1.0
-
-%files -n mingw64-gvnc
-%doc gtk-vnc-%{version}/AUTHORS
-%doc gtk-vnc-%{version}/ChangeLog
-%doc gtk-vnc-%{version}/ChangeLog-old
-%doc gtk-vnc-%{version}/NEWS
-%doc gtk-vnc-%{version}/README
-%doc gtk-vnc-%{version}/COPYING.LIB
+%files -n mingw64-gvnc -f gtk-vnc.lang
+%doc AUTHORS
+%doc ChangeLog
+%doc ChangeLog-old
+%doc NEWS
+%doc README
+%doc COPYING.LIB
 %{mingw64_bindir}/libgvnc-1.0-0.dll
 %{mingw64_libdir}/libgvnc-1.0.dll.a
 %{mingw64_libdir}/pkgconfig/gvnc-1.0.pc
diff --git a/src/Makefile.am b/src/Makefile.am
index 5e323a2..6bd08b3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,19 +20,11 @@ GTK_VNC_VERSION_FILE = $(srcdir)/libgtk-vnc_sym.version
 endif
 
 %.def: %.version Makefile
-if HAVE_GTK_2
-       $(AM_V_GEN)rm -f -- $@-tmp $@ ; \
-       printf 'EXPORTS\n' > $@-tmp && \
-       sed -e '/^$$/d; /#/d; /:/d; /\}/d; /\*/d; /LIBVIRT_/d; s/[ \t]*\(.*\)\;/    \1/g' $< >> $@-tmp && \
-       chmod a-w $@-tmp && \
-       mv $@-tmp $@
-else
        $(AM_V_GEN)rm -f -- $@-tmp $@ ; \
        printf 'EXPORTS\n' > $@-tmp && \
        sed -e '/^$$/d; /#/d; /:/d; /\}/d; /\*/d; /vnc_image_framebuffer_*/d; /LIBVIRT_/d; s/[ \t]*\(.*\)\;/  
  \1/g' $< >> $@-tmp && \
        chmod a-w $@-tmp && \
        mv $@-tmp $@
-endif
 
 
 libgvnc_1_0_la_LIBADD = \
@@ -149,7 +141,6 @@ gtk_vnc_HDRS = \
                        gtk-vnc.h \
                        vncdisplay.h \
                        vncgrabsequence.h \
-                       vncimageframebuffer.h \
                        $(NULL)
 
 nodist_gtk_vnc_HDRS = \
@@ -167,28 +158,10 @@ nodist_gtk_vnc_SOURCES = \
                        vncdisplayenums.h vncdisplayenums.c \
                        $(NULL)
 
-if HAVE_GTK_2
-gtk_vnc_SOURCES += \
-                       vncimageframebuffer.h vncimageframebuffer.c
-else
-EXTRA_DIST +=          vncimageframebuffer.h vncimageframebuffer.c
-endif
-
 gtk_vnc_LDFLAGS = \
                        $(VERSION_SCRIPT_FLAGS)$(GTK_VNC_VERSION_FILE) \
                        $(NO_UNDEFINED_FLAGS)
 
-if HAVE_GTK_2
-lib_LTLIBRARIES += libgtk-vnc-1.0.la
-libgtk_vnc_1_0_ladir = $(includedir)/gtk-vnc-$(GTK_VNC_API_VERSION)/
-libgtk_vnc_1_0_la_LIBADD = $(gtk_vnc_LIBADD)
-libgtk_vnc_1_0_la_CFLAGS = $(gtk_vnc_CFLAGS)
-libgtk_vnc_1_0_la_LDFLAGS = $(gtk_vnc_LDFLAGS) -version-info 0:1:0
-libgtk_vnc_1_0_la_SOURCES = $(gtk_vnc_SOURCES)
-libgtk_vnc_1_0_la_HEADERS = $(gtk_vnc_HDRS)
-nodist_libgtk_vnc_1_0_la_SOURCES = $(nodist_gtk_vnc_SOURCES)
-nodist_libgtk_vnc_1_0_la_HEADERS = $(nodist_gtk_vnc_HDRS)
-else
 lib_LTLIBRARIES += libgtk-vnc-2.0.la
 libgtk_vnc_2_0_ladir = $(includedir)/gtk-vnc-$(GTK_VNC_API_VERSION)/
 libgtk_vnc_2_0_la_LIBADD = $(gtk_vnc_LIBADD)
@@ -198,7 +171,7 @@ libgtk_vnc_2_0_la_SOURCES = $(gtk_vnc_SOURCES)
 libgtk_vnc_2_0_la_HEADERS = $(gtk_vnc_HDRS)
 nodist_libgtk_vnc_2_0_la_SOURCES = $(nodist_gtk_vnc_SOURCES)
 nodist_libgtk_vnc_2_0_la_HEADERS = $(nodist_gtk_vnc_HDRS)
-endif
+
 
 KEYMAP_GEN = keycodemapdb/tools/keymap-gen
 KEYMAP_CSV = keycodemapdb/data/keymaps.csv
@@ -352,10 +325,6 @@ GTK_VNC_INTROSPECTION_SRCS = \
                        $(srcdir)/vncgrabsequence.h $(srcdir)/vncgrabsequence.c \
                        $(builddir)/vncdisplayenums.h $(builddir)/vncdisplayenums.c
 
-if HAVE_GTK_2
-GTK_VNC_INTROSPECTION_SRCS += \
-                       $(srcdir)/vncimageframebuffer.h $(srcdir)/vncimageframebuffer.c
-endif
 
 GVnc-1.0.gir: libgvnc-1.0.la
 GVnc_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
@@ -380,18 +349,6 @@ GVncPulse_1_0_gir_SCANNERFLAGS = --c-include="gvncpulse.h" \
 INTROSPECTION_GIRS += GVncPulse-1.0.gir
 endif
 
-if HAVE_GTK_2
-GtkVnc-1.0.gir: libgtk-vnc-$(GTK_VNC_API_VERSION).la GVnc-1.0.gir
-GtkVnc_1_0_gir_INCLUDES = GObject-2.0 Gtk-2.0
-GtkVnc_1_0_gir_PACKAGES = gobject-2.0 gtk+-2.0
-GtkVnc_1_0_gir_EXPORT_PACKAGES = gtk-vnc-$(GTK_VNC_API_VERSION)
-GtkVnc_1_0_gir_LIBS = libgvnc-1.0.la libgtk-vnc-$(GTK_VNC_API_VERSION).la
-GtkVnc_1_0_gir_FILES = $(GTK_VNC_INTROSPECTION_SRCS)
-GtkVnc_1_0_gir_CFLAGS = $(libgvnc_1_0_la_CFLAGS) $(libgvncpulse_1_0_la_CFLAGS) -I$(srcdir)
-GtkVnc_1_0_gir_SCANNERFLAGS = --c-include="gtk-vnc.h" \
-       --include-uninstalled=$(top_builddir)/src/GVnc-1.0.gir
-INTROSPECTION_GIRS += GtkVnc-1.0.gir
-else
 GtkVnc-2.0.gir: libgtk-vnc-2.0.la GVnc-1.0.gir
 GtkVnc_2_0_gir_INCLUDES = GObject-2.0 Gtk-3.0
 GtkVnc_2_0_gir_PACKAGES = gobject-2.0 gtk+-3.0
@@ -402,7 +359,6 @@ GtkVnc_2_0_gir_CFLAGS = $(libgvnc_1_0_la_CFLAGS) $(libgvncpulse_1_0_la_CFLAGS) -
 GtkVnc_2_0_gir_SCANNERFLAGS = --c-include="gtk-vnc.h" \
        --include-uninstalled=$(top_builddir)/src/GVnc-1.0.gir
 INTROSPECTION_GIRS += GtkVnc-2.0.gir
-endif
 
 girdir = $(datadir)/gir-1.0
 gir_DATA = $(INTROSPECTION_GIRS)
diff --git a/src/gtk-vnc.h b/src/gtk-vnc.h
index 01a46ec..6be4eaf 100644
--- a/src/gtk-vnc.h
+++ b/src/gtk-vnc.h
@@ -24,9 +24,6 @@
 #include <vncdisplayenums.h>
 #include <vncdisplay.h>
 #include <vncgrabsequence.h>
-#if !GTK_CHECK_VERSION(3,0,0)
-#include <vncimageframebuffer.h>
-#endif
 
 #endif
 /*
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 9f38374..9fe6afd 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -147,21 +147,6 @@ typedef enum
     } vnc_display_signals;
 
 
-/* Some compatibility defines to let us build on both Gtk2 and Gtk3 */
-#if GTK_CHECK_VERSION (2, 91, 0)
-
-static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh)
-{
-    *ww = gdk_window_get_width(w);
-    *wh = gdk_window_get_height(w);
-}
-
-#define GtkObject GtkWidget
-#define GtkObjectClass GtkWidgetClass
-#define GTK_OBJECT_CLASS(c) GTK_WIDGET_CLASS(c)
-#define gdk_cursor_unref(c) g_object_unref(c)
-#endif
-
 
 static guint signals[LAST_SIGNAL] = { 0, 0, 0, 0,
                                       0, 0, 0, 0,
@@ -396,7 +381,8 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
         setup_surface_cache(obj, cr, fbw, fbh);
     }
 
-    gdk_drawable_get_size(gtk_widget_get_window(widget), &ww, &wh);
+    ww = gdk_window_get_width(gtk_widget_get_window(widget));
+    wh = gdk_window_get_height(gtk_widget_get_window(widget));
 
     if (ww > fbw)
         mx = (ww - fbw) / 2;
@@ -448,65 +434,6 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr)
 }
 
 
-#if !GTK_CHECK_VERSION (2, 91, 0)
-static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
-{
-    VncDisplay *obj = VNC_DISPLAY(widget);
-    cairo_t *cr;
-    gboolean ret;
-
-    cr = gdk_cairo_create(gtk_widget_get_window(GTK_WIDGET(obj)));
-    cairo_rectangle(cr,
-                    expose->area.x,
-                    expose->area.y,
-                    expose->area.width,
-                    expose->area.height);
-    cairo_clip(cr);
-
-    ret = draw_event(widget, cr);
-
-    cairo_destroy(cr);
-
-    return ret;
-}
-#endif
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
-static void do_keyboard_grab_all(GdkWindow *window)
-{
-    if (window == NULL)
-        return;
-
-    gdk_keyboard_grab(window,
-                      FALSE,
-                      GDK_CURRENT_TIME);
-}
-static void do_keyboard_ungrab_all(GdkWindow *window G_GNUC_UNUSED)
-{
-    gdk_keyboard_ungrab(GDK_CURRENT_TIME);
-}
-static void do_pointer_grab_all(GdkWindow *window,
-                                GdkCursor *cursor)
-{
-    if (window == NULL)
-        return;
-
-    gdk_pointer_grab(window,
-                     FALSE, /* All events to come to our window directly */
-                     GDK_POINTER_MOTION_MASK |
-                     GDK_BUTTON_PRESS_MASK |
-                     GDK_BUTTON_RELEASE_MASK |
-                     GDK_BUTTON_MOTION_MASK |
-                     GDK_SCROLL_MASK,
-                     NULL, /* Allow cursor to move over entire desktop */
-                     cursor,
-                     GDK_CURRENT_TIME);
-}
-static void do_pointer_ungrab_all(GdkWindow *window G_GNUC_UNUSED)
-{
-    gdk_pointer_ungrab(GDK_CURRENT_TIME);
-}
-#else
 static void do_keyboard_grab_all(GdkWindow *window)
 {
     GdkDeviceManager *mgr = gdk_display_get_device_manager(gdk_window_get_display(window));
@@ -581,7 +508,6 @@ static void do_pointer_ungrab_all(GdkWindow *window)
     }
     g_list_free(devices);
 }
-#endif
 
 static void do_keyboard_grab(VncDisplay *obj, gboolean quiet)
 {
@@ -813,7 +739,8 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
     if (priv->read_only)
         return FALSE;
 
-    gdk_drawable_get_size(gtk_widget_get_window(widget), &ww, &wh);
+    ww = gdk_window_get_width(gtk_widget_get_window(widget));
+    wh = gdk_window_get_height(gtk_widget_get_window(widget));
 
     /* First apply adjustments to the coords in the motion event */
     if (priv->allow_scaling) {
@@ -859,13 +786,8 @@ static gboolean motion_event(GtkWidget *widget, GdkEventMotion *motion)
         if (y >= (gdk_screen_get_height(screen) - 1)) y -= 200;
 
         if (x != (int)motion->x_root || y != (int)motion->y_root) {
-#if GTK_CHECK_VERSION(3, 0, 0)
             GdkDevice *dev = gdk_event_get_device((GdkEvent*)motion);
             gdk_device_warp(dev, screen, x, y);
-#else
-            GdkDisplay *display = gtk_widget_get_display(widget);
-            gdk_display_warp_pointer(display, screen, x, y);
-#endif
             priv->last_x = -1;
             priv->last_y = -1;
             return FALSE;
@@ -1221,7 +1143,8 @@ static void on_framebuffer_update(VncConnection *conn G_GNUC_UNUSED,
     fbw = vnc_framebuffer_get_width(VNC_FRAMEBUFFER(priv->fb));
     fbh = vnc_framebuffer_get_height(VNC_FRAMEBUFFER(priv->fb));
 
-    gdk_drawable_get_size(gtk_widget_get_window(widget), &ww, &wh);
+    ww = gdk_window_get_width(gtk_widget_get_window(widget));
+    wh = gdk_window_get_height(gtk_widget_get_window(widget));
 
     /* If we have a pixmap, update the region which changed.
      * If we don't have a pixmap, the entire thing will be
@@ -1428,11 +1351,7 @@ static gboolean vnc_display_set_preferred_pixel_format(VncDisplay *display)
         g_assert_not_reached ();
     }
 
-#if GTK_CHECK_VERSION (2, 21, 1)
     fmt.byte_order = gdk_visual_get_byte_order (v) == GDK_LSB_FIRST ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
-#else
-    fmt.byte_order = v->byte_order == GDK_LSB_FIRST ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
-#endif
 
     VNC_DEBUG ("Set depth color to %d (%d bpp)", fmt.depth, fmt.bits_per_pixel);
     if (!vnc_connection_set_pixel_format(priv->conn, &fmt))
@@ -1614,7 +1533,7 @@ static void on_cursor_changed(VncConnection *conn G_GNUC_UNUSED,
               cursor ? vnc_cursor_get_height(cursor) : -1);
 
     if (priv->remote_cursor) {
-        gdk_cursor_unref(priv->remote_cursor);
+        g_object_unref(priv->remote_cursor);
         priv->remote_cursor = NULL;
     }
 
@@ -1967,7 +1886,8 @@ void vnc_display_close(VncDisplay *obj)
     if (gtk_widget_get_window(widget)) {
         gint width, height;
 
-        gdk_drawable_get_size(gtk_widget_get_window(widget), &width, &height);
+        width = gdk_window_get_width(gtk_widget_get_window(widget));
+        height = gdk_window_get_height(gtk_widget_get_window(widget));
         gtk_widget_queue_draw_area(widget, 0, 0, width, height);
     }
 }
@@ -2097,12 +2017,12 @@ void vnc_display_send_pointer(VncDisplay *obj, gint x, gint y, int button_mask)
     }
 }
 
-static void vnc_display_destroy (GtkObject *obj)
+static void vnc_display_destroy (GtkWidget *obj)
 {
     VncDisplay *display = VNC_DISPLAY (obj);
     VNC_DEBUG("Display destroy, requesting that VNC connection close");
     vnc_display_close(display);
-    GTK_OBJECT_CLASS (vnc_display_parent_class)->destroy (obj);
+    GTK_WIDGET_CLASS (vnc_display_parent_class)->destroy (obj);
 }
 
 
@@ -2128,12 +2048,12 @@ static void vnc_display_finalize (GObject *obj)
     }
 
     if (priv->null_cursor) {
-        gdk_cursor_unref (priv->null_cursor);
+        g_object_unref (priv->null_cursor);
         priv->null_cursor = NULL;
     }
 
     if (priv->remote_cursor) {
-        gdk_cursor_unref(priv->remote_cursor);
+        g_object_unref(priv->remote_cursor);
         priv->remote_cursor = NULL;
     }
 
@@ -2156,14 +2076,9 @@ static void vnc_display_finalize (GObject *obj)
 static void vnc_display_class_init(VncDisplayClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
-    GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
     GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
 
-#if GTK_CHECK_VERSION (2, 91, 0)
     gtkwidget_class->draw = draw_event;
-#else
-    gtkwidget_class->expose_event = expose_event;
-#endif
     gtkwidget_class->motion_notify_event = motion_event;
     gtkwidget_class->button_press_event = button_event;
     gtkwidget_class->button_release_event = button_event;
@@ -2176,12 +2091,12 @@ static void vnc_display_class_init(VncDisplayClass *klass)
     gtkwidget_class->focus_out_event = focus_out_event;
     gtkwidget_class->grab_notify = grab_notify;
     gtkwidget_class->realize = realize_event;
+    gtkwidget_class->destroy = vnc_display_destroy;
 
     object_class->finalize = vnc_display_finalize;
     object_class->get_property = vnc_display_get_property;
     object_class->set_property = vnc_display_set_property;
 
-    gtkobject_class->destroy = vnc_display_destroy;
 
     g_object_class_install_property (object_class,
                                      PROP_POINTER_LOCAL,
@@ -2536,11 +2451,7 @@ static void vnc_display_init(VncDisplay *display)
      * double buffering to work around this until we
      * find a better idea.
      */
-#if GTK_CHECK_VERSION(3, 0, 0)
     gtk_widget_set_double_buffered(widget, TRUE);
-#else
-    gtk_widget_set_double_buffered(widget, FALSE);
-#endif
 
     priv = display->priv = VNC_DISPLAY_GET_PRIVATE(display);
     memset(priv, 0, sizeof(VncDisplayPrivate));
@@ -2972,8 +2883,8 @@ gboolean vnc_display_set_scaling(VncDisplay *obj,
         GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(obj));
 
         if (window != NULL) {
-            gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(obj)),
-                                  &ww, &wh);
+            ww = gdk_window_get_width(gtk_widget_get_window(GTK_WIDGET(obj)));
+            wh = gdk_window_get_height(gtk_widget_get_window(GTK_WIDGET(obj)));
             gtk_widget_queue_draw_area(GTK_WIDGET(obj), 0, 0, ww, wh);
         }
     }
@@ -3019,8 +2930,8 @@ void vnc_display_set_smoothing(VncDisplay *obj, gboolean enabled)
         GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(obj));
 
         if (window != NULL) {
-            gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(obj)),
-                                  &ww, &wh);
+            ww = gdk_window_get_width(gtk_widget_get_window(GTK_WIDGET(obj)));
+            wh = gdk_window_get_height(gtk_widget_get_window(GTK_WIDGET(obj)));
             gtk_widget_queue_draw_area(GTK_WIDGET(obj), 0, 0, ww, wh);
         }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]