summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerjoystick.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-12-14 19:41:07 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-10-23 15:26:19 +0300
commit9b27b6e5098aee7a050d4c3f3f14050c509f74ec (patch)
tree93863e039186d271d3a91247f8e2abf2b8d15125 /indra/newview/llviewerjoystick.cpp
parent702e4c7dc1a383f83a0324e97b087efef82e9248 (diff)
SL-13610 [MAC] WIP List HID available devices in joystick selection
Doesn't filter the list yet, just shows full list of usb devices Selecting visible devices doesn't work yet
Diffstat (limited to 'indra/newview/llviewerjoystick.cpp')
-rw-r--r--indra/newview/llviewerjoystick.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp
index e35cb26ce1..26a626f60f 100644
--- a/indra/newview/llviewerjoystick.cpp
+++ b/indra/newview/llviewerjoystick.cpp
@@ -227,8 +227,17 @@ std::string string_from_guid(const GUID &guid)
return res;
}
+#elif LL_DARWIN
+
+bool macos_devices_callback(std::string &product, LLSD::Binary &data, void* userdata)
+{
+ //LLViewerJoystick::getInstance()->initDevice(&device, product_name, data);
+ return false;
+}
+
#endif
+
// -----------------------------------------------------------------------------
void LLViewerJoystick::updateEnabled(bool autoenable)
{
@@ -365,19 +374,21 @@ void LLViewerJoystick::init(bool autoenable)
{
if (mNdofDev)
{
+ void* win_callback = nullptr;
+ std::function<void(std::string&, LLSD::Binary&, void*)> osx_callback;
// di8_devices_callback callback is immediate and happens in scope of getInputDevices()
#if LL_WINDOWS && !LL_MESA_HEADLESS
// space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib
U32 device_type = DI8DEVCLASS_GAMECTRL;
- void* callback = &di8_devices_callback;
+ win_callback = &di8_devices_callback;
#else
// MAC doesn't support device search yet
// On MAC there is an ndof_idsearch and it is possible to specify product
// and manufacturer in NDOF_Device for ndof_init_first to pick specific one
U32 device_type = 0;
- void* callback = NULL;
+ osx_callback = macos_devices_callback;
#endif
- if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL))
+ if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL))
{
LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL;
// Failed to gather devices from windows, init first suitable one
@@ -438,21 +449,23 @@ void LLViewerJoystick::initDevice(LLSD &guid)
{
#if LIB_NDOF
mLastDeviceUUID = guid;
+ void* win_callback = nullptr;
+ std::function<void(std::string&, LLSD::Binary&, void*)> osx_callback;
#if LL_WINDOWS && !LL_MESA_HEADLESS
// space navigator is marked as DI8DEVCLASS_GAMECTRL in ndof lib
U32 device_type = DI8DEVCLASS_GAMECTRL;
- void* callback = &di8_devices_callback;
+ win_callback = &di8_devices_callback;
#else
// MAC doesn't support device search yet
// On MAC there is an ndof_idsearch and it is possible to specify product
// and manufacturer in NDOF_Device for ndof_init_first to pick specific one
U32 device_type = 0;
- void* callback = NULL;
+ osx_callback = macos_devices_callback;
#endif
mDriverState = JDS_INITIALIZING;
- if (!gViewerWindow->getWindow()->getInputDevices(device_type, callback, NULL))
+ if (!gViewerWindow->getWindow()->getInputDevices(device_type, osx_callback, win_callback, NULL))
{
LL_INFOS("Joystick") << "Failed to gather devices from window. Falling back to ndof's init" << LL_ENDL;
// Failed to gather devices from windows, init first suitable one