Make linux/input.h compile time optional
Summary: Instead of hard depending on the include of linux/input.h we check whether that include file exists and properly ifdef all usages. Unfortunately there is no replacement for those parts which do mapping of input event codes. Reviewers: #plasma_on_wayland Subscribers: plasma-devel Tags: #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D2344
This commit is contained in:
parent
233e388e02
commit
618bebb63b
4 changed files with 54 additions and 33 deletions
|
@ -69,13 +69,15 @@ ecm_mark_as_test(testWaylandSurface)
|
|||
########################################################
|
||||
# Test WaylandSeat
|
||||
########################################################
|
||||
set( testWaylandSeat_SRCS
|
||||
test_wayland_seat.cpp
|
||||
)
|
||||
add_executable(testWaylandSeat ${testWaylandSeat_SRCS})
|
||||
target_link_libraries( testWaylandSeat Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
|
||||
add_test(kwayland-testWaylandSeat testWaylandSeat)
|
||||
ecm_mark_as_test(testWaylandSeat)
|
||||
if (HAVE_LINUX_INPUT_H)
|
||||
set( testWaylandSeat_SRCS
|
||||
test_wayland_seat.cpp
|
||||
)
|
||||
add_executable(testWaylandSeat ${testWaylandSeat_SRCS})
|
||||
target_link_libraries( testWaylandSeat Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer Wayland::Client Wayland::Server)
|
||||
add_test(kwayland-testWaylandSeat testWaylandSeat)
|
||||
ecm_mark_as_test(testWaylandSeat)
|
||||
endif()
|
||||
|
||||
########################################################
|
||||
# Test ShmPool
|
||||
|
@ -279,24 +281,28 @@ ecm_mark_as_test(testShadow)
|
|||
########################################################
|
||||
# Test FakeInput
|
||||
########################################################
|
||||
set( testFakeInput_SRCS
|
||||
test_fake_input.cpp
|
||||
)
|
||||
add_executable(testFakeInput ${testFakeInput_SRCS})
|
||||
target_link_libraries( testFakeInput Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer)
|
||||
add_test(kwayland-testFakeInput testFakeInput)
|
||||
ecm_mark_as_test(testFakeInput)
|
||||
if (HAVE_LINUX_INPUT_H)
|
||||
set( testFakeInput_SRCS
|
||||
test_fake_input.cpp
|
||||
)
|
||||
add_executable(testFakeInput ${testFakeInput_SRCS})
|
||||
target_link_libraries( testFakeInput Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer)
|
||||
add_test(kwayland-testFakeInput testFakeInput)
|
||||
ecm_mark_as_test(testFakeInput)
|
||||
endif()
|
||||
|
||||
########################################################
|
||||
# Test PlasmaWindowModel
|
||||
########################################################
|
||||
set( testPlasmaWindowModel_SRCS
|
||||
test_plasma_window_model.cpp
|
||||
)
|
||||
add_executable(testPlasmaWindowModel ${testPlasmaWindowModel_SRCS})
|
||||
target_link_libraries( testPlasmaWindowModel Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer)
|
||||
add_test(kwayland-testPlasmaWindowModel testPlasmaWindowModel)
|
||||
ecm_mark_as_test(testPlasmaWindowModel)
|
||||
if (HAVE_LINUX_INPUT_H)
|
||||
set( testPlasmaWindowModel_SRCS
|
||||
test_plasma_window_model.cpp
|
||||
)
|
||||
add_executable(testPlasmaWindowModel ${testPlasmaWindowModel_SRCS})
|
||||
target_link_libraries( testPlasmaWindowModel Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer)
|
||||
add_test(kwayland-testPlasmaWindowModel testPlasmaWindowModel)
|
||||
ecm_mark_as_test(testPlasmaWindowModel)
|
||||
endif()
|
||||
|
||||
########################################################
|
||||
# Test TextInput
|
||||
|
|
1
src/wayland/config-kwayland.h.cmake
Normal file
1
src/wayland/config-kwayland.h.cmake
Normal file
|
@ -0,0 +1 @@
|
|||
#cmakedefine01 HAVE_LINUX_INPUT_H
|
|
@ -33,7 +33,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define WL_SEAT_NAME_SINCE_VERSION 2
|
||||
#endif
|
||||
// linux
|
||||
#include <config-kwayland.h>
|
||||
#if HAVE_LINUX_INPUT_H
|
||||
#include <linux/input.h>
|
||||
#endif
|
||||
|
||||
namespace KWayland
|
||||
{
|
||||
|
@ -682,6 +685,7 @@ QMatrix4x4 SeatInterface::focusedPointerSurfaceTransformation() const
|
|||
namespace {
|
||||
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},
|
||||
|
@ -702,6 +706,9 @@ static quint32 qtToWaylandButton(Qt::MouseButton button)
|
|||
// further mapping not possible, 0x120 is BTN_JOYSTICK
|
||||
});
|
||||
return s_buttons.value(button, 0);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,6 +1082,7 @@ qint32 SeatInterface::touchDown(const QPointF &globalPosition)
|
|||
if (d->touchInterface.focus.touch && d->touchInterface.focus.surface) {
|
||||
d->touchInterface.focus.touch->down(id, serial, globalPosition - d->touchInterface.focus.offset);
|
||||
} else if (id == 0 && focusedTouchSurface()) {
|
||||
#if HAVE_LINUX_INPUT_H
|
||||
auto p = d->pointerForSurface(focusedTouchSurface());
|
||||
if (!p) {
|
||||
return id;
|
||||
|
@ -1087,6 +1095,7 @@ qint32 SeatInterface::touchDown(const QPointF &globalPosition)
|
|||
wl_fixed_from_double(pos.x()), wl_fixed_from_double(pos.y()));
|
||||
|
||||
wl_pointer_send_button(p->resource(), serial, timestamp(), BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
|
||||
#endif
|
||||
}
|
||||
|
||||
d->touchInterface.ids << id;
|
||||
|
@ -1117,6 +1126,7 @@ void SeatInterface::touchUp(qint32 id)
|
|||
if (d->touchInterface.focus.touch && d->touchInterface.focus.surface) {
|
||||
d->touchInterface.focus.touch->up(id, display()->nextSerial());
|
||||
} else if (id == 0 && focusedTouchSurface()) {
|
||||
#if HAVE_LINUX_INPUT_H
|
||||
const quint32 serial = display()->nextSerial();
|
||||
auto p = d->pointerForSurface(focusedTouchSurface());
|
||||
if (!p) {
|
||||
|
@ -1124,6 +1134,7 @@ void SeatInterface::touchUp(qint32 id)
|
|||
}
|
||||
|
||||
wl_pointer_send_button(p->resource(), serial, timestamp(), BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
|
||||
#endif
|
||||
}
|
||||
d->touchInterface.ids.removeAll(id);
|
||||
}
|
||||
|
|
|
@ -30,21 +30,28 @@ if (Qt5Concurrent_FOUND)
|
|||
ecm_mark_as_test(pasteClient)
|
||||
endif()
|
||||
|
||||
add_executable(touchClientTest touchclienttest.cpp)
|
||||
target_link_libraries(touchClientTest KF5::WaylandClient)
|
||||
if (HAVE_LINUX_INPUT_H)
|
||||
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(qtwayland-integration-test qtwaylandintegrationtest.cpp)
|
||||
target_link_libraries(qtwayland-integration-test Qt5::Core Qt5::Gui KF5::WaylandClient)
|
||||
ecm_mark_as_test(qtwayland-integration-test)
|
||||
|
||||
add_executable(subsurface-test subsurfacetest.cpp)
|
||||
target_link_libraries(subsurface-test Qt5::Core Qt5::Gui KF5::WaylandClient)
|
||||
ecm_mark_as_test(subsurface-test)
|
||||
endif()
|
||||
|
||||
add_executable(shadowTest shadowtest.cpp)
|
||||
target_link_libraries(shadowTest KF5::WaylandClient)
|
||||
ecm_mark_as_test(shadowTest)
|
||||
|
||||
add_executable(qtwayland-integration-test qtwaylandintegrationtest.cpp)
|
||||
target_link_libraries(qtwayland-integration-test Qt5::Core Qt5::Gui KF5::WaylandClient)
|
||||
ecm_mark_as_test(qtwayland-integration-test)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
add_executable(dpmsTest dpmstest.cpp)
|
||||
|
@ -52,10 +59,6 @@ if (Qt5Widgets_FOUND)
|
|||
ecm_mark_as_test(dpmsTest)
|
||||
endif()
|
||||
|
||||
add_executable(subsurface-test subsurfacetest.cpp)
|
||||
target_link_libraries(subsurface-test Qt5::Core Qt5::Gui KF5::WaylandClient)
|
||||
ecm_mark_as_test(subsurface-test)
|
||||
|
||||
add_executable(plasmasurface-test plasmasurfacetest.cpp)
|
||||
target_link_libraries(plasmasurface-test Qt5::Gui KF5::WaylandClient)
|
||||
ecm_mark_as_test(plasmasurface-test)
|
||||
|
|
Loading…
Reference in a new issue