* Its use should be as simple as the following (but also see below):
* - Create a new input object.
* - Provide a callback function to receive the events.
- * - Connect the input object to a kmscon_eloop.
+ * - Connect the input object to a ev_eloop.
* - Wake up the input object to begin receiving input events through the
* event loop.
*
#define KMSCON_INPUT_H
#include <inttypes.h>
+#include <limits.h>
#include <stdbool.h>
#include "eloop.h"
typedef void (*kmscon_input_cb) (struct kmscon_input *input,
struct kmscon_input_event *ev, void *data);
-/*
- * These are the values sent by the kernel in the /value/ field of the
- * /input_event/ struct.
- * See Documentation/input/event-codes.txt in the kernel tree.
- */
-enum kmscon_key_state {
- KMSCON_KEY_RELEASED = 0,
- KMSCON_KEY_PRESSED = 1,
- KMSCON_KEY_REPEATED = 2,
-};
-
int kmscon_input_new(struct kmscon_input **out);
void kmscon_input_ref(struct kmscon_input *input);
void kmscon_input_unref(struct kmscon_input *input);
int kmscon_input_connect_eloop(struct kmscon_input *input,
- struct kmscon_eloop *eloop, kmscon_input_cb cb, void *data);
+ struct ev_eloop *eloop, kmscon_input_cb cb, void *data);
void kmscon_input_disconnect_eloop(struct kmscon_input *input);
void kmscon_input_sleep(struct kmscon_input *input);
void kmscon_input_wake_up(struct kmscon_input *input);
bool kmscon_input_is_asleep(struct kmscon_input *input);
+/* Querying the results of evdev ioctl's. Also used by kbd backends. */
+static inline bool kmscon_evdev_bit_is_set(const unsigned long *array, int bit)
+{
+ return !!(array[bit / LONG_BIT] & (1LL << (bit % LONG_BIT)));
+}
+
#endif /* KMSCON_INPUT_H */