main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
Showing only changes of commit 896ba33336 - Show all commits

View File

@ -3,23 +3,26 @@
#include "GHOST_NDOFManagerUnix.h"
#include "GHOST_System.h"
/* Logging, use `ghost.ndof.unix.*` prefix. */
#include "CLG_log.h"
#include <spnav.h>
#include <stdio.h>
#include <unistd.h>
#define SPNAV_SOCK_PATH "/var/run/spnav.sock"
static const char *spnav_sock_path = "/var/run/spnav.sock";
static CLG_LogRef LOG_NDOF_UNIX = {"ghost.ndof.unix"};
#define LOG (&LOG_NDOF_UNIX)
GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System &sys)
: GHOST_NDOFManager(sys), available_(false)
{
if (access(SPNAV_SOCK_PATH, F_OK) != 0) {
#ifdef DEBUG
/* annoying for official builds, just adds noise and most people don't own these */
puts("ndof: spacenavd not found");
/* This isn't a hard error, just means the user doesn't have a 3D mouse. */
#endif
if (access(spnav_sock_path, F_OK) != 0) {
CLOG_INFO(LOG, 1, "'spacenavd' not found at \"%s\"", spnav_sock_path);
}
else if (spnav_open() != -1) {
CLOG_INFO(LOG, 1, "'spacenavd' found at\"%s\"", spnav_sock_path);
available_ = true;
/* determine exactly which device (if any) is plugged in */