]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Add #ifdef USE_UINPUT to fix open-vm-tools build failure on FreeBSD
authorKruti Pendharkar <kp025370@broadcom.com>
Wed, 6 Aug 2025 06:34:16 +0000 (23:34 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Wed, 6 Aug 2025 06:34:16 +0000 (23:34 -0700)
In the previous update, the "#ifdef USE_UINPUT" preprocessor guard was
removed, which broke the compilation of open-vm-tools on FreeBSD, because
FreeBSD does not have support for fakeMouseWayland.cpp.

Since USE_UINPUT is already defined for Linux systems in
services/plugins/dndcp/Makefile.am, adding those conditionals back to prevent
build failures on FreeBSD.

open-vm-tools/services/plugins/dndcp/dndUIX11.cpp

index bd5e13afd351e550617ee624d45b3918f9deffe9..690318f8db92a6100e4e3f110b4c9fb72073349b 100644 (file)
@@ -57,7 +57,9 @@ extern "C" {
 #include "rpcout.h"
 }
 
+#ifdef USE_UINPUT
 #include "fakeMouseWayland/fakeMouseWayland.h"
+#endif
 #include "dnd.h"
 #include "dndMsg.h"
 #include "hostinfo.h"
@@ -122,6 +124,7 @@ DnDUIX11::DnDUIX11(ToolsAppCtx *ctx)
     */
    OnWorkAreaChanged(Gdk::Screen::get_default());
 
+#ifdef USE_UINPUT
    //Initialize the uinput device if available
    if (ctx->uinputFD != -1) {
       Display *display = XOpenDisplay(NULL);
@@ -134,6 +137,7 @@ DnDUIX11::DnDUIX11(ToolsAppCtx *ctx)
       // Disconnect the connection to X Server.
       XCloseDisplay(display);
    }
+#endif
 
    g_debug("%s: Use UInput? %d.\n", __FUNCTION__, mUseUInput);
 }
@@ -392,6 +396,7 @@ DnDUIX11::OnSrcDragBegin(const CPClipboard *clip,       // IN
    CPClipboard_Clear(&mClipboard);
    CPClipboard_Copy(&mClipboard, clip);
 
+#ifdef USE_UINPUT
    if (mUseUInput) {
       /*
        * Check if the screen size changes, if so then update the
@@ -414,6 +419,7 @@ DnDUIX11::OnSrcDragBegin(const CPClipboard *clip,       // IN
       // Disconnect the connection to X Server.
       XCloseDisplay(display);
    }
+#endif
 
    /*
     * Before the DnD, we should make sure that the mouse is released
@@ -1956,8 +1962,10 @@ DnDUIX11::SendFakeXEvents(
     * 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);
+#endif
    } else {
       XTestFakeMotionEvent(dndXDisplay, -1, x, y, CurrentTime);
       XTestFakeMotionEvent(dndXDisplay, -1, x + 1, y + 1, CurrentTime);
@@ -1968,7 +1976,9 @@ DnDUIX11::SendFakeXEvents(
       g_debug("%s: faking left mouse button %s\n", __FUNCTION__,
               buttonPress ? "press" : "release");
       if (mUseUInput) {
+#ifdef USE_UINPUT
          FakeMouse_Click(buttonPress);
+#endif
       } else {
          XTestFakeButtonEvent(dndXDisplay, 1, buttonPress, CurrentTime);
          XSync(dndXDisplay, False);