mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Keyboard (Haiku): add support
This commit is contained in:
parent
bfa59d2c04
commit
5ebf984e9a
@ -1149,7 +1149,7 @@ elseif(Haiku)
|
||||
src/detection/host/host_windows.c
|
||||
src/detection/icons/icons_nosupport.c
|
||||
src/detection/initsystem/initsystem_haiku.cpp
|
||||
src/detection/keyboard/keyboard_nosupport.c
|
||||
src/detection/keyboard/keyboard_haiku.cpp
|
||||
src/detection/libc/libc_nosupport.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_nosupport.c
|
||||
|
36
src/detection/keyboard/keyboard_haiku.cpp
Normal file
36
src/detection/keyboard/keyboard_haiku.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
extern "C" {
|
||||
#include "keyboard.h"
|
||||
#include "common/io/io.h"
|
||||
}
|
||||
|
||||
#include <interface/Input.h>
|
||||
#include <support/List.h>
|
||||
|
||||
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */)
|
||||
{
|
||||
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_KEYBOARD_DEVICE)
|
||||
continue;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(device->Name());
|
||||
if (!device->IsRunning())
|
||||
ffStrbufAppendS(&name, " (stopped)");
|
||||
|
||||
FFKeyboardDevice* device = (FFKeyboardDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&device->serial);
|
||||
ffStrbufInitMove(&device->name, &name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user