Skip to content

Commit

Permalink
Merge pull request input-leap#1643 from whot/wip/libei-0.5
Browse files Browse the repository at this point in the history
Fix a few issues with the libei code and require 0.5
  • Loading branch information
shymega authored May 14, 2023
2 parents 23615f6 + e58182f commit 53180da
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 2 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -146,7 +146,7 @@ if (UNIX)
endif()

if (INPUTLEAP_BUILD_LIBEI)
pkg_check_modules(LIBEI REQUIRED libei libeis)
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)
Expand All @@ -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 <libei/libei.h>
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
Expand Down
3 changes: 3 additions & 0 deletions res/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}
30 changes: 8 additions & 22 deletions src/lib/platform/EiScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,29 +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_) {
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 {
Expand Down Expand Up @@ -591,9 +581,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
}
Expand Down Expand Up @@ -621,10 +611,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;
Expand Down

0 comments on commit 53180da

Please sign in to comment.