Skip to content

Commit 5ebf984

Browse files
mmumanCarterLi
authored andcommitted
Keyboard (Haiku): add support
1 parent bfa59d2 commit 5ebf984

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
@@ -1149,7 +1149,7 @@ elseif(Haiku)
11491149
src/detection/host/host_windows.c
11501150
src/detection/icons/icons_nosupport.c
11511151
src/detection/initsystem/initsystem_haiku.cpp
1152-
src/detection/keyboard/keyboard_nosupport.c
1152+
src/detection/keyboard/keyboard_haiku.cpp
11531153
src/detection/libc/libc_nosupport.c
11541154
src/detection/lm/lm_nosupport.c
11551155
src/detection/loadavg/loadavg_nosupport.c
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
extern "C" {
2+
#include "keyboard.h"
3+
#include "common/io/io.h"
4+
}
5+
6+
#include <interface/Input.h>
7+
#include <support/List.h>
8+
9+
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */)
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_KEYBOARD_DEVICE)
24+
continue;
25+
26+
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(device->Name());
27+
if (!device->IsRunning())
28+
ffStrbufAppendS(&name, " (stopped)");
29+
30+
FFKeyboardDevice* device = (FFKeyboardDevice*) ffListAdd(devices);
31+
ffStrbufInit(&device->serial);
32+
ffStrbufInitMove(&device->name, &name);
33+
}
34+
35+
return NULL;
36+
}

0 commit comments

Comments
 (0)