Possible bug with input handling
Tiago Vignatti
tiago.vignatti at linux.intel.com
Thu Dec 8 15:01:42 PST 2011
On 12/08/2011 09:34 PM, Christopher Michael wrote:
> On 12/08/11 10:14, Tiago Vignatti wrote:
>> 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
>
> I am using the X11 compositor. Here is the output from evtest when
> scrolling up/down on the wheel:
>
> http://imgur.com/IPhPT
oh, that's "expected" behavior within X11 compositor cause, even with
the last chances from today, we're not forwarding wheel events as they
should to clients cause requires protocol changes. We're not treating
correct either on drm compositor (evdev) case.
If you wanna hack around your code, you can take a look on a branch I
was playing with axis and wheel, on evdev:
http://cgit.freedesktop.org/~vignatti/wayland-demos/commit/?h=axis&id=a1bcb5af9474ef76d0a60d9923ab9ef9698a6fff
Tiago
More information about the wayland-devel
mailing list