diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cb52dc5d..f6313cc5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1158,7 +1158,7 @@ elseif(Haiku) src/detection/gamepad/gamepad_nosupport.c src/detection/media/media_linux.c src/detection/memory/memory_haiku.c - src/detection/mouse/mouse_nosupport.c + src/detection/mouse/mouse_haiku.cpp src/detection/netio/netio_nosupport.c src/detection/opengl/opengl_linux.c src/detection/os/os_haiku.c diff --git a/src/detection/mouse/mouse_haiku.cpp b/src/detection/mouse/mouse_haiku.cpp new file mode 100644 index 000000000..ca36d0f47 --- /dev/null +++ b/src/detection/mouse/mouse_haiku.cpp @@ -0,0 +1,36 @@ +extern "C" { +#include "mouse.h" +#include "common/io/io.h" +} + +#include +#include + +const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */) +{ + BList list; + BInputDevice *device; + + if (get_input_devices(&list) != B_OK) + { + return "get_input_devices() failed"; + } + + int32 i, n = list.CountItems(); + for (i = 0; i < n; i++) + { + device = (BInputDevice *) list.ItemAt(i); + if (device->Type() != B_POINTING_DEVICE) + continue; + + FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(device->Name()); + if (!device->IsRunning()) + ffStrbufAppendS(&name, " (stopped)"); + + FFMouseDevice* device = (FFMouseDevice*) ffListAdd(devices); + ffStrbufInit(&device->serial); + ffStrbufInitMove(&device->name, &name); + } + + return NULL; +}