From: Luiz Capitulino <lcapitulino@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Brad Hards <bradh@frogmouth.net>,
kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH] monitor: avoid moving cursor during "mouse_button" command
Date: Fri, 8 Apr 2011 13:37:08 -0300 [thread overview]
Message-ID: <20110408133708.2a25946a@doriath> (raw)
In-Reply-To: <m3bp0ghkwi.fsf@blackfin.pond.sub.org>
On Fri, 08 Apr 2011 16:34:21 +0200
Markus Armbruster <armbru@redhat.com> wrote:
> Brad Hards <bradh@frogmouth.net> writes:
>
> > This addresses https://bugs.launchpad.net/qemu/+bug/752476 which
> > basically points out that using the mouse_button command causes
> > the mouse cursor to warp to the origin (when using absolute
> > pointing device).
> >
> > I've tested this with a kubuntu 10.10 guest and it works fine
> > for me with both relative and absolute pointing devices. Note
> > that testing with realtive pointing device was relatively
> > light.
> >
> > Signed-off-by: Brad Hards <bradh@frogmouth.net>
> > ---
> > monitor.c | 14 +++++++++++++-
> > 1 files changed, 13 insertions(+), 1 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index f1a08dc..0ce162b 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -1879,6 +1879,9 @@ static void do_sendkey(Monitor *mon, const QDict *qdict)
> > muldiv64(get_ticks_per_sec(), hold_time, 1000));
> > }
> >
> > +static int mouse_x;
> > +static int mouse_y;
> > +static int mouse_z;
> > static int mouse_button_state;
> >
> > static void do_mouse_move(Monitor *mon, const QDict *qdict)
> > @@ -1893,13 +1896,22 @@ static void do_mouse_move(Monitor *mon, const QDict *qdict)
> > if (dz_str)
> > dz = strtol(dz_str, NULL, 0);
> > kbd_mouse_event(dx, dy, dz, mouse_button_state);
> > + if (kbd_mouse_is_absolute()) {
> > + mouse_x = dx;
> > + mouse_y = dy;
> > + mouse_z = dz;
> > + }
> > }
> >
> > static void do_mouse_button(Monitor *mon, const QDict *qdict)
> > {
> > int button_state = qdict_get_int(qdict, "button_state");
> > mouse_button_state = button_state;
> > - kbd_mouse_event(0, 0, 0, mouse_button_state);
> > + if (kbd_mouse_is_absolute()) {
> > + kbd_mouse_event(mouse_x, mouse_y, mouse_z, mouse_button_state);
> > + } else {
> > + kbd_mouse_event(0, 0, 0, mouse_button_state);
> > + }
> > }
> >
> > static void do_ioport_read(Monitor *mon, const QDict *qdict)
>
> There's one instance of state: position (if absolute) + buttons for any
> number of mice. Funny things can happen when you have more than one
> mouse and switch between them.
>
> Even if there's just one mouse: the state is updated only for monitor
> mouse action. Funny things can happen when something other than monitor
> commands uses the mouse.
>
> Shouldn't the state be kept per-mouse? Monitor could ask for current
> coordinates + button state then.
>
> Note buttons are already funny. The patch just extends the funniness to
> position. Could be a valid excuse for committing it as is.
I need Gerd's input here, or anyone who has a better idea of the trade offs
involved and how this code should evolve.
next prev parent reply other threads:[~2011-04-08 16:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 7:44 [Qemu-devel] [PATCH] monitor: avoid moving cursor during "mouse_button" command Brad Hards
2011-04-08 9:07 ` Brad Hards
2011-04-08 14:34 ` Markus Armbruster
2011-04-08 16:37 ` Luiz Capitulino [this message]
2011-04-28 10:46 ` Gerd Hoffmann
2011-04-30 0:09 ` Brad Hards
2011-05-02 6:57 ` Gerd Hoffmann
2011-04-09 0:21 ` Brad Hards
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=20110408133708.2a25946a@doriath \
--to=lcapitulino@redhat.com \
--cc=armbru@redhat.com \
--cc=bradh@frogmouth.net \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.