diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-22 15:13:10 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-07-22 15:15:00 +0300 |
commit | 185eeeaaac01bf24930f7e8b25c96f9fa9503073 (patch) | |
tree | dce02fb90b0bb5b3ae15e6c6dd1c2e6f9e88318b /intern | |
parent | 003dfae270781bfa642a2c5804fa190edd4dfca4 (diff) |
GHOST/Wayland: Fix mouse wheel events for Sway Compositor (use seat v5)
Bump the requested seat version to v5, use discreet scroll callback.
Tested with gnome, river & sway.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 07202ff972d..96f11aa2aa5 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -1580,13 +1580,38 @@ static void pointer_handle_button(void *data, } } -static void pointer_handle_axis(void *data, +static void pointer_handle_axis(void * /*data*/, struct wl_pointer * /*wl_pointer*/, const uint32_t /*time*/, const uint32_t axis, const wl_fixed_t value) { CLOG_INFO(LOG, 2, "axis (axis=%u, value=%d)", axis, value); +} + +static void pointer_handle_frame(void * /*data*/, struct wl_pointer * /*wl_pointer*/) +{ + CLOG_INFO(LOG, 2, "frame"); +} +static void pointer_handle_axis_source(void * /*data*/, + struct wl_pointer * /*wl_pointer*/, + uint32_t axis_source) +{ + CLOG_INFO(LOG, 2, "axis_source (axis_source=%u)", axis_source); +} +static void pointer_handle_axis_stop(void * /*data*/, + struct wl_pointer * /*wl_pointer*/, + uint32_t /*time*/, + uint32_t axis) +{ + CLOG_INFO(LOG, 2, "axis_stop (axis=%u)", axis); +} +static void pointer_handle_axis_discrete(void *data, + struct wl_pointer * /*wl_pointer*/, + uint32_t axis, + int32_t discrete) +{ + CLOG_INFO(LOG, 2, "axis_discrete (axis=%u, discrete=%d)", axis, discrete); input_t *input = static_cast<input_t *>(data); if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL) { @@ -1596,7 +1621,7 @@ static void pointer_handle_axis(void *data, if (wl_surface *focus_surface = input->pointer.wl_surface) { GHOST_WindowWayland *win = ghost_wl_surface_user_data(focus_surface); input->system->pushEvent(new GHOST_EventWheel( - input->system->getMilliSeconds(), win, std::signbit(value) ? +1 : -1)); + input->system->getMilliSeconds(), win, std::signbit(discrete) ? +1 : -1)); } } @@ -1606,6 +1631,10 @@ static const struct wl_pointer_listener pointer_listener = { pointer_handle_motion, pointer_handle_button, pointer_handle_axis, + pointer_handle_frame, + pointer_handle_axis_source, + pointer_handle_axis_stop, + pointer_handle_axis_discrete, }; #undef LOG @@ -2744,7 +2773,7 @@ static void global_handle_add(void *data, input->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); input->data_source = new data_source_t; input->wl_seat = static_cast<wl_seat *>( - wl_registry_bind(wl_registry, name, &wl_seat_interface, 4)); + wl_registry_bind(wl_registry, name, &wl_seat_interface, 5)); display->inputs.push_back(input); wl_seat_add_listener(input->wl_seat, &seat_listener, input); } |