On Tue, Apr 15, 2014 at 02:28:10PM +0200, Hans de Goede wrote: > And warn if INPUT_PROP_BUTTONPAD mismatches right/middle buttons presence. > > Signed-off-by: Hans de Goede <[email protected]> > Acked-by: Peter Hutterer <[email protected]>
I've gone through all patches again and they're now all really Reviewed-by: Peter Hutterer <[email protected]>, except for the bits where things break obviously :) I'll start getting some tests ready for all this so we can verify the behaviour, but meanwhile you can grab the rebased series from my github, wip/clickpad-improvements. Cheers, Peter > --- > src/evdev-mt-touchpad-buttons.c | 34 ++++++++++++++++++---------------- > src/evdev-mt-touchpad.c | 4 ++-- > src/evdev-mt-touchpad.h | 7 +++---- > 3 files changed, 23 insertions(+), 22 deletions(-) > > diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c > index e789a87..ec36280 100644 > --- a/src/evdev-mt-touchpad-buttons.c > +++ b/src/evdev-mt-touchpad-buttons.c > @@ -410,9 +410,17 @@ tp_init_buttons(struct tp_dispatch *tp, > int width, height; > double diagonal; > > + tp->buttons.is_clickpad = libevdev_has_property(device->evdev, > + INPUT_PROP_BUTTONPAD); > + > if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE) || > - libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) > - tp->buttons.has_buttons = true; > + libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) { > + if (tp->buttons.is_clickpad) > + log_bug("clickpad advertising right button (kernel > bug?)\n"); > + } else { > + if (!tp->buttons.is_clickpad) > + log_bug("non clickpad without right button (kernel > bug)?\n"); > + } > > width = abs(device->abs.max_x - device->abs.min_x); > height = abs(device->abs.max_y - device->abs.min_y); > @@ -423,10 +431,7 @@ tp_init_buttons(struct tp_dispatch *tp, > if (libevdev_get_id_vendor(device->evdev) == 0x5ac) /* Apple */ > tp->buttons.use_clickfinger = true; > > - tp->buttons.use_softbuttons = !tp->buttons.use_clickfinger && > - !tp->buttons.has_buttons; > - > - if (tp->buttons.use_softbuttons) { > + if (tp->buttons.is_clickpad && !tp->buttons.use_clickfinger) { > tp->buttons.area.top_edge = height * .8 + device->abs.min_y; > tp->buttons.area.rightbutton_left_edge = width/2 + > device->abs.min_x; > tp->buttons.timer_fd = timerfd_create(CLOCK_MONOTONIC, > TFD_CLOEXEC); > @@ -585,21 +590,18 @@ tp_post_softbutton_buttons(struct tp_dispatch *tp, > uint32_t time) > int > tp_post_button_events(struct tp_dispatch *tp, uint32_t time) > { > - int rc; > - > if ((tp->queued & > (TOUCHPAD_EVENT_BUTTON_PRESS|TOUCHPAD_EVENT_BUTTON_RELEASE)) == > 0) > return 0; > > - if (tp->buttons.has_buttons) > - rc = tp_post_physical_buttons(tp, time); > - else if (tp->buttons.use_clickfinger) > - rc = tp_post_clickfinger_buttons(tp, time); > - else if (tp->buttons.use_softbuttons) > - rc = tp_post_softbutton_buttons(tp, time); > - > + if (tp->buttons.is_clickpad) { > + if (tp->buttons.use_clickfinger) > + return tp_post_clickfinger_buttons(tp, time); > + else > + return tp_post_softbutton_buttons(tp, time); > + } > > - return rc; > + return tp_post_physical_buttons(tp, time); > } > > int > diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c > index b671211..910bd2a 100644 > --- a/src/evdev-mt-touchpad.c > +++ b/src/evdev-mt-touchpad.c > @@ -392,7 +392,7 @@ tp_process_state(struct tp_dispatch *tp, uint32_t time) > * to allow drag and drop. > */ > if ((tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS) && > - !tp->buttons.has_buttons) > + tp->buttons.is_clickpad) > tp_pin_fingers(tp); > > /* If we don't have a touch as pointer find a suitable one */ > @@ -496,7 +496,7 @@ static int > tp_post_scroll_events(struct tp_dispatch *tp, uint32_t time) > { > /* don't scroll if a clickpad is held down */ > - if (!tp->buttons.has_buttons && > + if (tp->buttons.is_buttonpad && > (tp->buttons.state || tp->buttons.old_state)) > return 0; > > diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h > index 04da6a6..5cb9ae2 100644 > --- a/src/evdev-mt-touchpad.h > +++ b/src/evdev-mt-touchpad.h > @@ -154,19 +154,18 @@ struct tp_dispatch { > } accel; > > struct { > - bool has_buttons; /* true for physical LMR > buttons */ > + bool is_clickpad; /* true for clickpads */ > bool use_clickfinger; /* number of fingers decides > button number */ > - bool use_softbuttons; /* use software-button area */ > uint32_t state; > uint32_t old_state; > uint32_t motion_dist; /* for pinned touches */ > unsigned int active; /* currently active button, for > release event */ > > - /* Only used if has_buttons is false. The software button area > is always > + /* Only used for clickpads. The software button area is always > * a horizontal strip across the touchpad. Depending on the > * rightbutton_left_edge value, the buttons are split according > to the > * edge settings. > - */ > + */ > struct { > int32_t top_edge; > int32_t rightbutton_left_edge; > -- > 1.9.0 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
