open-vm-tools

This commit is contained in:
milisbir 2018-02-18 00:59:29 +02:00
parent 0dc6e1cd86
commit 419ad378d0
2 changed files with 108 additions and 34 deletions

View File

@ -0,0 +1,83 @@
From c5bc784da611ee929e0da7c20a410e03e6540613 Mon Sep 17 00:00:00 2001
From: Oliver Kurth <okurth@vmware.com>
Date: Fri, 26 Jan 2018 15:04:36 -0800
Subject: [PATCH] Set X11 as the backend for gtk3 of open-vm-tools
Open-vm-tools defaults to gtk3. For distros like Fedora 27, Wayland is
the default display server. With no restriction on the backend, plugins
will try to use Wayland as the backend of Gtk+3. As a result,
gdk_display_get_default() returns a Wayland display;
gdk_display_get_default_group() also returns a Wayland window. Applying
GDK_WINDOW_XID() on the Wayland window will result in the crash reported
on recent Linux releases that default to a Wayland display server.
As X11-specific code is widely used in tools plugins, a migratation to
Wayland in the short term is not possible. So, as a compromised solution,
plugins can be forced to run on XWayland, which is the compatible mode
of Wayland for legacy X11 clients.
gdk_set_allowed_backends() only applies when flag GTK3 is defined, and Gtk
version cwgreater than 3.10.
---
open-vm-tools/services/plugins/desktopEvents/x11Lock.c | 12 +++++++++++-
open-vm-tools/services/plugins/dndcp/copyPasteDnDX11.cpp | 14 +++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/open-vm-tools/services/plugins/desktopEvents/x11Lock.c b/open-vm-tools/services/plugins/desktopEvents/x11Lock.c
index 572234ac..613b6946 100644
--- a/open-vm-tools/services/plugins/desktopEvents/x11Lock.c
+++ b/open-vm-tools/services/plugins/desktopEvents/x11Lock.c
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -364,6 +364,16 @@ X11Lock_Init(ToolsAppCtx *ctx,
g_set_prgname(VMUSER_TITLE);
argv[0] = VMUSER_TITLE;
+#if GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 10)
+ /*
+ * On recent distros, Wayland is the default display server. If the obtained
+ * display or window is a wayland one, applying X11 specific functions on them
+ * will result in crashes. Before migrating the X11 specific code to Wayland,
+ * force using X11 as the backend of Gtk+3. gdk_set_allowed_backends() is
+ * introduced since Gtk+3.10 and Wayland is supported from Gtk+3.10.
+ */
+ gdk_set_allowed_backends("x11");
+#endif
/* XXX: is calling gtk_init() multiple times safe? */
gtk_init(&argc, (char ***) &argv);
diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteDnDX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteDnDX11.cpp
index fffdc402..4c2f3d8d 100644
--- a/open-vm-tools/services/plugins/dndcp/copyPasteDnDX11.cpp
+++ b/open-vm-tools/services/plugins/dndcp/copyPasteDnDX11.cpp
@@ -1,5 +1,5 @@
/*********************************************************
- * Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
@@ -211,6 +211,18 @@ gboolean
CopyPasteDnDX11::Init(ToolsAppCtx *ctx)
{
TRACE_CALL();
+
+#if GTK_MAJOR_VERSION > 3 || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION >= 10)
+ /*
+ * On recent distros, Wayland is the default display server. If the obtained
+ * display or window is a wayland one, applying X11 specific functions on them
+ * will result in crashes. Before migrating the X11 specific code to Wayland,
+ * force using X11 as the backend of Gtk+3. gdk_set_allowed_backends() is
+ * introduced since Gtk+3.10 and Wayland is supported from Gtk+3.10.
+ */
+ gdk_set_allowed_backends("x11");
+#endif
+
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
ASSERT(ctx);

View File

@ -1,41 +1,32 @@
# Tanım: VMWare Araçları # Tanım: VMWare Araçları
# URL: http://open-vm-tools.sf.net/ # URL: http://open-vm-tools.sf.net/
# Paketçi: milisarge # Paketçi: milisarge
# Gerekler: libdnet glib libmspack # Gerekler: chrpath libdnet glib libmspack cunit xorg-libx11 xorg-libxext xorg-libxinerama xorg-libxi xorg-libxrender xorg-libxrandr xorg-libxtst gdk-pixbuf gtk3 gtkmm3
isim=open-vm-tools isim=open-vm-tools
surum=10.1.5 surum=10.2.0
devir=1 devir=1
kaynak=(https://github.com/vmware/open-vm-tools/archive/stable-${version/_/-}.tar.gz kaynak=(https://github.com/vmware/open-vm-tools/archive/stable-${surum/_/-}.tar.gz::open-vm-tools-$surum.tar.gz
vmtools.rc 0001-Set-X11-as-the-backend-for-gtk3-of-open-vm-tools.patch)
tools.conf)
derle(){ derle(){
cd $isim-stable-$surum cd "$SRC/$isim-"*"/open-vm-tools"
cd $isim patch -Np2 < "${SRC}"/0001-Set-X11-as-the-backend-for-gtk3-of-open-vm-tools.patch
sed -ie 's|-Werror||g' configure.ac cd "$SRC/$isim-"*"/open-vm-tools"
autoreconf -iv autoreconf -vi
CXXFLAGS+=' -std=gnu++11 -fpermissive ' sh ./configure --prefix=/usr \
CFLAGS+=' -fpermissive ' --sbindir=/usr/bin \
CUSTOM_PROCPS_NAME=procps \ --sysconfdir=/etc \
./configure \ --with-udev-rules-dir=/usr/lib/udev/rules.d \
--prefix=/usr \ --without-xmlsecurity \
--disable-static \ --without-kernel-modules
--without-root-privileges \
--without-x \
--without-gtk2 \
--without-xmlsecurity \
--without-gtkmm \
--without-icu \
--without-pam \
--without-kernel-modules
make make
make DESTDIR=$PKG install cd "$SRC/$isim-"*"/open-vm-tools"
mv $PKG/usr/sbin/mount.vmhgfs $PKG/sbin/mount.vmhgfs make install DESTDIR="$PKG"
install -D $SRC/vmtools.rc $PKG/etc/rc.d/init.d/vmtools chmod 7755 "$PKG"/usr/bin/vmware-user-suid-wrapper
# install vmware-xdg-detect-de
rm -rf $PKG/usr/{etc,sbin,share} $PKG/etc/vmware-tools/scripts/vmware/network install -D -m 0755 scripts/common/vmware-xdg-detect-de "$PKG"/usr/bin/vmware-xdg-detect-de
rm -f $PKG/usr/lib/open-vm-tools/plugins/common/*.la # We don't want a symlink in /sbin
rm "$PKG"/sbin/mount.vmhgfs
install -m644 $SRC/tools.conf $PKG/etc/vmware-tools/tools.conf rmdir "$PKG"/sbin
} }