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.shatok...@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