Possible bug with input handling

Christopher Michael cpmichael1 at comcast.net
Tue Nov 29 10:30:52 PST 2011


Hi All,

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 :/

Cheers,
devilhorns


More information about the wayland-devel mailing list