Skip to content

Commit 78c00a6

Browse files
committed
Mouse (Haiku): add support
1 parent c1c59cf commit 78c00a6

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ elseif(Haiku)
11581158
src/detection/gamepad/gamepad_nosupport.c
11591159
src/detection/media/media_linux.c
11601160
src/detection/memory/memory_haiku.c
1161-
src/detection/mouse/mouse_nosupport.c
1161+
src/detection/mouse/mouse_haiku.cpp
11621162
src/detection/netio/netio_nosupport.c
11631163
src/detection/opengl/opengl_linux.c
11641164
src/detection/os/os_haiku.c
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
extern "C" {
2+
#include "mouse.h"
3+
#include "common/io/io.h"
4+
}
5+
6+
#include <interface/Input.h>
7+
#include <support/List.h>
8+
9+
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */)
10+
{
11+
BList list;
12+
BInputDevice *device;
13+
14+
if (get_input_devices(&list) != B_OK)
15+
{
16+
return "get_input_devices() failed";
17+
}
18+
19+
int32 i, n = list.CountItems();
20+
for (i = 0; i < n; i++)
21+
{
22+
device = (BInputDevice *) list.ItemAt(i);
23+
if (device->Type() != B_POINTING_DEVICE)
24+
continue;
25+
26+
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(device->Name());
27+
if (!device->IsRunning())
28+
ffStrbufAppendS(&name, " (stopped)");
29+
30+
FFMouseDevice* device = (FFMouseDevice*) ffListAdd(devices);
31+
ffStrbufInit(&device->serial);
32+
ffStrbufInitMove(&device->name, &name);
33+
}
34+
35+
return NULL;
36+
}

0 commit comments

Comments
 (0)