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.
This commit is contained in:
Vlad Zahorodnii 2021-12-17 10:31:42 +02:00
parent 6cdf056047
commit a711f90a69
4 changed files with 26 additions and 46 deletions

View file

@ -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

View file

@ -1 +0,0 @@
#cmakedefine01 HAVE_LINUX_INPUT_H

View file

@ -30,11 +30,8 @@
#include "textinput_v3_interface_p.h"
#include "touch_interface_p.h"
#include "utils.h"
// linux
#include <config-kwaylandserver.h>
#if HAVE_LINUX_INPUT_H
#include <linux/input.h>
#endif
#include <functional>
@ -631,7 +628,6 @@ PointerInterface *SeatInterface::pointer() const
static quint32 qtToWaylandButton(Qt::MouseButton button)
{
#if HAVE_LINUX_INPUT_H
static const QHash<Qt::MouseButton, quint32> 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);
}

View file

@ -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)