Files
fastfetch/src/detection/mouse/mouse_haiku.cpp
T

28 lines
689 B
C++
Raw Normal View History

2025-02-15 16:13:19 +01:00
extern "C" {
#include "mouse.h"
}
#include <interface/Input.h>
#include <support/List.h>
2026-03-29 09:28:49 +08:00
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */) {
2025-02-15 16:13:19 +01:00
BList list;
2026-03-29 09:28:49 +08:00
if (get_input_devices(&list) != B_OK) {
2025-02-15 16:13:19 +01:00
return "get_input_devices() failed";
2026-03-29 09:28:49 +08:00
}
2025-02-15 16:13:19 +01:00
2026-03-29 09:28:49 +08:00
for (int32 i = 0, n = list.CountItems(); i < n; i++) {
BInputDevice* device = (BInputDevice*) list.ItemAt(i);
if (device->Type() != B_POINTING_DEVICE || !device->IsRunning()) {
2025-02-15 16:13:19 +01:00
continue;
2026-03-29 09:28:49 +08:00
}
2025-02-15 16:13:19 +01:00
FFMouseDevice* item = (FFMouseDevice*) ffListAdd(devices);
ffStrbufInit(&item->serial);
ffStrbufInitS(&item->name, device->Name());
2025-02-15 16:13:19 +01:00
}
return NULL;
}