]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix open-vm-tools build failure on FreeBSD 13 after adding GTK4 support
authorKruti Pendharkar <kp025370@broadcom.com>
Wed, 10 Dec 2025 05:31:19 +0000 (21:31 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 10 Dec 2025 05:31:19 +0000 (21:31 -0800)
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`

open-vm-tools/configure.ac
open-vm-tools/services/plugins/dndcp/copyPasteDnDUtil.cpp
open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h
open-vm-tools/services/plugins/dndcp/dndGuestBase/dndUIX11GTK4.h
open-vm-tools/services/plugins/dndcp/dndGuestBase/dragDetWndX11GTK4.h
open-vm-tools/services/plugins/dndcp/dndUIX11GTK4.cpp
open-vm-tools/services/plugins/dndcp/dragDetWndX11GTK4.cpp

index 598df55e65cce04cca2239217dba71654cbe3a47..fcf74e71b43b9e20c7a59b84716bef67ffb520c7 100644 (file)
@@ -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(
index 6d2fbf227c17d4f57c4406f5c9bf440bfcbeac81..20601b8fc7ee2bd6d0f75a74d36c9aecde2257b6 100644 (file)
@@ -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"
+}
 
 
 /*
index 90a2cbeeb7084eec8f817603946fcb6e38693a99..a7bc8aa084361484b4194500b982ab309b970e95 100644 (file)
@@ -36,8 +36,6 @@
 extern "C" {
 #include "debug.h"
 #include "dndClipboard.h"
-#include "../dnd/dndFileContentsUtil.h"
-#include "cpNameUtil.h"
 #include "vmware/tools/guestrpc.h"
 }
 
index f18c7e2f17583a46d750d81eef4ab7d52f7487d3..b6bc2737f6dc6dab371169d8200104d2ea9cafb4 100644 (file)
@@ -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"
 }
index e576d3eb4e78fd4c8c4d4ea0b34561a75f20cc52..dc1a0d2168af53ed1c3799ce63c71dcddf634254 100644 (file)
 #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 *);
index 2a0e160fe7a172031fa67cefda0074ddd43cad97..4e8829c3fceb43712a9849546b76479b87e0b646 100644 (file)
@@ -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"
index 9bda763bf379898ffcc0e7e7d5a6dd9d5b14869b..99240aa43cbdeaab8f4d9790c197b9f411d940e9 100644 (file)
@@ -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);