From 59b99faa7117e9c82b2dc8249a3c5bd592816190 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2023 14:36:34 +1000 Subject: [PATCH 1/6] cmake: fix the check for the EI sequence number The ei headers were never in a libei subdir. And the result got cached in cmake but not passed to the C code. --- CMakeLists.txt | 2 +- res/config.h.in | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7796e986..1f25bf57d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ if (UNIX) cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${LIBEI_INCLUDE_DIRS}") set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${LIBEI_LINK_LIBRARIES}") - check_cxx_source_compiles("#include + check_cxx_source_compiles("#include int main() { ei_device_start_emulating(nullptr, 0); } " HAVE_LIBEI_SEQUENCE_NUMBER) cmake_pop_check_state() diff --git a/res/config.h.in b/res/config.h.in index ecab77d92..f1ad90a88 100644 --- a/res/config.h.in +++ b/res/config.h.in @@ -33,3 +33,6 @@ /* Define if libportal has inputcapture support */ #cmakedefine HAVE_LIBPORTAL_INPUTCAPTURE ${HAVE_LIBPORTAL_INPUTCAPTURE} + +/* Define if libei ei_device_start_emulating takes a sequence number */ +#cmakedefine HAVE_LIBEI_SEQUENCE_NUMBER ${HAVE_LIBEI_SEQUENCE_NUMBER} From c9c7101b34cdc3b5299ea452007f77cd2ecd8c63 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2023 14:27:49 +1000 Subject: [PATCH 2/6] ei: drop the EI property handling code Properties have been dropped from libei so let's drop our code too. --- src/lib/platform/EiScreen.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index ad73a4276..ef294f06c 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -621,10 +621,6 @@ void EiScreen::handle_system_event(const Event& sysevent) case EI_EVENT_DEVICE_RESUMED: LOG((CLOG_DEBUG "device %s is resumed", ei_device_get_name(device))); break; - case EI_EVENT_PROPERTY: - LOG((CLOG_DEBUG "property %s: %s", ei_event_property_get_name(event), - ei_event_property_get_value(event))); - break; case EI_EVENT_KEYBOARD_MODIFIERS: // FIXME break; From 7b6e43e070980aab50b179f3bd75b889003fc323 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2023 14:30:53 +1000 Subject: [PATCH 3/6] ei: bind to all capabilities at once Otherwise an EIS implementation may create a device for whatever the first capability was, then delete that device again once the next capablity is added. This API has been removed from libei already anyway and will be gone in the next version. --- src/lib/platform/EiScreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index ef294f06c..50720d306 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -591,9 +591,9 @@ void EiScreen::handle_system_event(const Event& sysevent) case EI_EVENT_SEAT_ADDED: if (!ei_seat_) { ei_seat_ = ei_seat_ref(seat); - ei_seat_bind_capability(ei_seat_, EI_DEVICE_CAP_POINTER); - ei_seat_bind_capability(ei_seat_, EI_DEVICE_CAP_POINTER_ABSOLUTE); - ei_seat_bind_capability(ei_seat_, EI_DEVICE_CAP_KEYBOARD); + ei_seat_bind_capabilities(ei_seat_, EI_DEVICE_CAP_POINTER, + EI_DEVICE_CAP_POINTER_ABSOLUTE, + EI_DEVICE_CAP_KEYBOARD, NULL); LOG((CLOG_DEBUG "using seat %s", ei_seat_get_name(ei_seat_))); // we don't care about touch } From e07ff918fbed496f702abb3a28b6f96a30a2c52f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2023 14:47:23 +1000 Subject: [PATCH 4/6] ei: increment the sequence number with every start_emulating call It's meaningless but an actually incrementing number is still better than zero. --- src/lib/platform/EiScreen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index 50720d306..29a619124 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -243,17 +243,19 @@ void EiScreen::disable() void EiScreen::enter() { + static int sequence_number; is_on_screen_ = true; if (!is_primary_) { #if HAVE_LIBEI_SEQUENCE_NUMBER + ++sequence_number; if (ei_pointer_) { - ei_device_start_emulating(ei_pointer_, 0); + ei_device_start_emulating(ei_pointer_, sequence_number); } if (ei_keyboard_) { - ei_device_start_emulating(ei_keyboard_, 0); + ei_device_start_emulating(ei_keyboard_, sequence_number); } if (ei_abs_) { - ei_device_start_emulating(ei_abs_, 0); + ei_device_start_emulating(ei_abs_, sequence_number); } #else if (ei_pointer_) { From bcc8cd78043c7087c578247f2ea6ffa6b881c94f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2023 15:42:53 +1000 Subject: [PATCH 5/6] cmake: drop libeis - we don't use that library libeis is the library for the compositor - we don't actually need that library. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f25bf57d..0fd4ba6f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ option(INPUTLEAP_BUILD_INSTALLER "Build the installer" ON) option(INPUTLEAP_BUILD_TESTS "Build the tests" ON) option(INPUTLEAP_USE_EXTERNAL_GTEST "Use external installation of Google Test framework" OFF) option(INPUTLEAP_BUILD_X11 "Build with XWindows support" ON) -option(INPUTLEAP_BUILD_LIBEI "Build with libei/libeis support" OFF) +option(INPUTLEAP_BUILD_LIBEI "Build with libei support" OFF) set (CMAKE_EXPORT_COMPILE_COMMANDS ON) set (CMAKE_CXX_STANDARD 14) @@ -146,7 +146,7 @@ if (UNIX) endif() if (INPUTLEAP_BUILD_LIBEI) - pkg_check_modules(LIBEI REQUIRED libei libeis) + pkg_check_modules(LIBEI REQUIRED libei) pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon) pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0) pkg_check_modules(LIBPORTAL REQUIRED libportal) From e58182f8454b713c874c6c8ee677b55f404d2141 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 May 2023 15:13:50 +1000 Subject: [PATCH 6/6] ei: require version 0.5 This lets us drop the sequence number check. Version 0.5 has a new protocol that is no longer based on protobuf so we can drop those requirements and replace them with the others. But let's disable the libei tests, they drag in extra dependencies. --- .github/workflows/builds.yml | 8 ++++---- CMakeLists.txt | 11 +---------- src/lib/platform/EiScreen.cpp | 12 ------------ 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index e6cc4f6dd..11fc54c33 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -81,14 +81,14 @@ jobs: run: git config --global --add safe.directory $GITHUB_WORKSPACE - if: matrix.os == 'ubuntu:22.04' - name: build libei from git tag (0.4.1) + name: build libei from git tag (0.5) run: | apt-get install -y python3-pip pip3 install meson - apt-get install -y libsystemd-dev protobuf-compiler protobuf-c-compiler libprotobuf-c-dev meson git ca-certificates python3-pytest python3-attr python3-dbusmock - git clone --depth 1 --branch 0.4.1 https://gitlab.freedesktop.org/libinput/libei + apt-get install -y libsystemd-dev meson git ca-certificates python3-pytest python3-attr python3-dbusmock python3-structlog python3-jinja2 + git clone --depth 1 --branch 0.5 https://gitlab.freedesktop.org/libinput/libei cd libei - meson -Dprefix=/usr _libei_builddir + meson -Dprefix=/usr -Dtests=false _libei_builddir ninja -C _libei_builddir install cd .. rm -rf libei diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fd4ba6f6..c8dafe716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,7 +146,7 @@ if (UNIX) endif() if (INPUTLEAP_BUILD_LIBEI) - pkg_check_modules(LIBEI REQUIRED libei) + pkg_check_modules(LIBEI REQUIRED "libei>=0.5") pkg_check_modules(LIBXKBCOMMON REQUIRED xkbcommon) pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0) pkg_check_modules(LIBPORTAL REQUIRED libportal) @@ -168,15 +168,6 @@ if (UNIX) " HAVE_LIBPORTAL_OUTPUT_NONE) cmake_pop_check_state() - cmake_push_check_state(RESET) - set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${LIBEI_INCLUDE_DIRS}") - set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};${LIBEI_LINK_LIBRARIES}") - check_cxx_source_compiles("#include - int main() { ei_device_start_emulating(nullptr, 0); } - " HAVE_LIBEI_SEQUENCE_NUMBER) - cmake_pop_check_state() - - # Flatpak bits install(FILES "dist/flatpak/input-leap-flatpak" DESTINATION bin diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index 29a619124..ec3884c0b 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -246,7 +246,6 @@ void EiScreen::enter() static int sequence_number; is_on_screen_ = true; if (!is_primary_) { -#if HAVE_LIBEI_SEQUENCE_NUMBER ++sequence_number; if (ei_pointer_) { ei_device_start_emulating(ei_pointer_, sequence_number); @@ -257,17 +256,6 @@ void EiScreen::enter() if (ei_abs_) { ei_device_start_emulating(ei_abs_, sequence_number); } -#else - if (ei_pointer_) { - ei_device_start_emulating(ei_pointer_); - } - if (ei_keyboard_) { - ei_device_start_emulating(ei_keyboard_); - } - if (ei_abs_) { - ei_device_start_emulating(ei_abs_); - } -#endif } #if HAVE_LIBPORTAL_INPUTCAPTURE else {