fix cursor reset after click triggering overview

f38
Adam Williamson 9 years ago
parent d84fe45880
commit 95983e6f7e

@ -0,0 +1,64 @@
From 400a02e6d34a4e6f1e39ce0377a378cb58ab681b Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 9 Aug 2016 09:43:58 -0700
Subject: [PATCH] assert_and_click: handle undefined previous mouse position
assert_and_click tries to record the previous mouse cursor
position and return the cursor there after clicking. However if
the mouse has never been explicitly positioned anywhere before,
`backend_get_last_mouse_set` returns undefined for each
co-ordinate, which results in a couple of 'use of uninitialized
value in int' warnings and the cursor being set to 0,0, which
may trigger the GNOME overview under Wayland. So catch when the
values are undefined and in this case, call mouse_hide() - which
puts the cursor at bottom-right - instead. This avoids both the
warnings and the overview trigger.
Also fix another uninitialized value warning in `mouse_hide`
while we're at it - check if border_offset is defined before
using it.
---
consoles/vnc_base.pm | 8 +++++---
testapi.pm | 10 ++++++++--
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/consoles/vnc_base.pm b/consoles/vnc_base.pm
index 58d0223..765fb8b 100644
--- a/consoles/vnc_base.pm
+++ b/consoles/vnc_base.pm
@@ -188,9 +188,11 @@ sub mouse_hide {
$self->{mouse}->{x} = $self->{vnc}->width - 1;
$self->{mouse}->{y} = $self->{vnc}->height - 1;
- my $border_offset = int($args->{border_offset});
- $self->{mouse}->{x} -= $border_offset;
- $self->{mouse}->{y} -= $border_offset;
+ if (defined $args->{border_offset}) {
+ my $border_offset = int($args->{border_offset});
+ $self->{mouse}->{x} -= $border_offset;
+ $self->{mouse}->{y} -= $border_offset;
+ }
bmwqemu::diag "mouse_move $self->{mouse}->{x}, $self->{mouse}->{y}";
$self->{vnc}->mouse_move_to($self->{mouse}->{x}, $self->{mouse}->{y});
diff --git a/testapi.pm b/testapi.pm
index 60eb757..1d70bf5 100755
--- a/testapi.pm
+++ b/testapi.pm
@@ -311,8 +311,14 @@ sub assert_and_click {
}
# We can't just move the mouse, or we end up in a click-and-drag situation
sleep 1;
- # move mouse back to where it was before we clicked
- return mouse_set($old_mouse_coords->{x}, $old_mouse_coords->{y});
+ # move mouse back to where it was before we clicked, or to the 'hidden'
+ # position if it had never been positioned
+ if (defined $old_mouse_coords->{x} && defined $old_mouse_coords->{y}) {
+ return mouse_set($old_mouse_coords->{x}, $old_mouse_coords->{y});
+ }
+ else {
+ return mouse_hide();
+ }
}
=head2 assert_and_dclick

@ -31,13 +31,17 @@
Name: os-autoinst
Version: %{github_version}
Release: 20%{?github_date:.%{github_date}git%{shortcommit}}%{?dist}
Release: 21%{?github_date:.%{github_date}git%{shortcommit}}%{?dist}
Summary: OS-level test automation
License: GPLv2+
Group: Development/System
URL: https://os-autoinst.github.io/openQA/
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz
# Fix reset of mouse pointer on assert_and_click to undefined value
# https://github.com/os-autoinst/os-autoinst/pull/559
Patch0: https://patch-diff.githubusercontent.com/raw/os-autoinst/os-autoinst/pull/559.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc-c++
@ -191,6 +195,9 @@ make check VERBOSE=1
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.opensuse.os_autoinst.switch.conf
%changelog
* Tue Aug 09 2016 Adam Williamson <awilliam@redhat.com> - 4.3.21.20160712gitf5bb0fe
- fix an issue with cursor reset after assert_and_click triggering overview
* Tue Jul 12 2016 Adam Williamson <awilliam@redhat.com> - 4.3.20.20160712gitf5bb0fe
- git bump again (still fixing issues related to the shutdown rewrite)

Loading…
Cancel
Save