2013-11-17 11:19:50 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2008 Kristian Høgsberg
|
2015-05-28 08:23:59 +10:00
|
|
|
* Copyright © 2013-2015 Red Hat, Inc.
|
2013-11-17 11:19:50 +01:00
|
|
|
*
|
2015-06-11 12:09:18 +10:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2013-11-17 11:19:50 +01:00
|
|
|
*
|
2015-06-11 12:09:18 +10:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2013-11-17 11:19:50 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef LIBINPUT_UTIL_H
|
|
|
|
|
#define LIBINPUT_UTIL_H
|
|
|
|
|
|
2016-07-07 17:39:37 +10:00
|
|
|
#include "config.h"
|
|
|
|
|
|
2019-05-28 14:10:54 +10:00
|
|
|
#ifdef NDEBUG
|
|
|
|
|
#warning "libinput relies on assert(). #defining NDEBUG is not recommended"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-11-23 12:55:44 +01:00
|
|
|
#include "libinput.h"
|
|
|
|
|
|
2019-09-04 15:11:45 +10:00
|
|
|
#include "util-bits.h"
|
|
|
|
|
#include "util-macros.h"
|
|
|
|
|
#include "util-list.h"
|
|
|
|
|
#include "util-matrix.h"
|
2024-12-22 15:12:53 +10:00
|
|
|
#include "util-multivalue.h"
|
2019-09-04 15:11:45 +10:00
|
|
|
#include "util-strings.h"
|
|
|
|
|
#include "util-ratelimit.h"
|
2024-10-14 14:39:07 +10:00
|
|
|
#include "util-range.h"
|
2019-09-04 15:11:45 +10:00
|
|
|
#include "util-prop-parsers.h"
|
|
|
|
|
#include "util-time.h"
|
2025-04-02 15:24:59 +10:00
|
|
|
#include "util-mem.h"
|
2019-09-04 15:11:45 +10:00
|
|
|
|
2015-05-22 16:07:10 +10:00
|
|
|
#define VENDOR_ID_APPLE 0x5ac
|
2016-12-19 15:36:34 +10:00
|
|
|
#define VENDOR_ID_CHICONY 0x4f2
|
2016-04-21 15:08:23 +10:00
|
|
|
#define VENDOR_ID_LOGITECH 0x46d
|
2015-05-22 16:07:10 +10:00
|
|
|
#define VENDOR_ID_WACOM 0x56a
|
2015-07-16 16:05:48 +10:00
|
|
|
#define VENDOR_ID_SYNAPTICS_SERIAL 0x002
|
2015-12-13 22:27:55 -08:00
|
|
|
#define PRODUCT_ID_APPLE_KBD_TOUCHPAD 0x273
|
2017-01-10 09:22:16 +10:00
|
|
|
#define PRODUCT_ID_APPLE_APPLETOUCH 0x21a
|
2015-07-16 16:05:48 +10:00
|
|
|
#define PRODUCT_ID_SYNAPTICS_SERIAL 0x007
|
2017-08-30 15:53:01 +10:00
|
|
|
#define PRODUCT_ID_WACOM_EKR 0x0331
|
2015-05-22 16:07:10 +10:00
|
|
|
|
2015-06-19 16:03:42 +10:00
|
|
|
/* The HW DPI rate we normalize to before calculating pointer acceleration */
|
|
|
|
|
#define DEFAULT_MOUSE_DPI 1000
|
2017-05-16 13:01:32 +10:00
|
|
|
#define DEFAULT_TRACKPOINT_SENSITIVITY 128
|
2015-06-19 16:03:42 +10:00
|
|
|
|
2024-12-20 15:41:47 +10:00
|
|
|
#define _trace(file, ...) \
|
2015-06-24 15:30:59 +10:00
|
|
|
do { \
|
2024-03-15 14:56:06 +10:00
|
|
|
char buf_[1024]; \
|
|
|
|
|
snprintf(buf_, sizeof(buf_), __VA_ARGS__); \
|
2025-03-14 14:12:27 +10:00
|
|
|
fprintf(file, ANSI_BLUE "%30s():%4d - " ANSI_RED "%s" ANSI_NORMAL "\n", __func__, __LINE__, buf_); \
|
2015-06-24 15:30:59 +10:00
|
|
|
} while (0)
|
2015-06-29 13:56:05 +10:00
|
|
|
|
2024-12-20 15:41:47 +10:00
|
|
|
#define trace(...) _trace(stdout, __VA_ARGS__)
|
|
|
|
|
#define etrace(...) _trace(stderr, __VA_ARGS__)
|
|
|
|
|
|
2013-11-17 11:19:50 +01:00
|
|
|
#define LIBINPUT_EXPORT __attribute__ ((visibility("default")))
|
|
|
|
|
|
2025-04-02 15:24:59 +10:00
|
|
|
/* Commonly-used cleanup */
|
|
|
|
|
#ifdef udev_list_entry_foreach
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(udev);
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(udev_device);
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(udev_enumerate);
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(udev_monitor);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef LIBEVDEV_ATTRIBUTE_PRINTF
|
|
|
|
|
DEFINE_FREE_CLEANUP_FUNC(libevdev);
|
|
|
|
|
#endif
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(libinput);
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(libinput_device);
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(libinput_tablet_tool);
|
|
|
|
|
DEFINE_UNREF_CLEANUP_FUNC(libinput_seat);
|
|
|
|
|
DEFINE_DESTROY_CLEANUP_FUNC(libinput_event);
|
|
|
|
|
DEFINE_DESTROY_CLEANUP_FUNC(libinput_config_accel);
|
|
|
|
|
|
2013-11-17 11:19:50 +01:00
|
|
|
#endif /* LIBINPUT_UTIL_H */
|