mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-02-04 16:45:25 +00:00
feat(input/linux): add support for more virtual input devices (#2606)
Co-authored-by: ABeltramo <beltramo.ale@gmail.com> Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
@ -222,6 +222,26 @@ if(${SUNSHINE_ENABLE_TRAY} AND ${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRA
|
||||
message(FATAL_ERROR "Tray icon is required")
|
||||
endif()
|
||||
|
||||
if(${SUNSHINE_USE_LEGACY_INPUT}) # TODO: Remove this legacy option after the next stable release
|
||||
list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/src/platform/linux/input/legacy_input.cpp")
|
||||
else()
|
||||
# These need to be set before adding the inputtino subdirectory in order for them to be picked up
|
||||
set(LIBEVDEV_CUSTOM_INCLUDE_DIR "${EVDEV_INCLUDE_DIR}")
|
||||
set(LIBEVDEV_CUSTOM_LIBRARY "${EVDEV_LIBRARY}")
|
||||
|
||||
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/inputtino")
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES inputtino::libinputtino)
|
||||
file(GLOB_RECURSE INPUTTINO_SOURCES
|
||||
${CMAKE_SOURCE_DIR}/src/platform/linux/input/inputtino*.h
|
||||
${CMAKE_SOURCE_DIR}/src/platform/linux/input/inputtino*.cpp)
|
||||
list(APPEND PLATFORM_TARGET_FILES ${INPUTTINO_SOURCES})
|
||||
|
||||
# build libevdev before the libinputtino target
|
||||
if(EXTERNAL_PROJECT_LIBEVDEV_USED)
|
||||
add_dependencies(libinputtino libevdev)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND PLATFORM_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/src/platform/linux/publish.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/platform/linux/graphics.h"
|
||||
@ -229,7 +249,6 @@ list(APPEND PLATFORM_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/src/platform/linux/misc.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/platform/linux/misc.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/platform/linux/audio.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/platform/linux/input.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/glad/src/egl.c"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/glad/src/gl.c"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/glad/include/EGL/eglplatform.h"
|
||||
|
||||
@ -37,6 +37,9 @@ else()
|
||||
endif()
|
||||
|
||||
if(EVDEV_INCLUDE_DIR AND EVDEV_LIBRARY)
|
||||
message(STATUS "Found libevdev library: ${EVDEV_LIBRARY}")
|
||||
message(STATUS "Found libevdev include directory: ${EVDEV_INCLUDE_DIR}")
|
||||
|
||||
include_directories(SYSTEM ${EVDEV_INCLUDE_DIR})
|
||||
list(APPEND PLATFORM_LIBRARIES ${EVDEV_LIBRARY})
|
||||
else()
|
||||
|
||||
@ -19,7 +19,7 @@ macro(find_package) # cmake-lint: disable=C0103
|
||||
string(TOLOWER "${ARGV0}" ARGV0_LOWER)
|
||||
if(
|
||||
(("${ARGV0_LOWER}" STREQUAL "boost") AND DEFINED FETCH_CONTENT_BOOST_USED) OR
|
||||
(("${ARGV0_LOWER}" STREQUAL "libevdev") AND DEFINED FETCH_CONTENT_LIBEVDEV_USED)
|
||||
(("${ARGV0_LOWER}" STREQUAL "libevdev") AND DEFINED EXTERNAL_PROJECT_LIBEVDEV_USED)
|
||||
)
|
||||
# Do nothing, as the package has already been fetched
|
||||
else()
|
||||
@ -27,17 +27,3 @@ macro(find_package) # cmake-lint: disable=C0103
|
||||
_find_package(${ARGV})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# override pkg_check_modules function
|
||||
macro(pkg_check_modules) # cmake-lint: disable=C0103
|
||||
string(TOLOWER "${ARGV0}" ARGV0_LOWER)
|
||||
if(
|
||||
(("${ARGV0_LOWER}" STREQUAL "boost") AND DEFINED FETCH_CONTENT_BOOST_USED) OR
|
||||
(("${ARGV0_LOWER}" STREQUAL "libevdev") AND DEFINED FETCH_CONTENT_LIBEVDEV_USED)
|
||||
)
|
||||
# Do nothing, as the package has already been fetched
|
||||
else()
|
||||
# Call the original pkg_check_modules function
|
||||
_pkg_check_modules(${ARGV})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@ -54,4 +54,6 @@ elseif(UNIX) # Linux
|
||||
"Enable building wayland specific code." ON)
|
||||
option(SUNSHINE_ENABLE_X11
|
||||
"Enable X11 grab if available." ON)
|
||||
option(SUNSHINE_USE_LEGACY_INPUT # TODO: Remove this legacy option after the next stable release
|
||||
"Use the legacy virtual input implementation." OFF)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user