72 lines
2.7 KiB
C
72 lines
2.7 KiB
C
/*
|
|
This file is part of Furui.
|
|
|
|
Furui is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Furui is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Furui. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef FURUI_DEVICE_H
|
|
#define FURUI_DEVICE_H
|
|
|
|
struct furui_device {
|
|
char *path;
|
|
char *name;
|
|
char *uniq;
|
|
|
|
unsigned int has_keys;
|
|
unsigned int key_count;
|
|
unsigned int *keys;
|
|
|
|
unsigned int has_rels;
|
|
unsigned int rel_count;
|
|
unsigned int *rels;
|
|
|
|
unsigned int has_abses;
|
|
unsigned int abs_count;
|
|
unsigned int *abses;
|
|
};
|
|
|
|
extern struct furui_device *furui_device_new(const char *path);
|
|
extern void furui_device_free(struct furui_device *device);
|
|
extern struct furui_device *furui_device_copy(struct furui_device *device);
|
|
extern int furui_device_has_key_code(struct furui_device *device, unsigned int code);
|
|
extern int furui_device_has_rel_code(struct furui_device *device, unsigned int code);
|
|
extern int furui_device_has_abs_code(struct furui_device *device, unsigned int code);
|
|
extern void furui_device_print(const struct furui_device *device);
|
|
extern int furui_device_maybe_keyboard(struct furui_device *device);
|
|
extern int furui_device_maybe_gamepad(struct furui_device *device);
|
|
|
|
struct furui_device_list_element {
|
|
struct furui_device_list_element *next;
|
|
struct furui_device *value;
|
|
};
|
|
|
|
extern struct furui_device_list_element *furui_device_list_element_new(struct furui_device *device);
|
|
extern void furui_device_list_element_free(struct furui_device_list_element *element);
|
|
|
|
struct furui_device_list {
|
|
struct furui_device_list_element *head;
|
|
unsigned int count;
|
|
};
|
|
|
|
extern struct furui_device_list *furui_device_list_new(void);
|
|
extern void furui_device_list_free(struct furui_device_list *list);
|
|
extern unsigned int furui_device_list_get_count(struct furui_device_list *list);
|
|
extern struct furui_device *furui_device_list_get_element_at(struct furui_device_list *list, unsigned int index);
|
|
extern void furui_device_list_add_element(struct furui_device_list *list, struct furui_device *device);
|
|
extern struct furui_device_list *furui_device_list_scan(void);
|
|
extern void furui_device_list_print(struct furui_device_list *list);
|
|
extern void furui_device_list_filter(struct furui_device_list *list, int (*filter)(struct furui_device *));
|
|
|
|
#endif /* FURUI_DEVICE_H */
|