mirror of
https://github.com/X11Libre/xf86-input-libinput.git
synced 2026-04-14 10:54:17 +00:00
Compare commits
19 Commits
xlibre-xf8
...
incubate
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f01c47f3 | ||
|
|
d8536737f1 | ||
|
|
c65932fa4a | ||
|
|
7389ff0bda | ||
|
|
28aa704a2e | ||
|
|
64ba08fc54 | ||
|
|
b695a892d3 | ||
|
|
b952981d05 | ||
|
|
060022b4b3 | ||
|
|
3f1207ebeb | ||
|
|
1ca5d08407 | ||
|
|
7721621c89 | ||
|
|
8644b2724a | ||
|
|
559204d69b | ||
|
|
1b581c5739 | ||
|
|
d1984c55d7 | ||
|
|
ef54aca082 | ||
|
|
40e01ab7be | ||
|
|
e732b6a8e7 |
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{c,h}]
|
||||||
|
indent_size = 8
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[{meson.build,meson_options.txt}]
|
||||||
|
indent_size = 8
|
||||||
|
indent_style = tab
|
||||||
98
.gitlab-ci.yml
Normal file
98
.gitlab-ci.yml
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
|
||||||
|
#
|
||||||
|
# This CI uses the freedesktop.org ci-templates.
|
||||||
|
# Please see the ci-templates documentation for details:
|
||||||
|
# https://freedesktop.pages.freedesktop.org/ci-templates/
|
||||||
|
|
||||||
|
.templates_sha: &template_sha 84052757dacc5fd65f5ace92b7fe63c60f6c8558 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||||
|
|
||||||
|
include:
|
||||||
|
- project: 'freedesktop/ci-templates'
|
||||||
|
ref: *template_sha
|
||||||
|
file: '/templates/fedora.yml'
|
||||||
|
- project: 'freedesktop/ci-templates'
|
||||||
|
ref: *template_sha
|
||||||
|
file: '/templates/ci-fairy.yml'
|
||||||
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|
||||||
|
variables:
|
||||||
|
FDO_UPSTREAM_REPO: xorg/driver/xf86-input-libinput
|
||||||
|
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- containers
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
.fedora:
|
||||||
|
variables:
|
||||||
|
FDO_DISTRIBUTION_VERSION: 39
|
||||||
|
FDO_DISTRIBUTION_PACKAGES: 'git autoconf automake libtool make xorg-x11-server-devel libudev-devel libevdev-devel libinput-devel xorg-x11-util-macros diffutils'
|
||||||
|
FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/fedora-install.sh'
|
||||||
|
FDO_DISTRIBUTION_TAG: '2025-04-01.0'
|
||||||
|
|
||||||
|
|
||||||
|
fedora@container_build:
|
||||||
|
extends:
|
||||||
|
- .fedora
|
||||||
|
- .fdo.container-build@fedora
|
||||||
|
stage: containers
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: none
|
||||||
|
|
||||||
|
|
||||||
|
.default_build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- mkdir _builddir _inst
|
||||||
|
- pushd _builddir > /dev/null
|
||||||
|
- ../autogen.sh --prefix=$(realpath ../_inst) --disable-silent-rules
|
||||||
|
- make && make check
|
||||||
|
- make install
|
||||||
|
- popd > /dev/null
|
||||||
|
artifacts:
|
||||||
|
name: "automake-logs-$CI_JOB_NAME"
|
||||||
|
when: always
|
||||||
|
expire_in: 1 week
|
||||||
|
paths:
|
||||||
|
- _builddir/config.log
|
||||||
|
|
||||||
|
|
||||||
|
fedora@default-build:
|
||||||
|
extends:
|
||||||
|
- .fedora
|
||||||
|
- .fdo.distribution-image@fedora
|
||||||
|
- .default_build
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify that commit messages are as expected
|
||||||
|
#
|
||||||
|
check-commits:
|
||||||
|
extends:
|
||||||
|
- .fdo.ci-fairy
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- ci-fairy check-commits --junit-xml=results.xml
|
||||||
|
except:
|
||||||
|
- master@xorg/driver/xf86-input-libinput
|
||||||
|
variables:
|
||||||
|
GIT_DEPTH: 100
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
junit: results.xml
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify that the merge request has the allow-collaboration checkbox ticked
|
||||||
|
#
|
||||||
|
check-merge-request:
|
||||||
|
extends:
|
||||||
|
- .fdo.ci-fairy
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
|
||||||
|
artifacts:
|
||||||
|
when: on_failure
|
||||||
|
reports:
|
||||||
|
junit: results.xml
|
||||||
|
allow_failure: true
|
||||||
@@ -27,6 +27,9 @@ DISTCHECK_CONFIGURE_FLAGS = --with-xorg-module-dir='$${libdir}/xorg/modules' \
|
|||||||
SUBDIRS = src include man test
|
SUBDIRS = src include man test
|
||||||
MAINTAINERCLEANFILES = ChangeLog INSTALL
|
MAINTAINERCLEANFILES = ChangeLog INSTALL
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = xorg-libinput.pc
|
||||||
|
|
||||||
dist_xorgconf_DATA = conf/40-libinput.conf
|
dist_xorgconf_DATA = conf/40-libinput.conf
|
||||||
|
|
||||||
.PHONY: ChangeLog INSTALL
|
.PHONY: ChangeLog INSTALL
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -2,8 +2,7 @@ xf86-input-libinput - a libinput-based X driver
|
|||||||
===============================================
|
===============================================
|
||||||
|
|
||||||
The official repository for this driver is
|
The official repository for this driver is
|
||||||
|
https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput
|
||||||
https://github.com/X11Libre/xf86-input-evdev
|
|
||||||
|
|
||||||
This is an X driver based on libinput. It is a thin wrapper around libinput,
|
This is an X driver based on libinput. It is a thin wrapper around libinput,
|
||||||
so while it does provide all features that libinput supports it does little
|
so while it does provide all features that libinput supports it does little
|
||||||
@@ -13,6 +12,19 @@ beyond.
|
|||||||
usable input devices in your X session. Use with caution.***
|
usable input devices in your X session. Use with caution.***
|
||||||
|
|
||||||
|
|
||||||
|
Prerequisites
|
||||||
|
-------------
|
||||||
|
|
||||||
|
To build, you'll need the X.Org X server SDK (check your distribution for a
|
||||||
|
xorg-x11-server-devel package or similar) and libinput (check your
|
||||||
|
distribution for libinput-devel or similar).
|
||||||
|
|
||||||
|
To get libinput from source, see:
|
||||||
|
https://www.freedesktop.org/wiki/Software/libinput/
|
||||||
|
|
||||||
|
To build the X server from source:
|
||||||
|
https://www.x.org/wiki/Building_the_X_Window_System/
|
||||||
|
|
||||||
Building
|
Building
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@@ -31,3 +43,13 @@ Install the default configuration file:
|
|||||||
cp conf/99-libinput.conf /etc/X11/xorg.conf.d/
|
cp conf/99-libinput.conf /etc/X11/xorg.conf.d/
|
||||||
|
|
||||||
This will assign this driver to *all* devices. Use with caution.
|
This will assign this driver to *all* devices. Use with caution.
|
||||||
|
|
||||||
|
|
||||||
|
Bugs
|
||||||
|
----
|
||||||
|
|
||||||
|
Bugs in libinput go to the Issues section of the libinput gitlab project:
|
||||||
|
https://gitlab.freedesktop.org/libinput/libinput/issues
|
||||||
|
|
||||||
|
Bugs in this driver go to the Issues section of its gitlab project:
|
||||||
|
https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues
|
||||||
|
|||||||
24
configure.ac
24
configure.ac
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
# Initialize Autoconf
|
# Initialize Autoconf
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.60])
|
||||||
AC_INIT([xlibre-xf86-input-libinput],
|
AC_INIT([xf86-input-libinput],
|
||||||
[25.0.0],
|
[1.5.0],
|
||||||
[https://github.com/X11Libre/xf86-input-libinput/issues],
|
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues],
|
||||||
[xlibre-xf86-input-libinput])
|
[xf86-input-libinput])
|
||||||
AC_CONFIG_SRCDIR([Makefile.am])
|
AC_CONFIG_SRCDIR([Makefile.am])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_AUX_DIR(.)
|
AC_CONFIG_AUX_DIR(.)
|
||||||
@@ -113,17 +113,6 @@ AC_LINK_IFELSE(
|
|||||||
[AC_MSG_RESULT([no])
|
[AC_MSG_RESULT([no])
|
||||||
[libinput_have_clickfinger_button_map=no]])
|
[libinput_have_clickfinger_button_map=no]])
|
||||||
|
|
||||||
AC_MSG_CHECKING([if libinput_plugin_system_load is available])
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([[#include <libinput.h>]],
|
|
||||||
[[libinput_plugin_system_load_plugins(NULL, 0)]])],
|
|
||||||
[AC_MSG_RESULT([yes])
|
|
||||||
AC_DEFINE(HAVE_LIBINPUT_PLUGINS, [1],
|
|
||||||
[libinput_plugin_system_load_plugins() is available])
|
|
||||||
[libinput_have_plugin_system=yes]],
|
|
||||||
[AC_MSG_RESULT([no])
|
|
||||||
[libinput_have_plugin_system=no]])
|
|
||||||
|
|
||||||
LIBS=$OLD_LIBS
|
LIBS=$OLD_LIBS
|
||||||
CFLAGS=$OLD_CFLAGS
|
CFLAGS=$OLD_CFLAGS
|
||||||
|
|
||||||
@@ -152,10 +141,13 @@ sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
|
|||||||
AC_ARG_WITH([sdkdir], [], [sdkdir="$withval"])
|
AC_ARG_WITH([sdkdir], [], [sdkdir="$withval"])
|
||||||
AC_SUBST([sdkdir])
|
AC_SUBST([sdkdir])
|
||||||
|
|
||||||
|
DRIVER_NAME=libinput
|
||||||
|
AC_SUBST([DRIVER_NAME])
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
include/Makefile
|
include/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
man/Makefile
|
man/Makefile
|
||||||
test/Makefile
|
test/Makefile
|
||||||
])
|
xorg-libinput.pc])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
drivermandir = $(DRIVER_MAN_DIR)
|
drivermandir = $(DRIVER_MAN_DIR)
|
||||||
|
|
||||||
driverman_PRE = libinput.man
|
driverman_PRE = $(DRIVER_NAME).man
|
||||||
|
|
||||||
driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
|
driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
|
||||||
|
|
||||||
EXTRA_DIST = libinput.man
|
EXTRA_DIST = $(DRIVER_NAME).man
|
||||||
|
|
||||||
CLEANFILES = $(driverman_DATA)
|
CLEANFILES = $(driverman_DATA)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ If you are looking for the library documentation, go to
|
|||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B libinput
|
.B libinput
|
||||||
is an XLibre input driver based on libinput.
|
is an Xorg input driver based on libinput.
|
||||||
It therefore supports all input devices that libinput can handle, including
|
It therefore supports all input devices that libinput can handle, including
|
||||||
most mice, keyboards, tablets and touchscreens.
|
most mice, keyboards, tablets and touchscreens.
|
||||||
.PP
|
.PP
|
||||||
@@ -178,15 +178,6 @@ Enables left-handed button orientation, i.e. swapping left and right buttons.
|
|||||||
Enables middle button emulation.
|
Enables middle button emulation.
|
||||||
When enabled, pressing the left and right
|
When enabled, pressing the left and right
|
||||||
buttons simultaneously produces a middle mouse button click.
|
buttons simultaneously produces a middle mouse button click.
|
||||||
A synonym
|
|
||||||
.IP
|
|
||||||
.BI "Option \*qEmulate3Buttons\*q \*q" bool \*q
|
|
||||||
.IP
|
|
||||||
is preserved for compatibility with
|
|
||||||
.B evdev
|
|
||||||
driver, with
|
|
||||||
.BI "\*qMiddleEmulation\*q
|
|
||||||
having preference if both are set.
|
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qNaturalScrolling\*q \*q" bool \*q
|
.BI "Option \*qNaturalScrolling\*q \*q" bool \*q
|
||||||
Enables or disables natural scrolling behavior.
|
Enables or disables natural scrolling behavior.
|
||||||
@@ -477,13 +468,13 @@ button mapping of
|
|||||||
.B "\*q3 2 1 ...\*q"
|
.B "\*q3 2 1 ...\*q"
|
||||||
On systems using the
|
On systems using the
|
||||||
.B libinput
|
.B libinput
|
||||||
XLibre input driver it is recommended to use the
|
Xorg input driver it is recommended to use the
|
||||||
.B LeftHanded
|
.B LeftHanded
|
||||||
option instead.
|
option instead.
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
.B libinput
|
.B libinput
|
||||||
XLibre input driver does not use the button mapping after setup.
|
Xorg input driver does not use the button mapping after setup.
|
||||||
Use
|
Use
|
||||||
.BR XSetPointerMapping (3)
|
.BR XSetPointerMapping (3)
|
||||||
to modify the button mapping at runtime.
|
to modify the button mapping at runtime.
|
||||||
@@ -606,7 +597,7 @@ appropriate \fBMatch*\fR statement in the
|
|||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Peter Hutterer
|
Peter Hutterer
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR XLibre (1),
|
.BR Xorg (1),
|
||||||
.BR xorg.conf (5),
|
.BR xorg.conf (5),
|
||||||
.BR Xserver (1),
|
.BR Xserver (1),
|
||||||
.BR X (7)
|
.BR X (7)
|
||||||
|
|||||||
21
meson.build
21
meson.build
@@ -1,10 +1,11 @@
|
|||||||
project('xf86-input-libinput', 'c',
|
project('xf86-input-libinput', 'c',
|
||||||
version: '25.0.0',
|
version: '1.5.0', # bump version in configure.ac
|
||||||
default_options: ['warning_level=2'],
|
default_options: ['warning_level=2'],
|
||||||
meson_version: '>= 0.50.0')
|
meson_version: '>= 0.50.0')
|
||||||
|
|
||||||
driver_version = meson.project_version().split('.')
|
driver_version = meson.project_version().split('.')
|
||||||
|
|
||||||
|
dir_pkgconf = get_option('prefix') / get_option('libdir') / 'pkgconfig'
|
||||||
dir_man4 = get_option('prefix') / get_option('mandir') / 'man4'
|
dir_man4 = get_option('prefix') / get_option('mandir') / 'man4'
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
@@ -64,13 +65,9 @@ if cc.has_function('libinput_device_config_click_set_clickfinger_button_map',
|
|||||||
dependencies: dep_libinput)
|
dependencies: dep_libinput)
|
||||||
config_h.set('HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP', 1)
|
config_h.set('HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP', 1)
|
||||||
endif
|
endif
|
||||||
if cc.has_header_symbol('libinput.h', 'LIBINPUT_LED_COMPOSE',
|
if cc.has_header_symbol('libinput.h', 'LIBINPUT_LED_COMPOSE')
|
||||||
dependencies: dep_libinput)
|
|
||||||
config_h.set('HAVE_LIBINPUT_COMPOSE_AND_KANA', 1)
|
config_h.set('HAVE_LIBINPUT_COMPOSE_AND_KANA', 1)
|
||||||
endif
|
endif
|
||||||
if cc.has_function('libinput_plugin_system_load_plugins', dependencies: dep_libinput)
|
|
||||||
config_h.set('HAVE_LIBINPUT_PLUGINS', 1)
|
|
||||||
endif
|
|
||||||
|
|
||||||
dir_headers = get_option('sdkdir')
|
dir_headers = get_option('sdkdir')
|
||||||
if dir_headers == ''
|
if dir_headers == ''
|
||||||
@@ -127,6 +124,18 @@ test_draglock = executable('test-draglock',
|
|||||||
install: false)
|
install: false)
|
||||||
test('test-draglock', test_draglock)
|
test('test-draglock', test_draglock)
|
||||||
|
|
||||||
|
|
||||||
|
conf_pkgconf = configuration_data()
|
||||||
|
conf_pkgconf.set('PACKAGE_VERSION', meson.project_version())
|
||||||
|
conf_pkgconf.set('sdkdir', dir_headers)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input: 'xorg-libinput.pc.in',
|
||||||
|
output: 'xorg-libinput.pc',
|
||||||
|
configuration: conf_pkgconf,
|
||||||
|
install_dir: dir_pkgconf,
|
||||||
|
)
|
||||||
|
|
||||||
config_man = configuration_data()
|
config_man = configuration_data()
|
||||||
config_man.set('VERSION', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
|
config_man.set('VERSION', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@
|
|||||||
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
||||||
AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBINPUT_CFLAGS)
|
AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBINPUT_CFLAGS)
|
||||||
|
|
||||||
libinput_drv_la_LTLIBRARIES = libinput_drv.la
|
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
||||||
libinput_drv_la_LDFLAGS = -module -avoid-version
|
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
||||||
libinput_drv_la_LIBADD = $(LIBINPUT_LIBS) libdraglock.la libbezier.la -lm
|
@DRIVER_NAME@_drv_la_LIBADD = $(LIBINPUT_LIBS) libdraglock.la libbezier.la -lm
|
||||||
libinput_drv_ladir = @inputdir@
|
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||||
|
|
||||||
libinput_drv_la_SOURCES = \
|
@DRIVER_NAME@_drv_la_SOURCES = \
|
||||||
xf86libinput.c \
|
xf86libinput.c \
|
||||||
util-macros.h \
|
util-macros.h \
|
||||||
util-strings.h \
|
util-strings.h \
|
||||||
|
|||||||
@@ -22,7 +22,10 @@
|
|||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|||||||
@@ -22,7 +22,10 @@
|
|||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef BEZIER_H
|
#ifndef BEZIER_H
|
||||||
#define BEZIER_H
|
#define BEZIER_H
|
||||||
|
|||||||
@@ -22,7 +22,10 @@
|
|||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "draglock.h"
|
#include "draglock.h"
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,10 @@
|
|||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DRAGLOCK_H
|
#ifndef DRAGLOCK_H
|
||||||
#define DRAGLOCK_H 1
|
#define DRAGLOCK_H 1
|
||||||
|
|||||||
@@ -59,36 +59,6 @@ next_word(const char **state, size_t *len, const char *separators)
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a null-terminated string array with the contents of argv
|
|
||||||
* duplicated.
|
|
||||||
*
|
|
||||||
* Use strv_free() to free the array.
|
|
||||||
*
|
|
||||||
* @return A null-terminated string array or NULL on errors
|
|
||||||
*/
|
|
||||||
char**
|
|
||||||
strv_from_argv(int argc, char **argv)
|
|
||||||
{
|
|
||||||
char **strv = NULL;
|
|
||||||
|
|
||||||
assert(argc >= 0);
|
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
strv = zalloc((argc + 1) * sizeof *strv);
|
|
||||||
for (int i = 0; i < argc; i++) {
|
|
||||||
char *copy = safe_strdup(argv[i]);
|
|
||||||
if (!copy) {
|
|
||||||
strv_free(strv);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
strv[i] = copy;
|
|
||||||
}
|
|
||||||
return strv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a null-terminated string array with the tokens in the input
|
* Return a null-terminated string array with the tokens in the input
|
||||||
* string, e.g. "one two\tthree" with a separator list of " \t" will return
|
* string, e.g. "one two\tthree" with a separator list of " \t" will return
|
||||||
@@ -144,103 +114,3 @@ strv_from_string(const char *in, const char *separators, size_t *num_elements)
|
|||||||
|
|
||||||
return strv;
|
return strv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a newly allocated string with all elements joined by the
|
|
||||||
* joiner, same as Python's string.join() basically.
|
|
||||||
* A strv of ["one", "two", "three", NULL] with a joiner of ", " results
|
|
||||||
* in "one, two, three".
|
|
||||||
*
|
|
||||||
* An empty strv ([NULL]) returns NULL, same for passing NULL as either
|
|
||||||
* argument.
|
|
||||||
*
|
|
||||||
* @param strv Input string array
|
|
||||||
* @param joiner Joiner between the elements in the final string
|
|
||||||
*
|
|
||||||
* @return A null-terminated string joining all elements
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
strv_join(char **strv, const char *joiner)
|
|
||||||
{
|
|
||||||
char **s;
|
|
||||||
char *str;
|
|
||||||
size_t slen = 0;
|
|
||||||
size_t count = 0;
|
|
||||||
|
|
||||||
if (!strv || !joiner)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (strv[0] == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (s = strv, count = 0; *s; s++, count++) {
|
|
||||||
slen += strlen(*s);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(slen < 1000);
|
|
||||||
assert(strlen(joiner) < 1000);
|
|
||||||
assert(count > 0);
|
|
||||||
assert(count < 100);
|
|
||||||
|
|
||||||
slen += (count - 1) * strlen(joiner);
|
|
||||||
|
|
||||||
str = zalloc(slen + 1); /* trailing \0 */
|
|
||||||
for (s = strv; *s; s++) {
|
|
||||||
strcat(str, *s);
|
|
||||||
--count;
|
|
||||||
if (count > 0)
|
|
||||||
strcat(str, joiner);
|
|
||||||
}
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a pointer to the basename within filename.
|
|
||||||
* If the filename the empty string or a directory (i.e. the last char of
|
|
||||||
* filename is '/') NULL is returned.
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
safe_basename(const char *filename)
|
|
||||||
{
|
|
||||||
const char *basename;
|
|
||||||
|
|
||||||
if (*filename == '\0')
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
basename = strrchr(filename, '/');
|
|
||||||
if (basename == NULL)
|
|
||||||
return filename;
|
|
||||||
|
|
||||||
if (*(basename + 1) == '\0')
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return basename + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Similar to basename() but returns the trunk only without the (last)
|
|
||||||
* trailing suffix, so that:
|
|
||||||
*
|
|
||||||
* - foo.c returns foo
|
|
||||||
* - foo.a.b returns foo.a
|
|
||||||
* - foo returns foo
|
|
||||||
* - foo/ returns ""
|
|
||||||
*
|
|
||||||
* @return an allocated string representing the trunk name of the file
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
trunkname(const char *filename)
|
|
||||||
{
|
|
||||||
const char *base = safe_basename(filename);
|
|
||||||
char *suffix;
|
|
||||||
|
|
||||||
if (base == NULL)
|
|
||||||
return safe_strdup("");
|
|
||||||
|
|
||||||
suffix = rindex(base, '.');
|
|
||||||
if (suffix == NULL)
|
|
||||||
return safe_strdup(base);
|
|
||||||
else
|
|
||||||
return strndup(base, suffix-base);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -43,120 +43,6 @@
|
|||||||
|
|
||||||
#include "util-macros.h"
|
#include "util-macros.h"
|
||||||
|
|
||||||
static inline bool
|
|
||||||
streq(const char *str1, const char *str2)
|
|
||||||
{
|
|
||||||
/* one NULL, one not NULL is always false */
|
|
||||||
if (str1 && str2)
|
|
||||||
return strcmp(str1, str2) == 0;
|
|
||||||
return str1 == str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
strneq(const char *str1, const char *str2, int n)
|
|
||||||
{
|
|
||||||
/* one NULL, one not NULL is always false */
|
|
||||||
if (str1 && str2)
|
|
||||||
return strncmp(str1, str2, n) == 0;
|
|
||||||
return str1 == str2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *
|
|
||||||
zalloc(size_t size)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
/* We never need to alloc anything more than 1,5 MB so we can assume
|
|
||||||
* if we ever get above that something's going wrong */
|
|
||||||
if (size > 1536 * 1024)
|
|
||||||
assert(!"bug: internal malloc size limit exceeded");
|
|
||||||
|
|
||||||
p = calloc(1, size);
|
|
||||||
if (!p)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* strdup guaranteed to succeed. If the input string is NULL, the output
|
|
||||||
* string is NULL. If the input string is a string pointer, we strdup or
|
|
||||||
* abort on failure.
|
|
||||||
*/
|
|
||||||
static inline char*
|
|
||||||
safe_strdup(const char *str)
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (!str)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
s = strdup(str);
|
|
||||||
if (!s)
|
|
||||||
abort();
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
safe_atoi_base(const char *str, int *val, int base)
|
|
||||||
{
|
|
||||||
char *endptr;
|
|
||||||
long v;
|
|
||||||
|
|
||||||
assert(base == 10 || base == 16 || base == 8);
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
v = strtol(str, &endptr, base);
|
|
||||||
if (errno > 0)
|
|
||||||
return false;
|
|
||||||
if (str == endptr)
|
|
||||||
return false;
|
|
||||||
if (*str != '\0' && *endptr != '\0')
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (v > INT_MAX || v < INT_MIN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*val = v;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
safe_atoi(const char *str, int *val)
|
|
||||||
{
|
|
||||||
return safe_atoi_base(str, val, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
safe_atou_base(const char *str, unsigned int *val, int base)
|
|
||||||
{
|
|
||||||
char *endptr;
|
|
||||||
unsigned long v;
|
|
||||||
|
|
||||||
assert(base == 10 || base == 16 || base == 8);
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
v = strtoul(str, &endptr, base);
|
|
||||||
if (errno > 0)
|
|
||||||
return false;
|
|
||||||
if (str == endptr)
|
|
||||||
return false;
|
|
||||||
if (*str != '\0' && *endptr != '\0')
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ((long)v < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*val = v;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
safe_atou(const char *str, unsigned int *val)
|
|
||||||
{
|
|
||||||
return safe_atou_base(str, val, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
safe_atod(const char *str, double *val)
|
safe_atod(const char *str, double *val)
|
||||||
{
|
{
|
||||||
@@ -211,9 +97,7 @@ safe_atod(const char *str, double *val)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **strv_from_argv(int argc, char **argv);
|
|
||||||
char **strv_from_string(const char *in, const char *separator, size_t *num_elements);
|
char **strv_from_string(const char *in, const char *separator, size_t *num_elements);
|
||||||
char *strv_join(char **strv, const char *joiner);
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
strv_free(char **strv) {
|
strv_free(char **strv) {
|
||||||
@@ -274,122 +158,3 @@ out:
|
|||||||
free(numv);
|
free(numv);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct key_value_str{
|
|
||||||
char *key;
|
|
||||||
char *value;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct key_value_double {
|
|
||||||
double key;
|
|
||||||
double value;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline ssize_t
|
|
||||||
kv_double_from_string(const char *string,
|
|
||||||
const char *pair_separator,
|
|
||||||
const char *kv_separator,
|
|
||||||
struct key_value_double **result_out)
|
|
||||||
|
|
||||||
{
|
|
||||||
struct key_value_double *result = NULL;
|
|
||||||
|
|
||||||
if (!pair_separator || pair_separator[0] == '\0' ||
|
|
||||||
!kv_separator || kv_separator[0] == '\0')
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
size_t npairs;
|
|
||||||
char **pairs = strv_from_string(string, pair_separator, &npairs);
|
|
||||||
if (!pairs || npairs == 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
result = zalloc(npairs * sizeof *result);
|
|
||||||
|
|
||||||
for (size_t idx = 0; idx < npairs; idx++) {
|
|
||||||
char *pair = pairs[idx];
|
|
||||||
size_t nelem;
|
|
||||||
char **kv = strv_from_string(pair, kv_separator, &nelem);
|
|
||||||
double k, v;
|
|
||||||
|
|
||||||
if (!kv || nelem != 2 ||
|
|
||||||
!safe_atod(kv[0], &k) ||
|
|
||||||
!safe_atod(kv[1], &v)) {
|
|
||||||
strv_free(kv);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
result[idx].key = k;
|
|
||||||
result[idx].value = v;
|
|
||||||
|
|
||||||
strv_free(kv);
|
|
||||||
}
|
|
||||||
|
|
||||||
strv_free(pairs);
|
|
||||||
|
|
||||||
*result_out = result;
|
|
||||||
|
|
||||||
return npairs;
|
|
||||||
|
|
||||||
error:
|
|
||||||
strv_free(pairs);
|
|
||||||
free(result);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Strip any of the characters in what from the beginning and end of the
|
|
||||||
* input string.
|
|
||||||
*
|
|
||||||
* @return a newly allocated string with none of "what" at the beginning or
|
|
||||||
* end of string
|
|
||||||
*/
|
|
||||||
static inline char *
|
|
||||||
strstrip(const char *input, const char *what)
|
|
||||||
{
|
|
||||||
char *str, *last;
|
|
||||||
|
|
||||||
str = safe_strdup(&input[strspn(input, what)]);
|
|
||||||
|
|
||||||
last = str;
|
|
||||||
|
|
||||||
for (char *c = str; *c != '\0'; c++) {
|
|
||||||
if (!strchr(what, *c))
|
|
||||||
last = c + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*last = '\0';
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if str ends in suffix, false otherwise. If the suffix is the
|
|
||||||
* empty string, strendswith() always returns false.
|
|
||||||
*/
|
|
||||||
static inline bool
|
|
||||||
strendswith(const char *str, const char *suffix)
|
|
||||||
{
|
|
||||||
size_t slen = strlen(str);
|
|
||||||
size_t suffixlen = strlen(suffix);
|
|
||||||
size_t offset;
|
|
||||||
|
|
||||||
if (slen == 0 || suffixlen == 0 || suffixlen > slen)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
offset = slen - suffixlen;
|
|
||||||
return strneq(&str[offset], suffix, suffixlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool
|
|
||||||
strstartswith(const char *str, const char *prefix)
|
|
||||||
{
|
|
||||||
size_t prefixlen = strlen(prefix);
|
|
||||||
|
|
||||||
return prefixlen > 0 ? strneq(str, prefix, strlen(prefix)) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
safe_basename(const char *filename);
|
|
||||||
|
|
||||||
char *
|
|
||||||
trunkname(const char *filename);
|
|
||||||
|
|||||||
@@ -2742,19 +2742,11 @@ xf86libinput_handle_event(struct libinput_event *event)
|
|||||||
case LIBINPUT_EVENT_SWITCH_TOGGLE:
|
case LIBINPUT_EVENT_SWITCH_TOGGLE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* new libinput events we don't handle yet */
|
// new libinput events we don't handle yet
|
||||||
#ifdef LIBINPUT_EVENT_GESTURE_HOLD_BEGIN
|
|
||||||
case LIBINPUT_EVENT_GESTURE_HOLD_BEGIN:
|
case LIBINPUT_EVENT_GESTURE_HOLD_BEGIN:
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef LIBINPUT_EVENT_GESTURE_HOLD_END
|
|
||||||
case LIBINPUT_EVENT_GESTURE_HOLD_END:
|
case LIBINPUT_EVENT_GESTURE_HOLD_END:
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifdef LIBINPUT_EVENT_TABLET_PAD_KEY
|
|
||||||
case LIBINPUT_EVENT_TABLET_PAD_KEY:
|
case LIBINPUT_EVENT_TABLET_PAD_KEY:
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -3506,17 +3498,13 @@ static inline BOOL
|
|||||||
xf86libinput_parse_middleemulation_option(InputInfoPtr pInfo,
|
xf86libinput_parse_middleemulation_option(InputInfoPtr pInfo,
|
||||||
struct libinput_device *device)
|
struct libinput_device *device)
|
||||||
{
|
{
|
||||||
int enabled;
|
BOOL enabled;
|
||||||
|
|
||||||
if (!libinput_device_config_middle_emulation_is_available(device))
|
if (!libinput_device_config_middle_emulation_is_available(device))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
enabled = xf86SetBoolOption(pInfo->options,
|
enabled = xf86SetBoolOption(pInfo->options,
|
||||||
"MiddleEmulation",
|
"MiddleEmulation",
|
||||||
-1); /* returns -1 if the option has not been set */
|
|
||||||
if (enabled == -1)
|
|
||||||
enabled = xf86SetBoolOption(pInfo->options,
|
|
||||||
"Emulate3Buttons",
|
|
||||||
libinput_device_config_middle_emulation_get_default_enabled(device));
|
libinput_device_config_middle_emulation_get_default_enabled(device));
|
||||||
if (libinput_device_config_middle_emulation_set_enabled(device, enabled) !=
|
if (libinput_device_config_middle_emulation_set_enabled(device, enabled) !=
|
||||||
LIBINPUT_CONFIG_STATUS_SUCCESS) {
|
LIBINPUT_CONFIG_STATUS_SUCCESS) {
|
||||||
@@ -3894,10 +3882,6 @@ xf86libinput_init_driver_context(void)
|
|||||||
/* we want all msgs, let the server filter */
|
/* we want all msgs, let the server filter */
|
||||||
libinput_log_set_priority(driver_context.libinput,
|
libinput_log_set_priority(driver_context.libinput,
|
||||||
LIBINPUT_LOG_PRIORITY_DEBUG);
|
LIBINPUT_LOG_PRIORITY_DEBUG);
|
||||||
#if HAVE_LIBINPUT_PLUGINS
|
|
||||||
libinput_plugin_system_append_default_paths(driver_context.libinput);
|
|
||||||
libinput_plugin_system_load_plugins(driver_context.libinput, LIBINPUT_PLUGIN_SYSTEM_FLAG_NONE);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
libinput_ref(driver_context.libinput);
|
libinput_ref(driver_context.libinput);
|
||||||
}
|
}
|
||||||
@@ -5666,8 +5650,7 @@ LibinputInitTapProperty(DeviceIntPtr dev,
|
|||||||
struct xf86libinput *driver_data,
|
struct xf86libinput *driver_data,
|
||||||
struct libinput_device *device)
|
struct libinput_device *device)
|
||||||
{
|
{
|
||||||
// By default tapping property config is true
|
BOOL tap = driver_data->options.tapping;
|
||||||
BOOL tap = driver_data->options.tapping ? driver_data->options.tapping : TRUE;
|
|
||||||
|
|
||||||
if (!subdevice_has_capabilities(dev, CAP_POINTER))
|
if (!subdevice_has_capabilities(dev, CAP_POINTER))
|
||||||
return;
|
return;
|
||||||
|
|||||||
6
xorg-libinput.pc.in
Normal file
6
xorg-libinput.pc.in
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
sdkdir=@sdkdir@
|
||||||
|
|
||||||
|
Name: xorg-libinput
|
||||||
|
Description: X.Org libinput input driver.
|
||||||
|
Version: @PACKAGE_VERSION@
|
||||||
|
Cflags: -I${sdkdir}
|
||||||
Reference in New Issue
Block a user