mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Mouse / Keyboard (Haiku): code cleanup; ignore disabled devices
This commit is contained in:
parent
fc3f47742a
commit
f5dbbb70ef
@ -1,6 +1,5 @@
|
||||
extern "C" {
|
||||
#include "keyboard.h"
|
||||
#include "common/io/io.h"
|
||||
}
|
||||
|
||||
#include <interface/Input.h>
|
||||
@ -9,27 +8,19 @@ extern "C" {
|
||||
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++)
|
||||
for (int32 i = 0, n = list.CountItems(); i < n; i++)
|
||||
{
|
||||
device = (BInputDevice *) list.ItemAt(i);
|
||||
if (device->Type() != B_KEYBOARD_DEVICE)
|
||||
BInputDevice *device = (BInputDevice *) list.ItemAt(i);
|
||||
if (device->Type() != B_KEYBOARD_DEVICE || !device->IsRunning())
|
||||
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);
|
||||
FFKeyboardDevice* item = (FFKeyboardDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&item->serial);
|
||||
ffStrbufInitS(&item->name, device->Name());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -1,6 +1,5 @@
|
||||
extern "C" {
|
||||
#include "mouse.h"
|
||||
#include "common/io/io.h"
|
||||
}
|
||||
|
||||
#include <interface/Input.h>
|
||||
@ -9,27 +8,19 @@ extern "C" {
|
||||
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++)
|
||||
for (int32 i = 0, n = list.CountItems(); i < n; i++)
|
||||
{
|
||||
device = (BInputDevice *) list.ItemAt(i);
|
||||
if (device->Type() != B_POINTING_DEVICE)
|
||||
BInputDevice *device = (BInputDevice *) list.ItemAt(i);
|
||||
if (device->Type() != B_POINTING_DEVICE || !device->IsRunning())
|
||||
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);
|
||||
FFMouseDevice* item = (FFMouseDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&item->serial);
|
||||
ffStrbufInitS(&item->name, device->Name());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user