view: replace view_has_children with view_is_transient_for

This is a much cleaner implementation but allows us to do the same
things.
This commit is contained in:
Jente Hidskes 2019-01-30 20:25:29 +01:00
parent 7de253386c
commit 5c403edc0b
5 changed files with 36 additions and 22 deletions

7
seat.c
View file

@ -89,9 +89,14 @@ press_cursor_button(struct cg_seat *seat, struct wlr_input_device *device,
struct wlr_surface *surface;
struct cg_view *view = desktop_view_at(server, lx, ly,
&surface, &sx, &sy);
struct cg_view *current = seat_get_focus(seat);
if (view == current) {
return;
}
/* Focus that client if the button was pressed and
it has no open dialogs. */
if (view && !view_has_children(server, view)) {
if (view && !view_is_transient_for(current, view)) {
seat_set_focus(seat, view);
}
}