From 58dd4200ea9a05af15c0d6b690897f9c5afe9633 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Tue, 5 Mar 2024 12:51:50 +0100 Subject: [PATCH 1/3] fix: add some missing includes --- como/input/xkb/manager.h | 1 + plugins/effects/blur/blur.h | 1 + 2 files changed, 2 insertions(+) diff --git a/como/input/xkb/manager.h b/como/input/xkb/manager.h index 1cf0785d4..5b6535c00 100644 --- a/como/input/xkb/manager.h +++ b/como/input/xkb/manager.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/effects/blur/blur.h b/plugins/effects/blur/blur.h index 31ba5843c..689ccd3b4 100644 --- a/plugins/effects/blur/blur.h +++ b/plugins/effects/blur/blur.h @@ -15,6 +15,7 @@ #include #include +#include #include #include From e9894414e0fe33cfe64810fb6ffcff2e64506798 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Tue, 5 Mar 2024 13:40:30 +0100 Subject: [PATCH 2/3] fix: use QKeyCombination::toCombined() --- como/win/tabbox/tabbox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/como/win/tabbox/tabbox.h b/como/win/tabbox/tabbox.h index 85221af54..ad7d089cb 100644 --- a/como/win/tabbox/tabbox.h +++ b/como/win/tabbox/tabbox.h @@ -441,11 +441,11 @@ class tabbox mods &= keyQt; if (((keyQt & ~mods) == Qt::Key_Tab) || ((keyQt & ~mods) == Qt::Key_Backtab)) { if (contains(forward, QKeyCombination(mods, Qt::Key_Backtab).toCombined()) - || contains(forward, QKeyCombination(mods, Qt::Key_Tab))) { + || contains(forward, QKeyCombination(mods, Qt::Key_Tab).toCombined())) { return Forward; } if (contains(backward, QKeyCombination(mods, Qt::Key_Backtab).toCombined()) - || contains(backward, QKeyCombination(mods, Qt::Key_Tab))) { + || contains(backward, QKeyCombination(mods, Qt::Key_Tab).toCombined())) { return Backward; } } From 17eb47b936df5d850e01b61b389b7936bbfc5be6 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Tue, 5 Mar 2024 13:13:12 +0100 Subject: [PATCH 3/3] fix: use new wayland enums Introduce new WLR_HAVE_WL_POINTER_AXIS_SOURCE switch to keep compatibility with wlroots < 0.18.0 --- CMakeLists.txt | 1 + como/base/config-como.h.cmake | 1 + como/input/backend/wlroots/pointer.h | 30 ++++++++++++++++++++++------ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 681cc18d4..630c341b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,7 @@ if (${wlroots_VERSION} VERSION_GREATER_EQUAL 0.18) set(WLR_HAVE_UTIL_TRANSFORM_HEADER 1) set(WLR_HAVE_NEW_PIXEL_COPY_API 1) set(WLR_HAVE_BACKEND_CREATE_WITH_LOOP 1) + set(WLR_HAVE_WL_POINTER_AXIS_SOURCE 1) endif() find_package(X11) diff --git a/como/base/config-como.h.cmake b/como/base/config-como.h.cmake index 0366fc4c8..d7f1a3877 100644 --- a/como/base/config-como.h.cmake +++ b/como/base/config-como.h.cmake @@ -20,6 +20,7 @@ #cmakedefine01 WLR_HAVE_UTIL_TRANSFORM_HEADER #cmakedefine01 WLR_HAVE_NEW_PIXEL_COPY_API #cmakedefine01 WLR_HAVE_BACKEND_CREATE_WITH_LOOP +#cmakedefine01 WLR_HAVE_WL_POINTER_AXIS_SOURCE #if HAVE_BREEZE_DECO #define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}" diff --git a/como/input/backend/wlroots/pointer.h b/como/input/backend/wlroots/pointer.h index 36641a64a..62c2cb0c2 100644 --- a/como/input/backend/wlroots/pointer.h +++ b/como/input/backend/wlroots/pointer.h @@ -82,13 +82,20 @@ void handle_button(struct wl_listener* listener, void* data) auto pointer = event_receiver_struct->receiver; auto wlr_event = reinterpret_cast(data); - auto event = button_event{ + auto event = button_event + { wlr_event->button, - wlr_event->state == WLR_BUTTON_RELEASED ? button_state::released : button_state::pressed, - { - pointer, - wlr_event->time_msec, - }, +#if WLR_HAVE_WL_POINTER_AXIS_SOURCE + wlr_event->state == WL_POINTER_BUTTON_STATE_RELEASED ? button_state::released + : button_state::pressed, +#else + wlr_event->state == WLR_BUTTON_RELEASED ? button_state::released + : button_state::pressed, +#endif + { + pointer, + wlr_event->time_msec, + }, }; Q_EMIT pointer->button_changed(event); @@ -104,6 +111,16 @@ void handle_axis(struct wl_listener* listener, void* data) auto get_source = [](auto wlr_source) { switch (wlr_source) { +#if WLR_HAVE_WL_POINTER_AXIS_SOURCE + case WL_POINTER_AXIS_SOURCE_WHEEL: + return axis_source::wheel; + case WL_POINTER_AXIS_SOURCE_FINGER: + return axis_source::finger; + case WL_POINTER_AXIS_SOURCE_CONTINUOUS: + return axis_source::continuous; + case WL_POINTER_AXIS_SOURCE_WHEEL_TILT: + return axis_source::wheel_tilt; +#else case WLR_AXIS_SOURCE_WHEEL: return axis_source::wheel; case WLR_AXIS_SOURCE_FINGER: @@ -112,6 +129,7 @@ void handle_axis(struct wl_listener* listener, void* data) return axis_source::continuous; case WLR_AXIS_SOURCE_WHEEL_TILT: return axis_source::wheel_tilt; +#endif default: return axis_source::unknown; }