From: Kruti Pendharkar Date: Wed, 6 Aug 2025 06:34:16 +0000 (-0700) Subject: Add #ifdef USE_UINPUT to fix open-vm-tools build failure on FreeBSD X-Git-Tag: stable-13.1.0~98 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c96dd4c29c1a2708c2b9770e4e4220adb469ea6;p=thirdparty%2Fopen-vm-tools.git Add #ifdef USE_UINPUT to fix open-vm-tools build failure on FreeBSD 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. --- diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index bd5e13afd..690318f8d 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -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);