From 94de28bfbe922f98db73c4593105db86cda1fe48 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 27 Oct 2021 12:13:09 +0300 Subject: [PATCH] Move input backends in their own directory --- autotests/libinput/CMakeLists.txt | 2 +- autotests/libinput/device_test.cpp | 2 +- autotests/libinput/gesture_event_test.cpp | 4 ++-- autotests/libinput/input_event_test.cpp | 2 +- autotests/libinput/key_event_test.cpp | 4 ++-- autotests/libinput/pointer_event_test.cpp | 4 ++-- autotests/libinput/switch_event_test.cpp | 4 ++-- autotests/libinput/touch_event_test.cpp | 4 ++-- src/CMakeLists.txt | 11 ++--------- src/backends/CMakeLists.txt | 2 ++ src/backends/fakeinput/CMakeLists.txt | 4 ++++ src/{ => backends}/fakeinput/fakeinputbackend.cpp | 0 src/{ => backends}/fakeinput/fakeinputbackend.h | 0 src/{ => backends}/fakeinput/fakeinputdevice.cpp | 0 src/{ => backends}/fakeinput/fakeinputdevice.h | 0 src/backends/libinput/CMakeLists.txt | 9 +++++++++ src/{ => backends}/libinput/connection.cpp | 0 src/{ => backends}/libinput/connection.h | 0 src/{ => backends}/libinput/context.cpp | 0 src/{ => backends}/libinput/context.h | 0 src/{ => backends}/libinput/device.cpp | 0 src/{ => backends}/libinput/device.h | 0 src/{ => backends}/libinput/events.cpp | 0 src/{ => backends}/libinput/events.h | 0 src/{ => backends}/libinput/libinput_logging.cpp | 0 src/{ => backends}/libinput/libinput_logging.h | 0 src/{ => backends}/libinput/libinputbackend.cpp | 0 src/{ => backends}/libinput/libinputbackend.h | 0 src/input.cpp | 6 +++--- src/plugins/platforms/drm/drm_backend.cpp | 2 +- src/plugins/platforms/fbdev/fb_backend.cpp | 2 +- 31 files changed, 35 insertions(+), 27 deletions(-) create mode 100644 src/backends/CMakeLists.txt create mode 100644 src/backends/fakeinput/CMakeLists.txt rename src/{ => backends}/fakeinput/fakeinputbackend.cpp (100%) rename src/{ => backends}/fakeinput/fakeinputbackend.h (100%) rename src/{ => backends}/fakeinput/fakeinputdevice.cpp (100%) rename src/{ => backends}/fakeinput/fakeinputdevice.h (100%) create mode 100644 src/backends/libinput/CMakeLists.txt rename src/{ => backends}/libinput/connection.cpp (100%) rename src/{ => backends}/libinput/connection.h (100%) rename src/{ => backends}/libinput/context.cpp (100%) rename src/{ => backends}/libinput/context.h (100%) rename src/{ => backends}/libinput/device.cpp (100%) rename src/{ => backends}/libinput/device.h (100%) rename src/{ => backends}/libinput/events.cpp (100%) rename src/{ => backends}/libinput/events.h (100%) rename src/{ => backends}/libinput/libinput_logging.cpp (100%) rename src/{ => backends}/libinput/libinput_logging.h (100%) rename src/{ => backends}/libinput/libinputbackend.cpp (100%) rename src/{ => backends}/libinput/libinputbackend.h (100%) diff --git a/autotests/libinput/CMakeLists.txt b/autotests/libinput/CMakeLists.txt index 8a8b048c9e..65803c93fc 100644 --- a/autotests/libinput/CMakeLists.txt +++ b/autotests/libinput/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(${Libinput_INCLUDE_DIRS}) -add_library(LibInputTestObjects STATIC ../../src/libinput/device.cpp ../../src/libinput/events.cpp ../../src/inputdevice.cpp mock_libinput.cpp) +add_library(LibInputTestObjects STATIC ../../src/backends/libinput/device.cpp ../../src/backends/libinput/events.cpp ../../src/inputdevice.cpp mock_libinput.cpp) target_link_libraries(LibInputTestObjects Qt::Test Qt::Widgets Qt::DBus Qt::Gui KF5::ConfigCore) target_include_directories(LibInputTestObjects PUBLIC ${CMAKE_SOURCE_DIR}/src) diff --git a/autotests/libinput/device_test.cpp b/autotests/libinput/device_test.cpp index 99a3d0faf1..69be27ea70 100644 --- a/autotests/libinput/device_test.cpp +++ b/autotests/libinput/device_test.cpp @@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ #include "mock_libinput.h" -#include "libinput/device.h" +#include "backends/libinput/device.h" #include #include diff --git a/autotests/libinput/gesture_event_test.cpp b/autotests/libinput/gesture_event_test.cpp index fcd4ad76cb..c9e406c570 100644 --- a/autotests/libinput/gesture_event_test.cpp +++ b/autotests/libinput/gesture_event_test.cpp @@ -8,8 +8,8 @@ */ #include "mock_libinput.h" -#include "libinput/device.h" -#include "libinput/events.h" +#include "backends/libinput/device.h" +#include "backends/libinput/events.h" #include diff --git a/autotests/libinput/input_event_test.cpp b/autotests/libinput/input_event_test.cpp index d75d446392..e5f319a48c 100644 --- a/autotests/libinput/input_event_test.cpp +++ b/autotests/libinput/input_event_test.cpp @@ -8,7 +8,7 @@ */ #include "mock_libinput.h" -#include "libinput/device.h" +#include "backends/libinput/device.h" #include "input_event.h" #include diff --git a/autotests/libinput/key_event_test.cpp b/autotests/libinput/key_event_test.cpp index 1be840e30b..ad0dbd6020 100644 --- a/autotests/libinput/key_event_test.cpp +++ b/autotests/libinput/key_event_test.cpp @@ -8,8 +8,8 @@ */ #include "mock_libinput.h" -#include "libinput/device.h" -#include "libinput/events.h" +#include "backends/libinput/device.h" +#include "backends/libinput/events.h" #include diff --git a/autotests/libinput/pointer_event_test.cpp b/autotests/libinput/pointer_event_test.cpp index 9e363f9b43..40cab5049c 100644 --- a/autotests/libinput/pointer_event_test.cpp +++ b/autotests/libinput/pointer_event_test.cpp @@ -8,8 +8,8 @@ */ #include "mock_libinput.h" -#include "libinput/device.h" -#include "libinput/events.h" +#include "backends/libinput/device.h" +#include "backends/libinput/events.h" #include diff --git a/autotests/libinput/switch_event_test.cpp b/autotests/libinput/switch_event_test.cpp index 38a35d43f0..fd585a2b99 100644 --- a/autotests/libinput/switch_event_test.cpp +++ b/autotests/libinput/switch_event_test.cpp @@ -8,8 +8,8 @@ */ #include "mock_libinput.h" -#include "libinput/device.h" -#include "libinput/events.h" +#include "backends/libinput/device.h" +#include "backends/libinput/events.h" #include diff --git a/autotests/libinput/touch_event_test.cpp b/autotests/libinput/touch_event_test.cpp index 99494ed52a..f80c70e2f4 100644 --- a/autotests/libinput/touch_event_test.cpp +++ b/autotests/libinput/touch_event_test.cpp @@ -8,8 +8,8 @@ */ #include "mock_libinput.h" -#include "libinput/device.h" -#include "libinput/events.h" +#include "backends/libinput/device.h" +#include "backends/libinput/events.h" #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de4986a3e6..806ebf40f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,8 +46,6 @@ set(kwin_SRCS effects.cpp egl_context_attribute_builder.cpp events.cpp - fakeinput/fakeinputbackend.cpp - fakeinput/fakeinputdevice.cpp focuschain.cpp ftrace.cpp geometrytip.cpp @@ -73,12 +71,6 @@ set(kwin_SRCS layers.cpp layershellv1client.cpp layershellv1integration.cpp - libinput/connection.cpp - libinput/context.cpp - libinput/device.cpp - libinput/events.cpp - libinput/libinput_logging.cpp - libinput/libinputbackend.cpp linux_dmabuf.cpp main.cpp modifier_only_shortcuts.cpp @@ -229,7 +221,6 @@ target_link_libraries(kwin XCB::XCB XCB::XFIXES - Libinput::Libinput UDev::UDev XKB::XKB Qt5::XkbCommonSupportPrivate @@ -238,6 +229,8 @@ target_link_libraries(kwin Threads::Threads ) +add_subdirectory(backends) + if (KWIN_BUILD_CMS) target_sources(kwin PRIVATE colordevice.cpp diff --git a/src/backends/CMakeLists.txt b/src/backends/CMakeLists.txt new file mode 100644 index 0000000000..bb6421a5ef --- /dev/null +++ b/src/backends/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(fakeinput) +add_subdirectory(libinput) diff --git a/src/backends/fakeinput/CMakeLists.txt b/src/backends/fakeinput/CMakeLists.txt new file mode 100644 index 0000000000..dc558146e5 --- /dev/null +++ b/src/backends/fakeinput/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(kwin PRIVATE + fakeinputbackend.cpp + fakeinputdevice.cpp +) diff --git a/src/fakeinput/fakeinputbackend.cpp b/src/backends/fakeinput/fakeinputbackend.cpp similarity index 100% rename from src/fakeinput/fakeinputbackend.cpp rename to src/backends/fakeinput/fakeinputbackend.cpp diff --git a/src/fakeinput/fakeinputbackend.h b/src/backends/fakeinput/fakeinputbackend.h similarity index 100% rename from src/fakeinput/fakeinputbackend.h rename to src/backends/fakeinput/fakeinputbackend.h diff --git a/src/fakeinput/fakeinputdevice.cpp b/src/backends/fakeinput/fakeinputdevice.cpp similarity index 100% rename from src/fakeinput/fakeinputdevice.cpp rename to src/backends/fakeinput/fakeinputdevice.cpp diff --git a/src/fakeinput/fakeinputdevice.h b/src/backends/fakeinput/fakeinputdevice.h similarity index 100% rename from src/fakeinput/fakeinputdevice.h rename to src/backends/fakeinput/fakeinputdevice.h diff --git a/src/backends/libinput/CMakeLists.txt b/src/backends/libinput/CMakeLists.txt new file mode 100644 index 0000000000..0e758f0493 --- /dev/null +++ b/src/backends/libinput/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(kwin PRIVATE + connection.cpp + context.cpp + device.cpp + events.cpp + libinput_logging.cpp + libinputbackend.cpp +) +target_link_libraries(kwin Libinput::Libinput) diff --git a/src/libinput/connection.cpp b/src/backends/libinput/connection.cpp similarity index 100% rename from src/libinput/connection.cpp rename to src/backends/libinput/connection.cpp diff --git a/src/libinput/connection.h b/src/backends/libinput/connection.h similarity index 100% rename from src/libinput/connection.h rename to src/backends/libinput/connection.h diff --git a/src/libinput/context.cpp b/src/backends/libinput/context.cpp similarity index 100% rename from src/libinput/context.cpp rename to src/backends/libinput/context.cpp diff --git a/src/libinput/context.h b/src/backends/libinput/context.h similarity index 100% rename from src/libinput/context.h rename to src/backends/libinput/context.h diff --git a/src/libinput/device.cpp b/src/backends/libinput/device.cpp similarity index 100% rename from src/libinput/device.cpp rename to src/backends/libinput/device.cpp diff --git a/src/libinput/device.h b/src/backends/libinput/device.h similarity index 100% rename from src/libinput/device.h rename to src/backends/libinput/device.h diff --git a/src/libinput/events.cpp b/src/backends/libinput/events.cpp similarity index 100% rename from src/libinput/events.cpp rename to src/backends/libinput/events.cpp diff --git a/src/libinput/events.h b/src/backends/libinput/events.h similarity index 100% rename from src/libinput/events.h rename to src/backends/libinput/events.h diff --git a/src/libinput/libinput_logging.cpp b/src/backends/libinput/libinput_logging.cpp similarity index 100% rename from src/libinput/libinput_logging.cpp rename to src/backends/libinput/libinput_logging.cpp diff --git a/src/libinput/libinput_logging.h b/src/backends/libinput/libinput_logging.h similarity index 100% rename from src/libinput/libinput_logging.h rename to src/backends/libinput/libinput_logging.h diff --git a/src/libinput/libinputbackend.cpp b/src/backends/libinput/libinputbackend.cpp similarity index 100% rename from src/libinput/libinputbackend.cpp rename to src/backends/libinput/libinputbackend.cpp diff --git a/src/libinput/libinputbackend.h b/src/backends/libinput/libinputbackend.h similarity index 100% rename from src/libinput/libinputbackend.h rename to src/backends/libinput/libinputbackend.h diff --git a/src/input.cpp b/src/input.cpp index dff1534b8c..b1216d85aa 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -9,8 +9,10 @@ SPDX-License-Identifier: GPL-2.0-or-later */ #include "input.h" +#include "backends/fakeinput/fakeinputbackend.h" +#include "backends/libinput/connection.h" +#include "backends/libinput/device.h" #include "effects.h" -#include "fakeinput/fakeinputbackend.h" #include "gestures.h" #include "globalshortcuts.h" #include "input_event.h" @@ -28,8 +30,6 @@ #include "tabbox/tabbox.h" #endif #include "internal_client.h" -#include "libinput/connection.h" -#include "libinput/device.h" #include "platform.h" #include "popup_input_filter.h" #include "screenedge.h" diff --git a/src/plugins/platforms/drm/drm_backend.cpp b/src/plugins/platforms/drm/drm_backend.cpp index 737090d88b..692da40f92 100644 --- a/src/plugins/platforms/drm/drm_backend.cpp +++ b/src/plugins/platforms/drm/drm_backend.cpp @@ -7,6 +7,7 @@ SPDX-License-Identifier: GPL-2.0-or-later */ #include "drm_backend.h" +#include "backends/libinput/libinputbackend.h" #include #include "drm_output.h" #include "drm_object_connector.h" @@ -14,7 +15,6 @@ #include "drm_object_plane.h" #include "composite.h" #include "cursor.h" -#include "libinput/libinputbackend.h" #include "logging.h" #include "main.h" #include "renderloop.h" diff --git a/src/plugins/platforms/fbdev/fb_backend.cpp b/src/plugins/platforms/fbdev/fb_backend.cpp index 172ce569ea..6a9f488288 100644 --- a/src/plugins/platforms/fbdev/fb_backend.cpp +++ b/src/plugins/platforms/fbdev/fb_backend.cpp @@ -8,8 +8,8 @@ */ #include "fb_backend.h" +#include "backends/libinput/libinputbackend.h" #include "composite.h" -#include "libinput/libinputbackend.h" #include "logging.h" #include "main.h" #include "platform.h"