Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +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)
set(WLR_HAVE_WL_POINTER_ENUMS 1)
endif()

find_package(X11)
Expand Down
2 changes: 1 addition & 1 deletion como/base/config-como.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +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
#cmakedefine01 WLR_HAVE_WL_POINTER_ENUMS

#if HAVE_BREEZE_DECO
#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
Expand Down
4 changes: 2 additions & 2 deletions como/input/backend/wlroots/pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void handle_button(struct wl_listener* listener, void* data)
auto event = button_event
{
wlr_event->button,
#if WLR_HAVE_WL_POINTER_AXIS_SOURCE
#if WLR_HAVE_WL_POINTER_ENUMS
wlr_event->state == WL_POINTER_BUTTON_STATE_RELEASED ? button_state::released
: button_state::pressed,
#else
Expand All @@ -111,7 +111,7 @@ 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
#if WLR_HAVE_WL_POINTER_ENUMS
case WL_POINTER_AXIS_SOURCE_WHEEL:
return axis_source::wheel;
case WL_POINTER_AXIS_SOURCE_FINGER:
Expand Down
33 changes: 33 additions & 0 deletions tests/integration/lib/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,11 @@ void pointer_motion_absolute(QPointF const& position, uint32_t time)
wlr_signal_emit_safe(&test_app->pointer->events.frame, test_app->pointer);
}

#if WLR_HAVE_WL_POINTER_ENUMS
void pointer_button_impl(uint32_t button, uint32_t time, wl_pointer_button_state state)
#else
void pointer_button_impl(uint32_t button, uint32_t time, wlr_button_state state)
#endif
{
auto test_app = app();

Expand All @@ -498,19 +502,35 @@ void pointer_button_impl(uint32_t button, uint32_t time, wlr_button_state state)

void pointer_button_pressed(uint32_t button, uint32_t time)
{
#if WLR_HAVE_WL_POINTER_ENUMS
pointer_button_impl(button, time, WL_POINTER_BUTTON_STATE_PRESSED);
#else
pointer_button_impl(button, time, WLR_BUTTON_PRESSED);
#endif
}

void pointer_button_released(uint32_t button, uint32_t time)
{
#if WLR_HAVE_WL_POINTER_ENUMS
pointer_button_impl(button, time, WL_POINTER_BUTTON_STATE_RELEASED);
#else
pointer_button_impl(button, time, WLR_BUTTON_RELEASED);
#endif
}

#if WLR_HAVE_WL_POINTER_ENUMS
void pointer_axis_impl(double delta,
uint32_t time,
int32_t discrete_delta,
wl_pointer_axis orientation,
wl_pointer_axis_source source)
#else
void pointer_axis_impl(double delta,
uint32_t time,
int32_t discrete_delta,
wlr_axis_orientation orientation,
wlr_axis_source source)
#endif
{
auto test_app = app();

Expand All @@ -531,14 +551,27 @@ void pointer_axis_impl(double delta,

void pointer_axis_horizontal(double delta, uint32_t time, int32_t discrete_delta)
{
#if WLR_HAVE_WL_POINTER_ENUMS
pointer_axis_impl(delta,
time,
discrete_delta,
WL_POINTER_AXIS_HORIZONTAL_SCROLL,
WL_POINTER_AXIS_SOURCE_WHEEL);
#else
pointer_axis_impl(
delta, time, discrete_delta, WLR_AXIS_ORIENTATION_HORIZONTAL, WLR_AXIS_SOURCE_WHEEL);
#endif
}

void pointer_axis_vertical(double delta, uint32_t time, int32_t discrete_delta)
{
#if WLR_HAVE_WL_POINTER_ENUMS
pointer_axis_impl(
delta, time, discrete_delta, WL_POINTER_AXIS_VERTICAL_SCROLL, WL_POINTER_AXIS_SOURCE_WHEEL);
#else
pointer_axis_impl(
delta, time, discrete_delta, WLR_AXIS_ORIENTATION_VERTICAL, WLR_AXIS_SOURCE_WHEEL);
#endif
}

void keyboard_key_impl(uint32_t key,
Expand Down