From: Oliver Kurth Date: Fri, 6 Jul 2018 22:02:37 +0000 (-0700) Subject: open-vm-tools: build for FreeBSD fails in fakeMouseWayland X-Git-Tag: stable-11.0.0~533 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cd839359c127447686ed2f587b91b2c0095cc6a;p=thirdparty%2Fopen-vm-tools.git open-vm-tools: build for FreeBSD fails in fakeMouseWayland Root Cause: In the file fakeMouseWayland.cpp, several Linux related header files are included: These header files do not exist for FreeBSD and Solaris. Solution: Lib fakeMouse is not needed by FreeBSD and Solaris, so update the makefile to build the fakemouse related code only on Linux. --- diff --git a/open-vm-tools/services/plugins/dndcp/Makefile.am b/open-vm-tools/services/plugins/dndcp/Makefile.am index fce1b9e1a..8097fa61b 100644 --- a/open-vm-tools/services/plugins/dndcp/Makefile.am +++ b/open-vm-tools/services/plugins/dndcp/Makefile.am @@ -27,7 +27,6 @@ libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/dnd libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/dndGuest libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/stringxx libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/xutils -libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/fakeMouse libdndcp_la_CPPFLAGS += -I$(top_srcdir)/include libdndcp_la_CPPFLAGS += @XDR_CPPFLAGS@ @@ -79,8 +78,6 @@ libdndcp_la_SOURCES += dndGuest/dndCPTransportGuestRpc.cpp libdndcp_la_SOURCES += stringxx/string.cc libdndcp_la_SOURCES += xutils/xutils.cc -libdndcp_la_SOURCES += fakeMouseWayland/fakeMouseWayland.cpp - libdndcp_la_SOURCES += copyPasteCompat.c libdndcp_la_SOURCES += copyPasteCompatX11.c libdndcp_la_SOURCES += copyPasteDnDWrapper.cpp @@ -91,6 +88,12 @@ libdndcp_la_SOURCES += dndcp.cpp libdndcp_la_SOURCES += dragDetWndX11.cpp libdndcp_la_SOURCES += pointer.cpp +if LINUX +libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/fakeMouse +libdndcp_la_SOURCES += fakeMouseWayland/fakeMouseWayland.cpp +libdndcp_la_CPPFLAGS += -DUSE_UINPUT +endif + if HAVE_MKDTEMP libdndcp_la_CPPFLAGS += -DDND_IS_XDG libdndcp_la_SOURCES += dnd/dndXdg.c diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index d74092459..674dc973b 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -47,7 +47,9 @@ extern "C" { #include "rpcout.h" } +#ifdef USE_UINPUT #include "fakeMouseWayland/fakeMouseWayland.h" +#endif #include "dnd.h" #include "dndMsg.h" #include "hostinfo.h" @@ -106,6 +108,7 @@ DnDUIX11::DnDUIX11(ToolsAppCtx *ctx) */ OnWorkAreaChanged(Gdk::Screen::get_default()); +#ifdef USE_UINPUT //Initialize the uinput device if available if (ctx->uinputFD != -1) { Screen * scrn = DefaultScreenOfDisplay(XOpenDisplay(NULL)); @@ -115,6 +118,8 @@ DnDUIX11::DnDUIX11(ToolsAppCtx *ctx) mScreenHeight = scrn->height; } } +#endif + g_debug("%s: Use UInput? %d.\n", __FUNCTION__, mUseUInput); } @@ -372,6 +377,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 @@ -391,6 +397,7 @@ DnDUIX11::OnSrcDragBegin(const CPClipboard *clip, // IN FakeMouse_Update(mScreenWidth, mScreenHeight); } } +#endif /* * Before the DnD, we should make sure that the mouse is released @@ -1926,8 +1933,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); @@ -1938,7 +1947,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);