[Wayland-bugs] [Bug 105830] libinput ignores xinput settings regarding mouse wheel (quick fix included)

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Mar 31 00:38:33 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=105830

            Bug ID: 105830
           Summary: libinput ignores xinput settings regarding mouse wheel
                    (quick fix included)
           Product: Wayland
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: libinput
          Assignee: wayland-bugs at lists.freedesktop.org
          Reporter: sblachmann at gmail.com

PROBLEM:
libinput ignores settings done by "xinput set-button-map" that set wheels to
zero to deactivate them.

For details, please see: http://forums.debian.net/viewtopic.php?f=6&t=137104
Bug https://bugs.freedesktop.org/show_bug.cgi?id=104960 is possibly also
influenced by this issue.

CAUSE:
My investigation showed what causes the bug.
The problem is in libinput.c.
Please look at the comments added by me to understand the problem.

SOLUTION:
My quick fix factually just consisted of disabling the wheel by always
returning zero movement.
A *proper* fix would check whether the wheel is enabled at all in the button
map set by xinput or xorg.conf, and discard the events if wheel is disabled.

<<<CODE SNIPPET START>>>
LIBINPUT_EXPORT double
libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer
*event,
                                               enum libinput_pointer_axis axis)
{
        struct libinput *libinput = event->base.device->seat->libinput;
        double value = 0;

        require_event_type(libinput_event_get_context(&event->base),
                           event->base.type,
                           0.0,
                           LIBINPUT_EVENT_POINTER_AXIS);

        if (!libinput_event_pointer_has_axis(event, axis)) {
                log_bug_client(libinput, "value requested for unset axis\n");
        } else {
                switch (axis) {
                case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
                        value = event->discrete.x;
                        break;
                case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
                        value = event->discrete.y;
                        break;
                }
        }
//      return value;
//      
//      YUCKY BUG HERE: xinput-disabled wheels will generate events
//      FIX by checking xinput button map
//      for now just FSCK THE SCROLL SH!T

        return 0;
}

LIBINPUT_EXPORT enum libinput_pointer_axis_source
libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event)
{
        require_event_type(libinput_event_get_context(&event->base),
                           event->base.type,
                           0,
                           LIBINPUT_EVENT_POINTER_AXIS);

//      return event->source;
//      
//      YUCKY BUG HERE: xinput-disabled wheels will generate events
//      FIX by checking xinput button map
//      for now just FSCK THE SCROLL SH!T

        return 0;
}
<<<CODE SNIPPET END>>>

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-bugs/attachments/20180331/b140b453/attachment.html>


More information about the wayland-bugs mailing list