File tree Expand file tree Collapse file tree 2 files changed +12
-30
lines changed Expand file tree Collapse file tree 2 files changed +12
-30
lines changed Original file line number Diff line number Diff line change 11extern " C" {
22#include " keyboard.h"
3- #include " common/io/io.h"
43}
54
65#include < interface/Input.h>
@@ -9,27 +8,19 @@ extern "C" {
98const char * ffDetectKeyboard (FFlist* devices /* List of FFKeyboardDevice */ )
109{
1110 BList list;
12- BInputDevice *device;
1311
1412 if (get_input_devices (&list) != B_OK)
15- {
1613 return " get_input_devices() failed" ;
17- }
1814
19- int32 i, n = list.CountItems ();
20- for (i = 0 ; i < n; i++)
15+ for (int32 i = 0 , n = list.CountItems (); i < n; i++)
2116 {
22- device = (BInputDevice *) list.ItemAt (i);
23- if (device->Type () != B_KEYBOARD_DEVICE)
17+ BInputDevice * device = (BInputDevice *) list.ItemAt (i);
18+ if (device->Type () != B_KEYBOARD_DEVICE || !device-> IsRunning () )
2419 continue ;
2520
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);
21+ FFKeyboardDevice* item = (FFKeyboardDevice*) ffListAdd (devices);
22+ ffStrbufInit (&item->serial );
23+ ffStrbufInitS (&item->name , device->Name ());
3324 }
3425
3526 return NULL ;
Original file line number Diff line number Diff line change 11extern " C" {
22#include " mouse.h"
3- #include " common/io/io.h"
43}
54
65#include < interface/Input.h>
@@ -9,27 +8,19 @@ extern "C" {
98const char * ffDetectMouse (FFlist* devices /* List of FFMouseDevice */ )
109{
1110 BList list;
12- BInputDevice *device;
1311
1412 if (get_input_devices (&list) != B_OK)
15- {
1613 return " get_input_devices() failed" ;
17- }
1814
19- int32 i, n = list.CountItems ();
20- for (i = 0 ; i < n; i++)
15+ for (int32 i = 0 , n = list.CountItems (); i < n; i++)
2116 {
22- device = (BInputDevice *) list.ItemAt (i);
23- if (device->Type () != B_POINTING_DEVICE)
17+ BInputDevice * device = (BInputDevice *) list.ItemAt (i);
18+ if (device->Type () != B_POINTING_DEVICE || !device-> IsRunning () )
2419 continue ;
2520
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);
21+ FFMouseDevice* item = (FFMouseDevice*) ffListAdd (devices);
22+ ffStrbufInit (&item->serial );
23+ ffStrbufInitS (&item->name , device->Name ());
3324 }
3425
3526 return NULL ;
You can’t perform that action at this time.
0 commit comments