From a711f90a693ef6614d462ff55ef633806f791fe6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 17 Dec 2021 10:31:42 +0200 Subject: [PATCH] Include linux/input.h without performing any checks Currently drag-and-drop doesn't work on FreeBSD because relevant input parts of kwayland-server are not compiled there. HAVE_LINUX_INPUT_H is set to 0 on FreeBSD because linux/input.h is in /usr/local/include and check_include_file() doesn't look there. Regardless of that, as FreeBSD developers pointed out, including linux/input.h is the recommended way to get input event codes so let's make it a hard dependency. --- src/wayland/autotests/client/CMakeLists.txt | 38 +++++++++------------ src/wayland/config-kwaylandserver.h.cmake | 1 - src/wayland/seat_interface.cpp | 14 +------- src/wayland/tests/CMakeLists.txt | 19 +++++------ 4 files changed, 26 insertions(+), 46 deletions(-) delete mode 100644 src/wayland/config-kwaylandserver.h.cmake diff --git a/src/wayland/autotests/client/CMakeLists.txt b/src/wayland/autotests/client/CMakeLists.txt index 3977445a5a..34df293ac2 100644 --- a/src/wayland/autotests/client/CMakeLists.txt +++ b/src/wayland/autotests/client/CMakeLists.txt @@ -23,19 +23,17 @@ ecm_mark_as_test(testWaylandSurface) ######################################################## # Test WaylandSeat ######################################################## -if (HAVE_LINUX_INPUT_H) - set( testWaylandSeat_SRCS - test_wayland_seat.cpp - ) - ecm_add_qtwayland_client_protocol(testWaylandSeat_SRCS - PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml - BASENAME pointer-gestures-unstable-v1 +set( testWaylandSeat_SRCS + test_wayland_seat.cpp ) - add_executable(testWaylandSeat ${testWaylandSeat_SRCS}) - target_link_libraries( testWaylandSeat Qt::Test Qt::Gui KF5::WaylandClient Plasma::KWaylandServer Wayland::Client Wayland::Server) - add_test(NAME kwayland-testWaylandSeat COMMAND testWaylandSeat) - ecm_mark_as_test(testWaylandSeat) -endif() +ecm_add_qtwayland_client_protocol(testWaylandSeat_SRCS + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml + BASENAME pointer-gestures-unstable-v1 +) +add_executable(testWaylandSeat ${testWaylandSeat_SRCS}) +target_link_libraries( testWaylandSeat Qt::Test Qt::Gui KF5::WaylandClient Plasma::KWaylandServer Wayland::Client Wayland::Server) +add_test(NAME kwayland-testWaylandSeat COMMAND testWaylandSeat) +ecm_mark_as_test(testWaylandSeat) ######################################################## # Test ShmPool @@ -183,15 +181,13 @@ ecm_mark_as_test(testShadow) ######################################################## # Test FakeInput ######################################################## -if (HAVE_LINUX_INPUT_H) - set( testFakeInput_SRCS - test_fake_input.cpp - ) - add_executable(testFakeInput ${testFakeInput_SRCS}) - target_link_libraries( testFakeInput Qt::Test Qt::Gui KF5::WaylandClient Plasma::KWaylandServer) - add_test(NAME kwayland-testFakeInput COMMAND testFakeInput) - ecm_mark_as_test(testFakeInput) -endif() +set( testFakeInput_SRCS + test_fake_input.cpp + ) +add_executable(testFakeInput ${testFakeInput_SRCS}) +target_link_libraries( testFakeInput Qt::Test Qt::Gui KF5::WaylandClient Plasma::KWaylandServer) +add_test(NAME kwayland-testFakeInput COMMAND testFakeInput) +ecm_mark_as_test(testFakeInput) ######################################################## # Test TextInputV2 diff --git a/src/wayland/config-kwaylandserver.h.cmake b/src/wayland/config-kwaylandserver.h.cmake deleted file mode 100644 index 8ef84a3c33..0000000000 --- a/src/wayland/config-kwaylandserver.h.cmake +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine01 HAVE_LINUX_INPUT_H diff --git a/src/wayland/seat_interface.cpp b/src/wayland/seat_interface.cpp index 8b24797aa3..7051236e2d 100644 --- a/src/wayland/seat_interface.cpp +++ b/src/wayland/seat_interface.cpp @@ -30,11 +30,8 @@ #include "textinput_v3_interface_p.h" #include "touch_interface_p.h" #include "utils.h" -// linux -#include -#if HAVE_LINUX_INPUT_H + #include -#endif #include @@ -631,7 +628,6 @@ PointerInterface *SeatInterface::pointer() const static quint32 qtToWaylandButton(Qt::MouseButton button) { -#if HAVE_LINUX_INPUT_H static const QHash s_buttons({ {Qt::LeftButton, BTN_LEFT}, {Qt::RightButton, BTN_RIGHT}, @@ -652,10 +648,6 @@ static quint32 qtToWaylandButton(Qt::MouseButton button) // further mapping not possible, 0x120 is BTN_JOYSTICK }); return s_buttons.value(button, 0); -#else - Q_UNUSED(button) - return 0; -#endif } bool SeatInterface::isPointerButtonPressed(Qt::MouseButton button) const @@ -1061,7 +1053,6 @@ void SeatInterface::notifyTouchDown(qint32 id, const QPointF &globalPosition) d->globalTouch.focus.firstTouchPos = globalPosition; } -#if HAVE_LINUX_INPUT_H if (id == 0 && hasPointer() && focusedTouchSurface()) { TouchInterfacePrivate *touchPrivate = TouchInterfacePrivate::get(d->touch.data()); if (touchPrivate->touchesForClient(focusedTouchSurface()->client()).isEmpty()) { @@ -1072,7 +1063,6 @@ void SeatInterface::notifyTouchDown(qint32 id, const QPointF &globalPosition) d->pointer->sendFrame(); } } -#endif d->globalTouch.ids[id] = serial; } @@ -1119,7 +1109,6 @@ void SeatInterface::notifyTouchUp(qint32 id) } d->touch->sendUp(id, serial); -#if HAVE_LINUX_INPUT_H if (id == 0 && hasPointer() && focusedTouchSurface()) { TouchInterfacePrivate *touchPrivate = TouchInterfacePrivate::get(d->touch.data()); if (touchPrivate->touchesForClient(focusedTouchSurface()->client()).isEmpty()) { @@ -1129,7 +1118,6 @@ void SeatInterface::notifyTouchUp(qint32 id) d->pointer->sendFrame(); } } -#endif d->globalTouch.ids.remove(id); } diff --git a/src/wayland/tests/CMakeLists.txt b/src/wayland/tests/CMakeLists.txt index f6da93e828..638081d284 100644 --- a/src/wayland/tests/CMakeLists.txt +++ b/src/wayland/tests/CMakeLists.txt @@ -27,19 +27,16 @@ add_executable(pasteClient pasteclient.cpp) target_link_libraries(pasteClient Qt::Concurrent KF5::WaylandClient) ecm_mark_as_test(pasteClient) -if (HAVE_LINUX_INPUT_H) - add_executable(touchClientTest touchclienttest.cpp) - target_link_libraries(touchClientTest KF5::WaylandClient) +add_executable(touchClientTest touchclienttest.cpp) +target_link_libraries(touchClientTest KF5::WaylandClient) +add_executable(panelTest paneltest.cpp) +target_link_libraries(panelTest KF5::WaylandClient) +ecm_mark_as_test(panelTest) - add_executable(panelTest paneltest.cpp) - target_link_libraries(panelTest KF5::WaylandClient) - ecm_mark_as_test(panelTest) - - add_executable(subsurface-test subsurfacetest.cpp) - target_link_libraries(subsurface-test Qt::Core Qt::Gui KF5::WaylandClient) - ecm_mark_as_test(subsurface-test) -endif() +add_executable(subsurface-test subsurfacetest.cpp) +target_link_libraries(subsurface-test Qt::Core Qt::Gui KF5::WaylandClient) +ecm_mark_as_test(subsurface-test) add_executable(shadowTest shadowtest.cpp) target_link_libraries(shadowTest KF5::WaylandClient)