1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
commit f2b872ba4dc509622bda2d86ce42e2464d40832b
Author: Christoph Moench-Tegeder <cmt@burggraben.net>
Date: Mon Mar 24 01:03:53 2025 +0100
attempt to fix building with libspnav
diff --git cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
index e9aa47fd6e..826c510ef0 100644
--- cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
+++ cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
@@ -142,6 +142,7 @@ macro(InitializeFreeCADBuildOptions)
option(BUILD_CLOUD "Build the FreeCAD cloud module" OFF)
option(ENABLE_DEVELOPER_TESTS "Build the FreeCAD unit tests suit" ON)
+ option(FREECAD_SPNAV_SUPPORT "Enable libspnav support" OFF)
if(MSVC)
set(FREECAD_3DCONNEXION_SUPPORT "NavLib" CACHE STRING "Select version of the 3Dconnexion device integration")
set_property(CACHE FREECAD_3DCONNEXION_SUPPORT PROPERTY STRINGS "NavLib" "Raw input")
diff --git src/Gui/CMakeLists.txt src/Gui/CMakeLists.txt
index 642f58568f..52cc393875 100644
--- src/Gui/CMakeLists.txt
+++ src/Gui/CMakeLists.txt
@@ -133,7 +133,8 @@ if(${Qt5WinExtras_FOUND})
)
endif()
-IF(SPNAV_FOUND)
+IF(FREECAD_SPNAV_SUPPORT AND SPNAV_FOUND)
+ add_definitions(-D_USE_3DCONNEXION_SDK)
if(SPNAV_USE_X11)
add_definitions(-DSPNAV_USE_X11)
if (FREECAD_QT_MAJOR_VERSION EQUAL 5 AND UNIX AND NOT APPLE)
@@ -175,7 +176,11 @@ IF(SPNAV_FOUND)
list(APPEND FreeCADGui_LIBS
${SPNAV_LIBRARIES}
)
-ENDIF(SPNAV_FOUND)
+ENDIF(FREECAD_SPNAV_SUPPORT AND SPNAV_FOUND)
+
+IF(FREECAD_SPNAV_SUPPORT AND NOT SPNAV_FOUND)
+ MESSAGE(FATAL_ERROR "libspnav support requested but libspnav not found")
+ENDIF(FREECAD_SPNAV_SUPPORT AND NOT SPNAV_FOUND)
IF(OCULUS_FOUND)
add_definitions(-DOCULUS_FOUND)
diff --git src/Gui/GuiApplicationNativeEventAware.cpp src/Gui/GuiApplicationNativeEventAware.cpp
index ba41901472..c0cf3c7666 100644
--- src/Gui/GuiApplicationNativeEventAware.cpp
+++ src/Gui/GuiApplicationNativeEventAware.cpp
@@ -33,7 +33,7 @@
#if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND)
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
#if defined(SPNAV_USE_X11)
#include "3Dconnexion/GuiNativeEventLinuxX11.h"
#else
@@ -59,7 +59,15 @@ Gui::GUIApplicationNativeEventAware::~GUIApplicationNativeEventAware() = default
void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window)
{
#if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND)
+# if defined(USE_3DCONNEXION_NAVLIB)
+ ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath(
+ "User parameter:BaseApp/Preferences/View");
+ if (nativeEvent && hViewGrp->GetBool("LegacySpaceMouseDevices", false)) {
+ nativeEvent->initSpaceball(window);
+ }
+# else
nativeEvent->initSpaceball(window);
+# endif
#else
Q_UNUSED(window);
#endif
diff --git src/Gui/View3DInventorViewer.cpp src/Gui/View3DInventorViewer.cpp
index 694f834583..d32c2486b5 100644
--- src/Gui/View3DInventorViewer.cpp
+++ src/Gui/View3DInventorViewer.cpp
@@ -555,7 +555,15 @@ void View3DInventorViewer::init()
//filter a few qt events
viewerEventFilter = new ViewerEventFilter;
installEventFilter(viewerEventFilter);
+#if defined(USE_3DCONNEXION_NAVLIB)
+ ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath(
+ "User parameter:BaseApp/Preferences/View");
+ if (hViewGrp->GetBool("LegacySpaceMouseDevices", false)) {
+ getEventFilter()->registerInputDevice(new SpaceNavigatorDevice);
+ }
+#else
getEventFilter()->registerInputDevice(new SpaceNavigatorDevice);
+#endif
getEventFilter()->registerInputDevice(new GesturesDevice(this));
try{
|