input: Don't test bogus coordinates in surface jump logic

sx and sy are meaningless (-1000000) when view is NULL. The case this
is meant to catch is when the surface coordinates change while the
global coordinate doesn't, (eg: max/unmax a window with a keyboard
shortcut) - in that case view will always be set.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-10-28 14:09:34 -05:00 committed by Pekka Paalanen
parent eed00f679e
commit 9409ce7024
1 changed files with 7 additions and 2 deletions

View File

@ -456,6 +456,7 @@ default_grab_pointer_focus(struct weston_pointer_grab *grab)
struct weston_pointer *pointer = grab->pointer;
struct weston_view *view;
wl_fixed_t sx, sy;
bool surface_jump = false;
if (pointer->button_count > 0)
return;
@ -463,8 +464,12 @@ default_grab_pointer_focus(struct weston_pointer_grab *grab)
view = weston_compositor_pick_view(pointer->seat->compositor,
pointer->x, pointer->y,
&sx, &sy);
if (view) {
if (pointer->sx != sx || pointer->sy != sy)
surface_jump = true;
}
if (pointer->focus != view || pointer->sx != sx || pointer->sy != sy)
if (pointer->focus != view || surface_jump)
weston_pointer_set_focus(pointer, view);
}
@ -1458,7 +1463,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
if ((!pointer->focus && view) ||
(pointer->focus && !view) ||
(pointer->focus && pointer->focus->surface != view->surface) ||
pointer->sx != sx || pointer->sy != sy)
(view && (pointer->sx != sx || pointer->sy != sy)))
refocus = 1;
if (pointer->focus_client && refocus) {