* [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse
@ 2013-07-03 12:50 Eugene Shatokhin
2013-07-03 16:08 ` Andreas Färber
0 siblings, 1 reply; 6+ messages in thread
From: Eugene Shatokhin @ 2013-07-03 12:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Eugene Shatokhin, Luiz Capitulino
If absolute positions are used, 'mouse_button' command moved mouse
pointer to (0, 0) before generating a mouse button event. The event was
therefore generated at incorrect position.
This problem is now fixed.
Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
---
monitor.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/monitor.c b/monitor.c
index 9be515c..d742942 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1267,6 +1267,9 @@ static void do_sum(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "%05d\n", sum);
}
+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)
@@ -1281,13 +1284,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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse
2013-07-03 12:50 [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse Eugene Shatokhin
@ 2013-07-03 16:08 ` Andreas Färber
2013-07-03 19:02 ` Eugene Shatokhin
2014-02-25 12:21 ` Eugene Shatokhin
0 siblings, 2 replies; 6+ messages in thread
From: Andreas Färber @ 2013-07-03 16:08 UTC (permalink / raw)
To: Eugene Shatokhin; +Cc: Gerd Hoffmann, qemu-devel, Luiz Capitulino
Am 03.07.2013 14:50, schrieb Eugene Shatokhin:
> If absolute positions are used, 'mouse_button' command moved mouse
> pointer to (0, 0) before generating a mouse button event. The event was
> therefore generated at incorrect position.
>
> This problem is now fixed.
>
> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
This patch has been rejected before. I had suggested a different
solution but that was not fully accepted either and I haven't respun yet:
http://lists.nongnu.org/archive/html/qemu-devel/2013-06/msg02506.html
Andreas
> ---
> monitor.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/monitor.c b/monitor.c
> index 9be515c..d742942 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1267,6 +1267,9 @@ static void do_sum(Monitor *mon, const QDict *qdict)
> monitor_printf(mon, "%05d\n", sum);
> }
>
> +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)
> @@ -1281,13 +1284,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)
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse
2013-07-03 16:08 ` Andreas Färber
@ 2013-07-03 19:02 ` Eugene Shatokhin
2014-02-25 12:21 ` Eugene Shatokhin
1 sibling, 0 replies; 6+ messages in thread
From: Eugene Shatokhin @ 2013-07-03 19:02 UTC (permalink / raw)
To: Andreas Färber; +Cc: Gerd Hoffmann, qemu-devel, Luiz Capitulino
Ah, I see it now. Thanks for the link, I should have found that thread earlier.
Indeed, there can be several mice and keeping the position in global variables is a bad idea here.
Will test your patches when you update them.
Our automated testing system at ROSA Laboratory is quite similar to os-autoinst, so it is no surprise we ran into the same problem.
Thanks again for the info.
Regards,
Eugene
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse
2013-07-03 16:08 ` Andreas Färber
2013-07-03 19:02 ` Eugene Shatokhin
@ 2014-02-25 12:21 ` Eugene Shatokhin
2014-02-25 12:43 ` Gerd Hoffmann
1 sibling, 1 reply; 6+ messages in thread
From: Eugene Shatokhin @ 2014-02-25 12:21 UTC (permalink / raw)
To: Andreas Färber; +Cc: Gerd Hoffmann, qemu-devel, Luiz Capitulino
Hi,
On 07/03/2013 08:08 PM, Andreas Färber wrote:
> Am 03.07.2013 14:50, schrieb Eugene Shatokhin:
>> If absolute positions are used, 'mouse_button' command moved mouse
>> pointer to (0, 0) before generating a mouse button event. The event was
>> therefore generated at incorrect position.
>>
>> This problem is now fixed.
>>
>> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
>
> This patch has been rejected before. I had suggested a different
> solution but that was not fully accepted either and I haven't respun yet:
> http://lists.nongnu.org/archive/html/qemu-devel/2013-06/msg02506.html
>
Any news on this issue? I have just checked qemu 1.7.0 - the problem
still exists there.
Regards,
Eugene
--
Eugene Shatokhin, ROSA
www.rosalab.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse
2014-02-25 12:21 ` Eugene Shatokhin
@ 2014-02-25 12:43 ` Gerd Hoffmann
2014-02-25 13:54 ` Eugene Shatokhin
0 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2014-02-25 12:43 UTC (permalink / raw)
To: Eugene Shatokhin; +Cc: Luiz Capitulino, Andreas Färber, qemu-devel
On Di, 2014-02-25 at 16:21 +0400, Eugene Shatokhin wrote:
> Hi,
>
> On 07/03/2013 08:08 PM, Andreas Färber wrote:
> > Am 03.07.2013 14:50, schrieb Eugene Shatokhin:
> >> If absolute positions are used, 'mouse_button' command moved mouse
> >> pointer to (0, 0) before generating a mouse button event. The event was
> >> therefore generated at incorrect position.
> >>
> >> This problem is now fixed.
> >>
> >> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> >
> > This patch has been rejected before. I had suggested a different
> > solution but that was not fully accepted either and I haven't respun yet:
> > http://lists.nongnu.org/archive/html/qemu-devel/2013-06/msg02506.html
> >
>
> Any news on this issue? I have just checked qemu 1.7.0 - the problem
> still exists there.
I have an outstanding pull request for a input layer rewrite:
http://www.kraxel.org/cgit/qemu/tag/?id=pull-input-2
Once it is merged it should be easy to fix as you can simply generate
mouse button events without having to care about the position at all.
cheers,
Gerd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse
2014-02-25 12:43 ` Gerd Hoffmann
@ 2014-02-25 13:54 ` Eugene Shatokhin
0 siblings, 0 replies; 6+ messages in thread
From: Eugene Shatokhin @ 2014-02-25 13:54 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Luiz Capitulino, Andreas Färber, qemu-devel
On 02/25/2014 04:43 PM, Gerd Hoffmann wrote:
> On Di, 2014-02-25 at 16:21 +0400, Eugene Shatokhin wrote:
>> Hi,
>>
>> On 07/03/2013 08:08 PM, Andreas Färber wrote:
>>> Am 03.07.2013 14:50, schrieb Eugene Shatokhin:
>>>> If absolute positions are used, 'mouse_button' command moved mouse
>>>> pointer to (0, 0) before generating a mouse button event. The event was
>>>> therefore generated at incorrect position.
>>>>
>>>> This problem is now fixed.
>>>>
>>>> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
>>>
>>> This patch has been rejected before. I had suggested a different
>>> solution but that was not fully accepted either and I haven't respun yet:
>>> http://lists.nongnu.org/archive/html/qemu-devel/2013-06/msg02506.html
>>>
>>
>> Any news on this issue? I have just checked qemu 1.7.0 - the problem
>> still exists there.
>
> I have an outstanding pull request for a input layer rewrite:
>
> http://www.kraxel.org/cgit/qemu/tag/?id=pull-input-2
>
> Once it is merged it should be easy to fix as you can simply generate
> mouse button events without having to care about the position at all.
>
> cheers,
> Gerd
>
>
>
Good to know that, thanks!
Regards,
Eugene
--
Eugene Shatokhin, ROSA
www.rosalab.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-25 13:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-03 12:50 [Qemu-devel] [PATCH] monitor: Fix 'mouse_button': do not move mouse Eugene Shatokhin
2013-07-03 16:08 ` Andreas Färber
2013-07-03 19:02 ` Eugene Shatokhin
2014-02-25 12:21 ` Eugene Shatokhin
2014-02-25 12:43 ` Gerd Hoffmann
2014-02-25 13:54 ` Eugene Shatokhin
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.