From: Michael Poole <mdpoole@troilus.org>
To: Chase Douglas <chase.douglas@canonical.com>
Cc: Jiri Kosina <jkosina@suse.cz>, linux-input@vger.kernel.org
Subject: Re: [PATCH 3/3] HID: magicmouse: enable horizontal scrolling
Date: Mon, 21 Jun 2010 21:29:08 -0400 [thread overview]
Message-ID: <87eifzdfdn.fsf@troilus.org> (raw)
In-Reply-To: <1277083951-29137-4-git-send-email-chase.douglas@canonical.com> (Chase Douglas's message of "Sun, 20 Jun 2010 21:32:31 -0400")
Chase Douglas writes:
> Mimicks OS X behavior.
>
> Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
> ---
> drivers/hid/hid-magicmouse.c | 25 +++++++++++++++++++------
> 1 files changed, 19 insertions(+), 6 deletions(-)
I like this general idea, but Dmitry Torokhov didn't like my previous
patch to achieve a similar effect:
https://patchwork.kernel.org/patch/84201/
The only behavioral question I would have is whether a single
touch/swipe should be locked in one direction or if it should be able to
generate both horizontal and vertical scroll events. That seems like a
user preference thing to me.
(My real wish is for X and the various widget libraries to get decent
multitouch support soon, so that the kernel doesn't have to address
those policy questions.)
Michael
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index fe0c760..0b89c1c 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -95,6 +95,7 @@ struct magicmouse_sc {
> struct {
> short x;
> short y;
> + short scroll_x;
> short scroll_y;
> u8 size;
> } touches[16];
> @@ -181,11 +182,13 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
> */
> if (emulate_scroll_wheel) {
> unsigned long now = jiffies;
> - int step = msc->touches[id].scroll_y - y;
> + int step_x = msc->touches[id].scroll_x - x;
> + int step_y = msc->touches[id].scroll_y - y;
>
> /* Calculate and apply the scroll motion. */
> switch (tdata[7] & TOUCH_STATE_MASK) {
> case TOUCH_STATE_START:
> + msc->touches[id].scroll_x = x;
> msc->touches[id].scroll_y = y;
>
> /* Reset acceleration after half a second. */
> @@ -198,12 +201,20 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
>
> break;
> case TOUCH_STATE_DRAG:
> - step /= (64 - (int)scroll_speed) * msc->scroll_accel;
> - if (step != 0) {
> - msc->touches[id].scroll_y -= step *
> + step_x /= (64 - (int)scroll_speed) * msc->scroll_accel;
> + if (step_x != 0) {
> + msc->touches[id].scroll_x -= step_x *
> (64 - scroll_speed) * msc->scroll_accel;
> msc->scroll_jiffies = now;
> - input_report_rel(input, REL_WHEEL, step);
> + input_report_rel(input, REL_HWHEEL, -step_x);
> + }
> +
> + step_y /= (64 - (int)scroll_speed) * msc->scroll_accel;
> + if (step_y != 0) {
> + msc->touches[id].scroll_y -= step_y *
> + (64 - scroll_speed) * msc->scroll_accel;
> + msc->scroll_jiffies = now;
> + input_report_rel(input, REL_WHEEL, step_y);
> }
> break;
> }
> @@ -318,8 +329,10 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
> __set_bit(EV_REL, input->evbit);
> __set_bit(REL_X, input->relbit);
> __set_bit(REL_Y, input->relbit);
> - if (emulate_scroll_wheel)
> + if (emulate_scroll_wheel) {
> __set_bit(REL_WHEEL, input->relbit);
> + __set_bit(REL_HWHEEL, input->relbit);
> + }
>
> if (report_touches) {
> __set_bit(EV_ABS, input->evbit);
next prev parent reply other threads:[~2010-06-22 1:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 1:32 [PATCH 0/3] HID: magicmouse: More scroll improvements Chase Douglas
2010-06-21 1:32 ` [PATCH 1/3] HID: magicmouse: properly account for scroll movement in state Chase Douglas
2010-06-24 8:48 ` Jiri Kosina
2010-06-21 1:32 ` [PATCH 2/3] HID: magicmouse: add param for scroll speed Chase Douglas
2010-06-21 1:32 ` [PATCH 3/3] HID: magicmouse: enable horizontal scrolling Chase Douglas
2010-06-22 1:29 ` Michael Poole [this message]
2010-06-22 3:08 ` Chase Douglas
2010-06-22 9:10 ` Jiri Kosina
2010-06-24 8:50 ` [PATCH 0/3] HID: magicmouse: More scroll improvements Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eifzdfdn.fsf@troilus.org \
--to=mdpoole@troilus.org \
--cc=chase.douglas@canonical.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).