mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-21 14:20:05 +01:00
parent
c2f9ffe17e
commit
17cfd41ed6
4 changed files with 24 additions and 17 deletions
|
|
@ -213,7 +213,7 @@ endif
|
||||||
have_libwacom = get_option('libwacom')
|
have_libwacom = get_option('libwacom')
|
||||||
if have_libwacom
|
if have_libwacom
|
||||||
config_h.set('HAVE_LIBWACOM', 1)
|
config_h.set('HAVE_LIBWACOM', 1)
|
||||||
dep_libwacom = dependency('libwacom', version : '>= 0.27')
|
dep_libwacom = dependency('libwacom', version : '>= 2.14')
|
||||||
if cc.has_header_symbol('libwacom/libwacom.h', 'WACOM_BUTTON_DIAL_MODESWITCH',
|
if cc.has_header_symbol('libwacom/libwacom.h', 'WACOM_BUTTON_DIAL_MODESWITCH',
|
||||||
dependencies : dep_libwacom)
|
dependencies : dep_libwacom)
|
||||||
config_h.set('HAVE_LIBWACOM_BUTTON_DIAL_MODESWITCH', '1')
|
config_h.set('HAVE_LIBWACOM_BUTTON_DIAL_MODESWITCH', '1')
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,6 @@
|
||||||
|
|
||||||
#include "evdev-tablet.h"
|
#include "evdev-tablet.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
|
||||||
#include <libwacom/libwacom.h>
|
|
||||||
#else
|
|
||||||
typedef void *WacomStylus;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum notify {
|
enum notify {
|
||||||
DONT_NOTIFY,
|
DONT_NOTIFY,
|
||||||
DO_NOTIFY,
|
DO_NOTIFY,
|
||||||
|
|
@ -1401,14 +1395,20 @@ tablet_new_tool(struct tablet_dispatch *tablet,
|
||||||
struct libinput_tablet_tool *tool = zalloc(sizeof *tool);
|
struct libinput_tablet_tool *tool = zalloc(sizeof *tool);
|
||||||
const WacomStylus *s = NULL;
|
const WacomStylus *s = NULL;
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db;
|
WacomDevice *device = tablet->libwacom_device;
|
||||||
|
|
||||||
db = tablet_libinput_context(tablet)->libwacom.db;
|
if (device) {
|
||||||
#pragma GCC diagnostic push
|
int nstyli;
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
const WacomStylus **styli = libwacom_get_styli(device, &nstyli);
|
||||||
if (db)
|
|
||||||
s = libwacom_stylus_get_for_id(db, tool_id);
|
for (int i = 0; i < nstyli; i++) {
|
||||||
#pragma GCC diagnostic pop
|
const WacomStylus *stylus = styli[i];
|
||||||
|
if (libwacom_stylus_get_id(stylus) == (int)tool_id) {
|
||||||
|
s = stylus;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*tool = (struct libinput_tablet_tool){
|
*tool = (struct libinput_tablet_tool){
|
||||||
|
|
@ -2451,6 +2451,11 @@ tablet_destroy(struct evdev_dispatch *dispatch)
|
||||||
libinput_tablet_tool_unref(tool);
|
libinput_tablet_tool_unref(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBWACOM
|
||||||
|
if (tablet->libwacom_device)
|
||||||
|
libwacom_destroy(tablet->libwacom_device);
|
||||||
|
#endif
|
||||||
|
|
||||||
libinput_libwacom_unref(li);
|
libinput_libwacom_unref(li);
|
||||||
|
|
||||||
free(tablet);
|
free(tablet);
|
||||||
|
|
@ -2939,12 +2944,12 @@ static int
|
||||||
tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device)
|
tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device)
|
||||||
{
|
{
|
||||||
static unsigned int tablet_ids = 0;
|
static unsigned int tablet_ids = 0;
|
||||||
struct libinput *li = evdev_libinput_context(device);
|
|
||||||
struct libevdev *evdev = device->evdev;
|
struct libevdev *evdev = device->evdev;
|
||||||
enum libinput_tablet_tool_axis axis;
|
enum libinput_tablet_tool_axis axis;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
WacomDevice *wacom = NULL;
|
WacomDevice *wacom = NULL;
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
|
struct libinput *li = evdev_libinput_context(device);
|
||||||
WacomDeviceDatabase *db = libinput_libwacom_ref(li);
|
WacomDeviceDatabase *db = libinput_libwacom_ref(li);
|
||||||
if (db) {
|
if (db) {
|
||||||
char event_path[64];
|
char event_path[64];
|
||||||
|
|
@ -2968,6 +2973,7 @@ tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device)
|
||||||
evdev_device_get_id_vendor(device),
|
evdev_device_get_id_vendor(device),
|
||||||
evdev_device_get_id_product(device));
|
evdev_device_get_id_product(device));
|
||||||
}
|
}
|
||||||
|
tablet->libwacom_device = wacom;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -3020,8 +3026,6 @@ tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
out:
|
out:
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
if (wacom)
|
|
||||||
libwacom_destroy(wacom);
|
|
||||||
if (db)
|
if (db)
|
||||||
libinput_libwacom_unref(li);
|
libinput_libwacom_unref(li);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ struct tablet_dispatch {
|
||||||
struct evdev_dispatch base;
|
struct evdev_dispatch base;
|
||||||
struct evdev_device *device;
|
struct evdev_device *device;
|
||||||
unsigned int tablet_id; /* incremental ID */
|
unsigned int tablet_id; /* incremental ID */
|
||||||
|
WacomDevice *libwacom_device;
|
||||||
|
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
|
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
|
#else
|
||||||
|
typedef void *WacomStylus;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "util-bits.h"
|
#include "util-bits.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue