seat: refactor seat_focus_surface()

This commit is contained in:
Johan Malm 2020-10-06 21:31:01 +01:00
parent 50bcfa00f3
commit e400700a4a
4 changed files with 11 additions and 8 deletions

View file

@ -235,10 +235,12 @@ struct view *desktop_view_at(struct server *server, double lx, double ly,
double *sy, int *view_area);
void cursor_init(struct seat *seat);
void keyboard_init(struct seat *seat);
void seat_init(struct server *server);
void seat_finish(struct server *server);
void seat_focus_surface(struct wlr_surface *surface);
void seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface);
struct wlr_surface *seat_focused_surface(void);
void interactive_begin(struct view *view, enum cursor_mode mode,

View file

@ -93,7 +93,7 @@ void
desktop_focus_view(struct view *view)
{
if (!view) {
seat_focus_surface(NULL);
seat_focus_surface(view->server->seat.seat, NULL);
return;
}
if (view->minimized) {

View file

@ -118,15 +118,14 @@ seat_finish(struct server *server)
}
void
seat_focus_surface(struct wlr_surface *surface)
seat_focus_surface(struct wlr_seat *seat, struct wlr_surface *surface)
{
struct wlr_seat *wlr_seat = current_seat->seat;
if (!surface) {
wlr_seat_keyboard_notify_clear_focus(wlr_seat);
wlr_seat_keyboard_notify_clear_focus(seat);
return;
}
struct wlr_keyboard *kb = &current_seat->keyboard_group->keyboard;
wlr_seat_keyboard_notify_enter(wlr_seat, surface, kb->keycodes,
wlr_seat_keyboard_notify_enter(seat, surface, kb->keycodes,
kb->num_keycodes, &kb->modifiers);
}

View file

@ -38,7 +38,8 @@ unmanaged_handle_map(struct wl_listener *listener, void *data)
unmanaged->ly = xsurface->y;
if (wlr_xwayland_or_surface_wants_focus(xsurface)) {
seat_focus_surface(xsurface->surface);
struct wlr_seat *seat = unmanaged->server->seat.seat;
seat_focus_surface(seat, xsurface->surface);
}
}
@ -59,7 +60,8 @@ unmanaged_handle_unmap(struct wl_listener *listener, void *data)
if (!wlr_xwayland_or_surface_wants_focus(prev)) {
continue;
}
seat_focus_surface(prev->surface);
struct wlr_seat *seat = unmanaged->server->seat.seat;
seat_focus_surface(seat, prev->surface);
return;
}
}