mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 14:40:07 +01:00
This event is just used to notify the caller when the tool's no longer in proximity. When an event like this occurs, everything from evdev up until the next EV_SYN event is discarded along with any events that occured since the last EV_SYN event. This also silences any tool update events where the tool type is changed to LIBINPUT_TOOL_NONE, so we don't end up filling the tool list with a bunch of tools that aren't actually tools. Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
224 lines
5.7 KiB
C
224 lines
5.7 KiB
C
/*
|
|
* Copyright © 2013 Jonas Ådahl
|
|
*
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
* that the above copyright notice appear in all copies and that both that
|
|
* copyright notice and this permission notice appear in supporting
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
* advertising or publicity pertaining to distribution of the software
|
|
* without specific, written prior permission. The copyright holders make
|
|
* no representations about the suitability of this software for any
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
*
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#ifndef LIBINPUT_PRIVATE_H
|
|
#define LIBINPUT_PRIVATE_H
|
|
|
|
#include "linux/input.h"
|
|
|
|
#include "libinput.h"
|
|
#include "libinput-util.h"
|
|
|
|
struct libinput_source;
|
|
|
|
struct libinput_interface_backend {
|
|
int (*resume)(struct libinput *libinput);
|
|
void (*suspend)(struct libinput *libinput);
|
|
void (*destroy)(struct libinput *libinput);
|
|
};
|
|
|
|
struct libinput {
|
|
int epoll_fd;
|
|
struct list source_destroy_list;
|
|
|
|
struct list seat_list;
|
|
|
|
struct {
|
|
struct list list;
|
|
struct libinput_source *source;
|
|
int fd;
|
|
} timer;
|
|
|
|
struct libinput_event **events;
|
|
size_t events_count;
|
|
size_t events_len;
|
|
size_t events_in;
|
|
size_t events_out;
|
|
|
|
struct list tool_list;
|
|
|
|
const struct libinput_interface *interface;
|
|
const struct libinput_interface_backend *interface_backend;
|
|
void *user_data;
|
|
};
|
|
|
|
typedef void (*libinput_seat_destroy_func) (struct libinput_seat *seat);
|
|
|
|
struct libinput_seat {
|
|
struct libinput *libinput;
|
|
struct list link;
|
|
struct list devices_list;
|
|
void *user_data;
|
|
int refcount;
|
|
libinput_seat_destroy_func destroy;
|
|
|
|
char *physical_name;
|
|
char *logical_name;
|
|
|
|
uint32_t slot_map;
|
|
|
|
uint32_t button_count[KEY_CNT];
|
|
};
|
|
|
|
struct libinput_device {
|
|
struct libinput_seat *seat;
|
|
struct list link;
|
|
void *user_data;
|
|
int terminated;
|
|
int refcount;
|
|
};
|
|
|
|
struct libinput_tool {
|
|
struct list link;
|
|
uint32_t serial;
|
|
enum libinput_tool_type type;
|
|
int refcount;
|
|
};
|
|
|
|
typedef void (*libinput_source_dispatch_t)(void *data);
|
|
|
|
|
|
#define log_debug(...) log_msg(LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__)
|
|
#define log_info(...) log_msg(LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__)
|
|
#define log_error(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__)
|
|
#define log_bug_kernel(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__)
|
|
#define log_bug_libinput(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__);
|
|
#define log_bug_client(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__);
|
|
|
|
void
|
|
log_msg(enum libinput_log_priority priority, const char *format, ...);
|
|
void
|
|
log_msg_va(enum libinput_log_priority priority,
|
|
const char *format,
|
|
va_list args);
|
|
|
|
int
|
|
libinput_init(struct libinput *libinput,
|
|
const struct libinput_interface *interface,
|
|
const struct libinput_interface_backend *interface_backend,
|
|
void *user_data);
|
|
|
|
struct libinput_source *
|
|
libinput_add_fd(struct libinput *libinput,
|
|
int fd,
|
|
libinput_source_dispatch_t dispatch,
|
|
void *data);
|
|
|
|
void
|
|
libinput_remove_source(struct libinput *libinput,
|
|
struct libinput_source *source);
|
|
|
|
int
|
|
open_restricted(struct libinput *libinput,
|
|
const char *path, int flags);
|
|
|
|
void
|
|
close_restricted(struct libinput *libinput, int fd);
|
|
|
|
void
|
|
libinput_seat_init(struct libinput_seat *seat,
|
|
struct libinput *libinput,
|
|
const char *physical_name,
|
|
const char *logical_name,
|
|
libinput_seat_destroy_func destroy);
|
|
|
|
void
|
|
libinput_device_init(struct libinput_device *device,
|
|
struct libinput_seat *seat);
|
|
|
|
void
|
|
notify_added_device(struct libinput_device *device);
|
|
|
|
void
|
|
notify_removed_device(struct libinput_device *device);
|
|
|
|
void
|
|
keyboard_notify_key(struct libinput_device *device,
|
|
uint32_t time,
|
|
uint32_t key,
|
|
enum libinput_keyboard_key_state state);
|
|
|
|
void
|
|
pointer_notify_motion(struct libinput_device *device,
|
|
uint32_t time,
|
|
double dx,
|
|
double dy);
|
|
|
|
void
|
|
pointer_notify_motion_absolute(struct libinput_device *device,
|
|
uint32_t time,
|
|
double x,
|
|
double y);
|
|
|
|
void
|
|
pointer_notify_button(struct libinput_device *device,
|
|
uint32_t time,
|
|
int32_t button,
|
|
enum libinput_button_state state);
|
|
|
|
void
|
|
pointer_notify_axis(struct libinput_device *device,
|
|
uint32_t time,
|
|
enum libinput_pointer_axis axis,
|
|
double value);
|
|
|
|
void
|
|
touch_notify_touch_down(struct libinput_device *device,
|
|
uint32_t time,
|
|
int32_t slot,
|
|
int32_t seat_slot,
|
|
double x,
|
|
double y);
|
|
|
|
void
|
|
touch_notify_touch_motion(struct libinput_device *device,
|
|
uint32_t time,
|
|
int32_t slot,
|
|
int32_t seat_slot,
|
|
double x,
|
|
double y);
|
|
|
|
void
|
|
touch_notify_touch_up(struct libinput_device *device,
|
|
uint32_t time,
|
|
int32_t slot,
|
|
int32_t seat_slot);
|
|
|
|
void
|
|
tablet_notify_axis(struct libinput_device *device,
|
|
uint32_t time,
|
|
unsigned char *changed_axes,
|
|
double *axes);
|
|
|
|
void
|
|
tablet_notify_tool_update(struct libinput_device *device,
|
|
uint32_t time,
|
|
struct libinput_tool *tool);
|
|
|
|
void
|
|
tablet_notify_proximity_out(struct libinput_device *device,
|
|
uint32_t time);
|
|
|
|
void
|
|
touch_notify_frame(struct libinput_device *device,
|
|
uint32_t time);
|
|
#endif /* LIBINPUT_PRIVATE_H */
|