cursor: Allow leave/enter events within the same XDG toplevel

Attempting to open a GTK3 menu and activate a menu item in it,
using a single mouse motion (press-move-release), was broken due
to GTK apparently expecting to receive leave/enter events when the
cursor enters the menu (XDG popup).

To fix the issue, allow leave/enter events when the cursor is
moved between an XDG toplevel and popups of the same.

v2:
 - Use (struct view *) as proxy for toplevel in comparisons
 - Update seat->pressed.surface when entering/leaving popups
v3:
 - Go back to using get_toplevel() rather than (struct view *)
This commit is contained in:
John Lindgren 2022-09-10 01:57:39 -04:00
parent a8fbe1aac2
commit e18f7a32ba
3 changed files with 70 additions and 14 deletions

View file

@ -383,7 +383,8 @@ pressed_surface_destroy(struct wl_listener *listener, void *data)
void
seat_set_pressed(struct seat *seat, struct view *view,
struct wlr_scene_node *node, struct wlr_surface *surface)
struct wlr_scene_node *node, struct wlr_surface *surface,
struct wlr_surface *toplevel)
{
assert(surface);
seat_reset_pressed(seat);
@ -391,6 +392,7 @@ seat_set_pressed(struct seat *seat, struct view *view,
seat->pressed.view = view;
seat->pressed.node = node;
seat->pressed.surface = surface;
seat->pressed.toplevel = toplevel;
seat->pressed_surface_destroy.notify = pressed_surface_destroy;
wl_signal_add(&surface->events.destroy, &seat->pressed_surface_destroy);
}
@ -402,6 +404,7 @@ seat_reset_pressed(struct seat *seat)
seat->pressed.view = NULL;
seat->pressed.node = NULL;
seat->pressed.surface = NULL;
seat->pressed.toplevel = NULL;
wl_list_remove(&seat->pressed_surface_destroy.link);
}
}