Possible bug with input handling

Tiago Vignatti tiago.vignatti at linux.intel.com
Thu Dec 8 07:14:19 PST 2011


Hi, sorry for late reply.

On 11/29/2011 08:30 PM, Christopher Michael wrote:
>
> I found an issue while working on some local code, that may be a bug in
> the input handling of Wayland.
>
> In my function to process button events (from mouse), the 'btn'
> parameter that gets returned to my handler seems incorrect for Wheel
> Events.
>
> Basically, mouse wheel down events are coming in as BTN_EXTRA, and mouse
> wheel up events are coming in as BTN_SIDE. This seems incorrect to me :/
> In my opinion, these should be perhaps BTN_FORWARD/BTN_BACK or maybe
> BTN_GEAR_DOWN/BTN_GEAR_UP.
>
> In <linux/input.h> there resides a BTN_WHEEL value ... perhaps that
> should be used for the returned 'btn' parameter, and the 'state'
> parameter could be set to BTN_GEAR_UP/DOWN ?? It would make more sense
> imo. Here is some short 'pseudo' code to illustrate what I mean.
>
> _cb_handle_button(void *data, struct wl_input_device *dev, uint32_t t,
> uint32_t btn, uint32_t state)
> {
> if (btn == BTN_WHEEL)
> {
> if (state == BTN_GEAR_DOWN)
> printf("Mouse Wheel Scrolled Down\n");
> else if (state == BTN_GEAR_UP)
> printf("Mouse Wheel Scrolled Up\n");
> }
> }
>
> As I am fairly new to Wayland, I am not sure where the issue actually
> resides or what the proper fix would be, so I cannot provide a patch to
> fix it :/

BTN_WHEEL event is quite bizarre because it doesn't seem to be forwarded 
by any device. Are you using X11 or drm compositor btw? Can you run 
evtest [0] and show the output when you scroll up/down?

[0] http://cgit.freedesktop.org/evtest/

        Tiago


More information about the wayland-devel mailing list