Mouse wheel scrolls windows: forward scroll to Wayland clients
The wheel used to reach only the Interface Explorer dialog; clients never got wl_pointer.axis, and the login-session (KMS/libinput) backend dropped scroll events. - libinput axis events (wheel, touchpad, trackpoint) are queued as EV_AXIS and surface as InputEvent::Scroll(axis, value, discrete) in both the native and wasm (moonplasma:host/display seat-event.scroll) backends. - The nested backend keeps horizontal scroll and the host's axis_discrete notches. - The compositor sends axis_source(wheel) + axis_discrete/axis_value120 + axis + frame to the popup or window under the pointer; the explorer still takes the wheel while inspect mode is on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hjdz1uQ1y3GgazdKrR
This commit is contained in:
12 files changed
+200
-44
No files matched your search
@@ -297,6 +297,23 @@ static void handle_li_event(struct libinput_event *ev) {
|
||||
libinput_event_pointer_get_button_state(p) == LIBINPUT_BUTTON_STATE_PRESSED, 0, 0);
|
||||
break;
|
||||
}
|
||||
case LIBINPUT_EVENT_POINTER_AXIS: {
|
||||
/* Legacy axis event: still emitted alongside the libinput >= 1.19 scroll events, so one
|
||||
* handler covers wheels, touchpads and trackpoints on every libinput version. Value is in
|
||||
* pointer-motion units (~15 per wheel notch), sent as 24.8 fixed point. */
|
||||
struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
|
||||
int wheel = libinput_event_pointer_get_axis_source(p) == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL;
|
||||
static const enum libinput_pointer_axis axes[2] = {
|
||||
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL };
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (!libinput_event_pointer_has_axis(p, axes[i])) continue;
|
||||
double v = libinput_event_pointer_get_axis_value(p, axes[i]);
|
||||
int steps = wheel ? (int)libinput_event_pointer_get_axis_value_discrete(p, axes[i]) : 0;
|
||||
if (v == 0.0 && steps == 0) continue; /* scroll stop */
|
||||
q_push(EV_AXIS, i, (int32_t)(v * 256.0), steps, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user