From: Kruti Pendharkar Date: Wed, 10 Dec 2025 05:31:19 +0000 (-0800) Subject: Fix open-vm-tools build failure on FreeBSD 13 after adding GTK4 support X-Git-Tag: stable-13.1.0~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=136bce5d13360aeee467e0710a20b08a244c60bd;p=thirdparty%2Fopen-vm-tools.git Fix open-vm-tools build failure on FreeBSD 13 after adding GTK4 support This change includes the following fixes: 1. Building now defaults to GTK3 on FreeBSD, unless --with-gtk4 is explicitly specified. 2. Unnecessary header files such as cpName.h, cpNameUtil.h and dnd/dndFileContentsUtil.h have been removed. These headers caused a typedef conflict for Bool between /usr/local/include/X11/Xdefs.h and vm_basic_types.h 3. `fakeMouseWayland` and `UINPUT` do not work on FreeBSD, so they have been disabled, with their code guarded under `#ifdef UINPUT` --- diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index 598df55e6..fcf74e71b 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -292,6 +292,13 @@ elif test "$with_gtk2" = "yes" ; then with_gtk4="no" fi +# PR3594893, do not build with gtk4 for FreeBSD by default. Build with gtk3 +# by default as previous behavior, even both gtk4 and gtk3 libs are availale. +# Only build with gtk4 when explicitly set by "--with_gtk4" +if test "$with_gtk4" = "auto" && test "$os" = "freebsd" ; then + with_gtk4="no" +fi + AC_ARG_ENABLE( docs, AS_HELP_STRING( diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteDnDUtil.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteDnDUtil.cpp index 6d2fbf227..20601b8fc 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteDnDUtil.cpp +++ b/open-vm-tools/services/plugins/dndcp/copyPasteDnDUtil.cpp @@ -21,7 +21,7 @@ * copyPasteDnDUtil.cpp -- * * This is the utility file to keep the common API's - * for Copy/Paste and Drag/Drop functionality. + * for Copy/Paste and Drag/Drop functionality. * */ @@ -31,7 +31,9 @@ #include "dndFileContentsUtil.h" #include "dndFileList.hh" #include "copyPasteUIX11.h" +extern "C" { #include "cpNameUtil.h" +} /* diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h index 90a2cbeeb..a7bc8aa08 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h @@ -36,8 +36,6 @@ extern "C" { #include "debug.h" #include "dndClipboard.h" -#include "../dnd/dndFileContentsUtil.h" -#include "cpNameUtil.h" #include "vmware/tools/guestrpc.h" } diff --git a/open-vm-tools/services/plugins/dndcp/dndGuestBase/dndUIX11GTK4.h b/open-vm-tools/services/plugins/dndcp/dndGuestBase/dndUIX11GTK4.h index f18c7e2f1..b6bc2737f 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuestBase/dndUIX11GTK4.h +++ b/open-vm-tools/services/plugins/dndcp/dndGuestBase/dndUIX11GTK4.h @@ -40,8 +40,6 @@ extern "C" { #include "debug.h" #include "dndClipboard.h" -#include "../dnd/dndFileContentsUtil.h" -#include "cpNameUtil.h" #include "vmware/tools/guestrpc.h" #include "vmware/tools/plugin.h" } diff --git a/open-vm-tools/services/plugins/dndcp/dndGuestBase/dragDetWndX11GTK4.h b/open-vm-tools/services/plugins/dndcp/dndGuestBase/dragDetWndX11GTK4.h index e576d3eb4..dc1a0d216 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuestBase/dragDetWndX11GTK4.h +++ b/open-vm-tools/services/plugins/dndcp/dndGuestBase/dragDetWndX11GTK4.h @@ -34,7 +34,10 @@ #if !defined(DETWNDTEST) #include "dnd.h" #endif +/* Need to check USE_UINPUT, as FreeBSD does not support this */ +#ifdef USE_UINPUT #include "fakeMouseWayland/fakeMouseWayland.h" +#endif using source_drag_begin_handler = void (const Glib::RefPtr< Gdk::Drag > &, void *); using source_drag_end_handler = void (const Glib::RefPtr< Gdk::Drag > &, bool, void *); diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11GTK4.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11GTK4.cpp index 2a0e160fe..4e8829c3f 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11GTK4.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11GTK4.cpp @@ -37,8 +37,6 @@ extern "C" { #include "vmware/guestrpc/tclodefs.h" #include "copyPasteCompat.h" -#include "cpName.h" -#include "cpNameUtil.h" #include "dndClipboard.h" #include "hgfsUri.h" #include "rpcout.h" diff --git a/open-vm-tools/services/plugins/dndcp/dragDetWndX11GTK4.cpp b/open-vm-tools/services/plugins/dndcp/dragDetWndX11GTK4.cpp index 9bda763bf..99240aa43 100644 --- a/open-vm-tools/services/plugins/dndcp/dragDetWndX11GTK4.cpp +++ b/open-vm-tools/services/plugins/dndcp/dragDetWndX11GTK4.cpp @@ -96,6 +96,8 @@ DragDetWnd::DragDetWnd(int UseUInput_fd) // Let GTK preload data early. mTarget->set_preload(true); +/* Need to check USE_UINPUT, as FreeBSD does not support this */ +#ifdef USE_UINPUT // Uinput simulation for wayland backend. if (UseUInput_fd != -1) { g_debug("%s: Using uinput simulation", __FUNCTION__); @@ -110,6 +112,7 @@ DragDetWnd::DragDetWnd(int UseUInput_fd) // Disconnect the connection to X Server. XCloseDisplay(display); } +#endif return; fail: if (mWnd) { @@ -126,9 +129,11 @@ fail: DragDetWnd::~DragDetWnd() { +#ifdef USE_UINPUT if (mUseUInput) { FakeMouse_Destory(); } +#endif if (mWnd) { delete mWnd; mWnd = NULL; @@ -981,9 +986,11 @@ DragDetWnd::SimulateXEvents(const bool showWidget, const bool buttonEvent, * happen more reliably on KDE, but isn't necessary on GNOME. */ if (mUseUInput) { +#ifdef USE_UINPUT FakeMouse_Move(x, y); FakeMouse_Move(x + 1, y + 1); g_debug("%s: Uinput simulating moving mouse\n", __FUNCTION__); +#endif } else { XTestFakeMotionEvent(dndXDisplay, -1, x, y, CurrentTime); XTestFakeMotionEvent(dndXDisplay, -1, x + 1, y + 1, CurrentTime); @@ -996,8 +1003,10 @@ DragDetWnd::SimulateXEvents(const bool showWidget, const bool buttonEvent, g_debug("%s: faking left mouse button %s\n", __FUNCTION__, buttonPress ? "press" : "release"); if (mUseUInput) { +#ifdef USE_UINPUT ret = FakeMouse_Click(buttonPress); g_debug("%s: Uinput simulating click mouse with ret %d\n", __FUNCTION__, ret); +#endif } else { XTestFakeButtonEvent(dndXDisplay, 1, buttonPress, CurrentTime);