mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 15:00:05 +01:00
meson.build: change from config.set10() and #if to config.set() and #ifdef
config.set10 is much more convenient and nicer to read but can provide false positive if the value is 0 and #ifdef is used instead of #if. So let's switch everything to use #ifdef instead, that way we cannot get false positives if the value is unset. Closes #1162 Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1277>
This commit is contained in:
parent
36b2afae82
commit
cfec80582e
22 changed files with 110 additions and 101 deletions
35
meson.build
35
meson.build
|
|
@ -156,8 +156,9 @@ if not cc.has_header_symbol('sys/ptrace.h', 'PTRACE_ATTACH', prefix : prefix)
|
||||||
config_h.set('PTRACE_CONT', 'PT_CONTINUE')
|
config_h.set('PTRACE_CONT', 'PT_CONTINUE')
|
||||||
config_h.set('PTRACE_DETACH', 'PT_DETACH')
|
config_h.set('PTRACE_DETACH', 'PT_DETACH')
|
||||||
endif
|
endif
|
||||||
|
if get_option('install-tests')
|
||||||
config_h.set10('HAVE_INSTALLED_TESTS', get_option('install-tests'))
|
config_h.set('HAVE_INSTALLED_TESTS', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
pkgconfig = import('pkgconfig')
|
pkgconfig = import('pkgconfig')
|
||||||
|
|
@ -174,8 +175,8 @@ includes_src = include_directories('src')
|
||||||
############ mtdev configuration ############
|
############ mtdev configuration ############
|
||||||
|
|
||||||
have_mtdev = get_option('mtdev')
|
have_mtdev = get_option('mtdev')
|
||||||
config_h.set10('HAVE_MTDEV', have_mtdev)
|
|
||||||
if have_mtdev
|
if have_mtdev
|
||||||
|
config_h.set('HAVE_MTDEV', 1)
|
||||||
dep_mtdev = dependency('mtdev', version : '>= 1.1.0')
|
dep_mtdev = dependency('mtdev', version : '>= 1.1.0')
|
||||||
else
|
else
|
||||||
dep_mtdev = declare_dependency()
|
dep_mtdev = declare_dependency()
|
||||||
|
|
@ -184,8 +185,8 @@ endif
|
||||||
############ libwacom configuration ############
|
############ libwacom configuration ############
|
||||||
|
|
||||||
have_libwacom = get_option('libwacom')
|
have_libwacom = get_option('libwacom')
|
||||||
config_h.set10('HAVE_LIBWACOM', have_libwacom)
|
|
||||||
if have_libwacom
|
if have_libwacom
|
||||||
|
config_h.set('HAVE_LIBWACOM', 1)
|
||||||
dep_libwacom = dependency('libwacom', version : '>= 0.27')
|
dep_libwacom = dependency('libwacom', version : '>= 0.27')
|
||||||
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)
|
||||||
|
|
@ -612,13 +613,16 @@ executable('libinput-record',
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
|
|
||||||
config_h.set10('HAVE_DEBUG_GUI', get_option('debug-gui'))
|
|
||||||
if get_option('debug-gui')
|
if get_option('debug-gui')
|
||||||
|
config_h.set('HAVE_DEBUG_GUI', 1)
|
||||||
dep_gtk = dependency('gtk4', version : '>= 4.0', required : false)
|
dep_gtk = dependency('gtk4', version : '>= 4.0', required : false)
|
||||||
config_h.set10('HAVE_GTK4', dep_gtk.found())
|
if dep_gtk.found()
|
||||||
if not dep_gtk.found()
|
config_h.set('HAVE_GTK4', 1)
|
||||||
|
else
|
||||||
dep_gtk = dependency('gtk+-3.0', version : '>= 3.20')
|
dep_gtk = dependency('gtk+-3.0', version : '>= 3.20')
|
||||||
config_h.set10('HAVE_GTK3', dep_gtk.found())
|
if dep_gtk.found()
|
||||||
|
config_h.set('HAVE_GTK3', 1)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if meson.version().version_compare('>= 0.58')
|
if meson.version().version_compare('>= 0.58')
|
||||||
|
|
@ -636,8 +640,9 @@ if get_option('debug-gui')
|
||||||
dep_wayland_client = dependency('wayland-client', required : false)
|
dep_wayland_client = dependency('wayland-client', required : false)
|
||||||
dep_wayland_protocols = dependency('wayland-protocols', required : false)
|
dep_wayland_protocols = dependency('wayland-protocols', required : false)
|
||||||
|
|
||||||
config_h.set10('HAVE_GTK_X11', have_gtk_x11 and dep_x11.found())
|
if have_gtk_x11 and dep_x11.found()
|
||||||
config_h.set10('HAVE_GTK_WAYLAND', false)
|
config_h.set('HAVE_GTK_X11', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
debug_gui_sources = [ 'tools/libinput-debug-gui.c' ]
|
debug_gui_sources = [ 'tools/libinput-debug-gui.c' ]
|
||||||
|
|
||||||
|
|
@ -665,7 +670,7 @@ if get_option('debug-gui')
|
||||||
)
|
)
|
||||||
|
|
||||||
debug_gui_sources += [ wayland_headers, wayland_sources ]
|
debug_gui_sources += [ wayland_headers, wayland_sources ]
|
||||||
config_h.set10('HAVE_GTK_WAYLAND', true)
|
config_h.set('HAVE_GTK_WAYLAND', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
deps_debug_gui = [
|
deps_debug_gui = [
|
||||||
|
|
@ -791,11 +796,15 @@ if get_option('tests')
|
||||||
dep_check = dependency('check', version : '>= 0.9.10', required: false)
|
dep_check = dependency('check', version : '>= 0.9.10', required: false)
|
||||||
|
|
||||||
gstack = find_program('gstack', required : false)
|
gstack = find_program('gstack', required : false)
|
||||||
config_h.set10('HAVE_GSTACK', gstack.found())
|
if gstack.found()
|
||||||
|
config_h.set('HAVE_GSTACK', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
# for inhibit support during test run
|
# for inhibit support during test run
|
||||||
dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false)
|
dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false)
|
||||||
config_h.set10('HAVE_LIBSYSTEMD', dep_libsystemd.found())
|
if dep_libsystemd.found()
|
||||||
|
config_h.set('HAVE_LIBSYSTEMD', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
litest_sources = [
|
litest_sources = [
|
||||||
'src/libinput-private-config.c',
|
'src/libinput-private-config.c',
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -3742,7 +3742,7 @@ static bool
|
||||||
tp_requires_rotation(struct tp_dispatch *tp, struct evdev_device *device)
|
tp_requires_rotation(struct tp_dispatch *tp, struct evdev_device *device)
|
||||||
{
|
{
|
||||||
bool rotate = false;
|
bool rotate = false;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct libinput *li = tp_libinput_context(tp);
|
struct libinput *li = tp_libinput_context(tp);
|
||||||
WacomDeviceDatabase *db = NULL;
|
WacomDeviceDatabase *db = NULL;
|
||||||
WacomDevice **devices = NULL, **d;
|
WacomDevice **devices = NULL, **d;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "evdev-tablet-pad.h"
|
#include "evdev-tablet-pad.h"
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ pad_led_destroy(struct libinput *libinput, struct pad_mode_led *led)
|
||||||
free(led);
|
free(led);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
static inline struct pad_mode_led *
|
static inline struct pad_mode_led *
|
||||||
pad_led_new(struct libinput *libinput, const char *prefix, int group, int mode)
|
pad_led_new(struct libinput *libinput, const char *prefix, int group, int mode)
|
||||||
{
|
{
|
||||||
|
|
@ -198,7 +198,7 @@ pad_get_mode_group(struct pad_dispatch *pad, unsigned int index)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
static inline bool
|
static inline bool
|
||||||
is_litest_device(struct evdev_device *device)
|
is_litest_device(struct evdev_device *device)
|
||||||
{
|
{
|
||||||
|
|
@ -618,7 +618,7 @@ pad_init_leds(struct pad_dispatch *pad, struct evdev_device *device, WacomDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If libwacom fails, we init one fallback group anyway */
|
/* If libwacom fails, we init one fallback group anyway */
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
rc = pad_init_leds_from_libwacom(pad, device, wacom);
|
rc = pad_init_leds_from_libwacom(pad, device, wacom);
|
||||||
#endif
|
#endif
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include "evdev-tablet-pad.h"
|
#include "evdev-tablet-pad.h"
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -667,7 +667,7 @@ pad_init_buttons_from_libwacom(struct pad_dispatch *pad,
|
||||||
WacomDevice *tablet)
|
WacomDevice *tablet)
|
||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
|
|
||||||
if (tablet) {
|
if (tablet) {
|
||||||
int num_buttons = libwacom_get_num_buttons(tablet);
|
int num_buttons = libwacom_get_num_buttons(tablet);
|
||||||
|
|
@ -759,7 +759,7 @@ pad_init_left_handed(struct evdev_device *device, WacomDevice *wacom)
|
||||||
{
|
{
|
||||||
bool has_left_handed = true;
|
bool has_left_handed = true;
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
has_left_handed = !wacom || libwacom_is_reversible(wacom);
|
has_left_handed = !wacom || libwacom_is_reversible(wacom);
|
||||||
#endif
|
#endif
|
||||||
if (has_left_handed)
|
if (has_left_handed)
|
||||||
|
|
@ -772,7 +772,7 @@ pad_init(struct pad_dispatch *pad, struct evdev_device *device)
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
struct libinput *li = evdev_libinput_context(device);
|
struct libinput *li = evdev_libinput_context(device);
|
||||||
WacomDevice *wacom = NULL;
|
WacomDevice *wacom = NULL;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db = libinput_libwacom_ref(li);
|
WacomDeviceDatabase *db = libinput_libwacom_ref(li);
|
||||||
if (db) {
|
if (db) {
|
||||||
char event_path[64];
|
char event_path[64];
|
||||||
|
|
@ -825,7 +825,7 @@ pad_init(struct pad_dispatch *pad, struct evdev_device *device)
|
||||||
/* at most 5 "Multiple EV_ABS events" log messages per hour */
|
/* at most 5 "Multiple EV_ABS events" log messages per hour */
|
||||||
ratelimit_init(&pad->duplicate_abs_limit, s2us(60 * 60), 5);
|
ratelimit_init(&pad->duplicate_abs_limit, s2us(60 * 60), 5);
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
if (wacom)
|
if (wacom)
|
||||||
libwacom_destroy(wacom);
|
libwacom_destroy(wacom);
|
||||||
if (db)
|
if (db)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
#if !HAVE_LIBWACOM
|
#ifndef HAVE_LIBWACOM
|
||||||
typedef void *WacomDevice;
|
typedef void *WacomDevice;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include "evdev-tablet.h"
|
#include "evdev-tablet.h"
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#else
|
#else
|
||||||
typedef void *WacomStylus;
|
typedef void *WacomStylus;
|
||||||
|
|
@ -1004,7 +1004,7 @@ tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
|
||||||
const WacomStylus *s)
|
const WacomStylus *s)
|
||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
int code;
|
int code;
|
||||||
WacomStylusType type;
|
WacomStylusType type;
|
||||||
WacomAxisTypeFlags axes;
|
WacomAxisTypeFlags axes;
|
||||||
|
|
@ -1369,7 +1369,7 @@ tool_init_eraser_button(struct tablet_dispatch *tablet,
|
||||||
if (libinput_tablet_tool_get_type(tool) != LIBINPUT_TABLET_TOOL_TYPE_PEN)
|
if (libinput_tablet_tool_get_type(tool) != LIBINPUT_TABLET_TOOL_TYPE_PEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
/* libwacom's API is a bit terrible here:
|
/* libwacom's API is a bit terrible here:
|
||||||
* - has_eraser is true on styli that have a separate eraser, all
|
* - has_eraser is true on styli that have a separate eraser, all
|
||||||
* those are INVERT so we can exclude them
|
* those are INVERT so we can exclude them
|
||||||
|
|
@ -1400,7 +1400,7 @@ 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;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db;
|
WacomDeviceDatabase *db;
|
||||||
|
|
||||||
db = tablet_libinput_context(tablet)->libwacom.db;
|
db = tablet_libinput_context(tablet)->libwacom.db;
|
||||||
|
|
@ -2788,7 +2788,7 @@ tablet_init_left_handed(struct evdev_device *device, WacomDevice *wacom)
|
||||||
{
|
{
|
||||||
bool has_left_handed = true;
|
bool has_left_handed = true;
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
has_left_handed = !wacom || libwacom_is_reversible(wacom);
|
has_left_handed = !wacom || libwacom_is_reversible(wacom);
|
||||||
#endif
|
#endif
|
||||||
if (has_left_handed)
|
if (has_left_handed)
|
||||||
|
|
@ -2798,7 +2798,7 @@ tablet_init_left_handed(struct evdev_device *device, WacomDevice *wacom)
|
||||||
static inline bool
|
static inline bool
|
||||||
tablet_is_display_tablet(WacomDevice *wacom)
|
tablet_is_display_tablet(WacomDevice *wacom)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
return !wacom ||
|
return !wacom ||
|
||||||
(libwacom_get_integration_flags(wacom) &
|
(libwacom_get_integration_flags(wacom) &
|
||||||
(WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY));
|
(WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY));
|
||||||
|
|
@ -2810,7 +2810,7 @@ tablet_is_display_tablet(WacomDevice *wacom)
|
||||||
static inline bool
|
static inline bool
|
||||||
tablet_is_aes(struct evdev_device *device, WacomDevice *wacom)
|
tablet_is_aes(struct evdev_device *device, WacomDevice *wacom)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
int vid = evdev_device_get_id_vendor(device);
|
int vid = evdev_device_get_id_vendor(device);
|
||||||
/* Wacom-specific check for whether smoothing is required:
|
/* Wacom-specific check for whether smoothing is required:
|
||||||
* libwacom keeps all the AES pens in a single group, so any device
|
* libwacom keeps all the AES pens in a single group, so any device
|
||||||
|
|
@ -2943,7 +2943,7 @@ tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device)
|
||||||
enum libinput_tablet_tool_axis axis;
|
enum libinput_tablet_tool_axis axis;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
WacomDevice *wacom = NULL;
|
WacomDevice *wacom = NULL;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db = libinput_libwacom_ref(li);
|
WacomDeviceDatabase *db = libinput_libwacom_ref(li);
|
||||||
if (db) {
|
if (db) {
|
||||||
char event_path[64];
|
char event_path[64];
|
||||||
|
|
@ -3018,7 +3018,7 @@ tablet_init(struct tablet_dispatch *tablet, struct evdev_device *device)
|
||||||
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
out:
|
out:
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
if (wacom)
|
if (wacom)
|
||||||
libwacom_destroy(wacom);
|
libwacom_destroy(wacom);
|
||||||
if (db)
|
if (db)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
#if !HAVE_LIBWACOM
|
#ifndef HAVE_LIBWACOM
|
||||||
typedef void *WacomDevice;
|
typedef void *WacomDevice;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
#include "linux/input.h"
|
#include "linux/input.h"
|
||||||
#include "quirks.h"
|
#include "quirks.h"
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ libinput_plugin_system_load_internal_plugins(struct libinput *libinput,
|
||||||
|
|
||||||
system->loaded = true;
|
system->loaded = true;
|
||||||
|
|
||||||
#if HAVE_MTDEV
|
#ifdef HAVE_MTDEV
|
||||||
libinput_mtdev_plugin(libinput);
|
libinput_mtdev_plugin(libinput);
|
||||||
#endif
|
#endif
|
||||||
libinput_tablet_plugin_forced_tool(libinput);
|
libinput_tablet_plugin_forced_tool(libinput);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ struct libinput {
|
||||||
|
|
||||||
struct libinput_plugin_system plugin_system;
|
struct libinput_plugin_system plugin_system;
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct {
|
struct {
|
||||||
WacomDeviceDatabase *db;
|
WacomDeviceDatabase *db;
|
||||||
size_t refcount;
|
size_t refcount;
|
||||||
|
|
@ -1107,7 +1107,7 @@ point_in_rect(const struct device_coords *point, const struct device_coord_rect
|
||||||
point->y >= rect->y && point->y < rect->y + rect->h);
|
point->y >= rect->y && point->y < rect->y + rect->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *
|
WacomDeviceDatabase *
|
||||||
libinput_libwacom_ref(struct libinput *li);
|
libinput_libwacom_ref(struct libinput *li);
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -5146,7 +5146,7 @@ libinput_tablet_tool_config_eraser_button_get_default_button(
|
||||||
return tool->config.eraser_button.get_button(tool);
|
return tool->config.eraser_button.get_button(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *
|
WacomDeviceDatabase *
|
||||||
libinput_libwacom_ref(struct libinput *li)
|
libinput_libwacom_ref(struct libinput *li)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ backtrace_print(FILE *fp,
|
||||||
const char *highlight_before,
|
const char *highlight_before,
|
||||||
const char *highlight_extra)
|
const char *highlight_extra)
|
||||||
{
|
{
|
||||||
#if HAVE_GSTACK
|
#ifdef HAVE_GSTACK
|
||||||
pid_t parent, child;
|
pid_t parent, child;
|
||||||
int pipefd[2];
|
int pipefd[2];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "linux/input.h"
|
#include "linux/input.h"
|
||||||
#if HAVE_LIBSYSTEMD
|
#ifdef HAVE_LIBSYSTEMD
|
||||||
#include <systemd/sd-bus.h>
|
#include <systemd/sd-bus.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "linux/input.h"
|
#include "linux/input.h"
|
||||||
#if HAVE_LIBSYSTEMD
|
#ifdef HAVE_LIBSYSTEMD
|
||||||
#include <systemd/sd-bus.h>
|
#include <systemd/sd-bus.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
|
@ -1615,7 +1615,7 @@ static inline int
|
||||||
inhibit(void)
|
inhibit(void)
|
||||||
{
|
{
|
||||||
int lock_fd = -1;
|
int lock_fd = -1;
|
||||||
#if HAVE_LIBSYSTEMD
|
#ifdef HAVE_LIBSYSTEMD
|
||||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||||
_unref_(sd_bus_message) *m = NULL;
|
_unref_(sd_bus_message) *m = NULL;
|
||||||
_unref_(sd_bus) *bus = NULL;
|
_unref_(sd_bus) *bus = NULL;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_num_buttons_libwacom)
|
START_TEST(pad_num_buttons_libwacom)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput_device *device = dev->libinput_device;
|
struct libinput_device *device = dev->libinput_device;
|
||||||
WacomDeviceDatabase *db = NULL;
|
WacomDeviceDatabase *db = NULL;
|
||||||
|
|
@ -172,7 +172,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_button_intuos)
|
START_TEST(pad_button_intuos)
|
||||||
{
|
{
|
||||||
#if !HAVE_LIBWACOM
|
#ifndef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
unsigned int code;
|
unsigned int code;
|
||||||
|
|
@ -231,7 +231,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_button_bamboo)
|
START_TEST(pad_button_bamboo)
|
||||||
{
|
{
|
||||||
#if !HAVE_LIBWACOM
|
#ifndef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
unsigned int code;
|
unsigned int code;
|
||||||
|
|
@ -281,7 +281,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_button_libwacom)
|
START_TEST(pad_button_libwacom)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
WacomDeviceDatabase *db = NULL;
|
WacomDeviceDatabase *db = NULL;
|
||||||
|
|
@ -325,7 +325,7 @@ START_TEST(pad_button_mode_groups)
|
||||||
struct libinput_event_tablet_pad *pev;
|
struct libinput_event_tablet_pad *pev;
|
||||||
unsigned int expected_mode = 0;
|
unsigned int expected_mode = 0;
|
||||||
int evdev_codes[KEY_OK - BTN_0] = { 0 };
|
int evdev_codes[KEY_OK - BTN_0] = { 0 };
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db = NULL;
|
WacomDeviceDatabase *db = NULL;
|
||||||
WacomDevice *wacom = NULL;
|
WacomDevice *wacom = NULL;
|
||||||
|
|
||||||
|
|
@ -703,7 +703,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_left_handed_default)
|
START_TEST(pad_left_handed_default)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput_device *device = dev->libinput_device;
|
struct libinput_device *device = dev->libinput_device;
|
||||||
enum libinput_config_status status;
|
enum libinput_config_status status;
|
||||||
|
|
@ -735,7 +735,7 @@ START_TEST(pad_no_left_handed)
|
||||||
struct libinput_device *device = dev->libinput_device;
|
struct libinput_device *device = dev->libinput_device;
|
||||||
|
|
||||||
/* Without libwacom we default to left-handed being available */
|
/* Without libwacom we default to left-handed being available */
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
litest_assert(!libinput_device_config_left_handed_is_available(device));
|
litest_assert(!libinput_device_config_left_handed_is_available(device));
|
||||||
#else
|
#else
|
||||||
litest_assert(libinput_device_config_left_handed_is_available(device));
|
litest_assert(libinput_device_config_left_handed_is_available(device));
|
||||||
|
|
@ -744,7 +744,7 @@ START_TEST(pad_no_left_handed)
|
||||||
litest_assert_int_eq(libinput_device_config_left_handed_get_default(device), 0);
|
litest_assert_int_eq(libinput_device_config_left_handed_get_default(device), 0);
|
||||||
litest_assert_int_eq(libinput_device_config_left_handed_get(device), 0);
|
litest_assert_int_eq(libinput_device_config_left_handed_get(device), 0);
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
enum libinput_config_status status;
|
enum libinput_config_status status;
|
||||||
status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
|
status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
|
||||||
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
||||||
|
|
@ -763,7 +763,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_left_handed_ring)
|
START_TEST(pad_left_handed_ring)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
struct libinput_event *ev;
|
struct libinput_event *ev;
|
||||||
|
|
@ -811,7 +811,7 @@ static bool
|
||||||
pad_has_groups(struct litest_device *dev)
|
pad_has_groups(struct litest_device *dev)
|
||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db = NULL;
|
WacomDeviceDatabase *db = NULL;
|
||||||
WacomDevice *wacom = NULL;
|
WacomDevice *wacom = NULL;
|
||||||
|
|
||||||
|
|
@ -1020,7 +1020,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(pad_mode_group_has_no_toggle)
|
START_TEST(pad_mode_group_has_no_toggle)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput_device *device = dev->libinput_device;
|
struct libinput_device *device = dev->libinput_device;
|
||||||
struct libinput_tablet_pad_mode_group *group;
|
struct libinput_tablet_pad_mode_group *group;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1763,7 +1763,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(left_handed)
|
START_TEST(left_handed)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
struct libinput_event *event;
|
struct libinput_event *event;
|
||||||
|
|
@ -1892,7 +1892,7 @@ START_TEST(no_left_handed)
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
|
|
||||||
/* Without libwacom we default to left-handed being available */
|
/* Without libwacom we default to left-handed being available */
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
litest_assert(
|
litest_assert(
|
||||||
!libinput_device_config_left_handed_is_available(dev->libinput_device));
|
!libinput_device_config_left_handed_is_available(dev->libinput_device));
|
||||||
#else
|
#else
|
||||||
|
|
@ -1904,7 +1904,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(left_handed_tilt)
|
START_TEST(left_handed_tilt)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
struct libinput_event *event;
|
struct libinput_event *event;
|
||||||
|
|
@ -1977,7 +1977,7 @@ rotate_event(struct litest_device *dev, int angle_degrees)
|
||||||
|
|
||||||
START_TEST(left_handed_mouse_rotation)
|
START_TEST(left_handed_mouse_rotation)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
enum libinput_config_status status;
|
enum libinput_config_status status;
|
||||||
|
|
@ -2023,7 +2023,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(left_handed_artpen_rotation)
|
START_TEST(left_handed_artpen_rotation)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
struct libinput_event *event;
|
struct libinput_event *event;
|
||||||
|
|
@ -3542,7 +3542,7 @@ device_has_calibration(struct litest_device *dev)
|
||||||
libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_PEN) ||
|
libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_PEN) ||
|
||||||
libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS);
|
libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS);
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
WacomDeviceDatabase *db = libwacom_database_new();
|
WacomDeviceDatabase *db = libwacom_database_new();
|
||||||
if (db) {
|
if (db) {
|
||||||
WacomDevice *d =
|
WacomDevice *d =
|
||||||
|
|
@ -6379,7 +6379,7 @@ START_TEST(touch_arbitration_swap_device)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
static void
|
static void
|
||||||
verify_left_handed_tablet_motion(struct litest_device *tablet,
|
verify_left_handed_tablet_motion(struct litest_device *tablet,
|
||||||
struct libinput *li,
|
struct libinput *li,
|
||||||
|
|
@ -6502,7 +6502,7 @@ verify_left_handed_touch_sequence(struct litest_device *finger,
|
||||||
|
|
||||||
START_TEST(tablet_rotation_left_handed)
|
START_TEST(tablet_rotation_left_handed)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *tablet = litest_current_device();
|
struct litest_device *tablet = litest_current_device();
|
||||||
enum litest_device_type other;
|
enum litest_device_type other;
|
||||||
struct litest_device *finger;
|
struct litest_device *finger;
|
||||||
|
|
@ -6545,7 +6545,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(tablet_rotation_left_handed_configuration)
|
START_TEST(tablet_rotation_left_handed_configuration)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *tablet = litest_current_device();
|
struct litest_device *tablet = litest_current_device();
|
||||||
enum litest_device_type other;
|
enum litest_device_type other;
|
||||||
struct litest_device *finger;
|
struct litest_device *finger;
|
||||||
|
|
@ -6597,7 +6597,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(tablet_rotation_left_handed_while_in_prox)
|
START_TEST(tablet_rotation_left_handed_while_in_prox)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *tablet = litest_current_device();
|
struct litest_device *tablet = litest_current_device();
|
||||||
enum litest_device_type other;
|
enum litest_device_type other;
|
||||||
struct litest_device *finger;
|
struct litest_device *finger;
|
||||||
|
|
@ -6691,7 +6691,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(tablet_rotation_left_handed_while_touch_down)
|
START_TEST(tablet_rotation_left_handed_while_touch_down)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *tablet = litest_current_device();
|
struct litest_device *tablet = litest_current_device();
|
||||||
enum litest_device_type other;
|
enum litest_device_type other;
|
||||||
struct litest_device *finger;
|
struct litest_device *finger;
|
||||||
|
|
@ -6752,7 +6752,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(tablet_rotation_left_handed_add_touchpad)
|
START_TEST(tablet_rotation_left_handed_add_touchpad)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *tablet = litest_current_device();
|
struct litest_device *tablet = litest_current_device();
|
||||||
enum litest_device_type other;
|
enum litest_device_type other;
|
||||||
struct litest_device *finger;
|
struct litest_device *finger;
|
||||||
|
|
@ -6800,7 +6800,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(tablet_rotation_left_handed_add_tablet)
|
START_TEST(tablet_rotation_left_handed_add_tablet)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *finger = litest_current_device();
|
struct litest_device *finger = litest_current_device();
|
||||||
enum litest_device_type other;
|
enum litest_device_type other;
|
||||||
struct litest_device *tablet;
|
struct litest_device *tablet;
|
||||||
|
|
@ -7028,7 +7028,7 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(tablet_smoothing)
|
START_TEST(tablet_smoothing)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
|
||||||
|
|
@ -1353,7 +1353,7 @@ TEST_COLLECTION(touch)
|
||||||
litest_add(fake_mt_exists, LITEST_FAKE_MT, LITEST_ANY);
|
litest_add(fake_mt_exists, LITEST_FAKE_MT, LITEST_ANY);
|
||||||
litest_add(fake_mt_no_touch_events, LITEST_FAKE_MT, LITEST_ANY);
|
litest_add(fake_mt_no_touch_events, LITEST_FAKE_MT, LITEST_ANY);
|
||||||
|
|
||||||
#if HAVE_MTDEV
|
#ifdef HAVE_MTDEV
|
||||||
litest_add(touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY);
|
litest_add(touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY);
|
||||||
litest_add(touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY);
|
litest_add(touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY);
|
||||||
litest_add(touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY);
|
litest_add(touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY);
|
||||||
|
|
@ -1375,7 +1375,7 @@ TEST_COLLECTION(touch)
|
||||||
|
|
||||||
litest_add(touch_count_st, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD);
|
litest_add(touch_count_st, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD);
|
||||||
litest_add(touch_count_mt, LITEST_TOUCH, LITEST_SINGLE_TOUCH|LITEST_PROTOCOL_A);
|
litest_add(touch_count_mt, LITEST_TOUCH, LITEST_SINGLE_TOUCH|LITEST_PROTOCOL_A);
|
||||||
#if HAVE_MTDEV
|
#ifdef HAVE_MTDEV
|
||||||
litest_add(touch_count_mtdev, LITEST_PROTOCOL_A, LITEST_ANY);
|
litest_add(touch_count_mtdev, LITEST_PROTOCOL_A, LITEST_ANY);
|
||||||
litest_add(touch_count_invalid, LITEST_ANY, LITEST_TOUCH|LITEST_SINGLE_TOUCH|LITEST_PROTOCOL_A);
|
litest_add(touch_count_invalid, LITEST_ANY, LITEST_TOUCH|LITEST_SINGLE_TOUCH|LITEST_PROTOCOL_A);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2573,7 +2573,7 @@ START_TEST(touchpad_left_handed_clickpad_delayed)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
static inline bool
|
static inline bool
|
||||||
touchpad_has_rotation(struct libevdev *evdev)
|
touchpad_has_rotation(struct libevdev *evdev)
|
||||||
{
|
{
|
||||||
|
|
@ -2583,7 +2583,7 @@ touchpad_has_rotation(struct libevdev *evdev)
|
||||||
|
|
||||||
START_TEST(touchpad_left_handed_rotation)
|
START_TEST(touchpad_left_handed_rotation)
|
||||||
{
|
{
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
struct libinput_device *d = dev->libinput_device;
|
struct libinput_device *d = dev->libinput_device;
|
||||||
struct libinput *li = dev->libinput;
|
struct libinput *li = dev->libinput;
|
||||||
|
|
|
||||||
|
|
@ -46,21 +46,21 @@
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
#if HAVE_GTK_WAYLAND
|
#ifdef HAVE_GTK_WAYLAND
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
#include "pointer-constraints-unstable-v1-client-protocol.h"
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
#include <gdk/wayland/gdkwayland.h>
|
#include <gdk/wayland/gdkwayland.h>
|
||||||
#else
|
#else
|
||||||
#include <gdk/gdkwayland.h>
|
#include <gdk/gdkwayland.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GTK_X11
|
#ifdef HAVE_GTK_X11
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
#include <gdk/x11/gdkx.h>
|
#include <gdk/x11/gdkx.h>
|
||||||
#else
|
#else
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
@ -119,7 +119,7 @@ struct window {
|
||||||
struct {
|
struct {
|
||||||
bool locked;
|
bool locked;
|
||||||
|
|
||||||
#if HAVE_GTK_WAYLAND
|
#ifdef HAVE_GTK_WAYLAND
|
||||||
struct zwp_pointer_constraints_v1 *wayland_pointer_constraints;
|
struct zwp_pointer_constraints_v1 *wayland_pointer_constraints;
|
||||||
struct zwp_locked_pointer_v1 *wayland_locked_pointer;
|
struct zwp_locked_pointer_v1 *wayland_locked_pointer;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -210,7 +210,7 @@ struct window {
|
||||||
struct libinput_device *devices[50];
|
struct libinput_device *devices[50];
|
||||||
};
|
};
|
||||||
|
|
||||||
#if HAVE_GTK_WAYLAND
|
#ifdef HAVE_GTK_WAYLAND
|
||||||
static void
|
static void
|
||||||
wayland_registry_global(void *data,
|
wayland_registry_global(void *data,
|
||||||
struct wl_registry *registry,
|
struct wl_registry *registry,
|
||||||
|
|
@ -268,7 +268,7 @@ wayland_lock_pointer(struct window *w)
|
||||||
if (!w->lock_pointer.wayland_pointer_constraints)
|
if (!w->lock_pointer.wayland_pointer_constraints)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
GtkNative *window = gtk_widget_get_native(w->win);
|
GtkNative *window = gtk_widget_get_native(w->win);
|
||||||
GdkSurface *gdk_surface = gtk_native_get_surface(window);
|
GdkSurface *gdk_surface = gtk_native_get_surface(window);
|
||||||
surface = gdk_wayland_surface_get_wl_surface(gdk_surface);
|
surface = gdk_wayland_surface_get_wl_surface(gdk_surface);
|
||||||
|
|
@ -302,7 +302,7 @@ backend_is_wayland(void)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_GTK_WAYLAND */
|
#endif /* HAVE_GTK_WAYLAND */
|
||||||
|
|
||||||
#if HAVE_GTK_X11
|
#ifdef HAVE_GTK_X11
|
||||||
static bool
|
static bool
|
||||||
x_lock_pointer(struct window *w)
|
x_lock_pointer(struct window *w)
|
||||||
{
|
{
|
||||||
|
|
@ -319,7 +319,7 @@ x_lock_pointer(struct window *w)
|
||||||
x_display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
x_display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
GtkNative *window = gtk_widget_get_native(w->win);
|
GtkNative *window = gtk_widget_get_native(w->win);
|
||||||
GdkSurface *surface = gtk_native_get_surface(window);
|
GdkSurface *surface = gtk_native_get_surface(window);
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
@ -369,12 +369,12 @@ window_lock_pointer(struct window *w)
|
||||||
if (w->lock_pointer.locked)
|
if (w->lock_pointer.locked)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#if HAVE_GTK_WAYLAND
|
#ifdef HAVE_GTK_WAYLAND
|
||||||
if (backend_is_wayland())
|
if (backend_is_wayland())
|
||||||
w->lock_pointer.locked = wayland_lock_pointer(w);
|
w->lock_pointer.locked = wayland_lock_pointer(w);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GTK_X11
|
#ifdef HAVE_GTK_X11
|
||||||
if (backend_is_x11())
|
if (backend_is_x11())
|
||||||
w->lock_pointer.locked = x_lock_pointer(w);
|
w->lock_pointer.locked = x_lock_pointer(w);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -390,12 +390,12 @@ window_unlock_pointer(struct window *w)
|
||||||
|
|
||||||
w->lock_pointer.locked = false;
|
w->lock_pointer.locked = false;
|
||||||
|
|
||||||
#if HAVE_GTK_WAYLAND
|
#ifdef HAVE_GTK_WAYLAND
|
||||||
if (backend_is_wayland())
|
if (backend_is_wayland())
|
||||||
wayland_unlock_pointer(w);
|
wayland_unlock_pointer(w);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GTK_X11
|
#ifdef HAVE_GTK_X11
|
||||||
if (backend_is_x11())
|
if (backend_is_x11())
|
||||||
x_unlock_pointer(w);
|
x_unlock_pointer(w);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1047,7 +1047,7 @@ draw(GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
static void
|
static void
|
||||||
draw_gtk4(GtkDrawingArea *widget, cairo_t *cr, int width, int height, gpointer data)
|
draw_gtk4(GtkDrawingArea *widget, cairo_t *cr, int width, int height, gpointer data)
|
||||||
{
|
{
|
||||||
|
|
@ -1058,7 +1058,7 @@ draw_gtk4(GtkDrawingArea *widget, cairo_t *cr, int width, int height, gpointer d
|
||||||
static void
|
static void
|
||||||
window_place_ui_elements(GtkWidget *widget, struct window *w)
|
window_place_ui_elements(GtkWidget *widget, struct window *w)
|
||||||
{
|
{
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
w->width = gtk_widget_get_width(w->area);
|
w->width = gtk_widget_get_width(w->area);
|
||||||
w->height = gtk_widget_get_height(w->area);
|
w->height = gtk_widget_get_height(w->area);
|
||||||
#else
|
#else
|
||||||
|
|
@ -1089,7 +1089,7 @@ window_place_ui_elements(GtkWidget *widget, struct window *w)
|
||||||
w->pinch.y = w->height / 2;
|
w->pinch.y = w->height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
static void
|
static void
|
||||||
map_event_cb(GtkDrawingArea *widget, int width, int height, gpointer data)
|
map_event_cb(GtkDrawingArea *widget, int width, int height, gpointer data)
|
||||||
{
|
{
|
||||||
|
|
@ -1131,7 +1131,7 @@ window_quit(struct window *w)
|
||||||
g_main_loop_quit(w->event_loop);
|
g_main_loop_quit(w->event_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
static gboolean
|
static gboolean
|
||||||
window_delete_event_cb(GtkWindow *window, gpointer data)
|
window_delete_event_cb(GtkWindow *window, gpointer data)
|
||||||
{
|
{
|
||||||
|
|
@ -1156,14 +1156,14 @@ window_init(struct window *w)
|
||||||
{
|
{
|
||||||
list_init(&w->evdev_devices);
|
list_init(&w->evdev_devices);
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
w->win = gtk_window_new();
|
w->win = gtk_window_new();
|
||||||
#else
|
#else
|
||||||
w->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
w->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getenv("LIBINPUT_RUNNING_TEST_SUITE")) {
|
if (getenv("LIBINPUT_RUNNING_TEST_SUITE")) {
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
gtk_window_minimize(GTK_WINDOW(w->win));
|
gtk_window_minimize(GTK_WINDOW(w->win));
|
||||||
#else
|
#else
|
||||||
gtk_window_iconify(GTK_WINDOW(w->win));
|
gtk_window_iconify(GTK_WINDOW(w->win));
|
||||||
|
|
@ -1178,7 +1178,7 @@ window_init(struct window *w)
|
||||||
|
|
||||||
w->area = gtk_drawing_area_new();
|
w->area = gtk_drawing_area_new();
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
g_signal_connect(G_OBJECT(w->area), "resize", G_CALLBACK(map_event_cb), w);
|
g_signal_connect(G_OBJECT(w->area), "resize", G_CALLBACK(map_event_cb), w);
|
||||||
g_signal_connect(G_OBJECT(w->win),
|
g_signal_connect(G_OBJECT(w->win),
|
||||||
"close-request",
|
"close-request",
|
||||||
|
|
@ -1929,7 +1929,7 @@ main(int argc, char **argv)
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
bool gtk_init = false;
|
bool gtk_init = false;
|
||||||
|
|
||||||
#if HAVE_GTK4
|
#ifdef HAVE_GTK4
|
||||||
gtk_init = gtk_init_check();
|
gtk_init = gtk_init_check();
|
||||||
#else
|
#else
|
||||||
gtk_init = gtk_init_check(&argc, &argv);
|
gtk_init = gtk_init_check(&argc, &argv);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
static inline void
|
static inline void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
#if HAVE_INSTALLED_TESTS
|
#ifdef HAVE_INSTALLED_TESTS
|
||||||
printf("Usage: libinput test [--help] <feature>\n");
|
printf("Usage: libinput test [--help] <feature>\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "libinput test was disabled in the build configuration\n");
|
fprintf(stderr, "libinput test was disabled in the build configuration\n");
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ usage(void)
|
||||||
" debug-events\n"
|
" debug-events\n"
|
||||||
" Print events to stdout\n"
|
" Print events to stdout\n"
|
||||||
"\n"
|
"\n"
|
||||||
#if HAVE_DEBUG_GUI
|
#ifdef HAVE_DEBUG_GUI
|
||||||
" debug-gui\n"
|
" debug-gui\n"
|
||||||
" Display a simple GUI to visualize libinput's events.\n"
|
" Display a simple GUI to visualize libinput's events.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include "libinput-util.h"
|
#include "libinput-util.h"
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
#include <libwacom/libwacom.h>
|
#include <libwacom/libwacom.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -205,7 +205,7 @@ main(int argc, char **argv)
|
||||||
} else {
|
} else {
|
||||||
char *physmatch = NULL;
|
char *physmatch = NULL;
|
||||||
|
|
||||||
#if HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
if (vendor_id == VENDOR_ID_WACOM) {
|
if (vendor_id == VENDOR_ID_WACOM) {
|
||||||
if (product_id == PRODUCT_ID_WACOM_EKR)
|
if (product_id == PRODUCT_ID_WACOM_EKR)
|
||||||
wacom_handle_ekr(device,
|
wacom_handle_ekr(device,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue