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; }